Add subnet_id property for FloatingIP

In openstackclient we can pass a "subnet_id" param while creating
floatingip, but missing in FloatingIP properties.

Change-Id: I5c2b93d7e737755958ff074f3a84e592c94f0fe2
Closes-Bug: #1733258
This commit is contained in:
Dongcan Ye 2017-11-20 13:50:26 +08:00
parent 5fd5e77cf4
commit 4419c553a4
2 changed files with 7 additions and 2 deletions

View File

@ -30,8 +30,9 @@ class FloatingIP(resource.Resource):
allow_list = True
_query_mapping = resource.QueryParameters(
'description', 'fixed_ip_address', 'floating_ip_address',
'floating_network_id', 'port_id', 'router_id', 'status',
'description', 'fixed_ip_address',
'floating_ip_address', 'floating_network_id',
'port_id', 'router_id', 'status', 'subnet_id',
project_id='tenant_id')
# Properties
@ -65,6 +66,8 @@ class FloatingIP(resource.Resource):
status = resource.Body('status')
#: Timestamp at which the floating IP was last updated.
updated_at = resource.Body('updated_at')
#: The Subnet ID associated with the floating IP.
subnet_id = resource.Body('subnet_id')
@classmethod
def find_available(cls, session):

View File

@ -29,6 +29,7 @@ EXAMPLE = {
'status': 'ACTIVE',
'revision_number': 12,
'updated_at': '13',
'subnet_id': '14'
}
@ -62,6 +63,7 @@ class TestFloatingIP(testtools.TestCase):
self.assertEqual(EXAMPLE['status'], sot.status)
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
def test_find_available(self):
mock_session = mock.Mock()