- # TODO: move composition of api data to separate method
- api_data = list()
- api = dict(api_name='show_version')
- api_args = dict()
- api['api_args'] = api_args
- api_data.append(api)
-
- api_reply = None
- with PapiExecutor(node) as papi_executor:
- papi_executor.execute_papi(api_data)
- try:
- papi_executor.papi_should_have_passed()
- except AssertionError:
- raise RuntimeError('Failed to get VPP version on host: {host}'.
- format(host=node['host']))
- api_reply = papi_executor.get_papi_reply()
-
- if api_reply is not None:
- version_data = api_reply[0]['api_reply']['show_version_reply']
- ver = version_data['version'].rstrip('\0x00')
- if verbose:
- date = version_data['build_date'].rstrip('\0x00')
- loc = version_data['build_directory'].rstrip('\0x00')
- version = \
- 'VPP Version: {ver}\n' \
- 'Compile date: {date}\n' \
- 'Compile location: {loc}\n '\
- .format(ver=ver, date=date, loc=loc)
- else:
- version = 'VPP version:{ver}'.format(ver=ver)
- logger.info(version)
- else:
- raise PapiError('No reply received for show_version API command on '
- 'host {host}'.format(host=node['host']))
+ cmd = u"echo \"show pci\" | sudo socat - UNIX-CONNECT:/run/vpp/cli.sock"
+ exec_cmd_no_error(
+ node, cmd, sudo=False, message=u"VPP failed to start!", retries=120
+ )
+
+ cmd = u"vppctl show pci 2>&1 | fgrep -v \"Connection refused\" | " \
+ u"fgrep -v \"No such file or directory\""
+ exec_cmd_no_error(
+ node, cmd, sudo=True, message=u"VPP failed to start!", retries=120
+ )
+
+ # Properly enable cards in case they were disabled. This will be
+ # followed in https://jira.fd.io/browse/VPP-1934.
+ cmd = u"for i in $(sudo vppctl sho int | grep Eth | cut -d' ' -f1); do"\
+ u" sudo vppctl set int sta $i up; done"
+ exec_cmd(node, cmd, sudo=False)