Add O2 IMS compliance automation test scripts.
[it/test.git] / test_scripts / O2IMS_Compliance_Test / mock.sh
1 #!/bin/bash
2 # $1 mocker server host
3 # $2 mocker server port
4
5 if [ "$#" -ne 2 ]; then
6     echo "need 2 arguments"
7     exit 1
8 fi
9
10 export mockserver_host=$1
11 export mockserver_port=$2
12 export SMO_ENDPOINT="https://${mockserver_host}:${mockserver_port}/mockserver"
13
14 VALID_CLOUD_OBSERVER="{
15  \"id\": \"mock_smo_registration\",
16   \"httpRequest\" : {
17     \"path\" : \"/mock_smo/v1/ocloud_observer\",
18     \"method\":\"POST\"
19   },
20   \"httpResponse\" : {
21    \"statusCode\": 204,
22     \"body\" : {
23     \"status\": 204,
24     \"result\": \"Welcome to mocked smo server!\"
25     }
26   },
27   \"priority\" : 10
28 }"
29
30 INVALID_CLOUD_OBSERVER="{
31   \"id\": \"invalid_mock_smo_registration\",
32   \"httpRequest\" : {
33     \"path\" : \"/mock_smo/v1/invalid_ocloud_observer\",
34     \"method\":\"POST\"
35   },
36   \"httpResponse\" : {
37     \"statusCode\": 500,
38     \"body\" : {
39     \"status\": 500,
40     \"result\": \"mocked smo server invalid\"
41     }
42   },
43   \"priority\" : 10
44 }"
45
46 O2IMS_INVENTORY_OBSERVER="{
47   \"id\": \"mock_smo_inventory_change_notification_endpoint_registration\",
48   \"httpRequest\" : {
49     \"path\" : \"/mock_smo/v1/o2ims_inventory_observer\",
50     \"method\":\"POST\"
51   },
52   \"httpResponse\" : {
53     \"statusCode\": 204,
54     \"body\" : {
55     \"status\": 204,
56     \"result\": \"this is mocked inventory change notification callback\"
57     }
58   },
59   \"priority\" : 10
60 }"
61
62 O2IMS_ALARM_OBSERVER="{
63   \"id\": \"mock_smo_alarm_notification_endpoint_registration\",
64   \"httpRequest\" : {
65     \"path\" : \"/mock_smo/v1/o2ims_alarm_observer\",
66     \"method\":\"POST\"
67   },
68   \"httpResponse\" : {
69     \"statusCode\": 204,
70     \"body\" : {
71     \"status\": 204,
72     \"result\": \"Welcome to mocked smo server alarm notification endpoint\"
73     }
74   },
75   \"priority\" : 10
76 }"
77
78 curl -s -k -X PUT $SMO_ENDPOINT/expectation  --header 'Content-Type: application/json' \
79 --header 'Accept: application/json' \
80 -d "${VALID_CLOUD_OBSERVER}" 
81
82 curl -s -k -X PUT $SMO_ENDPOINT/expectation  --header 'Content-Type: application/json' \
83 --header 'Accept: application/json' \
84 -d "${INVALID_CLOUD_OBSERVER}"
85
86 curl -s -k -X PUT $SMO_ENDPOINT/expectation  --header 'Content-Type: application/json' \
87 --header 'Accept: application/json' \
88 -d "${O2IMS_INVENTORY_OBSERVER}"
89
90
91 curl -s -k -X PUT $SMO_ENDPOINT/expectation  --header 'Content-Type: application/json' \
92 --header 'Accept: application/json' \
93 -d "${O2IMS_ALARM_OBSERVER}"
94
95 exit