diff --git a/changelog/undistributed/changelog_show_policy_map_iosxe_20231127192427.rst b/changelog/undistributed/changelog_show_policy_map_iosxe_20231127192427.rst new file mode 100644 index 0000000000..bd1d316eb2 --- /dev/null +++ b/changelog/undistributed/changelog_show_policy_map_iosxe_20231127192427.rst @@ -0,0 +1,8 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* IOSXE + * Modified show_policy_map: + * Added priority_percent to the schema. + * Added regex p10_2 to accommodate getting the data from the output. + diff --git a/src/genie/libs/parser/iosxe/show_policy_map.py b/src/genie/libs/parser/iosxe/show_policy_map.py index cf6705ac93..fb3a593eec 100755 --- a/src/genie/libs/parser/iosxe/show_policy_map.py +++ b/src/genie/libs/parser/iosxe/show_policy_map.py @@ -2334,6 +2334,7 @@ class ShowPolicyMapSchema(MetaParser): Optional('set'): str, Optional('conform_burst'): int, Optional('priority'): bool, + Optional('priority_percent'): int, Optional('priority_kbps'): int, Optional('priority_levels'): int, Optional('peak_burst'): int, @@ -2525,6 +2526,9 @@ def cli(self, name='', output=None): # priority level 1 p10_1 = re.compile(r'^priority +level +(?P(\d+))$') + + # priority 8 (%) + p10_2 = re.compile(r'^priority +(?P(\d+)) .*$') # Set cos 5 # set dscp cs1 @@ -2842,7 +2846,14 @@ def cli(self, name='', output=None): if m: priority_level = int(m.groupdict()['priority_levels']) class_map_dict['priority_levels'] = priority_level + continue + # priority 9 (%) + m = p10_2.match(line) + if m: + class_map_dict['priority'] = True + priority_percent = int(m.groupdict()['priority_percent']) + class_map_dict['priority_percent'] = priority_percent continue # Set cos 5 diff --git a/src/genie/libs/parser/iosxe/tests/ShowPolicyMap/cli/equal/golden_output16_expected.py b/src/genie/libs/parser/iosxe/tests/ShowPolicyMap/cli/equal/golden_output16_expected.py new file mode 100644 index 0000000000..80c435891d --- /dev/null +++ b/src/genie/libs/parser/iosxe/tests/ShowPolicyMap/cli/equal/golden_output16_expected.py @@ -0,0 +1,12 @@ +expected_output = { + "policy_map": { + "map1": { + "class": { + "cs1": { + "priority": True, + "priority_percent": 9 + } + } + } + } +} \ No newline at end of file diff --git a/src/genie/libs/parser/iosxe/tests/ShowPolicyMap/cli/equal/golden_output16_output.txt b/src/genie/libs/parser/iosxe/tests/ShowPolicyMap/cli/equal/golden_output16_output.txt new file mode 100644 index 0000000000..ca15995be0 --- /dev/null +++ b/src/genie/libs/parser/iosxe/tests/ShowPolicyMap/cli/equal/golden_output16_output.txt @@ -0,0 +1,3 @@ + Policy Map map1 + Class cs1 + priority 9 (%) \ No newline at end of file