Skip to content

Commit

Permalink
Merge pull request #799 from mc4leaf/update_showpolicymap
Browse files Browse the repository at this point in the history
added priority percent to show policy map for iosxe
  • Loading branch information
Sohan Tirpude committed Feb 6, 2024
2 parents 266aeee + a8715d6 commit 882c298
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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.

11 changes: 11 additions & 0 deletions src/genie/libs/parser/iosxe/show_policy_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -2525,6 +2526,9 @@ def cli(self, name='', output=None):

# priority level 1
p10_1 = re.compile(r'^priority +level +(?P<priority_levels>(\d+))$')

# priority 8 (%)
p10_2 = re.compile(r'^priority +(?P<priority_percent>(\d+)) .*$')

# Set cos 5
# set dscp cs1
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
expected_output = {
"policy_map": {
"map1": {
"class": {
"cs1": {
"priority": True,
"priority_percent": 9
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Policy Map map1
Class cs1
priority 9 (%)

0 comments on commit 882c298

Please sign in to comment.