summaryrefslogtreecommitdiffstats
path: root/odl-pipeline/lib
diff options
context:
space:
mode:
authorNikolas Hermanns <nikolas.hermanns@ericsson.com>2017-05-03 16:23:02 +0200
committertomsou <soth@intracom-telecom.com>2017-05-04 07:02:02 +0000
commit40e6368775836d58dd3b83c197b9ff8efc462262 (patch)
tree033a3a6dd4a8a11d999ea791f5769d4582e2ab9b /odl-pipeline/lib
parent88331de3fb9375d316acba7b160ddf2a9beab5b2 (diff)
Stop and start quagga when reinstalling
Change-Id: Iba9a5980de0cbdf9c04bdd4dad704c12abb55048 Signed-off-by: Nikolas Hermanns <nikolas.hermanns@ericsson.com>
Diffstat (limited to 'odl-pipeline/lib')
-rw-r--r--odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
index 053e022..c0cf075 100644
--- a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
+++ b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
@@ -52,6 +52,11 @@ class ODLReInstaller(Service):
self.odl_node = node
LOG.info("ODL node found: {}".format(self.odl_node.name))
node.execute('systemctl stop opendaylight', as_root=True)
+ # rc 5 means the service is not there.
+ node.execute('systemctl stop bgpd', as_root=True,
+ check_exit_code=[0, 5])
+ node.execute('systemctl stop zrpcd', as_root=True,
+ check_exit_code=[0, 5])
self.disconnect_ovs(node)
@@ -90,8 +95,21 @@ class ODLReInstaller(Service):
self.validate_ovs(node)
LOG.info("OpenDaylight Upgrade Successful!")
- @staticmethod
- def reinstall_odl(node, odl_artifact):
+ def _start_service_if_enabled(self, node, service):
+ # rc 3 means service inactive
+ # rc 5 mean no service available
+ status, _ = node.execute('systemctl status {}'.
+ format(service), check_exit_code=[0, 3, 5])
+ if 'service; enabled' in status:
+ LOG.info('Starting {}'.format(service))
+ node.execute('systemctl start {}'.format(service), as_root=True)
+
+ def reinstall_odl(self, node, odl_artifact):
+ # Check for Quagga
+ self._start_service_if_enabled(node, 'zrpcd')
+ self._start_service_if_enabled(node, 'bgpd')
+
+ # Install odl
tar_tmp_path = '/tmp/odl-artifact/'
node.copy('to', odl_artifact, tar_tmp_path + odl_artifact)
node.execute('rm -rf /opt/opendaylight/', as_root=True)