Skip to content

Commit 3843ddb

Browse files
committed
Removed SoC IP checks
Signed-off-by: Manas Kumar Mandal <[email protected]>
1 parent 96b0157 commit 3843ddb

File tree

2 files changed

+16
-62
lines changed

2 files changed

+16
-62
lines changed

scripts/dualtor_neighbor_check.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,6 @@ def get_mux_server_to_port_map(mux_cables):
407407
return mux_server_to_port_map
408408

409409

410-
def get_mux_soc_neighbors(mux_cables):
411-
mux_soc_neighbor_ips = []
412-
for port, mux_details in mux_cables.items():
413-
if "server_ipv4" in mux_details:
414-
soc_ipv4 = str(ipaddress.ip_interface(mux_details["soc_ipv4"]).ip)
415-
mux_soc_neighbor_ips.append(soc_ipv4)
416-
return mux_soc_neighbor_ips
417-
418410
def get_mac_to_port_name_map(asic_fdb, if_oid_to_port_name_map):
419411
"""Return mac to port name map."""
420412
mac_to_port_name_map = {}
@@ -426,7 +418,7 @@ def get_mac_to_port_name_map(asic_fdb, if_oid_to_port_name_map):
426418

427419
def check_neighbor_consistency(neighbors, mux_states, hw_mux_states, mac_to_port_name_map,
428420
asic_route_table, asic_neigh_table, asic_nexthop_table,
429-
mux_server_to_port_map, mux_soc_neigh_ips):
421+
mux_server_to_port_map):
430422
"""Checks if neighbors are consistent with mux states."""
431423

432424
# Parse route table to get route destinations and their nexthop types
@@ -569,7 +561,6 @@ def parse_check_results(check_results):
569561
neighbors, mux_states, hw_mux_states, asic_fdb, asic_route_table, asic_neigh_table, \
570562
asic_nexthop_table = read_tables_from_db(appl_db)
571563
mac_to_port_name_map = get_mac_to_port_name_map(asic_fdb, if_oid_to_port_name_map)
572-
mux_soc_neigh_ips = get_mux_soc_neighbors(mux_cables)
573564

574565
check_results = check_neighbor_consistency(
575566
neighbors,
@@ -579,8 +570,7 @@ def parse_check_results(check_results):
579570
asic_route_table,
580571
asic_neigh_table,
581572
asic_nexthop_table,
582-
mux_server_to_port_map,
583-
mux_soc_neigh_ips
573+
mux_server_to_port_map
584574
)
585575
res = parse_check_results(check_results)
586576
sys.exit(0 if res else 1)

tests/dualtor_neighbor_check_test.py

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -349,26 +349,6 @@ def test_get_mux_server_to_port_map(self, mock_log_functions):
349349

350350
assert mux_server_to_port_map == result
351351

