示例#1
0
 def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
     LOG.debug("Creating port with network_id: %s" % net_id)
     db.validate_network_ownership(tenant_id, net_id)
     port = db.port_create(net_id,
                           port_state,
                           op_status=OperationalStatus.DOWN)
     return self._make_port_dict(port)
    def delete_network(self, tenant_id, net_id):
        """
        Deletes the network with the specified network identifier
        belonging to the specified tenant.
        """
        LOG.debug("LinuxBridgePlugin.delete_network() called")
        db.validate_network_ownership(tenant_id, net_id)
        net = db.network_get(net_id)
        if net:
            ports_on_net = db.port_list(net_id)
            if len(ports_on_net) > 0:
                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])

            net_dict = cutil.make_net_dict(net[const.UUID],
                                           net[const.NETWORKNAME],
                                           [], net[const.OPSTATUS])
            try:
                self._release_vlan_for_tenant(tenant_id, net_id)
                cdb.remove_vlan_binding(net_id)
            except Exception as excp:
                LOG.warning("Exception: %s" % excp)
                db.network_update(net_id, tenant_id, {const.OPSTATUS:
                                                      OperationalStatus.DOWN})
            db.network_destroy(net_id)
            return net_dict
        # Network not found
        raise exc.NetworkNotFound(net_id=net_id)
示例#3
0
 def get_network(self, tenant_id, network_id):
     db.validate_network_ownership(tenant_id, network_id)
     try:
         network = db.network_get(network_id)
     except:
         raise exc.NetworkNotFound(net_id=network_id)
     return network
示例#4
0
    def delete_network(self, tenant_id, net_id):
        """
        Deletes the network with the specified network identifier
        belonging to the specified tenant.
        """
        LOG.debug("LinuxBridgePlugin.delete_network() called")
        db.validate_network_ownership(tenant_id, net_id)
        net = db.network_get(net_id)
        if net:
            ports_on_net = db.port_list(net_id)
            if len(ports_on_net) > 0:
                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])

            net_dict = cutil.make_net_dict(net[const.UUID],
                                           net[const.NETWORKNAME], [],
                                           net[const.OPSTATUS])
            try:
                self._release_vlan_for_tenant(tenant_id, net_id)
                cdb.remove_vlan_binding(net_id)
            except Exception as excp:
                LOG.warning("Exception: %s" % excp)
                db.network_update(net_id, tenant_id,
                                  {const.OPSTATUS: OperationalStatus.DOWN})
            db.network_destroy(net_id)
            return net_dict
        # Network not found
        raise exc.NetworkNotFound(net_id=net_id)
    def update_network(self, tenant_id, net_id, **kwargs):
        db.validate_network_ownership(tenant_id, net_id)
        net = db.network_update(net_id, tenant_id, **kwargs)

        #LOG.debug("PRUTH: update_network: %s %s" % (net, kwargs['name']))
        update_network_properties(net.network_id, net.network_type, net.switch_name, net.vlan_tag, net.max_ingress_rate, net.max_ingress_burst)

        return self._make_net_dict(str(net.uuid), net.name,
                                        None, net.op_status)
示例#6
0
 def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
     """
     Creates a port on the specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.create_port() called")
     db.validate_network_ownership(tenant_id, net_id)
     port = db.port_create(net_id, port_state,
                           op_status=OperationalStatus.DOWN)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
示例#7
0
 def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
     """
     Creates a port on the specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.create_port() called")
     db.validate_network_ownership(tenant_id, net_id)
     port = db.port_create(net_id,
                           port_state,
                           op_status=OperationalStatus.DOWN)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
    def delete_network(self, tenant_id, net_id):
        db.validate_network_ownership(tenant_id, net_id)
        net = db.network_get(net_id)

        # Verify that no attachments are plugged into the network
        for port in db.port_list(net_id):
            if port.interface_id:
                raise q_exc.NetworkInUse(net_id=net_id)
        net = db.network_destroy(net_id)
        self.driver.delete_network(net)
        return self._make_net_dict(str(net.uuid), net.name, [], net.op_status)
示例#9
0
 def update_network(self, tenant_id, net_id, **kwargs):
     """
     Updates the attributes of a particular Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.update_network() called")
     db.validate_network_ownership(tenant_id, net_id)
     network = db.network_update(net_id, tenant_id, **kwargs)
     net_dict = cutil.make_net_dict(network[const.UUID],
                                    network[const.NETWORKNAME], [],
                                    network[const.OPSTATUS])
     return net_dict
示例#10
0
    def delete_network(self, tenant_id, net_id):
        db.validate_network_ownership(tenant_id, net_id)
        net = db.network_get(net_id)

        # Verify that no attachments are plugged into the network
        for port in db.port_list(net_id):
            if port.interface_id:
                raise q_exc.NetworkInUse(net_id=net_id)
        net = db.network_destroy(net_id)
        self.driver.delete_network(net)
        return self._make_net_dict(str(net.uuid), net.name, [], net.op_status)
 def update_network(self, tenant_id, net_id, **kwargs):
     """
     Updates the attributes of a particular Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.update_network() called")
     db.validate_network_ownership(tenant_id, net_id)
     network = db.network_update(net_id, tenant_id, **kwargs)
     net_dict = cutil.make_net_dict(network[const.UUID],
                                    network[const.NETWORKNAME],
                                    [], network[const.OPSTATUS])
     return net_dict
