-
Notifications
You must be signed in to change notification settings - Fork 558
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
IOS driver get_network_instances fix #1095
Merged
mirceaulinic
merged 15 commits into
napalm-automation:develop
from
chonty:ios-get_network_instances
Aug 6, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7832d0a
IOS driver get_network_instances fix
chonty 223572a
Fix for SVIs
chonty 6cb927f
Merge branch 'develop' into ios-get_network_instances
mirceaulinic dc0e166
changed formatting and ' to "
4ee44f9
Merge branch 'develop' into ios-get_network_instances
mirceaulinic e190a50
Merge branch 'develop' into ios-get_network_instances
mirceaulinic a54ceba
error handling: ret default instance when no VRFs
chonty 8522d24
tests
chonty dfc0986
Merge branch 'develop' into ios-get_network_instances
mirceaulinic 71ffa51
updated test cases
chonty 3f9dbcc
Merge branch 'ios-get_network_instances' of github.com:chonty/napalm …
chonty 4dff67c
reverted original test case changes
chonty fa32c39
undo a54ceba
chonty b53673b
reverted original test case changes properly
chonty cb09cbf
update 'normal' test case
chonty 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
33 changes: 33 additions & 0 deletions
33
test/ios/mocked_data/test_get_network_instances/no_vrf_svis/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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"default": { | ||
"name": "default", | ||
"type": "DEFAULT_INSTANCE", | ||
"state": { | ||
"route_distinguisher": "" | ||
}, | ||
"interfaces": { | ||
"interface": { | ||
"Ethernet0/0": {}, | ||
"Ethernet0/1": {}, | ||
"Ethernet0/2": {}, | ||
"Ethernet0/3": {}, | ||
"Ethernet1/0": {}, | ||
"Ethernet1/1": {}, | ||
"Ethernet1/2": {}, | ||
"Ethernet1/3": {}, | ||
"Ethernet2/0": {}, | ||
"Ethernet2/1": {}, | ||
"Ethernet2/2": {}, | ||
"Ethernet2/3": {}, | ||
"Ethernet3/0": {}, | ||
"Ethernet3/1": {}, | ||
"Ethernet3/2": {}, | ||
"Ethernet3/3": {}, | ||
"Vlan1": {}, | ||
"Vlan2": {}, | ||
"Vlan3": {}, | ||
"Vlan4": {} | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
test/ios/mocked_data/test_get_network_instances/no_vrf_svis/show_ip_interface_brief.txt
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Interface IP-Address OK? Method Status Protocol | ||
Ethernet0/0 172.29.29.220 YES manual up up | ||
Ethernet0/1 unassigned YES unset up up | ||
Ethernet0/2 unassigned YES unset up up | ||
Ethernet0/3 unassigned YES unset up up | ||
Ethernet1/0 unassigned YES unset up up | ||
Ethernet1/1 unassigned YES unset up up | ||
Ethernet1/2 unassigned YES unset up up | ||
Ethernet1/3 unassigned YES unset up up | ||
Ethernet2/0 unassigned YES unset up up | ||
Ethernet2/1 unassigned YES unset up up | ||
Ethernet2/2 unassigned YES unset up up | ||
Ethernet2/3 unassigned YES unset up up | ||
Ethernet3/0 unassigned YES unset up up | ||
Ethernet3/1 unassigned YES unset up up | ||
Ethernet3/2 unassigned YES unset up up | ||
Ethernet3/3 unassigned YES unset up up | ||
Vlan1 unassigned YES unset administratively down down | ||
Vlan2 2.2.2.2 YES manual up up | ||
Vlan3 3.3.3.3 YES manual up up | ||
Vlan4 4.4.4.4 YES manual up up |
Empty file.
128 changes: 58 additions & 70 deletions
128
test/ios/mocked_data/test_get_network_instances/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,78 +1,66 @@ | ||
{ | ||
"default":{ | ||
"interfaces":{ | ||
"interface":{ | ||
"GigabitEthernet0/0/0":{ | ||
|
||
}, | ||
"Gi0/0/0.152":{ | ||
|
||
}, | ||
"GigabitEthernet0/0/2":{ | ||
|
||
}, | ||
"Gi0/0/0.1774":{ | ||
|
||
}, | ||
"GigabitEthernet0/0/4":{ | ||
|
||
}, | ||
"Gi0/0/0.1772":{ | ||
|
||
}, | ||
"GigabitEthernet0/0/3":{ | ||
|
||
}, | ||
"Gi0/0/0.154":{ | ||
|
||
}, | ||
"GigabitEthernet0/0/1":{ | ||
|
||
}, | ||
"GigabitEthernet0":{ | ||
|
||
}, | ||
"Gi0/0/0.1776":{ | ||
|
||
}, | ||
"Gi0/0/0.600":{ | ||
|
||
}, | ||
"Loopback2":{ | ||
|
||
} | ||
} | ||
}, | ||
"state":{ | ||
"route_distinguisher":"" | ||
"default": { | ||
"name": "default", | ||
"type": "DEFAULT_INSTANCE", | ||
"state": { | ||
"route_distinguisher": "" | ||
}, | ||
"type":"DEFAULT_INSTANCE", | ||
"name":"default" | ||
}, | ||
"Mgmt-intf":{ | ||
"interfaces":{ | ||
"interface":{ | ||
"Gi0":{ | ||
|
||
} | ||
"interfaces": { | ||
"interface": { | ||
"Ethernet0/0": {}, | ||
"Ethernet0/1": {}, | ||
"Ethernet0/2": {}, | ||
"Ethernet0/3": {}, | ||
"Ethernet1/0": {}, | ||
"Ethernet1/1": {}, | ||
"Ethernet1/2": {}, | ||
"Ethernet1/3": {}, | ||
"Ethernet2/0": {}, | ||
"Ethernet2/1": {}, | ||
"Ethernet2/2": {}, | ||
"Ethernet2/3": {}, | ||
"Ethernet3/0": {}, | ||
"Ethernet3/1": {}, | ||
"Ethernet3/2": {}, | ||
"Ethernet3/3": {}, | ||
"Vlan1": {} | ||
} | ||
}, | ||
"state":{ | ||
"route_distinguisher":"" | ||
}, | ||
"type":"L3VRF", | ||
"name":"Mgmt-intf" | ||
} | ||
}, | ||
"opsnet":{ | ||
"interfaces":{ | ||
"interface":{ | ||
|
||
"CustA": { | ||
"name": "CustA", | ||
"type": "L3VRF", | ||
"state": { | ||
"route_distinguisher": "1:1" | ||
}, | ||
"interfaces": { | ||
"interface": { | ||
"Vlan2": {} | ||
} | ||
} | ||
}, | ||
"CustB": { | ||
"name": "CustB", | ||
"type": "L3VRF", | ||
"state": { | ||
"route_distinguisher": "2:2" | ||
}, | ||
"state":{ | ||
"route_distinguisher":"10283:1021312690" | ||
"interfaces": { | ||
"interface": { | ||
"Vlan3": {} | ||
} | ||
} | ||
}, | ||
"CustC": { | ||
"name": "CustC", | ||
"type": "L3VRF", | ||
"state": { | ||
"route_distinguisher": "3:3" | ||
}, | ||
"type":"L3VRF", | ||
"name":"opsnet" | ||
"interfaces": { | ||
"interface": { | ||
"Vlan4": {} | ||
} | ||
} | ||
} | ||
} | ||
} |
36 changes: 20 additions & 16 deletions
36
test/ios/mocked_data/test_get_network_instances/normal/show_ip_interface_brief.txt
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,17 +1,21 @@ | ||
Load for five secs: 0%/0%; one minute: 1%; five minutes: 1% | ||
Time source is NTP, 09:30:03.851 DST Wed Nov 8 2017 | ||
|
||
Interface IP-Address OK? Method Status Protocol | ||
GigabitEthernet0/0/0 unassigned YES NVRAM up up | ||
Gi0/0/0.152 192.168.241.21 YES NVRAM up up | ||
Gi0/0/0.154 192.168.241.30 YES NVRAM up up | ||
Gi0/0/0.600 192.168.241.141 YES NVRAM up up | ||
Gi0/0/0.1772 120.177.177.1 YES NVRAM up up | ||
Gi0/0/0.1774 101.177.177.1 YES NVRAM up up | ||
Gi0/0/0.1776 100.177.177.1 YES NVRAM up up | ||
GigabitEthernet0/0/1 unassigned YES NVRAM administratively down down | ||
GigabitEthernet0/0/2 unassigned YES NVRAM administratively down down | ||
GigabitEthernet0/0/3 unassigned YES NVRAM administratively down down | ||
GigabitEthernet0/0/4 unassigned YES NVRAM administratively down down | ||
GigabitEthernet0 192.168.243.80 YES NVRAM up up | ||
Loopback2 192.168.242.152 YES NVRAM up up | ||
Ethernet0/0 172.29.29.220 YES manual up up | ||
Ethernet0/1 unassigned YES unset up up | ||
Ethernet0/2 unassigned YES unset up up | ||
Ethernet0/3 unassigned YES unset up up | ||
Ethernet1/0 unassigned YES unset up up | ||
Ethernet1/1 unassigned YES unset up up | ||
Ethernet1/2 unassigned YES unset up up | ||
Ethernet1/3 unassigned YES unset up up | ||
Ethernet2/0 unassigned YES unset up up | ||
Ethernet2/1 unassigned YES unset up up | ||
Ethernet2/2 unassigned YES unset up up | ||
Ethernet2/3 unassigned YES unset up up | ||
Ethernet3/0 unassigned YES unset up up | ||
Ethernet3/1 unassigned YES unset up up | ||
Ethernet3/2 unassigned YES unset up up | ||
Ethernet3/3 unassigned YES unset up up | ||
Vlan1 unassigned YES unset administratively down down | ||
Vlan2 2.2.2.2 YES manual up up | ||
Vlan3 3.3.3.3 YES manual up up | ||
Vlan4 4.4.4.4 YES manual up up |
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
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.
I'd ask you to refrain from changing the existing test-cases, but just add new ones (as you already did). In other words, please keep the
no_vrf
case and revert the changes undernormal
. Of course, if there's anything incorrect with the existing data, please clarify here.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.
Sure. I just re-read the PR description and the test data I threw together was irrelevant anyway. New test cases incoming.
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.
Relevant test cases added and I dirty reverted the originals by copying them and pushing them again with 4dff67c. Hopefully that's not a problem.
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.
made a dog's breakfast out of that. The normal test case is now failing in a way I don't understand:
and the data is actually invalid. GigabitEthernet0 appears in both default and Mgmt-intf instances which this PR corrects.
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.
No problem at all, I don't mind what method you use as long as we get to there ;)
Looks like the tests are failing on the
normal
test case now, I think you can just copy the content from https://github.com/napalm-automation/napalm/tree/develop/test/ios/mocked_data/test_get_network_instances/normal and should be fine.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.
The tests were failing with https://github.com/napalm-automation/napalm/tree/develop/test/ios/mocked_data/test_get_network_instances/normal for some reason and the data was invalid anyway because Gi0 in Mgmt-intf unwraps to GigabitEthernet0 which also appears in the default instance. Replaced the test case with my new one.
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.
Okay, makes sense