Skip to content

Commit

Permalink
bugs fixed, tesing done
Browse files Browse the repository at this point in the history
  • Loading branch information
nforsg committed Aug 3, 2023
1 parent b56af48 commit eb1378c
Show file tree
Hide file tree
Showing 8 changed files with 325 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
EmulationExecutionInfo,
)


class ClusterController:
"""
Controller managing API calls to cluster managers
Expand Down Expand Up @@ -1830,7 +1831,7 @@ def stop_docker_statsmanager_thread(ip: str, port: int, emulation: str, ip_first
# Open a gRPC session
with grpc.insecure_channel(f'{ip}:{port}', options=constants.GRPC_SERVERS.GRPC_OPTIONS) as channel:
stub = csle_cluster.cluster_manager.cluster_manager_pb2_grpc.ClusterManagerStub(channel)
operation_outcome_dto = csle_cluster.cluster_manager.query_cluster_manager.stop_docker_stats_manager_thread(
operation_outcome_dto = csle_cluster.cluster_manager.query_cluster_manager.stop_docker_statsmanager_thread(
stub=stub, emulation=emulation, ip_first_octet=ip_first_octet)
return operation_outcome_dto

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from csle_collector.docker_stats_manager.docker_stats import DockerStats
from csle_collector.docker_stats_manager.docker_stats_manager_pb2 import DockerStatsMonitorDTO


class DockerStatsUtil:
"""
Utility class for managing docker container statistics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
logger = logging.getLogger()


class ElkManagerUtil:
"""
Class with utility functions related to the ELK Manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import csle_collector.elk_manager.elk_manager_util as elk_manager_util
from csle_base.json_serializable import JSONSerializable


class ELKManagersInfo(JSONSerializable):
"""
DTO containing the status of the ELK managers for a given emulation execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import logging
logger = logging.getLogger()


class EmulationExecutionInfo(JSONSerializable):
"""
DTO containing the runtime status of an emulation execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def from_dict(d: Dict[str, Any]) -> "TrafficManagersInfo":
dto = TrafficManagersInfo(
traffic_managers_running=d["traffic_managers_running"], ips=d["ips"], ports=d["ports"],
emulation_name=d["emulation_name"], execution_id=d["execution_id"],
traffic_managers_statuses=list(map(lambda x: traffic_manager_util.TrafficManagerUtil.traffic_dto_from_dict(x),
traffic_managers_statuses=list(map(lambda x:
traffic_manager_util.TrafficManagerUtil.traffic_dto_from_dict(x),
d["traffic_managers_statuses"])))
return dto

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def emulation_execution(execution_id: int):
:param execution_id: the id of the execution
:return: The given execution
"""
authorized = rest_api_util.check_if_user_is_authorized(request=request, requires_admin = False)
authorized = rest_api_util.check_if_user_is_authorized(request=request, requires_admin=False)
if authorized is not None:
return authorized
# Extract emulation query parameter
Expand Down Expand Up @@ -426,7 +426,7 @@ def start_stop_docker_stats_monitor(execution_id: int) -> Tuple[Response, int]:
f"Stopping docker stats monitor for emulation: {execution.emulation_env_config.name}, "
f"execution id: {execution.ip_first_octet}")
for node in config.cluster_config.cluster_nodes:
ClusterController.stop_docker_stats_manager_thread(
ClusterController.stop_docker_statsmanager_thread(
ip=node.ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT, emulation=execution.emulation_name,
ip_first_octet=execution.ip_first_octet)
if start:
Expand Down Expand Up @@ -2319,7 +2319,7 @@ def get_sdn_switches_of_execution(execution_id: int) -> Tuple[Response, int]:
:param execution_id: the id of the execution
:return: The sought for switches if they exist
"""
authorized = rest_api_util.check_if_user_is_authorized(request=request)
authorized = rest_api_util.check_if_user_is_authorized(request=request, requires_admin=False)
if authorized is not None:
return authorized

Expand Down

Large diffs are not rendered by default.

0 comments on commit eb1378c

Please sign in to comment.