tests: Fix info messages print in std_error

Signed-off-by: Ashish Pant <ashish12pant@gmail.com>

frr-reolad.py invocation sends info message to stderror channel
Redirected stderror from frr-reload.py to stdout

Fixed verify_convergence when more than one link is present
This commit is contained in:
Ashish Pant 2019-07-09 10:19:56 +05:30
parent 6bb29e5ea9
commit 870fc40f7a
2 changed files with 10 additions and 10 deletions

View File

@ -904,8 +904,9 @@ def clear_bgp_and_verify(tgen, topo, router):
# To find neighbor ip type # To find neighbor ip type
bgp_addr_type = topo["routers"][router]["bgp"]["address_family"] bgp_addr_type = topo["routers"][router]["bgp"]["address_family"]
total_peer = 0
for addr_type in bgp_addr_type.keys(): for addr_type in bgp_addr_type.keys():
total_peer = 0
if not check_address_types(addr_type): if not check_address_types(addr_type):
continue continue
@ -914,17 +915,16 @@ def clear_bgp_and_verify(tgen, topo, router):
for bgp_neighbor in bgp_neighbors: for bgp_neighbor in bgp_neighbors:
total_peer += len(bgp_neighbors[bgp_neighbor]["dest_link"]) total_peer += len(bgp_neighbors[bgp_neighbor]["dest_link"])
no_of_peer = 0
for addr_type in bgp_addr_type: for addr_type in bgp_addr_type:
bgp_neighbors = bgp_addr_type[addr_type]["unicast"]["neighbor"] bgp_neighbors = bgp_addr_type[addr_type]["unicast"]["neighbor"]
no_of_peer = 0
for bgp_neighbor, peer_data in bgp_neighbors.iteritems(): for bgp_neighbor, peer_data in bgp_neighbors.iteritems():
for dest_link, peer_dict in peer_data["dest_link"].iteritems(): for dest_link, peer_dict in peer_data["dest_link"].iteritems():
data = topo["routers"][bgp_neighbor]["links"] data = topo["routers"][bgp_neighbor]["links"]
if dest_link in data: if dest_link in data:
neighbor_ip = data[dest_link][addr_type].split( neighbor_ip = data[dest_link][addr_type].split("/")[0]
"/")[0]
if addr_type == "ipv4": if addr_type == "ipv4":
ipv4_data = show_bgp_json["ipv4Unicast"][ ipv4_data = show_bgp_json["ipv4Unicast"][
"peers"] "peers"]
@ -984,9 +984,8 @@ def clear_bgp_and_verify(tgen, topo, router):
# To find neighbor ip type # To find neighbor ip type
bgp_addr_type = topo["routers"][router]["bgp"]["address_family"] bgp_addr_type = topo["routers"][router]["bgp"]["address_family"]
total_peer = 0
for addr_type in bgp_addr_type.keys(): for addr_type in bgp_addr_type.keys():
total_peer = 0
if not check_address_types(addr_type): if not check_address_types(addr_type):
continue continue
@ -995,16 +994,16 @@ def clear_bgp_and_verify(tgen, topo, router):
for bgp_neighbor in bgp_neighbors: for bgp_neighbor in bgp_neighbors:
total_peer += len(bgp_neighbors[bgp_neighbor]["dest_link"]) total_peer += len(bgp_neighbors[bgp_neighbor]["dest_link"])
no_of_peer = 0
for addr_type in bgp_addr_type: for addr_type in bgp_addr_type:
bgp_neighbors = bgp_addr_type[addr_type]["unicast"]["neighbor"] bgp_neighbors = bgp_addr_type[addr_type]["unicast"]["neighbor"]
no_of_peer = 0
for bgp_neighbor, peer_data in bgp_neighbors.iteritems(): for bgp_neighbor, peer_data in bgp_neighbors.iteritems():
for dest_link, peer_dict in peer_data["dest_link"].iteritems(): for dest_link, peer_dict in peer_data["dest_link"].iteritems():
data = topo["routers"][bgp_neighbor]["links"] data = topo["routers"][bgp_neighbor]["links"]
if dest_link in data: if dest_link in data:
neighbor_ip = data[dest_link][addr_type]. \ neighbor_ip = data[dest_link][addr_type].\
split("/")[0] split("/")[0]
if addr_type == "ipv4": if addr_type == "ipv4":
ipv4_data = show_bgp_json["ipv4Unicast"][ ipv4_data = show_bgp_json["ipv4Unicast"][

View File

@ -21,6 +21,8 @@
from collections import OrderedDict from collections import OrderedDict
from datetime import datetime from datetime import datetime
from time import sleep from time import sleep
from subprocess import call
from subprocess import STDOUT as SUB_STDOUT
import StringIO import StringIO
import os import os
import ConfigParser import ConfigParser
@ -233,7 +235,7 @@ def reset_config_on_routers(tgen, routerName=None):
command = "/usr/lib/frr/frr-reload.py --input {}/{}/frr.sav" \ command = "/usr/lib/frr/frr-reload.py --input {}/{}/frr.sav" \
" --test {}/{}/frr_json_initial.conf > {}". \ " --test {}/{}/frr_json_initial.conf > {}". \
format(TMPDIR, rname, TMPDIR, rname, dname) format(TMPDIR, rname, TMPDIR, rname, dname)
result = os.system(command) result = call(command, shell=True, stderr=SUB_STDOUT)
# Assert if command fail # Assert if command fail
if result > 0: if result > 0:
@ -359,7 +361,6 @@ def start_topology(tgen):
os.chdir('{}/{}'.format(TMPDIR, rname)) os.chdir('{}/{}'.format(TMPDIR, rname))
os.system('touch zebra.conf bgpd.conf') os.system('touch zebra.conf bgpd.conf')
except IOError as (errno, strerror): except IOError as (errno, strerror):
logger.error("I/O error({0}): {1}".format(errno, strerror)) logger.error("I/O error({0}): {1}".format(errno, strerror))