- for controller in controllers:
- logger.info("Starting bgp speaker of controller at IP %s "
- % controller.ip)
- logger.info("Checking if zrpcd is "
- "running on the controller node")
-
- cmd = "systemctl status zrpcd"
- output = controller.run_cmd(cmd)
- msg = ("zrpcd is running")
-
- if not output:
- logger.info("zrpcd is not running on the controller node")
- results.add_failure(msg)
- else:
- logger.info("zrpcd is running on the controller node")
- results.add_success(msg)
-
- results.add_to_summary(0, "-")
-
- start_quagga = "odl:configure-bgp -op start-bgp-server " \
- "--as-num 100 --router-id {0}".format(controller.ip)
- test_utils.run_odl_cmd(controller, start_quagga)
-
- logger.info("Checking if bgpd is running"
- " on the controller node")
-
- # Check if there is a non-zombie bgpd process
- output_bgpd = controller.run_cmd("ps --no-headers -C "
- "bgpd -o state")
- states = output_bgpd.split()
- running = any([s != 'Z' for s in states])
-
- msg = ("bgpd is running")
- if not running:
- logger.info("bgpd is not running on the controller node")
- results.add_failure(msg)
- else:
- logger.info("bgpd is running on the controller node")
- results.add_success(msg)
-
- results.add_to_summary(0, "-")
-
- stop_quagga = 'odl:configure-bgp -op stop-bgp-server'
-
- test_utils.run_odl_cmd(controller, stop_quagga)
-
- # disabled because of buggy upstream
- # https://github.com/6WIND/zrpcd/issues/15
- # logger.info("Checking if bgpd is still running"
- # " on the controller node")
-
- # output_bgpd = controller.run_cmd("ps --no-headers -C " \
- # "bgpd -o state")
- # states = output_bgpd.split()
- # running = any([s != 'Z' for s in states])
-
- # msg = ("bgpd is stopped")
- # if not running:
- # logger.info("bgpd is not running on the controller node")
- # results.add_success(msg)
- # else:
- # logger.info("bgpd is still running on the controller node")
- # results.add_failure(msg)
+ controller = controllers[0] # We don't handle HA well
+ get_ext_ip_cmd = "sudo ip a | grep br-ex | grep inet | awk '{print $2}'"
+ ext_net_cidr = controller.run_cmd(get_ext_ip_cmd).split("/")
+ ext_net_mask = ext_net_cidr[1].split('\n')[0]
+ controller_ext_ip = ext_net_cidr[0]
+
+ logger.info("Starting bgp speaker of controller at IP %s "
+ % controller_ext_ip)
+ logger.info("Checking if zrpcd is "
+ "running on the controller node")
+
+ cmd = "systemctl status zrpcd"
+ output = controller.run_cmd(cmd)
+ msg = ("zrpcd is running")
+
+ if not output:
+ logger.info("zrpcd is not running on the controller node")
+ results.add_failure(msg)
+ else:
+ logger.info("zrpcd is running on the controller node")
+ results.add_success(msg)
+
+ results.add_to_summary(0, "-")
+
+ start_quagga = "odl:configure-bgp -op start-bgp-server " \
+ "--as-num 100 --router-id {0}".format(controller_ext_ip)
+ test_utils.run_odl_cmd(controller, start_quagga)
+
+ logger.info("Checking if bgpd is running"
+ " on the controller node")
+
+ # Check if there is a non-zombie bgpd process
+ output_bgpd = controller.run_cmd("ps --no-headers -C "
+ "bgpd -o state")
+ states = output_bgpd.split()
+ running = any([s != 'Z' for s in states])
+
+ msg = ("bgpd is running")
+ if not running:
+ logger.info("bgpd is not running on the controller node")
+ results.add_failure(msg)
+ else:
+ logger.info("bgpd is running on the controller node")
+ results.add_success(msg)
+
+ results.add_to_summary(0, "-")
+
+ # We should be able to restart the speaker
+ # but the test is disabled because of buggy upstream
+ # https://github.com/6WIND/zrpcd/issues/15
+ # stop_quagga = 'odl:configure-bgp -op stop-bgp-server'
+ # test_utils.run_odl_cmd(controller, stop_quagga)
+
+ # logger.info("Checking if bgpd is still running"
+ # " on the controller node")
+
+ # output_bgpd = controller.run_cmd("ps --no-headers -C " \
+ # "bgpd -o state")
+ # states = output_bgpd.split()
+ # running = any([s != 'Z' for s in states])
+
+ # msg = ("bgpd is stopped")
+ # if not running:
+ # logger.info("bgpd is not running on the controller node")
+ # results.add_success(msg)
+ # else:
+ # logger.info("bgpd is still running on the controller node")
+ # results.add_failure(msg)