csle_collector.five_g_core_manager package

Subpackages

Submodules

csle_collector.five_g_core_manager.five_g_core_manager module

class csle_collector.five_g_core_manager.five_g_core_manager.FiveGCoreManagerServicer[source]

Bases: FiveGCoreManagerServicer

gRPC server for managing the 5g core

getFiveGCoreStatus(request: GetFiveGCoreStatusMsg, context: ServicerContext) FiveGCoreStatusDTO[source]

Gets the status of the 5G core

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a DTO with the status of the 5g core

initFiveGCore(request: InitFiveGCoreMsg, context: ServicerContext) FiveGCoreStatusDTO[source]

Initializes the 5G core services

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a DTO with the status of the 5g core

startFiveGCore(request: StartFiveGCoreMsg, context: ServicerContext) FiveGCoreStatusDTO[source]

Starts the 5G core services

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a DTO with the status of the 5g core

startFiveGCoreMonitor(request: StartFiveGCoreMonitorMsg, context: ServicerContext) FiveGCoreStatusDTO[source]

Starts the 5G Core monitor thread

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a DTO with the status of the Core monitor thread

stopFiveGCore(request: StopFiveGCoreMsg, context: ServicerContext) FiveGCoreStatusDTO[source]

Stops the 5G core services

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a DTO with the status of the 5g core

stopFiveGCoreMonitor(request: StopFiveGCoreMonitorMsg, context: ServicerContext) FiveGCoreStatusDTO[source]

Stops the Core monitor thread if it is running

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a DTO with the status of the Core monitor thread

csle_collector.five_g_core_manager.five_g_core_manager.serve(port: int = 50052, log_dir: str = '/', max_workers: int = 100, log_file_name: str = 'five_g_core_manager.log') None[source]

Starts the gRPC server for managing clients

Parameters
  • port – the port that the server will listen to

  • log_dir – the directory to write the log file

  • log_file_name – the file name of the log

  • max_workers – the maximum number of GRPC workers

Returns

None

csle_collector.five_g_core_manager.five_g_core_manager_pb2 module

Generated protocol buffer code.

csle_collector.five_g_core_manager.five_g_core_manager_pb2_grpc module

Client and server classes corresponding to protobuf-defined services.

class csle_collector.five_g_core_manager.five_g_core_manager_pb2_grpc.FiveGCoreManager[source]

Bases: object

Interface exported by the server

