Renamed propperly WSL to WLS to avoid confussions

This commit is contained in:
Alberto Soutullo
2023-02-21 16:38:49 +01:00
committed by Alberto Soutullo Rendo
parent 9fdec86e1d
commit 1b433f56cc
16 changed files with 59 additions and 59 deletions

4
.gitignore vendored
View File

@@ -16,8 +16,8 @@ node_modules/
targets.json
data/
enclave.dump/
wsl-module/requirements.txt
wsl-module/__pycache__
wls-module/requirements.txt
wls-module/__pycache__
config/network_topology_auto/
config/config.json
gennet-module/topology/

View File

@@ -34,7 +34,7 @@ These are arguments that can be modified:
- _jobs_: int. Defines how many services will be instantiated at the same time.
- _interconnection_batch_: int. If nodes are being connected by a given topology, this tells kurtosis how many connections will try to set up in the same node at a time. Used to avoid timeouts if a node has a lot of connections.
- [WLS](wsl-module/README.md) module configuration
- [WLS](wls-module/README.md) module configuration
- [Gennet](gennet-module/Readme.md) module configuration
#### What will happen
@@ -50,7 +50,7 @@ Once all nodes have been interconnected the simulation starts and will inject tr
- Simulation log:
'kurtosis service logs wakurtosis $(kurtosis enclave inspect <enclave-name> | grep wsl- | awk '{print $1}')'
'kurtosis service logs wakurtosis $(kurtosis enclave inspect <enclave-name> | grep wls- | awk '{print $1}')'
- Grafana server:

View File

@@ -11,9 +11,9 @@ sudo apt install kurtosis-cli=$kurtosis_version
sudo apt-mark hold kurtosis-cli
sudo rm /etc/apt/sources.list.d/kurtosis.list
# Build WSL and Gennet docker image
cd wsl-module
docker build -t wsl:0.0.1 .
# Build WLS and Gennet docker image
cd wls-module
docker build -t wls:0.0.1 .
cd ..
cd gennet-module

View File

@@ -6,7 +6,7 @@ waku = import_module(vars.WAKU_MODULE)
prometheus = import_module(vars.PROMETHEUS_MODULE)
grafana = import_module(vars.GRAFANA_MODULE)
args_parser = import_module(vars.ARGUMENT_PARSER_MODULE)
wsl = import_module(vars.WSL_MODULE)
wls = import_module(vars.WLS_MODULE)
nodes = import_module(vars.NODE_BUILDERS_MODULE)
@@ -18,7 +18,7 @@ def run(plan, args):
config = json.decode(config_json)
kurtosis_config = config[vars.KURTOSIS_KEY]
wsl_config = config[vars.WLS_KEY]
wls_config = config[vars.WLS_KEY]
interconnection_batch = kurtosis_config[vars.INTERCONNECTION_BATCH_KEY]
# Load network topology
@@ -35,5 +35,5 @@ def run(plan, args):
waku.interconnect_waku_nodes(plan, network_topology, interconnection_batch)
# Setup WSL & Start the Simulation
wsl_service = wsl.init(plan, network_topology, wsl_config)
# Setup WLS & Start the Simulation
wls_service = wls.init(plan, network_topology, wls_config)

14
run.sh
View File

