diff options
author | ahothan <ahothan@cisco.com> | 2017-08-04 17:26:33 -0700 |
---|---|---|
committer | ahothan <ahothan@cisco.com> | 2017-08-04 17:27:41 -0700 |
commit | 2d66234fe3b8b3e104e63218b5120a35ca400ea5 (patch) | |
tree | 4290c61fa68b09c83a2983ff742f8f48bf53d231 /nfvbench/chain_clients.py | |
parent | 0036098e46e16c9ae5b795b108a5b9566c02906b (diff) |
Add support for multiple physnets for sr-iov
Update config plugin config
Add readable error message on exception
Change-Id: Ie22de349582abc34d7e62570118022463f835d64
Signed-off-by: ahothan <ahothan@cisco.com>
Diffstat (limited to 'nfvbench/chain_clients.py')
-rw-r--r-- | nfvbench/chain_clients.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/nfvbench/chain_clients.py b/nfvbench/chain_clients.py index 4be050f..dfd6ff2 100644 --- a/nfvbench/chain_clients.py +++ b/nfvbench/chain_clients.py @@ -78,11 +78,12 @@ class BasicStageClient(object): networks = self.neutron.list_networks(name=network_name) return networks['networks'][0] if networks['networks'] else None - def _create_net(self, name, subnet, cidr, network_type=None, segmentation_id=None): + def _create_net(self, name, subnet, cidr, network_type=None, segmentation_id=None, physical_network=None): network = self._lookup_network(name) if network: - phys_net = self.config.internal_networks.physical_network - if segmentation_id is not None and phys_net is not None: + # a network of same name already exists, we need to verify it has the same + # characteristics + if segmentation_id: if network['provider:segmentation_id'] != segmentation_id: raise StageClientException("Mismatch of 'segmentation_id' for reused " "network '{net}'. Network has id '{seg_id1}', " @@ -91,13 +92,14 @@ class BasicStageClient(object): seg_id1=network['provider:segmentation_id'], seg_id2=segmentation_id)) - if network['provider:physical_network'] != phys_net: + if physical_network: + if network['provider:physical_network'] != physical_network: raise StageClientException("Mismatch of 'physical_network' for reused " "network '{net}'. Network has '{phys1}', " "configuration requires '{phys2}'." .format(net=name, phys1=network['provider:physical_network'], - phys2=phys_net)) + phys2=physical_network)) LOG.info('Reusing existing network: ' + name) network['is_reuse'] = True @@ -112,10 +114,10 @@ class BasicStageClient(object): if network_type: body['network']['provider:network_type'] = network_type - phys_net = self.config.internal_networks.physical_network - if segmentation_id is not None and phys_net is not None: + if segmentation_id: body['network']['provider:segmentation_id'] = segmentation_id - body['network']['provider:physical_network'] = phys_net + if physical_network: + body['network']['provider:physical_network'] = physical_network network = self.neutron.create_network(body)['network'] body = { |