diff options
8 files changed, 270 insertions, 103 deletions
diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc074.rst b/docs/testing/user/userguide/opnfv_yardstick_tc074.rst index 261a8bd95..d6beeaff9 100644 --- a/docs/testing/user/userguide/opnfv_yardstick_tc074.rst +++ b/docs/testing/user/userguide/opnfv_yardstick_tc074.rst @@ -111,6 +111,17 @@ Yardstick Test Case Description TC074 | | Query the status of the supplied job_id and report on | | | metrics. If a workload is supplied, will report on only | | | that subset. | +| | * availability_zone: Specify the availability zone which | +| | the stack will use to create instances. | +| | * volume_type: | +| | Cinder volumes can have different types, for example | +| | encrypted vs. not encrypted. | +| | To be able to profile the difference between the two. | +| | * subnet_CIDR: Specify subnet CIDR of private network | +| | * stack_name: Specify the name of the stack that will be | +| | created, the default: "StorperfAgentGroup" | +| | * volume_count: Specify the number of volumes per | +| | virtual machines | | | | | | There are default values for each above-mentioned option. | | | | diff --git a/samples/vnf_samples/nsut/agnostic/agnostic_vnf_topology_ixia_4ports.yaml b/samples/vnf_samples/nsut/agnostic/agnostic_vnf_topology_ixia_4ports.yaml new file mode 100644 index 000000000..1447faff3 --- /dev/null +++ b/samples/vnf_samples/nsut/agnostic/agnostic_vnf_topology_ixia_4ports.yaml @@ -0,0 +1,71 @@ +# Copyright (c) 2018 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: agnostic-topology + name: agnostic-topology + short-name: agnostic-topology + description: agnostic-topology + constituent-vnfd: + - member-vnf-index: '1' + vnfd-id-ref: tg__0 + VNF model: ../../vnf_descriptors/ixia_rfc2544_tpl.yaml #TG type + - member-vnf-index: '2' + vnfd-id-ref: vnf__0 + VNF model: ../../vnf_descriptors/agnostic_vnf.yaml #VNF type + + 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/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml index d08dbaa6e..e4f715c84 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml @@ -22,6 +22,11 @@ description: > {% set queue_depths = queue_depths or "4" %} {% set steady_state_samples = steady_state_samples or 10 %} {% set volume_size = volume_size or 4 %} +{% set volume_count = volume_count or 1 %} +{% set volume_type = volume_type or "" %} +{% set availability_zone = availability_zone or "nova" %} +{% set subnet_CIDR = subnet_CIDR or "172.16.0.0/16" %} +{% set stack_name = stack_name or "StorperfAgentGroup" %} scenarios: - type: StorPerf @@ -39,6 +44,11 @@ scenarios: workload: {{workload}} workloads: {{workloads}} steady_state_samples: {{steady_state_samples}} + volume_count: {{volume_count}} + volume_type: {{volume_type}} + availability_zone: {{availability_zone}} + subnet_CIDR: {{subnet_CIDR}} + stack_name: {{stack_name}} runner: type: Iteration diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py index 73311f0c2..3ad1097b0 100644 --- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py +++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py @@ -46,7 +46,8 @@ class OvsDpdkContext(base.Context): '2.7.0': '16.11.1', '2.7.1': '16.11.2', '2.7.2': '16.11.3', - '2.8.0': '17.05.2' + '2.8.0': '17.05.2', + '2.8.1': '17.05.2' } DEFAULT_OVS = '2.6.0' @@ -166,8 +167,7 @@ class OvsDpdkContext(base.Context): version = self.ovs_properties.get('version', {}) ovs_ver = [int(x) for x in version.get('ovs', self.DEFAULT_OVS).split('.')] ovs_add_port = ('ovs-vsctl add-port {br} {port} -- ' - 'set Interface {port} type={type_}{dpdk_args}') - ovs_add_queue = 'ovs-vsctl set Interface {port} options:n_rxq={queue}' + 'set Interface {port} type={type_}{dpdk_args}{dpdk_rxq}') chmod_vpath = 'chmod 0777 {0}/var/run/openvswitch/dpdkvhostuser*' cmd_list = [ @@ -176,6 +176,8 @@ class OvsDpdkContext(base.Context): 'ovs-vsctl add-br {0} -- set bridge {0} datapath_type=netdev'. format(MAIN_BRIDGE) ] + dpdk_rxq = " options:n_rxq={queue}".format( + queue=self.ovs_properties.get("queues", 1)) ordered_network = collections.OrderedDict(self.networks) for index, vnf in enumerate(ordered_network.values()): @@ -183,10 +185,7 @@ class OvsDpdkContext(base.Context): dpdk_args = " options:dpdk-devargs=%s" % vnf.get("phy_port") dpdk_list.append(ovs_add_port.format( br=MAIN_BRIDGE, port='dpdk%s' % vnf.get("port_num", 0), - type_='dpdk', dpdk_args=dpdk_args)) - dpdk_list.append(ovs_add_queue.format( - port='dpdk%s' % vnf.get("port_num", 0), - queue=self.ovs_properties.get("queues", 1))) + type_='dpdk', dpdk_args=dpdk_args, dpdk_rxq=dpdk_rxq)) # Sorting the array to make sure we execute dpdk0... in the order list.sort(dpdk_list) @@ -196,7 +195,7 @@ class OvsDpdkContext(base.Context): for index, _ in enumerate(ordered_network): cmd_list.append(ovs_add_port.format( br=MAIN_BRIDGE, port='dpdkvhostuser%s' % index, - type_='dpdkvhostuser', dpdk_args="")) + type_='dpdkvhostuser', dpdk_args="", dpdk_rxq="")) ovs_flow = ("ovs-ofctl add-flow {0} in_port=%s,action=output:%s". format(MAIN_BRIDGE)) diff --git a/yardstick/benchmark/scenarios/storage/storperf.py b/yardstick/benchmark/scenarios/storage/storperf.py index 8093cd2d2..f2fcce651 100644 --- a/yardstick/benchmark/scenarios/storage/storperf.py +++ b/yardstick/benchmark/scenarios/storage/storperf.py @@ -87,7 +87,9 @@ class StorPerf(base.Scenario): env_args = {} env_args_payload_list = ["agent_count", "agent_flavor", "public_network", "agent_image", - "volume_size"] + "volume_size", "volume_type", + "volume_count", "availability_zone", + "stack_name", "subnet_CIDR"] for env_argument in env_args_payload_list: try: diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py index cf625d483..d4f75babb 100644 --- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py +++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py @@ -406,16 +406,15 @@ class IxNextgen(object): # pragma: no cover raise exceptions.IxNetworkFlowNotPresent(flow_group=fg_id) type = traffic_param.get('traffic_type', 'fixedDuration') - rate = traffic_param['rate'] rate_unit = ( 'framesPerSecond' if traffic_param['rate_unit'] == tp_base.TrafficProfileConfig.RATE_FPS else 'percentLineRate') weighted_range_pairs = self._parse_framesize( - traffic_param['outer_l2']['framesize']) + traffic_param['outer_l2'].get('framesize', {})) srcmac = str(traffic_param['outer_l2'].get('srcmac', '00:00:00:00:00:01')) dstmac = str(traffic_param['outer_l2'].get('dstmac', '00:00:00:00:00:02')) - if traffic_param['outer_l2']['QinQ']: + if traffic_param['outer_l2'].get('QinQ'): s_vlan = traffic_param['outer_l2']['QinQ']['S-VLAN'] c_vlan = traffic_param['outer_l2']['QinQ']['C-VLAN'] @@ -440,21 +439,27 @@ class IxNextgen(object): # pragma: no cover self.ixnet.setMultiAttribute( config_element + '/transmissionControl', '-type', type, '-duration', duration) + self.ixnet.setMultiAttribute( config_element + '/frameRate', - '-rate', rate, '-type', rate_unit) - self.ixnet.setMultiAttribute( - config_element + '/frameSize', - '-type', 'weightedPairs', - '-weightedRangePairs', weighted_range_pairs) + '-rate', traffic_param['rate'], '-type', rate_unit) + + if len(weighted_range_pairs): + self.ixnet.setMultiAttribute( + config_element + '/frameSize', + '-type', 'weightedPairs', + '-weightedRangePairs', weighted_range_pairs) + self.ixnet.commit() - self._update_frame_mac( - self._get_stack_item(fg_id, PROTO_ETHERNET)[0], - 'destinationAddress', dstmac) - self._update_frame_mac( - self._get_stack_item(fg_id, PROTO_ETHERNET)[0], - 'sourceAddress', srcmac) + if dstmac: + self._update_frame_mac( + self._get_stack_item(fg_id, PROTO_ETHERNET)[0], + 'destinationAddress', dstmac) + if srcmac: + self._update_frame_mac( + self._get_stack_item(fg_id, PROTO_ETHERNET)[0], + 'sourceAddress', srcmac) def _update_vlan_tag(self, fg_id, params, vlan=0): field_to_param_map = { @@ -514,20 +519,24 @@ class IxNextgen(object): # pragma: no cover if not self._get_config_element_by_flow_group_name(fg_id): raise exceptions.IxNetworkFlowNotPresent(flow_group=fg_id) - count = traffic_param['outer_l3']['count'] - srcip = str(traffic_param['outer_l3']['srcip']) - dstip = str(traffic_param['outer_l3']['dstip']) - srcseed = traffic_param['outer_l3']['srcseed'] - dstseed = traffic_param['outer_l3']['dstseed'] - srcmask = traffic_param['outer_l3']['srcmask'] or IP_VERSION_4_MASK - dstmask = traffic_param['outer_l3']['dstmask'] or IP_VERSION_4_MASK - - self._update_ipv4_address( - self._get_stack_item(fg_id, PROTO_IPV4)[0], - 'srcIp', srcip, srcseed, srcmask, count) - self._update_ipv4_address( - self._get_stack_item(fg_id, PROTO_IPV4)[0], - 'dstIp', dstip, dstseed, dstmask, count) + if traffic_param['outer_l3']: + count = traffic_param['outer_l3']['count'] + srcip = traffic_param['outer_l3']['srcip'] + dstip = traffic_param['outer_l3']['dstip'] + srcseed = traffic_param['outer_l3']['srcseed'] + dstseed = traffic_param['outer_l3']['dstseed'] + srcmask = traffic_param['outer_l3']['srcmask'] \ + or IP_VERSION_4_MASK + dstmask = traffic_param['outer_l3']['dstmask'] \ + or IP_VERSION_4_MASK + if srcip: + self._update_ipv4_address( + self._get_stack_item(fg_id, PROTO_IPV4)[0], + 'srcIp', str(srcip), srcseed, srcmask, count) + if dstip: + self._update_ipv4_address( + self._get_stack_item(fg_id, PROTO_IPV4)[0], + 'dstIp', str(dstip), dstseed, dstmask, count) def update_l4(self, traffic): """Update the L4 headers @@ -541,7 +550,10 @@ class IxNextgen(object): # pragma: no cover if not self._get_config_element_by_flow_group_name(fg_id): raise exceptions.IxNetworkFlowNotPresent(flow_group=fg_id) - proto = traffic_param['outer_l3']['proto'] + proto = traffic_param['outer_l3'].get('proto') + if not (proto and traffic_param['outer_l4']): + continue + if proto not in SUPPORTED_PROTO: raise exceptions.IXIAUnsupportedProtocol(protocol=proto) @@ -554,12 +566,15 @@ class IxNextgen(object): # pragma: no cover dstport = traffic_param['outer_l4']['dstport'] dstmask = traffic_param['outer_l4']['dstportmask'] - if proto in SUPPORTED_PROTO: - self._update_udp_port(self._get_stack_item(fg_id, proto)[0], - 'srcPort', srcport, seed, srcmask, count) - - self._update_udp_port(self._get_stack_item(fg_id, proto)[0], - 'dstPort', dstport, seed, dstmask, count) + if proto == PROTO_UDP: + if srcport: + self._update_udp_port( + self._get_stack_item(fg_id, proto)[0], + 'srcPort', srcport, seed, srcmask, count) + if dstport: + self._update_udp_port( + self._get_stack_item(fg_id, proto)[0], + 'dstPort', dstport, seed, dstmask, count) def _update_udp_port(self, descriptor, field, value, seed=1, mask=0, count=1): @@ -798,3 +813,29 @@ class IxNextgen(object): # pragma: no cover self.ixnet.commit() return obj + + def add_bgp(self, ipv4, dut_ip, local_as, bgp_type=None): + """Add BGP protocol""" + log.debug("add_bgp: ipv4='%s', dut_ip='%s', local_as='%s'", ipv4, + dut_ip, local_as) + obj = self.ixnet.add(ipv4, 'bgpIpv4Peer') + self.ixnet.commit() + + # Set DUT IP address + dut_ip_addr = self.ixnet.getAttribute(obj, '-dutIp') + self.ixnet.setAttribute(dut_ip_addr + '/singleValue', + '-value', dut_ip) + + # Set local AS number + local_as_number = self.ixnet.getAttribute(obj, '-localAs2Bytes') + self.ixnet.setAttribute(local_as_number + '/singleValue', + '-value', local_as) + + if bgp_type: + # Set BGP type. If not specified, default value is using. + # Default type is "internal" + bgp_type_field = self.ixnet.getAttribute(obj, '-type') + self.ixnet.setAttribute(bgp_type_field + '/singleValue', + '-value', bgp_type) + self.ixnet.commit() + return obj diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index 44bf2eafc..b8aa78d80 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -56,68 +56,83 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): if not traffickey.startswith((self.UPLINK, self.DOWNLINK)): continue + # values should be single-item dict, so just grab the first item try: - # values should be single-item dict, so just grab the first item - try: - key, value = next(iter(values.items())) - except StopIteration: - result[traffickey] = {} - continue - - port_id = value.get('id', 1) - port_index = port_id - 1 - - if value.get('outer_l3v4'): - ip = value['outer_l3v4'] - src_key, dst_key = 'srcip4', 'dstip4' - else: - ip = value['outer_l3v6'] - src_key, dst_key = 'srcip6', 'dstip6' - - srcip, srcmask = self._get_ip_and_mask(ip[src_key]) - dstip, dstmask = self._get_ip_and_mask(ip[dst_key]) - - outer_l4 = value.get('outer_l4') - src_port, src_port_mask = self._get_fixed_and_mask(outer_l4['srcport']) - dst_port, dst_port_mask = self._get_fixed_and_mask(outer_l4['dstport']) - result[traffickey] = { - 'bidir': False, - 'id': port_id, - 'rate': self.rate, - 'rate_unit': self.rate_unit, - 'outer_l2': { - 'framesize': value['outer_l2']['framesize'], - 'framesPerSecond': True, - 'QinQ': value['outer_l2'].get('QinQ'), - 'srcmac': mac['src_mac_{}'.format(port_index)], - 'dstmac': mac['dst_mac_{}'.format(port_index)], - }, - 'outer_l3': { - 'count': ip['count'], - 'dscp': ip['dscp'], - 'ttl': ip['ttl'], - 'srcseed': ip.get('srcseed', 1), - 'dstseed': ip.get('dstseed', 1), - 'srcip': srcip, - 'dstip': dstip, - 'srcmask': srcmask, - 'dstmask': dstmask, - 'type': key, - 'proto': ip['proto'], - }, - 'outer_l4': { - 'srcport': src_port, - 'dstport': dst_port, - 'srcportmask': src_port_mask, - 'dstportmask': dst_port_mask, - 'count': outer_l4['count'], - 'seed': outer_l4.get('seed', 1) - } - - } - except KeyError: + key, value = next(iter(values.items())) + except StopIteration: + result[traffickey] = {} continue + port_id = value.get('id', 1) + port_index = port_id - 1 + + result[traffickey] = { + 'bidir': False, + 'id': port_id, + 'rate': self.rate, + 'rate_unit': self.rate_unit, + 'outer_l2': {}, + 'outer_l3': {}, + 'outer_l4': {}, + } + + outer_l2 = value.get('outer_l2') + if outer_l2: + result[traffickey]['outer_l2'].update({ + 'framesize': outer_l2.get('framesize'), + 'framesPerSecond': True, + 'QinQ': outer_l2.get('QinQ'), + 'srcmac': mac.get('src_mac_{}'.format(port_index)), + 'dstmac': mac.get('dst_mac_{}'.format(port_index)), + }) + + if value.get('outer_l3v4'): + outer_l3 = value['outer_l3v4'] + src_key, dst_key = 'srcip4', 'dstip4' + else: + outer_l3 = value.get('outer_l3v6') + src_key, dst_key = 'srcip6', 'dstip6' + if outer_l3: + srcip = srcmask = dstip = dstmask = None + if outer_l3.get(src_key): + srcip, srcmask = self._get_ip_and_mask(outer_l3[src_key]) + if outer_l3.get(dst_key): + dstip, dstmask = self._get_ip_and_mask(outer_l3[dst_key]) + + result[traffickey]['outer_l3'].update({ + 'count': outer_l3.get('count', 1), + 'dscp': outer_l3.get('dscp'), + 'ttl': outer_l3.get('ttl'), + 'srcseed': outer_l3.get('srcseed', 1), + 'dstseed': outer_l3.get('dstseed', 1), + 'srcip': srcip, + 'dstip': dstip, + 'srcmask': srcmask, + 'dstmask': dstmask, + 'type': key, + 'proto': outer_l3.get('proto'), + }) + + outer_l4 = value.get('outer_l4') + if outer_l4: + src_port = src_port_mask = dst_port = dst_port_mask = None + if outer_l4.get('srcport'): + src_port, src_port_mask = ( + self._get_fixed_and_mask(outer_l4['srcport'])) + + if outer_l4.get('dstport'): + dst_port, dst_port_mask = ( + self._get_fixed_and_mask(outer_l4['dstport'])) + + result[traffickey]['outer_l4'].update({ + 'srcport': src_port, + 'dstport': dst_port, + 'srcportmask': src_port_mask, + 'dstportmask': dst_port_mask, + 'count': outer_l4.get('count', 1), + 'seed': outer_l4.get('seed', 1), + }) + return result def _ixia_traffic_generate(self, traffic, ixia_obj): diff --git a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py index 01ed4e34e..66fed81f1 100644 --- a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py +++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py @@ -334,6 +334,21 @@ class TestIxNextgen(unittest.TestCase): self.ixnet_gen.ixnet.setMultiAttribute.assert_not_called() + def test_add_bgp(self): + self.ixnet_gen.ixnet.add.return_value = 'obj' + self.ixnet_gen.ixnet.getAttribute.return_value = 'attr' + self.ixnet_gen.add_bgp(ipv4='ipv4 1', + dut_ip='10.0.0.1', + local_as=65000, + bgp_type='external') + self.ixnet_gen.ixnet.add.assert_called_once_with('ipv4 1', 'bgpIpv4Peer') + self.ixnet_gen.ixnet.setAttribute.assert_any_call( + 'attr/singleValue', '-value', '10.0.0.1') + self.ixnet_gen.ixnet.setAttribute.assert_any_call( + 'attr/singleValue', '-value', 65000) + self.ixnet_gen.ixnet.setAttribute.assert_any_call( + 'attr/singleValue', '-value', 'external') + @mock.patch.object(IxNetwork, 'IxNet') def test_connect(self, mock_ixnet): mock_ixnet.return_value = self.ixnet @@ -643,6 +658,9 @@ class TestIxNextgen(unittest.TestCase): 'outer_l3': { 'proto': 'unsupported', }, + 'outer_l4': { + 'seed': 1 + } }, } with mock.patch.object(self.ixnet_gen, |