@@ -44,10 +44,10 @@ kurtosis_cmd="kurtosis run --enclave-id ${enclave_name} . '{\"wakurtosis_config_
eval $kurtosis_cmd
echo -e "Enclave " $enclave_name " is up and running"
# Fetch the WSL service id and display the log of the simulation
wsl_service_name=$(kurtosis enclave inspect wakurtosis | grep wsl | awk '{print $1}')
# kurtosis service logs wakurtosis $wsl_service_name
echo -e "\n--> To see simulation logs run: kurtosis service logs wakurtosis $wsl_service_name <--"
# Fetch the WLS service id and display the log of the simulation
wls_service_name=$(kurtosis enclave inspect wakurtosis | grep wls | awk '{print $1}')
# kurtosis service logs wakurtosis $wls_service_name
echo -e "\n--> To see simulation logs run: kurtosis service logs wakurtosis $wls_service_name <--"
# Fetch the Grafana address & port
grafana_host=$(kurtosis enclave inspect wakurtosis | grep grafana | awk '{print $6}')
@@ -55,11 +55,11 @@ echo -e "\n--> Statistics in Grafana server at http://$grafana_host/ <--"
# echo "Output of kurtosis run command written in kurtosisrun_log.txt"
### Wait for WSL to finish
### Wait for WLS to finish
# Get the container suffix for the running service
enclave_preffix="$(kurtosis enclave inspect --full-uuids $enclave_name | grep UUID: | awk '{print $2}')"
cid_suffix="$(kurtosis enclave inspect --full-uuids $enclave_name | grep $wsl_service_name | cut -f 1 -d ' ')"
cid_suffix="$(kurtosis enclave inspect --full-uuids $enclave_name | grep $wls_service_name | cut -f 1 -d ' ')"
# Construct the fully qualified container name that kurtosis created
cid="$enclave_preffix--user-service--$cid_suffix"
@@ -69,7 +69,7 @@ echo "Waiting for simulation to finish ..."
status_code="$(docker container wait $cid)"
# Copy simulation results
# docker cp "$cid:/wsl/summary.json" "./"
# docker cp "$cid:/wls/summary.json" "./"
# echo "Simulation ended with code $status_code Results in ./summary.json"
# Stop and delete the enclave

View File

@@ -72,16 +72,16 @@ PEER_ID_KEY = "peer_id"
IP_KEY = "ip_address"
PORTS_KEY = "ports"
# WSL Configuration
WSL_IMAGE = "wsl:0.0.1"
WSL_SERVICE_NAME = "wsl"
WSL_CONFIG_PATH = "/wsl/config"
WSL_TARGETS_PATH = "/wsl/targets"
WSL_TOMLS_PATH = "/wsl/tomls"
WLS_CMD = ["python3", "wsl.py"]
# WLS Configuration
WLS_IMAGE = "wls:0.0.1"
WLS_SERVICE_NAME = "wls"
WLS_CONFIG_PATH = "/wls/config"
WLS_TARGETS_PATH = "/wls/targets"
WLS_TOMLS_PATH = "/wls/tomls"
WLS_CMD = ["python3", "wls.py"]
CONTAINER_WSL_CONFIGURATION_FILE_NAME = "wsl.yml"
CONTAINER_TARGETS_FILE_NAME_WSL = "targets.json"
CONTAINER_WLS_CONFIGURATION_FILE_NAME = "wls.yml"
CONTAINER_TARGETS_FILE_NAME_WLS = "targets.json"
# Waku RPC methods
POST_RELAY_MESSAGE_METHOD = "post_waku_v2_relay_v1_message"
@@ -100,7 +100,7 @@ GRAFANA_MODULE = "github.com/logos-co/wakurtosis/src/monitoring/grafana.star"
ARGUMENT_PARSER_MODULE = "github.com/logos-co/wakurtosis/src/arguments_parser.star"
FILE_HELPERS_MODULE = "github.com/logos-co/wakurtosis/src/file_helpers.star"
TEMPLATES_MODULE = "github.com/logos-co/wakurtosis/src/templates.star"
WSL_MODULE = "github.com/logos-co/wakurtosis/src/wsl.star"
WLS_MODULE = "github.com/logos-co/wakurtosis/src/wls.star"
TEST_ARGUMENTS_MODULE = "github.com/logos-co/wakurtosis/src/tests/test_arguments_parser.star"
TEST_FILES_MODULE = "github.com/logos-co/wakurtosis/src/tests/test_file_helpers.star"

View File

