2 export DOCKER_HOST
="unix:///var/run/docker.sock"
8 # Wait until a line appears in the screen session
10 timeout
-k 3s
${T} grep -q "^${1}" <(tail -f screenlog
.0)
14 # Send a command to the screen session, aka into the containernet prompt
15 screen
-S sonemu
-X stuff
"${1}^M"
19 if ! screen
--version |
grep 'Screen version'; then
20 # Install screen and do an initial cleanup
21 sudo apt-get update
-qq -y
22 sudo apt-get
install -y screen
23 screen
--version |
grep 'Screen version'
26 pkill
'screen' || true
31 # Start containernet with a topology
32 screen
-L -S sonemu
-d -m python src
/emuvim
/examples
/simple_topology.py
33 # Setup screen for immediate flusing
34 screen
-S sonemu
-X logfile flush
0
35 # Wait for the cli to start
40 son-emu-cli compute start
-d datacenter1
-n vnf1
&& sleep 1s
42 son-emu-cli compute start
-d datacenter1
-n vnf2
&& sleep 1s
44 son-emu-cli compute list
&& sleep 1s
46 Cmd
'sh echo "... starting various checks"'
47 Cmd
'vnf1 ifconfig && echo "... checked vnf1"'
49 Cmd
'vnf2 ifconfig && echo "... checked vnf2"'
52 Cmd
'vnf1 ping -c 2 vnf2 || echo "... checked ping"'
53 W
"... checked ping" 20s
55 # Wait for sonemu to end
58 echo -e '\n\n************i****** Result ******************\n\n'
60 echo -e '\n\n*********************************************\n\n'
63 # Check the ping result
64 if grep ', 2 received' screenlog
.0; then
65 echo 'No problems detected'
68 echo 'Ping is broken !'