コード例 #1
0
ファイル: test_vlan_mgr.py プロジェクト: LuizOz/quantum
 def test_release_segmentation_id_idDNE(self):
     LOG.debug("test_release_segmentation_idDNE - START")
     db.network_create(self.tenant_id, self.net_name)
     self.assertRaises(exc.NetworkNotFound,
                       self.vlan_mgr.release_segmentation_id,
                       self.tenant_id, self.net_id)
     LOG.debug("test_release_segmentation_idDNE - END")
コード例 #2
0
 def test_reserve_segmentation_id(self):
     LOG.debug("test_reserve_segmentation_id - START")
     db.network_create(self.tenant_id, self.net_name)
     vlan_id = self.vlan_mgr.reserve_segmentation_id(self.tenant_id,
                                                     self.net_name)
     self.assertEqual(vlan_id, int(conf.VLAN_START))
     LOG.debug("test_reserve_segmentation_id - END")
コード例 #3
0
    def test_get_all_networks(self):
        """
        Tests whether  dictionary is returned containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("UCSVICTestPlugin:test_get_all_networks() called\n")
        new_network1 = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network1[const.UUID])
        new_net_dict1 = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network1[const.NETWORKNAME],
            new_network1[const.UUID], self.vlan_name, self.vlan_id,
            device_ip=self.device_ip)
        new_network2 = db.network_create(self.tenant_id, "test_network2")
        cdb.add_vlan_binding("6", "q-000006vlan", new_network2[const.UUID])
        new_net_dict2 = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network2[const.NETWORKNAME],
            new_network2[const.UUID], "q-000006vlan", "6",
            device_ip=self.device_ip)

        net_list = self._cisco_ucs_plugin.get_all_networks(
            self.tenant_id, device_ip=self.device_ip)
        net_id_list = [new_net_dict1, new_net_dict2]

        self.assertTrue(net_list[0] in net_id_list)
        self.assertTrue(net_list[1] in net_id_list)
        self.tear_down_network(self.tenant_id, new_network1[const.UUID])
        self.tear_down_network(self.tenant_id, new_network2[const.UUID])
コード例 #4
0
    def test_get_all_networks(self):
        """
        Tests whether  dictionary is returned containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("UCSVICTestPlugin:test_get_all_networks() called\n")
        new_network1 = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network1[const.UUID])
        new_net_dict1 = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network1[const.NETWORKNAME],
            new_network1[const.UUID], self.vlan_name, self.vlan_id,
            device_ip=self.device_ip)
        new_network2 = db.network_create(self.tenant_id, "test_network2")
        cdb.add_vlan_binding("6", "q-000006vlan", new_network2[const.UUID])
        new_net_dict2 = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network2[const.NETWORKNAME],
            new_network2[const.UUID], "q-000006vlan", "6",
            device_ip=self.device_ip)

        net_list = self._cisco_ucs_plugin.get_all_networks(
            self.tenant_id, device_ip=self.device_ip)
        net_id_list = [new_net_dict1, new_net_dict2]

        self.assertTrue(net_list[0] in net_id_list)
        self.assertTrue(net_list[1] in net_id_list)
        self.tear_down_network(self.tenant_id, new_network1[const.UUID])
        self.tear_down_network(self.tenant_id, new_network2[const.UUID])
コード例 #5
0
ファイル: test_vlan_mgr.py プロジェクト: Blackspan/quantum
 def test_release_segmentation_id_idDNE(self):
     LOG.debug("test_release_segmentation_idDNE - START")
     db.network_create(self.tenant_id, self.net_name)
     self.assertRaises(exc.NetworkNotFound,
                       self.vlan_mgr.release_segmentation_id,
                       self.tenant_id,
                       self.net_id)
     LOG.debug("test_release_segmentation_idDNE - END")
コード例 #6
0
 def test_release_segmentation_id(self):
     LOG.debug("test_release_segmentation_id - START")
     db.network_create(self.tenant_id, self.net_name)
     vlan_id = self.vlan_mgr.reserve_segmentation_id(self.tenant_id,
                                                     self.net_name)
     cdb.add_vlan_binding(vlan_id, self.vlan_name, self.net_id)
     release_return = self.vlan_mgr.release_segmentation_id(self.tenant_id,
                                                            self.net_id)
     self.assertEqual(release_return, False)
     LOG.debug("test_release_segmentation_id - END")
コード例 #7
0
    def test_update_network(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_update_network - START")

        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]

        self._l2network_multiblade.create_network([tenant_id,
                                                   net_name,
                                                   self.net_id,
                                                   vlan_name(self.net_id),
                                                   vlan_id])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        net_details = db.network_update(self.net_id, tenant_id,
                                        name=new_net_name)
        networks = self._l2network_multiblade.update_network([
            tenant_id,
            self.net_id,
            {'name': new_net_name},
            ])

        for network in networks:
            self.assertEqual(network[const.NET_ID], self.net_id)
            self.assertEqual(network[const.NET_NAME], new_net_name)
        LOG.debug("test_update_network - END")
