csle_collector.ryu_manager package

Subpackages

Submodules

csle_collector.ryu_manager.query_ryu_manager module

csle_collector.ryu_manager.query_ryu_manager.get_ryu_status(stub: csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManagerStub, timeout=60) ryu_manager_pb2.RyuDTO[source]

Queries the server for the ryu server status

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

  • timeout – the GRPC timeout (seconds)

Returns

a RyuDTO describing the status of the ryu controller

csle_collector.ryu_manager.query_ryu_manager.start_ryu(stub: csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManagerStub, port: int, web_port: int, controller: str, timeout=60) ryu_manager_pb2.RyuDTO[source]

Sends a request to the Ryu manager to start the Ryu controller

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

  • timeout – the GRPC timeout (seconds)

  • port – the port that Ryu will listen to

  • web_port – the port that the Ryu web interface will listen to

  • controller – the controller that Ryu will start

Returns

a RyuDTO describing the status of the ryu controller

csle_collector.ryu_manager.query_ryu_manager.start_ryu_monitor(stub: csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManagerStub, kafka_ip: str, kafka_port: int, time_step_len: int, timeout=60) ryu_manager_pb2.RyuDTO[source]

Sends a request to the Ryu manager to start the Ryu controller

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

  • timeout – the GRPC timeout (seconds)

  • kafka_port – the port of Kafka to send data to

  • kafka_ip – the ip of Kafka to send data to

  • time_step_len – the time period for monitoring

Returns

a RyuDTO describing the status of the ryu controller

csle_collector.ryu_manager.query_ryu_manager.stop_ryu(stub: csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManagerStub, timeout=60) ryu_manager_pb2.RyuDTO[source]

Sends a request to the Ryu controller to stop the Ryu controller

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

  • timeout – the GRPC timeout (seconds)

Returns

a RyuDTO describing the status of the ryu controller

csle_collector.ryu_manager.query_ryu_manager.stop_ryu_monitor(stub: csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManagerStub, timeout=60) ryu_manager_pb2.RyuDTO[source]

Sends a request to the Ryu controller to stop the Ryu monitor

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

  • timeout – the GRPC timeout (seconds)

Returns

a RyuDTO describing the status of the ryu controller

csle_collector.ryu_manager.ryu_manager module

class csle_collector.ryu_manager.ryu_manager.RyuManagerServicer[source]

Bases: csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManagerServicer

gRPC server for managing a Ryu controller. Allows to start/stop the ryu controller remotely and also to query the state of the controller

getRyuStatus(request: ryu_manager_pb2.GetRyuStatusMsg, context: grpc.ServicerContext) ryu_manager_pb2.RyuDTO[source]

Gets the state of the Ryu controller

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a clients DTO with the state of the Ryu server

startRyu(request: ryu_manager_pb2.StartRyuMsg, context: grpc.ServicerContext) ryu_manager_pb2.RyuDTO[source]

Starts the ryu server

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a clients DTO with the state of the kafka server

startRyuMonitor(request: ryu_manager_pb2.StartRyuMonitorMsg, context: grpc.ServicerContext) ryu_manager_pb2.RyuDTO[source]

Starts the ryu monitor

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a clients DTO with the state of the kafka server

stopRyu(request: ryu_manager_pb2.StopRyuMsg, context: grpc.ServicerContext)[source]

Stops the Ryu controller

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a clients DTO with the state of the ryu server

stopRyuMonitor(request: ryu_manager_pb2.StopRyuMsg, context: grpc.ServicerContext)[source]

Stops the Ryu monitor

Parameters
  • request – the gRPC request

  • context – the gRPC context

Returns

a clients DTO with the state of the ryu server

csle_collector.ryu_manager.ryu_manager.serve(port: int = 50042, log_dir: str = '/', max_workers: int = 10, log_file_name: str = 'ryu_manager.log') None[source]

Starts the gRPC server for managing the ryu controller

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.ryu_manager.ryu_manager_pb2 module

Generated protocol buffer code.

csle_collector.ryu_manager.ryu_manager_pb2_grpc module

Client and server classes corresponding to protobuf-defined services.

class csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManager[source]

Bases: object

Interface exported by the server

static getRyuStatus(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static startRyu(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static startRyuMonitor(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static stopRyu(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
static stopRyuMonitor(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.ryu_manager.ryu_manager_pb2_grpc.RyuManagerServicer[source]

Bases: object

Interface exported by the server

getRyuStatus(request, context)[source]

Missing associated documentation comment in .proto file.

startRyu(request, context)[source]

Missing associated documentation comment in .proto file.

startRyuMonitor(request, context)[source]

Missing associated documentation comment in .proto file.

stopRyu(request, context)[source]

Missing associated documentation comment in .proto file.

stopRyuMonitor(request, context)[source]

Missing associated documentation comment in .proto file.

class csle_collector.ryu_manager.ryu_manager_pb2_grpc.RyuManagerStub(channel)[source]

Bases: object

Interface exported by the server

csle_collector.ryu_manager.ryu_manager_pb2_grpc.add_RyuManagerServicer_to_server(servicer, server)[source]

csle_collector.ryu_manager.ryu_manager_util module

class csle_collector.ryu_manager.ryu_manager_util.RyuManagerUtil[source]

Bases: object

Class with utility functions related to the Ryu Manager

static ryu_dto_empty() ryu_manager_pb2.RyuDTO[source]
Returns

an empty RyuDTO

static ryu_dto_from_dict(d: Dict[str, Any]) ryu_manager_pb2.RyuDTO[source]

Converts a dict representation of a RyuDTO to a DTO

Parameters

d – the dict to convert

Returns

the converted DTO

static ryu_dto_to_dict(ryu_dto: ryu_manager_pb2.RyuDTO) Dict[str, Any][source]

Converts a RyuDTO to a dict

Parameters

ryu_dto – the dto to convert

Returns

a dict representation of the DTO

Module contents