Skip to content

Commit 3cbcc49

Browse files
committed
Update Cygnus
- Tutorials use 1.18.3 which supports the NGSI v2 interface - `legacy` has been removed where possible.
1 parent deff723 commit 3cbcc49

File tree

9 files changed

+48
-17
lines changed

9 files changed

+48
-17
lines changed

context-provider/routes/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,25 @@ router.get('/app/monitor', function(req, res) {
153153
res.render('monitor', { title: 'Event Monitor' });
154154
});
155155

156+
// Display the app monitor page
157+
router.get('/device/history', function(req, res) {
158+
const data = NGSI_VERSION === 'ngsi-v2' ? NGSI_V2_STORES : NGSI_LD_STORES;
159+
const stores = [];
160+
161+
if (process.env.CRATE_DB_SERVICE_URL || process.env.STH_COMET_SERVICE_URL) {
162+
data.forEach(element => {
163+
stores.push({
164+
name: element.name,
165+
href: element.href.replace('app/store/', 'history/')
166+
});
167+
});
168+
}
169+
res.render('history-index', {
170+
title: 'Short-Term History',
171+
stores
172+
});
173+
});
174+
156175
// Viewing Store information is secured by Keyrock PDP.
157176
// LEVEL 1: AUTHENTICATION ONLY - Users must be logged in to view the store page.
158177
router.get('/app/store/:storeId', Security.authenticate, Store.displayStore);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
extends layout
2+
3+
block content
4+
h1= title
5+
6+
- if (stores.length)
7+
div
8+
h3 Device History for each Store
9+
10+
ul
11+
each store in stores
12+
a(href=`${store.href}`) #{store.name}
13+
|  
14+
- else
15+
p.red No Device History available

context-provider/views/index.pug

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ block content
4444
a(href="app/monitor") App Monitor
4545
|  
4646
a(href="device/monitor") Device Monitor
47+
|  
48+
a(href="device/history") Short-Term History
4749

4850
div
4951
h3 Store Details

docs/historic-context-nifi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ A summary of the differences can be seen below:
3232

3333
| Draco | Cygnus |
3434
| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
35-
| Offers an NGSI v2 interface for notifications | Offers an NGSI v1 interface for notifications |
35+
| Offers an NGSI v2 interface for notifications | Offers an NGSI v2 interface for notifications |
3636
| configurable subscription endpoint, but defaults to `/v2/notify` | subscription endpoint listens on `/notify` |
3737
| listens on a single port | listens on separate ports for each input |
3838
| Configured by a graphical interface | Configured via config files |

docs/short-term-history.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![FIWARE Core Context Management](https://nexus.lab.fiware.org/repository/raw/public/badges/chapters/core.svg)](https://github.com/FIWARE/catalogue/blob/master/core/README.md)
22
[![NGSI v1](https://img.shields.io/badge/NGSI-v1-ff69b4.svg)](http://forge.fiware.org/docman/view.php/7/3213/FI-WARE_NGSI_RESTful_binding_v1.0.zip)
3+
[![NGSI v2](https://img.shields.io/badge/NGSI-v2-blue.svg)](https://fiware-ges.github.io/orion/api/v2/stable/)
34

45
**Description:** This tutorial is an introduction to [FIWARE STH-Comet](https://fiware-sth-comet.readthedocs.io/) - a
56
generic enabler which is used to retrieve trend data from a MongoDB database. The tutorial activates the IoT sensors
@@ -1083,9 +1084,7 @@ This is done by making a POST request to the `/v2/subscription` endpoint of the
10831084
- The `fiware-service` and `fiware-servicepath` headers are used to filter the subscription to only listen to
10841085
measurements from the attached IoT Sensors
10851086
- The `idPattern` in the request body ensures that **Cygnus** will be informed of all **Motion Sensor** data changes.
1086-
- The notification `url` must match the configured `CYGNUS_API_PORT`
1087-
- The `attrsFormat=legacy` is required since **Cygnus** currently only accepts notifications in the older NGSI v1
1088-
format.
1087+
- The notification `url` must match the configured `CYGNUS_MONGO_SERVICE_PORT`
10891088

10901089
#### 14 Request:
10911090

@@ -1111,12 +1110,11 @@ curl -iX POST \
11111110
},
11121111
"notification": {
11131112
"http": {
1114-
"url": "http://cygnus:5050/notify"
1113+
"url": "http://cygnus:5051/notify"
11151114
},
11161115
"attrs": [
11171116
"count"
1118-
],
1119-
"attrsFormat": "legacy"
1117+
]
11201118
}
11211119
}'
11221120
```
@@ -1132,9 +1130,7 @@ the `throttling` attribute in the request body.
11321130
- The `fiware-service` and `fiware-servicepath` headers are used to filter the subscription to only listen to
11331131
measurements from the attached IoT Sensors
11341132
- The `idPattern` in the request body ensures that **Cygnus** will be informed of all **Smart Lamp** data changes only
1135-
- The notification `url` must match the configured `CYGNUS_API_PORT`
1136-
- The `attrsFormat=legacy` is required since **Cygnus** currently only accepts notifications in the older NGSI v1
1137-
format.
1133+
- The notification `url` must match the configured `CYGNUS_MONGO_SERVICE_PORT`
11381134
- The `throttling` value defines the rate that changes are sampled.
11391135

11401136
#### 15 Request:
@@ -1161,12 +1157,11 @@ curl -iX POST \
11611157
},
11621158
"notification": {
11631159
"http": {
1164-
"url": "http://cygnus:5050/notify"
1160+
"url": "http://cygnus:5051/notify"
11651161
},
11661162
"attrs": [
11671163
"luminosity"
1168-
],
1169-
"attrsFormat": "legacy"
1164+
]
11701165
},
11711166
"throttling": 5
11721167
}'

0 commit comments

Comments
 (0)