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)
def generate_FAD_2_default_config(self, filename): """Generates the WinnForum configuration for FAD_2""" # Create the actual config for FAD_2 # Load the esc sensor in SAS Test Harness esc_sensor = json.load( open( os.path.join('testcases', 'testdata', 'esc_sensor_record_0.json'))) # Load the device_c1 with registration in SAS Test Harness device_c1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) # Get a latitude and longitude within 40 kms from ESC. latitude, longitude, _ = vincenty.GeodesicPoint( esc_sensor['installationParam']['latitude'], esc_sensor['installationParam']['longitude'], 0.1, 30) # distance of 0.1 km from ESC at 30 degrees # Load the device_c1 in the neighborhood area of the ESC sensor device_c1['installationParam']['latitude'] = latitude device_c1['installationParam']['longitude'] = longitude # Load grant request for device_c1 grant_g1 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_g1['operationParam']['maxEirp'] = 20 # Load one ppa in SAS Test Harness pal_record_0 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_0.json'))) pal_low_frequency = 3550000000 pal_high_frequency = 3560000000 ppa_record_0 = json.load( open(os.path.join('testcases', 'testdata', 'ppa_record_0.json'))) ppa_record_a, pal_records = makePpaAndPalRecordsConsistent( ppa_record_0, [pal_record_0], pal_low_frequency, pal_high_frequency, 'test_user_1') # Load device_c3 in SAS Test Harness device_c3 = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Load the device_c3 in the neighborhood area of the PPA device_c3['installationParam']['latitude'] = 38.821322 device_c3['installationParam']['longitude'] = -97.280040 # Load grant request for device_c3 in SAS Test Harness grant_g3 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_g3['operationParam']['maxEirp'] = 20 # Update grant_g3 frequency to overlap with PPA zone frequency for C3 device grant_g3['operationParam']['operationFrequencyRange'] = { 'lowFrequency': 3550000000, 'highFrequency': 3555000000 } # Load the device_c2 with registration to SAS UUT device_c2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # Get a latitude and longitude within 40 kms from ESC. latitude, longitude, _ = vincenty.GeodesicPoint( esc_sensor['installationParam']['latitude'], esc_sensor['installationParam']['longitude'], 0.1, 30) # distance of 0.1 km from ESC at 30 degrees device_c2['installationParam']['latitude'] = latitude device_c2['installationParam']['longitude'] = longitude # Creating conditionals for C2 and C4. self.assertEqual(device_c2['cbsdCategory'], 'B') conditional_parameters_c2 = { 'cbsdCategory': device_c2['cbsdCategory'], 'fccId': device_c2['fccId'], 'cbsdSerialNumber': device_c2['cbsdSerialNumber'], 'airInterface': device_c2['airInterface'], 'installationParam': device_c2['installationParam'], 'measCapability': device_c2['measCapability'] } del device_c2['cbsdCategory'] del device_c2['airInterface'] del device_c2['installationParam'] # Load grant request for device_c2 to SAS UUT grant_g2 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_g2['operationParam']['maxEirp'] = 30 # Load the device_c4 with registration to SAS UUT. device_c4 = json.load( open(os.path.join('testcases', 'testdata', 'device_d.json'))) # Move device_c4 in the neighborhood area of the PPA device_c4['installationParam']['latitude'] = 38.8363 device_c4['installationParam']['longitude'] = -97.2642 device_c4['installationParam']['antennaBeamwidth'] = 0 # Creating conditionals for Cat B devices. self.assertEqual(device_c4['cbsdCategory'], 'B') conditional_parameters_c4 = { 'cbsdCategory': device_c4['cbsdCategory'], 'fccId': device_c4['fccId'], 'cbsdSerialNumber': device_c4['cbsdSerialNumber'], 'airInterface': device_c4['airInterface'], 'installationParam': device_c4['installationParam'], 'measCapability': device_c4['measCapability'] } del device_c4['cbsdCategory'] del device_c4['airInterface'] del device_c4['installationParam'] # Load grant request for device_c4 to SAS UUT grant_g4 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_g4['operationParam']['maxEirp'] = 20 #Update grant_g4 frequency to overlap with PPA zone frequency for C4 device grant_g4['operationParam']['operationFrequencyRange'] = { 'lowFrequency': 3550000000, 'highFrequency': 3555000000 } conditionals = { 'registrationData': [conditional_parameters_c2, conditional_parameters_c4] } cbsd_records = [device_c1, device_c3] grant_record_list = [[grant_g1], [grant_g3]] ppa_records = [ppa_record_a] # Creating CBSD reference IDs of valid format cbsd_reference_id1 = generateCbsdReferenceId('test_fcc_id_x', 'test_serial_number_x') cbsd_reference_id2 = generateCbsdReferenceId('test_fcc_id_y', 'test_serial_number_y') cbsd_reference_ids = [[cbsd_reference_id1, cbsd_reference_id2]] # SAS test harness configuration sas_harness_config = { 'sasTestHarnessName': 'SAS-TH-1', 'hostName': getFqdnLocalhost(), 'port': getUnusedPort(), 'serverCert': getCertFilename('sas.cert'), 'serverKey': getCertFilename('sas.key'), 'caCert': "certs/ca.cert" } # Generate FAD Records for each record type like cbsd,zone and esc_sensor cbsd_fad_records = generateCbsdRecords(cbsd_records, grant_record_list) ppa_fad_records = generatePpaRecords(ppa_records, cbsd_reference_ids) esc_fad_records = [esc_sensor] sas_harness_dump_records = { 'cbsdRecords': cbsd_fad_records, 'ppaRecords': ppa_fad_records, 'escSensorRecords': esc_fad_records } config = { 'registrationRequestC2': device_c2, 'registrationRequestC4': device_c4, 'conditionalRegistrationData': conditionals, 'grantRequestG2': grant_g2, 'grantRequestG4': grant_g4, 'palRecords': pal_records, 'sasTestHarnessConfig': sas_harness_config, 'sasTestHarnessDumpRecords': sas_harness_dump_records } writeConfig(filename, config)
def generate_EPR_2_default_config(self, filename): """ Generates the WinnForum configuration for EPR.2. """ # Load ESC record esc_record_1 = json.load( open(os.path.join('testcases', 'testdata', 'esc_sensor_record_0.json'))) # Load devices info device_1 = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) # Moving device_1(Cat A) to a location within 40 KMs of ESC sensor device_1['installationParam'][ 'latitude'] = esc_record_1['installationParam']['latitude'] + 0.20 device_1['installationParam'][ 'longitude'] = esc_record_1['installationParam']['longitude'] device_2 = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) # Moving device_2(Cat B) to a location within 80 KMs of ESC sensor device_2['installationParam'][ 'latitude'] = esc_record_1['installationParam']['latitude'] + 0.70 device_2['installationParam'][ 'longitude'] = esc_record_1['installationParam']['longitude'] device_3 = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Moving device_3(Cat A) to a location outside 40 KMs of ESC sensor device_3['installationParam'][ 'latitude'] = esc_record_1['installationParam']['latitude'] + 0.50 device_3['installationParam'][ 'longitude'] = esc_record_1['installationParam']['longitude'] device_4 = json.load( open(os.path.join('testcases', 'testdata', 'device_d.json'))) # Moving device_4(Cat B) to a location outside 80 KMs of ESC sensor device_4['installationParam'][ 'latitude'] = esc_record_1['installationParam']['latitude'] + 1.0 device_4['installationParam'][ 'longitude'] = esc_record_1['installationParam']['longitude'] # Load Grant requests with In-band frequency range for all devices grant_request_1 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_request_1['operationParam']['operationFrequencyRange']['lowFrequency'] = 3550000000 grant_request_1['operationParam']['operationFrequencyRange']['highFrequency'] = 3560000000 grant_request_2 = json.load( open(os.path.join('testcases', 'testdata', 'grant_1.json'))) grant_request_2['operationParam']['operationFrequencyRange']['lowFrequency'] = 3570000000 grant_request_2['operationParam']['operationFrequencyRange']['highFrequency'] = 3580000000 grant_request_3 = json.load( open(os.path.join('testcases', 'testdata', 'grant_2.json'))) grant_request_3['operationParam']['operationFrequencyRange']['lowFrequency'] = 3590000000 grant_request_3['operationParam']['operationFrequencyRange']['highFrequency'] = 3600000000 grant_request_4 = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_request_4['operationParam']['operationFrequencyRange']['lowFrequency'] = 3610000000 grant_request_4['operationParam']['operationFrequencyRange']['highFrequency'] = 3620000000 # 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 = { 'escRecords': [esc_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)
def generate_FAD_1_default_config(self, filename): """Generates the WinnForum configuration for FAD.1""" # 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_c = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Device #2 is Category B # 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 = {'registrationData': [conditionals_b]} del device_b['cbsdCategory'] del device_b['airInterface'] del device_b['installationParam'] devices = [device_a, device_b, device_c] # Grants grants = [] for index in range(len(devices)): grants.append( json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json')))) # PPAs and PALs ppas = [] pals = [] pal_low_frequency = 3550000000.0 pal_high_frequency = 3560000000.0 pal_record = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_0.json'))) ppa_record = json.load( open(os.path.join('testcases', 'testdata', 'ppa_record_0.json'))) ppa, pal = makePpaAndPalRecordsConsistent(ppa_record, [pal_record], pal_low_frequency, pal_high_frequency, device_a['userId']) device_a['installationParam']['latitude'], device_a[ 'installationParam']['longitude'] = getRandomLatLongInPolygon(ppa) # Devices inside and part of the claimed PPA. # Contains the index of devices in the devices list. ppas.append({'ppaRecord': ppa, 'ppaClusterList': [0]}) pals.extend(pal) # ESC senosrs esc_sensors = [] esc_sensors.append( json.load( open( os.path.join('testcases', 'testdata', 'esc_sensor_record_0.json')))) # SAS test harness configuration sas_test_harness_0_config = { 'sasTestHarnessName': 'SAS-TH-2', 'hostName': getFqdnLocalhost(), 'port': getUnusedPort(), 'serverCert': getCertFilename('sas.cert'), 'serverKey': getCertFilename('sas.key'), 'caCert': "certs/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') } config = { 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, 'grantRequests': grants, 'ppaRecords': ppas, 'palRecords': pals, 'escSensorRecords': esc_sensors, 'sasTestHarnessConfigs': [sas_test_harness_0_config, sas_test_harness_1_config] } writeConfig(filename, config)
def generate_PPR_3_default_config(self, filename): """High-level description of the default config: SAS UUT has devices B, D; all of which have a PAL grant. SAS TH has devices A, C, E, all of which have a PAL grant. SAS UUT has one PPA, with devices B and D on the cluster list. SAS TH has one PPA, with devices A, C, and E on the cluster list. The PPAs derive from different but adjacent PALs. Both PPAs are on 3620-3630 MHz, as are all grants. """ # Load Devices device_a = json.load( open(os.path.join('testcases', 'testdata', 'device_a.json'))) device_a['installationParam']['latitude'] = 38.842176 device_a['installationParam']['longitude'] = -97.092863 device_b = json.load( open(os.path.join('testcases', 'testdata', 'device_b.json'))) device_b['installationParam']['latitude'] = 38.845323113 device_b['installationParam']['longitude'] = -97.15514587 device_b['installationParam']['antennaBeamwidth'] = 0 device_b['installationParam']['antennaDowntilt'] = 0 device_c = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) device_c['installationParam']['latitude'] = 38.816782 device_c['installationParam']['longitude'] = -97.102965 device_d = json.load( open(os.path.join('testcases', 'testdata', 'device_d.json'))) device_d['installationParam']['latitude'] = 38.846125 device_d['installationParam']['longitude'] = -97.156184 device_d['installationParam']['antennaBeamwidth'] = 0 device_d['installationParam']['antennaDowntilt'] = 0 device_e = json.load( open(os.path.join('testcases', 'testdata', 'device_e.json'))) device_e['installationParam']['latitude'] = 38.761748 device_e['installationParam']['longitude'] = -97.118459 # Pre-load conditionals and remove REG-conditional fields from registration # requests. conditional_keys = [ 'cbsdCategory', 'fccId', 'cbsdSerialNumber', 'airInterface', 'installationParam', 'measCapability' ] reg_conditional_keys = [ 'cbsdCategory', 'airInterface', 'installationParam', 'measCapability' ] conditionals_b = {key: device_b[key] for key in conditional_keys} device_b = { key: device_b[key] for key in device_b if key not in reg_conditional_keys } conditionals_d = {key: device_d[key] for key in conditional_keys} device_d = { key: device_d[key] for key in device_d if key not in reg_conditional_keys } # Load grant requests (default is 3620-3630). grant_a = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_b = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_b['operationParam']['maxEirp'] = 30 grant_c = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_d = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) grant_d['operationParam']['maxEirp'] = 30 grant_e = json.load( open(os.path.join('testcases', 'testdata', 'grant_0.json'))) # CBSDs in SAS UUT. domain_proxy = { 'registrationRequests': [device_b, device_d], 'grantRequests': [grant_b, grant_d], 'conditionalRegistrationData': [conditionals_b, conditionals_d], 'cert': getCertFilename('domain_proxy.cert'), 'key': getCertFilename('domain_proxy.key') } # One PPA in SAS UUT. pal_low_frequency = 3620000000 pal_high_frequency = 3630000000 pal_record_0 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_0.json'))) ppa_record_0 = json.load( open(os.path.join('testcases', 'testdata', 'ppa_record_0.json'))) ppa_record_0['zone']['features'][0]['geometry']['coordinates'] = [[[ -97.155, 38.75 ], [-97.155, 38.85], [-97.165, 38.85], [-97.165, 38.75], [-97.155, 38.75]]] ppa_record_0, pal_records_0 = makePpaAndPalRecordsConsistent( ppa_record_0, [pal_record_0], pal_low_frequency, pal_high_frequency, 'test_user_1') device_b['userId'] = 'test_user_1' device_d['userId'] = 'test_user_1' ppa_cluster_list = [0, 1] # One PPA in the peer SAS test harness. pal_record_1 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_1.json'))) pal_record_1['fipsCode'] = 20041084500 ppa_record_1 = json.load( open(os.path.join('testcases', 'testdata', 'ppa_record_1.json'))) ppa_record_1['zone']['features'][0]['geometry']['coordinates'] = [[[ -97.145, 38.85 ], [-97.145, 38.75], [-97.05, 38.75], [-97.05, 38.85], [-97.145, 38.85]]] ppa_record_1, pal_records_1 = makePpaAndPalRecordsConsistent( ppa_record_1, [pal_record_1], pal_low_frequency, pal_high_frequency, 'test_user_2') # Generate FAD records. cbsd_records = [device_a, device_c, device_e] # Create CBSD reference IDs. cbsd_reference_id_a = generateCbsdReferenceId(device_a['fccId'], device_a['cbsdSerialNumber']) cbsd_reference_id_c = generateCbsdReferenceId(device_c['fccId'], device_c['cbsdSerialNumber']) cbsd_reference_id_e = generateCbsdReferenceId(device_e['fccId'], device_e['cbsdSerialNumber']) cbsd_reference_ids = [[ cbsd_reference_id_a, cbsd_reference_id_c, cbsd_reference_id_e ]] grant_record_list = [[grant_a], [grant_c], [grant_e]] cbsd_records = generateCbsdRecords(cbsd_records, grant_record_list) for cbsd in cbsd_records: for grant in cbsd['grants']: grant['channelType'] = 'PAL' # Create records. sas_harness_dump_records = { 'cbsdRecords': cbsd_records, 'ppaRecords': generatePpaRecords([ppa_record_1], cbsd_reference_ids), } # SAS test harness configuration. sas_harness_config = { 'sasTestHarnessName': 'SAS-TH-1', 'hostName': getFqdnLocalhost(), 'port': getUnusedPort(), 'serverCert': getCertFilename('sas.cert'), 'serverKey': getCertFilename('sas.key'), 'caCert': 'certs/ca.cert' } config = { 'domainProxy': domain_proxy, # Includes registration and grant requests. 'ppaRecord': ppa_record_0, # PPA in SAS UUT. 'ppaClusterList': ppa_cluster_list, # Same format and semantics as SIQ.12. 'palRecords': [pal_records_0[0], pal_records_1[0]], # PALs for both PPAs. 'sasTestHarnessDumpRecords': sas_harness_dump_records, # CBSDs and one PPA. 'sasTestHarnessConfig': sas_harness_config, # Just the config, no records. } writeConfig(filename, config)
def test_getFqdnLocalhost(self): # Initialize the testConfig with our test data. util._test_config = util._GetSharedTestConfig() util._test_config.hostname = 'foo.bar.com' self.assertEqual(util.getFqdnLocalhost(), 'foo.bar.com')
def generate_WDB_1_default_config(self, filename): """Generates the WinnForum configuration for WDB.1""" # Load devices 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'))) # Load PAL records pal_record_a_0 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_0.json'))) pal_record_a_1 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_1.json'))) pal_record_b_0 = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_2.json'))) # FIPS codes of adjacent census tracts pal_record_a_0['fipsCode'] = 20063955100 pal_record_a_1['fipsCode'] = 20063955200 pal_record_b_0['fipsCode'] = 20195955800 # Set the PAL frequency. pal_low_frequency = 3570000000 pal_high_frequency = 3580000000 # Setting the frequency range and user ID(s) 'U' for PAL records. pal_records_a = makePalRecordsConsistent( [pal_record_a_0, pal_record_a_1], pal_low_frequency, pal_high_frequency, device_a['userId']) pal_records_b = makePalRecordsConsistent([pal_record_b_0], pal_low_frequency, pal_high_frequency, device_b['userId']) # Set the locations of devices to reside with in census tracts. device_a['installationParam']['latitude'], device_a[ 'installationParam']['longitude'] = 39.0373, -100.4184 device_b['installationParam']['latitude'], device_b[ 'installationParam']['longitude'] = 38.9583, -99.9055 # Getting PAL IDs from pal records pal_ids_a = [pal_records_a[0]['palId'], pal_records_a[1]['palId']] pal_ids_b = [pal_records_b[0]['palId']] # Creating conditionals for Cat B devices 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['cbsdCategory'] del device_b['airInterface'] del device_b['installationParam'] del device_b['measCapability'] conditionals = [conditionals_b] pal_db_relative_file_path = os.path.join('testcases', 'testdata', 'pal_db', 'pal_db.json') # Create the PAL database file. pal_db_contents = pal_records_a pal_db_contents.extend(pal_records_b) ensureFileDirectoryExists(pal_db_relative_file_path) with open(pal_db_relative_file_path, 'w+') as file_handle: file_handle.write(json.dumps(pal_db_contents, indent=2)) pal_database_config = { 'hostName': getFqdnLocalhost(), 'port': getUnusedPort(), 'fileUrl': '/rest/pal/v1/pal_db.json/pal_db.json', 'filePath': pal_db_relative_file_path } # Create the actual configuration file config = { 'palIds': [pal_ids_a, pal_ids_b], 'registrationRequests': [device_a, device_b], 'conditionalRegistrationData': conditionals, 'palDatabaseConfig': pal_database_config } writeConfig(filename, config)
def generate_WDB_2_default_config(self, filename): """Generates the WinnForum configuration for WDB.2""" # Load category B devices info 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_b and Device_d are of Category B self.assertEqual(device_b['cbsdCategory'], 'B') self.assertEqual(device_d['cbsdCategory'], 'B') # Load CPI users info cpi_id_b = 'professional_installer_id_1' cpi_name_b = 'b_name' cpi_id_d = 'professional_installer_id_2' cpi_name_d = 'd_name' # Generate CPI keys for device b. cpi_private_key_device_b, cpi_public_key_device_b = generateCpiRsaKeys( ) # Generate CPI keys for device d. cpi_private_key_device_d, cpi_public_key_device_d = generateCpiRsaKeys( ) # Convert CBSDs registration requests to embed cpiSignatureData convertRequestToRequestWithCpiSignature(cpi_private_key_device_b, cpi_id_b, cpi_name_b, device_b) convertRequestToRequestWithCpiSignature(cpi_private_key_device_d, cpi_id_d, cpi_name_d, device_d) cpi_device_b_public_key_relative_file_path = os.path.join( 'testcases', 'testdata', 'cpi_db', 'CPI_Database-Public_b.txt') # Create the pal_db record file consistent with CBSDs and PAL records. ensureFileDirectoryExists(cpi_device_b_public_key_relative_file_path) with open(cpi_device_b_public_key_relative_file_path, 'w+') as file_handle: file_handle.write(cpi_public_key_device_b) cpi_device_d_public_key_relative_file_path = os.path.join( 'testcases', 'testdata', 'cpi_db', 'CPI_Database-Public_d.txt') # Create the pal_db record file consistent with CBSDs and PAL records. ensureFileDirectoryExists(cpi_device_d_public_key_relative_file_path) with open(cpi_device_d_public_key_relative_file_path, 'w+') as file_handle: file_handle.write(cpi_public_key_device_d) cpi_database_config = { 'hostName': getFqdnLocalhost(), 'port': getUnusedPort(), 'cpis': [{ 'cpiId': cpi_id_b, 'status': 'ACTIVE', 'publicKeyIdentifierFile': cpi_device_b_public_key_relative_file_path }, { 'cpiId': cpi_id_d, 'status': 'ACTIVE', 'publicKeyIdentifierFile': cpi_device_d_public_key_relative_file_path }], 'indexUrl': '/rest/cpi/v1/index.csv', 'indexPath': os.path.join('testcases', 'testdata', 'cpi_db', 'index.csv') } # Create the actual configuration. config = { 'registrationRequests': [device_b, device_d], 'cpiDatabaseConfig': cpi_database_config } writeConfig(filename, config)