Setup files to support PM Mapper Publishing
[integration/csit.git] / plans / dcaegen2-pmmapper / pmmapper / dmaapbc.sh
1 #!/bin/bash
2 # $1 is the IP address of the buscontroller
3
4 # INITIALIZE: dmaap object
5 echo $'\nInitializing /dmaap endpoint'
6 JSON=/tmp/dmaap.json
7 cat << EOF > $JSON
8 {
9 "version": "1",
10 "topicNsRoot": "topic.org.onap.dmaap",
11 "drProvUrl": "https://dmaap-dr-prov:8443",
12 "dmaapName": "mr",
13 "bridgeAdminTopic": "MM_AGENT_PROV"
14
15 }
16 EOF
17 curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap
18
19 # INITIALIZE: dcaeLocation object
20 echo $'\nInitializing /dcaeLocations endpoint'
21 JSON=/tmp/dcaeLocation.json
22 cat << EOF > $JSON
23 {
24 "dcaeLocationName": "csit-pmmapper",
25 "dcaeLayer": "central-cloud",
26 "clli": "CSIT",
27 "zone": "zoneA"
28 }
29 EOF
30 curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dcaeLocations
31
32 # INITIALIZE: MR object in 1 site
33 echo $'\nInitializing /mr_clusters endpoint'
34 DMAAP=$(docker ps -a -q --filter="name=dmaap_1")
35 DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
36 JSON=/tmp/mr.json
37 cat << EOF > $JSON
38 {
39 "dcaeLocationName": "csit-pmmapper",
40 "fqdn": "${DMAAP_MR_IP}",
41 "topicProtocol" : "http",
42 "topicPort": "3904"
43 }
44 EOF
45 curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clusters
46
47 # CREATING: DR feed
48 echo $'\nInitializing /feeds endpoint'
49 JSON=/tmp/feed.json
50 cat << EOF > $JSON
51 {
52 "feedName":"pmmapper",
53 "feedVersion": "1",
54 "feedDescription":"PM Mapper Feed",
55 "owner":"bulkpm",
56 "asprClassification": "unclassified",
57 "pubs": [
58         {
59             "dcaeLocationName": "csit-pmmapper",
60             "feedId": "1",
61             "lastMod": "2015-01-01T15:00:00.000Z",
62             "pubId": "10",
63             "status": "EMPTY",
64             "username": "pmmapper",
65             "userpwd": "pmmapper"
66         }
67         ]
68 }
69 EOF
70 curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/feeds
71
72 # CREATING: MR Topic
73 echo $'\nInitializing /topic endpoint'
74 JSON=/tmp/topic.json
75 cat << EOF > $JSON
76 {
77 "topicName":"test1",
78 "topicDescription":"PM Mapper - VES Event",
79 "owner":"pmmapper"
80 }
81 EOF
82 curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/topics
83
84 # CREATING: MR Client
85 echo $'\nInitializing /mr_clients endpoint'
86 JSON=/tmp/mrclients.json
87 cat << EOF > $JSON
88 {
89 "fqtn": "topic.org.onap.dmaap.mr.test1",
90 "dcaeLocationName": "csit-pmmapper",
91 "clientRole": "org.onap.dmaap.mr.topic",
92 "action": [ "pub", "view" ]
93 }
94 EOF
95 curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clients
96 sleep 5