Example #1
0
 def _get_LFDB_SA(self, sched, path):
     """Coroutine to fetch the entire LFDB from the SA"""
     req = IBA.ComponentMask(IBA.SALinearForwardingTableRecord())
     req.LID = sched.get_path_lid(path)
     res = yield sched.SubnAdmGetTable(req)
     for I in res:
         idx = I.blockNum
         self.lfdb[idx * 64:idx * 64 + 64] = bytearray(
             I.linearForwardingTable.portBlock)
Example #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);