mirror of
https://github.com/Telecominfraproject/wlan-cloud-loadsim.git
synced 2025-11-01 19:17:49 +00:00
Changing API entry point
This commit is contained in:
@@ -9,6 +9,11 @@ NET_NAME=owls_net
|
||||
TIP_CONTROLLER_NAME=debfarm1-node-a.arilia.com
|
||||
# You must set this to the IP address of your TIP controller
|
||||
TIP_CONTROLLER_IP=10.3.11.1
|
||||
# This is the name of the host providing API access. In some cases, it may be the same as the TIP controller host name
|
||||
TIP_API_HOST=debfarm1-node-a.arilia.com
|
||||
TIP_API_HOST_IP=10.3.11.1
|
||||
|
||||
SCRIPT_NAME=$PWD/scripts/simulation.yaml
|
||||
|
||||
# clean networks and create the testing network
|
||||
docker network prune --force
|
||||
@@ -30,7 +35,7 @@ rm -rf docker_logs_node1
|
||||
mkdir docker_logs_manager
|
||||
mkdir docker_logs_node1
|
||||
|
||||
HOSTNAMES="--add-host mgr.owls.net:172.21.10.2 --add-host node1.owls.net:172.21.10.3 --add-host $TIP_CONTROLLER_NAME:$TIP_CONTROLLER_IP"
|
||||
HOSTNAMES="--add-host mgr.owls.net:172.21.10.2 --add-host node1.owls.net:172.21.10.3 --add-host $TIP_CONTROLLER_NAME:$TIP_CONTROLLER_IP --add-host $TIP_API_HOST:$TIP_API_HOST_IP"
|
||||
|
||||
#
|
||||
# A simulation file called sim1.yaml is used to describe how a simulation should run. Here is the content...
|
||||
@@ -50,15 +55,13 @@ HOSTNAMES="--add-host mgr.owls.net:172.21.10.2 --add-host node1.owls.net:172.21.
|
||||
#
|
||||
# -e ERL_NODE_NAME="mgr@mgr.owls.net" -e ERL_OPTIONS="-noshell -noinput" -e ERL_NODE_TYPE="manager" -e TIP_AUTH="2" -e SIM_SCRIPT="/scripts/sim1.yaml" \
|
||||
|
||||
|
||||
|
||||
#start manager node
|
||||
docker run -d -p 9091:9090 --init \
|
||||
--network=owls_net \
|
||||
--volume="$PWD/ssl:/etc/ssl/certs" \
|
||||
--volume="$PWD/docker_logs_manager:/app_data/logs" \
|
||||
--volume="$PWD/scripts:/scripts" \
|
||||
-e ERL_NODE_NAME="mgr@mgr.owls.net" -e ERL_OPTIONS="-noshell -noinput" -e ERL_NODE_TYPE="manager" -e TIP_AUTH="2" \
|
||||
-e ERL_NODE_NAME="mgr@mgr.owls.net" -e ERL_OPTIONS="-noshell -noinput -tipauth 2 -tipapi $TIP_API_HOST -sim $SIM_SCRIPT " -e ERL_NODE_TYPE="manager" \
|
||||
--ip="172.21.10.2" $HOSTNAMES \
|
||||
--name="manager" $DOCKER_NAME
|
||||
|
||||
@@ -67,7 +70,7 @@ docker run -d --init \
|
||||
--network=owls_net \
|
||||
--volume="$PWD/ssl:/etc/ssl/certs" \
|
||||
--volume="$PWD/docker_logs_node1:/app_data/logs" \
|
||||
-e ERL_NODE_NAME="node1@mgr.owls.net" -e ERL_OPTIONS="-noshell -noinput" -e ERL_NODE_TYPE="node" -e TIP_AUTH="2" \
|
||||
-e ERL_NODE_NAME="node1@mgr.owls.net" -e ERL_OPTIONS="-noshell -noinput -tipauth 2 -tipapi $TIP_API_HOST" -e ERL_NODE_TYPE="node" \
|
||||
--ip="172.21.10.3" $HOSTNAMES \
|
||||
--name="node1" $DOCKER_NAME
|
||||
|
||||
|
||||
@@ -6,22 +6,17 @@ case $ERL_NODE_TYPE in
|
||||
manager)
|
||||
cp priv/templates/simmanager.args.template.docker config/vm.args
|
||||
cp priv/templates/simmanager.config.template.docker config/sys.config
|
||||
if [ -z "$SIM_SCRIPT" ]
|
||||
then
|
||||
erl -config config/sys.config -args_file config/vm.args -name $ERL_NODE_NAME $ERL_OPTIONS -pa deps/*/ebin -pa ebin -tipauth $TIP_AUTH
|
||||
else
|
||||
erl -config config/sys.config -args_file config/vm.args -name $ERL_NODE_NAME $ERL_OPTIONS -pa deps/*/ebin -pa ebin -tipauth $TIP_AUTH -sim $SIM_SCRIPT
|
||||
fi
|
||||
erl -config config/sys.config -args_file config/vm.args -name $ERL_NODE_NAME $ERL_OPTIONS -pa deps/*/ebin -pa ebin
|
||||
;;
|
||||
node)
|
||||
cp priv/templates/simnode.args.template.docker config/vm.args
|
||||
cp priv/templates/simnode.config.template.docker config/sys.config
|
||||
erl -config config/sys.config -args_file config/vm.args -name $ERL_NODE_NAME $ERL_OPTIONS -pa deps/*/ebin -pa ebin -tipauth $TIP_AUTH
|
||||
erl -config config/sys.config -args_file config/vm.args -name $ERL_NODE_NAME $ERL_OPTIONS -pa deps/*/ebin -pa ebin
|
||||
;;
|
||||
monitor)
|
||||
cp priv/templates/simmonitor.args.template.docker config/vm.args
|
||||
cp priv/templates/simmonitor.config.template.docker config/sys.config
|
||||
erl -config config/sys.config -args_file config/vm.args -name $ERL_NODE_NAME $ERL_OPTIONS -pa deps/*/ebin -pa ebin -tipauth $TIP_AUTH
|
||||
erl -config config/sys.config -args_file config/vm.args -name $ERL_NODE_NAME $ERL_OPTIONS -pa deps/*/ebin -pa ebin
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -35,14 +35,12 @@ loginUserAndPassword() ->
|
||||
<<"{ \"userId\": \"support@example.com\", \"password\": \"support\" }">>
|
||||
end.
|
||||
|
||||
tip_port() ->
|
||||
case init:get_argument(tipauth) of
|
||||
{ok,[["1"]]} ->
|
||||
30251;
|
||||
{ok,[["2"]]} ->
|
||||
30151;
|
||||
get_api_endpoint_name(Sim) ->
|
||||
case init:get_argument(tipapi) of
|
||||
{ok,[[APIEndPoint]]} ->
|
||||
APIEndPoint;
|
||||
_ ->
|
||||
30251
|
||||
binary_to_list(Sim#simulation.opensync_server_name)
|
||||
end.
|
||||
|
||||
% Options foe SSL: {cacerts, client_cacerts()}
|
||||
@@ -52,8 +50,8 @@ login(SimName)->
|
||||
_=inets:start(),
|
||||
try
|
||||
{ok,Sim} = simengine:get(SimName),
|
||||
ServerName = binary_to_list(Sim#simulation.opensync_server_name),
|
||||
LoginURIBase = "https://" ++ ServerName ++ ":" ++ integer_to_list(tip_port()),
|
||||
ServerName = get_api_endpoint_name(Sim),
|
||||
LoginURIBase = "https://" ++ ServerName,
|
||||
LoginURI = LoginURIBase ++ loginEndpoint(),
|
||||
LoginPassword = loginUserAndPassword(),
|
||||
_ = case httpc:request(post, {LoginURI, [],["application/json"],LoginPassword}, [], []) of
|
||||
|
||||
Reference in New Issue
Block a user