コード例 #8
0
    def test_delete_port(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_delete_port - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([tenant_id,
                                                   net_name,
                                                   self.net_id,
                                                   vlan_name(self.net_id),
                                                   vlan_id])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        self._l2network_multiblade.create_port([tenant_id,
                                                self.net_id,
                                                port_state, self.port_id])

        port = self._l2network_multiblade.delete_port([tenant_id,
                                                       self.net_id,
                                                       self.port_id])

        self.assertEqual(self.port_id, port[0][const.PORTID])

        # Recreating port so tear down doesn't cause an error
        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        self._l2network_multiblade.create_port([tenant_id,
                                                self.net_id,
                                                port_state, self.port_id])

        LOG.debug("test_delete_port - END")
コード例 #9
0
    def test_unplug_interface(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_unplug_interface - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([tenant_id,
                                                   net_name,
                                                   self.net_id,
                                                   vlan_name(self.net_id),
                                                   vlan_id])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        self._l2network_multiblade.create_port([tenant_id,
                                                self.net_id,
                                                port_state, self.port_id])

        self._l2network_multiblade.plug_interface([tenant_id, self.net_id,
                                                   self.port_id, interface_id])
        db.port_set_attachment(self.net_id, self.port_id, interface_id)
        interface = self._l2network_multiblade.unplug_interface([tenant_id,
                                                                 self.net_id,
                                                                 self.port_id])

        self.assertEqual(self.port_id, interface[0][const.PORTID])
        LOG.debug("test_unplug_interface - END")
コード例 #10
0
ファイル: test_ucs_plugin.py プロジェクト: Oneiroi/quantum
    def test_delete_port(self):
        """
        Tests Deletion of a port on a specified Virtual Network,
        if the port contains a remote interface attachment,
        the remote interface should first be un-plugged and
        then the port can be deleted.
        """
        LOG.debug("UCSVICTestPlugin:_test_delete_port() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
                self.tenant_id, new_network[const.NETWORKNAME],
                new_network[const.UUID], self.vlan_name, self.vlan_id,
                device_ip=self.device_ip)
        new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict = self._cisco_ucs_plugin.create_port(
                            self.tenant_id, self.net_id, const.PORT_UP,
                            new_port[const.UUID], device_ip=self.device_ip,
                            ucs_inventory=self._ucs_inventory,
                            least_rsvd_blade_dict=self._ucs_inventory.\
                            _get_least_reserved_blade())
        port_bind = self._cisco_ucs_plugin.delete_port(
                         self.tenant_id, new_net_dict[const.NET_ID],
                         port_dict[const.PORTID], device_ip=self.device_ip,
                         ucs_inventory=self._ucs_inventory,
                         chassis_id=self.chassis_id, blade_id=self.blade_id,
                         blade_intf_distinguished_name=self.\
                         blade_intf_distinguished_name,
                         least_rsvd_blade_dict=self._ucs_inventory.\
                         _get_least_reserved_blade())

        self.assertEqual(port_bind[const.PORTID], new_port[const.UUID])
        self.tearDownNetwork(self.tenant_id, new_net_dict[const.NET_ID])
コード例 #11
0
    def test_update_network(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_update_network - START")

        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]

        self._l2network_multiblade.create_network([
            tenant_id, net_name, self.net_id,
            vlan_name(self.net_id), vlan_id
        ])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        net_details = db.network_update(self.net_id,
                                        tenant_id,
                                        name=new_net_name)
        networks = self._l2network_multiblade.update_network([
            tenant_id,
            self.net_id,
            {
                'name': new_net_name
            },
        ])

        for network in networks:
            self.assertEqual(network[const.NET_ID], self.net_id)
            self.assertEqual(network[const.NET_NAME], new_net_name)
        LOG.debug("test_update_network - END")
コード例 #12
0
    def test_delete_port_PortNotFound(self):
        """
        Negative Test for delete port when port not found
        """
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id,
            new_network[const.NETWORKNAME],
            new_network[const.UUID],
            self.vlan_name,
            self.vlan_id,
            device_ip=self.device_ip)

        self.assertRaises(c_exc.PortVnicNotFound,
                          self._cisco_ucs_plugin.delete_port,
                          self.tenant_id, new_net_dict[const.NET_ID],
                          self.port_id, device_ip=self.device_ip,
                          ucs_inventory=self._ucs_inventory,
                          chassis_id=self.chassis_id, blade_id=self.blade_id,
                          blade_intf_distinguished_name=None,
                          least_rsvd_blade_dict=self._ucs_inventory.\
                          _get_least_reserved_blade())

        self.tear_down_network(self.tenant_id, new_net_dict[const.NET_ID])
コード例 #13
0
    def test_delete_port(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_delete_port - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([
            tenant_id, net_name, self.net_id,
            vlan_name(self.net_id), vlan_id
        ])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        self._l2network_multiblade.create_port(
            [tenant_id, self.net_id, port_state, self.port_id])

        port = self._l2network_multiblade.delete_port(
            [tenant_id, self.net_id, self.port_id])

        self.assertEqual(self.port_id, port[0][const.PORTID])

        # Recreating port so tear down doesn't cause an error
        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        self._l2network_multiblade.create_port(
            [tenant_id, self.net_id, port_state, self.port_id])

        LOG.debug("test_delete_port - END")
コード例 #14
0
    def _test_get_port_details(self, port_state):
        """
        Tests whether  user is able  to retrieve a remote interface
        that is attached to this particular port when port state is Up.
        """
        LOG.debug("UCSVICTestPlugin:_test_get_port_details() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network[const.NETWORKNAME],
            new_network[const.UUID], self.vlan_name, self.vlan_id,
            device_ip=self.device_ip)
        new_port = db.port_create(new_network[const.UUID], port_state)
        port_dict = self._cisco_ucs_plugin.create_port(
            self.tenant_id, self.net_id, port_state,
            new_port[const.UUID], device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))

        port_detail = self._cisco_ucs_plugin.get_port_details(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict[const.PORTID], device_ip=self.device_ip)
        self.assertEqual(str(port_dict), str(port_detail))
        self.tear_down_network_port(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict[const.PORTID])
コード例 #15
0
    def test_create_port(self):
        """
        Tests creation of a port on the specified Virtual Network.
        """
        LOG.debug("UCSVICTestPlugin:_test_create_port() called\n")

        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network[const.NETWORKNAME],
            new_network[const.UUID], self.vlan_name, self.vlan_id,
            device_ip=self.device_ip)
        new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict = self._cisco_ucs_plugin.create_port(
            self.tenant_id, self.net_id, const.PORT_UP,
            new_port[const.UUID], device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))
        self.assertEqual(port_dict[const.PORTID], new_port[const.UUID])
        profile_name = (
            self._cisco_ucs_plugin._get_profile_name(port_dict[const.PORTID]))
        self.assertTrue(profile_name is not None)
        self.tear_down_network_port(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict[const.PORTID])
