Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions scripts/dropconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ drop_counter_config_header = ['Counter',
'Description']
drop_counter_capability_header = ['Counter Type', 'Total']

# Drop Reason Prefixes
in_drop_reason_prefix = 'SAI_IN_DROP_REASON_'
out_drop_reason_prefix = 'SAI_OUT_DROP_REASON_'


class InvalidArgumentError(RuntimeError):
def __init__(self, msg):
Expand Down Expand Up @@ -106,10 +102,6 @@ class DropConfig(object):
if supported_reasons and int(capabilities.get('count', 0)) > 0:
print('\n{}'.format(counter))
for reason in supported_reasons:
if reason.startswith(in_drop_reason_prefix):
reason = reason[len(in_drop_reason_prefix):]
elif reason.startswith(out_drop_reason_prefix):
reason = reason[len(out_drop_reason_prefix):]
print('\t{}'.format(reason))

def create_counter(self, counter_name, alias, group, counter_type,
Expand Down Expand Up @@ -313,13 +305,7 @@ class DropConfig(object):
if not cap_query:
return None

reasons = []
for reason in deserialize_reason_list(cap_query.get('reasons', '')):
if reason.startswith(in_drop_reason_prefix):
reasons.append(reason[len(in_drop_reason_prefix):])
elif reason.startswith(out_drop_reason_prefix):
reasons.append(reason[len(out_drop_reason_prefix):])
return reasons
return deserialize_reason_list(cap_query.get('reasons', ''))


def deserialize_reason_list(list_str):
Expand Down
4 changes: 2 additions & 2 deletions sonic-utilities-tests/mock_tables/state_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
"ACL_ACTION|PACKET_ACTION": "FORWARD"
},
"DEBUG_COUNTER_CAPABILITIES|PORT_INGRESS_DROPS": {
"reasons": "[SAI_IN_DROP_REASON_IP_HEADER_ERROR,SAI_IN_DROP_REASON_NO_L3_HEADER]",
"reasons": "[IP_HEADER_ERROR,NO_L3_HEADER]",
"count": "4"
},
"DEBUG_COUNTER_CAPABILITIES|SWITCH_EGRESS_DROPS": {
"reasons": "[SAI_IN_DROP_REASON_ACL_ANY,SAI_IN_DROP_REASON_L2_ANY,SAI_IN_DROP_REASON_L3_ANY]",
"reasons": "[ACL_ANY,L2_ANY,L3_ANY]",
"count": "2"
}
}