rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 1 | #!/bin/bash |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 2 | # $1 is the IP address of the buscontroller |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 3 | |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 4 | # INITIALIZE: dmaap object |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 5 | echo $'\nInitializing /dmaap endpoint' |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 6 | JSON=/tmp/dmaap.json |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 7 | cat << EOF > $JSON |
| 8 | { |
| 9 | "version": "1", |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 10 | "topicNsRoot": "topic.org.onap.dmaap", |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 11 | "drProvUrl": "https://dmaap-dr-prov:8443", |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 12 | "dmaapName": "mr", |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 13 | "bridgeAdminTopic": "MM_AGENT_PROV" |
| 14 | |
| 15 | } |
| 16 | EOF |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 17 | curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap |
| 18 | |
| 19 | # INITIALIZE: dcaeLocation object |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 20 | echo $'\nInitializing /dcaeLocations endpoint' |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 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 |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 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 |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 33 | echo $'\nInitializing /mr_clusters endpoint' |
| 34 | DMAAP=$(docker ps -a -q --filter="name=dmaap_1") |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 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", |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 40 | "fqdn": "${DMAAP_MR_IP}", |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 41 | "topicProtocol" : "http", |
| 42 | "topicPort": "3904" |
| 43 | } |
| 44 | EOF |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 45 | curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clusters |
| 46 | |
| 47 | # CREATING: DR feed |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 48 | echo $'\nInitializing /feeds endpoint' |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 49 | JSON=/tmp/feed.json |
| 50 | cat << EOF > $JSON |
| 51 | { |
| 52 | "feedName":"pmmapper", |
| 53 | "feedVersion": "1", |
| 54 | "feedDescription":"PM Mapper Feed", |
| 55 | "owner":"bulkpm", |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 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 | ] |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 68 | } |
| 69 | EOF |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 70 | curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/feeds |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 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 |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 96 | sleep 5 |