コード例 #16
0
 def test_plug_interface(self, remote_interface_id=None,
                         new_vlanid=10, new_vlan_name='new_vlan'):
     """
     Attaches a remote interface to the specified port on the
     specified Virtual Network.
     """
     LOG.debug("UCSVICTestPlugin:_test_plug_interface() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
     port_dict = self._cisco_ucs_plugin.create_port(
         self.tenant_id, new_net_dict[const.NET_ID],
         const.PORT_UP, new_port[const.UUID],
         device_ip=self.device_ip,
         ucs_inventory=self._ucs_inventory,
         least_rsvd_blade_dict=(
             self._ucs_inventory._get_least_reserved_blade()))
     cdb.update_vlan_binding(new_network[const.UUID],
                             str(new_vlanid), new_vlan_name)
     port_bind = self._cisco_ucs_plugin.plug_interface(
         self.tenant_id, new_net_dict[const.NET_ID],
         port_dict[const.PORTID], remote_interface_id,
         device_ip=self.device_ip)
     self.assertEqual(port_bind[const.VLANNAME], new_vlan_name)
     self.assertEqual(port_bind[const.VLANID], new_vlanid)
     self.tear_down_network_port_interface(
         self.tenant_id, new_net_dict[const.NET_ID],
         new_port[const.UUID])
コード例 #17
0
 def test_plug_interface(self, remote_interface_id=None,
                         new_vlanid=10, new_vlan_name='new_vlan'):
     """
     Attaches a remote interface to the specified port on the
     specified Virtual Network.
     """
     LOG.debug("UCSVICTestPlugin:_test_plug_interface() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
     port_dict = self._cisco_ucs_plugin.create_port(
         self.tenant_id, new_net_dict[const.NET_ID],
         const.PORT_UP, new_port[const.UUID],
         device_ip=self.device_ip,
         ucs_inventory=self._ucs_inventory,
         least_rsvd_blade_dict=(
             self._ucs_inventory._get_least_reserved_blade()))
     cdb.update_vlan_binding(new_network[const.UUID],
                             str(new_vlanid), new_vlan_name)
     port_bind = self._cisco_ucs_plugin.plug_interface(
         self.tenant_id, new_net_dict[const.NET_ID],
         port_dict[const.PORTID], remote_interface_id,
         device_ip=self.device_ip)
     self.assertEqual(port_bind[const.VLANNAME], new_vlan_name)
     self.assertEqual(port_bind[const.VLANID], new_vlanid)
     self.tear_down_network_port_interface(
         self.tenant_id, new_net_dict[const.NET_ID],
         new_port[const.UUID])
コード例 #18
0
    def _test_get_port_details(self, port_state):
        """
        Tests whether  user is able  to retrieve a remote interface
        that is attached to this particular port when port state is Up.
        """
        LOG.debug("UCSVICTestPlugin:_test_get_port_details() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network[const.NETWORKNAME],
            new_network[const.UUID], self.vlan_name, self.vlan_id,
            device_ip=self.device_ip)
        new_port = db.port_create(new_network[const.UUID], port_state)
        port_dict = self._cisco_ucs_plugin.create_port(
            self.tenant_id, self.net_id, port_state,
            new_port[const.UUID], device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))

        port_detail = self._cisco_ucs_plugin.get_port_details(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict[const.PORTID], device_ip=self.device_ip)
        self.assertEqual(str(port_dict), str(port_detail))
        self.tear_down_network_port(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict[const.PORTID])
コード例 #19
0
    def test_create_port(self):
        """
        Tests creation of a port on the specified Virtual Network.
        """
        LOG.debug("UCSVICTestPlugin:_test_create_port() called\n")

        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network[const.NETWORKNAME],
            new_network[const.UUID], self.vlan_name, self.vlan_id,
            device_ip=self.device_ip)
        new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict = self._cisco_ucs_plugin.create_port(
            self.tenant_id, self.net_id, const.PORT_UP,
            new_port[const.UUID], device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))
        self.assertEqual(port_dict[const.PORTID], new_port[const.UUID])
        profile_name = (
            self._cisco_ucs_plugin._get_profile_name(port_dict[const.PORTID]))
        self.assertTrue(profile_name is not None)
        self.tear_down_network_port(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict[const.PORTID])