static getFiveGCoreStatus(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static initFiveGCore(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static startFiveGCore(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static startFiveGCoreMonitor(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static stopFiveGCore(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static stopFiveGCoreMonitor(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
class csle_collector.five_g_core_manager.five_g_core_manager_pb2_grpc.FiveGCoreManagerServicer[source]

Bases: object

Interface exported by the server

getFiveGCoreStatus(request, context)[source]

Missing associated documentation comment in .proto file.

initFiveGCore(request, context)[source]

Missing associated documentation comment in .proto file.

startFiveGCore(request, context)[source]

Missing associated documentation comment in .proto file.

startFiveGCoreMonitor(request, context)[source]

Missing associated documentation comment in .proto file.

stopFiveGCore(request, context)[source]

Missing associated documentation comment in .proto file.

stopFiveGCoreMonitor(request, context)[source]

Missing associated documentation comment in .proto file.

class csle_collector.five_g_core_manager.five_g_core_manager_pb2_grpc.FiveGCoreManagerStub(channel)[source]

Bases: object

Interface exported by the server

csle_collector.five_g_core_manager.five_g_core_manager_pb2_grpc.add_FiveGCoreManagerServicer_to_server(servicer, server)[source]

csle_collector.five_g_core_manager.five_g_core_manager_util module

class csle_collector.five_g_core_manager.five_g_core_manager_util.FiveGCoreManagerUtil[source]

Bases: object

Class with utility functions for the 5G core manager

static fetch_amf_metrics(ip: str) FiveGCoreAMFMetrics[source]

Fetches AMF metrics from the given URL and parses them into an AMFMetrics DTO.

Parameters

ip – The IP address string to populate the ‘ip’ field of the DTO

Returns

A populated AMFMetrics object

static fetch_hss_metrics(ip: str) FiveGCoreHSSMetrics[source]

Fetches HSS metrics from the given URL and parses them into an HSSMetrics DTO.

Parameters

ip – The IP address string to populate the ‘ip’ field of the DTO

Returns

A populated HSSMetrics object

static fetch_mme_metrics(ip: str) FiveGCoreMMEMetrics[source]

Fetches MME metrics from the given URL and parses them into an MMEMetrics DTO.

Parameters

ip – The IP address string to populate the ‘ip’ field of the DTO

Returns

A populated MMEMetrics object

static fetch_pcf_metrics(ip: str) FiveGCorePCFMetrics[source]

Fetches PCF metrics from the given URL and parses them into an PCFMetrics DTO.

Parameters

ip – The IP address string to populate the ‘ip’ field of the DTO

Returns

A populated PCFMetrics object

static fetch_pcrf_metrics(ip: str) FiveGCorePCRFMetrics[source]

Fetches PCRF metrics from the given URL and parses them into an PCRFMetrics DTO.

Parameters

ip – The IP address string to populate the ‘ip’ field of the DTO

Returns

A populated PCRFMetrics object

static fetch_smf_metrics(ip: str) FiveGCoreSMFMetrics[source]

Fetches SMF metrics from the given URL and parses them into an SMFMetrics DTO.

Parameters

ip – The IP address string to populate the ‘ip’ field of the DTO

Returns

A populated SMFMetrics object

static fetch_upf_metrics(ip: str) FiveGCoreUPFMetrics[source]

Fetches UPF metrics from the given URL and parses them into an UPFMetrics DTO.

Parameters

ip – The IP address string to populate the ‘ip’ field of the DTO

Returns

A populated UPFMetrics object

static five_g_core_status_dto_empty() FiveGCoreStatusDTO[source]
Returns

An empty FiveGCoreStatusDTO

static five_g_core_status_dto_from_dict(d: Dict[str, Any]) FiveGCoreStatusDTO[source]

Converts a FiveGCoreStatusDTO to a dict

Parameters

d – the dict to convert

Returns

the converted DTO

static five_g_core_status_dto_to_dict(five_g_core_status_dto: FiveGCoreStatusDTO) Dict[str, Any][source]

Converts a FiveGCoreStatusDTO to a dict

Parameters

five_g_core_status_dto – the DTO to convert

Returns

a dict representation of the DTO

static get_core_status(control_script_path: str) Dict[str, bool][source]

Executes the control script, parses the output, and return the statuses of the 5G core services

Parameters

control_script_path – the path to the control script

Returns

A dict with the names of the statuses and boolean values indicating if the services are running

static init_all_core_services(control_script_path: str) bool[source]

Initializes all 5G core services using the control script with the ‘all init’ command.

Parameters

control_script_path – the path to the control script

Returns

True if the script execution completed successfully, False otherwise.

static init_config_files(ip: str) bool[source]

Modifies the Open5GS configuration files to set the bind IP addresses. Specifically updates: 1. /etc/open5gs/amf.yaml (amf -> ngap -> server -> address) 2. /etc/open5gs/upf.yaml (upf -> pfcp -> server -> address)

Parameters

ip – The new IP address to set.

Returns

True if all files were updated successfully, False otherwise.

static init_subscriber_data(control_script_path: str, subscribers: List[FiveGSubscriberDTO]) bool[source]

Initializes the subscriber data for the 5G core.

Parameters
  • control_script_path – the path to the control script

  • subscribers – list of subscribers

Returns

True if the script execution completed successfully, False otherwise.

static start_all_core_services(control_script_path: str) bool[source]

Starts all 5G core services using the control script with the ‘all start’ command.

Parameters

control_script_path – the path to the control script

Returns

True if the script execution completed successfully, False otherwise.

static stop_all_core_services(control_script_path: str) bool[source]

Stops all 5G core services using the control script with the ‘all stop’ command.

Parameters

control_script_path – the path to the control script

Returns

True if the script execution completed successfully, False otherwise.

csle_collector.five_g_core_manager.query_five_g_core_manager module

csle_collector.five_g_core_manager.query_five_g_core_manager.get_five_g_core_status(stub: FiveGCoreManagerStub, timeout=60) FiveGCoreStatusDTO[source]

Queries the 5G core manager for the status of the 5G core

Parameters
  • stub – the stub to send the remote gRPC to the server

  • timeout – the timeout for the gRRPC call

Returns

a FiveGCoreStatusDTO describing the status of the 5G core

csle_collector.five_g_core_manager.query_five_g_core_manager.init_five_g_core(stub: FiveGCoreManagerStub, subscribers: List[FiveGSubscriberDTO], core_backhaul_ip: str, timeout=60) FiveGCoreStatusDTO[source]

Sends a request to the 5G core manager for stopping the 5G core services

Parameters
  • stub – the stub to send the remote gRPC to the server

  • subscribers – list of subscribers

  • core_backhaul_ip – The backhaul IP of the core network

  • timeout – the timeout for the gRRPC call

Returns

a FiveGCoreStatusDTO describing the status of the 5G core

csle_collector.five_g_core_manager.query_five_g_core_manager.start_five_g_core(stub: FiveGCoreManagerStub, timeout=60) FiveGCoreStatusDTO[source]

Sends a request to the 5G core manager for starting the 5G core services

Parameters
  • stub – the stub to send the remote gRPC to the server

  • timeout – the timeout for the gRRPC call

Returns

a FiveGCoreStatusDTO describing the status of the 5G core

csle_collector.five_g_core_manager.query_five_g_core_manager.start_five_g_core_monitor(stub: FiveGCoreManagerStub, kafka_ip: str, kafka_port: int, time_step_len_seconds: int, timeout=60) FiveGCoreStatusDTO[source]

Sends a request to the 5G core manager to start the core monitor thread

Parameters
  • kafka_ip – the ip of the Kafka server

  • kafka_port – the port of the Kafka server

  • time_step_len_seconds – the length of one time-step

  • stub – the stub to send the remote gRPC to the server

  • timeout – the GRPC timeout (seconds)

Returns

a FiveGCoreStatusDTO describing the core status

csle_collector.five_g_core_manager.query_five_g_core_manager.stop_five_g_core(stub: FiveGCoreManagerStub, timeout=60) FiveGCoreStatusDTO[source]

Sends a request to the 5G core manager for stopping the 5G core services

Parameters
  • stub – the stub to send the remote gRPC to the server

  • timeout – the timeout for the gRRPC call

Returns

a FiveGCoreStatusDTO describing the status of the 5G core

csle_collector.five_g_core_manager.query_five_g_core_manager.stop_five_g_core_monitor(stub: FiveGCoreManagerStub, timeout=60) FiveGCoreStatusDTO[source]

Sends a request to the 5G Core manager to stop the 5G Core monitor thread

Parameters
  • stub – the stub to send the remote gRPC to the server

  • timeout – the GRPC timeout (seconds)

Returns

a FiveGCoreStatusDTO describing the 5G core status

Module contents