aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-03-27 10:43:47 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-03-27 10:43:47 +0000
commit881bf91ed8014ba48c55d3a8fc5b4980913f9b95 (patch)
tree2a6a61da70236c3956c9c9afbba39f13486f7178 /tools
parent33077281ce5b50e4df4246bae40c52a86bd2f78a (diff)
parent20a12dd85dde14bee9ada4f9f72ffd8eebd4e53c (diff)
Merge "ixia: Make L3 and L4 headers optional"
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