3 #Copyright 2016 Open Platform for NFV Project, Inc. and its contributors
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
20 dir=$(python -c "import sysconfig; print sysconfig.get_path('platlib')")
21 toscafile_test1=${dir}/tosca-templates/tosca_helloworld_nfv.yaml
22 test1_reffile1=${dir}/tests/refdata/test1_client1.ref
23 test1_reffile2=${dir}/tests/refdata/test1_client2.ref
24 client1_log=${dir}/tests/logdata/client1.log
25 client2_log=${dir}/tests/logdata/client2.log
26 server_log=${dir}/tests/logdata/server.log
30 pgrep -f "DominoServer" && return 0
31 DominoServer --log "$LOGLEVEL" > "$server_log" 2>&1 &
35 pgrep -f "DominoServer" || return 0
36 kill $(pgrep -f "DominoServer")
41 #pgrep -f "DominoClient -p $CLIENT1_PORT" && return 0
42 DominoClient -p $CLIENT1_PORT --cliport $CLIENT1_CLIPORT \
43 --log "$LOGLEVEL" > "$client1_log" 2>&1 &
47 #pgrep -f "DominoClient -p $CLIENT2_PORT" && return 0
48 DominoClient -p $CLIENT2_PORT --cliport $CLIENT2_CLIPORT \
49 --log "$LOGLEVEL" > "$client2_log" 2>&1 &
53 pgrep -f "DominoClient" || return 0
54 kill $(pgrep -f "DominoClient")
59 if [ -f dominoserver.db ]; then
63 if [ -d toscafiles ]; then
72 echo "Stopping Domino Clients..."
75 echo "Stopping Domino Server..."
87 echo "domino/tests/run.sh has been executed."
91 echo "Terminating any running Domino Clients..."
94 echo "Terminating any running Domino Servers..."
98 echo "Cleaning residue files and folders from previous runs..."
102 echo "Launching Domino Server..."
106 echo "Launching Domino Client 1..."
110 echo "Launching Domino Client 2..."
114 echo "Test Heartbeat"
115 domino_cli $CLIENT1_CLIPORT heartbeat
118 echo "Test Subscribe API"
119 domino_cli $CLIENT1_CLIPORT subscribe -t hot \
120 -l tosca.policies.Placement:properties:region:nova-1
122 domino_cli $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE
124 domino_cli $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE
126 domino_cli $CLIENT1_CLIPORT subscribe \
127 -l tosca.policies.Placement:properties:region:nova-2
129 domino_cli $CLIENT1_CLIPORT subscribe \
130 -l tosca.policies.Placement:properties:region:nova-3 \
133 domino_cli $CLIENT1_CLIPORT subscribe \
134 -l tosca.policies.Placement:properties:region:nova-3 \
138 echo "Test Publish API"
139 domino_cli $CLIENT1_CLIPORT publish -t "$toscafile_test1"
142 domino_cli $CLIENT1_CLIPORT subscribe \
143 -l tosca.policies.Placement.Geolocation:properties:region:us-west-1
145 domino_cli $CLIENT2_CLIPORT publish -t "$toscafile_test1"
147 TUID=$(domino_cli $CLIENT2_CLIPORT list-tuids | cut -c3-34)
150 domino_cli $CLIENT2_CLIPORT publish -t "$toscafile_test1" -k "$TUID"
152 #echo "Stopping Domino Client 1..."
155 #echo "Stopping Domino Server..."
158 cut -d " " -f 4- "$client1_log" > file1
159 cut -d " " -f 4- "$client2_log" > file2
160 #will use the form below to declare success or failure
163 diff -q file1 "$test1_reffile1" 1>/dev/null
171 diff -q file2 "$test1_reffile2" 1>/dev/null