]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Moved test_database.py to plugins/cisco/tests/unit/
authorrohitagarwalla <roagarwa@cisco.com>
Mon, 15 Aug 2011 22:04:53 +0000 (15:04 -0700)
committerrohitagarwalla <roagarwa@cisco.com>
Mon, 15 Aug 2011 22:04:53 +0000 (15:04 -0700)
Edited test_database.py to be able to run like other tests
pylint for cisco/db folder - 8.85/10
pylint for cisco/tests/unit/test_database.py - 8.42/10
pep8 done

quantum/plugins/cisco/tests/unit/test_database.py [moved from quantum/plugins/cisco/db/test_database.py with 86% similarity]

similarity index 86%
rename from quantum/plugins/cisco/db/test_database.py
rename to quantum/plugins/cisco/tests/unit/test_database.py
index 12668b605d68aa01e8d82d83a69227df469555a5..63b900d8dce98b1823c007ca5628cc2650e07f77 100644 (file)
 #    under the License.
 # @author: Rohit Agarwalla, Cisco Systems, Inc.
 
+"""
+test_database.py is an independent test suite
+that tests the database api method calls
+"""
 import logging as LOG
 import unittest
 
-from optparse import OptionParser
 from quantum.plugins.cisco.common import cisco_constants as const
 
 import quantum.plugins.cisco.db.api as db
@@ -42,8 +45,8 @@ class L2networkDB(object):
                 vlan_dict["vlan-name"] = vlan_bind.vlan_name
                 vlan_dict["net-id"] = str(vlan_bind.network_id)
                 vlans.append(vlan_dict)
-        except Exception, e:
-            LOG.error("Failed to get all vlan bindings: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get all vlan bindings: %s" % str(exc))
         return vlans
 
     def get_vlan_binding(self, network_id):
@@ -58,8 +61,8 @@ class L2networkDB(object):
                 vlan_dict["vlan-name"] = vlan_bind.vlan_name
                 vlan_dict["net-id"] = str(vlan_bind.network_id)
                 vlan.append(vlan_dict)
-        except Exception, e:
-            LOG.error("Failed to get vlan binding: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get vlan binding: %s" % str(exc))
         return vlan
 
     def create_vlan_binding(self, vlan_id, vlan_name, network_id):
@@ -72,8 +75,8 @@ class L2networkDB(object):
             vlan_dict["vlan-name"] = res.vlan_name
             vlan_dict["net-id"] = str(res.network_id)
             return vlan_dict
-        except Exception, e:
-            LOG.error("Failed to create vlan binding: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to create vlan binding: %s" % str(exc))
 
     def delete_vlan_binding(self, network_id):
         """Delete a vlan binding"""
@@ -83,8 +86,8 @@ class L2networkDB(object):
             vlan_dict = {}
             vlan_dict["vlan-id"] = str(res.vlan_id)
             return vlan_dict
-        except Exception, e:
-            raise Exception("Failed to delete vlan binding: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to delete vlan binding: %s" % str(exc))
 
     def update_vlan_binding(self, network_id, vlan_id, vlan_name):
         """Update a vlan binding"""
@@ -97,8 +100,8 @@ class L2networkDB(object):
             vlan_dict["vlan-name"] = res.vlan_name
             vlan_dict["net-id"] = str(res.network_id)
             return vlan_dict
-        except Exception, e:
-            raise Exception("Failed to update vlan binding: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to update vlan binding: %s" % str(exc))
 
     def get_all_portprofiles(self):
         """Get all portprofiles"""
@@ -112,13 +115,13 @@ class L2networkDB(object):
                 pp_dict["vlan-id"] = str(portprof.vlan_id)
                 pp_dict["qos"] = portprof.qos
                 pps.append(pp_dict)
-        except Exception, e:
-            LOG.error("Failed to get all port profiles: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get all port profiles: %s" % str(exc))
         return pps
 
     def get_portprofile(self, tenant_id, pp_id):
         """Get a portprofile"""
