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 setUpClass(cls): # Change the Default Census Tract directory to test_data drive.ConfigureCensusTractDriver(TEST_DIR) # Load the common setup to all tests user_id = 'pal_user_id_0' pal_record_filenames = ['pal_record_1.json'] device_filenames = ['device_b.json'] pal_low_frequency = 3550000000 pal_high_frequency = 3650000000 cls.devices = [json.load(open(os.path.join(TEST_DIR, device_filename))) for device_filename in device_filenames] cls.pal_records = [json.load(open(os.path.join(TEST_DIR, pal_record_filename))) for pal_record_filename in pal_record_filenames] cls.pal_records = util.makePalRecordsConsistent( cls.pal_records, pal_low_frequency, pal_high_frequency, user_id)
def generate_PCR_4_default_config(self, filename): """Generate the WinnForum configuration for PCR 4.""" # 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'))) device_c = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Set the same user ID for all devices device_b['userId'] = device_a['userId'] device_c['userId'] = device_a['userId'] # Make PAL records consistent. pal_records = makePalRecordsConsistent([pal_record_1, pal_record_2], pal_low_frequency, pal_high_frequency, device_a['userId']) # Set the values of CBSD location, antenna gain, and EIRP limit such that a # single PPA can be formed. device_a['installationParam']['latitude'], device_a[ 'installationParam']['longitude'] = 39.0373, -100.4184 device_b['installationParam']['latitude'], device_b[ 'installationParam']['longitude'] = 39.0378, -100.4785 # At least one of the CBSDs is located outside the service area. device_c['installationParam']['latitude'], device_c[ 'installationParam']['longitude'] = 39.09755, -99.9179 device_c['installationParam']['heightType'] = 'AGL' # Set the AntennaGain and EIRP capability chosen in a way that only one PPA zone is created # by those CBDSs device_a['installationParam']['eirpCapability'] = 30 device_b['installationParam']['eirpCapability'] = 47 device_c['installationParam']['eirpCapability'] = 30 device_a['installationParam']['antennaGain'] = 16 device_b['installationParam']['antennaGain'] = 16 device_c['installationParam']['antennaGain'] = 16 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, device_c] config = { 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, 'palRecords': pal_records } writeConfig(filename, config)
def generate_PCR_2_default_config(self, filename): """Generate the WinnForum configuration for PCR 2.""" # Load PAL records. pal_record_a = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_1.json'))) pal_record_b = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_2.json'))) # Use the FIPS codes of adjacent census tracts. pal_record_a['fipsCode'] = 20063955100 pal_record_b['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'))) device_c = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Set the same user ID for all devices. device_b['userId'] = device_a['userId'] device_c['userId'] = device_a['userId'] # 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') # Make PAL record consistent. pal_records = makePalRecordsConsistent([pal_record_a, pal_record_b], pal_low_frequency, pal_high_frequency, device_a['userId']) # Set the values of CBSD location, antenna gain, and EIRP limit such that a # single PPA can be formed. device_a['installationParam']['latitude'], device_a[ 'installationParam']['longitude'] = 38.74021, -100.53862 # At least one of the CBSDs is close to the boundary of the Service Area, # so that -96 dBm/10 MHz protection contour extends beyond the service area boundary. device_b['installationParam']['latitude'], device_b[ 'installationParam']['longitude'] = 38.70645, -100.46034 # placed the device_c in between device_a and device_b within service area. device_c['installationParam']['latitude'], device_c[ 'installationParam']['longitude'] = 38.72281, -100.50103 device_c['installationParam']['heightType'] = 'AGL' # Set the AntennaGain and EIRP capability in a way that only # one PPA zone is created by those CBDSs using PPA Creation Reference Model. device_a['installationParam']['eirpCapability'] = 30 device_b['installationParam']['eirpCapability'] = 47 device_a['installationParam']['antennaGain'] = 16 device_b['installationParam']['antennaGain'] = 16 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, device_c] config = { 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, 'palRecords': pal_records, 'sasTestHarnessCert': getCertFilename('sas.cert'), 'sasTestHarnessKey': getCertFilename('sas.key') } writeConfig(filename, config)
def generate_PCR_1_default_config(self, filename): """Generate the WinnForum configuration for PCR 1.""" # Load PAL records. pal_record_a = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_1.json'))) pal_record_b = json.load( open(os.path.join('testcases', 'testdata', 'pal_record_2.json'))) # Use the FIPS codes of adjacent census tracts. pal_record_a['fipsCode'] = 20063955100 pal_record_b['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'))) device_c = json.load( open(os.path.join('testcases', 'testdata', 'device_c.json'))) # Set the same user ID for all devices device_b['userId'] = device_a['userId'] device_c['userId'] = device_a['userId'] # 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') # Make PAL records consistent. pal_records = makePalRecordsConsistent([pal_record_a, pal_record_b], pal_low_frequency, pal_high_frequency, device_a['userId']) # Set the locations of devices to reside with in 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 # placed the device_c in between device_a and device_b within service area. device_c['installationParam']['latitude'], device_c[ 'installationParam']['longitude'] = 39.0426, -100.4457 device_c['installationParam']['heightType'] = 'AGL' # Set the AntennaGain and EIRP capability. device_a['installationParam']['eirpCapability'] = 30 device_b['installationParam']['eirpCapability'] = 47 device_a['installationParam']['antennaGain'] = 16 device_b['installationParam']['antennaGain'] = 16 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, device_c] config = { 'registrationRequests': devices, 'conditionalRegistrationData': conditionals, 'palRecords': pal_records, 'sasTestHarnessCert': getCertFilename('sas.cert'), 'sasTestHarnessKey': getCertFilename('sas.key') } writeConfig(filename, config)
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)
from reference_models.geo import drive from reference_models.ppa import ppa # Configuration user_id = 'pal_user_id_0' pal_record_filenames = ['pal_record_0.json'] device_filenames = ['device_a.json'] pal_low_frequency = 3550000000 pal_high_frequency = 3650000000 TEST_DIR = os.path.join(os.path.dirname(__file__), 'test_data') # Change the Default Census Tract Driver Directory to parent directory of test_data drive.ConfigureCensusTractDriver(TEST_DIR) # Load Devices and PAL Records devices = [ json.load(open(os.path.join(TEST_DIR, device_filename))) for device_filename in device_filenames ] pal_records = [ json.load(open(os.path.join(TEST_DIR, pal_record_filename))) for pal_record_filename in pal_record_filenames ] # Modify PAL Record to comply with WINNF-TS-0245 pal_records = util.makePalRecordsConsistent(pal_records, pal_low_frequency, pal_high_frequency, user_id) ppa = ppa.PpaCreationModel(devices, pal_records) print ppa