diff --git a/napalm_s350/s350.py b/napalm_s350/s350.py index 55e8598..44751a5 100644 --- a/napalm_s350/s350.py +++ b/napalm_s350/s350.py @@ -408,7 +408,10 @@ class S350Driver(NetworkDriver): for status_line in show_status_output.splitlines(): if 'Up' in status_line or 'Down' in status_line: - interface, _, _, speed, _, _, link_state, _, _ = status_line.split() + if "Po" in status_line: + interface, _, _, speed, _, _, link_state = status_line.split() + else: + interface, _, _, speed, _, _, link_state, _, _ = status_line.split() # Since the MAC address for all the local ports are equal, get the address # from the first port and use it everywhere. diff --git a/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/expected_result.json b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/expected_result.json new file mode 100644 index 0000000..f197b9c --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/expected_result.json @@ -0,0 +1,101 @@ +{ + "gi1": { + "description": "test1", + "is_enabled": true, + "is_up": true, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 1000 + }, + "gi10": { + "description": "", + "is_enabled": false, + "is_up": false, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 0 + }, + "gi2": { + "description": "test2", + "is_enabled": false, + "is_up": false, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 0 + }, + "gi3": { + "description": "", + "is_enabled": false, + "is_up": false, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 0 + }, + "gi4": { + "description": "", + "is_enabled": false, + "is_up": false, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 0 + }, + "gi5": { + "description": "test5", + "is_enabled": false, + "is_up": false, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 0 + }, + "gi6": { + "description": "", + "is_enabled": true, + "is_up": true, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 1000 + }, + "gi7": { + "description": "", + "is_enabled": false, + "is_up": false, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 0 + }, + "gi8": { + "description": "", + "is_enabled": true, + "is_up": true, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 1000 + }, + "gi9": { + "description": "", + "is_enabled": false, + "is_up": false, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 0 + }, + "Po1": { + "description": "", + "is_enabled": true, + "is_up": true, + "last_flapped": -1.0, + "mac_address": "50:F7:22:AA:BB:CC", + "mtu": 1518, + "speed": 1000 + } +} diff --git a/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_interfaces_description.txt b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_interfaces_description.txt new file mode 100644 index 0000000..4919a57 --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_interfaces_description.txt @@ -0,0 +1,23 @@ +Port Description +------- ----------- +gi1 test1 +gi2 test2 +gi3 +gi4 +gi5 test5 +gi6 +gi7 +gi8 +gi9 +gi10 + +Ch Description +------- ----------- +Po1 +Po2 +Po3 +Po4 +Po5 +Po6 +Po7 +Po8 diff --git a/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_interfaces_status.txt b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_interfaces_status.txt new file mode 100644 index 0000000..f51c5d2 --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_interfaces_status.txt @@ -0,0 +1,25 @@ + Flow Link Back Mdix +Port Type Duplex Speed Neg ctrl State Pressure Mode +-------- ------------ ------ ----- -------- ---- ----------- -------- ------- +gi1 1G-Copper Full 1000 Enabled Off Up Disabled On +gi2 1G-Copper -- -- -- -- Down -- -- +gi3 1G-Copper -- -- -- -- Down -- -- +gi4 1G-Copper -- -- -- -- Down -- -- +gi5 1G-Copper -- -- -- -- Down -- -- +gi6 1G-Copper Full 1000 Enabled Off Up Disabled Off +gi7 1G-Copper -- -- -- -- Down -- -- +gi8 1G-Copper Full 1000 Enabled Off Up Disabled On +gi9 1G-Combo-C -- -- -- -- Down -- -- +gi10 1G-Combo-C -- -- -- -- Down -- -- + + Flow Link +Ch Type Duplex Speed Neg control State +-------- ------- ------ ----- -------- ------- ----------- +Po1 1G Full 1000 Enabled Off Up +Po2 -- -- -- -- -- Not Present +Po3 -- -- -- -- -- Not Present +Po4 -- -- -- -- -- Not Present +Po5 -- -- -- -- -- Not Present +Po6 -- -- -- -- -- Not Present +Po7 -- -- -- -- -- Not Present +Po8 -- -- -- -- -- Not Present diff --git a/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_lldp_local_gi1.txt b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_lldp_local_gi1.txt new file mode 100644 index 0000000..4ae9b8e --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_lldp_local_gi1.txt @@ -0,0 +1,19 @@ + +Device ID: 50:f7:22:aa:bb:cc +Port ID: gi1 +Capabilities: Bridge +System Name: switchaabbcc + +802.3 EEE: + +17 +17 +17 +17 + + +802.1 PVID: 1 +802.1 PPVID: +802.1 VLAN: +802.1 Protocol: + diff --git a/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_ports_jumbo_frame.txt b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_ports_jumbo_frame.txt new file mode 100644 index 0000000..4aafdc0 --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/SG300-10-portchannel/show_ports_jumbo_frame.txt @@ -0,0 +1,3 @@ + + Jumbo frames are disabled + Jumbo frames will be disabled after reset