-        pp = []
+        pp_list = []
         try:
             for portprof in l2network_db.get_portprofile(tenant_id, pp_id):
                 LOG.debug("Getting port profile : %s" % portprof.uuid)
@@ -127,9 +130,9 @@ class L2networkDB(object):
                 pp_dict["portprofile-name"] = portprof.name
                 pp_dict["vlan-id"] = str(portprof.vlan_id)
                 pp_dict["qos"] = portprof.qos
-                pp.append(pp_dict)
-        except Exception, e:
-            LOG.error("Failed to get port profile: %s" % str(e))
+                pp_list.append(pp_dict)
+        except Exception, exc:
+            LOG.error("Failed to get port profile: %s" % str(exc))
         return pp
 
     def create_portprofile(self, tenant_id, name, vlan_id, qos):
@@ -143,8 +146,8 @@ class L2networkDB(object):
             pp_dict["vlan-id"] = str(res.vlan_id)
             pp_dict["qos"] = res.qos
             return pp_dict
-        except Exception, e:
-            LOG.error("Failed to create port profile: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to create port profile: %s" % str(exc))
 
     def delete_portprofile(self, tenant_id, pp_id):
         """Delete a portprofile"""
@@ -154,8 +157,8 @@ class L2networkDB(object):
             pp_dict = {}
             pp_dict["pp-id"] = str(res.uuid)
             return pp_dict
-        except Exception, e:
-            raise Exception("Failed to delete port profile: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to delete port profile: %s" % str(exc))
 
     def update_portprofile(self, tenant_id, pp_id, name, vlan_id, qos):
         """Update a portprofile"""
@@ -169,8 +172,8 @@ class L2networkDB(object):
             pp_dict["vlan-id"] = str(res.vlan_id)
             pp_dict["qos"] = res.qos
             return pp_dict
-        except Exception, e:
-            raise Exception("Failed to update port profile: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to update port profile: %s" % str(exc))
 
     def get_all_pp_bindings(self):
         """Get all portprofile bindings"""
@@ -185,8 +188,8 @@ class L2networkDB(object):
                 ppbinding_dict["tenant-id"] = pp_bind.tenant_id
                 ppbinding_dict["default"] = pp_bind.default
                 pp_bindings.append(ppbinding_dict)
-        except Exception, e:
-            LOG.error("Failed to get all port profiles: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get all port profiles: %s" % str(exc))
         return pp_bindings
 
     def get_pp_binding(self, tenant_id, pp_id):
@@ -202,8 +205,8 @@ class L2networkDB(object):
                 ppbinding_dict["tenant-id"] = pp_bind.tenant_id
                 ppbinding_dict["default"] = pp_bind.default
                 pp_binding.append(ppbinding_dict)
-        except Exception, e:
-            LOG.error("Failed to get port profile binding: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get port profile binding: %s" % str(exc))
         return pp_binding
 
     def create_pp_binding(self, tenant_id, port_id, pp_id, default):
@@ -218,8 +221,8 @@ class L2networkDB(object):
             ppbinding_dict["tenant-id"] = res.tenant_id
             ppbinding_dict["default"] = res.default
             return ppbinding_dict
-        except Exception, e:
-            LOG.error("Failed to create port profile binding: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to create port profile binding: %s" % str(exc))
 
     def delete_pp_binding(self, tenant_id, port_id, pp_id):
         """Delete a portprofile binding"""
@@ -229,8 +232,8 @@ class L2networkDB(object):
             ppbinding_dict = {}
             ppbinding_dict["portprofile-id"] = str(res.portprofile_id)
             return ppbinding_dict
-        except Exception, e:
-            raise Exception("Failed to delete port profile: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to delete port profile: %s" % str(exc))
 
     def update_pp_binding(self, tenant_id, pp_id, newtenant_id, \
                           port_id, default):
@@ -245,8 +248,9 @@ class L2networkDB(object):
             ppbinding_dict["tenant-id"] = res.tenant_id
             ppbinding_dict["default"] = res.default
             return ppbinding_dict
