diff --git a/changelog/undistributed/changelog_iosxr_show_policy_map_int_20220323104856.rst b/changelog/undistributed/changelog_iosxr_show_policy_map_int_20220323104856.rst new file mode 100644 index 0000000000..07d057b67f --- /dev/null +++ b/changelog/undistributed/changelog_iosxr_show_policy_map_int_20220323104856.rst @@ -0,0 +1,5 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* IOSXR + * Modified ShowPolicyMapInterface Parser, update pattern p2 input direction diff --git a/src/genie/libs/parser/iosxr/show_policy_map.py b/src/genie/libs/parser/iosxr/show_policy_map.py index 67d4bf677b..3846739623 100644 --- a/src/genie/libs/parser/iosxr/show_policy_map.py +++ b/src/genie/libs/parser/iosxr/show_policy_map.py @@ -81,7 +81,6 @@ def cli(self, interface, output=None): else: out = output - # Initialize dictionary ret_dict = {} @@ -89,7 +88,8 @@ def cli(self, interface, output=None): p1 = re.compile(r'^.*direction +input: +Service +Policy +not +installed$') # TenGigE0/2/0/3 direction input: cap - p2 = re.compile(r'^.*direction +input: +(?P\w+)$') + # GigabitEthernet0/0/0/1 input: 4gig + p2 = re.compile(r'^.*(direction)? +input: +(?P\w+)$') # TenGigE0/2/0/3 output: Service Policy not installed p3 = re.compile(r'^.*output: +Service +Policy +not +installed$') diff --git a/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_arguments.json b/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_arguments.json new file mode 100644 index 0000000000..fab13dbef9 --- /dev/null +++ b/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_arguments.json @@ -0,0 +1,3 @@ +{ + "interface": "GigabitEthernet 0/0/0/1" +} diff --git a/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_expected.py b/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_expected.py new file mode 100644 index 0000000000..17a34c2cde --- /dev/null +++ b/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_expected.py @@ -0,0 +1,50 @@ +expected_output = { + 'interface': { + 'GigabitEthernet 0/0/0/1': { + 'service_policy': { + 'input': { + 'policy_name': { + '4gig': { + 'class': { + 'class-default': { + 'classification_statistics': { + 'matched': { + 'packets/bytes': '0/0', + 'rate/kbps': 0, + }, + 'total_dropped': { + 'packets/bytes': '0/0', + 'rate/kbps': 0, + }, + 'transmitted': 'N/A', + }, + }, + }, + }, + }, + }, + 'output': { + 'policy_name': { + '4gig': { + 'class': { + 'class-default': { + 'classification_statistics': { + 'matched': { + 'packets/bytes': '0/0', + 'rate/kbps': 0, + }, + 'total_dropped': { + 'packets/bytes': '0/0', + 'rate/kbps': 0, + }, + 'transmitted': 'N/A', + }, + }, + }, + }, + }, + }, + }, + }, + }, +} diff --git a/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_output.txt b/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_output.txt new file mode 100644 index 0000000000..396231fdd9 --- /dev/null +++ b/src/genie/libs/parser/iosxr/tests/ShowPolicyMapInterface/cli/equal/golden_output_4_output.txt @@ -0,0 +1,28 @@ +show policy-map interface GigabitEthernet 0/0/0/1 +Wed Mar 23 09:19:10.518 UTC + +GigabitEthernet0/0/0/1 input: 4gig + +Class class-default + Classification statistics (packets/bytes) (rate - kbps) + Matched : 0/0 0 + Transmitted : N/A + Total Dropped : 0/0 0 + Policing statistics (packets/bytes) (rate - kbps) + Policed(conform) : 0/0 0 + Policed(exceed) : 0/0 0 + Policed(violate) : 0/0 0 + Policed and dropped : 0/0 + +GigabitEthernet0/0/0/1 output: 4gig + +Class class-default + Classification statistics (packets/bytes) (rate - kbps) + Matched : 0/0 0 + Transmitted : N/A + Total Dropped : 0/0 0 + Policing statistics (packets/bytes) (rate - kbps) + Policed(conform) : 0/0 0 + Policed(exceed) : 0/0 0 + Policed(violate) : 0/0 0 + Policed and dropped : 0/0