Skip to content

Commit 3085bdc

Browse files
author
Giovanni Curiel dos Santos
committed
[IOTMID-220] Adding sample config. to perseo
This commit adds a sample configuration for perseo. Change-Id: I7018cc310772ac6517be73b5cdc7404d595b43b7
1 parent ad1b037 commit 3085bdc

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

test/perseo.config.sh

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
## Service configuration ##
2+
curl -X POST -H "Fiware-Service: devm" -H "Fiware-ServicePath: /" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
3+
"services": [
4+
{
5+
"resource": "/devm",
6+
"apikey": "nexus",
7+
"type": "Nexus"
8+
}
9+
]
10+
}' 'http://iotagent:4041/iot/services'
11+
12+
13+
## Device creation ##
14+
curl -X POST -H "Fiware-Service: devm" -H "Fiware-ServicePath: /" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
15+
"devices": [
16+
{
17+
"device_id": "mobile-1",
18+
"entity_name": "m1",
19+
"entity_type": "Nexus",
20+
"attributes": [
21+
{ "object_id": "acceleration", "name": "Acceleration", "type": "string" }
22+
],
23+
"internal_attributes": {
24+
"timeout" : {
25+
"sampleQueueMaxSize" : 4,
26+
"waitMultiplier" : 3 ,
27+
"minimumTimeoutBase" : 50
28+
}
29+
}
30+
}
31+
]
32+
}' 'http://iotagent:4041/iot/devices'
33+
34+
35+
## Publishing new values ##
36+
mosquitto_pub -h mqtt -t /nexus/mobile-1/attrs -m '{"acceleration" : "10"}'
37+
38+
39+
## Just checking on orion if the attribute was set ##
40+
curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Fiware-Service: devm" -H "Fiware-ServicePath: /" -d '{
41+
"entities": [
42+
{
43+
"isPattern": "false",
44+
"id": "m1",
45+
"type": "Nexus"
46+
}
47+
]
48+
}' 'http://orion:1026/NGSI10/queryContext'
49+
50+
51+
## Orion subscription ##
52+
#curl orion:1026/v1/subscribeContext -s -S -H "Fiware-Service: devm" -H #"Fiware-ServicePath: /" --header 'Content-Type: application/json' \
53+
# --header 'Accept: application/json' -d '
54+
# {
55+
# "entities": [
56+
# {
57+
# "type": "Nexus",
58+
# "isPattern": "false",
59+
# "id": "m1"
60+
# }
61+
# ],
62+
# "attributes": [
63+
# "Acceleration"
64+
# ],
65+
# "reference": "http://172.21.0.1:8080/dev/id",
66+
# "duration": "P1M",
67+
# "notifyConditions": [
68+
# {
69+
# "type": "ONCHANGE",
70+
# "condValues": [
71+
# "Acceleration"
72+
# ]
73+
# }
74+
# ],
75+
# "throttling": "PT5S"
76+
#}'
77+
78+
## Perseo's subscription in orion ##
79+
curl orion:1026/v1/subscribeContext -s -S -H "Fiware-Service: devm" -H "Fiware-ServicePath: /" --header 'Content-Type: application/json' \
80+
--header 'Accept: application/json' -d '
81+
{
82+
"entities": [
83+
{
84+
"type": "Nexus",
85+
"isPattern": "false",
86+
"id": "m1"
87+
}
88+
],
89+
"attributes": [
90+
"Acceleration"
91+
],
92+
"reference": "http://perseo-fe:9090/notices",
93+
"duration": "P1M",
94+
"notifyConditions": [
95+
{
96+
"type": "ONCHANGE",
97+
"condValues": [
98+
"Acceleration"
99+
]
100+
}
101+
],
102+
"throttling": "PT5S"
103+
}'
104+
105+
106+
## Registering a new filter in perseon ##
107+
curl -X POST http://perseo-fe:9090/rules -H "Fiware-Service: devm" -H "Fiware-ServicePath: /" -H "Content-Type: application/json" -d '{
108+
"name":"acceleration_notif_09",
109+
"text":"select *, \"acceleration_notif_09\" as ruleName, *, ev.Acceleration? as Acceleration, ev.id? as Meter from pattern [every ev=iotEvent(cast(cast(Acceleration?, String), float) > 9 and type=\"Nexus\")]",
110+
"action":{
111+
"type":"post",
112+
"template":"This is another notification - 09 - ${Acceleration}",
113+
"parameters":{
114+
"url": "http://172.21.0.1:8081/dev/perseo-fe-09",
115+
"method": "POST",
116+
"headers": {
117+
"Content-type": "text/plain"
118+
}
119+
}
120+
}
121+
}'

0 commit comments

Comments
 (0)