Skip to content
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

Add verify_eigrp_interfaces_timers API to verify.py ios/iosxe eigrp protocol #165

Merged
merged 75 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
07a18de
Create test
cherifimehdi Apr 19, 2024
ea82622
Add files via upload
cherifimehdi Apr 19, 2024
71e6b74
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi Apr 19, 2024
3d8629b
Add files via upload
cherifimehdi Apr 19, 2024
ad28677
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
cherifimehdi Apr 19, 2024
0c3f617
Add files via upload
cherifimehdi Apr 19, 2024
870cde5
Add files via upload
cherifimehdi Apr 19, 2024
3b1c8aa
Update verify.py
cherifimehdi May 9, 2024
d0a3049
Update mock_data.yaml
cherifimehdi May 9, 2024
3392b47
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 9, 2024
d7fb358
Create tst
cherifimehdi May 9, 2024
b23019b
Add files via upload
cherifimehdi May 9, 2024
91d77df
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 9, 2024
9aa5f43
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
cherifimehdi May 9, 2024
f269510
Add files via upload
cherifimehdi May 9, 2024
e371ca7
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 9, 2024
e791a69
Create tst
cherifimehdi May 9, 2024
3462971
Add files via upload
cherifimehdi May 9, 2024
ab3a82f
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 9, 2024
a4f1b96
Update pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 9, 2024
a84e4c2
Merge branch 'CiscoTestAutomation:master' into master
cherifimehdi May 9, 2024
c7ef175
Update mock_data.yaml
cherifimehdi May 9, 2024
466db60
Update mock_data.yaml
cherifimehdi May 9, 2024
0b461b8
Update pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 9, 2024
b9b115c
Update verify.py
cherifimehdi May 9, 2024
84761c9
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
cherifimehdi May 9, 2024
a94f36d
Add files via upload
cherifimehdi May 9, 2024
f349d8b
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
cherifimehdi May 9, 2024
834e94f
Add files via upload
cherifimehdi May 9, 2024
2220abe
Update verify.py
cherifimehdi May 9, 2024
cfe9f1b
Update verify.py
cherifimehdi May 10, 2024
0fa631a
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 12, 2024
f1ae334
Create test
cherifimehdi May 12, 2024
b5525a4
Add files via upload
cherifimehdi May 12, 2024
c7c3402
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 12, 2024
cdd0cc9
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
cherifimehdi May 12, 2024
349e14d
Add files via upload
cherifimehdi May 12, 2024
bc7fc38
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 13, 2024
15b066b
Update verify.py
cherifimehdi May 13, 2024
eea981e
Delete pkgs/sdk-pkg/changelog/changelog_add_verify_eigrp_interfaces_t…
cherifimehdi May 13, 2024
9d3d7b5
Create test
cherifimehdi May 13, 2024
5812abd
Add files via upload
cherifimehdi May 13, 2024
e544316
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 13, 2024
af6b3d9
Add files via upload
cherifimehdi May 13, 2024
6fe3e4b
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
cherifimehdi May 13, 2024
78ce9de
Add files via upload
cherifimehdi May 13, 2024
019d370
Add files via upload
cherifimehdi May 13, 2024
960b66b
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 17, 2024
b33cd38
Create tst
cherifimehdi May 17, 2024
deff34a
Add files via upload
cherifimehdi May 17, 2024
40e5c0e
Add files via upload
cherifimehdi May 17, 2024
8921b86
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 17, 2024
79ba7e6
Create tst
cherifimehdi May 17, 2024
40b1fbe
Add files via upload
cherifimehdi May 17, 2024
0710333
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi May 17, 2024
080eaab
Delete test_api_verify_eigrp_interfaces_timers.py
cherifimehdi May 24, 2024
36a5c68
Merge branch 'CiscoTestAutomation:master' into master
cherifimehdi Jun 2, 2024
bc31711
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi Jun 2, 2024
dab08ef
Create test
cherifimehdi Jun 2, 2024
baaa0c9
Add files via upload
cherifimehdi Jun 2, 2024
8202d1b
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi Jun 2, 2024
1c48a83
Add files via upload
cherifimehdi Jun 2, 2024
85e8996
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi Jun 2, 2024
2f81b6d
Create test
cherifimehdi Jun 2, 2024
b66123a
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi Jun 2, 2024
9fe0f71
Create tst
cherifimehdi Jun 2, 2024
222eebf
Add files via upload
cherifimehdi Jun 2, 2024
b5144a0
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi Jun 2, 2024
ac6c465
Create tst
cherifimehdi Jun 2, 2024
3e7d289
Add files via upload
cherifimehdi Jun 2, 2024
5ef4023
Delete pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/eigrp/verify/…
cherifimehdi Jun 2, 2024
28fd048
Update verify.py
cherifimehdi Jun 18, 2024
ff59b50
Update verify.py
cherifimehdi Jun 18, 2024
72ebca5
Merge branch 'CiscoTestAutomation:master' into master
cherifimehdi Jun 27, 2024
b12c94c
Update pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
cherifimehdi Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--------------------------------------------------------------------------------
New
--------------------------------------------------------------------------------
* IOSXE
* Added verify_eigrp_interfaces_timers to verify.py:
* New API supporting IPv4 and IPv6 to verify EIGRP interfaces timers
70 changes: 70 additions & 0 deletions pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/eigrp/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,73 @@ def verify_eigrp_router_id(
return set(router_id).issubset(eigrp_id)
log.error(f"Please, provid a valid format for auto_sys, router_id, vrf and/or ip")
continue

def verify_eigrp_interfaces_timers(
device,
timers_dict=None,
vrf="default",
auto_sys=None,
ip="ipv4",
max_time=60,
check_interval=10,
):
"""Verify hello interval and hold time of interfaces for a given vrf and active auto_sys for ipv4 or ipv6
Args:
device (obj): Device object
timers_dict (dict): dict to verify containing interfaces with their hello interval and hold time
# ex.) timers_dict = {'FastEthernet0/0': [{'hello_interval': 5}, {'hold_time': 15}]}
vrf (str) : Name of the vrf by default set to "default"
auto_sys (int) : Autonomous System
ip (str): Protocol ip, default: "ipv4" to change to "ipv6"
max_time (`int`): Max time, default: 30
check_interval (`int`): Check interval, default: 10
Returns:
result (bool): Verified result
"""
assert isinstance(auto_sys, int), "auto_sys must be int"
assert isinstance(vrf, str), "vrf must be str"
assert isinstance(timers_dict, dict), "timers_dict must be dict"
assert auto_sys != 0, "auto_sys must not be 0"
assert ip in ["ipv4", "ipv6"], "ip must be ipv4 or ipv6"
timeout = Timeout(max_time, check_interval)
while timeout.iterate():
if auto_sys and timers_dict:
try:
response = device.parse(
f"show {'ipv6' if ip!='ipv4' else 'ip'} eigrp interfaces detail"
)
except SchemaEmptyParserError:
timeout.sleep()
continue
inter_timers = {}
if (vrf not in response.q.get_values("vrf")) or (
str(auto_sys) not in response.q.get_values("eigrp_instance")
):
log.error(
f"Sorry, no data for the provided for 'auto_sys = {auto_sys}' and/or 'vrf = {vrf}'"
)
else:
interfaces = (
response.q.contains(vrf)
.contains_key_value("eigrp_instance", str(auto_sys))
.contains(ip)
.get_values("interface")
)
for interface in interfaces:
hello_interval = {
"hello_interval": (
response.q.contains(interface).get_values("hello_interval")
)[0]
}
hold_time = {
"hold_time": (
response.q.contains(interface).get_values("hold_time")
)[0]
}
inter_timers[interface] = [hello_interval, hold_time]
return set(timers_dict).issubset(inter_timers)
log.error(
f"Please, provide a valid format for auto_sys, timers_dict, vrf and/or ip"
)
continue

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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 interfaces detail:
response:
- "EIGRP-IPv4 Interfaces for AS(1)\r\n Xmit Queue\
\ PeerQ Mean Pacing Time Multicast Pending\r\nInterface \
\ Peers Un/Reliable Un/Reliable SRTT Un/Reliable Flow Timer\
\ Routes\r\nFa0/0 1 0/0 0/0 60\
\ 0/0 50 0\r\n Hello-interval is 5, Hold-time is\
\ 15\r\n Split-horizon is enabled\r\n Next xmit serial <none>\r\n Packetized\
\ sent/expedited: 1/0\r\n Hello's sent/expedited: 74/2\r\n Un/reliable mcasts:\
\ 0/1 Un/reliable ucasts: 1/2\r\n Mcast exceptions: 0 CR packets: 0 ACKs\
\ suppressed: 0\r\n Retransmissions sent: 1 Out-of-sequence rcvd: 0\r\n\
\ Topology-ids on interface - 0 \r\n Authentication mode is not set\r\n\
EIGRP-IPv4 Interfaces for AS(2)\r\n Xmit Queue\
\ PeerQ Mean Pacing Time Multicast Pending\r\nInterface \
\ Peers Un/Reliable Un/Reliable SRTT Un/Reliable Flow Timer\
\ Routes\r\nFa1/0 1 0/0 0/0 164\
\ 0/0 50 0\r\n Hello-interval is 5, Hold-time is\
\ 15\r\n Split-horizon is enabled\r\n Next xmit serial <none>\r\n Packetized\
\ sent/expedited: 1/0\r\n Hello's sent/expedited: 75/2\r\n Un/reliable mcasts:\
\ 0/1 Un/reliable ucasts: 1/2\r\n Mcast exceptions: 0 CR packets: 0 ACKs\
\ suppressed: 0\r\n Retransmissions sent: 1 Out-of-sequence rcvd: 1\r\n\
\ Topology-ids on interface - 0 \r\n Authentication mode is not set"
response_type: circular
show version: ''
show version | include operating mode: ''
term length 0: ''
term width 0: ''
prompt: R1#
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_interfaces_timers


class TestVerifyEigrpInterfacesTimers(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_interfaces_timers(self):
result = verify_eigrp_interfaces_timers(self.device, {'FastEthernet0/0': [{'hello_interval': 5}, {'hold_time': 15}]}, 'default', 1, 'ipv4', 60, 10)
expected_output = True
self.assertEqual(result, expected_output)
Loading