def test_dp_log_created_from_grpc_request(self, with_cbsd, serial_num, fcc_id, network_id): # Given cbsd = None if with_cbsd: cbsd = self.session.query(DBCbsd).first() message = CBSDRequest( user_id='some_user_id', fcc_id=fcc_id, serial_number=serial_num, min_power=2, max_power=3, antenna_gain=4, number_of_ports=5, ) # When actual_log = make_dp_log(method_name=CBSD_REGISTER, message=message, cbsd=cbsd) # Then expected_log = DPLog( event_timestamp=SOME_DATE, cbsd_serial_number=serial_num, fcc_id=fcc_id, log_from=CBSD, log_message=str(message), log_name='CBSDRegisterRequest', log_to=DP, network_id=network_id, response_code=None, ) self.assertEqual(expected_log, actual_log)
def enter(self): """ Enter the state """ request = CBSDRequest(serial_number=self.acs.device_cfg.get_parameter( ParameterName.SERIAL_NUMBER), ) state = get_cbsd_state(request) qrtb_update_desired_config_from_cbsd_state(state, self.acs.desired_cfg)
def _build_cbsd_request(self) -> CBSDRequest: return CBSDRequest( user_id=USER_ID, fcc_id=FCC_ID, serial_number=self.serial_number, min_power=0, max_power=20, antenna_gain=15, number_of_ports=2, )
def test_notify_dp_sets_values_received_by_dp_in_desired_config( self, mock_get_state) -> None: expected_final_param_values = { ParameterName.UL_BANDWIDTH: '100', ParameterName.DL_BANDWIDTH: '100', ParameterName.EARFCNUL: 55340, ParameterName.EARFCNDL: 55340, ParameterName.POWER_SPECTRAL_DENSITY: 34, } test_user = '******' test_fcc_id = 'fcc_id' test_serial_number = '123' acs_state_machine = EnodebAcsStateMachineBuilder.build_acs_state_machine( EnodebDeviceName.BAICELLS_QRTB) acs_state_machine.desired_cfg = EnodebConfiguration( BaicellsQRTBTrDataModel()) acs_state_machine.device_cfg.set_parameter(ParameterName.SAS_USER_ID, test_user) acs_state_machine.device_cfg.set_parameter(ParameterName.SAS_FCC_ID, test_fcc_id) acs_state_machine.device_cfg.set_parameter(ParameterName.SERIAL_NUMBER, test_serial_number) for param in expected_final_param_values: with self.assertRaises(KeyError): acs_state_machine.desired_cfg.get_parameter(param) # Skip previous steps not to duplicate the code acs_state_machine.transition('check_wait_get_params') req = Tr069MessageBuilder.param_values_qrtb_response( [], models.GetParameterValuesResponse, ) mock_get_state.return_value = MOCK_CBSD_STATE resp = acs_state_machine.handle_tr069_message(req) mock_get_state.assert_called_with( CBSDRequest(serial_number=test_serial_number), ) self.assertTrue(isinstance(resp, models.DummyInput)) for param, value in expected_final_param_values.items(): self.assertEqual( value, acs_state_machine.desired_cfg.get_parameter(param), )
def enter(self): """ Enter the state """ get_cbsd_state_request = CBSDRequest( serial_number=self.acs.device_cfg.get_parameter( ParameterName.SERIAL_NUMBER), ) state = get_cbsd_state(get_cbsd_state_request) qrtb_update_desired_config_from_cbsd_state(state, self.acs.desired_cfg) # NOTE: In case GPS scan is not completed, eNB reports LAT and LONG values as 0. # Only update CBSD in Domain Proxy when all params are available. gps_status = strtobool( self.acs.device_cfg.get_parameter(ParameterName.GPS_STATUS)) if gps_status: enodebd_update_cbsd_request = build_enodebd_update_cbsd_request( serial_number=self.acs.device_cfg.get_parameter( ParameterName.SERIAL_NUMBER), latitude_deg=self.acs.device_cfg.get_parameter( ParameterName.GPS_LAT), longitude_deg=self.acs.device_cfg.get_parameter( ParameterName.GPS_LONG), indoor_deployment=self.acs.device_cfg.get_parameter( ParameterName.INDOOR_DEPLOYMENT), antenna_height=self.acs.device_cfg.get_parameter( ParameterName.ANTENNA_HEIGHT), antenna_height_type=self.acs.device_cfg.get_parameter( ParameterName.ANTENNA_HEIGHT_TYPE), antenna_gain=self.acs.device_cfg.get_parameter( ParameterName.ANTENNA_GAIN), cbsd_category=self.acs.device_cfg.get_parameter( ParameterName.CBSD_CATEGORY), ) enodebd_update_cbsd(enodebd_update_cbsd_request) else: EnodebdLogger.debug( "Waiting for GPS to sync, before updating CBSD params in Domain Proxy." )
def get_cbsd_request() -> CBSDRequest: return CBSDRequest(serial_number=SERIAL_NUMBER)
def _build_request(**kwargs) -> CBSDRequest: return CBSDRequest(**kwargs)
def get_cbsd_request(serial_number: str) -> CBSDRequest: return CBSDRequest(serial_number=serial_number)