#!/usr/bin/env tclsh
# Copyright (c) 2014, Ixia
-# Copyright (c) 2015-2016, Intel Corporation
+# Copyright (c) 2015-2017, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
if {($multipleStreams < 0)} {
set multipleStreams 0
- } elseif {($multipleStreams > 65535)} {
- set multipleStreams 65535
}
if {$multipleStreams} {
#!/usr/bin/env tclsh
# Copyright (c) 2014, Ixia
-# Copyright (c) 2015-2016, Intel Corporation
+# Copyright (c) 2015-2017, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
set numflows 64000
if {$multipleStreams} {
- if {($multipleStreams > 65535)} {
- set numflows 65535
- } else {
- set numflows $multipleStreams
- }
+ set numflows $multipleStreams
set multipleStreams increment
} else {
set multipleStreams singleValue
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-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.
"Parameters" : {
"TRAFFIC" : {
"traffic_type" : "rfc2544_throughput",
- "multistream" : "8000",
+ "multistream" : 8000,
},
},
},
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-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.
# 'multistream' - Defines number of flows simulated by traffic generator.
# Value 0 disables multistream feature
# Data type: int
-# Supported values: 0-65535
+# Supported values: 0-65536 for 'L4' stream type
+# unlimited for 'L2' and 'L3' stream types
# Default value: 0.
# 'stream_type' - Stream type is an extension of the "multistream" feature.
# If multistream is disabled, then stream type will be
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-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.
if self._traffic['stream_type'] == 'L2':
# iterate through destimation MAC address
dst_mac_value = netaddr.EUI(self._traffic['l2']['dstmac']).value
- for i in range(int(self._traffic['multistream'])):
+ for i in range(self._traffic['multistream']):
tmp_mac = netaddr.EUI(dst_mac_value + i)
tmp_mac.dialect = netaddr.mac_unix_expanded
flow_template.update({'dl_dst':tmp_mac})
elif self._traffic['stream_type'] == 'L3':
# iterate through destimation IP address
dst_ip_value = netaddr.IPAddress(self._traffic['l3']['dstip']).value
- for i in range(int(self._traffic['multistream'])):
+ for i in range(self._traffic['multistream']):
tmp_ip = netaddr.IPAddress(dst_ip_value + i)
flow_template.update({'dl_type':'0x0800', 'nw_dst':tmp_ip})
# optimize flow insertion by usage of cache
elif self._traffic['stream_type'] == 'L4':
# read transport protocol from configuration and iterate through its destination port
proto = _PROTO_TCP if self._traffic['l3']['proto'].lower() == 'tcp' else _PROTO_UDP
- for i in range(int(self._traffic['multistream'])):
+ for i in range(self._traffic['multistream']):
flow_template.update({'dl_type':'0x0800', 'nw_proto':proto, 'tp_dst':i})
# optimize flow insertion by usage of cache
self._vswitch.add_flow(bridge, flow_template, cache='on')
'multistream' - Defines number of flows simulated by traffic generator.
Value 0 disables multistream feature
Data type: int
- Supported values: 0-65535
+ Supported values: 0-65536 for 'L4' stream type
+ unlimited for 'L2' and 'L3' stream types
Default value: 0.
'stream_type' - Stream type is an extension of the "multistream" feature.
If multistream is disabled, then stream type will be
self._traffic.update({'bidir': bidirectional,
'tunnel_type': self._tunnel_type,})
+ self._traffic = functions.check_traffic(self._traffic)
+
# Packet Forwarding mode
self._vswitch_none = S.getValue('VSWITCH').strip().lower() == 'none'
import shutil
from conf import settings as S
+MAX_L4_FLOWS = 65536
+
#
# Support functions
#
tools['dpdk_src'] = S.getValue('PATHS')['dpdk']['src']['path']
S.setValue('TOOLS', tools)
+
+def check_traffic(traffic):
+ """Check traffic definition and correct it if needed.
+ """
+ # in case of UDP ports we have only 65536 (0-65535) unique options
+ if traffic['multistream'] > MAX_L4_FLOWS and \
+ traffic['stream_type'] == 'L4':
+ logging.getLogger().warning('Requested amount of L4 flows %s is bigger than '
+ 'number of transport protocol ports. It was set '
+ 'to %s.', traffic['multistream'], MAX_L4_FLOWS)
+ traffic['multistream'] = MAX_L4_FLOWS
+ return traffic
# set traffic details, so they can be passed to traffic ctl
traffic = copy.deepcopy(settings.getValue('TRAFFIC'))
+ traffic = functions.check_traffic(traffic)
+
traffic_ctl = component_factory.create_traffic(
traffic['traffic_type'],
loader.get_trafficgen_class())