diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/test_router_availability_zones_ovn.py b/whitebox_neutron_tempest_plugin/tests/scenario/test_router_availability_zones_ovn.py index 3084ce1..a7b113f 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/test_router_availability_zones_ovn.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/test_router_availability_zones_ovn.py @@ -53,14 +53,14 @@ class OvnAvaliabilityzonesTest( body = cls.client.list_agents() agents = body['agents'] cls.AZs_list = [] - cls.ovn_controller_gw_agent_list = {} + cls.ovn_controller_gw_agent_dict = {} cls.agent_conf = {} for agent in agents: if agent.get('agent_type') in AZ_SUPPORTED_AGENTS: az = agent.get('availability_zone') if (az and (az not in cls.AZs_list)): cls.AZs_list.append(az) - cls.ovn_controller_gw_agent_list[ + cls.ovn_controller_gw_agent_dict[ agent.get('host').replace('"', '').split('.')[0]] = az cmd = '{} crudini --get {} DEFAULT {{}} || echo'.format( cls.neutron_api_prefix, cls.neutron_conf) @@ -100,16 +100,17 @@ class OvnAvaliabilityzonesTest( as a hint. In this case the resource should be spawned over 3 random availability zones (one network node per zone). """ - resource_list = self.ovn_controller_gw_agent_list + resource_dict = self.ovn_controller_gw_agent_dict router_port = self.os_admin.network_client.list_ports( device_owner=constants.DEVICE_OWNER_ROUTER_GW, device_id=router['id'])['ports'][0] chassis_list = self.get_router_gateway_chassis_list( router_port['id']) - resource_hosts = list(self.get_router_gateway_chassis_by_id(iden) - for iden in chassis_list) + resource_hosts = list( + self.get_router_gateway_chassis_by_id(iden).split('.')[0] + for iden in chassis_list) az_hosts = [] - for agent_host, agent_zone in resource_list.items(): + for agent_host, agent_zone in resource_dict.items(): if agent_zone in az: az_hosts.append(agent_host) @@ -126,7 +127,7 @@ class OvnAvaliabilityzonesTest( # Check that the router is only deployed over az hosts for host in resource_hosts: self.assertIn(host, az_hosts) - tmp_zones.append(resource_list[host]) + tmp_zones.append(resource_dict[host]) # Check that it is deployed over all the azs self.assertEqual(set(az).symmetric_difference(set(tmp_zones)), set()) @@ -139,7 +140,7 @@ class OvnAvaliabilityzonesTest( # Check that the router is only deployed over az hosts for host in resource_hosts: self.assertIn(host, az_hosts) - tmp_zones.append(resource_list[host]) + tmp_zones.append(resource_dict[host]) # Check that it is deployed only th one instance per az self.assertEqual(len(tmp_zones), len(set(tmp_zones))) # Check that the max redundancy is reached @@ -156,7 +157,7 @@ class OvnAvaliabilityzonesTest( """ az_host_counter = {} - for tmp_az in self.ovn_controller_gw_agent_list.values(): + for tmp_az in self.ovn_controller_gw_agent_dict.values(): tmp_counter = az_host_counter.get(tmp_az, 0) + 1 az_host_counter[tmp_az] = tmp_counter for tmp_az, counter in az_host_counter.items(): @@ -179,7 +180,7 @@ class OvnAvaliabilityzonesTest( """ az_host_counter = {} - for tmp_az in self.ovn_controller_gw_agent_list.values(): + for tmp_az in self.ovn_controller_gw_agent_dict.values(): tmp_counter = az_host_counter.get(tmp_az, 0) + 1 az_host_counter[tmp_az] = tmp_counter for tmp_az, counter in az_host_counter.items():