use floatingip for ping

netcreate_nova_boot_fip_ping was never using floatingip to
ping as we always call boot_server_with_fip(use_floating_ip=None)

Neutron policy doenst allow users to create router with
external_gateway_info. So we use admin client but still
create router using user tenant id.

Change-Id: I03895c835f5e05daed95bc15f1d6e05acd1c0110
This commit is contained in:
venkata anil 2019-09-19 00:23:43 +05:30
parent 460f8a1fbb
commit f752b4d463

View File

@ -31,7 +31,12 @@ class CreateNetworkNovaBootPing(vm_utils.VMScenario,
def run(self, image, flavor, ext_net_id, router_create_args=None, def run(self, image, flavor, ext_net_id, router_create_args=None,
network_create_args=None, subnet_create_args=None, **kwargs): network_create_args=None, subnet_create_args=None, **kwargs):
ext_net_name = None
if ext_net_id:
ext_net_name = self.clients("neutron").show_network(
ext_net_id)["network"]["name"]
router_create_args["name"] = self.generate_random_name() router_create_args["name"] = self.generate_random_name()
router_create_args["tenant_id"] = self.context["tenant"]["id"]
router_create_args.setdefault("external_gateway_info", router_create_args.setdefault("external_gateway_info",
{"network_id": ext_net_id, "enable_snat": True}) {"network_id": ext_net_id, "enable_snat": True})
router = self._create_router(router_create_args) router = self._create_router(router_create_args)
@ -40,8 +45,8 @@ class CreateNetworkNovaBootPing(vm_utils.VMScenario,
subnet = self._create_subnet(network, subnet_create_args or {}) subnet = self._create_subnet(network, subnet_create_args or {})
self._add_interface_router(subnet['subnet'], router['router']) self._add_interface_router(subnet['subnet'], router['router'])
kwargs["nics"] = [{'net-id': network['network']['id']}] kwargs["nics"] = [{'net-id': network['network']['id']}]
guest = self._boot_server_with_fip(image, flavor, True, None, **kwargs) guest = self._boot_server_with_fip(image, flavor, True,
ext_net_name, **kwargs)
self._wait_for_ping(guest[1]['ip']) self._wait_for_ping(guest[1]['ip'])
@atomic.action_timer("neutron.create_router") @atomic.action_timer("neutron.create_router")
@ -51,4 +56,4 @@ class CreateNetworkNovaBootPing(vm_utils.VMScenario,
:param router_create_args: POST /v2.0/routers request options :param router_create_args: POST /v2.0/routers request options
:returns: neutron router dict :returns: neutron router dict
""" """
return self.clients("neutron").create_router({"router": router_create_args}) return self.admin_clients("neutron").create_router({"router": router_create_args})