-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[autoneg] add support for remote speed advertisement #2124
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the description with old CLI output and new CLI output.
The CLI output change will impact existing systems in production and automation frameworks that rely on a specific output pattern. Has this been considered?
tests/intfutil_test.py
Outdated
@@ -281,7 +281,7 @@ def test_show_interfaces_autoneg_status_Ethernet0(self): | |||
assert result.exit_code == 0 | |||
assert result.output == show_interface_auto_neg_status_Ethernet0_output | |||
|
|||
def test_show_interfaces_autoneg_status_etp9_in_alias_mode(self): | |||
def test_show_interfaces_autoneg_status_eth9_in_alias_mode(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to change the test case name to eth9 when it is using etp9?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it's a typo, and now it's reverted
scripts/intfutil
Outdated
@@ -149,6 +150,24 @@ def appl_db_port_status_get(appl_db, intf_name, status_type): | |||
status = ','.join(new_speed_list) | |||
return status | |||
|
|||
def state_db_port_status_get(db, intf_name, type): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename 'type' to 'field'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
scripts/intfutil
Outdated
speed_list = status.split(',') | ||
new_speed_list = [] | ||
for s in natsorted(speed_list): | ||
new_speed_list.append('{}G'.format(s[:-3])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic will not work for switches that have less than 1G speed (e.g mgmt switches which run sonic) Please consider the use case as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
scripts/intfutil
Outdated
""" | ||
full_table_id = PORT_STATE_TABLE_PREFIX + intf_name | ||
status = db.get(db.STATE_DB, full_table_id, type) | ||
if status in [None, ""]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"if not status" should do the job
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/dump_tests/dump_state_test.py
Outdated
@@ -120,7 +121,7 @@ def test_identifier_single(self): | |||
expected = {'Ethernet0': {'CONFIG_DB': {'keys': [{'PORT|Ethernet0': {'alias': 'etp1', 'description': 'etp1', 'index': '0', 'lanes': '25,26,27,28', 'mtu': '9100', 'pfc_asym': 'off', 'speed': '40000'}}], 'tables_not_found': []}, | |||
'APPL_DB': {'keys': [{'PORT_TABLE:Ethernet0': {'index': '0', 'lanes': '0', 'alias': 'Ethernet0', 'description': 'ARISTA01T2:Ethernet1', 'speed': '25000', 'oper_status': 'down', 'pfc_asym': 'off', 'mtu': '9100', 'fec': 'rs', 'admin_status': 'up'}}], 'tables_not_found': []}, | |||
'ASIC_DB': {'keys': [{'ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF:oid:0xd00000000056d': {'SAI_HOSTIF_ATTR_NAME': 'Ethernet0', 'SAI_HOSTIF_ATTR_OBJ_ID': 'oid:0x10000000004a4', 'SAI_HOSTIF_ATTR_OPER_STATUS': 'true', 'SAI_HOSTIF_ATTR_TYPE': 'SAI_HOSTIF_TYPE_NETDEV', 'SAI_HOSTIF_ATTR_VLAN_TAG': 'SAI_HOSTIF_VLAN_TAG_STRIP'}}, {'ASIC_STATE:SAI_OBJECT_TYPE_PORT:oid:0x10000000004a4': {'NULL': 'NULL', 'SAI_PORT_ATTR_ADMIN_STATE': 'true', 'SAI_PORT_ATTR_MTU': '9122', 'SAI_PORT_ATTR_SPEED': '100000'}}], 'tables_not_found': [], 'vidtorid': {'oid:0xd00000000056d': 'oid:0xd', 'oid:0x10000000004a4': 'oid:0x1690000000001'}}, | |||
'STATE_DB': {'keys': [{'PORT_TABLE|Ethernet0': {'speed': '100000', 'supported_speeds': '10000,25000,40000,100000'}}], 'tables_not_found': []}}} | |||
'STATE_DB': {'keys': [{'PORT_TABLE|Ethernet0': {'rmt_adv_speeds': '40000', 'speed': '100000', 'supported_speeds': '10000,25000,40000,100000'}}], 'tables_not_found': []}}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should cover case that 'rmt_adv_speeds' has multiple values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
scripts/intfutil
Outdated
status = '{}G'.format(int(speed / 1000)) | ||
else: | ||
status = '{}M'.format(speed) | ||
elif field in [PORT_ADV_SPEEDS, PORT_RMT_ADV_SPEEDS] and status not in ["N/A", "all"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have PORT_ADV_SPEEDS field in STATE_DB. Why are we adding check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right, it's removed now
Please resolve the conflicts |
Please update the PR description with old command output and new command output as requested. |
@zhangyanzhao @yxieca pls help signoff and merge |
scripts/intfutil
Outdated
status = db.get(db.STATE_DB, full_table_id, field) | ||
if not status: | ||
return "N/A" | ||
if field == PORT_SPEED and status != "N/A": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already port_oper_speed_get() to get the speed, so why is this if
check required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
3d2f5c3
Add support for remote speed advertisement, such that users could easily identify the connection issues when autoneg is enabled. HLD: sonic-net/SONiC#924 - What I did Add support for remote speed advertisement - How I did it Implementation is done according to the AutoNeg HLD Signed-off-by: Dante Su <dante.su@broadcom.com>
Signed-off-by: Dante Su <dante.su@broadcom.com>
Signed-off-by: Dante Su <dante.su@broadcom.com>
Signed-off-by: Dante Su <dante.su@broadcom.com>
Signed-off-by: Dante Su <dante.su@broadcom.com>
Add support for remote speed advertisement, such that users could easily
identify the connection issues when autoneg is enabled.
HLD: sonic-net/SONiC#924
Signed-off-by: Dante Su dante.su@broadcom.com
What I did
Add support for remote speed advertisement
How I did it
Implementation is done according to the AutoNeg HLD
How to verify it
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)