-        except Exception, e:
-            raise Exception("Failed to update portprofile binding:%s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to update portprofile binding:%s" \
+                            % str(exc))
 
 
 class QuantumDB(object):
@@ -262,8 +266,8 @@ class QuantumDB(object):
                 net_dict["net-id"] = str(net.uuid)
                 net_dict["net-name"] = net.name
                 nets.append(net_dict)
-        except Exception, e:
-            LOG.error("Failed to get all networks: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get all networks: %s" % str(exc))
         return nets
 
     def get_network(self, network_id):
@@ -277,8 +281,8 @@ class QuantumDB(object):
                 net_dict["net-id"] = str(net.uuid)
                 net_dict["net-name"] = net.name
                 net.append(net_dict)
-        except Exception, e:
-            LOG.error("Failed to get network: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get network: %s" % str(exc))
         return net
 
     def create_network(self, tenant_id, net_name):
@@ -291,8 +295,8 @@ class QuantumDB(object):
             net_dict["net-id"] = str(res.uuid)
             net_dict["net-name"] = res.name
             return net_dict
-        except Exception, e:
-            LOG.error("Failed to create network: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to create network: %s" % str(exc))
 
     def delete_network(self, net_id):
         """Delete a network"""
@@ -302,8 +306,8 @@ class QuantumDB(object):
             net_dict = {}
             net_dict["net-id"] = str(net.uuid)
             return net_dict
-        except Exception, e:
-            raise Exception("Failed to delete port: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to delete port: %s" % str(exc))
 
     def rename_network(self, tenant_id, net_id, new_name):
         """Rename a network"""
@@ -314,8 +318,8 @@ class QuantumDB(object):
             net_dict["net-id"] = str(net.uuid)
             net_dict["net-name"] = net.name
             return net_dict
-        except Exception, e:
-            raise Exception("Failed to rename network: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to rename network: %s" % str(exc))
 
     def get_all_ports(self, net_id):
         """Get all ports"""
@@ -331,8 +335,8 @@ class QuantumDB(object):
                 port_dict["net"] = port.network
                 ports.append(port_dict)
             return ports
-        except Exception, e:
-            LOG.error("Failed to get all ports: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get all ports: %s" % str(exc))
 
     def get_port(self, net_id, port_id):
         """Get a port"""
@@ -347,8 +351,8 @@ class QuantumDB(object):
             port_dict["state"] = port.state
             port_list.append(port_dict)
             return port_list
-        except Exception, e:
-            LOG.error("Failed to get port: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to get port: %s" % str(exc))
 
     def create_port(self, net_id):
         """Add a port"""
@@ -361,8 +365,8 @@ class QuantumDB(object):
             port_dict["int-id"] = port.interface_id
             port_dict["state"] = port.state
             return port_dict
-        except Exception, e:
-            LOG.error("Failed to create port: %s" % str(e))
+        except Exception, exc:
+            LOG.error("Failed to create port: %s" % str(exc))
 
     def delete_port(self, net_id, port_id):
         """Delete a port"""
@@ -372,8 +376,8 @@ class QuantumDB(object):
             port_dict = {}
             port_dict["port-id"] = str(port.uuid)
             return port_dict
-        except Exception, e:
-            raise Exception("Failed to delete port: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to delete port: %s" % str(exc))
 
     def update_port(self, net_id, port_id, port_state):
         """Update a port"""
@@ -386,8 +390,8 @@ class QuantumDB(object):
             port_dict["int-id"] = port.interface_id
             port_dict["state"] = port.state
             return port_dict
-        except Exception, e:
-            raise Exception("Failed to update port state: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to update port state: %s" % str(exc))
 
     def plug_interface(self, net_id, port_id, int_id):
         """Plug interface to a port"""
@@ -400,8 +404,8 @@ class QuantumDB(object):
             port_dict["int-id"] = port.interface_id
             port_dict["state"] = port.state
             return port_dict
