2 export DOCKER_HOST
="unix:///var/run/docker.sock"
8 # Wait until a line appears in the screen session.
9 # It starts from the beginning of the log and exits after the first match.
11 #timeout -k 3s ${T} stdbuf -o0 grep -q -m 1 "^${1}" <(tail -F -n+0 screenlog.0)
12 # (HACK) As Jenkins blocks subshell, we must use an intermediate script
19 if strings screenlog.0 | grep -m 1 "\${1}"; then
26 timeout
-k 3s
${T} ${SUBF} "${1}"
33 # Send a command to the screen session, aka into the containernet prompt
34 screen -S sonemu -X stuff "${1}^M
"
38 if ! screen --version | grep 'Screen version'; then
39 # Install screen and do an initial cleanup
40 sudo apt-get update -qq -y
41 sudo apt-get install -y screen
42 screen --version | grep 'Screen version'
44 if ! timeout --version; then
45 # Install coreutils for the timeout command
46 sudo apt-get update -qq -y
47 sudo apt-get install -y coreutils
51 pkill -f 'SCREEN -L -S sonemu' || true
56 # Start containernet with a topology
57 screen -L -S sonemu -d -m python src/emuvim/examples/simple_topology.py
58 # Setup screen for immediate flusing
59 screen -S sonemu -X logfile flush 0
60 # Wait for the cli to start
61 W '^*** Starting CLI:' 60s
65 son-emu-cli compute start -d datacenter1 -n vnf1 && sleep 1s
67 son-emu-cli compute start -d datacenter1 -n vnf2 && sleep 1s
69 son-emu-cli compute list && sleep 1s
71 Cmd 'sh echo "... starting various checks
"'
72 sync # avoid test overlapping
73 Cmd 'vnf1 ifconfig && echo "... checked vnf1
"'
75 Cmd 'vnf2 ifconfig && echo "... checked vnf2
"'
78 Cmd 'vnf1 ping -c 2 vnf2 || echo "... checked
ping"'
79 W "^... checked
ping" 20s
81 # Wait for sonemu to end
84 echo -e '\n\n******************* Result ******************\n\n'
86 echo -e '\n\n*********************************************\n\n'
89 # Check the ping result
90 if grep ', 2 received' screenlog.0; then
91 echo 'No problems detected'
94 echo 'Ping is broken !'