csle_collector.traffic_manager package
Submodules
csle_collector.traffic_manager.query_traffic_manager module
- csle_collector.traffic_manager.query_traffic_manager.get_traffic_status(stub: csle_collector.traffic_manager.traffic_manager_pb2_grpc.TrafficManagerStub, timeout=60) traffic_manager_pb2.TrafficDTO [source]
Queries the server for the Traffic generator status
- Parameters
stub – the stub to send the remote gRPC to the server
timeout – the GRPC timeout (seconds)
- Returns
a TrafficDTO describing the status of the traffic generator
- csle_collector.traffic_manager.query_traffic_manager.start_traffic(stub: csle_collector.traffic_manager.traffic_manager_pb2_grpc.TrafficManagerStub, commands: List[str], sleep_time: int, timeout=60) traffic_manager_pb2.TrafficDTO [source]
Sends a request to the traffic manager to start the traffic generator script
- Parameters
stub – the stub to send the remote gRPC to the server
timeout – the GRPC timeout (seconds)
commands – list of commands for the traffic generator
sleep_time – sleep time for the traffic generator
- Returns
an TrafficDTO describing the status of the traffic manager
- csle_collector.traffic_manager.query_traffic_manager.stop_traffic(stub: csle_collector.traffic_manager.traffic_manager_pb2_grpc.TrafficManagerStub, timeout=60) traffic_manager_pb2.TrafficDTO [source]
Sends a request to the traffic manager to stop the traffic generator
- Parameters
stub – the stub to send the remote gRPC to the server
timeout – the GRPC timeout (seconds)
- Returns
a TrafficDTO describing the status of the traffic generator
csle_collector.traffic_manager.traffic_manager module
- class csle_collector.traffic_manager.traffic_manager.TrafficManagerServicer[source]
Bases:
csle_collector.traffic_manager.traffic_manager_pb2_grpc.TrafficManagerServicer
gRPC server for managing a traffic generator. Allows to start/stop the script and also to query the state of the script.
- getTrafficStatus(request: traffic_manager_pb2.GetTrafficStatusMsg, context: grpc.ServicerContext) traffic_manager_pb2.TrafficDTO [source]
Gets the state of the traffic manager
- Parameters
request – the gRPC request
context – the gRPC context
- Returns
a TrafficDTO with the state of the traffic manager
- csle_collector.traffic_manager.traffic_manager.serve(port: int = 50043, log_dir: str = '/', max_workers: int = 10, log_file_name: str = 'traffic_manager.log') None [source]
Starts the gRPC server for managing traffic scripts
- 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.traffic_manager.traffic_manager_pb2 module
Generated protocol buffer code.
csle_collector.traffic_manager.traffic_manager_pb2_grpc module
Client and server classes corresponding to protobuf-defined services.
- class csle_collector.traffic_manager.traffic_manager_pb2_grpc.TrafficManager[source]
Bases:
object
Interface exported by the server
- static getTrafficStatus(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.traffic_manager.traffic_manager_pb2_grpc.TrafficManagerServicer[source]
Bases:
object
Interface exported by the server
csle_collector.traffic_manager.traffic_manager_util module
- class csle_collector.traffic_manager.traffic_manager_util.TrafficManagerUtil[source]
Bases:
object
Class with utility functions related to the Traffic Manager