-        except Exception, e:
-            raise Exception("Failed to plug interface: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to plug interface: %s" % str(exc))
 
     def unplug_interface(self, net_id, port_id):
         """Unplug interface to a port"""
@@ -414,27 +418,32 @@ class QuantumDB(object):
             port_dict["int-id"] = port.interface_id
             port_dict["state"] = port.state
             return port_dict
-        except Exception, e:
-            raise Exception("Failed to unplug interface: %s" % str(e))
+        except Exception, exc:
+            raise Exception("Failed to unplug interface: %s" % str(exc))
 
 
 class L2networkDBTest(unittest.TestCase):
     """Class conisting of L2network DB unit tests"""
     def setUp(self):
         """Setup for tests"""
+        l2network_db.initialize()
         self.dbtest = L2networkDB()
         self.quantum = QuantumDB()
         LOG.debug("Setup")
 
-    def testACreateVlanBinding(self):
+    def tearDown(self):
+        """Tear Down"""
+        db.clear_db()
+
+    def testa_create_vlanbinding(self):
         """test add vlan binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
         self.assertTrue(vlan1["vlan-id"] == "10")
-        self.tearDownVlanBinding()
-        self.tearDownNetwork()
+        self.teardown_vlanbinding()
+        self.teardown_network()
 
-    def testBGetAllVlanBindings(self):
+    def testb_getall_vlanbindings(self):
         """test get all vlan binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         net2 = self.quantum.create_network("t1", "netid2")
@@ -448,10 +457,10 @@ class L2networkDBTest(unittest.TestCase):
             if "vlan" in vlan["vlan-name"]:
                 count += 1
         self.assertTrue(count == 2)
-        self.tearDownVlanBinding()
-        self.tearDownNetwork()
+        self.teardown_vlanbinding()
+        self.teardown_network()
 
-    def testCDeleteVlanBinding(self):
+    def testc_delete_vlanbinding(self):
         """test delete vlan binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
@@ -463,10 +472,10 @@ class L2networkDBTest(unittest.TestCase):
             if "vlan " in vlan["vlan-name"]:
                 count += 1
         self.assertTrue(count == 0)
-        self.tearDownVlanBinding()
-        self.tearDownNetwork()
+        self.teardown_vlanbinding()
+        self.teardown_network()
 
-    def testDUpdateVlanBinding(self):
+    def testd_update_vlanbinding(self):
         """test update vlan binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
@@ -478,17 +487,17 @@ class L2networkDBTest(unittest.TestCase):
             if "new" in vlan["vlan-name"]:
                 count += 1
         self.assertTrue(count == 1)
-        self.tearDownVlanBinding()
-        self.tearDownNetwork()
+        self.teardown_vlanbinding()
+        self.teardown_network()
 
-    def testICreatePortProfile(self):
+    def teste_create_portprofile(self):
         """test add port profile"""
         pp1 = self.dbtest.create_portprofile("t1", "portprofile1", 10, "qos1")
         self.assertTrue(pp1["portprofile-name"] == "portprofile1")
-        self.tearDownPortProfile()
-        self.tearDownNetwork()
+        self.teardown_portprofile()
+        self.teardown_network()
 
-    def testJGetAllPortProfile(self):
+    def testf_getall_portprofile(self):
         """test get all portprofiles"""
         pp1 = self.dbtest.create_portprofile("t1", "portprofile1", 10, "qos1")
         self.assertTrue(pp1["portprofile-name"] == "portprofile1")
@@ -500,9 +509,9 @@ class L2networkDBTest(unittest.TestCase):
             if "portprofile" in pprofile["portprofile-name"]:
                 count += 1
         self.assertTrue(count == 2)
-        self.tearDownPortProfile()
+        self.teardown_portprofile()
 
-    def testKDeletePortProfile(self):
+    def testg_delete_portprofile(self):
         """test delete portprofile"""
         pp1 = self.dbtest.create_portprofile("t1", "portprofile1", 10, "qos1")
         self.assertTrue(pp1["portprofile-name"] == "portprofile1")