@@ -33,10 +33,10 @@ def get_prometheus_template():
return template
# WSL
def get_wsl_template():
# WLS
def get_wls_template():
# Traffic simulation parameters
wsl_yml_template = """
wls_yml_template = """
general:
debug_level : "DEBUG"
@@ -68,4 +68,4 @@ def get_wsl_template():
inter_msg_type : {{.inter_msg_type}}
"""
return wsl_yml_template
return wls_yml_template

View File

@@ -8,16 +8,16 @@ templates = import_module(vars.TEMPLATES_MODULE)
def create_config(plan, wls_config):
# Traffic simulation parameters
wsl_yml_template = templates.get_wsl_template()
wls_yml_template = templates.get_wls_template()
artifact_id = plan.render_templates(
config={
vars.CONTAINER_WSL_CONFIGURATION_FILE_NAME: struct(
template=wsl_yml_template,
vars.CONTAINER_WLS_CONFIGURATION_FILE_NAME: struct(
template=wls_yml_template,
data=wls_config,
)
},
name="wsl_config"
name="wls_config"
)
return artifact_id
@@ -34,20 +34,20 @@ def create_targets(plan, services):
artifact_id = plan.render_templates(
config={
vars.CONTAINER_TARGETS_FILE_NAME_WSL: struct(
vars.CONTAINER_TARGETS_FILE_NAME_WLS: struct(
template=template,
data=template_data,
)
},
name="wsl_targets"
name="wls_targets"
)
return artifact_id
def init(plan, services, wsl_config):
def init(plan, services, wls_config):
# Generate simulation config
wsl_config = create_config(plan, wsl_config)
wls_config = create_config(plan, wls_config)
tomls_artifact = plan.upload_files(
src = vars.NODE_CONFIG_FILE_LOCATION,
@@ -55,23 +55,23 @@ def init(plan, services, wsl_config):
)
# Create targets.json
wsl_targets = create_targets(plan, services)
wls_targets = create_targets(plan, services)
add_service_config = ServiceConfig(
image=vars.WSL_IMAGE,
image=vars.WLS_IMAGE,
ports={},
files={
vars.WSL_CONFIG_PATH: wsl_config,
vars.WSL_TARGETS_PATH: wsl_targets,
vars.WSL_TOMLS_PATH: tomls_artifact
vars.WLS_CONFIG_PATH: wls_config,
vars.WLS_TARGETS_PATH: wls_targets,
vars.WLS_TOMLS_PATH: tomls_artifact
},
cmd=vars.WLS_CMD
)
wsl_service = plan.add_service(
service_name=vars.WSL_SERVICE_NAME,
wls_service = plan.add_service(
service_name=vars.WLS_SERVICE_NAME,
config=add_service_config
)
return wsl_service
return wls_service

View File

@@ -1,4 +1,4 @@
Wakurtosis Load Simualtor (WSL)
Wakurtosis Load Simualtor (WLS)
===============================
Kurtosis: https://docs.kurtosis.com/
@@ -8,7 +8,7 @@ Kurtosis: https://docs.kurtosis.com/
To build docker image:
`sh ./build.sh`
Name of the image is wsl:0.0.1
Name of the image is wls:0.0.1
### Parameters

6
wls-module/build.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
# pip freeze > requirements.txt
image_id=$(docker images -q wls:0.0.1)
echo $image_id
docker image rm -f $image_id
docker image build --progress=plain -t wls:0.0.1 ./

View File

@@ -1,7 +1,7 @@
FROM python:3.11.0
LABEL Maintainer="Daimakaimura"
WORKDIR /wsl
COPY wsl.py .
WORKDIR /wls
COPY wls.py .
COPY rtnorm.py .
COPY requirements.txt ./
RUN pip install -r requirements.txt

View File

@@ -17,7 +17,7 @@ import rtnorm
""" Globals """
G_APP_NAME = 'WLS'
G_LOG_LEVEL = 'DEBUG'
G_DEFAULT_CONFIG_FILE = './config/wsl.yml'
G_DEFAULT_CONFIG_FILE = './config/wls.yml'
G_LOGGER = None
""" Custom logging formatter """

View File

@@ -1,6 +0,0 @@
#!/bin/sh
# pip freeze > requirements.txt
image_id=$(docker images -q wsl:0.0.1)
echo $image_id
docker image rm -f $image_id
docker image build --progress=plain -t wsl:0.0.1 ./