File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,7 +97,30 @@ services:
9797 healthcheck :
9898 interval : 10s
9999
100+
101+ farmer :
102+ labels :
103+ org.fiware : ' tutorial'
104+ image : quay.io/fiware/tutorials.forwarder
105+ hostname : ' farmer'
106+ container_name : cb-farmer
107+ ports :
108+ - 1027:80
109+ environment :
110+ - TENANT=farmer
111+ - DEBUG=broker:*
100112
113+ devices :
114+ labels :
115+ org.fiware : ' tutorial'
116+ image : quay.io/fiware/tutorials.forwarder
117+ hostname : ' farmer'
118+ container_name : cb-devices
119+ ports :
120+ - 1028:80
121+ environment :
122+ - TENANT=openiot
123+ - DEBUG=broker:*
101124
102125 # Tutorial acts as a series of dummy IoT Sensors over HTTP
103126 tutorial :
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ services:
3636 test : curl --fail -s http://orion:${ORION_LD_PORT}/version || exit 1
3737 interval : 10s
3838
39+ farmer :
40+ environment :
41+ - CONTEXT_BROKER=http://orion:${ORION_LD_PORT}
42+
43+ devices :
44+ environment :
45+ - CONTEXT_BROKER=http://orion:${ORION_LD_PORT}
46+
3947 # IoT-Agent is configured for the JSON Protocol
4048 iot-agent :
4149 environment :
Original file line number Diff line number Diff line change @@ -50,6 +50,14 @@ services:
5050 volumes :
5151 - postgres-db:/var/lib/postgresql/data
5252
53+ farmer :
54+ environment :
55+ - CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}
56+
57+ devices :
58+ environment :
59+ - CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}
60+
5361 # IoT-Agent is configured for the JSON Protocol and connects to the Scorpio Broker
5462 iot-agent :
5563 environment :
Original file line number Diff line number Diff line change @@ -114,7 +114,13 @@ services:
114114 - IOTA_CB_HOST=api-gateway # name of the context broker to update context
115115 - IOTA_CB_PORT=${STELLIO_PORT} # port the context broker listens on to update context
116116
117-
117+ farmer :
118+ environment :
119+ - CONTEXT_BROKER=http://stellio:${STELLIO_PORT}
120+ devices :
121+ environment :
122+ - CONTEXT_BROKER=http://stellio:${STELLIO_PORT}
123+
118124 # Tutorial acts as a series of dummy IoT Sensors over HTTP and connects to the Stellio Broker
119125 tutorial :
120126 environment :
Original file line number Diff line number Diff line change @@ -94,4 +94,51 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOper
9494 }
9595]'
9696
97+
98+ echo -e " Registering Farmer and Devices as data sources.\n"
99+
100+ curl -s -o /dev/null -X POST ' http://' " ${CONTEXT_BROKER} " ' /ngsi-ld/v1/csourceRegistrations/' \
101+ -H ' Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
102+ -H ' Content-Type: application/json' \
103+ -d ' {
104+ "type": "ContextSourceRegistration",
105+ "information": [
106+ {
107+ "entities": [
108+ {
109+ "type": "Animal"
110+ }
111+ ]
112+ }
113+ ],
114+ "mode": "redirect",
115+ "operations": [
116+ "redirectionOps"
117+ ],
118+ "endpoint": "http://farmer"
119+ }'
120+
121+
122+ curl -s -o /dev/null -X POST ' http://farmer/ngsi-ld/v1/csourceRegistrations/' \
123+ -H ' Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
124+ -H ' Content-Type: application/json' \
125+ -d ' {
126+ "type": "ContextSourceRegistration",
127+ "information": [
128+ {
129+ "entities": [
130+ {
131+ "type": "Animal"
132+ }
133+ ]
134+ }
135+ ],
136+ "mode": "inclusive",
137+ "operations": [
138+ "federationOps"
139+ ],
140+ "endpoint": "http://devices"
141+ }'
142+
143+
97144echo -e " \033[1;32mdone\033[0m"
You can’t perform that action at this time.
0 commit comments