Esempio n. 1
0
    def delete_network(self, tenant_id, net_id):
        """
        Deletes the network with the specified network identifier
        belonging to the specified tenant.
        """
        LOG.debug("delete_network() called\n")
        net = db.network_get(net_id)
        if net:
            if len(net[const.NETWORKPORTS]) > 0:
                ports_on_net = db.port_list(net_id)
                for port in ports_on_net:
                    if port[const.INTERFACEID]:
                        raise exc.NetworkInUse(net_id=net_id)
                for port in ports_on_net:
                    self.delete_port(tenant_id, net_id, port[const.UUID])

            self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
            net_dict = cutil.make_net_dict(net[const.UUID],
                                           net[const.NETWORKNAME],
                                           [])
            self._release_vlan_for_tenant(tenant_id, net_id)
            cdb.remove_vlan_binding(net_id)
            db.network_destroy(net_id)
            return net_dict
        # Network not found
        raise exc.NetworkNotFound(net_id=net_id)
Esempio n. 2
0
    def delete_network(self, tenant_id, net_id):
        """
        Deletes the network with the specified network identifier
        belonging to the specified tenant.
        """
        LOG.debug("delete_network() called\n")
        net = db.network_get(net_id)
        if net:
            if len(net[const.NETWORKPORTS]) > 0:
                ports_on_net = db.port_list(net_id)
                for port in ports_on_net:
                    if port[const.INTERFACEID]:
                        raise exc.NetworkInUse(net_id=net_id)
                for port in ports_on_net:
                    self.delete_port(tenant_id, net_id, port[const.UUID])

            self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
            net_dict = cutil.make_net_dict(net[const.UUID],
                                           net[const.NETWORKNAME],
                                           [])
            self._release_vlan_for_tenant(tenant_id, net_id)
            cdb.remove_vlan_binding(net_id)
            db.network_destroy(net_id)
            return net_dict
        # Network not found
        raise exc.NetworkNotFound(net_id=net_id)
Esempio n. 3
0
 def update_network(self, tenant_id, net_id, **kwargs):
     """
     Updates the symbolic name belonging to a particular
     Virtual Network.
     """
     LOG.debug("update_network() called\n")
     network = db.network_update(net_id, tenant_id, **kwargs)
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, kwargs])
     net_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [])
     return net_dict
Esempio n. 4
0
 def update_network(self, tenant_id, net_id, **kwargs):
     """
     Updates the symbolic name belonging to a particular
     Virtual Network.
     """
     LOG.debug("UCSVICPlugin:update_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     network = db.network_get(net_id)
     net_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [])
     return net_dict
Esempio n. 5
0
 def update_network(self, tenant_id, net_id, **kwargs):
     """
     Updates the symbolic name belonging to a particular
     Virtual Network.
     """
     LOG.debug("UCSVICPlugin:update_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     network = db.network_get(net_id)
     net_dict = cutil.make_net_dict(network[const.UUID],
                                    network[const.NETWORKNAME], [])
     return net_dict
Esempio n. 6
0
 def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id, **kwargs):
     """
     Creates a new Virtual Network, and assigns it
     a symbolic name.
     """
     LOG.debug("UCSVICPlugin:create_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     self._driver.create_vlan(vlan_name, str(vlan_id), self._ucsm_ip, self._ucsm_username, self._ucsm_password)
     network = db.network_get(net_id)
     ports_on_net = []
     new_network_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], ports_on_net)
     return new_network_dict
Esempio n. 7
0
 def update_network(self, tenant_id, net_id, **kwargs):
     """
     Updates the symbolic name belonging to a particular
     Virtual Network.
     """
     LOG.debug("update_network() called\n")
     network = db.network_update(net_id, tenant_id, **kwargs)
     self._invoke_device_plugins(self._func_name(),
                                 [tenant_id, net_id, kwargs])
     net_dict = cutil.make_net_dict(network[const.UUID],
                                    network[const.NETWORKNAME], [])
     return net_dict
Esempio n. 8
0
 def delete_network(self, tenant_id, net_id, **kwargs):
     """
     Deletes the network with the specified network identifier
     belonging to the specified tenant.
     """
     LOG.debug("UCSVICPlugin:delete_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     net = db.network_get(net_id)
     vlan_binding = cdb.get_vlan_binding(net[const.UUID])
     vlan_name = vlan_binding[const.VLANNAME]
     self._driver.delete_vlan(vlan_name, self._ucsm_ip, self._ucsm_username, self._ucsm_password)
     net_dict = cutil.make_net_dict(net[const.UUID], net[const.NETWORKNAME], [])
     return net_dict
Esempio n. 9
0
 def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
                    **kwargs):
     """
     Creates a new Virtual Network, and assigns it
     a symbolic name.
     """
     LOG.debug("UCSVICPlugin:create_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     self._driver.create_vlan(vlan_name, str(vlan_id), self._ucsm_ip,
                              self._ucsm_username, self._ucsm_password)
     ports_on_net = []
     new_network_dict = cutil.make_net_dict(net_id, net_name, ports_on_net)
     return new_network_dict
