blob: 1430258999d178c32262f3425b8d11b870d7b2d8 [file] [log] [blame]
rajendrajaiswal8f0afd82019-02-11 12:30:26 +00001#!/bin/bash
rajendrajaiswal8f0afd82019-02-11 12:30:26 +00002# $1 is the IP address of the buscontroller
rajendrajaiswal59a78502019-03-21 16:31:19 +00003
rajendrajaiswal8f0afd82019-02-11 12:30:26 +00004# INITIALIZE: dmaap object
rajendrajaiswal59a78502019-03-21 16:31:19 +00005echo $'\nInitializing /dmaap endpoint'
rajendrajaiswala1574702019-02-14 10:29:45 +00006JSON=/tmp/dmaap.json
rajendrajaiswal8f0afd82019-02-11 12:30:26 +00007cat << EOF > $JSON
8{
9"version": "1",
rajendrajaiswal59a78502019-03-21 16:31:19 +000010"topicNsRoot": "topic.org.onap.dmaap",
rajendrajaiswal8f0afd82019-02-11 12:30:26 +000011"drProvUrl": "https://dmaap-dr-prov:8443",
rajendrajaiswal59a78502019-03-21 16:31:19 +000012"dmaapName": "mr",
rajendrajaiswal8f0afd82019-02-11 12:30:26 +000013"bridgeAdminTopic": "MM_AGENT_PROV"
14
15}
16EOF
rajendrajaiswala1574702019-02-14 10:29:45 +000017curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap
18
19# INITIALIZE: dcaeLocation object
rajendrajaiswal59a78502019-03-21 16:31:19 +000020echo $'\nInitializing /dcaeLocations endpoint'
rajendrajaiswala1574702019-02-14 10:29:45 +000021JSON=/tmp/dcaeLocation.json
22cat << EOF > $JSON
23{
24"dcaeLocationName": "csit-pmmapper",
25"dcaeLayer": "central-cloud",
26"clli": "CSIT",
27"zone": "zoneA"
28}
29EOF
rajendrajaiswala1574702019-02-14 10:29:45 +000030curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dcaeLocations
31
32# INITIALIZE: MR object in 1 site
rajendrajaiswal59a78502019-03-21 16:31:19 +000033echo $'\nInitializing /mr_clusters endpoint'
34DMAAP=$(docker ps -a -q --filter="name=dmaap_1")
rajendrajaiswala1574702019-02-14 10:29:45 +000035DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
36JSON=/tmp/mr.json
37cat << EOF > $JSON
38{
39"dcaeLocationName": "csit-pmmapper",
rajendrajaiswal59a78502019-03-21 16:31:19 +000040"fqdn": "${DMAAP_MR_IP}",
rajendrajaiswala1574702019-02-14 10:29:45 +000041"topicProtocol" : "http",
42"topicPort": "3904"
43}
44EOF
rajendrajaiswala1574702019-02-14 10:29:45 +000045curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clusters
46
47# CREATING: DR feed
rajendrajaiswal59a78502019-03-21 16:31:19 +000048echo $'\nInitializing /feeds endpoint'
rajendrajaiswala1574702019-02-14 10:29:45 +000049JSON=/tmp/feed.json
50cat << EOF > $JSON
51{
52"feedName":"pmmapper",
53"feedVersion": "1",
54"feedDescription":"PM Mapper Feed",
55"owner":"bulkpm",
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +000056"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 ]
rajendrajaiswala1574702019-02-14 10:29:45 +000068}
69EOF
rajendrajaiswala1574702019-02-14 10:29:45 +000070curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/feeds
rajendrajaiswal59a78502019-03-21 16:31:19 +000071
72# CREATING: MR Topic
73echo $'\nInitializing /topic endpoint'
74JSON=/tmp/topic.json
75cat << EOF > $JSON
76{
77"topicName":"test1",
78"topicDescription":"PM Mapper - VES Event",
79"owner":"pmmapper"
80}
81EOF
82curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/topics
83
84# CREATING: MR Client
85echo $'\nInitializing /mr_clients endpoint'
86JSON=/tmp/mrclients.json
87cat << 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}
94EOF
95curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clients
rajendrajaiswala1574702019-02-14 10:29:45 +000096sleep 5