352-
def test_get_mux_soc_neighbors(self, mock_log_functions):
353-
mux_cables = {
354-
"Ethernet4": {
355-
"server_ipv4": "192.168.0.2/32",
356-
"server_ipv6": "fc02:1000::2/128",
357-
"soc_ipv4": "192.168.0.1/32",
358-
"state": "active"
359-
},
360-
"Ethernet8": {
361-
"server_ipv4": "192.168.0.4/32",
362-
"soc_ipv4": "192.168.0.3/32",
363-
"state": "standby"
364-
}
365-
}
366-
expected_soc_ips = ["192.168.0.1", "192.168.0.3"]
367-
368-
result = dualtor_neighbor_check.get_mux_soc_neighbors(mux_cables)
369-
370-
assert set(expected_soc_ips) == set(result)
371-
372352
def test_check_neighbor_consistency_soc_ip_neighbor(self, mock_log_functions):
373353
mock_log_error, mock_log_warn, _, _ = mock_log_functions
374354
neighbors = {"192.168.0.1": "aa:bb:cc:dd:ee:ff"} # SOC IP neighbor
@@ -386,7 +366,6 @@ def test_check_neighbor_consistency_soc_ip_neighbor(self, mock_log_functions):
386366
["{\"ip\":\"192.168.0.1\",\"rif\":\"oid:0x6000000000671\"," +
387367
"\"switch_id\":\"oid:0x21000000000000\"}"]
388368
mux_server_to_port_map = {}
389-
mux_soc_neigh_ips = ["192.168.0.1", "192.168.0.3"] # SOC neighbor IPs
390369
expected_output = \
391370
["192.168.0.1", "aa:bb:cc:dd:ee:ff", "Ethernet4", "active", "no", "yes", "yes", "NEIGHBOR", "consistent"]
392371
expected_log_output = tabulate.tabulate(
@@ -404,8 +383,7 @@ def test_check_neighbor_consistency_soc_ip_neighbor(self, mock_log_functions):
404383
asic_route_table,
405384
asic_neigh_table,
406385
{'oid:0x40000000005c0': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_IP', 'nexthop_id': 'oid:0x40000000005c0'}},
407-
mux_server_to_port_map,
408-
mux_soc_neigh_ips
386+
mux_server_to_port_map
409387
)
410388
res = dualtor_neighbor_check.parse_check_results(check_results)
411389

@@ -450,7 +428,6 @@ def test_check_neighbor_consistency_multiple_neighbors_with_soc_ips(self, mock_l
450428
"{\"ip\":\"192.168.0.5\",\"rif\":\"oid:0x6000000000671\",\"switch_id\":\"oid:0x21000000000000\"}"
451429
]
452430
mux_server_to_port_map = {"192.168.0.2": "Ethernet4"}
453-
mux_soc_neigh_ips = ["192.168.0.1", "192.168.0.3"]
454431
expected_outputs = [
455432
["192.168.0.1", "aa:bb:cc:dd:ee:ff", "Ethernet4", "active", "no", "yes", "yes", "NEIGHBOR", "consistent"],
456433
["192.168.0.2", "ee:86:d8:46:7d:01", "Ethernet4", "active", "no", "yes", "yes", "NEIGHBOR", "consistent"],
@@ -476,8 +453,7 @@ def test_check_neighbor_consistency_multiple_neighbors_with_soc_ips(self, mock_l
476453
'oid:0x40000000005ae': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP',
477454
'nexthop_id': 'oid:0x40000000005ae'}
478455
},
479-
mux_server_to_port_map,
480-
mux_soc_neigh_ips
456+
mux_server_to_port_map
481457
)
482458
res = dualtor_neighbor_check.parse_check_results(check_results)
483459

@@ -510,8 +486,7 @@ def test_check_neighbor_consistency_no_fdb_entry(self, mock_log_functions):
510486
asic_route_table,
511487
asic_neigh_table,
512488
{},
513-
mux_server_to_port_map,
514-
[]
489+
mux_server_to_port_map
515490
)
516491
res = dualtor_neighbor_check.parse_check_results(check_results)
517492

@@ -552,8 +527,7 @@ def test_check_neighbor_consistency_consistent_neighbor_mux_active(self, mock_lo
552527
asic_route_table,
553528
asic_neigh_table,
554529
{'oid:0x40000000005c0': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_IP', 'nexthop_id': 'oid:0x40000000005c0'}},
555-
mux_server_to_port_map,
556-
[]
530+
mux_server_to_port_map
557531
)
558532
res = dualtor_neighbor_check.parse_check_results(check_results)
559533

@@ -596,8 +570,7 @@ def test_check_neighbor_consistency_inconsistent_neighbor_mux_active_no_asic_nei
596570
asic_neigh_table,
597571
{'oid:0x40000000005ae': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP',
598572
'nexthop_id': 'oid:0x40000000005ae'}},
599-
mux_server_to_port_map,
600-
[]
573+
mux_server_to_port_map
601574
)
602575
res = dualtor_neighbor_check.parse_check_results(check_results)
603576

