diff --git a/napalm/ios/ios.py b/napalm/ios/ios.py index ba3072917..8d18ab53d 100644 --- a/napalm/ios/ios.py +++ b/napalm/ios/ios.py @@ -2697,18 +2697,22 @@ def process_mac_fields(vlan, mac, mac_type, interface): def get_probes_config(self): probes = {} + probes_regex = ( r"ip\s+sla\s+(?P\d+)\n" - r"\s+(?P\S+)\s+(?P.*\n).*" - r"\s+tag\s+(?P\S+)\n.*" - r"\s+history\s+buckets-kept\s+(?P\d+)\n.*" - r"\s+frequency\s+(?P\d+)$" + r"\s+(?P\S+)\s+(?P.*)\n" + r"\s+tag\s+(?P[\S ]+)\n" + r"(\s+.*\n)*" + r"((\s+frequency\s+(?P\d+)\n(\s+.*\n)*\s+history" + r"\s+buckets-kept\s+(?P\d+))|(\s+history\s+buckets-kept" + r"\s+(?P\d+)\n.*\s+frequency\s+(?P\d+)))" ) + probe_args = { "icmp-echo": r"^(?P\S+)\s+source-(?:ip|interface)\s+(?P\S+)$" } probe_type_map = {"icmp-echo": "icmp-ping"} - command = "show run | include ip sla [0-9]" + command = "show run | section ip sla [0-9]" output = self._send_command(command) for match in re.finditer(probes_regex, output, re.M): probe = match.groupdict() @@ -2724,8 +2728,8 @@ def get_probes_config(self): "probe_type": probe_type_map[probe["probe_type"]], "target": probe_data["target"], "source": probe_data["source"], - "probe_count": int(probe["probe_count"]), - "test_interval": int(probe["interval"]), + "probe_count": int(probe["probe_count0"] or probe["probe_count1"]), + "test_interval": int(probe["interval0"] or probe["interval1"]), } } diff --git a/test/ios/mocked_data/test_get_probes_config/normal/expected_result.json b/test/ios/mocked_data/test_get_probes_config/normal/expected_result.json index 76935ad9c..f914b4333 100644 --- a/test/ios/mocked_data/test_get_probes_config/normal/expected_result.json +++ b/test/ios/mocked_data/test_get_probes_config/normal/expected_result.json @@ -16,5 +16,14 @@ "test_interval": 3, "probe_count": 20 } + }, + "3": { + "quad9": { + "source": "GigabitEthernet11", + "probe_type": "icmp-ping", + "target": "9.9.9.9", + "test_interval": 15, + "probe_count": 60 + } } } diff --git a/test/ios/mocked_data/test_get_probes_config/normal/show_run___include_ip_sla__0_9_.txt b/test/ios/mocked_data/test_get_probes_config/normal/show_run___section_ip_sla__0_9_.txt similarity index 64% rename from test/ios/mocked_data/test_get_probes_config/normal/show_run___include_ip_sla__0_9_.txt rename to test/ios/mocked_data/test_get_probes_config/normal/show_run___section_ip_sla__0_9_.txt index f778ecef4..eadb56e07 100644 --- a/test/ios/mocked_data/test_get_probes_config/normal/show_run___include_ip_sla__0_9_.txt +++ b/test/ios/mocked_data/test_get_probes_config/normal/show_run___section_ip_sla__0_9_.txt @@ -11,4 +11,10 @@ ip sla 2 history lives-kept 1 history buckets-kept 20 timeout 2000 - frequency 3 \ No newline at end of file + frequency 3 +ip sla 3 + icmp-echo 9.9.9.9 source-interface GigabitEthernet11 + tag quad9 + frequency 15 + history lives-kept 1 + history buckets-kept 60