summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2018-12-08 18:05:26 -0800
committerahothan <ahothan@cisco.com>2018-12-08 18:05:26 -0800
commit95ec969158c3f2e75a2e70e87d5f43f1c45b6f8e (patch)
treedd75ff0ac8d7e5594e946cc069aa52a5f1b2a1a5
parent40d716a6fca17fcbba066769b503f8aeeea400dc (diff)
NFVBENCH-110 EXT shared network requires 2 vlans per chain in config3.0.3
Change-Id: I6ba220eab476edd0e9f62c56a0c379250fc51916 Signed-off-by: ahothan <ahothan@cisco.com>
-rw-r--r--nfvbench/chaining.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/nfvbench/chaining.py b/nfvbench/chaining.py
index ed379bc..5f9e1e8 100644
--- a/nfvbench/chaining.py
+++ b/nfvbench/chaining.py
@@ -908,13 +908,22 @@ class ChainManager(object):
# if it is a single int or mac, make it a list of 1 int
if isinstance(ll, (int, str)):
ll = [ll]
- if not ll or len(ll) < self.chain_count:
- raise ChainException('%s=%s must be a list with %d elements per chain' %
- (list_name, ll, self.chain_count))
for item in ll:
if not re.match(pattern, str(item)):
raise ChainException("Invalid format '{item}' specified in {fname}"
.format(item=item, fname=list_name))
+ # must have at least 1 element
+ if not ll:
+ raise ChainException('%s cannot be empty' % (list_name))
+ # for shared network, if 1 element is passed, replicate it as many times
+ # as chains
+ if self.config.service_chain_shared_net and len(ll) == 1:
+ ll = [ll[0]] * self.chain_count
+
+ # number of elements musty be the number of chains
+ elif len(ll) < self.chain_count:
+ raise ChainException('%s=%s must be a list with %d elements per chain' %
+ (list_name, ll, self.chain_count))
return ll
def _setup_image(self):