Skip to content
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

[code sync] Merge code from sonic-net/sonic-swss.msft:202305 to 202305 #15

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions orchagent/muxorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,14 +1130,12 @@ void MuxOrch::updateRoute(const IpPrefix &pfx, bool add)
for (auto it = nextHops.begin(); it != nextHops.end(); it++)
{
NextHopKey nexthop = *it;
/* This will only work for configured MUX neighbors (most cases)
* TODO: add way to find MUX from neighbor
*/
MuxCable* cable = findMuxCableInSubnet(nexthop.ip_address);
auto standalone = standalone_tunnel_neighbors_.find(nexthop.ip_address);
NeighborEntry neighbor;
MacAddress mac;

gNeighOrch->getNeighborEntry(nexthop, neighbor, mac);

if ((cable == nullptr && standalone == standalone_tunnel_neighbors_.end()) ||
cable->isActive())
if (isNeighborActive(neighbor.ip_address, mac, neighbor.alias))
{
/* Here we pull from local nexthop ID because neighbor update occurs during state change
* before nexthopID is updated in neighorch. This ensures that if a neighbor is Active
Expand All @@ -1149,11 +1147,11 @@ void MuxOrch::updateRoute(const IpPrefix &pfx, bool add)
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set route entry %s to nexthop %s",
pfx.to_string().c_str(), nexthop.to_string().c_str());
pfx.to_string().c_str(), neighbor.to_string().c_str());
continue;
}
SWSS_LOG_NOTICE("setting route %s with nexthop %s %" PRIx64 "",
pfx.to_string().c_str(), nexthop.to_string().c_str(), next_hop_id);
pfx.to_string().c_str(), neighbor.to_string().c_str(), next_hop_id);
active_found = true;
break;
}
Expand Down
16 changes: 16 additions & 0 deletions tests/test_mux.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ def create_and_test_multi_nexthop_routes(self, dvs, dvs_route, appdb, macs, new_
new_ipv6_nexthop = self.SERV3_IPV6
non_mux_ipv4 = ["11.11.11.11", "12.12.12.12"]
non_mux_ipv6 = ["2222::100", "2222::101"]
mux_neighbor_ipv4 = "192.170.0.100"
mux_neighbor_ipv6 = "fc02:1000:100::100"
non_mux_mac = "00:aa:aa:aa:aa:aa"
mux_ports = ["Ethernet0", "Ethernet4"]
new_mux_port = "Ethernet8"
Expand All @@ -717,6 +719,10 @@ def create_and_test_multi_nexthop_routes(self, dvs, dvs_route, appdb, macs, new_

self.add_neighbor(dvs, new_ipv4_nexthop, new_mac)
self.add_neighbor(dvs, new_ipv6_nexthop, new_mac)
self.add_neighbor(dvs, non_mux_ipv4, non_mux_mac)
self.add_neighbor(dvs, non_mux_ipv6, non_mux_mac)
self.add_neighbor(dvs, mux_neighbor_ipv4, macs[1])
self.add_neighbor(dvs, mux_neighbor_ipv6, macs[1])

for port in mux_ports:
self.set_mux_state(appdb, port, ACTIVE)
Expand All @@ -733,6 +739,14 @@ def create_and_test_multi_nexthop_routes(self, dvs, dvs_route, appdb, macs, new_
self.multi_nexthop_test_route_update_decrease_size(appdb, asicdb, dvs, dvs_route, route_ipv4, mux_ports, ipv4_nexthops)
self.multi_nexthop_test_route_update_decrease_size(appdb, asicdb, dvs, dvs_route, route_ipv6, mux_ports, ipv6_nexthops)

# Testing mux neighbors that do not match mux configured ip
self.add_route(dvs, route_ipv4, [self.SERV1_IPV4, mux_neighbor_ipv4])
self.add_route(dvs, route_ipv6, [self.SERV1_IPV6, mux_neighbor_ipv6])
self.multi_nexthop_test_toggle(appdb, asicdb, dvs_route, route_ipv4, mux_ports, [self.SERV1_IPV4, mux_neighbor_ipv4])
self.multi_nexthop_test_toggle(appdb, asicdb, dvs_route, route_ipv6, mux_ports, [self.SERV1_IPV6, mux_neighbor_ipv6])
self.del_route(dvs,route_ipv4)
self.del_route(dvs,route_ipv6)

# # These tests do not create route, so create beforehand:
self.add_route(dvs, route_ipv4, ipv4_nexthops)
self.add_route(dvs, route_ipv6, ipv6_nexthops)
Expand All @@ -759,6 +773,8 @@ def create_and_test_multi_nexthop_routes(self, dvs, dvs_route, appdb, macs, new_
self.del_neighbor(dvs, neighbor)
self.del_neighbor(dvs, new_ipv4_nexthop)
self.del_neighbor(dvs, new_ipv6_nexthop)
self.del_neighbor(dvs, mux_neighbor_ipv4)
self.del_neighbor(dvs, mux_neighbor_ipv6)

def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac):
'''
Expand Down
Loading