- ssh.exec_command('echo show hardware-interfaces | '
- 'nc 0 5002 || echo "VPP not yet running"')
- if ret == 0:
- break
- else:
- raise RuntimeError('VPP failed to restart on node {}'.
+ ssh.exec_command('sudo service {} start'
+ .format(self._vpp_service_name))
+ if ret != 0:
+ raise RuntimeError('Restarting VPP failed on node {}'.
+ format(self._hostname))
+
+ # Sleep <waittime> seconds, up to <retry> times,
+ # and verify if VPP is running.
+ for _ in range(retries):
+ time.sleep(waittime)
+ (ret, stdout, _) = \
+ ssh.exec_command('echo show hardware-interfaces | '
+ 'nc 0 5002 || echo "VPP not yet running"')
+ if ret == 0 and stdout != 'VPP not yet running':
+ break
+ else:
+ raise RuntimeError('VPP failed to restart on node {}'.
+ format(self._hostname))
+
+ def restore_config(self):
+ """Restore VPP startup.conf from backup.
+
+ :raises RuntimeError: When restoration of startup.conf file failed.
+ """
+
+ ssh = SSH()
+ ssh.connect(self._node)
+
+ (ret, _, _) = ssh.exec_command('sudo cp {0} {1}'.
+ format(self._vpp_startup_conf_backup,
+ self._vpp_startup_conf))
+ if ret != 0:
+ raise RuntimeError('Restoration of config file failed on node {}'.