Skip to content

Commit 882c298

Browse files
author
Sohan Tirpude
authored
Merge pull request #799 from mc4leaf/update_showpolicymap
added priority percent to show policy map for iosxe
2 parents 266aeee + a8715d6 commit 882c298

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--------------------------------------------------------------------------------
2+
Fix
3+
--------------------------------------------------------------------------------
4+
* IOSXE
5+
* Modified show_policy_map:
6+
* Added priority_percent to the schema.
7+
* Added regex p10_2 to accommodate getting the data from the output.
8+

src/genie/libs/parser/iosxe/show_policy_map.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,6 +2334,7 @@ class ShowPolicyMapSchema(MetaParser):
23342334
Optional('set'): str,
23352335
Optional('conform_burst'): int,
23362336
Optional('priority'): bool,
2337+
Optional('priority_percent'): int,
23372338
Optional('priority_kbps'): int,
23382339
Optional('priority_levels'): int,
23392340
Optional('peak_burst'): int,
@@ -2525,6 +2526,9 @@ def cli(self, name='', output=None):
25252526

25262527
# priority level 1
25272528
p10_1 = re.compile(r'^priority +level +(?P<priority_levels>(\d+))$')
2529+
2530+
# priority 8 (%)
2531+
p10_2 = re.compile(r'^priority +(?P<priority_percent>(\d+)) .*$')
25282532

25292533
# Set cos 5
25302534
# set dscp cs1
@@ -2842,7 +2846,14 @@ def cli(self, name='', output=None):
28422846
if m:
28432847
priority_level = int(m.groupdict()['priority_levels'])
28442848
class_map_dict['priority_levels'] = priority_level
2849+
continue
28452850

2851+
# priority 9 (%)
2852+
m = p10_2.match(line)
2853+
if m:
2854+
class_map_dict['priority'] = True
2855+
priority_percent = int(m.groupdict()['priority_percent'])
2856+
class_map_dict['priority_percent'] = priority_percent
28462857
continue
28472858

28482859
# Set cos 5
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
expected_output = {
2+
"policy_map": {
3+
"map1": {
4+
"class": {
5+
"cs1": {
6+
"priority": True,
7+
"priority_percent": 9
8+
}
9+
}
10+
}
11+
}
12+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Policy Map map1
2+
Class cs1
3+
priority 9 (%)

0 commit comments

Comments
 (0)