Skip to content

Commit d73e068

Browse files
author
vedganes
committed
[neighorch] VOQ Inband port review comments fix 4
- Changes to avoid calling function to add encap index attribute for inband interface host neighbor. Since encap index attribute is supplied only for the remote neighbors and since the inband interface neighbor is local, encap index will not be added even if this function is called. So removed calling the api addVoqEncapIndex() while constructing neighbor add message for inband interface host. - Changes in vs test for system neigh delete to avoid timing issue Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
1 parent 8691db4 commit d73e068

File tree

2 files changed

+16
-36
lines changed

2 files changed

+16
-36
lines changed

orchagent/neighorch.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -1199,11 +1199,6 @@ bool NeighOrch::addInbandNeighbor(string alias, IpAddress ip_address)
11991199
memcpy(attr.value.mac, inband_mac.getMac(), 6);
12001200
neighbor_attrs.push_back(attr);
12011201

1202-
if(!addVoqEncapIndex(alias, ip_address, neighbor_attrs))
1203-
{
1204-
return false;
1205-
}
1206-
12071202
//No host route for neighbor of the Inband IP address
12081203
attr.id = SAI_NEIGHBOR_ENTRY_ATTR_NO_HOST_ROUTE;
12091204
attr.value.booldata = true;

tests/test_virtual_chassis.py

+16-31
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ def test_chassis_system_neigh(self, vct):
278278

279279
assert test_neigh != "", "Neigh not found in ASIC_DB"
280280

281+
# Preserve test neigh asic db key for delete verification later
282+
test_neigh_asic_db_key = test_neigh
283+
281284
# Check for presence of encap index, retrieve and store it for sync verification
282285
test_neigh_entry = asic_db.wait_for_entry("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", test_neigh)
283286
test_neigh_entry_attrs = asic_db.wait_for_fields("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", test_neigh, ["SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX"])
@@ -308,6 +311,9 @@ def test_chassis_system_neigh(self, vct):
308311

309312
assert test_sysneigh != "", "Neigh is not sync-ed to chassis app db"
310313

314+
# Preserve test sys neigh chassis app db key for delete verification later
315+
test_sysneigh_chassis_app_db_key = test_sysneigh
316+
311317
test_sysneigh_entry = chassis_app_db.get_entry("SYSTEM_NEIGH", test_sysneigh)
312318
sys_neigh_encap_index = test_sysneigh_entry.get("encap_index")
313319
assert sys_neigh_encap_index != "", "System neigh in chassis app db does not have encap index"
@@ -335,6 +341,7 @@ def test_chassis_system_neigh(self, vct):
335341
if lc_switch_id != "0":
336342
# Linecard other than linecard 1
337343
asic_db = dvs.get_asic_db()
344+
asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", 1)
338345
neighkeys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY")
339346
assert len(neighkeys), "No neigh entries in ASIC_DB"
340347

@@ -347,6 +354,9 @@ def test_chassis_system_neigh(self, vct):
347354
break
348355

349356
assert remote_neigh != "", "Remote neigh not found in ASIC_DB"
357+
358+
# Preserve remote neigh asic db neigh key for delete verification later
359+
test_remote_neigh_asic_db_key = remote_neigh
350360

351361
# Check for kernel entries
352362

@@ -406,16 +416,8 @@ def test_chassis_system_neigh(self, vct):
406416
# Check for presence of the neighbor in ASIC_DB. The deleted neighbor should
407417
# not be present in the asic db
408418
asic_db = dvs.get_asic_db()
409-
neighkeys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY")
410-
411-
test_neigh = ""
412-
for nkey in neighkeys:
413-
ne = ast.literal_eval(nkey)
414-
if ne['ip'] == test_neigh_ip:
415-
test_neigh = nkey
416-
break
417-
418-
assert test_neigh == "", "Stale neigh entry found in ASIC_DB"
419+
neighkeys = asic_db.wait_for_deleted_entry("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", test_neigh_asic_db_key)
420+
assert len(neighkeys) == 0, "Stale neigh entry found in ASIC_DB"
419421

420422
break
421423

@@ -425,17 +427,8 @@ def test_chassis_system_neigh(self, vct):
425427
if name.startswith("supervisor"):
426428
dvs = dvss[name]
427429
chassis_app_db = DVSDatabase(swsscommon.CHASSIS_APP_DB, dvs.redis_chassis_sock)
428-
sysneighkeys = chassis_app_db.get_keys("SYSTEM_NEIGH")
429-
430-
test_sysneigh = ""
431-
for sysnk in sysneighkeys:
432-
sysnk_tok = sysnk.split("|")
433-
assert len(sysnk_tok) == 3, "Invalid system neigh key in chassis app db"
434-
if sysnk_tok[2] == test_neigh_ip:
435-
test_sysneigh = sysnk
436-
break
437-
438-
assert test_sysneigh == "", "Stale neigh entry in chassis app db"
430+
sysneighkeys = chassis_app_db.wait_for_deleted_entry("SYSTEM_NEIGH", test_sysneigh_chassis_app_db_key)
431+
assert len(sysneighkeys) == 0, "Stale neigh entry in chassis app db"
439432

440433
break
441434

@@ -459,16 +452,8 @@ def test_chassis_system_neigh(self, vct):
459452
# Check for presence of the remote neighbor in ASIC_DB. The remote neighbor corresponding
460453
# to the deleted static neigbor should not be present
461454
asic_db = dvs.get_asic_db()
462-
neighkeys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY")
463-
464-
remote_neigh = ""
465-
for nkey in neighkeys:
466-
ne = ast.literal_eval(nkey)
467-
if ne['ip'] == test_neigh_ip:
468-
remote_neigh = nkey
469-
break
470-
471-
assert remote_neigh == "", "Stale remote neigh in ASIC_DB"
455+
neighkeys = asic_db.wait_for_deleted_entry("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY", test_remote_neigh_asic_db_key)
456+
assert len(neighkeys) == 0, "Stale remote neigh in ASIC_DB"
472457

473458
# Check for kernel entries. Kernel entries (neigh and route) should have been removed
474459

0 commit comments

Comments
 (0)