summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py31
-rw-r--r--sdnvpn/lib/utils.py61
-rw-r--r--sdnvpn/test/functest/run_tests.py19
-rw-r--r--sdnvpn/test/functest/testcase_3.py9
-rw-r--r--sdnvpn/test/functest/testcase_7.py4
-rw-r--r--sdnvpn/test/functest/testcase_8.py4
6 files changed, 91 insertions, 37 deletions
diff --git a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
index 655f816..34a6732 100644
--- a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
+++ b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
@@ -40,7 +40,11 @@ class ODLReInstaller(Service):
self.nodes = NodeManager(node_config['servers']).get_nodes()
for node in self.nodes:
node.execute('ovs-vsctl del-controller br-int', as_root=True)
+ first_controller = None
for node in self.nodes:
+ if not first_controller:
+ if 'controller' in node.execute('echo $HOSTNAME')[0]:
+ first_controller = node
# Check if ODL runs on this node
rv, _ = node.execute('ps aux |grep -v grep |grep karaf',
as_root=True, check_exit_code=[0, 1])
@@ -52,6 +56,8 @@ class ODLReInstaller(Service):
self.disconnect_ovs(node)
# Upgrade ODL
+ if not self.odl_node:
+ self.odl_node = first_controller
self.reinstall_odl(self.odl_node, odl_artifact)
# Wait for ODL to come back up
@@ -85,19 +91,26 @@ class ODLReInstaller(Service):
LOG.info("OpenDaylight Upgrade Successful!")
@staticmethod
- def reinstall_odl(node, odl_tarball):
+ def reinstall_odl(node, odl_artifact):
tar_tmp_path = '/tmp/odl-artifact/'
- node.copy('to', odl_tarball, tar_tmp_path + odl_tarball)
+ node.copy('to', odl_artifact, tar_tmp_path + odl_artifact)
node.execute('rm -rf /opt/opendaylight/*', as_root=True)
node.execute('mkdir -p /opt/opendaylight/*', as_root=True)
- LOG.info('Extracting %s to /opt/opendaylight/ on node %s'
- % (odl_tarball, node.name))
- node.execute('tar -zxf %s --strip-components=1 -C '
- '/opt/opendaylight/'
- % (tar_tmp_path + odl_tarball), as_root=True)
- node.execute('chown -R odl:odl /opt/opendaylight', as_root=True)
+ if 'tar.gz' in odl_artifact:
+ LOG.info('Extracting %s to /opt/opendaylight/ on node %s'
+ % (odl_artifact, node.name))
+ node.execute('tar -zxf %s --strip-components=1 -C '
+ '/opt/opendaylight/'
+ % (tar_tmp_path + odl_artifact), as_root=True)
+ node.execute('chown -R odl:odl /opt/opendaylight', as_root=True)
+ if '.rpm' in odl_artifact:
+ LOG.info('Installing %s on node %s'
+ % (odl_artifact, node.name))
+ node.execute('yum remove -y opendaylight', as_root=True)
+ node.execute('yum install -y %s'
+ % (tar_tmp_path + odl_artifact), as_root=True)
node.execute('rm -rf ' + tar_tmp_path, as_root=True)
- LOG.info('Installing and Starting Opendaylight on node %s' % node.name)
+ LOG.info('Starting Opendaylight on node %s' % node.name)
node.execute('puppet apply -e "include opendaylight" '
'--modulepath=/etc/puppet/modules/ '
'--verbose --debug --trace --detailed-exitcodes',
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index 90fce4a..eb59446 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -343,22 +343,57 @@ def assert_and_get_compute_nodes(nova_client, required_node_number=2):
return compute_nodes
-def open_icmp_ssh(neutron_client, security_group_id):
- os_utils.create_secgroup_rule(neutron_client,
- security_group_id,
- 'ingress',
- 'icmp')
- os_utils.create_secgroup_rule(neutron_client,
- security_group_id,
- 'tcp',
- 80, 80)
+def open_icmp(neutron_client, security_group_id):
+ if os_utils.check_security_group_rules(neutron_client,
+ security_group_id,
+ 'ingress',
+ 'icmp'):
+
+ if not os_utils.create_secgroup_rule(neutron_client,
+ security_group_id,
+ 'ingress',
+ 'icmp'):
+ logger.error("Failed to create icmp security group rule...")
+ else:
+ logger.info("This rule exists for security group: %s"
+ % security_group_id)
+
+
+def open_http_port(neutron_client, security_group_id):
+ if os_utils.check_security_group_rules(neutron_client,
+ security_group_id,
+ 'ingress',
+ 'tcp',
+ 80, 80):
+
+ if not os_utils.create_secgroup_rule(neutron_client,
+ security_group_id,
+ 'ingress',
+ 'tcp',
+ 80, 80):
+
+ logger.error("Failed to create http security group rule...")
+ else:
+ logger.info("This rule exists for security group: %s"
+ % security_group_id)
def open_bgp_port(neutron_client, security_group_id):
- os_utils.create_secgroup_rule(neutron_client,
- security_group_id,
- 'tcp',
- 179, 179)
+ if os_utils.check_security_group_rules(neutron_client,
+ security_group_id,
+ 'ingress',
+ 'tcp',
+ 179, 179):
+
+ if not os_utils.create_secgroup_rule(neutron_client,
+ security_group_id,
+ 'ingress',
+ 'tcp',
+ 179, 179):
+ logger.error("Failed to create bgp security group rule...")
+ else:
+ logger.info("This rule exists for security group: %s"
+ % security_group_id)
def exec_cmd(cmd, verbose):
diff --git a/sdnvpn/test/functest/run_tests.py b/sdnvpn/test/functest/run_tests.py
index 1130759..140aee2 100644
--- a/sdnvpn/test/functest/run_tests.py
+++ b/sdnvpn/test/functest/run_tests.py
@@ -20,13 +20,7 @@ import functest.utils.functest_utils as ft_utils
from sdnvpn.lib import config as sdnvpn_config
-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-run-tests").getLogger()
+logger = ft_logger.Logger(__name__).getLogger()
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TEST_DB_URL = COMMON_CONFIG.test_db
@@ -42,7 +36,7 @@ def push_results(testname, start_time, end_time, criteria, details):
details)
-def main():
+def main(report=False):
# Workaround for https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-100
# and SDNVPN-126
cmd_line = "neutron quota-update --subnet -1 --network -1 --port -1"
@@ -88,7 +82,7 @@ def main():
if status == "FAIL":
overall_status = "FAIL"
- if args.report:
+ if report:
push_results(
test_name_db, start_time, end_time, status, details)
@@ -99,4 +93,9 @@ def main():
if __name__ == '__main__':
- main()
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-r", "--report",
+ help="Create json result file",
+ action="store_true")
+ args = parser.parse_args()
+ main(report=args.report)
diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py
index b7df013..2e6d6b0 100644
--- a/sdnvpn/test/functest/testcase_3.py
+++ b/sdnvpn/test/functest/testcase_3.py
@@ -52,6 +52,7 @@ def main():
if "running" in
node.run_cmd("sudo systemctl status opendaylight")]
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, "-")
@@ -138,8 +139,8 @@ def main():
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",
+ "http://artifacts.opnfv.org/sdnvpn/"
+ "ubuntu-16.04-server-cloudimg-amd64-disk1.img",
"/home/opnfv/functest/data/")
else:
logger.info("Using old image")
@@ -151,7 +152,9 @@ def main():
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_icmp(neutron_client, sg_id)
+ test_utils.open_http_port(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,
diff --git a/sdnvpn/test/functest/testcase_7.py b/sdnvpn/test/functest/testcase_7.py
index 3bc9afb..00e9eef 100644
--- a/sdnvpn/test/functest/testcase_7.py
+++ b/sdnvpn/test/functest/testcase_7.py
@@ -74,7 +74,9 @@ def main():
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_icmp(neutron_client, sg_id)
+ test_utils.open_http_port(neutron_client, sg_id)
+
vm_2 = test_utils.create_instance(
nova_client,
TESTCASE_CONFIG.instance_2_name,
diff --git a/sdnvpn/test/functest/testcase_8.py b/sdnvpn/test/functest/testcase_8.py
index 1fdfa00..dc479b5 100644
--- a/sdnvpn/test/functest/testcase_8.py
+++ b/sdnvpn/test/functest/testcase_8.py
@@ -73,7 +73,9 @@ def main():
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_icmp(neutron_client, sg_id)
+ test_utils.open_http_port(neutron_client, sg_id)
+
vm_2 = test_utils.create_instance(
nova_client,
TESTCASE_CONFIG.instance_2_name,