コード例 #20
0
ファイル: test_ucs_plugin.py プロジェクト: Oneiroi/quantum
 def test_get_vlan_id_for_network(self):
     LOG.debug("UCSVICTestPlugin:test_get_vlan_id_for_network() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     vlan_bind_id = self._cisco_ucs_plugin._get_vlan_id_for_network(
                                 self.tenant_id, new_network[const.UUID])
     self.assertEqual(str(vlan_bind_id), self.vlan_id)
コード例 #21
0
    def test_get_all_ports(self):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("UCSVICPlugin:get_all_ports() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id,
            new_network[const.NETWORKNAME],
            new_network[const.UUID],
            self.vlan_name,
            self.vlan_id,
            device_ip=self.device_ip)
        new_port1 = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict1 = self._cisco_ucs_plugin.create_port(
                            self.tenant_id, self.net_id, const.PORT_UP,
                            new_port1[const.UUID], device_ip=self.device_ip,
                            ucs_inventory=self._ucs_inventory,
                            least_rsvd_blade_dict=self._ucs_inventory.\
                            _get_least_reserved_blade())
        new_port2 = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict2 = self._cisco_ucs_plugin.create_port(
                               self.tenant_id, self.net_id, const.PORT_UP,
                               new_port2[const.UUID], device_ip=self.device_ip,
                               ucs_inventory=self._ucs_inventory,
                               least_rsvd_blade_dict=self._ucs_inventory.\
                               _get_least_reserved_blade())
        ports_on_net = self._cisco_ucs_plugin.get_all_ports(
                           self.tenant_id, new_net_dict[const.NET_ID],
                           device_ip=self.device_ip,
                           ucs_inventory=self._ucs_inventory,
                           least_rsvd_blade_dict=self._ucs_inventory.\
                           _get_least_reserved_blade())
        port_list = [port_dict1, port_dict2]
        self.assertTrue(
            str(ports_on_net[1]) == str(port_list[1])
            or str(ports_on_net[1]) == str(port_list[0]))
        self.assertTrue(
            str(ports_on_net[0]) == str(port_list[1])
            or str(ports_on_net[0]) == str(port_list[0]))

        blade_intf_details = self._ucs_inventory._get_rsvd_blade_intf_by_port(
            self.tenant_id, port_dict1[const.PORTID])
        self._cisco_ucs_plugin.delete_port(
                     self.tenant_id, new_net_dict[const.NET_ID],
                     port_dict1[const.PORTID], device_ip=self.device_ip,
                     ucs_inventory=self._ucs_inventory,
                     chassis_id=self.chassis_id, blade_id=self.blade_id,
                     blade_intf_distinguished_name=blade_intf_details[\
                     const.BLADE_INTF_DN],
                     least_rsvd_blade_dict=self._ucs_inventory.\
                     _get_least_reserved_blade())
        self.tear_down_network_port(self.tenant_id, new_net_dict[const.NET_ID],
                                    port_dict2[const.PORTID])
コード例 #22
0
 def test_get_vlan_id_for_network(self):
     """
     Tests retrieval of vlan id
     """
     LOG.debug("UCSVICTestPlugin:test_get_vlan_id_for_network() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     vlan_bind_id = self._cisco_ucs_plugin._get_vlan_id_for_network(
         self.tenant_id, new_network[const.UUID])
     self.assertEqual(str(vlan_bind_id), self.vlan_id)
