def main(): """ Top-level function for enodebd """ service = MagmaService('enodebd', mconfigs_pb2.EnodebD()) logger.init() # Optionally pipe errors to Sentry sentry_init(service_name=service.name, sentry_mconfig=service.shared_mconfig.sentry_config) # State machine manager for tracking multiple connected eNB devices. state_machine_manager = StateMachineManager(service) # Statistics manager stats_mgr = StatsManager(state_machine_manager) stats_mgr.run() # Start TR-069 thread server_thread = Thread( target=tr069_server, args=(state_machine_manager, ), daemon=True, ) server_thread.start() print_grpc_payload = service.config.get('print_grpc_payload', False) # Add all servicers to the server enodebd_servicer = EnodebdRpcServicer( state_machine_manager, print_grpc_payload, ) enodebd_servicer.add_to_server(service.rpc_server) # Register function to get service status def get_enodebd_status(): return get_service_status_old(state_machine_manager) service.register_get_status_callback(get_enodebd_status) # Register a callback function for GetOperationalStates service303 function def get_enodeb_operational_states() -> List[State]: return get_operational_states( state_machine_manager, service.mconfig, print_grpc_payload, ) service.register_operational_states_callback(get_enodeb_operational_states) # Set eNodeBD iptables rules due to exposing public IP to eNodeB service.loop.create_task(set_enodebd_iptables_rule()) # Run the service loop service.run() # Cleanup the service service.close()
def main(): """ Top-level function for enodebd """ service = MagmaService('enodebd') # State machine manager for tracking multiple connected eNB devices. state_machine_manager = StateMachineManager(service) # Statistics manager stats_mgr = StatsManager(state_machine_manager) stats_mgr.run() # Start TR-069 thread server_thread = Thread(target=tr069_server, args=(state_machine_manager, ), daemon=True) server_thread.start() # Add all servicers to the server enodebd_servicer = EnodebdRpcServicer(state_machine_manager) enodebd_servicer.add_to_server(service.rpc_server) # Register function to get service status def get_enodebd_status(): return get_service_status_old(state_machine_manager) service.register_get_status_callback(get_enodebd_status) # Register a callback function for GetOperationalStates service303 function def get_enodeb_operational_states() -> List[State]: return get_operational_states(state_machine_manager) service.register_operational_states_callback(get_enodeb_operational_states) # Set eNodeBD iptables rules due to exposing public IP to eNodeB service.loop.create_task(set_enodebd_iptables_rule()) # Run the service loop service.run() # Cleanup the service service.close()
def _get_manager(self) -> StateMachineManager: service = EnodebAcsStateMachineBuilder.build_magma_service() return StateMachineManager(service)
def setUp(self) -> None: service = EnodebConfigBuilder.get_service_config() self.enb_acs_manager = StateMachineManager(service) self.mgr = StatsManager(self.enb_acs_manager) self.is_clear_stats_called = False
def build_multi_enb_acs_manager(cls, ) -> StateMachineManager: service = cls.build_multi_enb_magma_service() return StateMachineManager(service)
def build_acs_manager( cls, device: EnodebDeviceName = EnodebDeviceName.BAICELLS, ) -> StateMachineManager: service = cls.build_magma_service(device) return StateMachineManager(service)