napalm-automation-community / napalm-s350

NAPALM driver for Cisco SMB switches (SF3xx, SF5xx, SG3xx, SG5xx).
Apache License 2.0
16 stars 13 forks source link

SG300-10 support #20

Closed Phill93 closed 3 years ago

Phill93 commented 3 years ago

Hi,

i have some SG300-10 running and want to make this driver compatible.

Here are my first tests:

Phill93 commented 3 years ago

get_facts:

Command: show version

Output SG550-24F OS: 2.5.0.92

Active-image: flash://system/images/BnfVnkjOxGR8rQptJEA4E8F3vaTpEBpJ
  Version: 2.5.0.92
  MD5 Digest: f5ff4025a747ad66c7fd49b68d322557
  Date: 26-Nov-2019
  Time: 13:31:40
Inactive-image: flash://system/images/rAkXNOcQiDA93GefuQ3v1wq454SIjziS
  Version: 2.5.0.92
  MD5 Digest: f5ff4025a747ad66c7fd49b68d322557
  Date: 26-Nov-2019
  Time: 13:31:40

Output SG300-10 OS: 1.4.11.5

SW version    1.4.11.5 ( date  08-Apr-2020 time  13:49:34 )
Boot version    1.3.5.06 ( date  21-Jul-2013 time  15:12:10 )
HW version    V05

Fix: https://github.com/KIT-IAI/napalm-s350/commit/5bc1bce26f7825d7f6a477a2ed282d0dd3407772

Phill93 commented 3 years ago

get_arp_table Command: show arp | include (static|dynamic)

Output SG350-10 OS: 2.4.0.94

vlan 1     gi8        192.168.1.1     9c:eb:e8:52:bd:7c   dynamic
vlan 1     gi8        192.168.1.2     0c:37:96:00:15:cb   dynamic

Output SG300-10 OS: 1.4.11.5

% Wrong number of parameters or invalid range, size or characters entered

Problem: include is not available on os version lower 2.0

Fix: https://github.com/KIT-IAI/napalm-s350/commit/7a1f027cdb6d067bcb0a020df85ee1fcbe7e3b0d

Phill93 commented 3 years ago

get_interfaces Commands:

Output SG350-10 OS: 2.4.0.94:

switchc23cf0#show interfaces status | include (Up|Down)
gi1      1G-Copper      --      --     --     --  Down           --     --
gi2      1G-Copper      --      --     --     --  Down           --     --
gi3      1G-Copper      --      --     --     --  Down           --     --
gi4      1G-Copper      --      --     --     --  Down           --     --
gi5      1G-Copper      --      --     --     --  Down           --     --
gi6      1G-Copper      --      --     --     --  Down           --     --
gi7      1G-Copper      --      --     --     --  Down           --     --
gi8      1G-Copper    Full    1000  Enabled  Off  Up          Disabled On
gi9      1G-Combo-C     --      --     --     --  Down           --     --
gi10     1G-Combo-C     --      --     --     --  Down           --     --
switchc23cf0#show interfaces description
Port      Description
-------   -----------
gi1
gi2
gi3
gi4
gi5
gi6
gi7
gi8
gi9
gi10

Ch        Description
-------   -----------
Po1
Po2
Po3
Po4
Po5
Po6
Po7
Po8
switchc23cf0#show lldp local GigabitEthernet1 | begin Device\ ID
Device ID: 00:a5:bf:c2:3c:f0
Port ID: gi1
Capabilities: Bridge, Router
System Name: switchc23cf0
Management address: 192.168.1.253
Management address: fe80::2a5:bfff:fec2:3cf0%vlan1

802.3 Power Via Mdi:
 MDI Power support Port Class: PSE
 PSE MDI Power Support: Not supported
 PSE MDI Power State: Not enabled
 PSE power pair control ability: Not supported
 PSE Power Pair: Signal
 PSE Power class: 1
 Power Type: Type 2 PSE
 Power Source: Unknown Power Source
 Power Priority: unknown
 PSE Allocated Power Value: 0.0

802.1 PVID: 1
802.1 PPVID:
802.1 VLAN:
802.1 Protocol:

Output SG300-10 OS: 1.4.11.5

