Browse Source

Merge "Create default security group in TF with different name"

changes/42/604842/2
Zuul 7 months ago
parent
commit
76ce855962

+ 4
- 0
networking_opencontrail/ml2/mech_driver.py View File

@@ -150,6 +150,10 @@ class OpenContrailMechDriver(api.MechanismDriver):
150 150
 
151 151
     def create_security_group(self, context, sg):
152 152
         """Create a Security Group in OpenContrail."""
153
+        # vnc_openstack does not allow to create default security group
154
+        if sg.get('name') == 'default':
155
+            sg['name'] = 'default-openstack'
156
+            sg['description'] = 'default-openstack security group'
153 157
         sec_g = {'security_group': sg}
154 158
         try:
155 159
             self.drv.create_security_group(context, sec_g)

+ 1
- 1
networking_opencontrail/tests/unit/ml2/test_oc_mech_driver.py View File

@@ -225,7 +225,7 @@ class OpenContrailTestCases(testlib_api.SqlTestCase):
225 225
 
226 226
     def test_create_security_group(self):
227 227
         ctx = fake_plugin_context('ten-1')
228
-        sg = {'id': 'sg-1'}
228
+        sg = {'id': 'sg-1', 'name': 'test-security-group'}
229 229
         self.drv.create_security_group(ctx, sg)
230 230
 
231 231
         expected_calls = [

Loading…
Cancel
Save