Skip to content

Commit 23912ef

Browse files
Merge branch 'master' of https://github.com/Azure/sonic-utilities into auto-ts-mem
Signed-off-by: Stepan Blyschak <[email protected]>
2 parents 3c5f968 + 52ca324 commit 23912ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3112
-1278
lines changed

clear/main.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import sys
55
import click
66
import utilities_common.cli as clicommon
7-
import json
87

98
from utilities_common import util_base
109
from show.plugins.pbh import read_pbh_counters
10+
from config.plugins.pbh import serialize_pbh_counters
1111
from . import plugins
1212

1313

@@ -473,14 +473,8 @@ def statistics(db):
473473
pbh_rules = db.cfgdb.get_table("PBH_RULE")
474474
pbh_counters = read_pbh_counters(pbh_rules)
475475

476-
try:
477-
with open('/tmp/.pbh_counters.txt', 'w') as fp:
478-
json.dump(remap_keys(pbh_counters), fp)
479-
except IOError as err:
480-
pass
476+
serialize_pbh_counters(pbh_counters)
481477

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

485479
# ("sonic-clear flowcnt-trap")
486480
@cli.command()

config/config_mgmt.py

+21
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,27 @@ def _recurCreateConfig(diff, inp, outp, config):
872872
# we do not allow updates right now
873873
if isinstance(diff, list) and isinstance(outp, dict):
874874
return changed
875+
'''
876+
libYang converts ietf yang types to lower case internally, which
877+
creates false config diff for us while DPB.
878+
879+
Example:
880+
For DEVICE_METADATA['localhost']['mac'] type is yang:mac-address.
881+
Libyang converts from 'XX:XX:XX:E4:B3:DD' -> 'xx:xx:xx:e4:b3:dd'
882+
so args for this functions will be:
883+
884+
diff = DEVICE_METADATA['localhost']['mac']
885+
where DEVICE_METADATA': {'localhost': {'mac': ['XX:XX:XX:E4:B3:DD', 'xx:xx:xx:e4:b3:dd']}}}
886+
Note: above dict is representation of diff in config given by diffJson
887+
library.
888+
out = 'XX:XX:XX:e4:b3:dd'
889+
inp = 'xx:xx:xx:E4:B3:DD'
890+
891+
With below check, we will avoid processing of such config diff for DPB.
892+
'''
893+
if isinstance(diff, list) and isinstance(outp, str) and \
894+
inp.lower() == outp.lower():
895+
return changed
875896

876897
idx = -1
877898
for key in diff:

config/main.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -635,21 +635,23 @@ def _clear_cbf():
635635

636636
def _clear_qos():
637637
QOS_TABLE_NAMES = [
638+
'PORT_QOS_MAP',
639+
'QUEUE',
638640
'TC_TO_PRIORITY_GROUP_MAP',
639641
'MAP_PFC_PRIORITY_TO_QUEUE',
640642
'TC_TO_QUEUE_MAP',
641643
'DSCP_TO_TC_MAP',
642644
'MPLS_TC_TO_TC_MAP',
643645
'SCHEDULER',
644646
'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP',
645-
'PORT_QOS_MAP',
646647
'WRED_PROFILE',
647-
'QUEUE',
648648
'CABLE_LENGTH',
649-
'BUFFER_POOL',
650-
'BUFFER_PROFILE',
651649
'BUFFER_PG',
652650
'BUFFER_QUEUE',
651+
'BUFFER_PORT_INGRESS_PROFILE_LIST',
652+
'BUFFER_PORT_EGRESS_PROFILE_LIST',
653+
'BUFFER_PROFILE',
654+
'BUFFER_POOL',
653655
'DEFAULT_LOSSLESS_BUFFER_PARAMETER',
654656
'LOSSLESS_TRAFFIC_PATTERN']
655657

0 commit comments

Comments
 (0)