-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: fix vrf detection when no vrf is defined (#938)
* FIX: fix vrf detection when no vrf is defined Right now an exception is raized when no vrf is defined. It will now return the default instances list. Also catch a few unhandle errors when vrf name does not exists. A ValueError exception is now raised with an explaination. * Add test where novrf is defined Add a new test for ios to match the case where no vrf is setup on the equipment * Fix current black issue on ios.py * Narrow exception catching .. It makes pylama happy, and was not a recommanded usage. Co-authored-by: Frederic Brin <frederic.brin@exane.com>
- Loading branch information
1 parent
fdf91d9
commit c35d503
Showing
4 changed files
with
165 additions
and
6 deletions.
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
76 changes: 76 additions & 0 deletions
76
test/ios/mocked_data/test_get_network_instances/novrf/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,76 @@ | ||
{ | ||
"default": { | ||
"name": "default", | ||
"type": "DEFAULT_INSTANCE", | ||
"state": { | ||
"route_distinguisher": "" | ||
}, | ||
"interfaces": { | ||
"interface": { | ||
"Vlan1": {}, | ||
"Vlan1980": {}, | ||
"Vlan1981": {}, | ||
"Vlan1982": {}, | ||
"Vlan1983": {}, | ||
"Vlan1984": {}, | ||
"Vlan1985": {}, | ||
"Vlan1986": {}, | ||
"Vlan1987": {}, | ||
"GigabitEthernet1/0/1": {}, | ||
"GigabitEthernet1/0/2": {}, | ||
"GigabitEthernet1/0/3": {}, | ||
"GigabitEthernet1/0/4": {}, | ||
"GigabitEthernet1/0/5": {}, | ||
"GigabitEthernet1/0/6": {}, | ||
"GigabitEthernet1/0/7": {}, | ||
"GigabitEthernet1/0/8": {}, | ||
"GigabitEthernet1/0/9": {}, | ||
"GigabitEthernet1/0/10": {}, | ||
"GigabitEthernet1/0/11": {}, | ||
"GigabitEthernet1/0/12": {}, | ||
"GigabitEthernet1/0/13": {}, | ||
"GigabitEthernet1/0/14": {}, | ||
"GigabitEthernet1/0/15": {}, | ||
"GigabitEthernet1/0/16": {}, | ||
"GigabitEthernet1/0/17": {}, | ||
"GigabitEthernet1/0/18": {}, | ||
"GigabitEthernet1/0/19": {}, | ||
"GigabitEthernet1/0/20": {}, | ||
"GigabitEthernet1/0/21": {}, | ||
"GigabitEthernet1/0/22": {}, | ||
"GigabitEthernet1/0/23": {}, | ||
"GigabitEthernet1/0/24": {}, | ||
"GigabitEthernet1/0/25": {}, | ||
"GigabitEthernet1/0/26": {}, | ||
"GigabitEthernet1/0/27": {}, | ||
"GigabitEthernet1/0/28": {}, | ||
"GigabitEthernet1/0/29": {}, | ||
"GigabitEthernet1/0/30": {}, | ||
"GigabitEthernet1/0/31": {}, | ||
"GigabitEthernet1/0/32": {}, | ||
"GigabitEthernet1/0/33": {}, | ||
"GigabitEthernet1/0/34": {}, | ||
"GigabitEthernet1/0/35": {}, | ||
"GigabitEthernet1/0/36": {}, | ||
"GigabitEthernet1/0/37": {}, | ||
"GigabitEthernet1/0/38": {}, | ||
"GigabitEthernet1/0/39": {}, | ||
"GigabitEthernet1/0/40": {}, | ||
"GigabitEthernet1/0/41": {}, | ||
"GigabitEthernet1/0/42": {}, | ||
"GigabitEthernet1/0/43": {}, | ||
"GigabitEthernet1/0/44": {}, | ||
"GigabitEthernet1/0/45": {}, | ||
"GigabitEthernet1/0/46": {}, | ||
"GigabitEthernet1/0/47": {}, | ||
"GigabitEthernet1/0/48": {}, | ||
"GigabitEthernet1/0/49": {}, | ||
"GigabitEthernet1/0/50": {}, | ||
"GigabitEthernet1/0/51": {}, | ||
"GigabitEthernet1/0/52": {}, | ||
"Loopback1987": {}, | ||
"Tunnel100": {} | ||
} | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
test/ios/mocked_data/test_get_network_instances/novrf/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,65 @@ | ||
|
||
Interface IP-Address OK? Method Status Protocol | ||
Vlan1 unassigned YES NVRAM administratively down down | ||
Vlan1980 10.196.16.254 YES NVRAM up up | ||
Vlan1981 10.196.17.254 YES NVRAM up up | ||
Vlan1982 10.196.18.254 YES NVRAM up down | ||
Vlan1983 10.196.19.254 YES NVRAM up up | ||
Vlan1984 10.196.20.254 YES NVRAM up down | ||
Vlan1985 10.196.21.254 YES NVRAM up down | ||
Vlan1986 10.196.22.254 YES NVRAM up down | ||
Vlan1987 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/1 unassigned YES unset down down | ||
GigabitEthernet1/0/2 unassigned YES unset down down | ||
GigabitEthernet1/0/3 unassigned YES unset up up | ||
GigabitEthernet1/0/4 unassigned YES unset down down | ||
GigabitEthernet1/0/5 unassigned YES unset down down | ||
GigabitEthernet1/0/6 unassigned YES unset down down | ||
GigabitEthernet1/0/7 unassigned YES unset up up | ||
GigabitEthernet1/0/8 unassigned YES unset down down | ||
GigabitEthernet1/0/9 unassigned YES unset down down | ||
GigabitEthernet1/0/10 unassigned YES unset down down | ||
GigabitEthernet1/0/11 unassigned YES unset down down | ||
GigabitEthernet1/0/12 unassigned YES unset down down | ||
GigabitEthernet1/0/13 unassigned YES unset down down | ||
GigabitEthernet1/0/14 unassigned YES unset down down | ||
GigabitEthernet1/0/15 unassigned YES unset down down | ||
GigabitEthernet1/0/16 unassigned YES unset down down | ||
GigabitEthernet1/0/17 unassigned YES unset down down | ||
GigabitEthernet1/0/18 unassigned YES unset down down | ||
GigabitEthernet1/0/19 unassigned YES unset down down | ||
GigabitEthernet1/0/20 unassigned YES unset down down | ||
GigabitEthernet1/0/21 unassigned YES unset down down | ||
GigabitEthernet1/0/22 unassigned YES unset down down | ||
GigabitEthernet1/0/23 unassigned YES unset down down | ||
GigabitEthernet1/0/24 unassigned YES unset down down | ||
GigabitEthernet1/0/25 unassigned YES unset down down | ||
GigabitEthernet1/0/26 unassigned YES unset down down | ||
GigabitEthernet1/0/27 unassigned YES unset down down | ||
GigabitEthernet1/0/28 unassigned YES unset down down | ||
GigabitEthernet1/0/29 unassigned YES unset down down | ||
GigabitEthernet1/0/30 unassigned YES unset down down | ||
GigabitEthernet1/0/31 unassigned YES unset down down | ||
GigabitEthernet1/0/32 unassigned YES unset down down | ||
GigabitEthernet1/0/33 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/34 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/35 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/36 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/37 unassigned YES unset up up | ||
GigabitEthernet1/0/38 unassigned YES unset up up | ||
GigabitEthernet1/0/39 unassigned YES unset up up | ||
GigabitEthernet1/0/40 10.127.0.189 YES NVRAM up up | ||
GigabitEthernet1/0/41 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/42 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/43 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/44 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/45 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/46 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/47 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/48 unassigned YES unset down down | ||
GigabitEthernet1/0/49 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/50 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/51 unassigned YES unset administratively down down | ||
GigabitEthernet1/0/52 10.235.48.16 YES NVRAM up up | ||
Loopback1987 10.196.23.254 YES NVRAM up up | ||
Tunnel100 10.127.0.181 YES NVRAM up up |
Empty file.