diff options
Diffstat (limited to 'yardstick/benchmark/scenarios')
-rw-r--r-- | yardstick/benchmark/scenarios/networking/vnf_generic.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index 18ff40422..450f83f6a 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -64,10 +64,11 @@ class IncorrectSetup(Exception): class SshManager(object): - def __init__(self, node): + def __init__(self, node, timeout=120): super(SshManager, self).__init__() self.node = node self.conn = None + self.timeout = timeout def __enter__(self): """ @@ -76,7 +77,7 @@ class SshManager(object): """ try: self.conn = ssh.SSH.from_node(self.node) - self.conn.wait() + self.conn.wait(timeout=self.timeout) except SSHError as error: LOG.info("connect failed to %s, due to %s", self.node["ip"], error) # self.conn defaults to None @@ -171,7 +172,7 @@ class NetworkServiceTestCase(base.Scenario): flow = {} try: # TODO: should be .0 or .1 so we can use list - # but this also roughly matches private_0, public_0 + # but this also roughly matches uplink_0, downlink_0 fflow = self.scenario_cfg["options"]["flow"] for index, src in enumerate(fflow.get("src_ip", [])): flow["src_ip_{}".format(index)] = self._get_ip_flow_range(src) @@ -205,8 +206,8 @@ class NetworkServiceTestCase(base.Scenario): traffic_map_data = { 'flow': self._get_traffic_flow(), 'imix': self._get_traffic_imix(), - 'private': {}, - 'public': {}, + TrafficProfile.UPLINK: {}, + TrafficProfile.DOWNLINK: {}, } traffic_vnfd = vnfdgen.generate_vnfd(traffic_mapping, traffic_map_data) @@ -235,7 +236,7 @@ class NetworkServiceTestCase(base.Scenario): # check for xe0, xe1 intf = nodes[name]["interfaces"][if_name] except KeyError: - # if not xe0, then maybe vld_id, private_0, public_0 + # if not xe0, then maybe vld_id, uplink_0, downlink_0 # pop it and re-insert with the correct name from topology intf = nodes[name]["interfaces"].pop(vld_id) nodes[name]["interfaces"][if_name] = intf @@ -338,7 +339,7 @@ class NetworkServiceTestCase(base.Scenario): netdevs = {} cmd = "PATH=$PATH:/sbin:/usr/sbin ip addr show" - with SshManager(node_dict) as conn: + with SshManager(node_dict, timeout=timeout) as conn: if conn: exit_status = conn.execute(cmd)[0] if exit_status != 0: @@ -405,6 +406,10 @@ class NetworkServiceTestCase(base.Scenario): :return: None. Side effect: context_cfg is updated """ + num_nodes = len(self.context_cfg["nodes"]) + # OpenStack instance creation time is probably proportional to the number + # of instances + timeout = 120 * num_nodes for node, node_dict in self.context_cfg["nodes"].items(): for network in node_dict["interfaces"].values(): @@ -415,7 +420,7 @@ class NetworkServiceTestCase(base.Scenario): # 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) + netdevs = self._probe_netdevs(node, node_dict, timeout=timeout) except (SSHError, SSHTimeout): raise IncorrectConfig( "Unable to probe missing interface fields '%s', on node %s " @@ -499,6 +504,10 @@ printf "%s/driver:" $1 ; basename $(readlink -s $1/device/driver); } \ ext_intfs = vnfd["vdu"][0]["external-interface"] = [] # have to sort so xe0 goes first for intf_name, intf in sorted(node['interfaces'].items()): + # only interfaces with vld_id are added. + # Thus there are two layers of filters, only intefaces with vld_id + # show up in interfaces, and only interfaces with traffic profiles + # are used by the generators if intf.get('vld_id'): # force dpkd_port_num to int so we can do reverse lookup try: @@ -540,6 +549,13 @@ printf "%s/driver:" $1 ; basename $(readlink -s $1/device/driver); } \ vnfd = vnfdgen.generate_vnfd(vnf_model, node) # TODO: here add extra context_cfg["nodes"] regardless of template vnfd = vnfd["vnfd:vnfd-catalog"]["vnfd"][0] + # force inject pkey if it exists + # we want to standardize Heat using pkey as a string so we don't rely + # on the filesystem + try: + vnfd['mgmt-interface']['pkey'] = node['pkey'] + except KeyError: + pass self.create_interfaces_from_node(vnfd, node) vnf_impl = self.get_vnf_impl(vnfd['id']) vnf_instance = vnf_impl(node_name, vnfd) |