-
Notifications
You must be signed in to change notification settings - Fork 525
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
Change nexthop key to ip & ifname #977
Conversation
[MirrorOrch]: Init the next hop ip with 0 instead of default constructor
|
||
// TODO: set to blackhold if nexthop is empty? | ||
if (ip_addresses.getSize() == 0) |
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 think, if ips = "", you can erase and continue. I don't think we have to introduce 0.0.0.0
to handle this case
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.
Introduce 0.0.0.0 is to prepare for handling directly connected routes. It is better to keep ips and aliases same size, in general handling tokenize("", ',') will get empty vector. Zero ip would be used to construct NextHopGroupKey.
@@ -325,6 +325,17 @@ string RouteSync::getNextHopGw(struct rtnl_route *route_obj) | |||
nl_addr2str(addr, gw_ip, MAX_ADDR_SIZE); | |||
result += gw_ip; | |||
} | |||
else | |||
{ | |||
if (rtnl_route_get_family(route_obj) == AF_INET) |
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 we need this change? The RouteOrch can delete the entry if nexthop.size == 0
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.
As above.
orchagent/routeorch.h
Outdated
} | ||
|
||
inline bool operator<(const NextHopGroupKey &o) const | ||
{ |
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 we need these operators for NHGroupKey. I don't see the usage elsewhere. Please remove if not used.
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 useless, NextHopGroupKey just extended from IpAddresses.
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 remove the unused functions
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 used actually. NextHopGroupKey is used as map key. Compare function is needed for map key. So overload operator< is needed.
tests/test_acl.py
Outdated
fvs = swsscommon.FieldValuePairs([ | ||
("priority", "100"), | ||
("L4_SRC_PORT", "65000"), | ||
("PACKET_ACTION", "REDIRECT:10.0.0.2|Ethernet4")]) |
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 is a schema change, Can you update the swss-schema.md
?
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.
OK. I will update later.
orchagent/intfsorch.cpp
Outdated
return port.m_rif_id; | ||
} | ||
|
||
string IntfsOrch::getRouterIntfsAlias(const IpAddress &ip) |
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 function is ambiguous as same IP can be existing on multiple interfaces in a multi VRF scenario. I don't think we can have a function like this. Is it for some backward compatibility?
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 function will add a vrf argument to support VRF. The VRF PR includes this. Mirror session is using it now, in getNeighborEntry.
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 VRF argument to this function in this PR? It can pass default vrf
from the caller.
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.
OK, actually I had removed it just for this PR.
orchagent/neighorch.h
Outdated
|
||
#define NHFLAGS_IFDOWN 0x1 // nexthop's outbound i/f is down | ||
|
||
struct NeighborEntry | ||
struct NextHopKey |
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.
To me it looks better to be named as NeighborKey
than NextHopKey
.
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.
Now NeighborEntry is same as NextHopKey, I think NeighborEntry can be named as NeighborKey, but I haven't changed it. It is better to distinguish nexthop and neighbor, in some cases just need nexthop although now they are created together.
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 thought is, it is Neighorch and this is the key structure. So with NeighborKey, it aligns with the neighbor orch functionality. Nexthop is created from the Neighbor. Just a suggestion to think, not a blocker
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 agree with Prince to replace the NextHopKey
with NeighborKey
and also remove the NeighborEntry
. Otherwise it is confusing to have various class names.
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.
Also, since the two classes NextHopKey
and NextHopGroupKey
are very large. Please move them outside the header and create a separate header file and the implementation file.
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 think NexthopKey
semantic is more than NeighborKey
. A Route has nexthop but not neigh. Neigh can reuse NexthopKey
as NeighborKey
. But route can't use NeighborKey
as nexthop.
Spliting Nexthopkey
and NextHopGroupKey
is good idea. We will fix it soon.
@tylerlinp , we need to make sure that an old |
@prsunny Sure, we will revise our HLD and code. In fact We doesn't change mirror session schema in current VRF PR. So mirror backward compatibility is not issue. For Acl redirect we can add support for single ip without interface 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.
we don't have any additional comments.
retest this please |
1 similar comment
retest this please |
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.
Could you
orchagent/neighorch.h
Outdated
|
||
#define NHFLAGS_IFDOWN 0x1 // nexthop's outbound i/f is down | ||
|
||
struct NeighborEntry | ||
struct NextHopKey |
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 agree with Prince to replace the NextHopKey
with NeighborKey
and also remove the NeighborEntry
. Otherwise it is confusing to have various class names.
orchagent/neighorch.h
Outdated
|
||
#define NHFLAGS_IFDOWN 0x1 // nexthop's outbound i/f is down | ||
|
||
struct NeighborEntry | ||
struct NextHopKey |
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.
Also, since the two classes NextHopKey
and NextHopGroupKey
are very large. Please move them outside the header and create a separate header file and the implementation file.
orchagent/neighorch.h
Outdated
NextHopKey(const IpAddress &ip, const std::string &alias) : ip_address(ip), alias(alias) {} | ||
NextHopKey(const std::string &str) | ||
{ | ||
if (str.find(',') != string::npos) |
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 this check?
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 originally come from ipAddress
class. Some apps use multi-ipaddresses string to create NexthopKey
class. It needs to throw an exception to reminder the apps to use NexthopGroupKey
class
tests/test_acl.py
Outdated
@@ -1215,6 +1215,141 @@ def test_AclRuleIcmpV6(self, dvs, testlog): | |||
|
|||
self.remove_acl_table(acl_table) | |||
|
|||
def set_admin_status(self, interface, status): |
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.
Could you move these helper functions into conftest.py
file?
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, we will do it.
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 have done this in PR #943.
tests/test_acl.py
Outdated
tbl._del(interface + "|" + ip) | ||
time.sleep(1) | ||
|
||
def test_AclRuleRedirectToNexthop(self, dvs, testlog): |
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.
Since this is to test a new functionality, could you move this portion into a separate PR?
It could be better to add some unit tests that covers the current changes
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.
In fact ACL redirect is the existing function. But no vs test cases can cover it. Since we change nexthop key we add a test case to verify if this function works.
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.
retest this please |
@@ -1,5 +1,9 @@ | |||
sonic (1.0.0) stable; urgency=medium | |||
|
|||
* next-hop key add ifname |
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 keep the changelog as it is since right now we're not updating this file routinely.
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.
New version dpkg-deb use the newest time in chaneglog to set deb files timestamp. There is a problem that new files with same size and timestamp cannot be saved to image in process of PR build, so in this PR fpmsynd cannot be updated and many test cases failed. I add changelog just for building swss.deb with newer timestamp and pass tests.
THE PROBLEM MUST BE RESOLVED, or else the VS test become meaningless, for the running version may not be the codes compiled.
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.
are you referring to the VS test running under this pull request? and the fpmsyncd is not replaced with the latest binary? if that is the case as you described, I'll check.
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,I have forward the email which describes this issue detailly to you. It is common issue, not just on this PR.
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.
could you check right now if the binaries could overwrite the old ones?
I have added Azure/sonic-build-tools@e9e3957 to fix this issue.
could you also resolve the conflicts? thanks! |
1. create separate file for NextHopKey and NextHopGroupKey 2. remove test_AclRuleRedirectToNexthop
retest this please |
…thop_key Resolve conflicts and change nexthop delimiter to '@' Conflicts: orchagent/mirrororch.cpp Modifications: doc/swss-schema.md orchagent/nexthopkey.h orchagent/nexthopgroupkey.h
89dac4c
to
67aca81
Compare
retest this please |
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's better not to update the changelog
@@ -1,5 +1,9 @@ | |||
sonic (1.0.0) stable; urgency=medium | |||
|
|||
* next-hop key add ifname |
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.
could you check right now if the binaries could overwrite the old ones?
I have added Azure/sonic-build-tools@e9e3957 to fix this issue.
What I did
Changed nexthop key including ifname.
Made a supplement to vs test of ACL redirect.
Why I did it
To implement VRF, single IP cannot indicate nexthop uniquely.
How I verified it
vs test
Details if related