@@ -513,9 +522,9 @@ class L2networkDBTest(unittest.TestCase):
             if "portprofile " in pprofile["portprofile-name"]:
                 count += 1
         self.assertTrue(count == 0)
-        self.tearDownPortProfile()
+        self.teardown_portprofile()
 
-    def testLUpdatePortProfile(self):
+    def testh_update_portprofile(self):
         """test update portprofile"""
         pp1 = self.dbtest.create_portprofile("t1", "portprofile1", 10, "qos1")
         self.assertTrue(pp1["portprofile-name"] == "portprofile1")
@@ -527,9 +536,9 @@ class L2networkDBTest(unittest.TestCase):
             if "new" in pprofile["portprofile-name"]:
                 count += 1
         self.assertTrue(count == 1)
-        self.tearDownPortProfile()
+        self.teardown_portprofile()
 
-    def testMCreatePortProfileBinding(self):
+    def testi_create_portprofilebinding(self):
         """test create portprofile binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         port1 = self.quantum.create_port(net1["net-id"])
@@ -537,12 +546,12 @@ class L2networkDBTest(unittest.TestCase):
         pp_binding1 = self.dbtest.create_pp_binding("t1", port1["port-id"], \
                                               pp1["portprofile-id"], "0")
         self.assertTrue(pp_binding1["tenant-id"] == "t1")
-        self.tearDownPortProfileBinding()
-        self.tearDownPort()
-        self.tearDownNetwork()
-        self.tearDownPortProfile()
+        self.teardown_portprofilebinding()
+        self.teardown_port()
+        self.teardown_network()
+        self.teardown_portprofile()
 
-    def testNGetAllPortProfileBinding(self):
+    def testj_getall_portprofilebinding(self):
         """test get all portprofile binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         port1 = self.quantum.create_port(net1["net-id"])
@@ -561,12 +570,12 @@ class L2networkDBTest(unittest.TestCase):
             if "t1" in pp_bind["tenant-id"]:
                 count += 1
         self.assertTrue(count == 2)
-        self.tearDownPortProfileBinding()
-        self.tearDownPort()
-        self.tearDownNetwork()
-        self.tearDownPortProfile()
+        self.teardown_portprofilebinding()
+        self.teardown_port()
+        self.teardown_network()
+        self.teardown_portprofile()
 
