Skip to content

Commit 0491e7d

Browse files
committed
Update Device provisioning to use ENV.
1 parent 9540033 commit 0491e7d

2 files changed

Lines changed: 28 additions & 22 deletions

File tree

provision-devices

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ printf "⏳ Provisioning IoT devices "
1818
#
1919

2020
curl -s -o /dev/null -X POST \
21-
'http://iot-agent:4041/iot/services' \
21+
"http://iot-agent:$IOTA_NORTH_PORT/iot/services" \
2222
-H 'Content-Type: application/json' \
2323
-H 'fiware-service: openiot' \
2424
-H 'fiware-servicepath: /' \
2525
-d '{
2626
"services": [
2727
{
2828
"apikey": "1068318794",
29-
"cbroker": "http://orion:1026",
29+
"cbroker": "'"http://orion:$ORION_PORT"'",
3030
"entity_type": "Motion",
3131
"resource": "/iot/d",
3232
"protocol": "PDI-IoTA-UltraLight",
@@ -45,7 +45,7 @@ curl -s -o /dev/null -X POST \
4545
},
4646
{
4747
"apikey": "3020035",
48-
"cbroker": "http://orion:1026",
48+
"cbroker": "'"http://orion:$ORION_PORT"'",
4949
"entity_type": "Bell",
5050
"resource": "/iot/d",
5151
"protocol": "PDI-IoTA-UltraLight",
@@ -66,7 +66,7 @@ curl -s -o /dev/null -X POST \
6666
},
6767
{
6868
"apikey": "3314136",
69-
"cbroker": "http://orion:1026",
69+
"cbroker": "'"http://orion:$ORION_PORT"'",
7070
"entity_type": "Lamp",
7171
"resource": "/iot/d",
7272
"protocol": "PDI-IoTA-UltraLight",
@@ -90,7 +90,7 @@ curl -s -o /dev/null -X POST \
9090
},
9191
{
9292
"apikey": "3089326",
93-
"cbroker": "http://orion:1026",
93+
"cbroker": "'"http://orion:$ORION_PORT"'",
9494
"entity_type": "Door",
9595
"resource": "/iot/d",
9696
"protocol": "PDI-IoTA-UltraLight",
@@ -121,7 +121,7 @@ curl -s -o /dev/null -X POST \
121121
#
122122

123123
curl -s -o /dev/null -X POST \
124-
'http://iot-agent:4041/iot/devices' \
124+
"http://iot-agent:$IOTA_NORTH_PORT/iot/devices" \
125125
-H 'Content-Type: application/json' \
126126
-H 'fiware-service: openiot' \
127127
-H 'fiware-servicepath: /' \
@@ -139,7 +139,7 @@ curl -s -o /dev/null -X POST \
139139
"device_id": "bell001",
140140
"entity_name": "Bell:001",
141141
"entity_type": "Bell",
142-
"endpoint": "http://iot-sensors:3001/iot/bell001",
142+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/bell001"'",
143143
"static_attributes": [
144144
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:001"}
145145
]
@@ -148,7 +148,7 @@ curl -s -o /dev/null -X POST \
148148
"device_id": "door001",
149149
"entity_name": "Door:001",
150150
"entity_type": "Door",
151-
"endpoint": "http://iot-sensors:3001/iot/door001",
151+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/door001"'",
152152
"static_attributes": [
153153
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:001"}
154154
]
@@ -157,8 +157,8 @@ curl -s -o /dev/null -X POST \
157157
"device_id": "lamp001",
158158
"entity_name": "Lamp:001",
159159
"entity_type": "Lamp",
160-
"endpoint": "http://iot-sensors:3001/iot/lamp001",
161-
"static_attributes": [
160+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/lamp001"'",
161+
"static_attributes": [
162162
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:001"}
163163
]
164164
}
@@ -173,7 +173,7 @@ curl -s -o /dev/null -X POST \
173173
#
174174

175175
curl -s -o /dev/null -X POST \
176-
'http://iot-agent:4041/iot/devices' \
176+
"http://iot-agent:$IOTA_NORTH_PORT/iot/devices" \
177177
-H 'Content-Type: application/json' \
178178
-H 'fiware-service: openiot' \
179179
-H 'fiware-servicepath: /' \
@@ -191,7 +191,7 @@ curl -s -o /dev/null -X POST \
191191
"device_id": "bell002",
192192
"entity_name": "Bell:002",
193193
"entity_type": "Bell",
194-
"endpoint": "http://iot-sensors:3001/iot/bell002",
194+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/bell002"'",
195195
"static_attributes": [
196196
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:002"}
197197
]
@@ -200,7 +200,7 @@ curl -s -o /dev/null -X POST \
200200
"device_id": "door002",
201201
"entity_name": "Door:002",
202202
"entity_type": "Door",
203-
"endpoint": "http://iot-sensors:3001/iot/door002",
203+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/door002"'",
204204
"static_attributes": [
205205
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:002"}
206206
]
@@ -209,7 +209,7 @@ curl -s -o /dev/null -X POST \
209209
"device_id": "lamp002",
210210
"entity_name": "Lamp:002",
211211
"entity_type": "Lamp",
212-
"endpoint": "http://iot-sensors:3001/iot/lamp002",
212+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/lamp002"'",
213213
"static_attributes": [
214214
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:002"}
215215
]
@@ -229,7 +229,7 @@ curl -s -o /dev/null -X POST \
229229
#
230230

231231
curl -s -o /dev/null -X POST \
232-
'http://iot-agent:4041/iot/devices' \
232+
"http://iot-agent:$IOTA_NORTH_PORT/iot/devices" \
233233
-H 'Content-Type: application/json' \
234234
-H 'fiware-service: openiot' \
235235
-H 'fiware-servicepath: /' \
@@ -247,7 +247,7 @@ curl -s -o /dev/null -X POST \
247247
"device_id": "bell003",
248248
"entity_name": "Bell:003",
249249
"entity_type": "Bell",
250-
"endpoint": "http://iot-sensors:3001/iot/bell003",
250+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/bell003"'",
251251
"static_attributes": [
252252
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:003"}
253253
]
@@ -256,7 +256,7 @@ curl -s -o /dev/null -X POST \
256256
"device_id": "door003",
257257
"entity_name": "Door:003",
258258
"entity_type": "Door",
259-
"endpoint": "http://iot-sensors:3001/iot/door003",
259+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/door003"'",
260260
"static_attributes": [
261261
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:003"}
262262
]
@@ -265,7 +265,7 @@ curl -s -o /dev/null -X POST \
265265
"device_id": "lamp003",
266266
"entity_name": "Lamp:003",
267267
"entity_type": "Lamp",
268-
"endpoint": "http://iot-sensors:3001/iot/lamp003",
268+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/lamp003"'",
269269
"static_attributes": [
270270
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:003"}
271271
]
@@ -284,7 +284,7 @@ curl -s -o /dev/null -X POST \
284284
#
285285

286286
curl -s -o /dev/null -X POST \
287-
'http://iot-agent:4041/iot/devices' \
287+
"http://iot-agent:$IOTA_NORTH_PORT/iot/devices" \
288288
-H 'Content-Type: application/json' \
289289
-H 'fiware-service: openiot' \
290290
-H 'fiware-servicepath: /' \
@@ -302,7 +302,7 @@ curl -s -o /dev/null -X POST \
302302
"device_id": "bell004",
303303
"entity_name": "Bell:004",
304304
"entity_type": "Bell",
305-
"endpoint": "http://iot-sensors:3001/iot/bell004",
305+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/bell004"'",
306306
"static_attributes": [
307307
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:004"}
308308
]
@@ -311,7 +311,7 @@ curl -s -o /dev/null -X POST \
311311
"device_id": "door004",
312312
"entity_name": "Door:004",
313313
"entity_type": "Door",
314-
"endpoint": "http://iot-sensors:3001/iot/door004",
314+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/door004"'",
315315
"static_attributes": [
316316
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:004"}
317317
]
@@ -320,7 +320,7 @@ curl -s -o /dev/null -X POST \
320320
"device_id": "lamp004",
321321
"entity_name": "Lamp:004",
322322
"entity_type": "Lamp",
323-
"endpoint": "http://iot-sensors:3001/iot/lamp004",
323+
"endpoint": "'"http://iot-sensors:$TUTORIAL_DUMMY_DEVICE_PORT/iot/lamp004"'",
324324
"static_attributes": [
325325
{"name": "refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:004"}
326326
]

services

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ fi
1616
loadData () {
1717
docker run --rm -v $(pwd)/import-data:/import-data \
1818
--network fiware_default \
19+
-e ORION_PORT="${ORION_PORT}" \
20+
-e TUTORIAL_APP_PORT="${TUTORIAL_APP_PORT}" \
1921
--entrypoint /bin/ash curlimages/curl import-data
2022
waitForIoTAgent
2123
docker run --rm -v $(pwd)/provision-devices:/provision-devices \
2224
--network fiware_default \
25+
-e ORION_PORT="${ORION_PORT}" \
26+
-e TUTORIAL_APP_PORT="${TUTORIAL_APP_PORT}" \
27+
-e TUTORIAL_DUMMY_DEVICE_PORT="${TUTORIAL_DUMMY_DEVICE_PORT}" \
28+
-e IOTA_NORTH_PORT="${IOTA_NORTH_PORT}" \
2329
--entrypoint /bin/ash curlimages/curl provision-devices
2430
echo ""
2531
}

0 commit comments

Comments
 (0)