Skip to content

Commit 6399f38

Browse files
created example of code
1 parent 6196a61 commit 6399f38

1 file changed

Lines changed: 27 additions & 79 deletions

File tree

Lines changed: 27 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11

2-
# # The code for installing different versions of context brokers are located after the code
2+
# # This code allows you to install a orion-ld broker in a linux system
3+
# # The manuals are here https://github.com/FIWARE/context.Orion-LD/tree/develop/doc/manuals-ld
4+
#
5+
# # INSTALL NGSI LD broker (OrionLD)
6+
# sudo docker pull mongo:3.6
7+
# sudo docker pull fiware/orion-ld
8+
# sudo docker network create fiware_default
9+
# sudo docker run -d --name=mongo-db --network=fiware_default --expose=27017 mongo:3.6 --bind_ip_all --smallfiles
10+
# sudo docker run -d --name fiware-orionld -h orion --network=fiware_default -p 1026:1026 fiware/orion-ld -dbhost mongo-db
11+
#
12+
# # TO RELAUNCH (only if you have already installed a broker in the same machine)
13+
# sudo docker stop fiware-orionld
14+
# sudo docker rm fiware-orionld
15+
# sudo docker stop mongo-db
16+
# sudo docker rm mongo-db
17+
# sudo docker network rm fiware_default
18+
#
19+
# # CHECK INSTANCES
20+
# # Check the broker is running
21+
# curl -X GET 'http://localhost:1026/version'
22+
#
23+
# # Check what entities are in the broker
24+
# curl -X GET http://localhost:1026/ngsi-ld/v1/entities?local=true&limit=1000
25+
#
26+
# # now the python code you can use to insert some value in the context broker according to the data model
327
#
428
from pysmartdatamodels import pysmartdatamodels as sdm
529
import subprocess
6-
serverUrl = "http://localhost:1026" # supposed that your broker is installed in localhost with 1026 as default port. Edit to match your configuration
30+
serverUrl = "http://localhost:1026" # supposed that your broker is installed in localhost. Edit to match your configuration
731
dataModel = "VehicleModel"
832
subject = "dataModel.Transportation"
933
brandName = "Mercedes Benz"
@@ -30,84 +54,8 @@
3054
# The next line creates the query for inserting this attribute in a NGSI-LD context broker if the attribute does not exist it creates it
3155
print(sdm.update_broker(dataModel, subject, attribute, value, serverUrl=serverUrl, updateThenCreate=True))
3256

33-
print(" In case you have installed the a cntext broker (see comments below )")
57+
print(" In case you have installed the orion-ld broker (see comments on the header of this program)")
3458
print(" Execute this instruction to check that the entities has been inserted")
3559
command = ['curl', '-X', 'GET', 'http://localhost:1026/ngsi-ld/v1/entities?local=true&limit=1000']
3660
result = subprocess.run(command, capture_output=True, text=True)
3761
print(result.stdout)
38-
39-
# This code allows you to install different context brokers in a linux system
40-
#
41-
# # ORION-LD
42-
# # The manuals are here https://github.com/FIWARE/context.Orion-LD/tree/develop/doc/manuals-ld
43-
#
44-
# # INSTALL NGSI LD broker (OrionLD)
45-
# sudo docker pull mongo:3.6
46-
# sudo docker pull fiware/orion-ld
47-
# sudo docker network create fiware_default
48-
# sudo docker run -d --name=mongo-db --network=fiware_default --expose=27017 mongo:3.6 --bind_ip_all --smallfiles
49-
# sudo docker run -d --name fiware-orionld -h orion --network=fiware_default -p 1026:1026 fiware/orion-ld -dbhost mongo-db
50-
#
51-
# # TO RELAUNCH (only if you have already installed a broker in the same machine)
52-
# sudo docker stop fiware-orionld
53-
# sudo docker rm fiware-orionld
54-
# sudo docker stop mongo-db
55-
# sudo docker rm mongo-db
56-
# sudo docker network rm fiware_default
57-
#
58-
# # CHECK INSTANCES
59-
# # Check the broker is running
60-
# curl -X GET 'http://localhost:1026/version'
61-
#
62-
# # Check what entities are in the broker
63-
# curl -X GET http://localhost:1026/ngsi-ld/v1/entities?local=true&limit=1000
64-
#
65-
# # STELLIO
66-
#
67-
# # INSTALL NGSI LD broker (Stellio)
68-
# curl -O https://raw.githubusercontent.com/stellio-hub/stellio-context-broker/develop/docker-compose.yml -O https://raw.githubusercontent.com/stellio-hub/stellio-context-broker/develop/.env
69-
# curl -o config/kafka/update_run.sh --create-dirs https://raw.githubusercontent.com/stellio-hub/stellio-context-broker/develop/config/kafka/update_run.sh && chmod u+x config/kafka/update_run.sh
70-
# docker compose up -d
71-
# # wait for some seconds for services to be up and running
72-
#
73-
# # TO RELAUNCH (only if you have already installed a broker in the same machine)
74-
# docker compose down
75-
#
76-
# # CHECK INSTANCES
77-
# curl -X GET 'http://localhost:8080/actuator/health'
78-
# curl -X GET 'http://localhost:8080/search-service/actuator/health'
79-
#
80-
# # view the logs
81-
# docker-compose logs -f --tail=100
82-
#
83-
# # SCORPIO
84-
# sudo docker pull postgis/postgis
85-
# sudo docker pull scorpiobroker/all-in-one-runner:java-latest
86-
# sudo docker network create fiware_default
87-
# sudo docker run -d --name postgres --network=fiware_default -h postgres -p 5432 -e POSTGRES_USER=ngb -e POSTGRES_PASSWORD=ngb -e POSTGRES_DB=ngb postgis/postgis
88-
# sudo docker run -d --name scorpio -h scorpio --network=fiware_default -e DBHOST=postgres -p 9090:9090 scorpiobroker/all-in-one-runner:java-latest
89-
#
90-
# # TO RELAUNCH (only if you have already installed a broker in the same machine)
91-
# sudo docker stop scorpio
92-
# sudo docker rm scorpio
93-
# sudo docker stop postgres
94-
# sudo docker rm postgres
95-
# sudo docker network rm fiware_default
96-
#
97-
# # CHECK INSTANCES
98-
# # Check the broker is running
99-
# # Release Info
100-
# curl -X GET 'http://localhost:9090/q/info'
101-
# # Health status of the broker
102-
# curl -X GET 'http://localhost:9090/q/health'
103-
#
104-
# # Check what entities are in the broker
105-
# curl -X GET http://localhost:1026/ngsi-ld/v1/entities?local=true&limit=1000
106-
#
107-
#
108-
# # now the python code you can use to insert some value in the context broker according to the data model
109-
# # Version Warning!
110-
# # This code is designed to work with the version 0.8.0.1 of pysmartdatamodels or later
111-
#
112-
#
113-
#

0 commit comments

Comments
 (0)