diff options
-rw-r--r-- | docs/release/release-notes/release-notes.rst | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | odl-pipeline/lib/odl_reinstaller.sh | 20 | ||||
-rw-r--r-- | odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py | 59 | ||||
-rw-r--r-- | sdnvpn/test/functest/run_sdnvpn_tests.py | 18 |
4 files changed, 92 insertions, 11 deletions
diff --git a/docs/release/release-notes/release-notes.rst b/docs/release/release-notes/release-notes.rst index 652bf32..1a3e9a5 100644 --- a/docs/release/release-notes/release-notes.rst +++ b/docs/release/release-notes/release-notes.rst @@ -44,13 +44,13 @@ Release Data | **Project** | sdnvpn | | | | +--------------------------------------+-------------------------------------------+ -| **Repo/tag** | Fraser 6.0 | +| **Repo/tag** | opnfv-6.2.0 | | | | +--------------------------------------+-------------------------------------------+ -| **Release designation** | Fraser 6.0 - initial release | +| **Release designation** | Fraser 6.2 | | | | +--------------------------------------+-------------------------------------------+ -| **Release date** | Apr 27 2018 | +| **Release date** | June 29 2018 | | | | +--------------------------------------+-------------------------------------------+ | **Purpose of the delivery** | New test cases | diff --git a/odl-pipeline/lib/odl_reinstaller.sh b/odl-pipeline/lib/odl_reinstaller.sh index cb34489..a55f16c 100644..100755 --- a/odl-pipeline/lib/odl_reinstaller.sh +++ b/odl-pipeline/lib/odl_reinstaller.sh @@ -11,4 +11,24 @@ set -e export PYTHONPATH=$PYTHONPATH:$DIR mkdir -p $DIR/tmp cd $DIR +cat > opendaylight.service << EOF +[Unit] +Description=OpenDaylight SDN Controller +Documentation=https://wiki.opendaylight.org/view/Main_Page http://www.opendaylight.org/ +After=network.service + +[Service] +Type=forking +ExecStart=/opt/opendaylight/bin/start +Environment=_JAVA_OPTIONS='-Djava.net.preferIPv4Stack=true' +User=odl +Group=odl +SuccessExitStatus=143 +LimitNOFILE=102400 +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +curl --fail --silent -L -O http://artifacts.opnfv.org/apex/random/aaa-cli-jar.jar python ./odl_reinstaller/odl_reinstaller.py $@ diff --git a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py index c0cf075..7e444a8 100644 --- a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py +++ b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py @@ -8,6 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 # # +import os import re import time @@ -19,6 +20,9 @@ from utils.service import Service from utils.node_manager import NodeManager from utils import utils_yaml +ODL_SYSTEMD = '/usr/lib/systemd/system/opendaylight.service' +ODL_AAA_JAR = '/opt/opendaylight/bin/aaa-cli-jar.jar' + @for_all_methods(log_enter_exit) class ODLReInstaller(Service): @@ -46,17 +50,27 @@ class ODLReInstaller(Service): 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]) - if 'java' in rv: + jrv, _ = node.execute('ps aux |grep -v grep |grep karaf', + as_root=True, check_exit_code=[0, 1]) + rv, (_, rc) = node.execute('docker ps | grep opendaylight_api', + as_root=True, check_exit_code=[0, 1]) + if rc == 0: + LOG.info("ODL is running as docker container") + node.execute('docker stop opendaylight_api', as_root=True) + self.odl_node = node + elif 'java' in jrv: + LOG.info("ODL is running as systemd service") self.odl_node = node - LOG.info("ODL node found: {}".format(self.odl_node.name)) node.execute('systemctl stop opendaylight', as_root=True) + + if self.odl_node is not None: + LOG.info("ODL node found: {}".format(self.odl_node.name)) # rc 5 means the service is not there. + # rc 4 means the service cannot be found node.execute('systemctl stop bgpd', as_root=True, - check_exit_code=[0, 5]) + check_exit_code=[0, 4, 5]) node.execute('systemctl stop zrpcd', as_root=True, - check_exit_code=[0, 5]) + check_exit_code=[0, 4, 5]) self.disconnect_ovs(node) @@ -81,7 +95,7 @@ class ODLReInstaller(Service): LOG.warning("NetVirt not detected as up after 10 " "attempts...deployment may be unstable!") counter += 1 - time.sleep(10) + time.sleep(15) # Reconnect OVS instances LOG.info("Reconnecting OVS instances") @@ -97,9 +111,11 @@ class ODLReInstaller(Service): def _start_service_if_enabled(self, node, service): # rc 3 means service inactive + # rc 4 means service cannot be found # rc 5 mean no service available status, _ = node.execute('systemctl status {}'. - format(service), check_exit_code=[0, 3, 5]) + format(service), check_exit_code=[0, 3, + 4, 5]) if 'service; enabled' in status: LOG.info('Starting {}'.format(service)) node.execute('systemctl start {}'.format(service), as_root=True) @@ -115,11 +131,34 @@ class ODLReInstaller(Service): node.execute('rm -rf /opt/opendaylight/', as_root=True) node.execute('mkdir -p /opt/opendaylight/', as_root=True) if 'tar.gz' in odl_artifact: + # check if systemd service exists (may not if this was a docker + # deployment) + if not node.is_file(ODL_SYSTEMD): + LOG.info("Creating odl user, group, and systemd file") + # user/group may already exist so just ignore errors here + node.execute('groupadd odl', as_root=True, + check_exit_code=False) + node.execute('useradd -g odl odl', as_root=True, + check_exit_code=False) + systemd_file = os.path.join(os.getcwd(), + 'opendaylight.service') + node.copy('to', systemd_file, '/tmp/opendaylight.service', + check_exit_code=True) + node.execute('mv /tmp/opendaylight.service %s' % ODL_SYSTEMD, + as_root=True) + node.execute('systemctl daemon-reload', as_root=True) 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) + # AAA CLI jar for creating ODL user will be missing in regular + # netvirt distro. Only part of full distro. + if not node.is_file(ODL_AAA_JAR): + LOG.info("ODL AAA CLI jar missing, will copy") + aaa_cli_file = os.path.join(os.getcwd(), + 'aaa-cli-jar.jar') + node.copy('to', aaa_cli_file, ODL_AAA_JAR) node.execute('chown -R odl:odl /opt/opendaylight', as_root=True) if '.rpm' in odl_artifact: LOG.info('Installing %s on node %s' @@ -129,7 +168,11 @@ class ODLReInstaller(Service): % (tar_tmp_path + odl_artifact), as_root=True) node.execute('rm -rf ' + tar_tmp_path, as_root=True) LOG.info('Starting Opendaylight on node %s' % node.name) + # we do not want puppet-odl to install the repo or the package, so we + # use tags to ignore those resources node.execute('puppet apply -e "include opendaylight" ' + '--tags file,concat,file_line,augeas,odl_user,' + 'odl_keystore,service ' '--modulepath=/etc/puppet/modules/ ' '--verbose --debug --trace --detailed-exitcodes', check_exit_code=[2], as_root=True) diff --git a/sdnvpn/test/functest/run_sdnvpn_tests.py b/sdnvpn/test/functest/run_sdnvpn_tests.py index 23a62e6..c05876d 100644 --- a/sdnvpn/test/functest/run_sdnvpn_tests.py +++ b/sdnvpn/test/functest/run_sdnvpn_tests.py @@ -71,6 +71,24 @@ class SdnvpnFunctest(feature.Feature): os_utils.delete_floating_ip( neutron_client, floating_ip['id']) + # Workaround for + # https://jira.opnfv.org/browse/SNAPS-318 + # Clean up the stale routers + logger.info("Cleaning up the stale routers") + ports = os_utils.get_port_list(neutron_client) + if ports is not None: + for port in ports: + if port['device_owner'] == 'network:router_interface': + os_utils.delete_neutron_port( + neutron_client, port['id']) + routers = os_utils.get_router_list(neutron_client) + if routers is not None: + for router in routers: + os_utils.remove_gateway_router( + neutron_client, router['id']) + os_utils.delete_neutron_router( + neutron_client, router['id']) + with open(COMMON_CONFIG.config_file) as f: config_yaml = yaml.safe_load(f) |