summaryrefslogtreecommitdiffstats
path: root/sdnvpn/test/functest/testcase_3.py
diff options
context:
space:
mode:
authortomsou <soth@intracom-telecom.com>2017-02-16 14:48:09 +0000
committertomsou <soth@intracom-telecom.com>2017-02-23 07:34:27 +0000
commit71273a2b8d51725be2743010fb65fb46229dd10c (patch)
tree29c46dfc11c766d0973bb890ab37402f39666089 /sdnvpn/test/functest/testcase_3.py
parentec758275c12562ddc1d92155c38a312c17353dd1 (diff)
Implement testcase 3: Quagga-ODL integration
Testcase 3, which verifies OpenDaylight can start and communicate with zrpcd/Quagga - Verify that zrpdc service is running - Issue bgp speaker start to OpenDaylight - Verify that zrpcd has started bgpd JIRA: SDNVPN-98 Change-Id: Ia0c497292a724161259c669425229d189a317ba2 Signed-off-by: tomsou <soth@intracom-telecom.com> Signed-off-by: Romanos Skiadas <rski@intracom-telecom.com>
Diffstat (limited to 'sdnvpn/test/functest/testcase_3.py')
-rw-r--r--sdnvpn/test/functest/testcase_3.py117
1 files changed, 116 insertions, 1 deletions
diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py
index 36e2d1a..42b672a 100644
--- a/sdnvpn/test/functest/testcase_3.py
+++ b/sdnvpn/test/functest/testcase_3.py
@@ -8,9 +8,124 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import argparse
+import functest.utils.functest_logger as ft_logger
+from sdnvpn.lib import config as sdnvpn_config
+from sdnvpn.lib.results import Results
+from opnfv.deployment.factory import Factory as DeploymentFactory
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument("-r", "--report",
+ help="Create json result file",
+ action="store_true")
+
+args = parser.parse_args()
+
+logger = ft_logger.Logger("sdnvpn-testcase-3").getLogger()
+
+COMMON_CONFIG = sdnvpn_config.CommonConfig()
+TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig("testcase_3")
+
def main():
- pass
+ results = Results(COMMON_CONFIG.line_length)
+ results.add_to_summary(0, "=")
+ results.add_to_summary(2, "STATUS", "SUBTEST")
+ results.add_to_summary(0, "=")
+
+ # TODO unhardcode this to work with apex
+ deploymentHandler = DeploymentFactory.get_handler(
+ 'fuel',
+ '10.20.0.2',
+ 'root',
+ 'r00tme')
+
+ openstack_nodes = deploymentHandler.get_nodes()
+
+ controllers = [node for node in openstack_nodes
+ if node.is_odl()]
+
+ msg = ("Verify that OpenDaylight can start/communicate with zrpcd/Quagga")
+ results.record_action(msg)
+ results.add_to_summary(0, "-")
+
+ if not controllers:
+ msg = ("Controller (ODL) list is empty")
+ logger.info(msg)
+ results.add_failure(msg)
+ else:
+ msg = ("Controller (ODL) list is ready")
+ logger.info(msg)
+ results.add_success(msg)
+
+ 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, "-")
+
+ # TODO here we need the external ip of the controller
+ cmd_start_quagga = '/opt/opendaylight/bin/client "odl:configure-bgp ' \
+ '-op start-bgp-server --as-num 100 ' \
+ '--router-id {0}"'.format(controller.ip)
+
+ controller.run_cmd(cmd_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, "-")
+
+ cmd_stop_quagga = '/opt/opendaylight/bin/client -v "odl:configure' \
+ '-bgp -op stop-bgp-server"'
+
+ controller.run_cmd(cmd_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)
+
+ return results.compile_summary()
if __name__ == '__main__':