Skip to content

Commit

Permalink
[syncd] Create neighbor entries before next hop (#1432)
Browse files Browse the repository at this point in the history
During warm boot scenario make sure we will create all neighbor entries
before next hop that have the same IP address as neighbor entry. In
Broadcom platform neighbor entry needs to be created before next hop
with the same ip address otherwise create next hop will fail (hardware
limitation?).
  • Loading branch information
kcudnik authored Oct 21, 2024
1 parent fa76ca1 commit 697d86b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
15 changes: 15 additions & 0 deletions syncd/ComparisonLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3129,6 +3129,21 @@ void ComparisonLogic::applyViewTransition(
}
}

for (auto &obj: temp.m_soAll)
{
/*
* Make sure we will create all neighbor entries before next hop that
* have the same IP address as neighbor entry. In Broadcom platform
* neighbor entry needs to be created before next hop with the same ip
* address otherwise create next hop will fail (hardware limitation?).
*/

if (obj.second->getObjectType() == SAI_OBJECT_TYPE_NEIGHBOR_ENTRY)
{
processObjectForViewTransition(current, temp, obj.second);
}
}

for (auto &obj: temp.m_soAll)
{
if (obj.second->getObjectType() != SAI_OBJECT_TYPE_ROUTE_ENTRY)
Expand Down
28 changes: 28 additions & 0 deletions tests/BCM56850.pl
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,36 @@ sub test_acl_pre_match_999
for (1..8) { play "acl_pre_match_999.rec", 0; }
}

sub test_neighbor_next_hop
{
fresh_start;

play "neighbor_next_hop.rec";

open (my $H, "<", "applyview.log") or die "failed to open applyview.log $!";

my @lines = <$H>;

close ($H);

my $order = "";

for(@lines)
{
$order .= "E" if /create.+NEIGHBOR_ENTRY:/;
$order .= "N" if /create.+NEXT_HOP:/;
}

if (not $order =~ /^E+N+$/)
{
print color('red') . "Invalid order, expected neighbor created first, then next hop" . color('reset') . "\n";
exit 1;
}
}

# RUN TESTS

