コード例 #1
0
ファイル: discovery.py プロジェクト: tubbytani/python-rdma
def _subnet_fill_LIDs_SA(sched,sbn,LMC):
    """Coroutine to ask the SA for all the PortInfo's with LMC=LMC."""
    pinf = IBA.ComponentMask(IBA.SAPortInfoRecord())
    pinf.portInfo.LMC = LMC;
    res = yield sched.SubnAdmGetTable(pinf);
    if res:
        sbn.set_max_lid(max(I.endportLID for I in res));
    for I in res:
        assert I.endportLID == I.portInfo.LID;
        sbn.get_port_pinf(pinf,portIdx=I.portNum);
コード例 #2
0
    def SubnGet(self,payload,path,attributeModifier=0):
        ID = payload.MAD_ATTRIBUTE_ID;
        meth = payload.MAD_SUBNGET;
        if ID == IBA.SMPGUIDInfo.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SAGUIDInfoRecord());
            req.LID = self.get_path_lid(path);
            req.blockNum = attributeModifier;
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     lambda x:x.GUIDInfo);
        if ID == IBA.SMPLinearForwardingTable.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SALinearForwardingTableRecord());
            req.LID = self.get_path_lid(path);
            req.blockNum = attributeModifier;
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     (lambda x:x.linearForwardingTable,
                                      self._sa_error));
        if ID == IBA.SMPMulticastForwardingTable.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SAMulticastForwardingTableRecord());
            req.LID = self.get_path_lid(path);
            req.blockNum = attributeModifier & ((1<<9)-1);
            req.position = (attributeModifier >> 12) & 0xF;
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     (lambda x:x.multicastForwardingTable,
                                      self._sa_error));
        if ID == IBA.SMPNodeDescription.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SANodeRecord());
            req.LID = self.get_path_lid(path);
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     self._finish_nodedesc);
        if ID == IBA.SMPNodeInfo.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SANodeRecord());
            req.LID = self.get_path_lid(path);
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     self._finish_nodeinfo);

        if ID == IBA.SMPPKeyTable.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SAPKeyTableRecord());
            req.LID = self.get_path_lid(path);
            nt = getattr(path,"_cached_node_type",None);
            if nt is None or nt == IBA.NODE_SWITCH:
                req.portNum = attributeModifier >> 16;
            req.blockNum = attributeModifier & 0xFFFF;
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     (lambda x:x.PKeyTable,
                                      self._sa_error));

        if ID == IBA.SMPPortInfo.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SAPortInfoRecord());
            req.endportLID = self.get_path_lid(path);
            if (attributeModifier == 0 and
                getattr(path,"_cached_node_type",None) != IBA.NODE_SWITCH):
                # This can mean 'whatever port' or it can mean 'switch port 0'
                # If we don't know the node type then do a get table and
                # figure it out.
                return self._subn_adm_do(req,self.sa_path,0,
                                         req.MAD_SUBNADMGETTABLE,
                                         self._finish_port_info_attr0);

            req.portNum = attributeModifier;
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     lambda x:x.portInfo);
        if ID == IBA.SMPSLToVLMappingTable.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SASLToVLMappingTableRecord());
            req.LID = self.get_path_lid(path);
            req.inputPortNum = (attributeModifier >> 8) & 0xFF;
            req.outputPortNum = attributeModifier & 0xFF;
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     (lambda x:x.SLToVLMappingTable,
                                      self._sa_error));
        if ID == IBA.SMPSMInfo.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SASMInfoRecord());
            req.LID = self.get_path_lid(path);
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     lambda x:x.SMInfo);
        if ID == IBA.SMPSwitchInfo.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SASwitchInfoRecord());
            req.LID = self.get_path_lid(path);
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     lambda x:x.switchInfo);
        if ID == IBA.SMPVLArbitrationTable.MAD_ATTRIBUTE_ID:
            req = IBA.ComponentMask(IBA.SAVLArbitrationTableRecord());
            req.LID = self.get_path_lid(path);
            req.outputPortNum = attributeModifier & 0xFFFF;
            req.blockNum = (attributeModifier >> 16) & 0xFFFF;
            return self._subn_adm_do(req,self.sa_path,0,
                                     req.MAD_SUBNADMGET,
                                     (lambda x:x.VLArbitrationTable,
                                      self._sa_error));

        return self._parent.SubnGet(payload,path,attributeModifier);