aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking/vnf_generic.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios/networking/vnf_generic.py')
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py73
1 files changed, 42 insertions, 31 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 599835d56..e6dca929c 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -265,8 +265,25 @@ class NetworkServiceTestCase(base.Scenario):
for dpdk_port_num, netdev in enumerate(s):
netdev['dpdk_port_num'] = dpdk_port_num
+ def _probe_netdevs(self, node, node_dict):
+ cmd = "PATH=$PATH:/sbin:/usr/sbin ip addr show"
+ netdevs = {}
+ with SshManager(node_dict) as conn:
+ if conn:
+ exit_status = conn.execute(cmd)[0]
+ if exit_status != 0:
+ raise IncorrectSetup("Node's %s lacks ip tool." % node)
+ exit_status, stdout, _ = conn.execute(
+ self.FIND_NETDEVICE_STRING)
+ if exit_status != 0:
+ raise IncorrectSetup(
+ "Cannot find netdev info in sysfs" % node)
+ netdevs = node_dict['netdevs'] = self.parse_netdev_info(stdout)
+ return netdevs
+
@classmethod
- def _probe_missing_values(cls, netdevs, network, missing):
+ def _probe_missing_values(cls, netdevs, network):
+
mac_lower = network['local_mac'].lower()
for netdev in netdevs.values():
if netdev['address'].lower() != mac_lower:
@@ -288,36 +305,30 @@ class NetworkServiceTestCase(base.Scenario):
"""
for node, node_dict in self.context_cfg["nodes"].items():
- cmd = "PATH=$PATH:/sbin:/usr/sbin ip addr show"
- with SshManager(node_dict) as conn:
- exit_status = conn.execute(cmd)[0]
- if exit_status != 0:
- raise IncorrectSetup("Node's %s lacks ip tool." % node)
- exit_status, stdout, _ = conn.execute(
- self.FIND_NETDEVICE_STRING)
- if exit_status != 0:
- raise IncorrectSetup(
- "Cannot find netdev info in sysfs" % node)
- netdevs = node_dict['netdevs'] = self.parse_netdev_info(
- stdout)
-
- for network in node_dict["interfaces"].values():
- missing = self.TOPOLOGY_REQUIRED_KEYS.difference(network)
- if not missing:
- continue
-
- try:
- self._probe_missing_values(netdevs, network,
- missing)
- except KeyError:
- pass
- else:
- missing = self.TOPOLOGY_REQUIRED_KEYS.difference(
- network)
- if missing:
- raise IncorrectConfig(
- "Require interface fields '%s' not found, topology file "
- "corrupted" % ', '.join(missing))
+ for network in node_dict["interfaces"].values():
+ missing = self.TOPOLOGY_REQUIRED_KEYS.difference(network)
+ if not missing:
+ continue
+
+ # only ssh probe if there are missing values
+ # ssh probe won't work on Ixia, so we had better define all our values
+
+ try:
+ netdevs = self._probe_netdevs(node, node_dict)
+ self._probe_missing_values(netdevs, network)
+ except KeyError:
+ pass
+ except (SSHError, SSHTimeout):
+ raise IncorrectConfig(
+ "Unable to probe missing interface fields '%s', on node %s "
+ "SSH Error" % (', '.join(missing), node))
+ else:
+ missing = self.TOPOLOGY_REQUIRED_KEYS.difference(
+ network)
+ if missing:
+ raise IncorrectConfig(
+ "Require interface fields '%s' not found, topology file "
+ "corrupted" % ', '.join(missing))
# 3. Use topology file to find connections & resolve dest address
self._resolve_topology()