Beispiel #1
0
    def createPG(self, serialNbr=None, modelNbr=None, wac=None, centerFrequency=None):
        """
        Create a PG. This PG is not registered anywhere with the application or
        otherwise. Its usage is likely only for initializing PG hardware.
        
        When no model number is passed, pg model number (implantable) provided 
        in the testContext argument will be used. When no wakeUpAccessCode is 
        passed, the default wac is assigned to device object.  When no 
        centerFrequency is passed, default centerFrequency from the komodors.ini 
        file is assigned to device object. When no serial number is passed, a
        random number is assigned

        @type serialNbr: C{str}
        @param serialNbr: Serial Number of device.  Defaults to None.  
                          If None is passed an unused serial number is assigned 
                          to device.
        
        @type modelNbr: C{str}
        @param modelNbr: Model number of device to be created.  Defaults to None.
                         If None is passed, implantable provided in command line 
                         argument is used as model number.
            
        @rtype: C{L{PGEntity<komodors.entities.PGEntity>}}
        @return: KomodoRS PGEntity object
        
        @raise IncompatibleModelError: If pg model model number passed is not 
                                       compatible with the external provided in 
                                       the testContext.

        """
        if modelNbr is None:
            modelNbr = self.context["implantable"]
        else:
            # Validate the model number. IncompatibleModelError will be raised
            # if implantable is not compatible with external
            loadProductLineModel(external=self.context["external"], implantable=modelNbr)

        # Get KomodoRS device object
        logger.info("Creating a PG entity with model = %s" % modelNbr)
        return PGEntity(model=modelNbr, serial=serialNbr, rfCenterFrequency=centerFrequency, wakeUpAccessCode=wac)
Beispiel #2
0
    eplm.save()
    extplms.append(eplm)

all_externals = [(v, geographies[i], comm_nbrs[i], extplms[i]) for i,v in enumerate(comm_models) ]

# ExternalCountryPLM (same countries as Dragon 2)
for extd3 in all_externals:
    # Find all the external/country plm matches for a given geog/external
    # ex. DAU3.0-6290 -> search for 'AU' and '6290' and get Australia and New Zealand
    ecplmsd2 = ExternalCountryPLM.active.filter(project=dragon2)\
                                        .filter(external__external__icontains=extd3[1])\
                                        .filter(external__external__icontains=extd3[2])
    
    # Loop through the countries that were found and create a new ExternalCountryPLMs for Dragon 3
    for ecplmd2 in ecplmsd2:
        newEcplm = ExternalCountryPLM(project=dragon3, external=extd3[3], country=ecplmd2.country)
        newEcplm.save()
        
# PLM
for extd3 in all_externals:
    loadProductLineModel(external=extd3[0], location=PLECONFIG_DIR)
    pgs = getSupportedPGModels()
    pgs.sort()              
    # Add empty PG model for each external, since this is a fortyTwo 'feature'
    pgs.append('null')
    
    for pg in pgs:
        print pg, extd3[0], extd3[1], extd3[2]
        plm = PLM(project=dragon3, geography=extd3[1], comm_model=extd3[0], comm_nbr=extd3[2], pg_model=pg)
        plm.save()