summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes/release-notes.rst148
-rw-r--r--docs/scenarios/os-odl_l2-bgpvpn/scenario.description.rst10
-rw-r--r--docs/userguide/feature.userguide.rst30
-rw-r--r--sdnvpn/artifacts/quagga_setup.sh68
-rw-r--r--sdnvpn/lib/config.py12
-rw-r--r--sdnvpn/lib/quagga.py76
-rw-r--r--sdnvpn/lib/results.py6
-rw-r--r--sdnvpn/lib/utils.py62
-rw-r--r--sdnvpn/test/functest/config.yaml22
-rw-r--r--sdnvpn/test/functest/testcase_3.py166
10 files changed, 494 insertions, 106 deletions
diff --git a/docs/release-notes/release-notes.rst b/docs/release-notes/release-notes.rst
index 17fef44..fe0fbbe 100644
--- a/docs/release-notes/release-notes.rst
+++ b/docs/release-notes/release-notes.rst
@@ -1,6 +1,6 @@
-===============================================================================
-OPNFV Release Note for the Colorado.1.0 release of OPNFV for SDN VPN feature
-===============================================================================
+==========================================================================
+OPNFV Release Note for the Danube.1.0 release of OPNFV for SDN VPN feature
+==========================================================================
License
=======
@@ -12,13 +12,13 @@ License. .. http://creativecommons.org/licenses/by/4.0 ..
Abstract
========
-This document comprises the release notes for the SDN VPN feature contained in the Colorado
+This document comprises the release notes for the SDN VPN feature contained in the Danube
release of OPNFV.
Important notes
===============
-In the Colorado release, SDN VPN only supports ODL as a backend. Make sure to always deploy
+In the Danube release, SDN VPN only supports ODL as a backend. Make sure to always deploy
SDN VPN and ODL together. Make use of deployment scenarios including the SDNVPN feature.
Summary
@@ -30,43 +30,43 @@ through the OpenStack Neutron BGPVPN API extension.
Release Data
============
-+--------------------------------------+--------------------------------------+
-| **Project** | sdnvpn |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Repo/tag** | Colorado.1.0 |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Release designation** | Colorado 1.0 follow-up release |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Release date** | September 22 2016 |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Purpose of the delivery** | Including BGP stack - Quagga |
-| | Fuel 9.0 baseline + Bug-fixes |
-| | HEAT integration |
-| | 2 new e2e testcases for Functest |
-| | Documentation |
-| | |
-+--------------------------------------+--------------------------------------+
++--------------------------------------+-------------------------------------------+
+| **Project** | sdnvpn |
+| | |
++--------------------------------------+-------------------------------------------+
+| **Repo/tag** | Danube.1.0 |
+| | |
++--------------------------------------+-------------------------------------------+
+| **Release designation** | Danube 1.0 follow-up release |
+| | |
++--------------------------------------+-------------------------------------------+
+| **Release date** | March 23 2016 |
+| | |
++--------------------------------------+-------------------------------------------+
+| **Purpose of the delivery** | Including BGP stack - 6WIND Zrpcd/Quagga |
+| | Fuel 10.0 baseline + bug fixes |
+| | Deployment with Apex |
+| | Integration with Boron SR2.0 and bugfixes |
+| | 4 new e2e testcases for Functest |
+| | Horizon integration for networking-bgpvpn |
+| | |
++--------------------------------------+-------------------------------------------+
Version change
--------------
-Compared to the Brahmaputra release, a new version of ODL including several critical
-bugfixes is deployed. Together with the new BGP stack and HEAT integration the user
-can use now full stack bgp. New testcases to functest were added to guarantee
-functionality.
+Compared to the Colorado release, a new version of ODL including
+several critical bugfixes is deployed. Together with the new BGP
+stack, integration with Apex, the Horizon dashboards and bugfixes the
+user has even more features available. New testcases were added to
+functest to guarantee functionality.
Module version changes
~~~~~~~~~~~~~~~~~~~~~~
-ODL has been upgraded to Beryllium SR3.
+ODL has been upgraded to Boron SR2.
Document changes
~~~~~~~~~~~~~~~~
-The amount documentation is increased substantially. E2E deployment docu and examples to use bgpvpn
-is added.
Reason for version
------------------
@@ -74,14 +74,27 @@ Reason for version
Feature additions
~~~~~~~~~~~~~~~~~
-SDN VPN adds the possibility to create and associate BGP/MPLS based Virtual Private Networks (VPNs)
-through the OpenStack Neutron BGPVPN API extension.
+SDN VPN adds the possibility to create and associate BGP/MPLS based
+Virtual Private Networks (VPNs) through the OpenStack Neutron BGPVPN
+API extension.
+
+A new installer based on Apex is provided.
+The Horizon dashboard for the OpenStack Neutron BGPVPN API extensions
+is available.
Bug corrections
~~~~~~~~~~~~~~~
-Several bugs in ODL VPN Service have been fixed in this release.
+- Several bugs in ODL VPN Service have been fixed in this release.
+
+- Floating IP is now working and tested in functest, relevant Tempest
+ tests have been enabled.
+
+- Performance issues have been rectified and the relevant tests have
+ been enabled again.
+
+- Yardstick testcases have been enabled again.
Deliverables
------------
@@ -90,8 +103,13 @@ Software deliverables
~~~~~~~~~~~~~~~~~~~~~
- Fuel plugin for OpenStack BGPVPN
-- Changes to ODL Fuel plugin to activate VPN Service Karaf feature
-- Integration of VPN Service functional tests and BGPVPN API tests into Functest framework
+- Changes to ODL Fuel plugin to activate the NetVirt Karaf features
+ and to apply the appropriate configuration. Also changes to
+ implement integration with 6Wind Zrpcd and Quagga.
+- Changes to Apex to enable a BGPVPN deployment.
+- Integration of VPN Service functional tests and BGPVPN API tests into Functest framework.
+- Enabling performance tests in Yardstick.
+- Changes to 6Wind Zrpcd to enable integration with Apex.
Documentation deliverables
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -102,7 +120,7 @@ Documentation deliverables
- User guide
-- Release noes (this document)
+- Release notes (this document)
Known Limitations, Issues and Workarounds
=========================================
@@ -110,49 +128,35 @@ Known Limitations, Issues and Workarounds
System Limitations
------------------
-Floating ip will come with the Boron release so yardstick testcases cannot be run
-and the user is only able to access the node through tenat network. Boron is targeted
-for Colorado 2.0.
-Due to lacking support for floating IPs in ODL VPNService (which replaces Netvirt as
-Neutron backend in the SDN VPN scenarios), the following test suites have some restrictions
-and are not executed:
-- Tempest:
- tempest.api.compute.servers.test_create_server.ServersTestJSON
- tempest.api.compute.servers.test_create_server.ServersTestManualDisk
- tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON
- tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops
- tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
- tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern
- tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern
-
-Yardstick uses the floating ip mechanism to connect to the instances using SSH.
-Therefore, the default test cases have been replaced by the ones running tests on the
-bare-metal servers. Feature specific Yardstick test cases have not been implemented,
-we plan to add these in Colorado 2.0.
-
-It is known that the performance of management operations is quite low. To work around
-the overall timeout of functest, the performance tool Rally was excluded from the
-test list. For Colorado 2.0 a much higher performance is expected and Rally it is
-expected to be included again.
-
-A timeout in promise occurs. This timeout was set from 5 to 10 seconds for all scenarios
-a jira ticket was written to change it back
-in Colorado 2.0: https://jira.opnfv.org/browse/PROMISE-79.
-
-Parser testcase was removed from functest due to low performance. In Colorado 2.0
-a big performance improvement is forseen and Parser will then be added again.
-
Known issues
------------
+Moving to the new NetVirt has caused a regression in which a subnet
+cannot be both attached to a Router and Network associated to a VPN.
+This has been worked around in the tests and the upstream bug is being
+tracked [0].
+
+OpenStack NAT does not work. Instances created in subnets that are connected to
+the public network via a gateway should have external connectivity. This does
+not work and can be worked around by assigning a Floating IP to the instance [1].
+
Workarounds
-----------
+The router/network association mutual exclusivity is worked around
+by not network associating subnets attached to routers.
+
+The NAT issues are worked around by assigning floating IPs to VMs that require
+external connectivity.
+
Test results
============
-The deployment scenarios have successfully deployed in OPNFV CI many times and all Functest tests
-(general and feature specific) are passing.
+The deployment scenarios have successfully deployed in OPNFV CI many
+times and all Functest tests (general and feature specific) are
+passing.
References
==========
+[0] https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-94
+[1] https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-99
diff --git a/docs/scenarios/os-odl_l2-bgpvpn/scenario.description.rst b/docs/scenarios/os-odl_l2-bgpvpn/scenario.description.rst
index 67c79a1..e552bcf 100644
--- a/docs/scenarios/os-odl_l2-bgpvpn/scenario.description.rst
+++ b/docs/scenarios/os-odl_l2-bgpvpn/scenario.description.rst
@@ -33,9 +33,9 @@ has a quite large number of backend drivers (Bagpipe, OpenContrail,
Nuage and OpenDaylight currently). In OPNFV, currently only the OpenDaylight driver
is supported.
-The BGPVPN ODL driver maps the BGPVPN API onto the OpenDaylight VPNService, which exposes the data
+The BGPVPN ODL driver maps the BGPVPN API onto the OpenDaylight NetVirt service, which exposes the data
center overlay like a virtual router to which Neutron Networks and Routers (and in the future also Ports)
-are connected. The VPNService has access to the state of the Neutron API through the OpenDaylight
+are connected. NetVirt has access to the state of the Neutron API through the OpenDaylight
Neutron Northbound Interface module, which has been enhanced to support the BGPVPN API extension.
It uses an internal mesh of VxLAN tunnels to interconnect the vSwitches on the data
center compute nodes. For the purpose of BGP based route exchange with other BGP speakers the ODL
@@ -83,7 +83,7 @@ Limitations, Issues and Workarounds
.. some insight at this point.
Currently, in OPNFV only ODL is supported as a backend for BGPVPN. API calls are
-mapped onto the ODL VPN Service REST API through the BGPVPN ODL driver and the
+mapped onto the ODL NetVirt REST API through the BGPVPN ODL driver and the
ODL Neutron Northbound module.
No DPDK-enabled vhost user ports are supported.
@@ -93,5 +93,5 @@ Integration with data center gateway will not work due to missing OVS patches fo
References
==========
-For more information on the OPNFV Colorado release, please visit
-http://www.opnfv.org/colorado
+For more information on the OPNFV Danube release, please visit
+http://www.opnfv.org/danube
diff --git a/docs/userguide/feature.userguide.rst b/docs/userguide/feature.userguide.rst
index 0b45e28..4f16d3d 100644
--- a/docs/userguide/feature.userguide.rst
+++ b/docs/userguide/feature.userguide.rst
@@ -18,7 +18,7 @@ SDN VPN feature description
A high-level description of the scenarios is provided in this section.
For details of the scenarios and their provided capabilities refer to
the scenario description document:
-http://artifacts.opnfv.org/colorado/sdnpvn/scenarios/os-odl_l2-bgpvpn/index.html
+http://artifacts.opnfv.org/danube/sdnpvn/scenarios/os-odl_l2-bgpvpn/index.html
The BGPVPN feature enables creation of BGP VPNs on the Neutron API according to the OpenStack
BGPVPN blueprint at https://blueprints.launchpad.net/neutron/+spec/neutron-bgp-vpn.
@@ -27,7 +27,7 @@ how to associate it with the existing Neutron object model, as well as a unique
definition of the related semantics. The BGPVPN framework supports a backend
driver model with currently available drivers for Bagpipe, OpenContrail, Nuage
and OpenDaylight. The OPNFV scenario makes use of the OpenDaylight driver and backend
-implementation through the ODL VPNService project.
+implementation through the ODL NetVirt project.
Hardware requirements
=====================
@@ -64,10 +64,10 @@ See in Installation section below how to configure this.
Preparing the host to install Fuel by script
============================================
-.. Not all of these options are relevant for all scenario's. I advise following the
+.. Not all of these options are relevant for all scenarios. I advise following the
.. instructions applicable to the deploy tool used in the scenario.
-Before starting the installation of the <scenario> scenario some preparation of the
+Before starting the installation of the os-odl_l2-bgpnvp scenario some preparation of the
machine that will host the Fuel VM must be done.
Installation of required packages
@@ -98,20 +98,19 @@ First of all the opnfv-fuel repository needs to be cloned:
git clone ssh://<user>@gerrit.opnfv.org:29418/fuel
-This command downloads the whole repository fuel. We need now to switch it to
-the stable Colorado branch:
+This command downloads the whole repository fuel. To checkout a specific
+version of OPNFV, checkout the appropriate branch:
::
cd fuel
- git checkout stable/colorado
+ git checkout stable/<colorado|danube>
-Now download the appropriate OPNFV Fuel ISO into an appropriate folder:
+Now download the corresponding OPNFV Fuel ISO into an appropriate folder from
+the website
::
+ https://www.opnfv.org/software/downloads/release-archives
- wget http://artifacts.opnfv.org/fuel/colorado/opnfv-colorado.1.0.iso
-
-The exact name of the ISO image may change.
-Check https://www.opnfv.org/opnfv-colorado-fuel-users to get the latest ISO.
+Have in mind that the fuel repo version needs to map with the downloaded artifact.
Simplified scenario deployment procedure using Fuel
===================================================
@@ -221,8 +220,11 @@ If plugins are installed and you want to update them use --force flag.
Now the feature can be configured. Create a new environment with "Neutron with ML2 plugin" and
in there "Neutron with tunneling segmentation".
-Then go to settings/other and check "OpenDaylight plugin", "Install Openvswitch with NSH/DPDK" and
-"BGPVPN plugin". Then you should be able to check "BGPVPN extensions" in OpenDaylight plugin section.
+Go to Networks/Settings/Other and check "Assign public network to all nodes". This is required for
+features such as floating IP, which require the Compute hosts to have public interfaces.
+Then go to settings/other and check "OpenDaylight plugin", "Use ODL to manage L3 traffic",
+"BGPVPN plugin" and set the OpenDaylight package version to "5.2.0-1". Then you should
+be able to check "BGPVPN extensions" in OpenDaylight plugin section.
Now the deploy button on fuel dashboard can be used to deploy the environment.
diff --git a/sdnvpn/artifacts/quagga_setup.sh b/sdnvpn/artifacts/quagga_setup.sh
new file mode 100644
index 0000000..6da50e1
--- /dev/null
+++ b/sdnvpn/artifacts/quagga_setup.sh
@@ -0,0 +1,68 @@
+#! /bin/bash
+
+set -xe
+
+# change the password because this script is run on a passwordless cloud-image
+echo 'ubuntu:opnfv' | chpasswd
+
+# Wait for a floating IP
+# as a workaround to NAT breakage
+sleep 20
+
+# Variables to be filled in with python
+NEIGHBOR_IP=%s
+OWN_IP=%s
+
+ZEBRA_CONFIG_LOCATION="/etc/quagga/zebra.conf"
+DAEMONS_FILE_LOCATION="/etc/quagga/daemons"
+BGPD_CONFIG_LOCATION="/etc/quagga/daemons"
+BGPD_LOG_FILE="/var/log/bgpd.log"
+
+DEBIAN_FONTEND=noninteractive apt-get update
+DEBIAN_FRONTEND=noninteractive apt-get install quagga -y
+
+touch $BGPD_LOG_FILE
+chown quagga:quagga $BGPD_LOG_FILE
+
+chown quagga:quagga $DAEMONS_FILE_LOCATION
+cat <<CATEOF > $DAEMONS_FILE_LOCATION
+zebra=yes
+bgpd=yes
+ospfd=no
+ospf6d=no
+ripd=no
+ripngd=no
+isisd=no
+babeld=no
+CATEOF
+
+touch $ZEBRA_CONFIG_LOCATION
+chown quagga:quagga $ZEBRA_CONFIG_LOCATION
+
+cat <<CATEOF > $BGPD_CONFIG_LOCATION
+! -*- bgp -*-
+
+hostname bgpd
+password sdncbgpc
+
+router bgp 200
+ bgp router-id ${OWN_IP}
+ neighbor ${NEIGHBOR_IP} remote-as 100
+ no neighbor ${NEIGHBOR_IP} activate
+!
+ address-family vpnv4 unicast
+ neighbor ${NEIGHBOR_IP} activate
+ exit-address-family
+!
+line vty
+ exec-timeout 0 0
+!
+debug bgp events
+debug bgp updates
+log file ${BGPD_LOG_FILE}
+end
+CATEOF
+chown quagga:quagga $BGPD_CONFIG_LOCATION
+
+pgrep bgpd
+pgrep zebra
diff --git a/sdnvpn/lib/config.py b/sdnvpn/lib/config.py
index 7fc0cd4..4fd40ed 100644
--- a/sdnvpn/lib/config.py
+++ b/sdnvpn/lib/config.py
@@ -21,7 +21,6 @@ class CommonConfig(object):
"""
Common configuration parameters across testcases
"""
-
def __init__(self):
self.repo_path = CONST.dir_repo_sdnvpn
self.config_file = os.path.join(self.repo_path,
@@ -29,6 +28,9 @@ class CommonConfig(object):
self.keyfile_path = os.path.join(self.repo_path,
'sdnvpn/artifacts/id_rsa')
self.test_db = CONST.results_test_db_url
+ self.quagga_setup_script_path = os.path.join(
+ self.repo_path,
+ "sdnvpn/artifacts/quagga_setup.sh")
self.line_length = 90 # length for the summary table
self.vm_boot_timeout = 180
self.default_flavor = ft_utils.get_parameter_from_yaml(
@@ -37,6 +39,14 @@ class CommonConfig(object):
self.image_format = CONST.openstack_image_disk_format
self.image_path = '{0}/{1}'.format(CONST.dir_functest_data,
self.image_filename)
+ # This is the ubuntu image used by sfc
+ # Basically vanilla ubuntu + some scripts in there
+ # We can use it to setup a quagga instance
+ # TODO does functest have an ubuntu image somewhere?
+ self.ubuntu_image_name = "sdnvpn-ubuntu"
+ self.ubuntu_image_path = '{0}/{1}'.format(
+ CONST.dir_functest_data,
+ "ubuntu-16.04-server-cloudimg-amd64-disk1.img")
class TestcaseConfig(object):
diff --git a/sdnvpn/lib/quagga.py b/sdnvpn/lib/quagga.py
new file mode 100644
index 0000000..e2885c2
--- /dev/null
+++ b/sdnvpn/lib/quagga.py
@@ -0,0 +1,76 @@
+"""Utilities for setting up quagga peering"""
+
+import re
+import time
+
+import functest.utils.functest_logger as ft_logger
+import functest.utils.functest_utils as ft_utils
+import sdnvpn.lib.config as config
+from sdnvpn.lib.utils import run_odl_cmd, exec_cmd
+
+logger = ft_logger.Logger("sdnvpn-quagga").getLogger()
+
+COMMON_CONFIG = config.CommonConfig()
+
+
+def odl_add_neighbor(neighbor_ip, controller):
+ command = 'configure-bgp -op add-neighbor --as-num 200'
+ command += ' --ip %s --use-source-ip %s' % (neighbor_ip, controller.ip)
+ success = run_odl_cmd(controller, command)
+ return success
+
+
+def bootstrap_quagga(fip_addr, controller_ip):
+ script = gen_quagga_setup_script(
+ controller_ip,
+ fip_addr)
+ cmd = "sshpass -popnfv ssh opnfv@%s << EOF %s EOF" % (fip_addr, script)
+ rc = ft_utils.execute_command(cmd)
+ return rc == 0
+
+
+def gen_quagga_setup_script(controller_ip, instance_floating_ip):
+ with open(COMMON_CONFIG.quagga_setup_script_path) as f:
+ template = f.read()
+ script = template % (controller_ip, instance_floating_ip)
+ return script
+
+
+def check_for_peering(controller):
+ cmd = 'show-bgp --cmd "ip bgp neighbors"'
+ tries = 20
+ neighbors = None
+ bgp_state_regex = re.compile("(BGP state =.*)")
+ opens_regex = re.compile("Opens:(.*)")
+ while tries > 0:
+ if neighbors and 'Established' in neighbors:
+ break
+ neighbors = run_odl_cmd(controller, cmd)
+ logger.info("Output of %s: %s", cmd, neighbors)
+ if neighbors:
+ opens = opens_regex.search(neighbors)
+ if opens:
+ logger.info("Opens sent/received: %s", opens.group(1))
+ state = bgp_state_regex.search(neighbors)
+ if state:
+ logger.info("Peering state: %s", state.group(1))
+ tries -= 1
+ time.sleep(1)
+
+ if not neighbors or 'Established' not in neighbors:
+ logger.error("Quagga failed to peer with OpenDaylight")
+ logger.error("OpenDaylight status: %s", neighbors)
+ return False
+
+ logger.info("Quagga peered with OpenDaylight")
+ return True
+
+
+def check_for_route_exchange(ip):
+ """Check that Quagga has learned the route to an IP"""
+ logger.debug("Checking that '%s' is in the Zebra routing table", ip)
+ routes, success = exec_cmd("vtysh -c 'show ip route'", verbose=True)
+ if not success:
+ return False
+ logger.debug("Zebra routing table: %s", routes)
+ return ip in routes
diff --git a/sdnvpn/lib/results.py b/sdnvpn/lib/results.py
index 5661d07..9f4fd19 100644
--- a/sdnvpn/lib/results.py
+++ b/sdnvpn/lib/results.py
@@ -114,6 +114,12 @@ class Results(object):
def add_success(self, test):
self.add_to_summary(2, "PASS", test)
+ def add_subtest(self, test, successful):
+ if successful:
+ self.add_success(test)
+ else:
+ self.add_failure(test)
+
def check_ssh_output(self, vm_source, vm_target,
expected, timeout=30):
console_log = vm_source.get_console_output()
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index 00d0fa7..149a37e 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -9,10 +9,12 @@
#
import sys
import time
+import requests
+import re
+import subprocess
import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
-import re
from sdnvpn.lib import config as sdnvpn_config
@@ -20,6 +22,9 @@ logger = ft_logger.Logger("sndvpn_test_utils").getLogger()
common_config = sdnvpn_config.CommonConfig()
+ODL_USER = 'admin'
+ODL_PASS = 'admin'
+
def create_net(neutron_client, name):
logger.debug("Creating network %s", name)
@@ -301,3 +306,58 @@ def open_icmp_ssh(neutron_client, security_group_id):
security_group_id,
'tcp',
80, 80)
+
+
+def open_bgp_port(neutron_client, security_group_id):
+ os_utils.create_secgroup_rule(neutron_client,
+ security_group_id,
+ 'tcp',
+ 179, 179)
+
+
+def exec_cmd(cmd, verbose):
+ success = True
+ logger.debug("Executing '%s'" % cmd)
+ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ output = ""
+ for line in iter(p.stdout.readline, b''):
+ output += line
+
+ if verbose:
+ logger.debug(output)
+
+ p.stdout.close()
+ returncode = p.wait()
+ if returncode != 0:
+ logger.error("Command %s failed to execute." % cmd)
+ success = False
+
+ return output, success
+
+
+def check_odl_fib(ip, controller_ip):
+ """Check that there is an entry in the ODL Fib for `ip`"""
+ url = "http://" + controller_ip + \
+ ":8181/restconf/config/odl-fib:fibEntries/"
+ logger.debug("Querring '%s' for FIB entries", url)
+ res = requests.get(url, auth=(ODL_USER, ODL_PASS))
+ if res.status_code != 200:
+ logger.error("OpenDaylight response status code: %s", res.status_code)
+ return False
+ logger.debug("Checking whether '%s' is in the OpenDaylight FIB"
+ % controller_ip)
+ logger.debug("OpenDaylight FIB: \n%s" % res.text)
+ return ip in res.text
+
+
+def run_odl_cmd(odl_node, cmd):
+ '''
+ Run a command in the OpenDaylight Karaf shell
+
+ This is a bit flimsy because of shell quote escaping, make sure that
+ the cmd passed does not have any top level double quotes or this
+ function will break.
+ '''
+ karaf_cmd = '/opt/opendaylight/bin/client "%s" ' % cmd
+ return odl_node.run_cmd(karaf_cmd)
diff --git a/sdnvpn/test/functest/config.yaml b/sdnvpn/test/functest/config.yaml
index 4a0628b..dd46dde 100644
--- a/sdnvpn/test/functest/config.yaml
+++ b/sdnvpn/test/functest/config.yaml
@@ -67,9 +67,29 @@ testcases:
route_distinguishers2: '222:222'
testcase_3:
- enabled: true
+ enabled: false
description: Data center gateway integration
testname_db: functest_testcase_3
+ secgroup_name: sdnvpn-sg
+ secgroup_descr: Security group for SDNVPN test cases
+ image_name: sdnvpn-image
+ ubuntu_image_name: sdnvpn-ubuntu-image
+ net_1_name: sdnvpn-3-1-net
+ subnet_1_name: sdnvpn-3-1-subnet
+ subnet_1_cidr: 10.10.10.0/24
+ router_1_name: sdnvpn-3-1-router
+ quagga_net_name: sdnvpn-3-2-quagga-net
+ quagga_subnet_name: sdnvpn-3-2-quagga-subnet
+ quagga_subnet_cidr: 10.10.11.0/24
+ quagga_router_name: sdnvpn-3-2-quagga-router
+ quagga_instance_name: sdnvpn-3-2-quagga
+ quagga_instance_ip: 10.10.11.5
+ quagga_instance_flavor: m1.small
+ instance_1_name: sdnvpn-3-1
+ instance_1_ip: 10.10.10.5
+ import_targets: '31:31'
+ export_targets: '32:32'
+
testcase_4:
enabled: true
diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py
index 42b672a..26593f8 100644
--- a/sdnvpn/test/functest/testcase_3.py
+++ b/sdnvpn/test/functest/testcase_3.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
#
# Copyright (c) 2017 All rights reserved
# This program and the accompanying materials
@@ -7,13 +6,37 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
-
+# Tests performed:
+# - Peering OpenDaylight with Quagga:
+# - Set up a Quagga instance in the functest container
+# - Start a BGP router with OpenDaylight
+# - Add the functest Quagga as a neighbor
+# - Verify that the OpenDaylight and functest Quaggas peer
+# - Exchange routing information with Quagga:
+# - Create a network, instance and BGPVPN in OpenStack
+# - Verify the route to the instance is present in the OpenDaylight FIB
+# - Verify that the functest Quagga also learns these routes
+import os
import argparse
+
+from sdnvpn.lib import quagga
+import sdnvpn.lib.utils as test_utils
+import sdnvpn.lib.config as sdnvpn_config
+
+import functest.utils.openstack_utils as os_utils
+import functest.utils.functest_utils as ft_utils
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
+
+COMMON_CONFIG = sdnvpn_config.CommonConfig()
+TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig("testcase_3")
+
+logger = ft_logger.Logger("sdnvpn-testcase-3").getLogger()
+
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--report",
@@ -45,15 +68,15 @@ def main():
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")
+ msg = ("Controller (ODL) list is empty. Skipping rest of tests.")
logger.info(msg)
results.add_failure(msg)
+ return results.compile_summary()
else:
msg = ("Controller (ODL) list is ready")
logger.info(msg)
@@ -79,11 +102,10 @@ def main():
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)
+ start_quagga = "odl:configure-bgp -op start-bgp-server " \
+ "--as-num 100 --router-id {0}".format(controller.ip)
- controller.run_cmd(cmd_start_quagga)
+ test_utils.run_odl_cmd(controller, start_quagga)
logger.info("Checking if bgpd is running"
" on the controller node")
@@ -103,10 +125,9 @@ def main():
results.add_to_summary(0, "-")
- cmd_stop_quagga = '/opt/opendaylight/bin/client -v "odl:configure' \
- '-bgp -op stop-bgp-server"'
+ stop_quagga = 'odl:configure-bgp -op stop-bgp-server'
- controller.run_cmd(cmd_stop_quagga)
+ test_utils.run_odl_cmd(controller, stop_quagga)
# disabled because of buggy upstream
# https://github.com/6WIND/zrpcd/issues/15
@@ -125,6 +146,127 @@ def main():
# logger.info("bgpd is still running on the controller node")
# results.add_failure(msg)
+ # Taken from the sfc tests
+ if not os.path.isfile(COMMON_CONFIG.ubuntu_image_path):
+ logger.info("Downloading image")
+ ft_utils.download_url(
+ "https://cloud-images.ubuntu.com/releases/16.04/"
+ "release/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
+ "/home/opnfv/functest/data/")
+ else:
+ logger.info("Using old image")
+
+ glance_client = os_utils.get_glance_client()
+ nova_client = os_utils.get_nova_client()
+ neutron_client = os_utils.get_neutron_client()
+
+ sg_id = os_utils.create_security_group_full(neutron_client,
+ TESTCASE_CONFIG.secgroup_name,
+ TESTCASE_CONFIG.secgroup_descr)
+ test_utils.open_icmp_ssh(neutron_client, sg_id)
+ test_utils.open_bgp_port(neutron_client, sg_id)
+ net_id, _, _ = test_utils.create_network(neutron_client,
+ TESTCASE_CONFIG.net_1_name,
+ TESTCASE_CONFIG.subnet_1_name,
+ TESTCASE_CONFIG.subnet_1_cidr,
+ TESTCASE_CONFIG.router_1_name)
+
+ quagga_net_id, _, _ = test_utils.create_network(
+ neutron_client,
+ TESTCASE_CONFIG.quagga_net_name,
+ TESTCASE_CONFIG.quagga_subnet_name,
+ TESTCASE_CONFIG.quagga_subnet_cidr,
+ TESTCASE_CONFIG.quagga_router_name)
+
+ ubuntu_image_id = os_utils.create_glance_image(
+ glance_client,
+ COMMON_CONFIG.ubuntu_image_name,
+ COMMON_CONFIG.ubuntu_image_path,
+ disk="qcow2",
+ container="bare",
+ public="public")
+
+ # NOTE(rski) The order of this seems a bit weird but
+ # there is a reason for this, namely
+ # https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-99
+ # so we create the quagga instance using cloud-init
+ # and immediately give it a floating IP.
+ # The cloud-init script should contain a small sleep for
+ # this to work.
+ # We also create the FIP first because it is used in the
+ # cloud-init script.
+ fip = os_utils.create_floating_ip(neutron_client)
+
+ quagga_bootstrap_script = quagga.gen_quagga_setup_script(
+ controllers[0].ip, fip['fip_addr'])
+ quagga_vm = test_utils.create_instance(
+ nova_client,
+ TESTCASE_CONFIG.quagga_instance_name,
+ ubuntu_image_id,
+ quagga_net_id,
+ sg_id,
+ fixed_ip=TESTCASE_CONFIG.quagga_instance_ip,
+ flavor=TESTCASE_CONFIG.quagga_instance_flavor,
+ userdata=quagga_bootstrap_script)
+ fip_added = os_utils.add_floating_ip(nova_client,
+ quagga_vm.id,
+ fip['fip_addr'])
+
+ msg = "Assign a Floating IP to %s " % TESTCASE_CONFIG.quagga_instance_name
+ if fip_added:
+ results.add_success(msg)
+ else:
+ results.add_failure(msg)
+
+ testcase = "Bootstrap quagga inside an OpenStack instance"
+ success = False
+ if success:
+ results.add_success(testcase)
+ else:
+ results.add_failure(testcase)
+ results.add_to_summary(0, "=")
+
+ results.add_to_summary(0, '-')
+ results.add_to_summary(1, "Peer Quagga with OpenDaylight")
+ results.add_to_summary(0, '-')
+
+ neighbor = quagga.odl_add_neighbor(fip['fip_addr'], controller)
+ peer = quagga.check_for_peering(controller)
+
+ image_id = os_utils.create_glance_image(glance_client,
+ TESTCASE_CONFIG.image_name,
+ COMMON_CONFIG.image_path,
+ disk=COMMON_CONFIG.image_format,
+ container="bare",
+ public=True)
+
+ instance = test_utils.create_instance(
+ nova_client,
+ TESTCASE_CONFIG.instance_1_name,
+ image_id,
+ net_id,
+ sg_id,
+ fixed_ip=TESTCASE_CONFIG.instance_1_ip,
+ secgroup_name=TESTCASE_CONFIG.secgroup_name)
+
+ kwargs = {"import_targets": TESTCASE_CONFIG.import_targets,
+ "export_targets": TESTCASE_CONFIG.export_targets,
+ "route_targets": TESTCASE_CONFIG.export_targets,
+ "name": "bgpvpn-3-1"}
+
+ bgpvpn = os_utils.create_bgpvpn(neutron_client, **kwargs)
+ bgpvpn_id = bgpvpn['bgpvpn']['id']
+ os_utils.create_network_association(
+ neutron_client, bgpvpn_id, net_id)
+
+ test_utils.wait_for_instance(instance)
+
+ exchange = quagga.check_for_route_exchange(fip['fip_addr'])
+ if neighbor and peer and exchange:
+ results.add_success("Peering with quagga")
+ else:
+ results.add_failure("Peering with quagga")
+
return results.compile_summary()