diff options
author | mklyus <mklyus@cisco.com> | 2020-04-13 10:36:08 +0300 |
---|---|---|
committer | mklyus <mklyus@cisco.com> | 2020-04-27 22:36:54 +0300 |
commit | f34214799a03f08d02f1ef1f1fc3c91970030f89 (patch) | |
tree | 7705f853eb77dd804a57ea0dba2b9283ffbebc05 | |
parent | a302be9afab5879a8f52153202ff972712d6b2e8 (diff) |
l3-router fixes
Change-Id: I025c97af8003e797b8cd3133e0b2d64694fe4b58
Signed-off-by: mklyus <mklyus@cisco.com>
-rwxr-xr-x | nfvbench/cfg.default.yaml | 6 | ||||
-rw-r--r-- | nfvbench/chain_router.py | 7 | ||||
-rw-r--r-- | nfvbench/chaining.py | 6 |
3 files changed, 15 insertions, 4 deletions
diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml index d154318..1c4e20b 100755 --- a/nfvbench/cfg.default.yaml +++ b/nfvbench/cfg.default.yaml @@ -172,8 +172,8 @@ traffic_generator: # `tg_gateway_ip_addrs` base IP for traffic generator ports in the left and right networks to the VNFs # chain count consecutive IP addresses spaced by tg_gateway_ip_addrs_step will be used # `tg_gateway_ip_addrs__step`: step for generating traffic generator gateway sequences. default is 0.0.0.1 - tg_gateway_ip_addrs: ['1.1.0.100', '2.2.0.100'] - tg_gateway_ip_cidrs: ['1.1.0.0/24','2.2.0.0/24'] + tg_gateway_ip_addrs: ['192.168.1.100', '192.168.2.100'] + tg_gateway_ip_cidrs: ['192.168.1.0/24','192.168.2.0/24'] tg_gateway_ip_addrs_step: 0.0.0.1 # `gateway_ip_addrs`: base IPs of VNF router gateways (left and right), quantity used depends on chain count # must correspond to the public IP on the left and right networks @@ -181,7 +181,7 @@ traffic_generator: # must be the same subnet but not same IP as tg_gateway_ip_addrs. # chain count consecutive IP addresses spaced by gateway_ip_addrs_step will be used # `gateway_ip_addrs_step`: step for generating router gateway sequences. default is 0.0.0.1 - gateway_ip_addrs: ['1.1.0.2', '2.2.0.2'] + gateway_ip_addrs: ['192.168.1.1', '192.168.2.1'] gateway_ip_addrs_step: 0.0.0.1 # UDP DEFINED VARIABLES diff --git a/nfvbench/chain_router.py b/nfvbench/chain_router.py index ac89476..99114e0 100644 --- a/nfvbench/chain_router.py +++ b/nfvbench/chain_router.py @@ -80,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'], @@ -125,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] diff --git a/nfvbench/chaining.py b/nfvbench/chaining.py index b9ed48b..a52c7e9 100644 --- a/nfvbench/chaining.py +++ b/nfvbench/chaining.py @@ -245,6 +245,7 @@ class ChainNetwork(object): self.reuse = False self.network = None self.vlan = None + self.router_name = None if manager.config.l3_router and hasattr(network_config, 'router_name'): self.router_name = network_config.router_name try: @@ -924,7 +925,10 @@ class Chain(object): if port_index: # this will pick the last item in array port_index = -1 - return self.networks[port_index].get_vlan() + # This string filters networks connected to TG, in case of + # l3-router feature we have 4 networks instead of 2 + networks = [x for x in self.networks if not x.router_name] + return networks[port_index].get_vlan() def get_vxlan(self, port_index): """Get the VXLAN id on a given port. |