test_neighbor_next_hop;
test_acl_pre_match_999;
test_relaxed;
test_acl_counter_match;
Expand Down
23 changes: 23 additions & 0 deletions tests/BCM56850/neighbor_next_hop.rec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
2018-11-14.19:34:17.416379|a|INIT_VIEW
2018-11-14.19:34:17.419035|A|SAI_STATUS_SUCCESS
2018-11-14.19:34:17.420345|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true
2018-11-14.19:34:26.317753|a|APPLY_VIEW
2018-11-14.19:34:26.319120|A|SAI_STATUS_SUCCESS
2018-11-14.19:34:17.416379|a|INIT_VIEW
2018-11-14.19:34:17.419035|A|SAI_STATUS_SUCCESS
2018-11-14.19:34:17.420345|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true
2018-11-14.19:34:17.420634|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_DEFAULT_VIRTUAL_ROUTER_ID=oid:0x0
2018-11-14.19:34:26.138403|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_DEFAULT_VIRTUAL_ROUTER_ID=oid:0x3000000000022
2018-11-14.19:34:26.147205|g|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0,oid:0x0
2018-11-14.19:34:26.151676|G|SAI_STATUS_SUCCESS|SAI_SWITCH_ATTR_PORT_LIST=32:oid:0x1000000000002,oid:0x1000000000003,oid:0x1000000000004,oid:0x1000000000005,oid:0x1000000000006,oid:0x1000000000007,oid:0x1000000000008,oid:0x1000000000009,oid:0x100000000000a,oid:0x100000000000b,oid:0x100000000000c,oid:0x100000000000d,oid:0x100000000000e,oid:0x100000000000f,oid:0x1000000000010,oid:0x1000000000011,oid:0x1000000000012,oid:0x1000000000013,oid:0x1000000000014,oid:0x1000000000015,oid:0x1000000000016,oid:0x1000000000017,oid:0x1000000000018,oid:0x1000000000019,oid:0x100000000001a,oid:0x100000000001b,oid:0x100000000001c,oid:0x100000000001d,oid:0x100000000001e,oid:0x100000000001f,oid:0x1000000000020,oid:0x1000000000021
2018-11-14.19:34:27.438163|c|SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x60000000005bc|SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID=oid:0x3000000000022|SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS=00:E0:EC:C2:AD:F1|SAI_ROUTER_INTERFACE_ATTR_TYPE=SAI_ROUTER_INTERFACE_TYPE_PORT|SAI_ROUTER_INTERFACE_ATTR_PORT_ID=oid:0x1000000000009|SAI_ROUTER_INTERFACE_ATTR_MTU=9100
2018-11-14.19:34:29.338659|c|SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x600000000065d|SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID=oid:0x3000000000022|SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS=00:E0:EC:C2:AD:F1|SAI_ROUTER_INTERFACE_ATTR_TYPE=SAI_ROUTER_INTERFACE_TYPE_PORT|SAI_ROUTER_INTERFACE_ATTR_PORT_ID=oid:0x100000000001e|SAI_ROUTER_INTERFACE_ATTR_MTU=9100
2018-11-14.19:34:29.350477|c|SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x6000000000663|SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID=oid:0x3000000000022|SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS=00:E0:EC:C2:AD:F1|SAI_ROUTER_INTERFACE_ATTR_TYPE=SAI_ROUTER_INTERFACE_TYPE_PORT|SAI_ROUTER_INTERFACE_ATTR_PORT_ID=oid:0x1000000000005|SAI_ROUTER_INTERFACE_ATTR_MTU=9100
2018-11-14.19:34:31.339104|c|SAI_OBJECT_TYPE_NEXT_HOP:oid:0x4000000000667|SAI_NEXT_HOP_ATTR_TYPE=SAI_NEXT_HOP_TYPE_IP|SAI_NEXT_HOP_ATTR_IP=10.0.0.55|SAI_NEXT_HOP_ATTR_ROUTER_INTERFACE_ID=oid:0x60000000005bc
2018-11-14.19:34:31.799264|c|SAI_OBJECT_TYPE_NEXT_HOP:oid:0x4000000000668|SAI_NEXT_HOP_ATTR_TYPE=SAI_NEXT_HOP_TYPE_IP|SAI_NEXT_HOP_ATTR_IP=10.0.0.47|SAI_NEXT_HOP_ATTR_ROUTER_INTERFACE_ID=oid:0x6000000000663
2018-11-14.19:34:32.067463|c|SAI_OBJECT_TYPE_NEXT_HOP:oid:0x4000000000669|SAI_NEXT_HOP_ATTR_TYPE=SAI_NEXT_HOP_TYPE_IP|SAI_NEXT_HOP_ATTR_IP=10.0.0.57|SAI_NEXT_HOP_ATTR_ROUTER_INTERFACE_ID=oid:0x600000000065d
2018-11-14.19:34:32.067141|c|SAI_OBJECT_TYPE_NEIGHBOR_ENTRY:{"ip":"10.0.0.57","rif":"oid:0x600000000065d","switch_id":"oid:0x21000000000000"}|SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS=52:54:00:58:BC:32
2018-11-14.19:34:31.798881|c|SAI_OBJECT_TYPE_NEIGHBOR_ENTRY:{"ip":"10.0.0.47","rif":"oid:0x6000000000663","switch_id":"oid:0x21000000000000"}|SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS=52:54:00:57:24:59
2018-11-14.19:34:31.338650|c|SAI_OBJECT_TYPE_NEIGHBOR_ENTRY:{"ip":"10.0.0.55","rif":"oid:0x60000000005bc","switch_id":"oid:0x21000000000000"}|SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS=52:54:00:A4:67:AB
2018-11-14.19:34:26.317753|a|APPLY_VIEW
2018-11-14.19:34:26.319120|A|SAI_STATUS_SUCCESS

0 comments on commit 697d86b

Please sign in to comment.