Conversation
|
Has dependency on: |
Makefile.am
Outdated
| @@ -1,4 +1,4 @@ | |||
| SUBDIRS = fpmsyncd neighsyncd intfsyncd portsyncd orchagent swssconfig | |||
| SUBDIRS = fpmsyncd neighsyncd intfsyncd portsyncd orchagent swssconfig vlanconfd | |||
There was a problem hiding this comment.
i prefer vlanmgr than vlanconfd
There was a problem hiding this comment.
There is already bgpconfd. We may change to vlanmgr from vlanconfd, then it introduces name inconsistency.
As suggested by @qiluo-msft in #357, probably we may merge the files of vlan configuration enforcer and intf configuration enforcer into one flat folder while keeping them in separate processes, other future configuration enforcer (in c++) could follow the same practice.
I don't have strong opinion about the naming of configuration enforcer folder and configuration enforcers themselves, but to avoid multiple iterations of name change and folder rearrangement, could @lguohan @taoyl-ms @qiluo-msft @stcheng agree on the following names:
folder name: cfgagent
vlan configuration enforcer: vlanconfd
intf configuration enforcer: intfconfd
Or please help give names (and folder structure) you all agree on, thanks!
Signed-off-by: Jipan Yang <[email protected]>
Signed-off-by: Jipan Yang <[email protected]>
|
can you seperate the vlanmgr and switchmgr into two PR? |
cfgagent/vlanconf.cpp
Outdated
| cmd += DOT1Q_BRIDGE_NAME; | ||
| cmd += " name "; | ||
| cmd += VLAN_PREFIX + to_string(vlan_id) | ||
| + " type vlan id " + to_string(vlan_id); |
There was a problem hiding this comment.
can we contruct the command in one line, easier to ready.
There was a problem hiding this comment.
I had problem compiling it if put them in one line. Will check again to see how to around the problem.
There was a problem hiding this comment.
I think "stringstream" would be a better option here and it takes different types of input so you wudn't have to convert integers to_string
There was a problem hiding this comment.
Using stringstream looks like a good idea.
cfgagent/vlanconf.cpp
Outdated
| gSwtichConfVlan->updateHostFloodControl(port_alias); | ||
|
|
||
| // Bring up vlan member port and set MTU to 9100 by default | ||
| cmd = "ip link set " + port_alias + " up mtu 9100"; |
There was a problem hiding this comment.
9100 hard coded? do we have that value in config db?
There was a problem hiding this comment.
It is hard coded in interfaces.j2, not in config DB. Probably port schema in configDB should be updated to have MTU field.
127.0.0.1:6379[4]> hgetall "PORT|Ethernet20"
- "alias"
- "tenGigE20"
127.0.0.1:6379[4]> hgetall "VLAN_MEMBER|Vlan1000|Ethernet20" - "tagging_mode"
- "untagged"
|
@lguohan Ok, will take switch related configuration to a separate PR |
cfgagent/vlanconf.h
Outdated
| VlanConf(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, vector<string> tableNames); | ||
| void syncCfgDB(); | ||
| private: | ||
| ProducerStateTable m_appVlanTableProducer, m_appVlanMemberTableProducer; |
There was a problem hiding this comment.
P [](start = 0, length = 2)
can you change all tab to spaces?
cfgagent/vlanconfd.cpp
Outdated
|
|
||
| string mac_str; | ||
| swss::exec("ip link show eth0 | grep ether | awk '{print $2}'", mac_str); | ||
| gMacAddress = mac_str; |
There was a problem hiding this comment.
can we make this as an parameter instead of hard code the vlan mac address into the code logic, see -m option in orchagent?
There was a problem hiding this comment.
SWITCH_ATTR in SWITCH table has switch_mac field, to implement mac fetching from configDB SWITCH. mac could be be taken from there if configured, otherwise eth0 mac is used by default.
mac address here is to set on VLAN.
cfgagent/vlanconf.cpp
Outdated
| { | ||
| if (m_stateLagTable.get(alias, temp)) | ||
| { | ||
| SWSS_LOG_DEBUG("%s is ready\n", alias.c_str()); |
There was a problem hiding this comment.
\n [](start = 39, length = 2)
remove this '\n', does dot look like we need it.
Signed-off-by: Jipan Yang <[email protected]>
cfgagent/vlanconf.cpp
Outdated
| swss::exec(cmd, res); | ||
|
|
||
| // When port is not member of any VLAN, it shall be detached from Dot1Q bridge! | ||
| cmd = "bridge vlan show dev " + port_alias + " | grep None"; |
There was a problem hiding this comment.
we need to use the full path for all the commands, otherwise those commands could be override by users.
There was a problem hiding this comment.
right. I'm thinking of having a common header file with all the commands macro defined, full path is specified in the macro definition.
| for (auto i : kfvFieldsValues(t)) | ||
| { | ||
| if (fvField(i) == "tagging_mode") | ||
| tagging_mode = fvValue(i); |
| if (table_name == CFG_VLAN_TABLE_NAME) | ||
| doVlanTask(consumer); | ||
| else if (table_name == CFG_VLAN_MEMBER_TABLE_NAME) | ||
| doVlanMemberTask(consumer); |
Signed-off-by: Jipan Yang <[email protected]>
cfgagent/vlanmgr.cpp
Outdated
| SWSS_LOG_DEBUG("%s", (dumpTuple(consumer, consumer.m_toSync[member_key])).c_str()); | ||
| } | ||
| /* | ||
| * There is pending task from consumber pipe, in this case just skip it. |
Signed-off-by: Jipan Yang <[email protected]>
Signed-off-by: Jipan Yang <[email protected]>
cfgagent/vlanmgr.cpp
Outdated
| EXEC_WITH_ERROR_THROW(cmd.str(), res); | ||
| } | ||
|
|
||
| void VlanMgr::syncCfgDB() |
There was a problem hiding this comment.
syncCfgDB [](start = 14, length = 9)
where is function gets called?
28d5e91 to
d8b6fb8
Compare
|
has dependency on sonic-net/sonic-swss-common#156 |
|
retest this please |
|
retest this please |
|
sonic-net/sonic-swss-common#156 is merged, but build still failed. |
|
Sorry, too many iterations of name change and folder restructuring, I missed OrchBase to Orch name change in few places for last commit. Please check it again. |
Signed-off-by: Jipan Yang <[email protected]>
|
Removed const string VLAN_PREFIX = "Vlan"; from portsyncd/linksync.cpp |
cfgmgr/vlanmgrd.cpp
Outdated
|
|
||
| string mac_str; | ||
| stringstream cmd; | ||
| cmd << IP_CMD << " link show eth0 | " << GREP_CMD << " ether | " << AWK_CMD << " '{print $2}'"; |
There was a problem hiding this comment.
we need to use the -m option to get the mac address since it is complicated.
You can check here. https://github.com/Azure/sonic-buildimage/blob/37dc7bd4786c793796530e53da304b5e68b7ed16/files/image_config/interfaces/interfaces-config.sh#L7
For some asic, the switch mac must match certain pattern.
Here for the VLAN mac, you will want it to be the same as the switch mac. Therefore, we need to follow the same procedure.
There was a problem hiding this comment.
Ok, I'm think of using the switch table in configDB which has switch mac field
127.0.0.1:6379[4]> hgetall "SWITCH|SWITCH_ATTR"
- "switch_mac"
- "00:05:64:30:73:c0"
In interfaces-config.sh, we set the switch_mac to configDB if it is not there already, then use the configDB data in vlanMgr. This way it gives people the option to specify switch mac other than that of eth0.
There was a problem hiding this comment.
that is fine, but use eth0 mac directly is not an option. need to remove that part from your current code.
cfgmgr/vlanmgr.cpp
Outdated
| /* | ||
| * TODO: support host VLAN mtu setting. | ||
| * Host VLAN mtu should be set only after member configured | ||
| * and VLAN state is not UNKOWN. |
| SWSS_LOG_DEBUG("%s mtu %u: Host VLAN mtu setting to be supported.", key.c_str(), mtu); | ||
| fvVector.push_back(i); | ||
| } | ||
| else if (fvField(i) == "members@") { |
There was a problem hiding this comment.
in the new configdb schema, we have VLAN_MEMBER table, we should remove the members@ attribute in VLAN table, otherwise, there cloud potentially be two sources of truth.
We do not need to do this change now. But, please do it in later PR.
There was a problem hiding this comment.
Ok, will remove it once minigraph.py update for the member processing is committed.
| it++; | ||
| continue; | ||
| } | ||
| string tagging_mode = "untagged"; |
There was a problem hiding this comment.
can you also update the VLAN_MEMBER scheme in https://github.com/Azure/SONiC/wiki/Configuration ?
lguohan
left a comment
There was a problem hiding this comment.
-m need to be added to specify the mac address of the bridge.
Signed-off-by: Jipan Yang <[email protected]>
| FieldValueTuple a("admin_status", "up"); | ||
| fvVector.push_back(a); | ||
| } | ||
| m_appVlanTableProducer.set(key, fvVector); |
There was a problem hiding this comment.
Is there any plan to deal with the operational state of Vlan interface if not yet done? We may need that to disable routing if vlan interface is down.
If we are doing that, I assume some other entity (like netlink message in linksync.cpp) will update the app-db? In that case, do we have a timing issue here? (e,g, netlink messages came before we put the table to app-db)?
We can address this in future PR if needed.
There was a problem hiding this comment.
we need to define the operational state of vlan first. if it mean all members are down, then we have way to know the member oper status already, we do not need to rely on the netlink to get the vlan op status, then. This is going to be another feature request and thus a separate PR.
What I did Admin-disable port before applying media-based NPU serdes attributes from media_settings.json. Why I did it This fix is needed along with xcvrd changes #377. Maintain deterministic behavior of interface bring-up, by toggling host_tx_ready flag, which will trigger CMIS reinit for the module once NPU serdes params have been applied. How I verified it Validated media_settings being notified and applied on Cisco 8111 with subject changes combined with diffs from #360, #377 and #15453. Will update final results once #377 is frozen. Details if related Proposal for xcvrd changes: #356 Signed-off-by: Aman Singhal <[email protected]>
…c-net#2831) What I did Admin-disable port before applying media-based NPU serdes attributes from media_settings.json. Why I did it This fix is needed along with xcvrd changes sonic-net#377. Maintain deterministic behavior of interface bring-up, by toggling host_tx_ready flag, which will trigger CMIS reinit for the module once NPU serdes params have been applied. How I verified it Validated media_settings being notified and applied on Cisco 8111 with subject changes combined with diffs from sonic-net#360, sonic-net#377 and #15453. Will update final results once sonic-net#377 is frozen. Details if related Proposal for xcvrd changes: sonic-net#356 Signed-off-by: Aman Singhal <[email protected]>
* configDB enforcer for VLAN Signed-off-by: Jipan Yang <[email protected]> * Use OrchBase for configDB vlan configuration enforcer Signed-off-by: Jipan Yang <[email protected]> * Rename vlanconf to vlanmgr, and spin off switchmgr Signed-off-by: Jipan Yang <[email protected]> * Use shell full path command macros Signed-off-by: Jipan Yang <[email protected]> * Optimize shell command execution error handling Signed-off-by: Jipan Yang <[email protected]> * Use Orch class for vlanmgrd orchestration Signed-off-by: Jipan Yang <[email protected]> * Support getting switch mac from configDB Signed-off-by: Jipan Yang <[email protected]>
…c-net#2831) What I did Admin-disable port before applying media-based NPU serdes attributes from media_settings.json. Why I did it This fix is needed along with xcvrd changes sonic-net#377. Maintain deterministic behavior of interface bring-up, by toggling host_tx_ready flag, which will trigger CMIS reinit for the module once NPU serdes params have been applied. How I verified it Validated media_settings being notified and applied on Cisco 8111 with subject changes combined with diffs from sonic-net#360, sonic-net#377 and #15453. Will update final results once sonic-net#377 is frozen. Details if related Proposal for xcvrd changes: sonic-net#356 Signed-off-by: Aman Singhal <[email protected]>
sysconfig is added in Python3.2 distutils.sysconfig is from Python2 Python3.6 does not support distutils.sysconfig Signed-off-by: Guohan Lu <[email protected]>
Signed-off-by: Jipan Yang [email protected]
What I did
Configuration enforcer for VLAN
Why I did it
Support vlan configuration via configDB for both initialization and incremental update
How I verified it
VLAN trunk test plan: https://github.com/Azure/SONiC/wiki/VLAN-trunk-test-plan
Details if related