Skip to content

Commit

Permalink
Enhanced bgp_fact to validate NEIGH_STATE_TABLE element 'peerType' (s…
Browse files Browse the repository at this point in the history
…onic-net#8462)

Added validation for this change : sonic-net/sonic-buildimage#15265
  • Loading branch information
abdosi authored and AharonMalkin committed Jan 25, 2024
1 parent 4a024d1 commit e898fa8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/bgp/test_bgp_fact.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def test_bgp_facts(duthosts, enum_frontend_dut_hostname, enum_asic_index):
bgp_facts = duthost.bgp_facts(instance_id=enum_asic_index)['ansible_facts']
namespace = duthost.get_namespace_from_asic_id(enum_asic_index)
config_facts = duthost.config_facts(host=duthost.hostname, source="running", namespace=namespace)['ansible_facts']

sonic_db_cmd = "sonic-db-cli {}".format("-n " + namespace if namespace else "")
for k, v in list(bgp_facts['bgp_neighbors'].items()):
# Verify bgp sessions are established
Expand All @@ -24,7 +23,11 @@ def test_bgp_facts(duthosts, enum_frontend_dut_hostname, enum_asic_index):
# Check bgpmon functionality by validate STATE DB contains this neighbor as well
state_fact = duthost.shell('{} STATE_DB HGET "NEIGH_STATE_TABLE|{}" "state"'
.format(sonic_db_cmd, k), module_ignore_errors=False)['stdout_lines']
peer_type = duthost.shell('{} STATE_DB HGET "NEIGH_STATE_TABLE|{}" "peerType"'
.format(sonic_db_cmd, k),
module_ignore_errors=False)['stdout_lines']
assert state_fact[0] == "Established"
assert peer_type[0] == "i-BGP" if v['remote AS'] == v['local AS'] else "e-BGP"

# In multi-asic, would have 'BGP_INTERNAL_NEIGHBORS' and possibly no 'BGP_NEIGHBOR' (ebgp) neighbors.
nbrs_in_cfg_facts = {}
Expand Down

0 comments on commit e898fa8

Please sign in to comment.