Browse Source

Adding Subnet ID to External Segment

This is required for Neutron mapping.

Change-Id: Ia7e21b494feb2140d0b1f27e556523b3f8f3a45e
Closes-bug: 1420626
Sumit Naiksatam 4 years ago
parent
commit
e4451d9479

+ 9
- 3
gbpautomation/heat/engine/resources/neutron/grouppolicy.py View File

@@ -907,11 +907,12 @@ class ExternalPolicy(gbpresource.GBPResource):
907 907
 class ExternalSegment(gbpresource.GBPResource):
908 908
 
909 909
     PROPERTIES = (
910
-        TENANT_ID, NAME, DESCRIPTION, IP_VERSION, CIDR,
910
+        TENANT_ID, NAME, DESCRIPTION, IP_VERSION, CIDR, SUBNET_ID,
911 911
         EXTERNAL_ROUTES, PORT_ADDRESS_TRANSLATION, SHARED
912 912
     ) = (
913 913
         'tenant_id', 'name', 'description', 'ip_version', 'cidr',
914
-        'external_routes', 'port_address_translation', 'shared'
914
+        'subnet_id', 'external_routes', 'port_address_translation',
915
+        'shared'
915 916
     )
916 917
 
917 918
     properties_schema = {
@@ -939,6 +940,11 @@ class ExternalSegment(gbpresource.GBPResource):
939 940
             _('CIDR of the external segment.'),
940 941
             default=None, update_allowed=False
941 942
         ),
943
+        SUBNET_ID: properties.Schema(
944
+            properties.Schema.STRING,
945
+            _('Subnet ID of the neutron external network.'),
946
+            default=None, update_allowed=False
947
+        ),
942 948
         EXTERNAL_ROUTES: properties.Schema(
943 949
             properties.Schema.LIST,
944 950
             _('External routes of the external segment.'),
@@ -947,7 +953,7 @@ class ExternalSegment(gbpresource.GBPResource):
947 953
         PORT_ADDRESS_TRANSLATION: properties.Schema(
948 954
             properties.Schema.BOOLEAN,
949 955
             _('Port address translation required for the external segment.'),
950
-            update_allowed=True, required=True
956
+            update_allowed=True, default=False
951 957
         ),
952 958
         SHARED: properties.Schema(
953 959
             properties.Schema.BOOLEAN,

+ 3
- 0
gbpautomation/heat/tests/test_grouppolicy.py View File

@@ -263,6 +263,7 @@ external_segment_template = '''
263 263
           "description": "test ES resource",
264 264
           "ip_version": '6',
265 265
           "cidr": "192.168.0.0/24",
266
+          "subnet_id": "some-subnet-id",
266 267
           "external_routes": [{
267 268
               "destination": "0.0.0.0/0",
268 269
               "nexthop": "null"
@@ -1516,6 +1517,7 @@ class ExternalSegmentTest(HeatTestCase):
1516 1517
                 "description": "test ES resource",
1517 1518
                 "ip_version": '6',
1518 1519
                 "cidr": "192.168.0.0/24",
1520
+                "subnet_id": "some-subnet-id",
1519 1521
                 "external_routes": [{
1520 1522
                     "destination": "0.0.0.0/0",
1521 1523
                     "nexthop": "null"
@@ -1546,6 +1548,7 @@ class ExternalSegmentTest(HeatTestCase):
1546 1548
                 "description": "test ES resource",
1547 1549
                 "ip_version": '6',
1548 1550
                 "cidr": "192.168.0.0/24",
1551
+                "subnet_id": "some-subnet-id",
1549 1552
                 "external_routes": [{
1550 1553
                     "destination": "0.0.0.0/0",
1551 1554
                     "nexthop": "null"

Loading…
Cancel
Save