summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--sdnvpn/test/functest/config.yaml2
-rw-r--r--sdnvpn/test/functest/testcase_3.py117
2 files changed, 117 insertions, 2 deletions
diff --git a/sdnvpn/test/functest/config.yaml b/sdnvpn/test/functest/config.yaml
index c3dc516..4a0628b 100644
--- a/sdnvpn/test/functest/config.yaml
+++ b/sdnvpn/test/functest/config.yaml
@@ -67,7 +67,7 @@ testcases:
route_distinguishers2: '222:222'
testcase_3:
- enabled: false
+ enabled: true
description: Data center gateway integration
testname_db: functest_testcase_3
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__':