aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-03-24 10:49:10 +0000
committerMartin Klozik <martinx.klozik@intel.com>2017-03-24 16:07:22 +0000
commit20a12dd85dde14bee9ada4f9f72ffd8eebd4e53c (patch)
tree59bffddbc76ae61bf4dac1c13f9fd1f2fa7772fb /tools
parente1d6248d35bf61e87cc07f9a4f286ada06a819c8 (diff)
ixia: Make L3 and L4 headers optional
During testing it is sometimes useful to generate pure L2 traffic without L3 or L4 related headers. IxNetwork TCL script was updated to support this option. Generic TRAFFIC array was enhanced by on/off switch for L3 and L4 headers. Thus it can be implemented by other traffic generators in the future, if this feature will prove itself useful. JIRA: VSPERF-500 Change-Id: I723c703e5d6ef609fd5b7db366871278a4730203 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com> Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/functions.py38
1 files changed, 30 insertions, 8 deletions
diff --git a/tools/functions.py b/tools/functions.py
index 05bde54f..da43edca 100644
--- a/tools/functions.py
+++ b/tools/functions.py
@@ -143,13 +143,35 @@ def settings_update_paths():
S.setValue('TOOLS', tools)
def check_traffic(traffic):
- """Check traffic definition and correct it if needed.
+ """Check traffic definition and correct it if possible.
"""
- # 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
+ # check if requested networking layers make sense
+ if traffic['vlan']['enabled']:
+ if not (traffic['l3']['enabled'] and traffic['l4']['enabled']):
+ raise RuntimeError('TRAFFIC misconfiguration: both l3 and l4 must '
+ 'be enabled if vlan is enabled.')
+ if traffic['l4']['enabled']:
+ if not traffic['l3']['enabled']:
+ raise RuntimeError('TRAFFIC misconfiguration: l3 must be enabled '
+ 'if l4 is enabled.')
+
+ # check if multistream configuration makes sense
+ if traffic['multistream']:
+ if traffic['stream_type'] == 'L3':
+ if not traffic['l3']['enabled']:
+ raise RuntimeError('TRAFFIC misconfiguration: l3 must be '
+ 'enabled if l3 streams are requested.')
+ if traffic['stream_type'] == 'L4':
+ if not traffic['l4']['enabled']:
+ raise RuntimeError('TRAFFIC misconfiguration: l4 must be '
+ 'enabled if l4 streams are requested.')
+
+ # in case of UDP ports we have only 65536 (0-65535) unique options
+ if traffic['multistream'] > MAX_L4_FLOWS:
+ 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