@@ -640,8 +613,7 @@ def test_check_neighbor_consistency_inconsistent_neighbor_mux_active_asic_tunnel
640613
asic_neigh_table,
641614
{'oid:0x40000000005ae': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP',
642615
'nexthop_id': 'oid:0x40000000005ae'}},
643-
mux_server_to_port_map,
644-
[]
616+
mux_server_to_port_map
645617
)
646618
res = dualtor_neighbor_check.parse_check_results(check_results)
647619

@@ -682,8 +654,7 @@ def test_check_neighbor_consistency_inconsistent_neighbor_mux_active_in_toggle(s
682654
asic_neigh_table,
683655
{'oid:0x40000000005ae': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP',
684656
'nexthop_id': 'oid:0x40000000005ae'}},
685-
mux_server_to_port_map,
686-
[]
657+
mux_server_to_port_map
687658
)
688659
res = dualtor_neighbor_check.parse_check_results(check_results)
689660

@@ -724,8 +695,7 @@ def test_check_neighbor_consistency_consistent_neighbor_mux_standby(self, mock_l
724695
asic_neigh_table,
725696
{'oid:0x40000000005ae': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP',
726697
'nexthop_id': 'oid:0x40000000005ae'}},
727-
mux_server_to_port_map,
728-
[]
698+
mux_server_to_port_map
729699
)
730700
res = dualtor_neighbor_check.parse_check_results(check_results)
731701

@@ -767,8 +737,7 @@ def test_check_nbr_consistency_inconsistent_nbr_mux_standby_no_asic_tunnel_route
767737
asic_route_table,
768738
asic_neigh_table,
769739
{'oid:0x40000000005c0': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_IP', 'nexthop_id': 'oid:0x40000000005c0'}},
770-
mux_server_to_port_map,
771-
[]
740+
mux_server_to_port_map
772741
)
773742
res = dualtor_neighbor_check.parse_check_results(check_results)
774743

@@ -812,8 +781,7 @@ def test_check_neighbor_consistency_inconsistent_neighbor_mux_standby_asic_neigh
812781
asic_neigh_table,
813782
{'oid:0x40000000005ae': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_IP',
814783
'nexthop_id': 'oid:0x40000000005ae'}},
815-
mux_server_to_port_map,
816-
[]
784+
mux_server_to_port_map
817785
)
818786
res = dualtor_neighbor_check.parse_check_results(check_results)
819787

@@ -854,8 +822,7 @@ def test_check_neighbor_consistency_inconsistent_neighbor_mux_standby_in_toggle(
854822
asic_neigh_table,
855823
{'oid:0x40000000005ae': {'nexthop_type': 'SAI_NEXT_HOP_TYPE_IP',
856824
'nexthop_id': 'oid:0x40000000005ae'}},
857-
mux_server_to_port_map,
858-
[]
825+
mux_server_to_port_map
859826
)
860827
res = dualtor_neighbor_check.parse_check_results(check_results)
861828

@@ -895,8 +862,7 @@ def test_check_neighbor_consistency_zero_mac_neighbor(self, mock_log_functions):
895862
asic_route_table,
896863
asic_neigh_table,
897864
{},
898-
mux_server_to_port_map,
899-
[]
865+
mux_server_to_port_map
900866
)
901867
res = dualtor_neighbor_check.parse_check_results(check_results)
902868

@@ -931,8 +897,7 @@ def test_check_neighbor_consistency_zero_mac_expired_neighbor(self, mock_log_fun
931897
asic_route_table,
932898
asic_neigh_table,
933899
{},
934-
mux_server_to_port_map,
935-
[]
900+
mux_server_to_port_map
936901
)
937902
res = dualtor_neighbor_check.parse_check_results(check_results)
938903

@@ -968,8 +933,7 @@ def test_check_neighbor_consistency_inconsistent_zero_mac_neighbor(self, mock_lo
968933
asic_route_table,
969934
asic_neigh_table,
970935
{},
971-
mux_server_to_port_map,
972-
[]
936+
mux_server_to_port_map
973937
)
974938
res = dualtor_neighbor_check.parse_check_results(check_results)
975939

0 commit comments

Comments
 (0)