Skip to content

Commit

Permalink
Increasing test coverage and cii best practices (#55)
Browse files Browse the repository at this point in the history
* update readme
* update documentation to increase cii best practices
* increase test coverage
* minor issues fixing
  • Loading branch information
MattiaMarzano-Eng authored Jul 9, 2021
1 parent b556ff7 commit e8245c1
Show file tree
Hide file tree
Showing 15 changed files with 936 additions and 573 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ jobs:
run: |
npm install
npm test
code-coverage:
name: Coveralls Code Coverage
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion AGECONF/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"logLevel": "DEBUG",
"logLevel": "INFO",
"multiCore": false,
"relaxTemplateValidation": true,
"contextBroker": {
Expand Down Expand Up @@ -71,6 +71,8 @@
"contexts": [{
"id": "urn:ngsi-ld:Device:age01_Car",
"type": "Device",
"ngsiVersion": "ld",
"jsonLdContext": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"service": "opcua_car",
"subservice": "/demo",
"polling": false,
Expand Down Expand Up @@ -104,6 +106,8 @@
"contextSubscriptions": [{
"id": "urn:ngsi-ld:Device:age01_Car",
"type": "Device",
"ngsiVersion": "ld",
"jsonLdContext": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"mappings": [{
"ocb_id": "Error",
"opcua_id": "ns=3;s=Error",
Expand Down
2 changes: 1 addition & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Upgrade NodeJS version from 8.12.0 to 8.15.0 in Dockerfile due to security issues
Code refactoring and increase test coverage
250 changes: 230 additions & 20 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ For checking current status of the Agent, send a request to /status service

Documentation about OPC UA Client Secure connection can be found [here](docs/opc_ua_secure_connection_configuration.md)


### How to get access to the advanced API and Documentation topics

Documentation about the OPC UA Administration API can be found [here](https://opcuaiotagent.docs.apiary.io)
Expand Down Expand Up @@ -160,12 +159,12 @@ The **IoT Agent for OPC UA** project is part of [FIWARE](https://fiware.org/) an

The IoT Agent for OPC UA is licensed under [Affero General Public License (GPL) version 3](./LICENSE).

© 2020 Engineering Ingegneria Informatica S.p.A.
© 2021 Engineering Ingegneria Informatica S.p.A.

The following third-party libraries are used under license

1. [node-opcua](http://node-opcua.github.io/) - **MIT** - © 2014-2018 Etienne Rossignon
2. [iotagent-node-lib](https://github.com/telefonicaid/iotagent-node-lib) - **AGPL** © 2014-2018 Telefonica
1. [node-opcua](http://node-opcua.github.io/) - **MIT** - © 2014-2021 Etienne Rossignon
2. [iotagent-node-lib](https://github.com/telefonicaid/iotagent-node-lib) - **AGPL** © 2014-2021 Telefonica
Investigación y Desarrollo

The full list of third-party libraries licenses can be found
Expand Down
4 changes: 4 additions & 0 deletions conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"contexts": [{
"id": "urn:ngsi-ld:Device:age01_Car",
"type": "Device",
"ngsiVersion": "ld",
"jsonLdContext": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"service": "opcua_car",
"subservice": "/demo",
"polling": false,
Expand Down Expand Up @@ -104,6 +106,8 @@
"contextSubscriptions": [{
"id": "urn:ngsi-ld:Device:age01_Car",
"type": "Device",
"ngsiVersion": "ld",
"jsonLdContext": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"mappings": [{
"ocb_id": "Error",
"opcua_id": "ns=3;s=Error",
Expand Down
93 changes: 46 additions & 47 deletions conf/config.json.TEST_WITH_PLACEHOLDER
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"logLevel": "INFO",
"multiCore" : false,
"relaxTemplateValidation":true,
"multiCore": false,
"relaxTemplateValidation": true,
"contextBroker": {
"host": "TEST_MACHINE_IP",
"port": 1026,
"url": "http://TEST_MACHINE_IP:1026",
"ngsiVersion":"ld",
"jsonLdContext":"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"fallbackTenant":"opcua_car"
"service": "opcua_car",
"subservice": "/demo"
},
"server": {
"port": 4003,
"port": 4001,
"baseRoot": "/"
},
"deviceRegistry": {
Expand All @@ -29,82 +27,68 @@
"service": "opcua_car",
"subservice": "/demo",
"active": [
{
"name": "MissingContextSubElementForThis",
"type": "Number",
"object_id": "MissingContextSubElementForThis"
},
{
"name": "EngineBrake",
"type": "Number",
"object_id": "EngineBrake"
},
{
"name": "Speed",
"type": "Number",
"object_id": "Speed"
"type": "Number"
},
{
"name": "Acceleration",
"type": "Number",
"object_id": "Acceleration"
"type": "Number"
},
{
"name": "EngineStopped",
"type": "Boolean",
"object_id": "EngineStopped"
"type": "Boolean"
},
{
"name": "Engine_Temperature",
"type": "Number",
"object_id": "Engine_Temperature"
"type": "Number"
},
{
"name": "Engine_Oxigen",
"type": "Number",
"object_id": "Engine_Oxigen"
"type": "Number"
}
],
"lazy": [
{
"name": "Speed",
"type": "Number"
}
],
"lazy": [],
"commands": [
{
"name": "Error",
"type": "command"
},
{
"name": "Stop",
"type": "command",
"object_id": "Stop"
"type": "command"
},
{
"name": "Accelerate",
"type": "command",
"object_id": "Accelerate"
"type": "command"
}
]
}
},
"browseServerOptions": null,
"service": "opcua_car",
"subservice": "/demo",
"providerUrl": "http://TEST_MACHINE_IP:4003",
"providerUrl": "http://TEST_MACHINE_IP:4001",
"pollingExpiration": "200000",
"pollingDaemonFrequency": "20000",
"deviceRegistrationDuration": "P1M",
"defaultType": null,
"contexts": [
{
"id": "urn:ngsi-ld:Device:age01_Car",
"id": "age01_Car",
"type": "Device",
"service": "opcua_car",
"subservice": "/demo",
"polling": false,
"mappings": [
{
"ocb_id": "EngineBrake",
"opcua_id": "ns=3;s=EngineBrake",
"object_id": null,
"inputArguments": []
},
{
"ocb_id": "Speed",
"opcua_id": "ns=3;s=Speed",
"ocb_id": "Error",
"opcua_id": "ns=3;s=Error",
"object_id": null,
"inputArguments": []
},
Expand Down Expand Up @@ -137,9 +121,26 @@
],
"contextSubscriptions": [
{
"id": "urn:ngsi-ld:Device:age01_Car",
"id": "age01_Car",
"type": "Device",
"mappings": [
{
"ocb_id": "Error",
"opcua_id": "ns=3;s=Error",
"object_id": "ns=3;i=1000",
"inputArguments": [
{
"dataType": 12,
"type": "Error Type"
}
]
},
{
"ocb_id": "Speed",
"opcua_id": "ns=3;s=Speed",
"object_id": "ns=3;i=1000",
"inputArguments": []
},
{
"ocb_id": "Stop",
"opcua_id": "ns=3;s=Stop",
Expand All @@ -153,13 +154,11 @@
"inputArguments": [
{
"dataType": 6,
"type": "Intensity",
"value": 2,
"arrayType": 0
"type": "Intensity"
}
]
}
]
}
]
}
}
9 changes: 6 additions & 3 deletions conf/config.properties.WITH_PLACEHOLDER
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespaceNumericIdentifier=1000
context-broker-host=TEST_MACHINE_IP
context-broker-port=1026
server-base-root=/
server-port=4003
server-port=4001
device-registry-type=memory
mongodb-host=TEST_MACHINE_IP
mongodb-port=27017
Expand All @@ -15,11 +15,11 @@ mongodb-retries=5
mongodb-retry-time=5
fiware-service=opcua_car
fiware-service-path=/demo
provider-url=http://TEST_MACHINE_IP:4003
provider-url=http://TEST_MACHINE_IP:4001
device-registration-duration=P1M
#endpoint=opc.tcp://TEST_MACHINE_IP:4334/UA/EnergyMESServer
endpoint=opc.tcp://TEST_MACHINE_IP:5001/UA/CarServer
log-level=DEBUG
log-level=INFO
#DATATYPE MAPPING OPCUA --> NGSI
OPC-datatype-Number=Number
OPC-datatype-Decimal128=Number
Expand All @@ -39,6 +39,9 @@ maxNotificationsPerPublish=100
publishingEnabled=true
priority=10

#SubscriptionsStrategy
uniqueSubscription=false

#MONITORING PARAMETERS
samplingInterval=1
queueSize=10000
Expand Down
1 change: 0 additions & 1 deletion iot_agent_modules/run/findType.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = {
return device.active[i].type;
}
}
console.log('ritorno null???');
return null;
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "https://github.com/Engineering-Research-and-Development/iotagent-opcua/issues"
},
"engines": {
"node": ">=8.0.0"
"node": ">=12.0.0"
},
"scripts": {
"clean": "rm -rf package-lock.json && rm -rf node_modules && rm -rf coverage",
Expand Down
4 changes: 3 additions & 1 deletion replace_local_ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
MACHINE_IP=$(hostname -I | cut -d ' ' -f 1)

sed -i "s/TEST_MACHINE_IP/$MACHINE_IP/g" conf/config.properties
sed -i "s/TEST_MACHINE_IP/$MACHINE_IP/g" conf/config.json
sed -i "s/TEST_MACHINE_IP/$MACHINE_IP/g" conf/config.json
sed -i "s/TEST_MACHINE_IP/$MACHINE_IP/g" conf/config.properties.WITH_PLACEHOLDER
sed -i "s/TEST_MACHINE_IP/$MACHINE_IP/g" conf/config.json.TEST_WITH_PLACEHOLDER
6 changes: 3 additions & 3 deletions roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ guidelines only, and this section may be revised to provide newer information at
## Short term

The following list of features are planned to be addressed in the short term, and incorporated in the next release of
the product planned for **June 2021**:
the product planned for **October 2021**:

- NGSI-LD full compliance
- Test Coverage increasing
- Documentation improvement
- Features improvement and Bug Fixing from validation scenarios

## Medium term

The following list of features are planned to be addressed in the medium term, typically within the subsequent
release(s) generated in the next **6 months** after next planned release:

- Test Coverage increasing
- Mapping Tool: introduction of OPC UA Companions
- Investigate compatibility with future NodeJS LTS

Expand Down
2 changes: 1 addition & 1 deletion tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ services:
- "1026:1026"
depends_on:
- orion_mongo
command: -statCounters -dbhost orion_mongo -logForHumans -logLevel INFO -t 255
command: -statCounters -dbhost orion_mongo -logLevel INFO

orion_mongo:
hostname: orion_mongo
Expand Down
Loading

0 comments on commit e8245c1

Please sign in to comment.