From 13df0af820060eb2927f8b00cacad30b18aa8874 Mon Sep 17 00:00:00 2001 From: Deepak S Date: Sun, 24 Sep 2017 21:57:08 -0700 Subject: Adding multi-port support for ixia taffic generator Change-Id: Ic8aa130f3cdc7bd8dec39d06a6b824340bf658b2 Signed-off-by: Deepak S Signed-off-by: Ross Brattain --- ...al_rfc2544_ipv4_1rule_1flow_64B_ixia_4port.yaml | 50 ++++++++++++++ .../nsut/vfw/vfw_vnf_topology_ixia_4port.yaml | 72 +++++++++++++++++++++ .../traffic_profiles/ixia_ipv4_latency.yaml | 4 +- .../vfw/vfw_ipv4_profile_muttiport.ixncfg | Bin 0 -> 77930 bytes .../vnf_descriptors/ixia_rfc2544_tpl.yaml | 32 ++------- samples/vnf_samples/vnf_descriptors/tg_ixload.yaml | 36 +++-------- .../network_services/libs/ixia_libs/test_IxNet.py | 12 ++-- .../network_services/libs/ixia_libs/IxNet/IxNet.py | 46 +++++++------ .../traffic_profile/ixia_rfc2544.py | 62 +++++++++--------- 9 files changed, 201 insertions(+), 113 deletions(-) create mode 100644 samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia_4port.yaml create mode 100644 samples/vnf_samples/nsut/vfw/vfw_vnf_topology_ixia_4port.yaml create mode 100644 samples/vnf_samples/traffic_profiles/vfw/vfw_ipv4_profile_muttiport.ixncfg diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia_4port.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia_4port.yaml new file mode 100644 index 000000000..89842bee9 --- /dev/null +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia_4port.yaml @@ -0,0 +1,50 @@ +# Copyright (c) 2016-2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# vfw_ipv4_profile_1flows.ixncfg + +--- +schema: yardstick:task:0.1 +scenarios: +- type: NSPerf + traffic_profile: "../../traffic_profiles/ixia_ipv4_latency.yaml" + topology: vfw_vnf_topology_ixia_4port.yaml + nodes: + tg__0: trafficgen_1.yardstick + vnf__0: vnf.yardstick + options: + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__0': 'xe0'}, {'tg__0': 'xe2'}] + dst_ip: [{'tg__0': 'xe1'}, {'tg__0': 'xe3'}] + count: 1 + traffic_type: 4 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf__0: + rules: acl_1rule.yaml + vnf_config: {lb_config: 'SW', lb_count: 2, worker_config: '1C/1T', worker_threads: 1} + nfvi_enable: True + runner: + type: Iteration + iterations: 10 + interval: 35 + ixia_profile: ../../traffic_profiles/vfw/vfw_ipv4_profile_muttiport.ixncfg +context: + type: Node + name: yardstick + nfvi_type: baremetal + file: /etc/yardstick/nodes/pod_ixia_4port.yaml +#/etc/yardstick/nodes/pod_ixia.yaml diff --git a/samples/vnf_samples/nsut/vfw/vfw_vnf_topology_ixia_4port.yaml b/samples/vnf_samples/nsut/vfw/vfw_vnf_topology_ixia_4port.yaml new file mode 100644 index 000000000..04b3de9f0 --- /dev/null +++ b/samples/vnf_samples/nsut/vfw/vfw_vnf_topology_ixia_4port.yaml @@ -0,0 +1,72 @@ +# Copyright (c) 2016-2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +nsd:nsd-catalog: + nsd: + - id: vFW + name: vFW + short-name: vFW + description: scenario with vFW VNF + constituent-vnfd: + - member-vnf-index: '1' + vnfd-id-ref: tg__0 + VNF model: ../../vnf_descriptors/ixia_rfc2544_tpl.yaml + - member-vnf-index: '2' + vnfd-id-ref: vnf__0 + VNF model: ../../vnf_descriptors/vfw_vnf.yaml + + vld: + - id: uplink_0 + name: tg__0 to vnf__0 link 1 + type: ELAN + vnfd-connection-point-ref: + - member-vnf-index-ref: '1' + vnfd-connection-point-ref: xe0 + vnfd-id-ref: tg__0 + - member-vnf-index-ref: '2' + vnfd-connection-point-ref: xe0 + vnfd-id-ref: vnf__0 + + - id: downlink_0 + name: vnf__0 to tg__0 link 2 + type: ELAN + vnfd-connection-point-ref: + - member-vnf-index-ref: '2' + vnfd-connection-point-ref: xe1 + vnfd-id-ref: vnf__0 + - member-vnf-index-ref: '1' + vnfd-connection-point-ref: xe1 + vnfd-id-ref: tg__0 + + - id: uplink_1 + name: tg__0 to vnf__0 link 3 + type: ELAN + vnfd-connection-point-ref: + - member-vnf-index-ref: '1' + vnfd-connection-point-ref: xe2 + vnfd-id-ref: tg__0 + - member-vnf-index-ref: '2' + vnfd-connection-point-ref: xe2 + vnfd-id-ref: vnf__0 + + - id: downlink_1 + name: vnf__0 to tg__0 link 4 + type: ELAN + vnfd-connection-point-ref: + - member-vnf-index-ref: '2' + vnfd-connection-point-ref: xe3 + vnfd-id-ref: vnf__0 + - member-vnf-index-ref: '1' + vnfd-connection-point-ref: xe3 + vnfd-id-ref: tg__0 diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml index af74df2c9..a475173f2 100644 --- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml +++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml @@ -122,8 +122,8 @@ downlink_1: outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.dst_ip1', '1.1.1.1-1.15.255.255') }}" - dstip4: "{{get(flow, 'flow.src_ip1', '90.90.1.1-90.105.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip_1', '1.1.1.1-1.15.255.255') }}" + dstip4: "{{get(flow, 'flow.src_ip_1', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 diff --git a/samples/vnf_samples/traffic_profiles/vfw/vfw_ipv4_profile_muttiport.ixncfg b/samples/vnf_samples/traffic_profiles/vfw/vfw_ipv4_profile_muttiport.ixncfg new file mode 100644 index 000000000..76accc1ed Binary files /dev/null and b/samples/vnf_samples/traffic_profiles/vfw/vfw_ipv4_profile_muttiport.ixncfg differ diff --git a/samples/vnf_samples/vnf_descriptors/ixia_rfc2544_tpl.yaml b/samples/vnf_samples/vnf_descriptors/ixia_rfc2544_tpl.yaml index 69442b7c8..9b2a152f3 100644 --- a/samples/vnf_samples/vnf_descriptors/ixia_rfc2544_tpl.yaml +++ b/samples/vnf_samples/vnf_descriptors/ixia_rfc2544_tpl.yaml @@ -41,34 +41,10 @@ vnfd:vnfd-catalog: vdu: - id: trexgen-baremetal name: trexgen-baremetal - description: IXIAstateless traffic verifier - external-interface: - - name: xe0 - virtual-interface: - type: PCI-PASSTHROUGH - # Substitution variables MUST be quoted. Otherwise Python can misinterpet them. - vpci: '{{ interfaces.xe0.vpci }}' # Value filled by vnfdgen - local_iface_name: '{{ interfaces.xe0.local_iface_name }}' # Value filled by vnfdgen - local_ip: '{{ interfaces.xe0.local_ip }}' # Value filled by vnfdgen - driver: '{{ interfaces.xe0.driver}}' # Value filled by vnfdgen - dst_ip: '{{ interfaces.xe0.dst_ip }}' # Value filled by vnfdgen - local_mac: '{{ interfaces.xe0.local_mac }}' # Value filled by vnfdgen - dst_mac: '{{ interfaces.xe0.dst_mac }}' # Value filled by vnfdgen - bandwidth: 10 Gbps - vnfd-connection-point-ref: xe0 - - name: xe1 - virtual-interface: - type: PCI-PASSTHROUGH - vpci: '{{ interfaces.xe1.vpci }}' # Value filled by vnfdgen - local_iface_name: '{{ interfaces.xe1.local_iface_name }}' # Value filled by vnfdgen - local_ip: '{{ interfaces.xe1.local_ip }}' # Value filled by vnfdgen - driver: '{{ interfaces.xe1.driver}}' # Value filled by vnfdgen - dst_ip: '{{ interfaces.xe1.dst_ip }}' # Value filled by vnfdgen - local_mac: '{{ interfaces.xe1.local_mac }}' # Value filled by vnfdgen - dst_mac: '{{ interfaces.xe1.dst_mac }}' # Value filled by vnfdgen - bandwidth: 10 Gbps - vnfd-connection-point-ref: xe1 - + description: IXIAstateless traffic verifier + vm-flavor: + vcpu-count: '4' + memory-mb: '4096' benchmark: kpi: - rx_throughput_fps diff --git a/samples/vnf_samples/vnf_descriptors/tg_ixload.yaml b/samples/vnf_samples/vnf_descriptors/tg_ixload.yaml index b430d35bd..ad4953fce 100644 --- a/samples/vnf_samples/vnf_descriptors/tg_ixload.yaml +++ b/samples/vnf_samples/vnf_descriptors/tg_ixload.yaml @@ -16,10 +16,11 @@ vnfd:vnfd-catalog: vnfd: - id: IxLoadTrafficGen - name: IxLoadTrafficGenVnfSshIntel + name: IxLoadTrafficGen short-name: IxLoadTrafficGenVnf description: IxLoad client/server connection details mgmt-interface: + vdu-id: ixloadgen-baremetal user: '{{user}}' # Value filled by vnfdgen password: '{{password}}' # Value filled by vnfdgen ip: '{{ip}}' # Value filled by vnfdgen @@ -32,35 +33,16 @@ vnfd:vnfd-catalog: py_bin_path: '{{tg_config.py_bin_path}}' dut_result_dir: '{{tg_config.dut_result_dir}}' version: '{{tg_config.version}}' + connection-point: + - name: xe0 + type: VPORT + - name: xe1 + type: VPORT + vdu: - id: abclient-baremetal name: abclient-baremetal description: AB client interface details - external-interface: - - name: xe0 - virtual-interface: - type: PCI-PASSTHROUGH - vpci: '{{ interfaces.xe0.vpci }}' # Value filled by vnfdgen - local_iface_name: '{{ interfaces.xe0.local_iface_name }}' # Value filled by vnfdgen - local_ip: '{{ interfaces.xe0.local_ip }}' # Value filled by vnfdgen - dst_ip: '{{ interfaces.xe0.dst_ip }}' # Value filled by vnfdgen - local_mac: '{{ interfaces.xe0.local_mac }}' # Value filled by vnfdgen - dst_mac: '{{ interfaces.xe0.dst_mac }}' # Value filled by vnfdgen - netmask: '{{ interfaces.xe0.netmask }}' # Value filled by vnfdgen - bandwidth: 10 Gbps - vnfd-connection-point-ref: xe0 - - name: xe1 - virtual-interface: - type: PCI-PASSTHROUGH - vpci: '{{ interfaces.xe1.vpci }}' # Value filled by vnfdgen - local_iface_name: '{{ interfaces.xe1.local_iface_name }}' # Value filled by vnfdgen - local_ip: '{{ interfaces.xe1.local_ip }}' # Value filled by vnfdgen - dst_ip: '{{ interfaces.xe1.dst_ip }}' # Value filled by vnfdgen - local_mac: '{{ interfaces.xe1.local_mac }}' # Value filled by vnfdgen - dst_mac: '{{ interfaces.xe1.dst_mac }}' # Value filled by vnfdgen - netmask: '{{ interfaces.xe1.netmask }}' # Value filled by vnfdgen - bandwidth: 10 Gbps - vnfd-connection-point-ref: xe1 benchmark: kpi: - complete_requests @@ -77,4 +59,4 @@ vnfd:vnfd-catalog: - requests_served_95% (ms) - requests_served_98% (ms) - requests_served_99% (ms) - - requests_served_100% (ms) \ No newline at end of file + - requests_served_100% (ms) diff --git a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py index 0c82d74a8..3f374fb50 100644 --- a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py +++ b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py @@ -82,10 +82,8 @@ class TestIxNextgen(unittest.TestCase): config = { 'chassis': '1.1.1.1', - 'card1': '1', - 'card2': '2', - 'port1': '2', - 'port2': '2', + 'cards': ['1', '2'], + 'ports': ['2', '2'], } ixnet_gen = IxNextgen(ixnet) @@ -673,10 +671,8 @@ class TestIxNextgen(unittest.TestCase): 'machine': 'test1', 'port': 'test5', 'chassis': 'test4', - 'card1': '0000', - 'port1': '07', - 'card2': '0001', - 'port2': '08', + 'cards': ['0000', '0001'], + 'ports': ['07', '08'], 'output_dir': 'test2', 'version': 'test3', 'bidir': True, diff --git a/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py b/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py index 4b906508c..358e6e761 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: ('uplink_0', ['256', '2048']), + 0: ('uplink', ['256', '2048']), } - MODE_SEEDS_DEFAULT = 'downlink_0', ['2048', '256'] + MODE_SEEDS_DEFAULT = 'downlink', ['2048', '256'] @staticmethod def find_view_obj(view_name, views): @@ -125,24 +125,27 @@ class IxNextgen(object): @staticmethod def get_config(tg_cfg): + card = [] + port = [] external_interface = tg_cfg["vdu"][0]["external-interface"] - card_port0 = external_interface[0]["virtual-interface"]["vpci"] - card_port1 = external_interface[1]["virtual-interface"]["vpci"] - card0, port0 = card_port0.split(':')[:2] - card1, port1 = card_port1.split(':')[:2] + for intf in external_interface: + card_port0 = intf["virtual-interface"]["vpci"] + card0, port0 = card_port0.split(':')[:2] + card.append(card0) + port.append(port0) + cfg = { 'py_lib_path': tg_cfg["mgmt-interface"]["tg-config"]["py_lib_path"], 'machine': tg_cfg["mgmt-interface"]["ip"], 'port': tg_cfg["mgmt-interface"]["tg-config"]["tcl_port"], 'chassis': tg_cfg["mgmt-interface"]["tg-config"]["ixchassis"], - 'card1': card0, - 'port1': port0, - 'card2': card1, - 'port2': port1, + 'cards': card, + 'ports': port, 'output_dir': tg_cfg["mgmt-interface"]["tg-config"]["dut_result_dir"], 'version': tg_cfg["mgmt-interface"]["tg-config"]["version"], 'bidir': True, } + return cfg def __init__(self, ixnet=None): @@ -183,9 +186,13 @@ class IxNextgen(object): self.set_random_ip_multi_attribute(ip, seeds[1], fixed_bits, random_mask, l3_count) def add_ip_header(self, params, version): - for it, ep, i in self.iter_over_get_lists('/traffic', 'trafficItem', "configElement"): - mode, seeds = self.MODE_SEEDS_MAP.get(i, self.MODE_SEEDS_DEFAULT) - l3 = params[mode]['outer_l3'] + for it, ep, i in self.iter_over_get_lists('/traffic', 'trafficItem', "configElement", 1): + iter1 = (v['outer_l3'] for v in params.values() if str(v['id']) == str(i)) + try: + l3 = next(iter1, {}) + seeds = self.MODE_SEEDS_MAP.get(i, self.MODE_SEEDS_DEFAULT)[1] + except (KeyError, IndexError): + continue for ip, ip_bits, _ in self.iter_over_get_lists(ep, 'stack', 'field'): self.set_random_ip_multi_attributes(ip_bits, version, seeds, l3) @@ -222,10 +229,11 @@ class IxNextgen(object): def ix_assign_ports(self): vports = self.ixnet.getList(self.ixnet.getRoot(), 'vport') - ports = [ - (self._cfg['chassis'], self._cfg['card1'], self._cfg['port1']), - (self._cfg['chassis'], self._cfg['card2'], self._cfg['port2']), - ] + ports = [] + + chassis = self._cfg['chassis'] + ports = [(chassis, card, port) for card, port in + zip(self._cfg['cards'], self._cfg['ports'])] vport_list = self.ixnet.getList("/", "vport") self.ixnet.execute('assignPorts', ports, [], vport_list, True) @@ -276,10 +284,10 @@ class IxNextgen(object): def update_ether_multi_attributes(self, ether, l2): if "ethernet.header.destinationAddress" in ether: - self.update_ether_multi_attribute(ether, str(l2['dstmac'])) + self.update_ether_multi_attribute(ether, str(l2.get('dstmac', "00:00:00:00:00:02"))) if "ethernet.header.sourceAddress" in ether: - self.update_ether_multi_attribute(ether, str(l2['srcmac'])) + self.update_ether_multi_attribute(ether, str(l2.get('srcmac', "00:00:00:00:00:01"))) def ix_update_ether(self, params): for ti, ep, index in self.iter_over_get_lists('/traffic', 'trafficItem', diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index ee58172d8..28480b8e9 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -43,35 +43,39 @@ class IXIARFC2544Profile(TrexProfile): traffic = static_traffic[traffickey] # outer_l2 index = 0 - for key, value in profile_data[traffickey].items(): - framesize = value['outer_l2']['framesize'] - traffic['outer_l2']['framesize'] = framesize - traffic['framesPerSecond'] = True - traffic['bidir'] = False - traffic['outer_l2']['srcmac'] = \ - mac["src_mac_{}".format(traffic['id'])] - traffic['outer_l2']['dstmac'] = \ - mac["dst_mac_{}".format(traffic['id'])] - - # outer_l3 - if "outer_l3v6" in list(value.keys()): - traffic['outer_l3'] = value['outer_l3v6'] - srcip4 = value['outer_l3v6']['srcip6'] - traffic['outer_l3']['srcip4'] = srcip4.split("-")[0] - dstip4 = value['outer_l3v6']['dstip6'] - traffic['outer_l3']['dstip4'] = dstip4.split("-")[0] - else: - traffic['outer_l3'] = value['outer_l3v4'] - srcip4 = value['outer_l3v4']['srcip4'] - traffic['outer_l3']['srcip4'] = srcip4.split("-")[0] - dstip4 = value['outer_l3v4']['dstip4'] - traffic['outer_l3']['dstip4'] = dstip4.split("-")[0] - - traffic['outer_l3']['type'] = key - traffic['outer_l3']['count'] = value['outer_l3v4']['count'] - # outer_l4 - traffic['outer_l4'] = value['outer_l4'] - index = index + 1 + try: + for key, value in profile_data[traffickey].items(): + framesize = value['outer_l2']['framesize'] + traffic['outer_l2']['framesize'] = framesize + traffic['framesPerSecond'] = True + traffic['bidir'] = False + traffic['outer_l2']['srcmac'] = \ + mac["src_mac_{}".format(traffic['id'])] + traffic['outer_l2']['dstmac'] = \ + mac["dst_mac_{}".format(traffic['id'])] + + # outer_l3 + if "outer_l3v6" in list(value.keys()): + traffic['outer_l3'] = value['outer_l3v6'] + srcip4 = value['outer_l3v6']['srcip6'] + traffic['outer_l3']['srcip4'] = srcip4.split("-")[0] + dstip4 = value['outer_l3v6']['dstip6'] + traffic['outer_l3']['dstip4'] = dstip4.split("-")[0] + else: + traffic['outer_l3'] = value['outer_l3v4'] + srcip4 = value['outer_l3v4']['srcip4'] + traffic['outer_l3']['srcip4'] = srcip4.split("-")[0] + dstip4 = value['outer_l3v4']['dstip4'] + traffic['outer_l3']['dstip4'] = dstip4.split("-")[0] + + traffic['outer_l3']['type'] = key + traffic['outer_l3']['count'] = value['outer_l3v4']['count'] + # outer_l4 + traffic['outer_l4'] = value['outer_l4'] + index = index + 1 + except Exception: + continue + result.update({traffickey: traffic}) return result -- cgit 1.2.3-korg