-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from cherifimehdi/master
Add verify_eigrp_router_id API to verify.py ios/iosxe eigrp protocol (my old contribution) supporting EIGRPv4 and EIGRPv6 for IOS/IOSXE
- Loading branch information
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
pkgs/sdk-pkg/changelog/changelog_add_verify_eigrp_router_id_202421031402.rst
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,6 @@ | ||
-------------------------------------------------------------------------------- | ||
New | ||
-------------------------------------------------------------------------------- | ||
* IOSXE | ||
* Added verify_eigrp_router_id to verify.py: | ||
* New API supporting IPv4 and IPv6 to verify EIGRP router IDs |
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
47 changes: 47 additions & 0 deletions
47
...s/sdk/apis/tests/iosxe/eigrp/verify/verify_eigrp_router_id/mock_data/iosxe/mock_data.yaml
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,47 @@ | ||
configure: | ||
commands: | ||
end: | ||
new_state: execute | ||
line console 0: | ||
new_state: configure_line | ||
no logging console: '' | ||
prompt: R1(config)# | ||
configure_line: | ||
commands: | ||
end: | ||
new_state: execute | ||
exec-timeout 0: '' | ||
prompt: R1(config-line)# | ||
connect: | ||
commands: | ||
? '' | ||
: new_state: execute | ||
preface: 'Trying mock_device ... | ||
Connected to mock_device. | ||
Escape character is ''^]''.' | ||
prompt: '' | ||
execute: | ||
commands: | ||
config term: | ||
new_state: configure | ||
config-transaction: | ||
new_state: configure | ||
show ip eigrp topology: | ||
response: | ||
- "EIGRP-IPv4 Topology Table for AS(1)/ID(1.1.1.1)\r\nCodes: P - Passive, A\ | ||
\ - Active, U - Update, Q - Query, R - Reply,\r\n r - reply Status,\ | ||
\ s - sia Status \r\n\r\nP 192.168.2.0/24, 1 successors, FD is 25856\r\n \ | ||
\ via Redistributed (25856/0)\r\nP 192.168.1.0/24, 1 successors, FD\ | ||
\ is 28160\r\n via Connected, FastEthernet0/0\r\n\r\nEIGRP-IPv4 Topology\ | ||
\ Table for AS(2)/ID(9.9.9.9)\r\nCodes: P - Passive, A - Active, U - Update,\ | ||
\ Q - Query, R - Reply,\r\n r - reply Status, s - sia Status \r\n\r\n\ | ||
P 192.168.2.0/24, 1 successors, FD is 28160\r\n via Connected, FastEthernet1/0\r\ | ||
\nP 192.168.1.0/24, 1 successors, FD is 25856\r\n via Redistributed\ | ||
\ (25856/0)" | ||
response_type: circular | ||
show version: '' | ||
term length 0: '' | ||
term width 0: '' | ||
prompt: R1# |
35 changes: 35 additions & 0 deletions
35
...k/apis/tests/iosxe/eigrp/verify/verify_eigrp_router_id/test_api_verify_eigrp_router_id.py
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,35 @@ | ||
import os | ||
import unittest | ||
from pyats.topology import loader | ||
from genie.libs.sdk.apis.iosxe.eigrp.verify import verify_eigrp_router_id | ||
|
||
|
||
class TestVerifyEigrpRouterId(unittest.TestCase): | ||
|
||
@classmethod | ||
def setUpClass(self): | ||
testbed = f""" | ||
devices: | ||
R1: | ||
connections: | ||
defaults: | ||
class: unicon.Unicon | ||
a: | ||
command: mock_device_cli --os iosxe --mock_data_dir {os.path.dirname(__file__)}/mock_data --state connect | ||
protocol: unknown | ||
os: iosxe | ||
platform: iosxe | ||
type: iosxe | ||
""" | ||
self.testbed = loader.load(testbed) | ||
self.device = self.testbed.devices['R1'] | ||
self.device.connect( | ||
learn_hostname=True, | ||
init_config_commands=[], | ||
init_exec_commands=[] | ||
) | ||
|
||
def test_verify_eigrp_router_id(self): | ||
result = verify_eigrp_router_id(self.device, ['1.1.1.1'], 'default', 1, 'ipv4', 60, 10) | ||
expected_output = True | ||
self.assertEqual(result, expected_output) |