def generate_PCR_6_default_config(self, filename): """Generate the WinnForum configuration for PCR 6.""" # File path where SAS UUT claimed ppa boundary generated in PCR.1 test pcr_1_test_config_file_path = os.path.join('testcases', 'configs', 'test_WINNF_FT_S_PCR_1', 'default.config') sas_uut_claimed_ppa_boundary_file_path = getSasUutClaimedPpaBoundaryFilePath( 'default.config') # Load SAS UUT claimed ppa boundary and check if any error while retrieving # SAS UUT claimed ppa boundary generated in PCR.1 test. try: with open(sas_uut_claimed_ppa_boundary_file_path, 'r') as claimed_ppa_file: user_claimed_ppa_contour = json.load(claimed_ppa_file) except IOError: raise RuntimeError( 'ConfigError:There is an error in reading path:%s \n\n' % sas_uut_claimed_ppa_boundary_file_path) # Expand the user claimed ppa boundary by approximately 1 kilometer. user_claimed_ppa_contour_feature_collection = utils.InsureFeatureCollection( utils.ShrinkAndCleanPolygon( user_claimed_ppa_contour['features'][0]['geometry'], -1e-2), as_dict=True) # Create the actual config. config = { 'configPCR_1': pcr_1_test_config_file_path, 'userClaimedPpaContour': user_claimed_ppa_contour_feature_collection } writeConfig(filename, config)
def generate_PCR_5_default_config(self, filename): """Generate the WinnForum configuration for PCR 5.""" # Load PAL records. pal_record_1 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_1.json'))) pal_record_2 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_2.json'))) # Use the FIPS codes of adjacent census tracts. pal_record_1['fipsCode'] = 20063955100 pal_record_2['fipsCode'] = 20063955200 # Set the PAL frequency. pal_low_frequency = 3570000000 pal_high_frequency = 3580000000 # Load device info. device_a = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) device_b = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # light check to ensure CBSD userId is not same. self.assertNotEqual(device_a['userId'], device_b['userId']) # The userId of at least one of the CBSDs is not associated to the userId of # the PAL Holder configured in the PAL record for this service area. pal_records = makePalRecordsConsistent([pal_record_1, pal_record_2], pal_low_frequency, pal_high_frequency, device_a['userId']) # CBSDs are located inside the service area. device_a['installationParam']['latitude'], device_a[ 'installationParam']['longitude'] = 39.0373, -100.4184 device_b['installationParam']['latitude'], device_b[ 'installationParam']['longitude'] = 39.0378, -100.4785 conditionals_b = { 'cbsdCategory': device_b['cbsdCategory'], 'fccId': device_b['fccId'], 'cbsdSerialNumber': device_b['cbsdSerialNumber'], 'airInterface': device_b['airInterface'], 'installationParam': device_b['installationParam'], 'measCapability': device_b['measCapability'] } conditionals = [conditionals_b] del device_b['installationParam'] del device_b['cbsdCategory'] del device_b['airInterface'] del device_b['measCapability'] # Create the actual config. devices = [device_a, device_b] config = { 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, 'palRecords': pal_records } writeConfig(filename, config)
def generate_FT_S_PAT_default_config(self, filename): """Generates the WinnForum configuration for PAT.1.""" # Load Devices device_a = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) # load FSS fss_data = json.load( open(os.path.join('testcases', 'testdata', 'fss_record_0.json'))) fss_record_0 = fss_data['record'] fss_record_0['rxAntennaGainRequired'] = True reliability_level = -1 config = [] config.append({ 'reliabilityLevel': reliability_level, 'cbsd': cbsddata(device_a), 'fss': fssdata(fss_record_0, True) }) # Load PPA ppa_record = json.load( open(os.path.join('testcases', 'testdata', 'ppa_record_3.json'))) reliability_level = -1 config.append({ 'reliabilityLevel': reliability_level, 'cbsd': cbsddata(device_a), 'ppa': ppa_record['zone']['features'][0] }) writeConfig(filename, config)
def generate_HBT_10_default_config(self, filename): """Generates the WinnForum configuration for HBT.10.""" # Load device info device_a = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) device_c = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) device_b = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # Load grant.json grant_a = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_c = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_b = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) heartbeat_a = {'operationState': 'GRANTED'} heartbeat_c = {'grantId': 'REMOVE', 'operationState': 'GRANTED'} heartbeat_b = {'operationState': 'GRANTED', 'grantRenew': True} # Device a and device_c are Cat A. self.assertEqual(device_a['cbsdCategory'], 'A') self.assertEqual(device_c['cbsdCategory'], 'A') # Device_b is Category B with conditionals pre-loaded. self.assertEqual(device_b['cbsdCategory'], 'B') conditionals_b = { 'cbsdCategory': device_b['cbsdCategory'], 'fccId': device_b['fccId'], 'cbsdSerialNumber': device_b['cbsdSerialNumber'], 'airInterface': device_b['airInterface'], 'installationParam': device_b['installationParam'] } conditionals = [conditionals_b] del device_b['installationParam'] del device_b['cbsdCategory'] del device_b['airInterface'] # Create the actual config. devices = [device_a, device_c, device_b] blacklist_devices = [device_a] grant_requests = [grant_a, grant_c, grant_b] heartbeat_requests = [heartbeat_a, heartbeat_c, heartbeat_b] config = { 'fccIdsBlacklist': [d['fccId'] for d in blacklist_devices], 'conditionalRegistrationData': conditionals, 'registrationRequests': devices, 'grantRequests': grant_requests, 'heartbeatRequests': heartbeat_requests, # First request has a blacklisted CBSD => BLACKLISTED # Second request is missing Grant ID => MISSING_PARAM # Third request has all valid params => SUCCESS 'expectedResponseCodes': [(101, ), (102, ), (0, )] } writeConfig(filename, config)
def generate_SDS_10_default_config(self, filename): """Generates the WinnForum configuration for SDS_10. """ # Create the actual config for domain proxy cert/key path config = { 'domainProxyCert': getCertFilename("domain_proxy_wrong_type.cert"), 'domainProxyKey': getCertFilename("server.key") } writeConfig(filename, config)
def generate_SCS_11_default_config(self, filename): """Generate the WinnForum configuration for SCS_11.""" # Create the configuration for blacklisted client cert/key path config = { 'clientCert': getCertFilename("device_blacklisted.cert"), 'clientKey': getCertFilename("device_blacklisted.key") } writeConfig(filename, config)
def generate_SCS_16_default_config(self, filename): """Generate the WinnForum configuration for SCS_16.""" # Create the configuration for client cert/key path. config = { 'clientCert': getCertFilename("device_cert_from_revoked_ca.cert"), 'clientKey': getCertFilename("device_cert_from_revoked_ca.key") } writeConfig(filename, config)
def generate_SDS_12_default_config(self, filename): """Generates the WinnForum configuration for SDS.12""" # Create the actual config for domain proxy cert/key path config = { 'domainProxyCert': getCertFilename("domain_proxy_expired.cert"), 'domainProxyKey': getCertFilename("domain_proxy_expired.key") } writeConfig(filename, config)
def generate_SSS_11_default_config(self, filename): """Generate the WinnForum configuration for SSS_11.""" # Create the configuration for blacklisted SAS cert/key path. config = { 'sasCert': getCertFilename("sas_blacklisted.cert"), 'sasKey': getCertFilename("sas_blacklisted.key") } writeConfig(filename, config)
def generate_SCS_15_default_config(self, filename): """ Generates the WinnForum configuration for SCS.15 """ # Create the actual config for client cert/key path config = { 'clientCert': getCertFilename("device_inapplicable.cert"), 'clientKey': getCertFilename("device_a.key") } writeConfig(filename, config)
def generate_SSS_15_default_config(self, filename): """Generates the WinnForum configuration for SSS_15. """ # Create the actual config for SAS cert/key path config = { 'sasCert': getCertFilename("sas_inapplicable.cert"), 'sasKey': getCertFilename("sas.key") } writeConfig(filename, config)
def generate_SCS_7_default_config(self, filename): """Generates the WinnForum configuration for SCS_7""" # Create the actual config for client cert/key path config = { 'clientCert': getCertFilename("device_corrupted.cert"), 'clientKey': getCertFilename("device_corrupted.key") } writeConfig(filename, config)
def generate_SSS_6_default_config(self, filename): """Generates the WinnForum configuration for SSS_6""" # Create the actual config for SAS cert/key path config = { 'sasCert': getCertFilename("unrecognized_sas.cert"), 'sasKey': getCertFilename("unrecognized_sas.key") } writeConfig(filename, config)
def generate_SSS_16_default_config(self, filename): """Generate the WinnForum configuration for SSS_16.""" # Create the configuration for SAS cert/key path. config = { 'sasCert': getCertFilename("sas_cert_from_revoked_ca.cert"), 'sasKey': getCertFilename("sas_cert_from_revoked_ca.key") } writeConfig(filename, config)
def generate_SSS_10_default_config(self, filename): """Generates the WinnForum configuration for SSS_10. """ # Create the actual config for SAS cert/key path config = { 'sasCert': getCertFilename("sas_wrong_type.cert"), 'sasKey': getCertFilename("device_a.key") } writeConfig(filename, config)
def generate_SCS_6_default_config(self, filename): """Generates the WinnForum configuration for SCS_6""" # Create the actual config for client cert/key path config = { 'clientCert': getCertFilename("unrecognized_device.cert"), 'clientKey': getCertFilename("unrecognized_device.key") } writeConfig(filename, config)
def generate_SCS_10_default_config(self, filename): """Generates the WinnForum configuration for SCS_10. """ # Create the actual config for client cert/key path config = { 'clientCert': getCertFilename("device_wrong_type.cert"), 'clientKey': getCertFilename("server.key") } writeConfig(filename, config)
def generate_SDS_6_default_config(self, filename): """Generates the WinnForum configuration for SDS_6""" # Create the actual config for domain proxy cert/key path config = { 'domainProxyCert': getCertFilename("unrecognized_domain_proxy.cert"), 'domainProxyKey': getCertFilename("unrecognized_domain_proxy.key") } writeConfig(filename, config)
def generate_SDS_11_default_config(self, filename): """Generate the WinnForum configuration for SDS_11.""" # Create the configuration for blacklisted domain proxy cert/key path. config = { 'domainProxyCert': getCertFilename("domain_proxy_blacklisted.cert"), 'domainProxyKey': getCertFilename("domain_proxy_blacklisted.key") } writeConfig(filename, config)
def generate_SDS_16_default_config(self, filename): """Generate the WinnForum configuration for SDS_16.""" # Create the configuration for domain proxy cert/key path. config = { 'domainProxyCert': getCertFilename("domain_proxy_cert_from_revoked_ca.cert"), 'domainProxyKey': getCertFilename("domain_proxy_cert_from_revoked_ca.key") } writeConfig(filename, config)
def generate_QPR_8_default_config(self, filename): """Generates the WinnForum configuration for QPR.8.""" # Load device info # Cat B - between 2.4 km - 4.8 km of Waipahu, Hawaii Field Office. device_b = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) device_b['installationParam']['latitude'] = 21.397934 device_b['installationParam']['longitude'] = -158.034459 # device_b is Category B with conditionals pre-loaded. self.assertEqual(device_b['cbsdCategory'], 'B') conditionals_b = { 'cbsdCategory': device_b['cbsdCategory'], 'fccId': device_b['fccId'], 'cbsdSerialNumber': device_b['cbsdSerialNumber'], 'airInterface': device_b['airInterface'], 'installationParam': device_b['installationParam'], 'measCapability': device_b['measCapability'] } del device_b['installationParam'] del device_b['cbsdCategory'] del device_b['airInterface'] del device_b['measCapability'] # Grant Requests grant_0 = { 'operationParam': { 'maxEirp': 35, 'operationFrequencyRange': { 'lowFrequency': 3650000000, 'highFrequency': 3660000000 } } } grant_1 = { 'operationParam': { 'maxEirp': 35, 'operationFrequencyRange': { 'lowFrequency': 3660000000, 'highFrequency': 3670000000 } } } # Create the actual config. config = { 'registrationRequest': device_b, 'conditionalRegistrationData': [conditionals_b], 'grantRequest1': grant_0, 'grantRequest2': grant_1 } writeConfig(filename, config)
def generate_REG_13_default_config(self, filename): """Generates the WinnForum configuration for REG.13.""" # Load device info device_a = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) # Create the actual config. devices = [device_a] config = { 'fccIds': [(d['fccId'], 47) for d in devices], 'userIds': [d['userId'] for d in devices], 'registrationRequests': devices, # Configure SAS version to a higher than supported version. 'sasVersion': 'v5.0' } writeConfig(filename, config)
def generate_REG_11_default_config(self, filename): """Generates the WinnForum configuration for REG.11.""" # Load device info device_a = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) device_c = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) device_b = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) device_d = json.load( open(os.path.join('testcases', 'testdata', 'device_d.json'))) # Device #1 is Category A. self.assertEqual(device_a['cbsdCategory'], 'A') # Device #2 is Category A with one conditional parameter missing. self.assertEqual(device_c['cbsdCategory'], 'A') del device_c['installationParam']['indoorDeployment'] # Device #3 is Category B. self.assertEqual(device_b['cbsdCategory'], 'B') # Device #4 is Category B with one conditional missing and conditionals # pre-loaded. self.assertEqual(device_d['cbsdCategory'], 'B') conditionals_d = { 'cbsdCategory': device_d['cbsdCategory'], 'fccId': device_d['fccId'], 'cbsdSerialNumber': device_d['cbsdSerialNumber'], 'airInterface': device_d['airInterface'], 'installationParam': device_d['installationParam'] } del conditionals_d['installationParam']['antennaBeamwidth'] conditionals = [conditionals_d] # Create the actual config. devices = [device_a, device_c, device_b, device_d] config = { 'fccIds': [(d['fccId'], 47) for d in devices], 'userIds': [d['userId'] for d in devices], 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, 'expectedResponseCodes': [(0,), (200,), (103,), (103,)] } writeConfig(filename, config)
def generate_SSS_18_default_config(self, filename): """ Generates the WinnForum configuration for SSS.18 """ # Create the actual config for SAS cert/key path valid_cert_key_pair = { 'cert': getCertFilename('sas.cert'), 'key': getCertFilename('sas.key') } invalid_cert_key_pair = { 'cert': getCertFilename('sas_expired.cert'), 'key': getCertFilename('sas_expired.key') } config = { 'validCertKeyPair': valid_cert_key_pair, 'invalidCertKeyPair': invalid_cert_key_pair } writeConfig(filename, config)
def generate_QPR_2_default_config(self, filename): """Generates the WinnForum configuration for QPR.2.""" # Load device info # CBSD 1: Category A CBSD located within the boundary of the NRAO / NRRO # Quiet Zone. device_1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) device_1['installationParam']['latitude'] = 39.244586 device_1['installationParam']['longitude'] = -78.505269 # CBSD 2: Category B CBSD located within the boundary of the NRAO / NRRO # Quiet Zone. device_2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) device_2['installationParam']['latitude'] = 39.247287 device_2['installationParam']['longitude'] = -80.489236 # device_1 is Category A. self.assertEqual(device_1['cbsdCategory'], 'A') # device_2 is Category B with conditionals pre-loaded. self.assertEqual(device_2['cbsdCategory'], 'B') conditionals_2 = { 'cbsdCategory': device_2['cbsdCategory'], 'fccId': device_2['fccId'], 'cbsdSerialNumber': device_2['cbsdSerialNumber'], 'airInterface': device_2['airInterface'], 'installationParam': device_2['installationParam'], 'measCapability': device_2['measCapability'] } conditionals = [conditionals_2] del device_2['installationParam'] del device_2['cbsdCategory'] del device_2['airInterface'] del device_2['measCapability'] # Create the actual config. devices = [device_1, device_2] config = { 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, } writeConfig(filename, config)
def generate_QPR_6_default_config(self, filename): """Generates the WinnForum configuration for QPR.6.""" # Load device info # CBSD 1: Category A within 2.4 km of Waipahu, Hawaii FCC Field Office. device_1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) device_1['installationParam']['latitude'] = 21.377719 device_1['installationParam']['longitude'] = -157.973411 # CBSD 2: Category B within 2.4 km of Allegan, Michigan FCC Field Office. device_2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) device_2['installationParam']['latitude'] = 42.586213 device_2['installationParam']['longitude'] = -85.955594 # device_1 is Category A. self.assertEqual(device_1['cbsdCategory'], 'A') # device_2 is Category B with conditionals pre-loaded. self.assertEqual(device_2['cbsdCategory'], 'B') conditionals_2 = { 'cbsdCategory': device_2['cbsdCategory'], 'fccId': device_2['fccId'], 'cbsdSerialNumber': device_2['cbsdSerialNumber'], 'airInterface': device_2['airInterface'], 'installationParam': device_2['installationParam'], 'measCapability': device_2['measCapability'] } conditionals = [conditionals_2] del device_2['installationParam'] del device_2['cbsdCategory'] del device_2['airInterface'] del device_2['measCapability'] # Create the actual config. devices = [device_1, device_2] config = { 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, } writeConfig(filename, config)
def generate_REG_12_default_config(self, filename): """Generates the WinnForum configuration for REG.12.""" # Load device info device_a = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) device_b = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # Device_a is Category A. self.assertEqual(device_a['cbsdCategory'], 'A') # Device_b is Category B with conditionals pre-loaded. self.assertEqual(device_b['cbsdCategory'], 'B') conditionals_b = { 'cbsdCategory': device_b['cbsdCategory'], 'fccId': device_b['fccId'], 'cbsdSerialNumber': device_b['cbsdSerialNumber'], 'airInterface': device_b['airInterface'], 'installationParam': device_b['installationParam'] } conditionals = [conditionals_b] del device_b['cbsdCategory'] del device_b['airInterface'] del device_b['installationParam'] # Create the actual config. devices = [device_a, device_b] blacklist_devices = [device_a] reregister_devices = [device_a, device_b] config = { 'fccIds': [(d['fccId'], 47) for d in devices], 'fccIdsBlacklist': [d['fccId'] for d in blacklist_devices], 'userIds': [d['userId'] for d in devices], 'registrationRequests': devices, 'reregistrationRequests': reregister_devices, 'conditionalRegistrationData': conditionals, 'expectedResponseCodes': [(101,), (0,)] } writeConfig(filename, config)
def generate_GPR_1_default_config(self, filename): """ Generates the WinnForum configuration for GPR.1. """ # Load GWPZ Record gwpz_record_1 = json.load( open(os.path.join('testcases', 'testdata', 'gwpz_record_0.json'))) # Load devices info device_1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) # Moving device_1 to a location within 40 KMs of GWPZ zone device_1['installationParam']['latitude'] = 39.10448 device_1['installationParam']['longitude'] = -99.7792 device_2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # Moving device_2 to a location outside 40 KMs of GWPZ zone device_2['installationParam']['latitude'] = 37.83075 device_2['installationParam']['longitude'] = -107.65025 device_3 = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Moving device_3 to a location inside GWPZ zone device_3['installationParam']['latitude'], \ device_3['installationParam']['longitude'] = getRandomLatLongInPolygon(gwpz_record_1) device_4 = json.load( open(os.path.join('testcases', 'testdata', 'device_d.json'))) # Moving device_4 to a location outside 40 KMs of GWPZ zone device_4['installationParam']['latitude'] = 38.0934 device_4['installationParam']['longitude'] = -106.91676 # Load Grant requests grant_request_1 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_request_2 = json.load( open(os.path.join('testcases', 'testdata', 'grant_1.json'))) grant_request_3 = json.load( open(os.path.join('testcases', 'testdata', 'grant_2.json'))) grant_request_4 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) # device_b and device_d are Category B # Load Conditional Data self.assertEqual(device_2['cbsdCategory'], 'B') conditionals_device_2 = { 'cbsdCategory': device_2['cbsdCategory'], 'fccId': device_2['fccId'], 'cbsdSerialNumber': device_2['cbsdSerialNumber'], 'airInterface': device_2['airInterface'], 'installationParam': device_2['installationParam'], 'measCapability': device_2['measCapability'] } self.assertEqual(device_4['cbsdCategory'], 'B') conditionals_device_4 = { 'cbsdCategory': device_4['cbsdCategory'], 'fccId': device_4['fccId'], 'cbsdSerialNumber': device_4['cbsdSerialNumber'], 'airInterface': device_4['airInterface'], 'installationParam': device_4['installationParam'], 'measCapability': device_4['measCapability'] } # Remove conditionals from registration del device_2['cbsdCategory'] del device_2['airInterface'] del device_2['installationParam'] del device_2['measCapability'] del device_4['cbsdCategory'] del device_4['airInterface'] del device_4['installationParam'] del device_4['measCapability'] # Registration and grant records cbsd_records_domain_proxy_0 = { 'registrationRequests': [device_1, device_2], 'grantRequests': [grant_request_1, grant_request_2], 'conditionalRegistrationData': [conditionals_device_2] } cbsd_records_domain_proxy_1 = { 'registrationRequests': [device_3], 'grantRequests': [grant_request_3], 'conditionalRegistrationData': [] } # Protected entity record protected_entities = { 'gwpzRecords': [gwpz_record_1] } iteration_config = { 'cbsdRequestsWithDomainProxies': [cbsd_records_domain_proxy_0, cbsd_records_domain_proxy_1], 'cbsdRecords': [{ 'registrationRequest': device_4, 'grantRequest': grant_request_4, 'conditionalRegistrationData': conditionals_device_4, 'clientCert': getCertFilename('device_d.cert'), 'clientKey': getCertFilename('device_d.key') }], 'protectedEntities': protected_entities, 'dpaActivationList': [], 'dpaDeactivationList': [], 'sasTestHarnessData': [] } # Create the actual config. config = { 'initialCbsdRequestsWithDomainProxies': self.getEmptyCbsdRequestsWithDomainProxies(2), 'initialCbsdRecords': [], 'iterationData': [iteration_config], 'sasTestHarnessConfigs': [], 'domainProxyConfigs': [{ 'cert': getCertFilename('domain_proxy.cert'), 'key': getCertFilename('domain_proxy.key') }, { 'cert': getCertFilename('domain_proxy_1.cert'), 'key': getCertFilename('domain_proxy_1.key') }] } writeConfig(filename, config)
def generate_GPR_3_default_config(self, filename): """ Generates the WinnForum configuration for GPR.3 """ # Load GWPZ Record gwpz_record_1 = json.load( open(os.path.join('testcases', 'testdata', 'gwpz_record_0.json'))) # Load devices info device_1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) # Moving device_1 to a location inside GWPZ zone device_1['installationParam']['latitude'], \ device_1['installationParam']['longitude'] = getRandomLatLongInPolygon(gwpz_record_1) device_2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # Moving device_2 to a location inside GWPZ zone device_2['installationParam']['latitude'], \ device_2['installationParam']['longitude'] = getRandomLatLongInPolygon(gwpz_record_1) # Load Grant requests grant_request_1 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_request_1['operationParam']['operationFrequencyRange']['lowFrequency'] = 3650000000 grant_request_1['operationParam']['operationFrequencyRange']['highFrequency'] = 3655000000 grant_request_2 = json.load( open(os.path.join('testcases', 'testdata', 'grant_1.json'))) grant_request_2['operationParam']['operationFrequencyRange']['lowFrequency'] = 3660000000 grant_request_2['operationParam']['operationFrequencyRange']['highFrequency'] = 3665000000 # device_b is Category B # Load Conditional Data self.assertEqual(device_2['cbsdCategory'], 'B') conditionals_device_2 = { 'cbsdCategory': device_2['cbsdCategory'], 'fccId': device_2['fccId'], 'cbsdSerialNumber': device_2['cbsdSerialNumber'], 'airInterface': device_2['airInterface'], 'installationParam': device_2['installationParam'], 'measCapability': device_2['measCapability'] } conditionals = [conditionals_device_2] # Remove conditionals from registration del device_2['cbsdCategory'] del device_2['airInterface'] del device_2['installationParam'] del device_2['measCapability'] devices = [device_1, device_2] grants = [grant_request_1, grant_request_2] # Create the actual config. config = { 'registrationRequests': devices, 'grantRequests': grants, 'conditionalRegistrationData': conditionals, 'gwpzRecord': gwpz_record_1 } writeConfig(filename, config)
def generate_GPR_2_default_config(self, filename): """ Generates the WinnForum configuration for GPR.2. """ # Load GWPZ Record gwpz_record_1 = json.load( open(os.path.join('testcases', 'testdata', 'gwpz_record_0.json'))) # Load devices info device_1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) # Moving device_1 to a location within 40 KMs of GWPZ zone device_1['installationParam']['latitude'] = 39.10448 device_1['installationParam']['longitude'] = -99.7792 device_2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # Moving device_2 to a location outside 40 KMs of GWPZ zone device_2['installationParam']['latitude'] = 37.83075 device_2['installationParam']['longitude'] = -107.65025 device_3 = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Moving device_3 to a location inside GWPZ zone device_3['installationParam']['latitude'], \ device_3['installationParam']['longitude'] = getRandomLatLongInPolygon(gwpz_record_1) device_4 = json.load( open(os.path.join('testcases', 'testdata', 'device_d.json'))) # Moving device_4 to a location outside 40 KMs of GWPZ zone device_4['installationParam']['latitude'] = 38.0934 device_4['installationParam']['longitude'] = -106.91676 # Load Grant requests grant_request_1 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_request_1['operationParam']['operationFrequencyRange']['lowFrequency'] = 3650000000 grant_request_1['operationParam']['operationFrequencyRange']['highFrequency'] = 3655000000 grant_request_2 = json.load( open(os.path.join('testcases', 'testdata', 'grant_1.json'))) grant_request_2['operationParam']['operationFrequencyRange']['lowFrequency'] = 3660000000 grant_request_2['operationParam']['operationFrequencyRange']['highFrequency'] = 3665000000 grant_request_3 = json.load( open(os.path.join('testcases', 'testdata', 'grant_2.json'))) grant_request_3['operationParam']['operationFrequencyRange']['lowFrequency'] = 3670000000 grant_request_3['operationParam']['operationFrequencyRange']['highFrequency'] = 3680000000 grant_request_4 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_request_4['operationParam']['operationFrequencyRange']['lowFrequency'] = 3690000000 grant_request_4['operationParam']['operationFrequencyRange']['highFrequency'] = 3700000000 # device_b and device_d are Category B # Load Conditional Data self.assertEqual(device_2['cbsdCategory'], 'B') conditionals_device_2 = { 'cbsdCategory': device_2['cbsdCategory'], 'fccId': device_2['fccId'], 'cbsdSerialNumber': device_2['cbsdSerialNumber'], 'airInterface': device_2['airInterface'], 'installationParam': device_2['installationParam'], 'measCapability': device_2['measCapability'] } self.assertEqual(device_4['cbsdCategory'], 'B') conditionals_device_4 = { 'cbsdCategory': device_4['cbsdCategory'], 'fccId': device_4['fccId'], 'cbsdSerialNumber': device_4['cbsdSerialNumber'], 'airInterface': device_4['airInterface'], 'installationParam': device_4['installationParam'], 'measCapability': device_4['measCapability'] } # Remove conditionals from registration del device_2['cbsdCategory'] del device_2['airInterface'] del device_2['installationParam'] del device_2['measCapability'] del device_4['cbsdCategory'] del device_4['airInterface'] del device_4['installationParam'] del device_4['measCapability'] # Registration and grant records cbsd_records_domain_proxy_0 = { 'registrationRequests': [device_1, device_2], 'grantRequests': [grant_request_1, grant_request_2], 'conditionalRegistrationData': [conditionals_device_2] } cbsd_records_domain_proxy_1 = { 'registrationRequests': [device_3], 'grantRequests': [grant_request_3], 'conditionalRegistrationData': [] } # Protected entity record protected_entities = { 'gwpzRecords': [gwpz_record_1] } # SAS Test Harnesses configurations, # Following configurations are for two SAS test harnesses sas_test_harness_device_1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) sas_test_harness_device_1['fccId'] = "test_fcc_id_e" sas_test_harness_device_1['userId'] = "test_user_id_e" sas_test_harness_device_2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) sas_test_harness_device_2['fccId'] = "test_fcc_id_f" sas_test_harness_device_2['userId'] = "test_user_id_f" sas_test_harness_device_3 = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) sas_test_harness_device_3['fccId'] = "test_fcc_id_g" sas_test_harness_device_3['userId'] = "test_user_id_g" # Generate Cbsd FAD Records for SAS Test Harness 0 cbsd_fad_records_sas_test_harness_0 = generateCbsdRecords( [sas_test_harness_device_1], [[grant_request_1]] ) # Generate Cbsd FAD Records for SAS Test Harness 1 cbsd_fad_records_sas_test_harness_1 = generateCbsdRecords( [sas_test_harness_device_2, sas_test_harness_device_3], [[grant_request_2], [grant_request_3]] ) # Generate SAS Test Harnesses dump records dump_records_sas_test_harness_0 = { 'cbsdRecords': cbsd_fad_records_sas_test_harness_0 } dump_records_sas_test_harness_1 = { 'cbsdRecords': cbsd_fad_records_sas_test_harness_1 } # SAS Test Harnesses configuration sas_test_harness_0_config = { 'sasTestHarnessName': 'SAS-TH-1', 'hostName': getFqdnLocalhost(), 'port': getUnusedPort(), 'serverCert': getCertFilename('sas.cert'), 'serverKey': getCertFilename('sas.key'), 'caCert': getCertFilename('ca.cert') } sas_test_harness_1_config = { 'sasTestHarnessName': 'SAS-TH-2', 'hostName': getFqdnLocalhost(), 'port': getUnusedPort(), 'serverCert': getCertFilename('sas_1.cert'), 'serverKey': getCertFilename('sas_1.key'), 'caCert': getCertFilename('ca.cert') } iteration_config = { 'cbsdRequestsWithDomainProxies': [cbsd_records_domain_proxy_0, cbsd_records_domain_proxy_1], 'cbsdRecords': [{ 'registrationRequest': device_4, 'grantRequest': grant_request_4, 'conditionalRegistrationData': conditionals_device_4, 'clientCert': getCertFilename('device_d.cert'), 'clientKey': getCertFilename('device_d.key') }], 'protectedEntities': protected_entities, 'dpaActivationList': [], 'dpaDeactivationList': [], 'sasTestHarnessData': [dump_records_sas_test_harness_0, dump_records_sas_test_harness_1] } # Create the actual config. config = { 'initialCbsdRequestsWithDomainProxies': self.getEmptyCbsdRequestsWithDomainProxies(2), 'initialCbsdRecords': [], 'iterationData': [iteration_config], 'sasTestHarnessConfigs': [sas_test_harness_0_config, sas_test_harness_1_config], 'domainProxyConfigs': [{ 'cert': getCertFilename('domain_proxy.cert'), 'key': getCertFilename('domain_proxy.key') }, { 'cert': getCertFilename('domain_proxy_1.cert'), 'key': getCertFilename('domain_proxy_1.key')}] } writeConfig(filename, config)