[autoneg] add support for remote speed advertisement#2124
[autoneg] add support for remote speed advertisement#2124prgeor merged 5 commits intosonic-net:masterfrom
Conversation
dgsudharsan
left a comment
There was a problem hiding this comment.
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
| 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.
Why do you need to change the test case name to eth9 when it is using etp9?
There was a problem hiding this comment.
I thought it's a typo, and now it's reverted
scripts/intfutil
Outdated
| status = ','.join(new_speed_list) | ||
| return status | ||
|
|
||
| def state_db_port_status_get(db, intf_name, type): |
There was a problem hiding this comment.
Please rename 'type' to 'field'
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.
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.
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.
"if not status" should do the job
tests/dump_tests/dump_state_test.py
Outdated
| '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.
Maybe we should cover case that 'rmt_adv_speeds' has multiple values.
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.
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.
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.
there is already port_oper_speed_get() to get the speed, so why is this if check required?
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)