diff options
-rw-r--r-- | sdnvpn/artifacts/quagga_setup.sh | 9 | ||||
-rw-r--r-- | sdnvpn/lib/quagga.py | 8 | ||||
-rw-r--r-- | sdnvpn/test/functest/run_tests.py | 7 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_3.py | 47 |
4 files changed, 55 insertions, 16 deletions
diff --git a/sdnvpn/artifacts/quagga_setup.sh b/sdnvpn/artifacts/quagga_setup.sh index 6da50e1..8a90198 100644 --- a/sdnvpn/artifacts/quagga_setup.sh +++ b/sdnvpn/artifacts/quagga_setup.sh @@ -12,13 +12,18 @@ sleep 20 # Variables to be filled in with python NEIGHBOR_IP=%s OWN_IP=%s +# directly access the instance from the external net without NAT +EXT_NET_MASK=%s + +ip link set ens7 up +ip addr add $OWN_IP/$EXT_NET_MASK dev ens7 ZEBRA_CONFIG_LOCATION="/etc/quagga/zebra.conf" DAEMONS_FILE_LOCATION="/etc/quagga/daemons" -BGPD_CONFIG_LOCATION="/etc/quagga/daemons" +BGPD_CONFIG_LOCATION="/etc/quagga/bgpd.conf" BGPD_LOG_FILE="/var/log/bgpd.log" -DEBIAN_FONTEND=noninteractive apt-get update +DEBIAN_FRONTEND=noninteractive apt-get update DEBIAN_FRONTEND=noninteractive apt-get install quagga -y touch $BGPD_LOG_FILE diff --git a/sdnvpn/lib/quagga.py b/sdnvpn/lib/quagga.py index e2885c2..9f8a4cd 100644 --- a/sdnvpn/lib/quagga.py +++ b/sdnvpn/lib/quagga.py @@ -29,10 +29,14 @@ def bootstrap_quagga(fip_addr, controller_ip): return rc == 0 -def gen_quagga_setup_script(controller_ip, instance_floating_ip): +def gen_quagga_setup_script(controller_ip, + fake_floating_ip, + ext_net_mask): with open(COMMON_CONFIG.quagga_setup_script_path) as f: template = f.read() - script = template % (controller_ip, instance_floating_ip) + script = template % (controller_ip, + fake_floating_ip, + ext_net_mask) return script diff --git a/sdnvpn/test/functest/run_tests.py b/sdnvpn/test/functest/run_tests.py index e828af3..9acfa0f 100644 --- a/sdnvpn/test/functest/run_tests.py +++ b/sdnvpn/test/functest/run_tests.py @@ -50,6 +50,13 @@ def main(): output = cmd.read() logger.debug(output) + # Workaround for https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-115 + cmd_line = "nova quota-class-update --instances -1 default" + logger.info("Setting instances quota to unlimited : %s" % cmd_line) + cmd = os.popen(cmd_line) + output = cmd.read() + logger.debug(output) + with open(COMMON_CONFIG.config_file) as f: config_yaml = yaml.safe_load(f) diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py index 8bbc738..0253444 100644 --- a/sdnvpn/test/functest/testcase_3.py +++ b/sdnvpn/test/functest/testcase_3.py @@ -29,7 +29,6 @@ import functest.utils.functest_logger as ft_logger from sdnvpn.lib.results import Results - COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig("testcase_3") @@ -43,11 +42,6 @@ parser.add_argument("-r", "--report", 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(): results = Results(COMMON_CONFIG.line_length) @@ -59,6 +53,7 @@ def main(): controllers = [node for node in openstack_nodes if node.is_odl()] + computes = [node for node in openstack_nodes if node.is_compute()] msg = ("Verify that OpenDaylight can start/communicate with zrpcd/Quagga") results.record_action(msg) results.add_to_summary(0, "-") @@ -91,7 +86,6 @@ def main(): results.add_to_summary(0, "-") - # TODO here we need the external ip of the controller 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) @@ -173,7 +167,7 @@ def main(): glance_client, COMMON_CONFIG.ubuntu_image_name, COMMON_CONFIG.ubuntu_image_path, - disk="qcow2", + disk="raw", container="bare", public="public") @@ -187,9 +181,27 @@ def main(): # We also create the FIP first because it is used in the # cloud-init script. fip = os_utils.create_floating_ip(neutron_client) - + # fake_fip is needed to bypass NAT + # see below for the reason why. + fake_fip = os_utils.create_floating_ip(neutron_client) + # pin quagga to some compute + compute_node = nova_client.hypervisors.list()[0] + quagga_compute_node = "nova:" + compute_node.hypervisor_hostname + # Map the hypervisor used above to a compute handle + # returned by releng's manager + for comp in computes: + if compute_node.host_ip in comp.run_cmd("ip a"): + compute = comp + break + # Get the mask of ext net of the compute where quagga is running + # TODO check this works on apex + cmd = "ip a | grep br-ex | grep inet | awk '{print $2}'" + ext_cidr = compute.run_cmd(cmd).split("/") + ext_net_mask = ext_cidr[1] quagga_bootstrap_script = quagga.gen_quagga_setup_script( - controllers[0].ip, fip['fip_addr']) + controllers[0].ip, + fake_fip['fip_addr'], + ext_net_mask) quagga_vm = test_utils.create_instance( nova_client, TESTCASE_CONFIG.quagga_instance_name, @@ -198,7 +210,9 @@ def main(): sg_id, fixed_ip=TESTCASE_CONFIG.quagga_instance_ip, flavor=TESTCASE_CONFIG.quagga_instance_flavor, - userdata=quagga_bootstrap_script) + userdata=quagga_bootstrap_script, + compute_node=quagga_compute_node) + fip_added = os_utils.add_floating_ip(nova_client, quagga_vm.id, fip['fip_addr']) @@ -217,6 +231,15 @@ def main(): results.add_failure(testcase) results.add_to_summary(0, "=") + # This part works around NAT + # What we do is attach the instance directly to the OpenStack + # external network. This way is is directly accessible from the + # controller without NAT. We assign a floating IP for this + # to make sure no overlaps happen. + libvirt_instance_name = getattr(quagga_vm, "OS-EXT-SRV-ATTR:instance_name") + compute.run_cmd("virsh attach-interface %s" + " bridge br-ex" % libvirt_instance_name) + results.add_to_summary(0, '-') results.add_to_summary(1, "Peer Quagga with OpenDaylight") results.add_to_summary(0, '-') @@ -229,7 +252,7 @@ def main(): COMMON_CONFIG.image_path, disk=COMMON_CONFIG.image_format, container="bare", - public=True) + public="public") instance = test_utils.create_instance( nova_client, |