-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds mac, ip checks for getters #1560
Merged
+570
−372
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
70f7b4e
adds mac and ip checks for get_lldp_neighbors, get_lldp_neighbors_det…
ef8ef7c
Merge branch 'develop' into x-issue451
985a3de
Merge branch 'develop' into x-issue451
mirceaulinic bae734a
Update napalm/ios/ios.py
864da80
change chassis id to convert addressing Mircea's suggestion
1ef34de
add default option to convert
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 38 additions & 32 deletions
70
test/ios/mocked_data/test_get_interfaces_ip/normal/expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
{ | ||
"Vlan20": { | ||
"ipv4": { | ||
"172.29.50.3": { | ||
"prefix_length": 27 | ||
} | ||
}, | ||
"ipv6": { | ||
"FE80::C009:24FF:FEAC:0": { | ||
"prefix_length": 10 | ||
}, | ||
"2002::1": { | ||
"prefix_length": 64 | ||
} | ||
} | ||
}, | ||
"Vlan41": { | ||
"ipv4": { | ||
"172.29.52.34": { | ||
"prefix_length": 27 | ||
}, | ||
"192.168.81.34": { | ||
"prefix_length": 24 | ||
} | ||
} | ||
}, | ||
"Loopback0": { | ||
"ipv6": { | ||
"FE80::C009:24FF:FEAC:0": {"prefix_length": 10}, | ||
"2001::1": {"prefix_length": 128}, | ||
"2001::2": {"prefix_length": 128} | ||
} | ||
} | ||
"Vlan20": { | ||
"ipv4": { | ||
"172.29.50.3": { | ||
"prefix_length": 27 | ||
} | ||
}, | ||
"ipv6": { | ||
"fe80::c009:24ff:feac:0": { | ||
"prefix_length": 10 | ||
}, | ||
"2002::1": { | ||
"prefix_length": 64 | ||
} | ||
} | ||
}, | ||
"Vlan41": { | ||
"ipv4": { | ||
"172.29.52.34": { | ||
"prefix_length": 27 | ||
}, | ||
"192.168.81.34": { | ||
"prefix_length": 24 | ||
} | ||
} | ||
}, | ||
"Loopback0": { | ||
"ipv6": { | ||
"fe80::c009:24ff:feac:0": { | ||
"prefix_length": 10 | ||
}, | ||
"2001::1": { | ||
"prefix_length": 128 | ||
}, | ||
"2001::2": { | ||
"prefix_length": 128 | ||
} | ||
} | ||
} | ||
} |
24 changes: 12 additions & 12 deletions
24
test/ios/mocked_data/test_get_lldp_neighbors/missing_hostname/expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"FastEthernet0/24": [ | ||
{ | ||
"port": "Fa0/19", | ||
"hostname": "switch1" | ||
} | ||
], | ||
"FastEthernet0/17": [ | ||
{ | ||
"port": "480f.cf28.8a1b", | ||
"hostname": "480f.cf28.8a1b" | ||
} | ||
] | ||
"FastEthernet0/24": [ | ||
{ | ||
"port": "Fa0/19", | ||
"hostname": "switch1" | ||
} | ||
], | ||
"FastEthernet0/17": [ | ||
{ | ||
"port": "48:0F:CF:28:8A:1B", | ||
"hostname": "48:0F:CF:28:8A:1B" | ||
} | ||
] | ||
} |
44 changes: 22 additions & 22 deletions
44
test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate/expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
{ | ||
"GigabitEthernet1": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "2cc2.603e.363b", | ||
"remote_port": "Management1", | ||
"remote_port_description": "", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_description": "Arista Networks EOS version 4.15.2F running on an Arista Networks vEOS", | ||
"remote_system_enable_capab": ["bridge", "router"], | ||
"remote_system_name": "eos-spine1.ntc.com" | ||
}, | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "0005.8671.58c0", | ||
"remote_port": "fxp0", | ||
"remote_port_description": "fxp0", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_description": "Juniper Networks, Inc. vmx internet router, kernel JUNOS 15.1F4.15, Build date: 2015-12-23 19:22:55 UTC Copyright (c) 1996-2015 Juniper Networks, Inc.", | ||
"remote_system_enable_capab": ["bridge", "router"], | ||
"remote_system_name": "vmx1" | ||
} | ||
] | ||
"GigabitEthernet1": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "2C:C2:60:3E:36:3B", | ||
"remote_port": "Management1", | ||
"remote_port_description": "", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_description": "Arista Networks EOS version 4.15.2F running on an Arista Networks vEOS", | ||
"remote_system_enable_capab": ["bridge", "router"], | ||
"remote_system_name": "eos-spine1.ntc.com" | ||
}, | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "00:05:86:71:58:C0", | ||
"remote_port": "fxp0", | ||
"remote_port_description": "fxp0", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_description": "Juniper Networks, Inc. vmx internet router, kernel JUNOS 15.1F4.15, Build date: 2015-12-23 19:22:55 UTC Copyright (c) 1996-2015 Juniper Networks, Inc.", | ||
"remote_system_enable_capab": ["bridge", "router"], | ||
"remote_system_name": "vmx1" | ||
} | ||
] | ||
} |
48 changes: 24 additions & 24 deletions
48
test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate2/expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
{ | ||
"FastEthernet0/24": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "a40c.c3c1.3980", | ||
"remote_port": "Fa0/19", | ||
"remote_port_description": "FastEthernet0/19", | ||
"remote_system_capab": ["bridge"], | ||
"remote_system_description": "Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(1)SE2, RELEASE SOFTWARE (fc3)", | ||
"remote_system_enable_capab": ["bridge"], | ||
"remote_system_name": "switch1" | ||
} | ||
], | ||
"FastEthernet0/17": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "480f.cf28.8a1b", | ||
"remote_port": "480f.cf28.8a1b", | ||
"remote_port_description": "", | ||
"remote_system_capab": [], | ||
"remote_system_description": "", | ||
"remote_system_enable_capab": [], | ||
"remote_system_name": "" | ||
} | ||
] | ||
"FastEthernet0/24": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "A4:0C:C3:C1:39:80", | ||
"remote_port": "Fa0/19", | ||
"remote_port_description": "FastEthernet0/19", | ||
"remote_system_capab": ["bridge"], | ||
"remote_system_description": "Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(1)SE2, RELEASE SOFTWARE (fc3)", | ||
"remote_system_enable_capab": ["bridge"], | ||
"remote_system_name": "switch1" | ||
} | ||
], | ||
"FastEthernet0/17": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_chassis_id": "48:0F:CF:28:8A:1B", | ||
"remote_port": "480f.cf28.8a1b", | ||
"remote_port_description": "", | ||
"remote_system_capab": [], | ||
"remote_system_description": "", | ||
"remote_system_enable_capab": [], | ||
"remote_system_name": "" | ||
} | ||
] | ||
} |
112 changes: 56 additions & 56 deletions
112
test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate4/expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
{ | ||
"GigabitEthernet1": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi1", | ||
"remote_port_description": "GigabitEthernet1", | ||
"remote_chassis_id": "001e.bd3a.f900", | ||
"remote_system_name": "csr9.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
}, | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi1", | ||
"remote_port_description": "GigabitEthernet1", | ||
"remote_chassis_id": "001e.bd60.ee00", | ||
"remote_system_name": "csr8.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
}, | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi1", | ||
"remote_port_description": "GigabitEthernet1", | ||
"remote_chassis_id": "001e.e507.ed00", | ||
"remote_system_name": "csr12.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
} | ||
], | ||
"GigabitEthernet2": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi2", | ||
"remote_port_description": "GigabitEthernet2", | ||
"remote_chassis_id": "001e.bd3a.f900", | ||
"remote_system_name": "csr9.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
} | ||
], | ||
"GigabitEthernet4": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi4", | ||
"remote_port_description": "GigabitEthernet4", | ||
"remote_chassis_id": "001e.bd60.ee00", | ||
"remote_system_name": "csr8.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
} | ||
] | ||
"GigabitEthernet1": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi1", | ||
"remote_port_description": "GigabitEthernet1", | ||
"remote_chassis_id": "00:1E:BD:3A:F9:00", | ||
"remote_system_name": "csr9.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
}, | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi1", | ||
"remote_port_description": "GigabitEthernet1", | ||
"remote_chassis_id": "00:1E:BD:60:EE:00", | ||
"remote_system_name": "csr8.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
}, | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi1", | ||
"remote_port_description": "GigabitEthernet1", | ||
"remote_chassis_id": "00:1E:E5:07:ED:00", | ||
"remote_system_name": "csr12.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
} | ||
], | ||
"GigabitEthernet2": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi2", | ||
"remote_port_description": "GigabitEthernet2", | ||
"remote_chassis_id": "00:1E:BD:3A:F9:00", | ||
"remote_system_name": "csr9.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
} | ||
], | ||
"GigabitEthernet4": [ | ||
{ | ||
"parent_interface": "", | ||
"remote_port": "Gi4", | ||
"remote_port_description": "GigabitEthernet4", | ||
"remote_chassis_id": "00:1E:BD:60:EE:00", | ||
"remote_system_name": "csr8.bogus.com", | ||
"remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", | ||
"remote_system_capab": ["bridge", "router"], | ||
"remote_system_enable_capab": ["router"] | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this regex check, I'd just apply the
convert
function instead, e.g.,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick review and all the suggestions. Just checking: I agree with your suggestion, but if the chassis id cannot be converted, an empty chassis id will be returned. This is an example value from a chassis id from one of the tests:
Is that OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have addressed the comment with the latest commit. Let me know what you think @mirceaulinic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there should be a third argument, with the default, notice in the suggestion above:
When unable to convert to the normalised MAC format, it'd default to the extracted value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the help! Added.