Example #1
0
    def get_network_details(self, tenant_id, netw_id):
        """
        Retrieves a list of all the remote vifs that
        are attached to the network.

        :returns: a sequence of mappings with the following signature:
                    {'net-id': uuid that uniquely identifies the
                                particular quantum network
                     'net-name': a human-readable name associated
                                 with network referenced by net-id
                     'net-ifaces': ['vif1_on_network_uuid',
                                    'vif2_on_network_uuid',...,'vifn_uuid']
                   }
        :raises: exception.NetworkNotFound
        :raises: exception.QuantumException
        """
        if not nvplib.check_tenant(self.controller, netw_id, tenant_id):
            raise exception.NetworkNotFound(net_id=netw_id)
        result = None
        remote_vifs = []
        switch = netw_id
        lports = nvplib.query_ports(self.controller, switch, relations="LogicalPortAttachment")

        for port in lports:
            relation = port["_relations"]
            vic = relation["LogicalPortAttachment"]
            if "vif_uuid" in vic:
                remote_vifs.append(vic["vif_uuid"])

        if not result:
            result = nvplib.get_network(self.controller, switch)

        d = {"net-id": netw_id, "net-ifaces": remote_vifs, "net-name": result["display_name"], "net-op-status": "UP"}
        LOG.debug("get_network_details() completed for tenant %s: %s" % (tenant_id, d))
        return d
Example #2
0
 def _get_lswitch_cluster_pairs(self, netw_id, tenant_id):
     """Figure out the set of lswitches on each cluster that maps to this
        network id"""
     pairs = []
     for c in self.clusters:
         lswitches = []
         try:
             ls = nvplib.get_network(c, netw_id)
             lswitches.append(ls['uuid'])
         except exception.NetworkNotFound:
             continue
         pairs.append((c, lswitches))
     if len(pairs) == 0:
         raise exception.NetworkNotFound(net_id=netw_id)
     LOG.debug("Returning pairs for network: %s" % (pairs))
     return pairs
Example #3
0
 def _get_lswitch_cluster_pairs(self, netw_id, tenant_id):
     """Figure out the set of lswitches on each cluster that maps to this
        network id"""
     pairs = []
     for c in self.clusters:
         lswitches = []
         try:
             ls = nvplib.get_network(c, netw_id)
             lswitches.append(ls['uuid'])
         except exception.NetworkNotFound:
             continue
         pairs.append((c, lswitches))
     if len(pairs) == 0:
         raise exception.NetworkNotFound(net_id=netw_id)
     LOG.debug("Returning pairs for network: %s" % (pairs))
     return pairs
Example #4
0
    def get_network_details(self, tenant_id, netw_id):
        """
        Retrieves a list of all the remote vifs that
        are attached to the network.

        :returns: a sequence of mappings with the following signature:
                    {'net-id': uuid that uniquely identifies the
                                particular quantum network
                     'net-name': a human-readable name associated
                                 with network referenced by net-id
                     'net-ifaces': ['vif1_on_network_uuid',
                                    'vif2_on_network_uuid',...,'vifn_uuid']
                   }
        :raises: exception.NetworkNotFound
        :raises: exception.QuantumException
        """
        if not nvplib.check_tenant(self.controller, netw_id, tenant_id):
            raise exception.NetworkNotFound(net_id=netw_id)
        result = None
        remote_vifs = []
        switch = netw_id
        lports = nvplib.query_ports(self.controller,
                                    switch,
                                    relations="LogicalPortAttachment")

        for port in lports:
            relation = port["_relations"]
            vic = relation["LogicalPortAttachment"]
            if "vif_uuid" in vic:
                remote_vifs.append(vic["vif_uuid"])

        if not result:
            result = nvplib.get_network(self.controller, switch)

        d = {
            "net-id": netw_id,
            "net-ifaces": remote_vifs,
            "net-name": result["display_name"],
            "net-op-status": "UP",
        }
        LOG.debug("get_network_details() completed for tenant %s: %s" %
                  (tenant_id, d))
        return d