コード例 #23
0
ファイル: test_database.py プロジェクト: BillTheBest/quantum
 def create_network(self, tenant_id, net_name):
     """Create a network"""
     net_dict = {}
     try:
         res = db.network_create(tenant_id, net_name)
         LOG.debug("Created network: %s" % res.uuid)
         net_dict["tenant-id"] = res.tenant_id
         net_dict["net-id"] = str(res.uuid)
         net_dict["net-name"] = res.name
         return net_dict
     except Exception, exc:
         LOG.error("Failed to create network: %s" % str(exc))
コード例 #24
0
    def test_plug_interface_portDNE(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_plug_interface_portDNE - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([tenant_id, net_name, self.net_id, vlan_name(self.net_id), vlan_id])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        self.assertRaises(
            exc.PortNotFound, self._l2network_multiblade.plug_interface, [tenant_id, self.net_id, port_id, interface_id]
        )

        LOG.debug("test_plug_interface_portDNE - START")
コード例 #25
0
 def create_network(self, tenant_id, net_name):
     """Create a network"""
     net_dict = {}
     try:
         res = db.network_create(tenant_id, net_name)
         LOG.debug("Created network: %s" % res.uuid)
         net_dict["tenant-id"] = res.tenant_id
         net_dict["net-id"] = str(res.uuid)
         net_dict["net-name"] = res.name
         return net_dict
     except Exception, exc:
         LOG.error("Failed to create network: %s" % str(exc))
コード例 #26
0
    def test_get_all_ports(self):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("UCSVICPlugin:get_all_ports() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id, new_network[const.NETWORKNAME],
            new_network[const.UUID], self.vlan_name, self.vlan_id,
            device_ip=self.device_ip)
        new_port1 = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict1 = self._cisco_ucs_plugin.create_port(
            self.tenant_id, self.net_id, const.PORT_UP,
            new_port1[const.UUID], device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))
        new_port2 = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict2 = self._cisco_ucs_plugin.create_port(
            self.tenant_id, self.net_id, const.PORT_UP,
            new_port2[const.UUID], device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))
        ports_on_net = self._cisco_ucs_plugin.get_all_ports(
            self.tenant_id, new_net_dict[const.NET_ID],
            device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))
        port_list = [port_dict1, port_dict2]
        self.assertTrue(str(ports_on_net[1]) == str(port_list[1]) or
                        str(ports_on_net[1]) == str(port_list[0]))
        self.assertTrue(str(ports_on_net[0]) == str(port_list[1]) or
                        str(ports_on_net[0]) == str(port_list[0]))

        blade_intf_details = self._ucs_inventory._get_rsvd_blade_intf_by_port(
            self.tenant_id, port_dict1[const.PORTID])
        self._cisco_ucs_plugin.delete_port(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict1[const.PORTID], device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            chassis_id=self.chassis_id, blade_id=self.blade_id,
            blade_intf_distinguished_name=blade_intf_details[
                const.BLADE_INTF_DN],
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))
        self.tear_down_network_port(
            self.tenant_id, new_net_dict[const.NET_ID],
            port_dict2[const.PORTID])
コード例 #27
0
 def create_network(self, tenant_id, net_name, **kwargs):
     """
     Creates a new Virtual Network, and assigns it
     a symbolic name.
     """
     LOG.debug("create_network() called\n")
     new_network = db.network_create(tenant_id, net_name)
     new_net_id = new_network[const.UUID]
     vlan_id = self._get_vlan_for_tenant(tenant_id, net_name)
     vlan_name = self._get_vlan_name(new_net_id, str(vlan_id))
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_name, new_net_id, vlan_name, vlan_id])
     cdb.add_vlan_binding(vlan_id, vlan_name, new_net_id)
     new_net_dict = {const.NET_ID: new_net_id, const.NET_NAME: net_name, const.NET_PORTS: []}
     return new_net_dict
