aboutsummaryrefslogtreecommitdiffstats
path: root/nfvbench/chain_router.py
diff options
context:
space:
mode:
Diffstat (limited to 'nfvbench/chain_router.py')
-rw-r--r--nfvbench/chain_router.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/nfvbench/chain_router.py b/nfvbench/chain_router.py
index 9372716..99114e0 100644
--- a/nfvbench/chain_router.py
+++ b/nfvbench/chain_router.py
@@ -39,15 +39,12 @@ import time
from netaddr import IPAddress
from netaddr import IPNetwork
-from log import LOG
+from .log import LOG
class ChainException(Exception):
"""Exception while operating the chains."""
- pass
-
-
class ChainRouter(object):
"""Could be a shared router across all chains or a chain private router."""
@@ -83,6 +80,11 @@ class ChainRouter(object):
.format(router=self.name,
sub_id=subnet.network['subnets'][0]))
interfaces = self.manager.neutron_client.list_ports(device_id=router['id'])['ports']
+ # This string filters nfvbench networks in case when some other specific networks
+ # created and attached to the test nfvebnch router manually or automatically
+ # like in case of HA when neutron router virtually present on several network nodes
+ interfaces = [x for x in interfaces if x['fixed_ips'][0]['subnet_id'] in
+ [s.network['subnets'][0] for s in self.subnets]]
for interface in interfaces:
if self.is_ip_in_network(
interface['fixed_ips'][0]['ip_address'],
@@ -128,6 +130,8 @@ class ChainRouter(object):
router_interface = {'subnet_id': subnet.network['subnets'][0]}
self.manager.neutron_client.add_interface_router(router_id, router_interface)
interfaces = self.manager.neutron_client.list_ports(device_id=router_id)['ports']
+ interfaces = [x for x in interfaces if x['fixed_ips'][0]['subnet_id'] in
+ [s.network['subnets'][0] for s in self.subnets]]
for interface in interfaces:
itf = interface['fixed_ips'][0]['ip_address']
cidr0 = self.manager.config.traffic_generator.tg_gateway_ip_cidrs[0]