Skip to content

Commit bc6b35e

Browse files
authored
[bgp] Update timer test to use correct neighbor type (#3109)
Bgp update timer test establishes two bgp peering session with pseudoswitch. This neighbor type is ToRRouter for all dut types. Fix is to configure the neighbor based on the dut type
1 parent b4b6d21 commit bc6b35e

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

tests/bgp/test_bgp_update_timer.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class BGPNeighbor(object):
4848

4949
def __init__(self, duthost, ptfhost, name,
5050
neighbor_ip, neighbor_asn,
51-
dut_ip, dut_asn, port, is_quagga=False):
51+
dut_ip, dut_asn, port, neigh_type, is_quagga=False):
5252
self.duthost = duthost
5353
self.ptfhost = ptfhost
5454
self.ptfip = ptfhost.mgmt_ip
@@ -58,6 +58,7 @@ def __init__(self, duthost, ptfhost, name,
5858
self.peer_ip = dut_ip
5959
self.peer_asn = dut_asn
6060
self.port = port
61+
self.type = neigh_type
6162
self.is_quagga = is_quagga
6263

6364
def start_session(self):
@@ -84,7 +85,7 @@ def start_session(self):
8485
neighbor_lo_addr=self.ip,
8586
neighbor_mgmt_addr=self.ip,
8687
neighbor_hwsku=None,
87-
neighbor_type="ToRRouter"
88+
neighbor_type=self.type
8889
)
8990

9091
_write_variable_from_j2_to_configdb(
@@ -166,6 +167,17 @@ def common_setup_teardown(duthost, is_quagga, ptfhost, setup_interfaces):
166167
mg_facts = duthost.minigraph_facts(host=duthost.hostname)["ansible_facts"]
167168
conn0, conn1 = setup_interfaces
168169
dut_asn = mg_facts["minigraph_bgp_asn"]
170+
171+
dut_type = ''
172+
for k,v in mg_facts['minigraph_devices'].iteritems():
173+
if k == duthost.hostname:
174+
dut_type = v['type']
175+
176+
if dut_type == 'ToRRouter':
177+
neigh_type = 'LeafRouter'
178+
else:
179+
neigh_type = 'ToRRouter'
180+
169181
bgp_neighbors = (
170182
BGPNeighbor(
171183
duthost,
@@ -176,6 +188,7 @@ def common_setup_teardown(duthost, is_quagga, ptfhost, setup_interfaces):
176188
conn0["local_addr"].split("/")[0],
177189
dut_asn,
178190
NEIGHBOR_PORT0,
191+
neigh_type,
179192
is_quagga=is_quagga
180193
),
181194
BGPNeighbor(
@@ -187,6 +200,7 @@ def common_setup_teardown(duthost, is_quagga, ptfhost, setup_interfaces):
187200
conn1["local_addr"].split("/")[0],
188201
dut_asn,
189202
NEIGHBOR_PORT1,
203+
neigh_type,
190204
is_quagga=is_quagga
191205
)
192206
)

0 commit comments

Comments
 (0)