Skip to content

Commit 408c4ea

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add standard attributes to the core network resources"
2 parents 88f27bf + a86cdd4 commit 408c4ea

16 files changed

+64
-0
lines changed

openstack/network/v2/floating_ip.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class FloatingIP(resource.Resource):
3030
allow_list = True
3131

3232
# Properties
33+
#: Timestamp when the floating IP was created.
34+
created_at = resource.prop('created_at')
3335
#: The floating IP description.
3436
description = resource.prop('description')
3537
#: The fixed IP address associated with the floating IP. If you
@@ -47,10 +49,14 @@ class FloatingIP(resource.Resource):
4749
port_id = resource.prop('port_id')
4850
#: The ID of the project this floating IP is associated with.
4951
project_id = resource.prop('tenant_id')
52+
#: Revision number of the floating IP. *Type: int*
53+
revision_number = resource.prop('revision_number', type=int)
5054
#: The ID of an associated router.
5155
router_id = resource.prop('router_id')
5256
#: The floating IP status. Value is ``ACTIVE`` or ``DOWN``.
5357
status = resource.prop('status')
58+
#: Timestamp when the floating IP was last updated.
59+
updated_at = resource.prop('updated_at')
5460

5561
@classmethod
5662
def find_available(cls, session):

openstack/network/v2/network.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class Network(resource.Resource):
7676
#: An isolated segment ID on the physical network. The provider
7777
#: network type defines the segmentation model.
7878
provider_segmentation_id = resource.prop('provider:segmentation_id')
79+
#: Revision number of the network. *Type: int*
80+
revision_number = resource.prop('revision_number', type=int)
7981
segments = resource.prop('segments')
8082
#: The network status.
8183
status = resource.prop('status')

openstack/network/v2/port.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ class Port(resource.Resource):
9191
project_id = resource.prop('tenant_id')
9292
#: The ID of the QoS policy attached to the port.
9393
qos_policy_id = resource.prop('qos_policy_id')
94+
#: Revision number of the port. *Type: int*
95+
revision_number = resource.prop('revision_number', type=int)
9496
#: The IDs of any attached security groups.
9597
#: *Type: list of strs of the security group IDs*
9698
security_group_ids = resource.prop('security_groups', type=list)

openstack/network/v2/router.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Router(resource.Resource):
3535
#: Availability zones for the router.
3636
#: *Type: list of availability zone names*
3737
availability_zones = resource.prop('availability_zones')
38+
#: Timestamp when the router was created.
39+
created_at = resource.prop('created_at')
3840
#: The router description.
3941
description = resource.prop('description')
4042
#: The ``network_id``, for the external gateway. *Type: dict*
@@ -52,10 +54,14 @@ class Router(resource.Resource):
5254
name = resource.prop('name')
5355
#: The ID of the project this router is associated with.
5456
project_id = resource.prop('tenant_id')
57+
#: Revision number of the router. *Type: int*
58+
revision_number = resource.prop('revision_number', type=int)
5559
#: The extra routes configuration for the router.
5660
routes = resource.prop('routes', type=list)
5761
#: The router status.
5862
status = resource.prop('status')
63+
#: Timestamp when the router was last updated.
64+
updated_at = resource.prop('updated_at')
5965

6066
def add_interface(self, session, **body):
6167
"""Add an internal interface to a logical router.

openstack/network/v2/security_group.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,22 @@ class SecurityGroup(resource.Resource):
2929
allow_list = True
3030

3131
# Properties
32+
#: Timestamp when the security group was created.
33+
created_at = resource.prop('created_at')
3234
#: The security group description.
3335
description = resource.prop('description')
3436
#: The security group name.
3537
name = resource.prop('name')
3638
#: The ID of the project this security group is associated with.
3739
project_id = resource.prop('tenant_id')
40+
#: Revision number of the security group. *Type: int*
41+
revision_number = resource.prop('revision_number', type=int)
3842
#: A list of
3943
#: :class:`~openstack.network.v2.security_group_rule.SecurityGroupRule`
4044
#: objects. *Type: list*
4145
security_group_rules = resource.prop('security_group_rules')
46+
#: Timestamp when the security group was last updated.
47+
updated_at = resource.prop('updated_at')
4248

4349
def __init__(self, attrs=None, loaded=False):
4450
super(SecurityGroup, self).__init__(attrs=attrs, loaded=loaded)

openstack/network/v2/security_group_rule.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class SecurityGroupRule(resource.Resource):
2828
allow_list = True
2929

3030
# Properties
31+
#: Timestamp when the security group rule was created.
32+
created_at = resource.prop('created_at')
3133
#: ``ingress`` or ``egress``: The direction in which the security group
3234
#: rule is applied. For a compute instance, an ingress security group
3335
#: rule is applied to incoming ingress traffic for that instance.
@@ -62,5 +64,9 @@ class SecurityGroupRule(resource.Resource):
6264
#: in the request body. This attribute matches the specified IP prefix
6365
#: as the source IP address of the IP packet.
6466
remote_ip_prefix = resource.prop('remote_ip_prefix')
67+
#: Revision number of the security group rule. *Type: int*
68+
revision_number = resource.prop('revision_number', type=int)
6569
#: The security group ID to associate with this security group rule.
6670
security_group_id = resource.prop('security_group_id')
71+
#: Timestamp when the security group rule was last updated.
72+
updated_at = resource.prop('updated_at')

openstack/network/v2/subnet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class Subnet(resource.Resource):
5858
network_id = resource.prop('network_id')
5959
#: The ID of the project this subnet is associated with.
6060
project_id = resource.prop('tenant_id')
61+
#: Revision number of the subnet. *Type: int*
62+
revision_number = resource.prop('revision_number', type=int)
6163
#: The ID of the segment this subnet is associated with.
6264
segment_id = resource.prop('segment_id')
6365
#: Service types for this subnet

openstack/network/v2/subnet_pool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,7 @@ class SubnetPool(resource.Resource):
6666
#: The adjacent prefixes are merged and treated as a single prefix.
6767
#: *Type: list*
6868
prefixes = resource.prop('prefixes', type=list)
69+
#: Revision number of the subnet pool. *Type: int*
70+
revision_number = resource.prop('revision_number', type=int)
6971
#: Timestamp when the subnet pool was last updated.
7072
updated_at = resource.prop('updated_at')

openstack/tests/unit/network/v2/test_floating_ip.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
'router_id': '7',
2727
'description': '8',
2828
'status': 'ACTIVE',
29+
'created_at': '2016-10-04T12:14:57.233772',
30+
'updated_at': '2016-10-12T12:15:34.233222',
31+
'revision_number': 12,
2932
}
3033

3134

@@ -56,6 +59,9 @@ def test_make_it(self):
5659
self.assertEqual(EXAMPLE['router_id'], sot.router_id)
5760
self.assertEqual(EXAMPLE['description'], sot.description)
5861
self.assertEqual(EXAMPLE['status'], sot.status)
62+
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
63+
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
64+
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
5965

6066
def test_find_available(self):
6167
mock_session = mock.Mock()

openstack/tests/unit/network/v2/test_network.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
'created_at': '2016-03-09T12:14:57.233772',
3939
'updated_at': '2016-07-09T12:14:57.233772',
4040
'is_default': False,
41+
'revision_number': 23,
4142
}
4243

4344

@@ -86,3 +87,4 @@ def test_make_it(self):
8687
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
8788
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
8889
self.assertFalse(sot.is_default)
90+
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)

0 commit comments

Comments
 (0)