Skip to content

Commit

Permalink
Closes-bug: #1780176
Browse files Browse the repository at this point in the history
Change-Id: If239dde4563f4ac03e91f2eb49409c1bdcb743f5
(cherry picked from commit a9f3182)
  • Loading branch information
vappachan committed Jul 13, 2018
1 parent 2b9a97a commit 5a66d4d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
32 changes: 32 additions & 0 deletions fixtures/physical_router_fixture.py
Expand Up @@ -3,6 +3,7 @@
import vnc_api_test
from pif_fixture import PhysicalInterfaceFixture
from physical_device_fixture import PhysicalDeviceFixture
from tcutils.control.cn_introspect_utils import *

class PhysicalRouterFixture(PhysicalDeviceFixture):

Expand Down Expand Up @@ -120,6 +121,37 @@ def setUp(self):
password=self.ssh_password,
logger=self.logger)

@retry(delay=15, tries=10)
def verify_bgp_peer(self):
"""
Check the configured control node has any peer and if so the state is Established.
"""

result = True
for entry1 in self.inputs.bgp_ips:
cn_ispec = ControlNodeInspect(entry1)
cn_bgp_entry = cn_ispec.get_cn_bgp_neigh_entry(encoding='BGP')

if not cn_bgp_entry:
result = False
self.logger.error(
'Control Node %s does not have any BGP Peer' %
(entry1))
else:
for entry in cn_bgp_entry:

if entry['peer'] == self.name:

if entry['state'] != 'Established':
result = result and False
self.logger.error('!!!Node %s peering info:With Peer %s: %s peering is not Established. Current State %s ' % (
entry1, self.tunnel_ip, entry['peer'], entry['state']))
else:
self.logger.info(
'Node %s peering info:With Peer %s : %s peering is Current State is %s ' %
(entry1,self.tunnel_ip, entry['peer'], entry['state']))
return result

def cleanUp(self):
super(PhysicalRouterFixture, self).cleanUp()
do_cleanup = True
Expand Down
2 changes: 1 addition & 1 deletion run_tests.sh
Expand Up @@ -405,7 +405,7 @@ fi

check_test_discovery

setup_physical_routers
setup_physical_routers || die "BGP peering is not up."

if [[ -n $JENKINS_TRIGGERED && $JENKINS_TRIGGERED -eq 1 ]]; then
export REPORT_DETAILS_FILE=report_details_${SCRIPT_TS}_$(date +"%Y_%m_%d_%H_%M_%S").ini
Expand Down
2 changes: 2 additions & 0 deletions tools/setup_physical_routers.py
Expand Up @@ -42,6 +42,8 @@
domain=init_obj.admin_domain
)
phy_router_obj.setUp()
assert phy_router_obj.verify_bgp_peer(), 'BGP peering is not up.'

if device_dict['type'] == 'vcenter_gateway':
vrouter_obj = VirtualRouterFixture(device_dict['name'],
'embedded',
Expand Down

0 comments on commit 5a66d4d

Please sign in to comment.