From 20a12dd85dde14bee9ada4f9f72ffd8eebd4e53c Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Fri, 24 Mar 2017 10:49:10 +0000 Subject: 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 Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Sridhar Rao Reviewed-by: Trevor Cooper --- tools/functions.py | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'tools') 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 -- cgit 1.2.3-korg