Example #1
0
 def test_reserve_segmentation_id_NA(self):
     LOG.debug("test_reserve_segmentation_id - START")
     db.clear_db()
     self.assertRaises(c_exc.VlanIDNotAvailable,
                       self.vlan_mgr.reserve_segmentation_id,
                       self.tenant_id, self.net_name)
     LOG.debug("test_reserve_segmentation_id - END")
    def _test_with_port_creation(self, cmd, params=None):
        """Tests commands that requires a port to exist"""
        LOG.debug("test_%s - START", cmd)
        net = self._l2network.create_network(tenant, net_name)
        port = self._l2network.create_port(tenant, net[const.NET_ID],
                                           port_state, state=port_state)

        args = [tenant, net[const.NET_ID], port[const.PORT_ID]]
        if params is not None:
            args.extend(params)

        ip_address = getattr(self._ucs_inventory, cmd)(args)
        ip_address = ip_address[const.DEVICE_IP][0]
        self.assertValidUCM(ip_address)

        # Clean up created network and port
        try:
            self._l2network.unplug_interface(
                tenant, net[const.NET_ID], port[const.PORT_ID])
        except:
            pass
        self._l2network.delete_port(tenant,
                                    net[const.NET_ID], port[const.PORT_ID])
        self._l2network.delete_network(tenant, net[const.NET_ID])
        db.clear_db()

        LOG.debug("test_%s - END", cmd)
    def _test_with_port_creation(self, cmd, params=None):
        """Tests commands that requires a port to exist"""
        LOG.debug("test_%s - START", cmd)
        net = self._l2network.create_network(tenant, net_name)
        port = self._l2network.create_port(tenant,
                                           net[const.NET_ID],
                                           port_state,
                                           state=port_state)

        args = [tenant, net[const.NET_ID], port[const.PORT_ID]]
        if params is not None:
            args.extend(params)

        ip_address = getattr(self._ucs_inventory, cmd)(args)
        ip_address = ip_address[const.DEVICE_IP][0]
        self.assertValidUCM(ip_address)

        # Clean up created network and port
        try:
            self._l2network.unplug_interface(tenant, net[const.NET_ID],
                                             port[const.PORT_ID])
        except:
            pass
        self._l2network.delete_port(tenant, net[const.NET_ID],
                                    port[const.PORT_ID])
        self._l2network.delete_network(tenant, net[const.NET_ID])
        db.clear_db()

        LOG.debug("test_%s - END", cmd)
Example #4
0
 def test_reserve_segmentation_id_NA(self):
     LOG.debug("test_reserve_segmentation_id - START")
     db.clear_db()
     self.assertRaises(c_exc.VlanIDNotAvailable,
                       self.vlan_mgr.reserve_segmentation_id,
                       self.tenant_id,
                       self.net_name)
     LOG.debug("test_reserve_segmentation_id - END")
    def tearDown(self):
        """Tear down our tests"""
        try:
            port = db.port_get(self.net_id, self.port_id)
            self._l2network_multiblade.delete_port([tenant_id, self.net_id, self.port_id])
        except exc.NetworkNotFound:
            # We won't always have a port to remove
            pass
        except exc.PortNotFound:
            # We won't always have a port to remove
            pass

        try:
            net = db.network_get(self.net_id)
            self._l2network_multiblade.delete_network([tenant_id, self.net_id])
        except exc.NetworkNotFound:
            # We won't always have a network to remove
            pass
        db.clear_db()
    def tearDown(self):
        """Tear down our tests"""
        try:
            port = db.port_get(self.net_id, self.port_id)
            self._l2network_multiblade.delete_port(
                [tenant_id, self.net_id, self.port_id])
        except exc.NetworkNotFound:
            # We won't always have a port to remove
            pass
        except exc.PortNotFound:
            # We won't always have a port to remove
            pass

        try:
            net = db.network_get(self.net_id)
            self._l2network_multiblade.delete_network([tenant_id, self.net_id])
        except exc.NetworkNotFound:
            # We won't always have a network to remove
            pass
        db.clear_db()
Example #7
0
 def tearDown(self):
     """Tear Down"""
     db.clear_db()
Example #8
0
 def tearDown(self):
     db.clear_db()
 def tearDown(self):
     """Clear the test environment"""
     # Remove database contents
     db.clear_db()
Example #10
0
 def tearDown(self):
     """Clear the test environment"""
     # Remove database contents
     db.clear_db()