Example #1
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])
Example #2
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])
Example #3
0
 def update_vlan_binding(self, network_id, vlan_id, vlan_name):
     """Update a vlan binding."""
     try:
         res = l2network_db.update_vlan_binding(network_id, vlan_id, vlan_name)
         LOG.debug("Updating vlan binding for vlan: %s" % res.vlan_id)
         vlan_dict = {}
         vlan_dict["vlan-id"] = str(res.vlan_id)
         vlan_dict["vlan-name"] = res.vlan_name
         vlan_dict["net-id"] = str(res.network_id)
         return vlan_dict
     except Exception, exc:
         raise Exception("Failed to update vlan binding: %s" % str(exc))
Example #4
0
 def update_vlan_binding(self, network_id, vlan_id, vlan_name):
     """Update a vlan binding."""
     try:
         res = l2network_db.update_vlan_binding(network_id, vlan_id,
                                                vlan_name)
         LOG.debug("Updating vlan binding for vlan: %s" % res.vlan_id)
         vlan_dict = {}
         vlan_dict["vlan-id"] = str(res.vlan_id)
         vlan_dict["vlan-name"] = res.vlan_name
         vlan_dict["net-id"] = str(res.network_id)
         return vlan_dict
     except Exception as exc:
         raise Exception("Failed to update vlan binding: %s" % str(exc))