Browse Source

Allow port ID for policy target

Change-Id: I1d8354d1b8ad3a08ec29c22d2c2df41540be82f8
Closes-bug: #1419947
Susaant Kondapaneni 4 years ago
parent
commit
58ae2c7976
1 changed files with 12 additions and 12 deletions
  1. 12
    12
      gbpautomation/heat/engine/resources/neutron/grouppolicy.py

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

@@ -24,13 +24,15 @@ from heat.engine import properties
24 24
 class PolicyTarget(gbpresource.GBPResource):
25 25
 
26 26
     PROPERTIES = (
27
-        TENANT_ID, NAME, DESCRIPTION, POLICY_TARGET_GROUP_ID
27
+        TENANT_ID, NAME, DESCRIPTION, POLICY_TARGET_GROUP_ID,
28
+        PORT_ID
28 29
     ) = (
29
-        'tenant_id', 'name', 'description', 'policy_target_group_id'
30
+        'tenant_id', 'name', 'description', 'policy_target_group_id',
31
+        'port_id'
30 32
     )
31 33
 
32 34
     ATTRIBUTES = (
33
-        PORT_ID
35
+        PORT_ID_ATTR
34 36
     ) = (
35 37
         'port_id'
36 38
     )
@@ -55,12 +57,17 @@ class PolicyTarget(gbpresource.GBPResource):
55 57
             _('Policy target group id of the policy target.'),
56 58
             required=True,
57 59
             update_allowed=True
60
+        ),
61
+        PORT_ID: properties.Schema(
62
+            properties.Schema.STRING,
63
+            _('Neutron port id of the policy target.'),
64
+            update_allowed=False
58 65
         )
59 66
     }
60 67
 
61 68
     attributes_schema = {
62
-        PORT_ID: attributes.Schema(
63
-            _("Neutron port id of this policy target")
69
+        PORT_ID_ATTR: attributes.Schema(
70
+            _('Neutron port id of this policy target.')
64 71
         )
65 72
     }
66 73
 
@@ -82,13 +89,6 @@ class PolicyTarget(gbpresource.GBPResource):
82 89
 
83 90
         self.resource_id_set(pt['id'])
84 91
 
85
-    def _resolve_attribute(self, name):
86
-        client = self.grouppolicy()
87
-        pt_id = self.resource_id
88
-        if name == 'port_id':
89
-            return client.show_policy_target(pt_id)['policy_target']['port_id']
90
-        return super(PolicyTarget, self)._resolve_attribute(name)
91
-
92 92
     def handle_delete(self):
93 93
 
94 94
         client = self.grouppolicy()

Loading…
Cancel
Save