-    def testODeletePortProfileBinding(self):
+    def testk_delete_portprofilebinding(self):
         """test delete portprofile binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         port1 = self.quantum.create_port(net1["net-id"])
@@ -582,12 +591,12 @@ class L2networkDBTest(unittest.TestCase):
             if "t1 " in pp_bind["tenant-id"]:
                 count += 1
         self.assertTrue(count == 0)
-        self.tearDownPortProfileBinding()
-        self.tearDownPort()
-        self.tearDownNetwork()
-        self.tearDownPortProfile()
+        self.teardown_portprofilebinding()
+        self.teardown_port()
+        self.teardown_network()
+        self.teardown_portprofile()
 
-    def testPUpdatePortProfileBinding(self):
+    def testl_update_portprofilebinding(self):
         """test update portprofile binding"""
         net1 = self.quantum.create_network("t1", "netid1")
         port1 = self.quantum.create_port(net1["net-id"])
@@ -603,12 +612,12 @@ class L2networkDBTest(unittest.TestCase):
             if "new" in pp_bind["tenant-id"]:
                 count += 1
         self.assertTrue(count == 1)
-        self.tearDownPortProfileBinding()
-        self.tearDownPort()
-        self.tearDownNetwork()
-        self.tearDownPortProfile()
+        self.teardown_portprofilebinding()
+        self.teardown_port()
+        self.teardown_network()
+        self.teardown_portprofile()
 
-    def testQtest_vlanids(self):
+    def testm_test_vlanids(self):
         """test vlanid methods"""
         l2network_db.create_vlanids()
         vlanids = l2network_db.get_all_vlanids()
@@ -618,9 +627,9 @@ class L2networkDBTest(unittest.TestCase):
         self.assertTrue(used == True)
         used = l2network_db.release_vlanid(vlanid)
         self.assertTrue(used == False)
-        self.tearDownVlanID()
+        self.teardown_vlanid()
 
-    def tearDownNetwork(self):
+    def teardown_network(self):
         """tearDown Network table"""
         LOG.debug("Tearing Down Network")
         nets = self.quantum.get_all_networks("t1")
@@ -628,7 +637,7 @@ class L2networkDBTest(unittest.TestCase):
             netid = net["net-id"]
             self.quantum.delete_network(netid)
 
-    def tearDownPort(self):
+    def teardown_port(self):
         """tearDown Port table"""
         LOG.debug("Tearing Down Port")
         nets = self.quantum.get_all_networks("t1")
@@ -639,7 +648,7 @@ class L2networkDBTest(unittest.TestCase):
                 portid = port["port-id"]
                 self.quantum.delete_port(netid, portid)
 
-    def tearDownVlanBinding(self):
+    def teardown_vlanbinding(self):
         """tearDown VlanBinding table"""
         LOG.debug("Tearing Down Vlan Binding")
         vlans = self.dbtest.get_all_vlan_bindings()
@@ -647,7 +656,7 @@ class L2networkDBTest(unittest.TestCase):
             netid = vlan["net-id"]
             self.dbtest.delete_vlan_binding(netid)
 
-    def tearDownPortProfile(self):
+    def teardown_portprofile(self):
         """tearDown PortProfile table"""
         LOG.debug("Tearing Down Port Profile")
         pps = self.dbtest.get_all_portprofiles()
@@ -655,7 +664,7 @@ class L2networkDBTest(unittest.TestCase):
             ppid = pprofile["portprofile-id"]
             self.dbtest.delete_portprofile("t1", ppid)
 
-    def tearDownPortProfileBinding(self):
+    def teardown_portprofilebinding(self):
         """tearDown PortProfileBinding table"""
         LOG.debug("Tearing Down Port Profile Binding")
         pp_bindings = self.dbtest.get_all_pp_bindings()
@@ -664,7 +673,7 @@ class L2networkDBTest(unittest.TestCase):
             portid = pp_binding["port-id"]
             self.dbtest.delete_pp_binding("t1", portid, ppid)
 
-    def tearDownVlanID(self):
+    def teardown_vlanid(self):
         """tearDown VlanID table"""
         LOG.debug("Tearing Down Vlan IDs")
         vlanids = l2network_db.get_all_vlanids()
@@ -677,17 +686,22 @@ class QuantumDBTest(unittest.TestCase):
     """Class conisting of Quantum DB unit tests"""
     def setUp(self):
         """Setup for tests"""
+        l2network_db.initialize()
         self.dbtest = QuantumDB()
         self.tenant_id = "t1"
         LOG.debug("Setup")
 
-    def testACreateNetwork(self):
+    def tearDown(self):
+        """Tear Down"""
+        db.clear_db()
+
+    def testa_create_network(self):
         """test to create network"""
         net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
         self.assertTrue(net1["net-name"] == "plugin_test1")
-        self.tearDownNetworkPort()
+        self.teardown_network_port()
 
-    def testBGetNetworks(self):
+    def testb_get_networks(self):
         """test to get all networks"""
         net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
         self.assertTrue(net1["net-name"] == "plugin_test1")
@@ -699,9 +713,9 @@ class QuantumDBTest(unittest.TestCase):
             if "plugin_test" in net["net-name"]:
                 count += 1
         self.assertTrue(count == 2)
-        self.tearDownNetworkPort()
+        self.teardown_network_port()
 
-    def testCDeleteNetwork(self):
+    def testc_delete_network(self):
         """test to delete network"""
         net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
         self.assertTrue(net1["net-name"] == "plugin_test1")
@@ -712,18 +726,18 @@ class QuantumDBTest(unittest.TestCase):
             if "plugin_test1" in net["net-name"]:
                 count += 1
         self.assertTrue(count == 0)
-        self.tearDownNetworkPort()
+        self.teardown_network_port()
 
-    def testDRenameNetwork(self):
+    def testd_rename_network(self):
         """test to rename network"""
         net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
         self.assertTrue(net1["net-name"] == "plugin_test1")
         net = self.dbtest.rename_network(self.tenant_id, net1["net-id"],
           "plugin_test1_renamed")
         self.assertTrue(net["net-name"] == "plugin_test1_renamed")
-        self.tearDownNetworkPort()
+        self.teardown_network_port()
 
-    def testECreatePort(self):
+    def teste_create_port(self):
         """test to create port"""
         net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
         port = self.dbtest.create_port(net1["net-id"])
@@ -733,9 +747,9 @@ class QuantumDBTest(unittest.TestCase):
         for por in ports:
             count += 1
         self.assertTrue(count == 1)
-        self.tearDownNetworkPort()
+        self.teardown_network_port()
 
-    def testFDeletePort(self):
+    def testf_delete_port(self):
         """test to delete port"""
         net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
         port = self.dbtest.create_port(net1["net-id"])
@@ -752,9 +766,9 @@ class QuantumDBTest(unittest.TestCase):
         for por in ports:
             count += 1
         self.assertTrue(count == 0)
-        self.tearDownNetworkPort()
+        self.teardown_network_port()
 
-    def testGPlugUnPlugInterface(self):
+    def testg_plug_unplug_interface(self):
         """test to plug/unplug interface"""
         net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
         port1 = self.dbtest.create_port(net1["net-id"])
@@ -764,9 +778,9 @@ class QuantumDBTest(unittest.TestCase):
         self.dbtest.unplug_interface(net1["net-id"], port1["port-id"])
         port = self.dbtest.get_port(net1["net-id"], port1["port-id"])
         self.assertTrue(port[0]["int-id"] == None)
-        self.tearDownNetworkPort()
+        self.teardown_network_port()
 
-    def testIJoinedTest(self):
+    def testh_joined_test(self):
         """test to get network and port"""
         net1 = self.dbtest.create_network("t1", "net1")
         port1 = self.dbtest.create_port(net1["net-id"])
@@ -777,9 +791,9 @@ class QuantumDBTest(unittest.TestCase):
         for port in ports:
             net = port["net"]
             LOG.debug("Port id %s Net id %s" % (port["port-id"], net.uuid))
-        self.tearDownJoinedTest()
+        self.teardown_joined_test()
 
-    def tearDownNetworkPort(self):
+    def teardown_network_port(self):
         """tearDown for Network and Port table"""
         networks = self.dbtest.get_all_networks(self.tenant_id)
         for net in networks:
@@ -791,7 +805,7 @@ class QuantumDBTest(unittest.TestCase):
                     self.dbtest.delete_port(netid, por["port-id"])
                 self.dbtest.delete_network(netid)
 
-    def tearDownJoinedTest(self):
+    def teardown_joined_test(self):
         """tearDown for joined Network and Port test"""
         LOG.debug("Tearing Down Network and Ports")
         nets = self.dbtest.get_all_networks("t1")
@@ -802,7 +816,7 @@ class QuantumDBTest(unittest.TestCase):
                 self.dbtest.delete_port(port["net-id"], port["port-id"])
             self.dbtest.delete_network(netid)
 
-
+"""
 if __name__ == "__main__":
     usagestr = "Usage: %prog [OPTIONS] <command> [args]"
     parser = OptionParser(usage=usagestr)
@@ -823,3 +837,4 @@ if __name__ == "__main__":
     unittest.TextTestRunner(verbosity=2).run(suite)
     suite = unittest.TestLoader().loadTestsFromTestCase(L2networkDBTest)
     unittest.TextTestRunner(verbosity=2).run(suite)
+"""