[intfsorch] Create subport with the entry contains necessary attributes#1650
[intfsorch] Create subport with the entry contains necessary attributes#1650prsunny merged 1 commit intosonic-net:masterfrom
Conversation
|
I'd extend PR description to explicitly mentioned that in case MTU=0 the subport will inherit MTU value from the parent port. |
| MacAddress mac; | ||
|
|
||
| uint32_t mtu; | ||
| uint32_t mtu = 0; |
There was a problem hiding this comment.
Port object is not supposed to be created by "INTF_TABLE:Ethernet4.20:192.169.1.1/24".
In current fix, sub interface admin_status still faces a similar issue that adminUp get some random init value, most likely non-zero, to cause interface SAI ADMIN_STATE to be "true", ignorant of user config in CONFIG_DB.
Try
"INTF_TABLE:Ethernet4.20": {
"admin_status": "false"
}
You will still get ADMIN_V4_STATE and ADMIN_V6_STATE to be "true" in ASIC_DB output.
1) "SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID"
2) "oid:0x3000000000022"
3) "SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS"
4) "02:42:AC:11:00:04"
5) "SAI_ROUTER_INTERFACE_ATTR_TYPE"
6) "SAI_ROUTER_INTERFACE_TYPE_SUB_PORT"
7) "SAI_ROUTER_INTERFACE_ATTR_PORT_ID"
8) "oid:0x1000000000012"
9) "SAI_ROUTER_INTERFACE_ATTR_OUTER_VLAN_ID"
10) "10"
11) "SAI_ROUTER_INTERFACE_ATTR_ADMIN_V4_STATE"
12) "true"
13) "SAI_ROUTER_INTERFACE_ATTR_ADMIN_V6_STATE"
14) "true"
15) "SAI_ROUTER_INTERFACE_ATTR_MTU"
16) "32761"
17) "SAI_ROUTER_INTERFACE_ATTR_NAT_ZONE_ID"
18) "0"
I believe on line 745, we need to amend the condition to create Port object with && !ip_prefix_in_key as root fix, though it does no harm to give mtu an explicit init value. To be consistent, we should do the same treatment to adminUp as mtu. I have reproduced this issue using vs docker, and have crafted a vs test case to validate the root fix.
AssertionError: Expected field/value pairs not found: expected={'SAI_ROUTER_INTERFACE_ATTR_TYPE': 'SAI_ROUTER_INTERFACE_TYPE_SUB_PORT', 'SAI_ROUTER_INTERFACE_ATTR_OUTER_VLAN_ID': '10', 'SAI_ROUTER_INTERFACE_ATTR_ADMIN_V4_STATE': 'false', 'SAI_ROUTER_INTERFACE_ATTR_ADMIN_V6_STATE': 'false', 'SAI_ROUTER_INTERFACE_ATTR_MTU': '9100', 'SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID': 'oid:0x3000000000022'}, received={'SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID': 'oid:0x3000000000022', 'SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS': '02:42:AC:11:00:02', 'SAI_ROUTER_INTERFACE_ATTR_TYPE': 'SAI_ROUTER_INTERFACE_TYPE_SUB_PORT', 'SAI_ROUTER_INTERFACE_ATTR_PORT_ID': 'oid:0x1000000000012', 'SAI_ROUTER_INTERFACE_ATTR_OUTER_VLAN_ID': '10', 'SAI_ROUTER_INTERFACE_ATTR_ADMIN_V4_STATE': 'true', 'SAI_ROUTER_INTERFACE_ATTR_ADMIN_V6_STATE': 'true', 'SAI_ROUTER_INTERFACE_ATTR_MTU': '32630', 'SAI_ROUTER_INTERFACE_ATTR_NAT_ZONE_ID': '0'}, key="oid:0x60000000005f6", table="ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE"
orchagent/intfsorch.cpp
Outdated
| if (isSubIntf) | ||
| { | ||
| if (!gPortsOrch->addSubPort(port, alias, adminUp, mtu)) | ||
| if (!ip_prefix_in_key && !gPortsOrch->addSubPort(port, alias, adminUp, mtu)) |
redis APPL_DB has two entries for subport 8) "INTF_TABLE:Ethernet4.20" 9) "INTF_TABLE:Ethernet4.20:192.169.1.1/24" Sometimes, if the entry with ip_prefix key is fetched first when adding subport, the mtu and adminUp may not have been initialized. the syslog may like Feb 23 02:20:43.650184 as7726-32x-3 NOTICE swss#orchagent: :- addRouterIntfs: Create router interface Ethernet4.20 MTU 32761 Feb 23 02:20:43.651383 as7726-32x-3 ERR syncd#syncd:[none] brcm_sai_create_router_interface:284 Invalid MTU size The mtu is too large, and SAI returns SAI_STATUS_INVALID_PARAMETER Create the subport by the entry w/o ip_prefix key. Also initialize mtu and adminUp to default value.
…es (#1650) Subport mtu and admin_status initialized to values of 0 and false resepectively.
…es (sonic-net#1650) Subport mtu and admin_status initialized to values of 0 and false resepectively.
…model (sonic-net#1650) - What I did This PR brings in support for packages with YANG models and CLI auto generation capabilities for 3rd party packages. - How I did it Packages can set two new flags in manifest - "auto-generate-show" and "auto-generate-config" in addition to YANG module recorded in package image label "com.azure.sonic.yang-module". - How to verify it Build and run. Prepare some package with YANG model and test CLI is generated for it. Signed-off-by: Stepan Blyshchak <stepanb@nvidia.com> Co-authored-by: Vadym Hlushko <vadymh@nvidia.com>
…th YANG model (sonic-net#1650)" (sonic-net#1972) This reverts commit f5e5a56.
…kages with YANG model (sonic-net#1650)" (sonic-net#1972)" (sonic-net#1994) This reverts commit fe00bbf. - What I did Revert previous revert, since the proposed fix has been merged - sonic-net/sonic-buildimage#9587 - How I did it Revert the revert. - How to verify it Run build an on the switch.
…es (sonic-net#1650) Subport mtu and admin_status initialized to values of 0 and false resepectively.
redis APPL_DB has two entries for subport
8) "INTF_TABLE:Ethernet4.20"
9) "INTF_TABLE:Ethernet4.20:192.169.1.1/24"
sometimes, if the entry with ip key are execute first,
the syslog is like
Feb 23 02:20:43.650184 as7726-32x-3 NOTICE swss#orchagent: :- addRouterIntfs: Create router interface Ethernet4.20 MTU 32761
Feb 23 02:20:43.651383 as7726-32x-3 ERR syncd#syncd:[none] brcm_sai_create_router_interface:284 Invalid MTU size
the mtu value is not init and is too large. sai will return SAI_STATUS_INVALID_PARAMETER
Thus, mtu should be initialized to 0
What I did
initialize mtu to 0
Why I did it
sometimes gPortsOrch->addSubPort(port, alias, adminUp, mtu) is called and
the mtu value is not init and is too large. sai will return SAI_STATUS_INVALID_PARAMETER
Thus, mtu should be initialized to 0
How I verified it
create/remove subport interface many times
Details if related