diff --git a/changelog/undistributed/changelog_show_ospf_iosxe_20240820091556.rst b/changelog/undistributed/changelog_show_ospf_iosxe_20240820091556.rst new file mode 100644 index 0000000000..aa84bfa1bb --- /dev/null +++ b/changelog/undistributed/changelog_show_ospf_iosxe_20240820091556.rst @@ -0,0 +1,6 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* iosxe + * Modified ShowIpOspfInterfaceBrief: + * Updated regex pattern parse OSPF area as string to facilitate parsing dot notation areas, as well as numeric. \ No newline at end of file diff --git a/src/genie/libs/parser/iosxe/show_ospf.py b/src/genie/libs/parser/iosxe/show_ospf.py index d0b1180f27..1e1f3fe215 100755 --- a/src/genie/libs/parser/iosxe/show_ospf.py +++ b/src/genie/libs/parser/iosxe/show_ospf.py @@ -1405,7 +1405,7 @@ def cli(self, output=None): # Init vars ret_dict = {} - p1 = re.compile(r'^(?P\S+) +(?P\S+) +(?P\d+) +' + p1 = re.compile(r'^(?P\S+) +(?P\S+) +(?P\S+) +' '(?P
\S+) +(?P\d+) +(?P\S+) +(?P\d+)' '\/(?P\d+)$$') diff --git a/src/genie/libs/parser/iosxe/tests/ShowIpOspfInterfaceBrief/cli/equal/golden_output3_expected.py b/src/genie/libs/parser/iosxe/tests/ShowIpOspfInterfaceBrief/cli/equal/golden_output3_expected.py new file mode 100644 index 0000000000..ec5083ba48 --- /dev/null +++ b/src/genie/libs/parser/iosxe/tests/ShowIpOspfInterfaceBrief/cli/equal/golden_output3_expected.py @@ -0,0 +1,66 @@ +expected_output = { + "instance": { + "1": { + "areas": { + "0.0.0.0": { + "interfaces": { + "GigabitEthernet3": { + "cost": 1, + "ip_address": "100.3.4.4/24", + "nbrs_count": 0, + "nbrs_full": 0, + "state": "P2P" + }, + "GigabitEthernet4": { + "cost": 1, + "ip_address": "100.2.4.4/24", + "nbrs_count": 1, + "nbrs_full": 1, + "state": "P2P" + }, + "Loopback0": { + "cost": 1, + "ip_address": "100.255.255.4/32", + "nbrs_count": 0, + "nbrs_full": 0, + "state": "LOOP" + } + } + }, + "0.0.0.2": { + "interfaces": { + "GigabitEthernet5": { + "cost": 1, + "ip_address": "100.1.4.4/24", + "nbrs_count": 0, + "nbrs_full": 0, + "state": "P2P" + } + } + } + } + }, + "200": { + "areas": { + "0.0.0.0": { + "interfaces": { + "GigabitEthernet6": { + "cost": 1, + "ip_address": "100.4.11.4/24", + "nbrs_count": 0, + "nbrs_full": 0, + "state": "P2P" + }, + "GigabitEthernet7": { + "cost": 1, + "ip_address": "100.4.12.4/24", + "nbrs_count": 1, + "nbrs_full": 1, + "state": "P2P" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/genie/libs/parser/iosxe/tests/ShowIpOspfInterfaceBrief/cli/equal/golden_output3_output.txt b/src/genie/libs/parser/iosxe/tests/ShowIpOspfInterfaceBrief/cli/equal/golden_output3_output.txt new file mode 100644 index 0000000000..cf01d873a2 --- /dev/null +++ b/src/genie/libs/parser/iosxe/tests/ShowIpOspfInterfaceBrief/cli/equal/golden_output3_output.txt @@ -0,0 +1,8 @@ +R4#show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C +Lo0 1 0.0.0.0 100.255.255.4/32 1 LOOP 0/0 +Gi4 1 0.0.0.0 100.2.4.4/24 1 P2P 1/1 +Gi3 1 0.0.0.0 100.3.4.4/24 1 P2P 0/0 +Gi5 1 2 100.1.4.4/24 1 P2P 0/0 +Gi7 200 0 100.4.12.4/24 1 P2P 1/1 +Gi6 200 0 100.4.11.4/24 1 P2P 0/0