diff options
author | 2017-09-12 09:57:38 -0700 | |
---|---|---|
committer | 2017-09-18 10:30:58 -0700 | |
commit | ae0cdbea1100a09d0c46191dd7e5d8d5eec8d484 (patch) | |
tree | 0649b8b464c4c7379eed8e05976eaa7c836f990e /yardstick | |
parent | 468aeaf9fe6a5cd0d350f566ed7b9216efc752b6 (diff) |
NSB: count from 0, vnf_0, tg_9, private->uplink, public->downlink
Also rename private to uplink, public to downlink
for scale-out template we need to count from 0
so we can use range() without +1/-1 errors
vnf_0, vnf_1
tg_0, tg_1
also fix Ixia defaults
Change-Id: I6aecfbb95f99af20f012a9df19c19be77d1b5b77
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
Diffstat (limited to 'yardstick')
11 files changed, 77 insertions, 67 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index f381186de..905f1f4c5 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -170,7 +170,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) @@ -204,8 +204,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) @@ -234,7 +234,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 diff --git a/yardstick/network_services/helpers/samplevnf_helper.py b/yardstick/network_services/helpers/samplevnf_helper.py index 7054b9232..5f87f788d 100644 --- a/yardstick/network_services/helpers/samplevnf_helper.py +++ b/yardstick/network_services/helpers/samplevnf_helper.py @@ -64,15 +64,15 @@ SCRIPT_TPL = """ class PortPairs(object): - PUBLIC = "public" - PRIVATE = "private" + DOWNLINK = "downlink" + UPLINK = "uplink" def __init__(self, interfaces): super(PortPairs, self).__init__() self.interfaces = interfaces self._all_ports = None - self._priv_ports = None - self._pub_ports = None + self._uplink_ports = None + self._downlink_ports = None self._networks = None self._port_pair_list = None self._valid_networks = None @@ -93,62 +93,63 @@ class PortPairs(object): return self._networks @classmethod - def get_public_id(cls, vld_id): + def get_downlink_id(cls, vld_id): # partition returns a tuple - parts = list(vld_id.partition(cls.PRIVATE)) + parts = list(vld_id.partition(cls.UPLINK)) if parts[0]: - # 'private' was not in or not leftmost in the string + # 'uplink' was not in or not leftmost in the string return - parts[1] = cls.PUBLIC + parts[1] = cls.DOWNLINK public_id = ''.join(parts) return public_id @property - # this only works for vnfs that have both private and public visible + # this only works for vnfs that have both uplink and public visible def valid_networks(self): if self._valid_networks is None: self._valid_networks = [] for vld_id in self.networks: - public_id = self.get_public_id(vld_id) - if public_id in self.networks: - self._valid_networks.append((vld_id, public_id)) + downlink_id = self.get_downlink_id(vld_id) + if downlink_id in self.networks: + self._valid_networks.append((vld_id, downlink_id)) return self._valid_networks @property def all_ports(self): if self._all_ports is None: - self._all_ports = sorted(set(self.priv_ports + self.pub_ports)) + self._all_ports = sorted(set(self.uplink_ports + self.downlink_ports)) return self._all_ports @property - def priv_ports(self): - if self._priv_ports is None: + def uplink_ports(self): + if self._uplink_ports is None: intfs = chain.from_iterable( intfs for vld_id, intfs in self.networks.items() if - vld_id.startswith(self.PRIVATE)) - self._priv_ports = sorted(set(intfs)) - return self._priv_ports + vld_id.startswith(self.UPLINK)) + self._uplink_ports = sorted(set(intfs)) + return self._uplink_ports @property - def pub_ports(self): - if self._pub_ports is None: + def downlink_ports(self): + if self._downlink_ports is None: intfs = chain.from_iterable( - intfs for vld_id, intfs in self.networks.items() if vld_id.startswith(self.PUBLIC)) - self._pub_ports = sorted(set(intfs)) - return self._pub_ports + intfs for vld_id, intfs in self.networks.items() if + vld_id.startswith(self.DOWNLINK)) + self._downlink_ports = sorted(set(intfs)) + return self._downlink_ports @property def port_pair_list(self): if self._port_pair_list is None: self._port_pair_list = [] - for priv, pub in self.valid_networks: - for private_intf in self.networks[priv]: - # only VNFs have private, public peers - peer_intfs = self.networks.get(pub, []) + for uplink, downlink in self.valid_networks: + for uplink_intf in self.networks[uplink]: + # only VNFs have uplink, public peers + peer_intfs = self.networks.get(downlink, []) if peer_intfs: - for public_intf in peer_intfs: - port_pair = private_intf, public_intf + for downlink_intf in peer_intfs: + port_pair = uplink_intf, downlink_intf self._port_pair_list.append(port_pair) return self._port_pair_list @@ -341,9 +342,9 @@ class MultiPortConfig(object): priv_to_pub_map = [tuple(self.vnfd_helper.port_nums(x)) for x in self.port_pairs] # must be list to use .index() port_list = list(chain.from_iterable(priv_to_pub_map)) - priv_ports = (x[0] for x in priv_to_pub_map) + uplink_ports = (x[0] for x in priv_to_pub_map) self.prv_que_handler = '({})'.format( - "".join(("{},".format(port_list.index(x)) for x in priv_ports))) + "".join(("{},".format(port_list.index(x)) for x in uplink_ports))) def generate_arp_route_tbl(self): arp_route_tbl_tmpl = "({port0_dst_ip_hex},{port0_netmask_hex},{port_num}," \ diff --git a/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py b/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py index 1ec00e5bc..4b906508c 100644 --- a/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py +++ b/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py @@ -113,10 +113,10 @@ class IxNextgen(object): } MODE_SEEDS_MAP = { - 0: ('private_0', ['256', '2048']), + 0: ('uplink_0', ['256', '2048']), } - MODE_SEEDS_DEFAULT = 'public_0', ['2048', '256'] + MODE_SEEDS_DEFAULT = 'downlink_0', ['2048', '256'] @staticmethod def find_view_obj(view_name, views): diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py index 611792b94..ad256b444 100644 --- a/yardstick/network_services/traffic_profile/base.py +++ b/yardstick/network_services/traffic_profile/base.py @@ -22,6 +22,8 @@ class TrafficProfile(object): This class defines the behavior """ + UPLINK = "uplink" + DOWNLINK = "downlink" @staticmethod def get(tp_config): diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index 049a81a65..cb8a34796 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -78,7 +78,7 @@ class IXIARFC2544Profile(TrexProfile): def _ixia_traffic_generate(self, traffic_generator, traffic, ixia_obj): for key, value in traffic.items(): - if "public" in key or "private" in key: + if key.startswith((self.UPLINK, self.DOWNLINK)): value["iload"] = str(self.rate) ixia_obj.ix_update_frame(traffic) ixia_obj.ix_update_ether(traffic) @@ -90,7 +90,7 @@ class IXIARFC2544Profile(TrexProfile): def update_traffic_profile(self, traffic_generator): def port_generator(): for vld_id, intfs in sorted(traffic_generator.networks.items()): - if not vld_id.startswith(("private", "public")): + if not vld_id.startswith((self.UPLINK, self.DOWNLINK)): continue profile_data = self.params.get(vld_id) if not profile_data: diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index 3dc08df69..16e809b65 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -58,7 +58,8 @@ class RFC2544Profile(TrexProfile): if not profile_data: continue # correlated traffic doesn't use public traffic? - if vld_id.startswith("public") and self.generator.rfc2544_helper.correlated_traffic: + if vld_id.startswith(self.DOWNLINK) and \ + self.generator.rfc2544_helper.correlated_traffic: continue for intf in intfs: port = self.generator.vnfd_helper.port_num(intf) @@ -165,7 +166,8 @@ class RFC2544Profile(TrexProfile): if not profile_data: continue # correlated traffic doesn't use public traffic? - if vld_id.startswith("public") and self.generator.rfc2544_helper.correlated_traffic: + if vld_id.startswith(self.DOWNLINK) and \ + self.generator.rfc2544_helper.correlated_traffic: continue for intf in intfs: port = self.generator.vnfd_helper.port_num(intf) diff --git a/yardstick/network_services/vnf_generic/vnf/base.py b/yardstick/network_services/vnf_generic/vnf/base.py index e32e5fb50..42e3d2a48 100644 --- a/yardstick/network_services/vnf_generic/vnf/base.py +++ b/yardstick/network_services/vnf_generic/vnf/base.py @@ -123,6 +123,10 @@ class VnfdHelper(dict): class VNFObject(object): + # centralize network naming convention + UPLINK = PortPairs.UPLINK + DOWNLINK = PortPairs.DOWNLINK + def __init__(self, name, vnfd): super(VNFObject, self).__init__() self.name = name diff --git a/yardstick/network_services/vnf_generic/vnf/cgnapt_vnf.py b/yardstick/network_services/vnf_generic/vnf/cgnapt_vnf.py index 45ef757b3..b5072c194 100644 --- a/yardstick/network_services/vnf_generic/vnf/cgnapt_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/cgnapt_vnf.py @@ -70,8 +70,8 @@ class CgnaptApproxSetupEnvHelper(DpdkVnfSetupEnvHelper): interfaces = self.vnfd_helper.interfaces # fixme: Get private port and gateway from port list - priv_ports = self.vnfd_helper.port_pairs.priv_ports - return [self._get_ports_gateway(intf["name"]) for intf in priv_ports] + uplink_ports = self.vnfd_helper.port_pairs.uplink_ports + return [self._get_ports_gateway(intf["name"]) for intf in uplink_ports] class CgnaptApproxVnf(SampleVNF): diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index c240d3778..557009d30 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -416,8 +416,9 @@ class ClientResourceHelper(ResourceHelper): def _build_ports(self): self.networks = self.vnfd_helper.port_pairs.networks - self.priv_ports = self.vnfd_helper.port_nums(self.vnfd_helper.port_pairs.priv_ports) - self.pub_ports = self.vnfd_helper.port_nums(self.vnfd_helper.port_pairs.pub_ports) + self.uplink_ports = self.vnfd_helper.port_nums(self.vnfd_helper.port_pairs.uplink_ports) + self.downlink_ports = \ + self.vnfd_helper.port_nums(self.vnfd_helper.port_pairs.downlink_ports) self.all_ports = self.vnfd_helper.port_nums(self.vnfd_helper.port_pairs.all_ports) def get_stats(self, *args, **kwargs): @@ -689,8 +690,8 @@ class SampleVNF(GenericVNF): self.context_cfg = None self.nfvi_context = None self.pipeline_kwargs = {} - self.priv_ports = None - self.pub_ports = None + self.uplink_ports = None + self.downlink_ports = None # TODO(esm): make QueueFileWrapper invert-able so that we # never have to manage the queues self.q_in = Queue() @@ -704,8 +705,8 @@ class SampleVNF(GenericVNF): def _build_ports(self): self._port_pairs = PortPairs(self.vnfd_helper.interfaces) self.networks = self._port_pairs.networks - self.priv_ports = self.vnfd_helper.port_nums(self._port_pairs.priv_ports) - self.pub_ports = self.vnfd_helper.port_nums(self._port_pairs.pub_ports) + self.uplink_ports = self.vnfd_helper.port_nums(self._port_pairs.uplink_ports) + self.downlink_ports = self.vnfd_helper.port_nums(self._port_pairs.downlink_ports) self.my_ports = self.vnfd_helper.port_nums(self._port_pairs.all_ports) def _get_route_data(self, route_index, route_type): diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py index 1b2efe34b..a73c691b9 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py @@ -58,8 +58,8 @@ class IxiaResourceHelper(ClientResourceHelper): rfc_helper_type = IxiaRfc2544Helper self.rfc_helper = rfc_helper_type(self.scenario_helper) - self.priv_ports = None - self.pub_ports = None + self.uplink_ports = None + self.downlink_ports = None self._connect() def _connect(self, client=None): diff --git a/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py b/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py index 72c1514f1..cd4a008ce 100644 --- a/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/vpe_vnf.py @@ -50,13 +50,13 @@ class ConfigCreate(object): config.set(tm_q, 'cfg', '/tmp/full_tm_profile_10G.cfg') return config - def __init__(self, priv_ports, pub_ports, socket): + def __init__(self, uplink_ports, downlink_ports, socket): super(ConfigCreate, self).__init__() self.sw_q = -1 self.sink_q = -1 self.n_pipeline = 1 - self.priv_ports = priv_ports - self.pub_ports = pub_ports + self.uplink_ports = uplink_ports + self.downlink_ports = downlink_ports self.pipeline_per_port = 9 self.socket = socket @@ -76,7 +76,7 @@ class ConfigCreate(object): return config def vpe_rxq(self, config): - for port in self.pub_ports: + for port in self.downlink_ports: new_section = 'RXQ{0}.0'.format(port) config.add_section(new_section) config.set(new_section, 'mempool', 'MEMPOOL1') @@ -102,7 +102,7 @@ class ConfigCreate(object): for k, v in parser.items(pipeline): if k == "pktq_in": if "RXQ" in v: - value = "RXQ{0}.0".format(self.priv_ports[index]) + value = "RXQ{0}.0".format(self.uplink_ports[index]) else: value = self.get_sink_swq(parser, pipeline, k, index) @@ -110,7 +110,7 @@ class ConfigCreate(object): elif k == "pktq_out": if "TXQ" in v: - value = "TXQ{0}.0".format(self.pub_ports[index]) + value = "TXQ{0}.0".format(self.downlink_ports[index]) else: self.sw_q += 1 value = self.get_sink_swq(parser, pipeline, k, index) @@ -134,9 +134,9 @@ class ConfigCreate(object): if "RXQ" not in v: value = self.get_sink_swq(parser, pipeline, k, index) elif "TM" in v: - value = "RXQ{0}.0 TM{1}".format(self.pub_ports[index], index) + value = "RXQ{0}.0 TM{1}".format(self.downlink_ports[index], index) else: - value = "RXQ{0}.0".format(self.pub_ports[index]) + value = "RXQ{0}.0".format(self.downlink_ports[index]) parser.set(pipeline, k, value) @@ -145,9 +145,9 @@ class ConfigCreate(object): self.sw_q += 1 value = self.get_sink_swq(parser, pipeline, k, index) elif "TM" in v: - value = "TXQ{0}.0 TM{1}".format(self.priv_ports[index], index) + value = "TXQ{0}.0 TM{1}".format(self.uplink_ports[index], index) else: - value = "TXQ{0}.0".format(self.priv_ports[index]) + value = "TXQ{0}.0".format(self.uplink_ports[index]) parser.set(pipeline, k, value) @@ -165,7 +165,7 @@ class ConfigCreate(object): config = self.vpe_initialize(config) config = self.vpe_rxq(config) config.write(cfg_file) - for index in range(0, len(self.priv_ports)): + for index in range(0, len(self.uplink_ports)): config = self.vpe_upstream(vnf_cfg, index) config.write(cfg_file) config = self.vpe_downstream(vnf_cfg, index) @@ -174,7 +174,7 @@ class ConfigCreate(object): def generate_vpe_script(self, interfaces): rules = PipelineRules(pipeline_id=1) - for priv_port, pub_port in zip(self.priv_ports, self.pub_ports): + for priv_port, pub_port in zip(self.uplink_ports, self.downlink_ports): priv_intf = interfaces[priv_port]["virtual-interface"] pub_intf = interfaces[pub_port]["virtual-interface"] @@ -215,8 +215,8 @@ class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper): def _build_vnf_ports(self): self._port_pairs = PortPairs(self.vnfd_helper.interfaces) - self.priv_ports = self._port_pairs.priv_ports - self.pub_ports = self._port_pairs.pub_ports + self.uplink_ports = self._port_pairs.uplink_ports + self.downlink_ports = self._port_pairs.downlink_ports self.all_ports = self._port_pairs.all_ports def build_config(self): @@ -226,8 +226,8 @@ class VpeApproxSetupEnvHelper(DpdkVnfSetupEnvHelper): } self._build_vnf_ports() - vpe_conf = ConfigCreate(self.vnfd_helper.port_pairs.priv_ports, - self.vnfd_helper.port_pairs.pub_ports, self.socket) + vpe_conf = ConfigCreate(self.vnfd_helper.port_pairs.uplink_ports, + self.vnfd_helper.port_pairs.downlink_ports, self.socket) vpe_conf.create_vpe_config(self.scenario_helper.vnf_cfg) config_basename = posixpath.basename(self.CFG_CONFIG) |