def setUpClass(cls): # Load the list of CBSD records with registration and grant details cbsd_filename = ['cbsd_uut_ut.json', 'cbsd_th1_ut.json'] cbsd_list = [] for cbsd_file in cbsd_filename: cbsd_record = json.load(open(os.path.join(TEST_DIR, cbsd_file))) cbsd_list.append(cbsd_record) cls.cbsd_list = data.getAllGrantInfoFromCbsdDataDump(cbsd_list) # Load the protection entity data with overlapping frequency of CBSD grants cls.fss_record = json.load(open(os.path.join(TEST_DIR, 'fss_ut.json'))) cls.ppa_record = json.load(open(os.path.join(TEST_DIR, 'ppa_ut.json'))) cls.ppa_cbsd_list = data.getAllGrantInfoFromCbsdDataDump( cbsd_list, ppa_record=cls.ppa_record) cls.pal_record = json.load(open(os.path.join(TEST_DIR, 'pal_ut.json'))) cls.gwpz_record = json.load( open(os.path.join(TEST_DIR, 'gwpz_ut.json'))) cls.esc_record = json.load(open(os.path.join(TEST_DIR, 'esc_ut.json')))
def _McpConfigRead(config): """Extracts DPA and grants from MCP config JSON. Note: returns all grants involved in the test irrespective of iteration process. Args: config: A JSON dictionary. Returns: A tuple (dpas, grants) where: dpas: a list of objects of type |dpa_mgr.Dpa|. grants: a list of |data.CbsdGrantInfo|. """ if ('iterationData' not in config or 'dpas' not in config or 'initialCbsdRequestsWithDomainProxies' not in config): raise ValueError( 'Unsupported config file. Please use a MCP1 config file') # Build the DPAs. dpas = [] for dpa_id, dpa_data in config['dpas'].items(): dpa = dpa_mgr.BuildDpa( dpa_id, protection_points_method=dpa_data['points_builder']) # - add extra properties for the geometry and margin. dpa.margin_db = dpa_data['movelistMargin'] try: dpa_zone = zones.GetCoastalDpaZones()[dpa_id] except KeyError: dpa_zone = zones.GetPortalDpaZones(kml_path=dpa_kml_file)[dpa_id] dpa.geometry = dpa_zone.geometry # - read also the activation list and freq range. dpa.activation = None for iter_data in config['iterationData']: for activation in iter_data['dpaActivationList']: if activation['dpaId'] == dpa_id: dpa.activation = activation['frequencyRange'] break dpas.append(dpa) # Read the CBSDs, assuming all granted, into list of |CbsdGrantInfo|. # - initial stuff into SAS UUT grants = [] for records in config['initialCbsdRequestsWithDomainProxies']: grant_requests = records['grantRequests'] reg_requests = MergeConditionalData( records['registrationRequests'], records['conditionalRegistrationData']) grants.extend( data.getGrantsFromRequests(reg_requests, grant_requests, is_managing_sas=True)) for record in config['initialCbsdRecords']: grant_request = [record['grantRequest']] reg_request = MergeConditionalData( [record['registrationRequest']], [record['conditionalRegistrationData']]) grants.append( data.getGrantsFromRequests(reg_requests, grant_requests, is_managing_sas=True)) # - then iterations for TH and UUT for iter_data in config['iterationData']: for th_data in iter_data['sasTestHarnessData']: th_grants = data.getAllGrantInfoFromCbsdDataDump( th_data['cbsdRecords'], is_managing_sas=False) grants.extend([g for g in th_grants]) for records in iter_data['cbsdRequestsWithDomainProxies']: grant_requests = records['grantRequests'] reg_requests = MergeConditionalData( records['registrationRequests'], records['conditionalRegistrationData']) uut_grants = data.getGrantsFromRequests(reg_requests, grant_requests, is_managing_sas=True) grants.extend([g for g in uut_grants]) for record in iter_data['cbsdRecords']: grant_request = [record['grantRequest']] reg_request = MergeConditionalData( [record['registrationRequest']], [record['conditionalRegistrationData']]) uut_grant = data.getGrantsFromRequests(reg_requests, grant_requests, is_managing_sas=True) grants.append(uut_grant) return grants, dpas
def _IprConfigRead(config): """Extracts DPA and grants from IPR config JSON. Note: All IPT suppprted except IPR1. Args: config: A JSON dictionary. Returns: A tuple (dpas, grants) where: dpas: a list of objects of type |dpa_mgr.Dpa|. grants: a list of |data.CbsdGrantInfo|. """ dpa_cfgs = None if 'portalDpa' in config: dpa_cfgs = [config['portalDpa']] elif 'escDpa' in config: dpa_cfgs = [config['escDpa']] if dpa_cfgs is None: if 'dpas' in config: dpa_cfgs = config['dpas'] elif 'dpa' in config: dpa_cfgs = [config['dpa']] if dpa_cfgs is None or ('domainProxies' not in config and 'registrationRequest' not in config): raise ValueError( 'Unsupported config file. Please use a IPR config file') # Build the DPAs dpas = [] for dpa_cfg in dpa_cfgs: dpa_id = dpa_cfg['dpaId'] try: dpa_kml_file = config['dpaDatabaseConfig']['filePath'] except KeyError: dpa_kml_file = None try: points_builder = dpa_cfg['points_builder'] except KeyError: points_builder = None try: dpa = dpa_mgr.BuildDpa(dpa_id, protection_points_method=points_builder, portal_dpa_filename=dpa_kml_file) except IOError: print('Portal KML File not found: %s ' % dpa_kml_file) raise try: freq_range_mhz = (dpa_cfg['frequencyRange']['lowFrequency'] / 1.e6, dpa_cfg['frequencyRange']['highFrequency'] / 1.e6) dpa.ResetFreqRange([freq_range_mhz]) except KeyError: pass # - add extra properties for the geometry and margin try: dpa.margin_db = dpa_cfg['movelistMargin'] except KeyError: dpa_margin_db = 'linear(1.5)' try: dpa_zone = zones.GetCoastalDpaZones()[dpa_id] except KeyError: dpa_zone = zones.GetPortalDpaZones(kml_path=dpa_kml_file)[dpa_id] dpa.geometry = dpa_zone.geometry dpas.append(dpa) # Read the CBSDs, assuming all granted, into list of |CbsdGrantInfo|. grants = [] if 'domainProxies' in config: # - first the SAS UUT for domain_proxy_config in config['domainProxies']: grant_requests = domain_proxy_config['grantRequests'] reg_requests = MergeConditionalData( domain_proxy_config['registrationRequests'], domain_proxy_config['conditionalRegistrationData']) grants.extend( data.getGrantsFromRequests(reg_requests, grant_requests, is_managing_sas=True)) # - now the peer SASes. if 'sasTestHarnessConfigs' in config: for th_config in config['sasTestHarnessConfigs']: dump_records = th_config['fullActivityDumpRecords'][0] grants.extend( data.getAllGrantInfoFromCbsdDataDump( dump_records, is_managing_sas=False)) elif 'registrationRequest' in config: grants.extend( data.getGrantsFromRequests( MergeConditionalData([config['registrationRequest']], [config['conditionalRegistrationData']]), [config['grantRequest']], is_managing_sas=True)) return grants, dpas
for fss_record in fss_list: # Get the frequency range of the FSS fss_freq_range = fss_record['record']['deploymentParam'][0]\ ['operationParam']['operationFrequencyRange'] fss_low_freq = fss_freq_range['lowFrequency'] fss_high_freq = fss_freq_range['highFrequency'] # Get FSS T&C Flag value fss_ttc_flag = fss_record['ttc'] # FSS Passband is between 3600 and 4200 if (fss_low_freq >= interf.FSS_LOW_FREQ_HZ and fss_low_freq < interf.CBRS_HIGH_FREQ_HZ): fss_cochannel_aggr_interference = aggregate_interference.\ calculateAggregateInterferenceForFssCochannel(fss_record, data.getAllGrantInfoFromCbsdDataDump(cbsd_list)) print('Aggregate Interference (mW) output at FSS co-channel: ' + str(CvtToList(fss_cochannel_aggr_interference))) fss_blocking_aggr_interference = aggregate_interference.\ calculateAggregateInterferenceForFssBlocking(fss_record, data.getAllGrantInfoFromCbsdDataDump(cbsd_list)) print('\nAggregate Interference (mW) output at FSS blocking: \n' + str(CvtToList(fss_blocking_aggr_interference))) # FSS Passband is between 3700 and 4200 and TT&C flag is set to TRUE elif (fss_low_freq >= interf.FSS_TTC_LOW_FREQ_HZ and fss_high_freq <= interf.FSS_TTC_HIGH_FREQ_HZ and fss_ttc_flag is True): fss_blocking_aggr_interference = aggregate_interference.\ calculateAggregateInterferenceForFssBlocking(fss_record, data.getAllGrantInfoFromCbsdDataDump(cbsd_list)) print('\nAggregate Interference (mW) output at FSS blocking: \n' + str(CvtToList(fss_blocking_aggr_interference)))
for fss_record in fss_list: # Get the frequency range of the FSS fss_freq_range = fss_record['record']['deploymentParam'][0]\ ['operationParam']['operationFrequencyRange'] fss_low_freq = fss_freq_range['lowFrequency'] fss_high_freq = fss_freq_range['highFrequency'] # Get FSS T&C Flag value fss_ttc_flag = fss_record['ttc'] # FSS Passband is between 3600 and 4200 if (fss_low_freq >= interf.FSS_LOW_FREQ_HZ and fss_low_freq < interf.CBRS_HIGH_FREQ_HZ): fss_cochannel_aggr_interference = aggregate_interference.\ calculateAggregateInterferenceForFssCochannel( fss_record, data.getAllGrantInfoFromCbsdDataDump(cbsd_list)) print( 'Aggregate Interference (mW) output at FSS co-channel: %s\n' % (CvtToList(fss_cochannel_aggr_interference))) fss_blocking_aggr_interference = aggregate_interference.\ calculateAggregateInterferenceForFssBlocking( fss_record, data.getAllGrantInfoFromCbsdDataDump(cbsd_list)) print( '\nAggregate Interference (mW) output at FSS blocking: %s\n' % (CvtToList(fss_blocking_aggr_interference))) # FSS Passband is between 3700 and 4200 and TT&C flag is set to TRUE elif (fss_low_freq >= interf.FSS_TTC_LOW_FREQ_HZ and fss_high_freq <= interf.FSS_TTC_HIGH_FREQ_HZ and fss_ttc_flag is True): fss_blocking_aggr_interference = aggregate_interference.\