Esempio n. 10
0
 def delete_network(self, tenant_id, net_id, **kwargs):
     """
     Deletes the network with the specified network identifier
     belonging to the specified tenant.
     """
     LOG.debug("UCSVICPlugin:delete_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     vlan_binding = cdb.get_vlan_binding(net_id)
     vlan_name = vlan_binding[const.VLANNAME]
     self._driver.delete_vlan(vlan_name, self._ucsm_ip, self._ucsm_username,
                              self._ucsm_password)
     #Rohit:passing empty network name, might not need fixing
     net_dict = cutil.make_net_dict(net_id, "", [])
     return net_dict
Esempio n. 11
0
    def get_all_networks(self, tenant_id, **kwargs):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("UCSVICPlugin:get_all_networks() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [])
            new_networks_list.append(new_network_dict)

        return new_networks_list
Esempio n. 12
0
    def get_all_networks(self, tenant_id):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("get_all_networks() called\n")
        self._invoke_device_plugins(self._func_name(), [tenant_id])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [])
            new_networks_list.append(new_network_dict)

        return new_networks_list
Esempio n. 13
0
 def delete_network(self, tenant_id, net_id, **kwargs):
     """
     Deletes the network with the specified network identifier
     belonging to the specified tenant.
     """
     LOG.debug("UCSVICPlugin:delete_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     net = db.network_get(net_id)
     vlan_binding = cdb.get_vlan_binding(net[const.UUID])
     vlan_name = vlan_binding[const.VLANNAME]
     self._driver.delete_vlan(vlan_name, self._ucsm_ip, self._ucsm_username,
                              self._ucsm_password)
     net_dict = cutil.make_net_dict(net[const.UUID], net[const.NETWORKNAME],
                                    [])
     return net_dict
Esempio n. 14
0
 def delete_network(self, tenant_id, net_id, **kwargs):
     """
     Deletes the network with the specified network identifier
     belonging to the specified tenant.
     """
     LOG.debug("UCSVICPlugin:delete_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     vlan_binding = cdb.get_vlan_binding(net_id)
     vlan_name = vlan_binding[const.VLANNAME]
     self._driver.delete_vlan(vlan_name, self._ucsm_ip,
                              self._ucsm_username, self._ucsm_password)
     #Rohit:passing empty network name, might not need fixing
     net_dict = cutil.make_net_dict(net_id,
                                    "",
                                    [])
     return net_dict
Esempio n. 15
0
    def get_all_networks(self, tenant_id):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("get_all_networks() called\n")
        self._invoke_device_plugins(self._func_name(), [tenant_id])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID],
                                                   network[const.NETWORKNAME],
                                                   [])
            new_networks_list.append(new_network_dict)

        return new_networks_list
Esempio n. 16
0
    def get_all_networks(self, tenant_id, **kwargs):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("UCSVICPlugin:get_all_networks() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID],
                                                   network[const.NETWORKNAME],
                                                   [])
            new_networks_list.append(new_network_dict)

        return new_networks_list
Esempio n. 17
0
    def get_network_details(self, tenant_id, net_id):
        """
        Gets the details of a particular network
        """
        LOG.debug("get_network_details() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], ports_on_net)

        return new_network
Esempio n. 18
0
    def get_network_details(self, tenant_id, net_id, **kwargs):
        """
        Deletes the Virtual Network belonging to a the
        spec
        """
        LOG.debug("UCSVICPlugin:get_network_details() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        network = db.network_get(net_id)
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], ports_on_net)

        return new_network
Esempio n. 19
0
    def get_network_details(self, tenant_id, net_id):
        """
        Gets the details of a particular network
        """
        LOG.debug("get_network_details() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port[const.UUID],
                                            port[const.PORTSTATE],
                                            port[const.NETWORKID],
                                            port[const.INTERFACEID])
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID],
                                              network[const.NETWORKNAME],
                                              ports_on_net)

        return new_network
Esempio n. 20
0
    def get_network_details(self, tenant_id, net_id, **kwargs):
        """
        Deletes the Virtual Network belonging to a the
        spec
        """
        LOG.debug("UCSVICPlugin:get_network_details() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        network = db.network_get(net_id)
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port[const.UUID],
                                            port[const.PORTSTATE],
                                            port[const.NETWORKID],
                                            port[const.INTERFACEID])
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID],
                                          network[const.NETWORKNAME],
                                          ports_on_net)

        return new_network