Created
June 21, 2016 08:15
-
-
Save fgalan/0f1814890f5f6142135890d4ee79655c to your computer and use it in GitHub Desktop.
Subscription/Notification test at orion.lab.fiware.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Creating subscription | |
------------------------ | |
[root@orion ~]# curl -v localhost:10026/v2/subscriptions -X POST -s -S --header 'Content-Type: application/json' -d @- <<EOF | |
> { | |
> "description": "A subscription to get info about Room1", | |
> "subject": { | |
> "entities": [ | |
> { | |
> "id": "11582", | |
> "type": "UserTest" | |
> } | |
> ], | |
> "condition": { | |
> "attrs": [ | |
> "temperature" | |
> ] | |
> } | |
> }, | |
> "notification": { | |
> "http": { | |
> "url": "http://localhost:1028" | |
> }, | |
> "attrs": [ | |
> "temperature" | |
> ] | |
> }, | |
> "expires": "2040-01-01T14:00:00.00Z", | |
> "throttling": 5 | |
> } | |
> EOF | |
* About to connect() to localhost port 10026 (#0) | |
* Trying ::1... connected | |
* Connected to localhost (::1) port 10026 (#0) | |
> POST /v2/subscriptions HTTP/1.1 | |
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 | |
> Host: localhost:10026 | |
> Accept: */* | |
> Content-Type: application/json | |
> Content-Length: 394 | |
> | |
< HTTP/1.1 201 Created | |
< Connection: Keep-Alive | |
< Content-Length: 0 | |
< Location: /v2/subscriptions/5768f56870dce43aa351cfa7 | |
< Fiware-Correlator: fdba21bc-3786-11e6-9e5e-52540003a38e | |
< Date: Tue, 21 Jun 2016 08:06:00 GMT | |
< | |
* Connection #0 to host localhost left intact | |
* Closing connection #0 | |
2. Check subscription is there (timeSent: missing) | |
-------------------------------------------------- | |
[root@orion ~]# curl localhost:10026/v2/subscriptions/5768f56870dce43aa351cfa7 | python -mjson.tool | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
125 375 125 375 0 0 114k 0 --:--:-- --:--:-- --:--:-- 366k | |
{ | |
"description": "A subscription to get info about Room1", | |
"expires": "2040-01-01T14:00:00.00Z", | |
"id": "5768f56870dce43aa351cfa7", | |
"notification": { | |
"attrs": [ | |
"temperature" | |
], | |
"attrsFormat": "normalized", | |
"http": { | |
"url": "http://localhost:1028" | |
} | |
}, | |
"status": "active", | |
"subject": { | |
"condition": { | |
"attrs": [ | |
"temperature" | |
] | |
}, | |
"entities": [ | |
{ | |
"id": "11582", | |
"idPattern": "", | |
"type": "UserTest" | |
} | |
] | |
}, | |
"throttling": 5 | |
} | |
3. Create entity (this triggers notification, see terminal2.txt) | |
---------------------------------------------------------------- | |
[root@orion ~]# curl -v localhost:10026/v2/entities -X POST -s -S --header 'Content-Type: application/json' -d @- <<EOF | |
> { | |
> "id": "11582", | |
> "type": "UserTest", | |
> "temperature": { | |
> "type": "Float", | |
> "value": 23.5 | |
> } | |
> } | |
> EOF | |
* About to connect() to localhost port 10026 (#0) | |
* Trying ::1... connected | |
* Connected to localhost (::1) port 10026 (#0) | |
> POST /v2/entities HTTP/1.1 | |
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 | |
> Host: localhost:10026 | |
> Accept: */* | |
> Content-Type: application/json | |
> Content-Length: 93 | |
> | |
< HTTP/1.1 201 Created | |
< Connection: Keep-Alive | |
< Content-Length: 0 | |
< Location: /v2/entities/11582?type=UserTest | |
< Fiware-Correlator: 85a1e89e-3787-11e6-be07-52540003a38e | |
< Date: Tue, 21 Jun 2016 08:09:48 GMT | |
< | |
* Connection #0 to host localhost left intact | |
* Closing connection #0 | |
4. Check subscription is there (timeSent: 1) | |
-------------------------------------------- | |
[root@orion ~]# curl localhost:10026/v2/subscriptions/5768f56870dce43aa351cfa7 | python -mjson.tool | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
108 434 108 434 0 0 109k 0 --:--:-- --:--:-- --:--:-- 423k | |
{ | |
"description": "A subscription to get info about Room1", | |
"expires": "2040-01-01T14:00:00.00Z", | |
"id": "5768f56870dce43aa351cfa7", | |
"notification": { | |
"attrs": [ | |
"temperature" | |
], | |
"attrsFormat": "normalized", | |
"http": { | |
"url": "http://localhost:1028" | |
}, | |
"lastNotification": "2016-06-21T08:09:48.00Z", | |
"timesSent": 1 | |
}, | |
"status": "active", | |
"subject": { | |
"condition": { | |
"attrs": [ | |
"temperature" | |
] | |
}, | |
"entities": [ | |
{ | |
"id": "11582", | |
"idPattern": "", | |
"type": "UserTest" | |
} | |
] | |
}, | |
"throttling": 5 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@orion ~]# nc -l 1028 | |
POST / HTTP/1.1 | |
user-agent: orion/1.2.1 libcurl/7.19.7 | |
host: localhost:1028 | |
accept: application/json | |
content-length: 145 | |
content-type: application/json; charset=utf-8 | |
fiware-correlator: 85a1e89e-3787-11e6-be07-52540003a38e | |
ngsiv2-attrsformat: normalized | |
X-Forwarded-For: 127.0.0.1 | |
Connection: keep-alive | |
{"subscriptionId":"5768f56870dce43aa351cfa7","data":[{"id":"11582","type":"UserTest","temperature":{"type":"Float","value":23.5,"metadata":{}}}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment