summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/gobgp_test.py
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-07-15 19:53:53 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-31 16:26:17 +0900
commit0b4b806c06f0ee50bb1bc1b30c38399553687abd (patch)
tree6898ec9eeb21a26668012c1c7743772da7b72214 /test/scenario_test/gobgp_test.py
parent2ad42ead02cce21cf71b3dde0731e8f5c6d4ac6a (diff)
config: use the latest openconfig yang
Diffstat (limited to 'test/scenario_test/gobgp_test.py')
-rw-r--r--test/scenario_test/gobgp_test.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/test/scenario_test/gobgp_test.py b/test/scenario_test/gobgp_test.py
index 1333afad..03443777 100644
--- a/test/scenario_test/gobgp_test.py
+++ b/test/scenario_test/gobgp_test.py
@@ -113,9 +113,20 @@ class GoBGPTestBase(unittest.TestCase):
return
self.assertEqual(ans_nexthop, rep_nexthop)
+ def extract_bgp_section(self):
+ with open(self.gobgp_config_file) as f:
+ dst = ''
+ for line in f:
+ if 'DefinedSets' in line:
+ break
+ dst += line
+
+ return dst.encode('utf8')
+
def load_gobgp_config(self):
try:
- self.gobgp_config = toml.loads(open(self.gobgp_config_file).read())
+ t = self.extract_bgp_section()
+ self.gobgp_config = toml.loads(t)
except IOError, (errno, strerror):
print "I/O error(%s): %s" % (errno, strerror)
@@ -169,9 +180,9 @@ class GoBGPTestBase(unittest.TestCase):
# get address of each neighbor from gobpg configration
def get_neighbor_address(self, config):
address = []
- neighbors_config = config['NeighborList']
+ neighbors_config = config['Neighbors']['NeighborList']
for neighbor_config in neighbors_config:
- neighbor_ip = neighbor_config['NeighborAddress']
+ neighbor_ip = neighbor_config['NeighborConfig']['NeighborAddress']
address.append(neighbor_ip)
return address
@@ -266,6 +277,25 @@ class GoBGPTestBase(unittest.TestCase):
print "adj_rib_%s is none" % type
return None
+ # quagga login check
+ def try_login_quagga(self, peer, retry=3, interval=1):
+ print "try login to quagga : %s" % peer
+ if interval < 0:
+ interval = self.wait_per_retry
+ retry_count = 0
+ while True:
+ try:
+ tn = qaccess.login(peer)
+ return tn
+ except:
+ retry_count += 1
+ if retry_count > retry:
+ break
+ print "failed to login to %s" % peer
+ print "wait (" + str(interval) + " seconds)"
+ time.sleep(interval)
+ return None
+
# get route information on quagga
def get_route(self, neighbor_address, target_prefix, retry=3, interval=-1, af=IPv4):