switchf5bcdb#show interfaces status | include (Up|Down)
% Wrong number of parameters or invalid range, size or characters entered
switchf5bcdb#show interfaces description
Port      Description
-------   -----------
gi1
gi2
gi3
gi4
gi5
gi6
gi7
gi8
gi9
gi10

Ch        Description
-------   -----------
Po1
Po2
Po3
Po4
Po5
Po6
Po7
Po8
switchf5bcdb#show lldp local GigabitEthernet1 | begin Device\ ID
% Wrong number of parameters or invalid range, size or characters entered

Problem: include and begin are not available on os version lower 2.0

Fix: https://github.com/KIT-IAI/napalm-s350/commit/5a2d22302ad2d4a4af1961eb5c096377d85c41e3

Phill93 commented 3 years ago

get_interfaces_ip command: show ip int | include (UP|DOWN)

Output SG350-10 OS: 2.4.0.94:

switchc23cf0#show ip int | include (UP|DOWN)
192.168.1.253/24   vlan 1    UP/UP      Static  disable   No   enable   Valid

Output SG300-10 OS: 1.4.11.5

switchf5bcdb#show ip int | include (UP|DOWN)
% Unrecognized command

Problem: include is not available on os version lower 2.0

Fix: https://github.com/KIT-IAI/napalm-s350/commit/c7d6577a2ca1ac145b4b41b0021856d9c362c3a6

Phill93 commented 3 years ago

get_lldp_neighbors command: show lldp neighbors | begin \ \ Port

Output SG350-10 OS: 2.4.0.94:

switchc23cf0#show lldp neighbors | begin \ \ Port
  Port        Device ID          Port ID         System Name    Capabilities  TTL
--------- ----------------- ----------------- ----------------- ------------ -----
gi8       50:f7:22:f5:bc:db        gi7          switchf5bcdb         B        96

Output SG300-10 OS: 1.4.11.5

switchf5bcdb#show lldp neighbors | begin \ \ Port
% Wrong number of parameters or invalid range, size or characters entered

Problem: begin is not available on os version lower 2.0

Fix: https://github.com/KIT-IAI/napalm-s350/commit/711bfbc1baa80fb81ca0b7821336d312bf844dbd

qaxi commented 3 years ago

Wonerfull job!!! As far as I can check it is OK. Can you make pull request please?

And ... I am working on Unit tests now, it would be handy to get full output of all used commands for as much device types as possible ...

I can do it on SG550X stack, SG550X, SG500 stack. Can you help me to get more?

qaxi commented 3 years ago

For now we need output of those commands: `# setup terminal terminal datadump terminal width 0 terminal no prompt

show inventory show version show system show interfaces status show interfaces description

choose any physical interface on your device

show lldp local GigabitEthernet1 show lldp local GigabitEthernet1/1 show lldp local GigabitEthernet1/0/1

show ip interface show ip route show lldp neighbors

choose any interface with attached neighbor

show lldp neighbor GigabitEthernet1

show sntp status show hosts show arp show startup-config show running-config `

Phill93 commented 3 years ago

Currently I am not finished yet. I will make a Pull Request when I am finished.

I can deliver outputs for the following device types:

Phill93 commented 3 years ago

get_lldp_neighbors_detail

Working after get_lldp_neighbors is fixed

Fix: not needed

Phill93 commented 3 years ago

get_ntp_servers

command: show sntp status | include Server

problem: include command

Fix: https://github.com/KIT-IAI/napalm-s350/commit/e74495ffb994c08f0bde195980c49642d702f5a8

qaxi commented 3 years ago

Hello, Good job, I will take look at it ASAP. I worked on unit tests in napalm-s350/test/unit/mocked_data for my device SG350X-48P . You can test it by 'pytest' If you mind, you could put there outputs for SG300-10, SG500-28 I do not have X00 devices. Do you have an Stack of switches? I have SG550X-48 stack and I am planing to provid unit tests in near future.

qaxi commented 3 years ago

It is merged to master, but a lot of - probably incompatible - changes were made in develop ...

Phill93 commented 3 years ago

Do you have an Stack of switches? I have SG550X-48 stack and I am planing to provid unit tests in near future.

I have a stack with three SG500-28

qaxi commented 3 years ago

That is perfect so we can provide full range of command output for unit tests ...