Neutron's floatingip add desc param

Neutron's floatingip have not name param,
so we should use desc param as a name.

Change-Id: Ie0522a00e16deee6fa1df5be19e9723f2bf01577
This commit is contained in:
Hai Shi 2017-03-13 14:06:49 +08:00
parent 0ef4e30eed
commit 91f22381a2
3 changed files with 6 additions and 3 deletions

View File

@ -381,7 +381,8 @@ class NeutronV2Loadbalancer(NeutronLbaasV2Mixin):
@base.resource("neutron", "floatingip", order=next(_neutron_order),
tenant_resource=True)
class NeutronFloatingIP(NeutronMixin):
pass
def name(self):
return self.raw_resource.get("description")
@base.resource("neutron", "port", order=next(_neutron_order),

View File

@ -497,7 +497,8 @@ class NeutronScenario(scenario.OpenStackScenario):
"""
floating_network_id = self._get_network_id(
floating_network)
args = {"floating_network_id": floating_network_id}
args = {"floating_network_id": floating_network_id,
"description": self.generate_random_name()}
args.update(floating_ip_args)
return self.clients("neutron").create_floatingip({"floatingip": args})

View File

@ -804,9 +804,10 @@ class NeutronScenarioTestCase(test.ScenarioTestCase):
network_id = "net-id"
floating_ip_args = floating_ip_args or {}
self.clients("neutron").create_floatingip.return_value = fip
self.scenario.generate_random_name = mock.Mock(return_value="s_rally")
mock_get_network_id = self.scenario._get_network_id = mock.Mock()
mock_get_network_id.return_value = network_id
args = {"floating_network_id": network_id}
args = {"floating_network_id": network_id, "description": "s_rally"}
args.update(floating_ip_args)
expected_fip_data = {"floatingip": args}
resultant_fip = self.scenario._create_floatingip(