Commit 41d8a726 authored by David Hancock's avatar David Hancock

Update controller to use config script

Can config for cloudlab or local execution via config.sh
parent 7c747da2
#!/bin/bash
if [[ $# -gt 0 ]]
then
echo "configuring controller for cloudlab execution"
printf "#!/bin/bash\n\n" > tests/ssh_vals.sh
printf "user=$1\n" >> tests/ssh_vals.sh
echo "/opt/hp4-src/hp4/hp4.json" > hp4controller/hp4_json_path
if [[ $# -gt 1 ]]
then
printf "nodes=( $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} )\n" >> tests/ssh_vals.sh
fi
else
echo "configuring controller for local (e.g., mininet) execution"
rm -f hp4controller/hp4_json_path
fi
......@@ -17,6 +17,7 @@ from errors import AddRuleError, ModRuleError, DeleteRuleError
import signal
import errno
import traceback
from pathlib2 import Path
import code
from inspect import currentframe, getframeinfo
......@@ -122,6 +123,11 @@ class Controller(object):
# TODO: fix this
json = '/home/ubuntu/hp4-src/hp4/hp4.json'
hjp_check = Path('hp4_json_path')
if hjp_check.is_file():
with open(hp4_json_path, 'r') as hjp:
json = hjp.readline()[:-1]
runtime_CLI.load_json_config(std_client, json)
rta = SimpleSwitchAPI(prelookup[pre], std_client, mc_client, sswitch_client)
......
#!/bin/bash
printf "#!/bin/bash\n\n" > ssh_vals.sh
printf "user=$1\n" >> ssh_vals.sh
printf "nodes=( $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} )\n" >> ssh_vals.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment