Skip to content

Commit

Permalink
Merge branch 'master' into robust-techsupport
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanblyschak authored Apr 8, 2022
2 parents 44f90ca + 52ca324 commit 2748ff9
Show file tree
Hide file tree
Showing 46 changed files with 3,106 additions and 1,270 deletions.
10 changes: 2 additions & 8 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import sys
import click
import utilities_common.cli as clicommon
import json

from utilities_common import util_base
from show.plugins.pbh import read_pbh_counters
from config.plugins.pbh import serialize_pbh_counters
from . import plugins


Expand Down Expand Up @@ -473,14 +473,8 @@ def statistics(db):
pbh_rules = db.cfgdb.get_table("PBH_RULE")
pbh_counters = read_pbh_counters(pbh_rules)

try:
with open('/tmp/.pbh_counters.txt', 'w') as fp:
json.dump(remap_keys(pbh_counters), fp)
except IOError as err:
pass
serialize_pbh_counters(pbh_counters)

def remap_keys(dict):
return [{'key': k, 'value': v} for k, v in dict.items()]

# ("sonic-clear flowcnt-trap")
@cli.command()
Expand Down
21 changes: 21 additions & 0 deletions config/config_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,27 @@ def _recurCreateConfig(diff, inp, outp, config):
# we do not allow updates right now
if isinstance(diff, list) and isinstance(outp, dict):
return changed
'''
libYang converts ietf yang types to lower case internally, which
creates false config diff for us while DPB.
Example:
For DEVICE_METADATA['localhost']['mac'] type is yang:mac-address.
Libyang converts from 'XX:XX:XX:E4:B3:DD' -> 'xx:xx:xx:e4:b3:dd'
so args for this functions will be:
diff = DEVICE_METADATA['localhost']['mac']
where DEVICE_METADATA': {'localhost': {'mac': ['XX:XX:XX:E4:B3:DD', 'xx:xx:xx:e4:b3:dd']}}}
Note: above dict is representation of diff in config given by diffJson
library.
out = 'XX:XX:XX:e4:b3:dd'
inp = 'xx:xx:xx:E4:B3:DD'
With below check, we will avoid processing of such config diff for DPB.
'''
if isinstance(diff, list) and isinstance(outp, str) and \
inp.lower() == outp.lower():
return changed

idx = -1
for key in diff:
Expand Down
10 changes: 6 additions & 4 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,21 +635,23 @@ def _clear_cbf():

def _clear_qos():
QOS_TABLE_NAMES = [
'PORT_QOS_MAP',
'QUEUE',
'TC_TO_PRIORITY_GROUP_MAP',
'MAP_PFC_PRIORITY_TO_QUEUE',
'TC_TO_QUEUE_MAP',
'DSCP_TO_TC_MAP',
'MPLS_TC_TO_TC_MAP',
'SCHEDULER',
'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP',
'PORT_QOS_MAP',
'WRED_PROFILE',
'QUEUE',
'CABLE_LENGTH',
'BUFFER_POOL',
'BUFFER_PROFILE',
'BUFFER_PG',
'BUFFER_QUEUE',
'BUFFER_PORT_INGRESS_PROFILE_LIST',
'BUFFER_PORT_EGRESS_PROFILE_LIST',
'BUFFER_PROFILE',
'BUFFER_POOL',
'DEFAULT_LOSSLESS_BUFFER_PARAMETER',
'LOSSLESS_TRAFFIC_PATTERN']

Expand Down
Loading

0 comments on commit 2748ff9

Please sign in to comment.