コード例 #28
0
    def test_plug_interface_portDNE(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_plug_interface_portDNE - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([
            tenant_id, net_name, self.net_id,
            vlan_name(self.net_id), vlan_id
        ])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        self.assertRaises(exc.PortNotFound,
                          self._l2network_multiblade.plug_interface,
                          [tenant_id, self.net_id, port_id, interface_id])

        LOG.debug("test_plug_interface_portDNE - START")
コード例 #29
0
    def test_create_port(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_create_port - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([
            tenant_id, net_name, self.net_id,
            vlan_name(self.net_id), vlan_id
        ])

        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        port = self._l2network_multiblade.create_port(
            [tenant_id, self.net_id, port_state, self.port_id])

        self.assertEqual(self.port_id, port[0][const.PORTID])
        LOG.debug("test_create_port - END")
コード例 #30
0
 def test_create_network(self):
     """
     Tests creation of new Virtual Network.
     """
     LOG.debug("UCSVICTestPlugin:_test_create_network() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     self.assertEqual(new_net_dict[const.NET_ID], new_network[const.UUID])
     self.assertEqual(new_net_dict[const.NET_NAME],
                      new_network[const.NETWORKNAME])
     self.tear_down_network(self.tenant_id, new_network[const.UUID])
コード例 #31
0
    def test_create_network(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_create_network - START")

        # Create the network in the test DB, then with the model
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        networks = self._l2network_multiblade.create_network(
            [tenant_id, net_name, self.net_id, vlan_name(self.net_id), vlan_id]
        )
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        for network in networks:
            self.assertEqual(network[const.NET_ID], self.net_id)
            self.assertEqual(network[const.NET_NAME], net_name)

        LOG.debug("test_create_network - END")
コード例 #32
0
 def test_create_network(self):
     """
     Tests creation of new Virtual Network.
     """
     LOG.debug("UCSVICTestPlugin:_test_create_network() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     self.assertEqual(new_net_dict[const.NET_ID], new_network[const.UUID])
     self.assertEqual(new_net_dict[const.NET_NAME],
                      new_network[const.NETWORKNAME])
     self.tear_down_network(self.tenant_id, new_network[const.UUID])
コード例 #33
0
 def test_delete_network(self):
     """
     Tests deletion of  the network with the specified network identifier
     belonging to the specified tenant.
     """
     LOG.debug("UCSVICTestPlugin:test_delete_network() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     new_net_dict = self._cisco_ucs_plugin.delete_network(
         self.tenant_id, new_network[const.UUID], device_ip=self.device_ip)
     self.assertEqual(new_net_dict[const.NET_ID], new_network[const.UUID])
コード例 #34
0
 def test_delete_network(self):
     """
     Tests deletion of  the network with the specified network identifier
     belonging to the specified tenant.
     """
     LOG.debug("UCSVICTestPlugin:test_delete_network() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     new_net_dict = self._cisco_ucs_plugin.delete_network(
         self.tenant_id, new_network[const.UUID], device_ip=self.device_ip)
     self.assertEqual(new_net_dict[const.NET_ID], new_network[const.UUID])
コード例 #35
0
ファイル: test_ucs_plugin.py プロジェクト: LuizOz/quantum
    def test_delete_port(self):
        """
        Tests Deletion of a port on a specified Virtual Network,
        if the port contains a remote interface attachment,
        the remote interface should first be un-plugged and
        then the port can be deleted.
        """
        LOG.debug("UCSVICTestPlugin:_test_delete_port() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
            self.tenant_id,
            new_network[const.NETWORKNAME],
            new_network[const.UUID],
            self.vlan_name,
            self.vlan_id,
            device_ip=self.device_ip)
        new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
        port_dict = self._cisco_ucs_plugin.create_port(
            self.tenant_id,
            self.net_id,
            const.PORT_UP,
            new_port[const.UUID],
            device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))

        blade_intf_details = self._ucs_inventory._get_rsvd_blade_intf_by_port(
            self.tenant_id, port_dict[const.PORTID])
        port_bind = self._cisco_ucs_plugin.delete_port(
            self.tenant_id,
            new_net_dict[const.NET_ID],
            port_dict[const.PORTID],
            device_ip=self.device_ip,
            ucs_inventory=self._ucs_inventory,
            chassis_id=self.chassis_id,
            blade_id=self.blade_id,
            blade_intf_distinguished_name=blade_intf_details[
                const.BLADE_INTF_DN],
            least_rsvd_blade_dict=(
                self._ucs_inventory._get_least_reserved_blade()))

        self.assertEqual(port_bind[const.PORTID], new_port[const.UUID])
        self.tear_down_network(self.tenant_id, new_net_dict[const.NET_ID])
コード例 #36
0
    def test_create_network(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_create_network - START")

        # Create the network in the test DB, then with the model
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        networks = self._l2network_multiblade.create_network([
            tenant_id, net_name, self.net_id,
            vlan_name(self.net_id), vlan_id
        ])

        self.assertEqual(networks.__len__(), self.ucs_count)
        for network in networks:
            self.assertEqual(network[const.NET_ID], self.net_id)
            self.assertEqual(network[const.NET_NAME], net_name)

        LOG.debug("test_create_network - END")
コード例 #37
0
 def create_network(self, tenant_id, net_name, **kwargs):
     """
     Creates a new Virtual Network, and assigns it
     a symbolic name.
     """
     LOG.debug("create_network() called\n")
     new_network = db.network_create(tenant_id, net_name)
     new_net_id = new_network[const.UUID]
     vlan_id = self._get_vlan_for_tenant(tenant_id, net_name)
     vlan_name = self._get_vlan_name(new_net_id, str(vlan_id))
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_name,
                                                  new_net_id, vlan_name,
                                                  vlan_id])
     cdb.add_vlan_binding(vlan_id, vlan_name, new_net_id)
     new_net_dict = {const.NET_ID: new_net_id,
                     const.NET_NAME: net_name,
                     const.NET_PORTS: []}
     return new_net_dict
コード例 #38
0
    def test_create_port(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_create_port - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([tenant_id,
                                                   net_name,
                                                   self.net_id,
                                                   vlan_name(self.net_id),
                                                   vlan_id])

        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        port = self._l2network_multiblade.create_port([tenant_id,
                                                self.net_id,
                                                port_state,
                                                self.port_id])

        self.assertEqual(self.port_id, port[0][const.PORTID])
        LOG.debug("test_create_port - END")
コード例 #39
0
ファイル: test_ucs_plugin.py プロジェクト: Oneiroi/quantum
    def test_delete_port_profile(self):
        LOG.debug("UCSVICTestPlugin:test_delete_port_profile() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
        self._cisco_ucs_plugin._set_ucsm(self.device_ip)
        self._cisco_ucs_plugin._create_port_profile(
                                self.tenant_id, new_network[const.UUID],
                                new_port[const.UUID], self.vlan_name,
                                self.vlan_id)
        profile_name = self._cisco_ucs_plugin.\
                            _get_profile_name(new_port[const.UUID])

        counter1 = self._cisco_ucs_plugin._port_profile_counter
        self._cisco_ucs_plugin._delete_port_profile(new_port[const.UUID],
                                                    profile_name)
        counter2 = self._cisco_ucs_plugin._port_profile_counter
        self.assertEqual(counter1 - 1, counter2)
コード例 #40
0
 def test_get_network_details(self):
     """
     Tests the deletion the Virtual Network belonging to a the
     spec
     """
     LOG.debug("UCSVICTestPlugin:test_get_network_details() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     new_net_dict = self._cisco_ucs_plugin.get_network_details(
         self.tenant_id, new_network[const.UUID],
         device_ip=self.device_ip)
     self.assertEqual(new_net_dict[const.NET_ID], new_network[const.UUID])
     self.assertEqual(new_net_dict[const.NET_NAME],
                      new_network[const.NETWORKNAME])
     self.tear_down_network(self.tenant_id, new_network[const.UUID])
コード例 #41
0
 def test_get_network_details(self):
     """
     Tests the deletion the Virtual Network belonging to a the
     spec
     """
     LOG.debug("UCSVICTestPlugin:test_get_network_details() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_net_dict = self._cisco_ucs_plugin.create_network(
         self.tenant_id, new_network[const.NETWORKNAME],
         new_network[const.UUID], self.vlan_name, self.vlan_id,
         device_ip=self.device_ip)
     new_net_dict = self._cisco_ucs_plugin.get_network_details(
         self.tenant_id, new_network[const.UUID],
         device_ip=self.device_ip)
     self.assertEqual(new_net_dict[const.NET_ID], new_network[const.UUID])
     self.assertEqual(new_net_dict[const.NET_NAME],
                      new_network[const.NETWORKNAME])
     self.tear_down_network(self.tenant_id, new_network[const.UUID])
コード例 #42
0
ファイル: test_ucs_plugin.py プロジェクト: Oneiroi/quantum
    def test_delete_port_PortNotFound(self):
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_net_dict = self._cisco_ucs_plugin.create_network(
                self.tenant_id, new_network[const.NETWORKNAME],
                new_network[const.UUID], self.vlan_name, self.vlan_id,
                device_ip=self.device_ip)

        self.assertRaises(c_exc.PortVnicNotFound,
                          self._cisco_ucs_plugin.delete_port,
                          self.tenant_id, new_net_dict[const.NET_ID],
                          self.port_id, device_ip=self.device_ip,
                          ucs_inventory=self._ucs_inventory,
                          chassis_id=self.chassis_id, blade_id=self.blade_id,
                          blade_intf_distinguished_name=self.\
                          blade_intf_distinguished_name,
                          least_rsvd_blade_dict=self._ucs_inventory.\
                          _get_least_reserved_blade())

        self.tearDownNetwork(self.tenant_id, new_net_dict[const.NET_ID])
コード例 #43
0
 def test_create_port_profile(self):
     """
     Tests creation of port profile
     """
     LOG.debug("UCSVICTestPlugin:test_create_port_profile() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
     self._cisco_ucs_plugin._set_ucsm(self.device_ip)
     new_port_profile = self._cisco_ucs_plugin._create_port_profile(
         self.tenant_id, new_network[const.UUID], new_port[const.UUID],
         self.vlan_name, self.vlan_id)
     profile_name = self._cisco_ucs_plugin.\
                         _get_profile_name(new_port[const.UUID])
     self.assertEqual(new_port_profile[const.PROFILE_NAME], profile_name)
     self.assertEqual(new_port_profile[const.PROFILE_VLAN_NAME],
                      self.vlan_name)
     self.assertEqual(new_port_profile[const.PROFILE_VLAN_ID], self.vlan_id)
     self._cisco_ucs_plugin._delete_port_profile(new_port[const.UUID],
                                                 profile_name)
コード例 #44
0
    def test_plug_interface(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_plug_interface - START")
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([
            tenant_id, net_name, self.net_id,
            vlan_name(self.net_id), vlan_id
        ])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        self.port_id = db.port_create(self.net_id, port_state)[const.UUID]
        self._l2network_multiblade.create_port(
            [tenant_id, self.net_id, port_state, self.port_id])

        interface = self._l2network_multiblade.plug_interface(
            [tenant_id, self.net_id, self.port_id, interface_id])
        port = db.port_set_attachment(self.net_id, self.port_id, interface_id)

        self.assertEqual(self.port_id, interface[0][const.PORTID])
        self.assertEqual(port[const.INTERFACEID], interface_id)
        LOG.debug("test_plug_interface - END")
コード例 #45
0
    def test_delete_network(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_delete_network - START")

        # Create the network in the test DB, then with the model
        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([
            tenant_id, net_name, self.net_id,
            vlan_name(self.net_id), vlan_id
        ])
        cdb.add_vlan_binding(vlan_id, vlan_name(self.net_id), self.net_id)

        networks = self._l2network_multiblade.delete_network(
            [tenant_id, self.net_id])
        cdb.remove_vlan_binding(self.net_id)
        db.network_destroy(self.net_id)
        for network in networks:
            self.assertEqual(network[const.NET_ID], self.net_id)
            self.assertEqual(network[const.NET_NAME], net_name)

        LOG.debug("test_delete_network - END")
コード例 #46
0
    def test_rename_network(self):
        """Support for the Quantum core API call"""
        LOG.debug("test_rename_network - START")

        self.net_id = db.network_create(tenant_id, net_name)[const.UUID]
        self._l2network_multiblade.create_network([tenant_id,
                                                   net_name,
                                                   self.net_id,
                                                   vlan_name(self.net_id),
                                                   vlan_id])

        db.network_rename(tenant_id, self.net_id, new_net_name)
        networks = self._l2network_multiblade.rename_network([tenant_id,
                                                   self.net_id,
                                                   new_net_name])

        self.assertEqual(networks.__len__(), self.ucs_count)
        for network in networks:
            self.assertEqual(network[const.NET_ID], self.net_id)
            self.assertEqual(network[const.NET_NAME], new_net_name)
        LOG.debug("test_rename_network - END")
コード例 #47
0
    def test_delete_port_profile(self):
        """
        Tests deletion of port profile
        """
        LOG.debug("UCSVICTestPlugin:test_delete_port_profile() called\n")
        new_network = db.network_create(self.tenant_id, self.net_name)
        cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                             new_network[const.UUID])
        new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
        self._cisco_ucs_plugin._set_ucsm(self.device_ip)
        self._cisco_ucs_plugin._create_port_profile(
            self.tenant_id, new_network[const.UUID],
            new_port[const.UUID], self.vlan_name,
            self.vlan_id)
        profile_name = (
            self._cisco_ucs_plugin._get_profile_name(new_port[const.UUID]))

        counter1 = self._cisco_ucs_plugin._port_profile_counter
        self._cisco_ucs_plugin._delete_port_profile(new_port[const.UUID],
                                                    profile_name)
        counter2 = self._cisco_ucs_plugin._port_profile_counter
        self.assertEqual(counter1 - 1, counter2)
コード例 #48
0
 def test_create_port_profile(self):
     """
     Tests creation of port profile
     """
     LOG.debug("UCSVICTestPlugin:test_create_port_profile() called\n")
     new_network = db.network_create(self.tenant_id, self.net_name)
     cdb.add_vlan_binding(str(self.vlan_id), self.vlan_name,
                          new_network[const.UUID])
     new_port = db.port_create(new_network[const.UUID], const.PORT_UP)
     self._cisco_ucs_plugin._set_ucsm(self.device_ip)
     new_port_profile = self._cisco_ucs_plugin._create_port_profile(
         self.tenant_id, new_network[const.UUID],
         new_port[const.UUID], self.vlan_name,
         self.vlan_id)
     profile_name = (
         self._cisco_ucs_plugin._get_profile_name(new_port[const.UUID]))
     self.assertEqual(new_port_profile[const.PROFILE_NAME], profile_name)
     self.assertEqual(new_port_profile[const.PROFILE_VLAN_NAME],
                      self.vlan_name)
     self.assertEqual(new_port_profile[const.PROFILE_VLAN_ID], self.vlan_id)
     self._cisco_ucs_plugin._delete_port_profile(new_port[const.UUID],
                                                 profile_name)