Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Limmen committed Apr 11, 2024
1 parent e9d8ae0 commit 68185db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ def createOvsSwitches(
:param context: the gRPC context
:return: an OperationOutcomeDTO
"""
logging.info(f"Creates OVS switches in execution with id: {request.ipFirstOctet} "
logging.info(f"Creating OVS switches in execution with id: {request.ipFirstOctet} "
f"and emulation: {request.emulation}")
execution = MetastoreFacade.get_emulation_execution(ip_first_octet=request.ipFirstOctet,
emulation_name=request.emulation)
Expand Down Expand Up @@ -835,6 +835,7 @@ def configureOvs(
emulation_name=request.emulation)
if execution is None:
return csle_cluster.cluster_manager.cluster_manager_pb2.OperationOutcomeDTO(outcome=False)
logging.info(f"Found execution with id: {request.ipFirstOctet}, applying the configuration")
OVSController.apply_ovs_config(emulation_env_config=execution.emulation_env_config,
physical_server_ip=GeneralUtil.get_host_ip(), logger=logging.getLogger())
return csle_cluster.cluster_manager.cluster_manager_pb2.OperationOutcomeDTO(outcome=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ def apply_ovs_config(emulation_env_config: EmulationEnvConfig, physical_server_i
cmd = f"{constants.COMMANDS.SUDO} {constants.OVS.OVS_VSCTL} set bridge {bridge_name} " \
f"protocols={','.join(ovs_sw.openflow_protocols)}"
logger.info(f"Running cmd:{cmd} on container: {ovs_sw.container_name}")
EmulationUtil.execute_ssh_cmd(cmd=cmd, conn=emulation_env_config.connections[ovs_sw.docker_gw_bridge_ip])
EmulationUtil.execute_ssh_cmd(cmd=cmd, conn=emulation_env_config.connections[ovs_sw.docker_gw_bridge_ip],
wait_for_completion=False)
logger.info(f"Command: {cmd} completed")
cmd = f"{constants.COMMANDS.SUDO} {constants.OVS.OVS_VSCTL} set-controller {bridge_name} " \
f"{ovs_sw.controller_transport_protocol}:{ovs_sw.controller_ip}:{ovs_sw.controller_port}"
logger.info(f"Running cmd:{cmd} on container: {ovs_sw.container_name}")
EmulationUtil.execute_ssh_cmd(cmd=cmd, conn=emulation_env_config.connections[ovs_sw.docker_gw_bridge_ip])
EmulationUtil.execute_ssh_cmd(cmd=cmd, conn=emulation_env_config.connections[ovs_sw.docker_gw_bridge_ip],
wait_for_completion=False)
logger.info(f"Command: {cmd} completed")

0 comments on commit 68185db

Please sign in to comment.