Merge "Add Test to Create Port with no security groups"
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 9cd5e2e..d919f2e 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -220,6 +220,22 @@
         self.assertEqual(free_mac_address,
                          show_port['mac_address'])
 
+    @test.attr(type='smoke')
+    def test_create_port_with_no_securitygroups(self):
+        port = self.create_port(self.create_network(), security_groups=[])
+        self.assertIsNotNone(port['security_groups'])
+        self.assertEmpty(port['security_groups'])
+
+    @test.attr(type='smoke')
+    def test_update_port_with_no_securitygroups(self):
+        port = self.create_port(self.create_network())
+        # Verify that port is created with default security group
+        self.assertIsNotNone(port['security_groups'])
+        self.assertNotEmpty(port['security_groups'])
+        updated_port = self.update_port(port, security_groups=[])
+        self.assertIsNotNone(updated_port['security_groups'])
+        self.assertEmpty(updated_port['security_groups'])
+
 
 class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
     _interface = 'json'