Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
naiades
naiades-platform-poc
Commits
e510f465
Commit
e510f465
authored
May 20, 2020
by
Federico Sismondi
Browse files
Feat() new scripts for querying current data and historical data
parent
1c76e0c8
Changes
11
Hide whitespace changes
Inline
Side-by-side
scripts/admin_historic_get_tables.sh
0 → 100755
View file @
e510f465
#!/usr/bin/env bash
[[
-z
"
$CRATE_HOST
"
]]
&&
echo
"Please set CRATE_HOST env var. E.g. export CRATE_HOST=127.0.0.1"
&&
exit
echo
"Querying historical data at:
${
CRATE_HOST
}
"
curl
--location
--request
POST
\
"http://CRATE_HOST:4200/_sql"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Content-Type: application/json"
\
--header
"Accept: application/json"
\
--data
'{
"stmt":"SHOW TABLES"
}'
\ No newline at end of file
scripts/admin_susbcription_for_historic_data_weather.sh
0 → 100755
View file @
e510f465
#!/usr/bin/env bash
[[
-z
"
$ORION_HOST
"
]]
&&
echo
"Please set ORION_HOST env var. E.g. export ORION_HOST=127.0.0.1"
&&
exit
echo
"Querying context broker at:
${
ORION_HOST
}
"
# API NOTES:
# "condition": { "attrs": [] } -> means monitor all the attributes in the entity
curl
--location
--request
POST
\
"http://
$ORION_HOST
:1026/v2/subscriptions/"
\
--header
"Fiware-Service: carouge"
\
--header
"Content-Type: application/json"
\
--header
"Accept: application/json"
\
--data
'{
"description": "Notify QuantumLeap, the historic API, of all WeatherObservedRaw changes",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "WeatherObservedRaw"
}
],
"condition": {
"attrs": []
}
},
"notification": {
"http": {
"url": "http://172.18.1.7:8668/v2/notify"
},
"attrs": [],
"attrsFormat" : "keyValues",
"metadata": ["dateCreated", "dateModified"]
}
}'
scripts/historic_01_set_up.sh
0 → 100755
View file @
e510f465
#!/usr/bin/env bash
[[
-z
"
$ORION_HOST
"
]]
&&
echo
"Please set ORION_HOST env var. E.g. export ORION_HOST=127.0.0.1"
&&
exit
echo
"Querying context broker at:
${
ORION_HOST
}
"
# API NOTES:
# "condition": { "attrs": [] } -> means monitor all the attributes in the entity
curl
--location
--request
POST
\
"http://
$ORION_HOST
:1026/v2/subscriptions/"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Content-Type: application/json"
\
--header
"Accept: application/json"
\
--data
'{
"description": "Notify QuantumLeap, the historic API, of all FlowerBed changes",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "FlowerBed"
}
],
"condition": {
"attrs": []
}
},
"notification": {
"http": {
"url": "http://172.18.1.7:8668/v2/notify"
},
"attrs": [],
"metadata": ["dateCreated", "dateModified"]
}
}'
scripts/historic_02_api_query.sh
0 → 100755
View file @
e510f465
#!/usr/bin/env bash
[[
-z
"
$QUANTUM_HOST
"
]]
&&
echo
"Please set QUANTUM_HOST env var. E.g. export QUANTUM_HOST=127.0.0.1"
&&
exit
echo
"Querying QuantumLeap API at:
${
QUANTUM_HOST
}
"
curl
--location
--request
GET
\
"http://
$QUANTUM_HOST
:8668/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc/value?limit=100"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Accept: application/json"
#| python -mjson.tool
scripts/watering_01_create_entity.sh
View file @
e510f465
...
@@ -4,47 +4,23 @@
...
@@ -4,47 +4,23 @@
echo
"Querying context broker at:
${
ORION_HOST
}
"
echo
"Querying context broker at:
${
ORION_HOST
}
"
curl
-iX
POST
\
curl
-iX
POST
\
"http://
$ORION_HOST
:1026/v2/entities/"
\
"http://
$ORION_HOST
:1026/v2/entities/
?options=keyValues
"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Content-Type: application/json"
\
--header
"Content-Type: application/json"
\
--data
'{
--data
'{
"id": "urn:ngsi-ld:FlowerBed:FlowerBed-
345
",
"id": "urn:ngsi-ld:FlowerBed:FlowerBed-
1
",
"type": "FlowerBed",
"type": "FlowerBed",
"category": {
"dateModified":"2017-03-31T08:00",
"type": "Property",
"category": ["urbanTreeSpot"],
"value": ["urbanTreeSpot"]
"dateLastWatering": "2017-03-31T08:00",
},
"nextWateringDeadline":"2017-04-31T08:00",
"soilMoistureVwc": {
"type": "Property",
"value": 0.85
},
"dateLastWatering": {
"type": "Property",
"value": {
"@type": "DateTime",
"@value": "2020-02-11T08:00:00Z"
}
},
"soilTemperature": {
"type": "Property",
"value": 17
},
"address": {
"address": {
"type": "Property",
"streetAddress": "Place de Sardaigne",
"value": {
"adressLocality": "Carouge",
"addressCountry": "Switzerland",
"addressCountry": "Switzerland"
"streetAddress": "Place de Sardaigne",
"adressLocality": "Carouge",
"type": "PostalAddress"
}
},
},
"location": {
"soilTemperature": 17,
"type": "GeoProperty",
"soilMoistureVwc": 0.85
"value": {
"type": "Point",
"coordinates": [46.184255,6.1378375]
}
}
}
}
'
'
scripts/watering_03_retrieve_entity_keyValues_by_id.sh
View file @
e510f465
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
echo
"Querying context broker at:
${
ORION_HOST
}
"
echo
"Querying context broker at:
${
ORION_HOST
}
"
curl
--location
--request
GET
\
curl
--location
--request
GET
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
345
?options=keyValues"
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
1
?options=keyValues"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Fiware-ServicePath: /Watering"
\
| python
-mjson
.tool
| python
-mjson
.tool
\ No newline at end of file
scripts/watering_04_retrieve_attribute_value.sh
View file @
e510f465
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
echo
"Querying context broker at:
${
ORION_HOST
}
"
echo
"Querying context broker at:
${
ORION_HOST
}
"
curl
--location
--request
GET
\
curl
--location
--request
GET
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
345
/attrs/soilMoistureVwc/value"
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
1
/attrs/soilMoistureVwc/value"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Fiware-ServicePath: /Watering"
\
| python
-mjson
.tool
| python
-mjson
.tool
...
...
scripts/watering_05_retrieve_attribute.sh
View file @
e510f465
...
@@ -4,13 +4,8 @@
...
@@ -4,13 +4,8 @@
echo
"Querying context broker at:
${
ORION_HOST
}
"
echo
"Querying context broker at:
${
ORION_HOST
}
"
curl
--location
--request
GET
\
curl
--location
--request
GET
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
345
/attrs/soilMoistureVwc"
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
1
/attrs/soilMoistureVwc"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Fiware-ServicePath: /Watering"
\
| python
-mjson
.tool
| python
-mjson
.tool
#curl --location --request GET \
# "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/location" \
# --header "Fiware-Service: carouge" \
# --header "Fiware-ServicePath: /Watering" \
# | python -mjson.tool
\ No newline at end of file
scripts/watering_06_update_specific_attrs.sh
View file @
e510f465
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
echo
"Querying context broker at:
${
ORION_HOST
}
"
echo
"Querying context broker at:
${
ORION_HOST
}
"
curl
--location
--request
PUT
\
curl
--location
--request
PUT
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
345
/attrs/soilMoistureVwc/value"
\
"http://
$ORION_HOST
:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-
1
/attrs/soilMoistureVwc/value"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-Service: carouge"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Fiware-ServicePath: /Watering"
\
--header
"Content-Type: text/plain"
\
--header
"Content-Type: text/plain"
\
...
...
scripts/watering_07_subscribe_to_entity.sh
View file @
e510f465
...
@@ -18,7 +18,7 @@ curl --location --request POST \
...
@@ -18,7 +18,7 @@ curl --location --request POST \
"subject": {
"subject": {
"entities": [
"entities": [
{
{
"id
": "urn:ngsi-ld:FlowerBed:FlowerBed-345
",
"id
Pattern": ".*
",
"type": "FlowerBed"
"type": "FlowerBed"
}
}
],
],
...
...
scripts/xx_delete_subs.sh
View file @
e510f465
curl
--request
DELETE
'localhost:1026/v2/subscriptions/5e54f6dc00043ebcd1ef0850'
#!/usr/bin/env bash
[[
-z
"
$ORION_HOST
"
]]
&&
echo
"Please set ORION_HOST env var. E.g. export ORION_HOST=127.0.0.1"
&&
exit
echo
"Querying context broker at:
${
ORION_HOST
}
"
curl
--location
--request
DELETE
"http://
$ORION_HOST
:1026/v2/subscriptions/5ec4fbfe91d551c2b4612f42"
\
--header
"Fiware-Service: carouge"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment