-
Notifications
You must be signed in to change notification settings - Fork 531
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
[intfmgrd]: Merge intfsyncd into intfmgrd #635
Conversation
7707d61
to
4e26ebe
Compare
Move intfsyncd functionality to intfmgrd, add VRF membership support. Signed-off-by: Marian Pritsak <marianp@mellanox.com>
4e26ebe
to
ab1741c
Compare
cfgmgr/intfmgr.cpp
Outdated
|
||
if (keys.size() != 2) | ||
if (!isIntfStateOk(vrf_name)) |
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.
vrf_name is optional and can be empty here. You would want to check if it is empty. User may just want to configure "mtu" for the interface.
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
cfgmgr/intfmgr.cpp
Outdated
if (op == SET_COMMAND) | ||
{ | ||
/* | ||
* Don't proceed if port/LAG/VLAN is not ready yet. |
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.
Same comment is repeated down. I think you can remove this.
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
} | ||
|
||
string alias(keys[0]); | ||
IpPrefix ip_prefix(keys[1]); | ||
setIntfIp(alias, "add", ip_prefix.to_string(), ip_prefix.isV4()); |
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.
We have to check for return value here. Previously it was via Netlink and hence ensured it was configured in kernel. Now, we have to explicitly check if the address is successfully configured in kernel
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
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.
Using EXEC_WITH_ERROR_THROW
cfgmgr/intfmgr.cpp
Outdated
@@ -43,6 +45,23 @@ bool IntfMgr::setIntfIp(const string &alias, const string &opCmd, | |||
return (ret == 0); | |||
} | |||
|
|||
bool IntfMgr::setIntfVrf(const string &alias, const string vrfName) |
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.
The return value shouldn't be a boolean. For proper error checking, you should return the return value which can be 0, 1 or 2 I believe.
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.
Changed function to use EXEC_WITH_ERROR_THROW
return false; | ||
} | ||
|
||
setIntfVrf(alias, vrf_name); |
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.
Check the return values please and call m_appIntfTableProducer only on 0. Print a syslog error for 1 and 2 along with the value.
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.
Changed function to use EXEC_WITH_ERROR_THROW
} | ||
else if (op == DEL_COMMAND) | ||
{ | ||
setIntfVrf(alias, ""); |
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.
Same comment about return 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.
Changed function to use EXEC_WITH_ERROR_THROW
} | ||
|
||
string alias(keys[0]); | ||
IpPrefix ip_prefix(keys[1]); | ||
setIntfIp(alias, "add", ip_prefix.to_string(), ip_prefix.isV4()); |
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.
Same.
} | ||
else if (op == DEL_COMMAND) | ||
{ | ||
setIntfIp(alias, "del", ip_prefix.to_string(), ip_prefix.isV4()); |
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.
Same.
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.
Changed function to use EXEC_WITH_ERROR_THROW
string op = kfvOp(t); | ||
if (op == SET_COMMAND) | ||
|
||
if (keys.size() == 1) |
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.
What does it mean for the key size to be 1? Shouldn't use literals in the code like that. Please define somewhere and explain.
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.
It is not some kind enum to define. It means exactly if there are two keys or one
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.
My question was to illustrate the need to not use literals in the code. I know what it means. You can still #define somewhere common or even use an enum.
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
@marian-pritsak , @lguohan, looking at the VS test failures, there are test cases that do " |
@@ -13,6 +13,7 @@ using namespace swss; | |||
|
|||
#define VLAN_PREFIX "Vlan" | |||
#define LAG_PREFIX "PortChannel" | |||
#define VNET_PREFIX "Vnet" | |||
|
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.
can you add vs test for this refactoring.
I am think you need to first create
INTERFACE|eth0 with vrf, then check if the interface has been moved to vrf or not.
INTERFACE|eth0|ipaddress, then check if the interface has been assigned with IP address or not.
add another ip address, and check if the interface has been assigned with additional IP.
then, remove the one ip address, and check.
remove another ip address, and check.
Then, check vrf name and check if the interface is moved to another vrf or not.
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.
need to fix the vs test case and add a few more since you have changed the INTERFACE schema.
|
||
if (!vrfName.empty()) | ||
{ | ||
cmd << IP_CMD << " link set " << alias << " master " << vrfName; |
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.
When the interface is enslaved in a vrf, the connected (subnet route) and receive (ip2me route) need to be removed from the old vrf. Is the expectation that SAI will do this automatically?
I don't see this PR taking care of that and I don't see #632 taking care of that either.
Please clarify whether it's been agreed that SAI will do this. If not, then either this PR or the one I mentioned above, need to take care of it, unless I've missed something.
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.
Seems #632 won't be taking care of this. As such, this PR will need to address the issue.
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.
@nikos-github , for the current use-case, the interface configuration (in ConfigDB) will have the interface with the VRF name. That means, when it is created first time, it will be enslaved to this VRF. My understanding is in phase 1, we are not planning for dynamically changing the interface from one VRF to another. When we have the full VRF implementation as part of sonic-net/SONiC#242, this shall be taken care.
* VNET/VRF Changes (#6) * VRF changes * Fixed an IPv6 address parsing issue * Updated logs, removed intfmgr changes in favour of PR #635 * Updated VRF table name * Addressed review comment, test fixes * Remove extra semi-colon * Route handling, review comments (#8) * Vnet route table handling * Addressed review comments * Fix for interface routes, add debug logs
retest this please |
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
b309a80
to
ebc02e7
Compare
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
ebc02e7
to
dda84b3
Compare
@marian-pritsak , there is conflict, can you resolve it? |
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
retest this please |
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
2708d6d
to
7ce4c66
Compare
retest this please |
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
e7f1c4e
to
53efde8
Compare
@lguohan Fixed vs tests |
tests/test_warm_reboot.py
Outdated
@@ -836,6 +835,10 @@ def test_swss_port_state_syncup(dvs, testlog): | |||
dvs.stop_swss() | |||
time.sleep(3) | |||
|
|||
dvs.runcmd("ip addr flush dev Ethernet0") |
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.
Can we use the same method as deleting from Interface table? intf_tbl._del
.
It looks like we add one way and flush another way
tests/test_warm_reboot.py
Outdated
# Defining create neighbor entries (4 ipv4 and 4 ip6, two each on each interface) in linux kernel | ||
intf_tbl = swsscommon.Table(conf_db, "INTERFACE") | ||
fvs = swsscommon.FieldValuePairs([("NULL","NULL")]) | ||
intf_tbl.set("Ethernet0|111.0.0.1/24", fvs) |
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.
Is it possible to use the same intfs
list here as well for consistency, since that is used throughout the function?
tests/test_warm_reboot.py
Outdated
@@ -1556,6 +1560,14 @@ def test_routing_WarmRestart(dvs, testlog): | |||
rt_key = json.loads(addobjs[0]['key']) | |||
assert rt_key['dest'] == "192.168.100.0/24" | |||
|
|||
intf_tbl._del("Ethernet0|111.0.0.1/24") |
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.
Same comment to use intfs
list
53efde8
to
1fb5368
Compare
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
1fb5368
to
9917b52
Compare
@marian-pritsak , can you help look at the VS failure with the latest changes? |
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
@prsunny, routing warm reboot passes on my VM |
retest this please |
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
2b67da6
to
35e3b69
Compare
Conflicts: tests/test_warm_reboot.py
I didn't see this issue got addressed, or have I missed anything here? |
* [syncd] Fix notification on shutdown request * Move check to the beginning of the function
Move intfsyncd functionality to intfmgrd, add VRF membership support.
Signed-off-by: Marian Pritsak marianp@mellanox.com