示例#12
0
    def get_all_ports(self, tenant_id, net_id, **kwargs):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("LinuxBridgePlugin.get_all_ports() called")
        db.validate_network_ownership(tenant_id, net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

        # This plugin does not perform filtering at the moment
        return ports_on_net
示例#13
0
    def get_all_ports(self, tenant_id, net_id, **kwargs):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("LinuxBridgePlugin.get_all_ports() called")
        db.validate_network_ownership(tenant_id, net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

        # This plugin does not perform filtering at the moment
        return ports_on_net
示例#14
0
 def get_all_ports(self, tenant_id, net_id, **kwargs):
     """
     Retrieves all port identifiers belonging to the
     specified Virtual Network.
     """
     LOG.debug("FakePlugin.get_all_ports() called")
     db.validate_network_ownership(tenant_id, net_id)
     filter_opts = kwargs.get('filter_opts')
     if filter_opts:
         LOG.debug("filtering options were passed to the plugin"
                   "but the Fake plugin does not support them")
     port_ids = []
     ports = db.port_list(net_id)
     for x in ports:
         d = {'port-id': str(x.uuid)}
         port_ids.append(d)
     return port_ids
示例#15
0
    def get_all_ports(self, tenant_id, net_id, **kwargs):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        :param tenant_id: unique identifier for the tenant for which this
            method is going to retrieve ports
        :param net_id: unique identifiers for the network whose ports are
            about to be retrieved
        :param **kwargs: options to be passed to the plugin. The following
            keywork based-options can be specified:
            filter_opts - options for filtering network list
        :returns: a list of mapping sequences with the following signature:
                     [ {'port-id': uuid representing a particular port
                                    on the specified quantum network
                       },
                       ....
                       {'port-id': uuid representing a particular port
                                     on the specified quantum network
                       }
                    ]
        :raises: exception.NetworkNotFound
        """
        LOG.debug("QuantumRestProxy: get_all_ports() called")
        db.validate_network_ownership(tenant_id, net_id)

        filter_fn = None
        filter_opts = kwargs.get('filter_opts', None)
        if filter_opts is not None and len(filter_opts) > 0:
            filter_fn = self.filter_port
            LOG.debug("QuantumRestProxy: filter_opts ignored: %s" %
                      filter_opts)

        port_ids = []
        ports = db.port_list(net_id)
        for port in ports:
            if filter_fn is not None and \
               filter_fn(filter_opts, port) is None:
                continue
            d = {
                'port-id': str(port.uuid),
            }
            port_ids.append(d)
        return port_ids
    def get_network_details(self, tenant_id, net_id):
        """
        retrieved a list of all the remote vifs that
        are attached to the network
        """
        LOG.debug("LinuxBridgePlugin.get_network_details() called")
        db.validate_network_ownership(tenant_id, net_id)
        network = db.network_get(net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

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

        return new_network
示例#17
0
    def get_network_details(self, tenant_id, net_id):
        """
        retrieved a list of all the remote vifs that
        are attached to the network
        """
        LOG.debug("LinuxBridgePlugin.get_network_details() called")
        db.validate_network_ownership(tenant_id, net_id)
        network = db.network_get(net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

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

        return new_network
    def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
        LOG.debug("PRUTH: Creating port with network_id: %s" % net_id)

        neuca_tenant_id = self.config.get("NEUCA", "neuca_tenant_id")
        
        if tenant_id != neuca_tenant_id:
            db.validate_network_ownership(tenant_id, net_id)
            #new_mac = None
        #else:
            #new_mac = str(quantum.common.utils.generate_mac())
        #    pass

        port = db.port_create(net_id, port_state,
                                op_status=OperationalStatus.DOWN)
        

        LOG.debug("PRUTH: neuca_tenant_id: %s, net_id: %s, interface_id: %s" % (neuca_tenant_id, net_id, port.interface_id))
        LOG.debug("PRUTH: kwargs:%s" % (str(kwargs)))
        
        neuca_db.add_port_properties(port.uuid,None,None)

        return self._make_port_dict(port)
示例#19
0
 def get_all_ports(self, tenant_id, net_id, **kwargs):
     ids = []
     db.validate_network_ownership(tenant_id, net_id)
     ports = db.port_list(net_id)
     # This plugin does not perform filtering at the moment
     return [{'port-id': str(p.uuid)} for p in ports]
示例#20
0
 def get_all_ports(self, tenant_id, net_id, **kwargs):
     ids = []
     db.validate_network_ownership(tenant_id, net_id)
     ports = db.port_list(net_id)
     # This plugin does not perform filtering at the moment
     return [{'port-id': str(p.uuid)} for p in ports]
示例#21
0
 def get_network_details(self, tenant_id, net_id):
     db.validate_network_ownership(tenant_id, net_id)
     net = db.network_get(net_id)
     ports = self.get_all_ports(tenant_id, net_id)
     return self._make_net_dict(str(net.uuid), net.name,
                                ports, net.op_status)
示例#22
0
 def update_network(self, tenant_id, net_id, **kwargs):
     db.validate_network_ownership(tenant_id, net_id)
     net = db.network_update(net_id, tenant_id, **kwargs)
     return self._make_net_dict(str(net.uuid), net.name,
                                None, net.op_status)
示例#23
0
 def get_network_details(self, tenant_id, net_id):
     db.validate_network_ownership(tenant_id, net_id)
     net = db.network_get(net_id)
     ports = self.get_all_ports(tenant_id, net_id)
     return self._make_net_dict(str(net.uuid), net.name, ports,
                                net.op_status)
示例#24
0
 def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
     LOG.debug("Creating port with network_id: %s" % net_id)
     db.validate_network_ownership(tenant_id, net_id)
     port = db.port_create(net_id, port_state,
                           op_status=OperationalStatus.DOWN)
     return self._make_port_dict(port)
示例#25
0
 def update_network(self, tenant_id, net_id, **kwargs):
     db.validate_network_ownership(tenant_id, net_id)
     net = db.network_update(net_id, tenant_id, **kwargs)
     return self._make_net_dict(str(net.uuid), net.name, None,
                                net.op_status)