blob: e7f21125ac7e9f7c1872797013ef8fc9ab14abea [file] [log] [blame]
Scott Bakeracb2bf62019-03-15 10:20:35 -07001#!/bin/bash
2
3# Copyright 2017-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -e
18
19CHAMELEON_URL=http://`hostname`:30006/xosapi/v1/testservice/testserviceserviceinstances
20TOSCA_URL=http://`hostname`:30007
21TEST_POD=`kubectl get pods | grep -i testservice | cut -f 1 -d " "`
22RECIPE=../tosca/test_sync_after_policy_update.yaml
23
24curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X post --data-binary @$RECIPE $TOSCA_URL/run
25
26echo "done tosca"
27
28cat <<EOF > wait_for.txt
29TEST:SYNC_DONE id=[0-9]+ model_class=TestserviceServiceInstance model_name=u'test-sync-after-policy-update' some_integer=1 some_other_integer=0
30TEST:POLICY_DONE id=[0-9]+ model_class=TestserviceServiceInstance model_name=u'test-sync-after-policy-update' some_integer=0 some_other_integer=0
31TEST:POLICY_DONE id=[0-9]+ model_class=TestserviceServiceInstance model_name=u'test-sync-after-policy-update' some_integer=1 some_other_integer=0
32EOF
33kubectl logs -f --since=30s $TEST_POD | ansi2txt | python wait_for_lines.py wait_for.txt
34
35python ./verify_model.py $CHAMELEON_URL name=test-sync-after-policy-update "updated>=0" "enacted>=@updated" "policed>=@enacted" "some_integer=1"