summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--yardstick/benchmark/contexts/standalone/ovs_dpdk.py15
-rw-r--r--yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py111
-rw-r--r--yardstick/network_services/traffic_profile/ixia_rfc2544.py133
-rw-r--r--yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py18
4 files changed, 175 insertions, 102 deletions
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/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,