Compare commits

..

9 Commits

Author SHA1 Message Date
8bd1ea0a48 Create CONTRIBUTING.md 2019-02-19 13:57:09 +01:00
94682098ea Update issue templates (#31) 2019-02-14 15:55:20 +01:00
1052fd4a08 Release 1.3 (#30)
* Test debian stretch+python3 (#18)

* changes starting with python3 explicit

* removes python modules which are not available for python3

* exchanges fyzz query parsing with rdflib functionality

* fixes interop tests

* replaces reduce with for loop in nodb driver

* simple python2 -> python3 conversions

* adds changes for handling different string handling in python3

* test stretch building with travis

* installing python-setuptools in docker

* installing python-setuptools in docker

* changing python2 to python3 in docker makefiles

* changing python2 to python3 and some other test changes

* push docker only in master branche

* running version of openmtc

* fix some port problems

* porting path library completly now

* restoring travis.yml

* testing new travis.yml

* add sudo

* updating travis OS from trusty to xenial

* upgrade pip before

* show running docker logs

* show more logs

* for debugging

* showlogs of docker after failure

* testing new travis.yml

* finish travis.yml

* Adding roadmap (#26)

* adding roadmap

* adding a nicer view for some documents

* creating contributions.md (#27)

* travis only building on master branch (#25)

* deleting some typo

* another typo

* adding a contributer

* bump version to 1.3.0

* better link for contributions

* Port and fix simple apps

* add version tag
2019-02-14 15:41:53 +01:00
c3ac4f9dfb fixing type of timestamp 2019-02-05 16:23:17 +01:00
7781b15c4e Adding Contributions to readme 2019-02-05 15:51:35 +01:00
b9034a916f Coverage badge 2019-02-05 12:30:43 +01:00
5257a11cf0 Adding vulnerabilities (snyk) badge to README 2019-01-25 17:51:30 +01:00
461698b32a Better Workaround for Snyk to find requirements.txt 2019-01-25 17:48:05 +01:00
734a51fb73 Workaround for Snyk to find requirements.txt 2019-01-25 17:43:58 +01:00
24 changed files with 175 additions and 188 deletions

23
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -1,26 +1,26 @@
services:
- docker
- docker
dist: xenial
before_script:
- sudo apt update
- sudo apt install qemu-user-static python3 python3-pip python3-setuptools
- sudo pip3 install --upgrade pip
- sudo python3 -m pip install --upgrade setuptools
- sudo python3 -m pip install --upgrade pyresttest
- "./create-binary-docker backend"
- "./create-binary-docker backend -a arm"
- "./create-binary-docker gateway"
- "./create-binary-docker gateway -a arm"
- "./create-binary-docker orioncontextbroker"
- "./create-binary-docker orioncontextbroker -a arm"
- "./create-binary-docker influxdbapp"
- "./create-binary-docker influxdbapp -a arm"
- "./create-binary-docker cul868ipe"
- "./create-binary-docker cul868ipe -a arm"
- docker run -d --name backend -p 0.0.0.0:18000:18000 -e "ONEM2M_CSE_ID=backend" -e "ONEM2M_NOTIFICATION_DISABLED=false" openmtc/backend-amd64 -v
- docker logs backend
- docker run -d --name gateway -p 0.0.0.0:8000:8000 -e "ONEM2M_HTTP_TRANSPORT_PORT=8000" -e "ONEM2M_CSE_ID=gateway" -e "ONEM2M_REMOTE_CSE_POA=<POA>" -e "ONEM2M_REMOTE_CSE_ID=backend" -e "ONEM2M_NOTIFICATION_DISABLED=false" -e "ONEM2M_REGISTRATION_DISABLED=false" openmtc/gateway-amd64 -v
- docker logs gateway
- sudo apt update
- sudo apt install qemu-user-static python3 python3-pip python3-setuptools
- sudo pip3 install --upgrade pip
- sudo python3 -m pip install --upgrade setuptools
- sudo python3 -m pip install --upgrade pyresttest
- "./create-binary-docker backend"
- "./create-binary-docker backend -a arm"
- "./create-binary-docker gateway"
- "./create-binary-docker gateway -a arm"
- "./create-binary-docker orioncontextbroker"
- "./create-binary-docker orioncontextbroker -a arm"
- "./create-binary-docker influxdbapp"
- "./create-binary-docker influxdbapp -a arm"
- "./create-binary-docker cul868ipe"
- "./create-binary-docker cul868ipe -a arm"
- docker run -d --name backend -p 0.0.0.0:18000:18000 -e "ONEM2M_CSE_ID=backend" -e "ONEM2M_NOTIFICATION_DISABLED=false" openmtc/backend-amd64 -v
- docker logs backend
- docker run -d --name gateway -p 0.0.0.0:8000:8000 -e "ONEM2M_HTTP_TRANSPORT_PORT=8000" -e "ONEM2M_CSE_ID=gateway" -e "ONEM2M_REMOTE_CSE_POA=<POA>" -e "ONEM2M_REMOTE_CSE_ID=backend" -e "ONEM2M_NOTIFICATION_DISABLED=false" -e "ONEM2M_REGISTRATION_DISABLED=false" openmtc/gateway-amd64 -v
- docker logs gateway
script:
- docker tag openmtc/orioncontextbroker-amd64 openmtc/orion-context-broker-app-amd64
- docker tag openmtc/orioncontextbroker-arm openmtc/orion-context-broker-app-arm
@ -35,6 +35,21 @@ after_script:
env:
matrix:
secure: oQe/MxxFrPPArxb6OFzOUwG2ZlA5GYekMR6qn0Y3101v82MdrIVgDILHR41iwykTtk1XpJPV9uabsRsvY4hBmbjYzihYZFOAzFf+/KU7wROtKum0fFfLjCPb8uGV41k1JTquB94FibXboVAP7rNL0Vrpl+FGUvMGatQBtwZnGvha6Ha07qTao+X9+0dJ4YvFlvcba/jfzBZBwHw7KHpRoiyKU0dPmXpHcqnZBFcNqRXhzdVrgx0auP/tghoshW5LQWkpTV11uSx/kYuby4oo8r8nB6L0rW1jYSXs9DHiTQCfCy24xlb9YJjCD9aFcjH0lIkVIqQwJYA67MzKYMK4XV684J/Jr3+jfVOoUt0bpZaTnk+r/uiFCtEsN7q0KUlvHLUAi1YNJhKs6CRrAH3GK25QByh+suzPzZoHP42F2LYP9URlzbDH+/v7CwNuw+9pHSmxEhs18LVmggwkMos3o3ArvzMLRNJ3QG1fdoxL/Ubqxhmvhy4rZi6vGQsiF64oX8PN0sRgXekTU/ma+6CTM6qhgkocMUYzT2r/6qd/9R3jmtxSZnikjkR6Iu9NLzAUY+cqnvvjohAvqYyj+tGlQfOPxAU9H4wXnbQWLBM8yn6yt2Ki+3+Jx4Owdv0oXVJpN0GWjMzIJ1nEus5odkWW+c4wcZb6m3Ak0PrzYPp2BgE=
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
docker push openmtc/backend-amd64;
docker push openmtc/backend-arm;
docker push openmtc/gateway-amd64;
docker push openmtc/gateway-arm;
docker push openmtc/orion-context-broker-app-amd64;
docker push openmtc/orion-context-broker-app-arm;
docker push openmtc/cul868-ipe-amd64;
docker push openmtc/cul868-ipe-arm;
docker push openmtc/influxdb-app-amd64;
docker push openmtc/influxdb-app-arm;
fi
after_failure:
- docker logs backend
- docker logs gateway
- docker logs gateway
- coveralls

43
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,43 @@
# Contributor guidelines template
## What do I need to know to help?
If you are looking to help to with a code contribution our project uses Python,Bash and Docker.
If you don't feel ready to make a code contribution yet, no problem!
You can also check out the [documentation issues](https://fiware-openmtc.readthedocs.io/).
If you are interested in making a code contribution and would like to learn more about the technologies that we use,
check out the list below.
- Include bulleted list of
- resources (tutorials, videos, books) that new contributors
- can use to learn what they need to know to contribute to your project
## How do I make a contribution?
Never made an open source contribution before?
Wondering how contributions work in the in our project?
Here's a quick rundown!
1) Find an issue that you are interested in addressing or a feature that you would like to add.
2) Fork the repository associated with the issue to your local GitHub organization.
This means that you will have a copy of the repository under your-GitHub-username/repository-name.
3) Clone the repository to your local machine using git clone https://github.com/OpenMTC/OpenMTC.git .
4) Create a new branch for your fix using git checkout -b branch-name-here.
5) Make the appropriate changes for the issue you are trying to address or the feature that you want to add.
6) Use git add insert-paths-of-changed-files-here to add the file contents of the changed files to the "snapshot" git uses to manage the state of the project, also known as the index.
7) Use git commit -m "Insert a short message of the changes made here" to store the contents of the index with a descriptive message.
8) Push the changes to the remote repository using git push origin branch-name-here.
9) Submit a pull request to the upstream repository.
10) Title the pull request with a short description of the changes made and the issue or bug number associated with your change. For example, you can title an issue like so "Added more log outputting to resolve #4352".
11) In the description of the pull request, explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainer. It's OK if your pull request is not perfect (no pull request is), the reviewer will be able to help you fix any problems and improve it!
12) Wait for the pull request to be reviewed by a maintainer.
13) Make changes to the pull request if the reviewing maintainer recommends them.
14) Celebrate your success after your pull request is merged!
## Where can I go for help?
If you need help, you can ask questions via mail (info@openmtc.org) or Github Issue.
## What does the Code of Conduct mean for me?
Our Code of Conduct means that you are responsible for treating everyone on the project with respect and courtesy regardless of their identity. If you are the victim of any inappropriate behavior or comments as described in our Code of Conduct, we are here for you and will do the best to ensure that the abuser is reprimanded appropriately, per our code.

6
CONTRIBUTIONS.md Normal file
View File

@ -0,0 +1,6 @@
# Contributors ordered by number of commits
Ronald Steinke <rst-fokus>
Christian Klopp <ckl-fokus>
Alexander Ortlieb <aor-fokus>
Jason Fox <jason-fox>

View File

@ -12,6 +12,8 @@
![Status](https://nexus.lab.fiware.org/static/badges/statuses/iot-openmtc.svg)
[![](https://img.shields.io/docker/pulls/openmtc/gateway-amd64.svg)](https://hub.docker.com/u/openmtc)
[![Build Status](https://travis-ci.org/OpenMTC/OpenMTC.svg?branch=master)](https://travis-ci.org/OpenMTC/OpenMTC)
[![Known Vulnerabilities](https://snyk.io/test/github/OpenMTC/OpenMTC/badge.svg?targetFile=openmtc-gevent%2Frequirements.txt)](https://snyk.io/test/github/OpenMTC/OpenMTC?targetFile=openmtc-gevent%2Frequirements.txt)
[![Coverage Status](https://coveralls.io/repos/github/OpenMTC/OpenMTC/badge.svg?branch=master)](https://coveralls.io/github/OpenMTC/OpenMTC?branch=master)
The OpenMTC SDK aims to provide developers with a convenient yet flexible tool
to write oneM2M compliant applications. This includes network applications
@ -22,16 +24,19 @@ This project is part of [FIWARE](https://www.fiware.org/). For more information
check the FIWARE Catalogue entry for the
[IoT Agents](https://github.com/Fiware/catalogue/tree/master/iot-agents).
| :books: [Documentation](https://fiware-openmtc.readthedocs.io) | :page_facing_up: [Site](http://www.openmtc.org) | :whale: [Docker Hub](https://hub.docker.com/u/openmtc) | :dart: [Roadmap](roadmap.md) |
# Content
- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Quality Assurance](#quality-assurance)
- [Contributing](#contributing)
- [License](#license)
## Install
## Install
Information about how to install the JSON IoTAgent can be found at the
corresponding section of the
@ -89,10 +94,14 @@ follows:
---
## Licence
## Contributing
Contribution guidelines are detailed in the [CONTRIBUTIONS](CONTRIBUTIONS.md) file.
## License
The OpenMTC SDK is licensed under the Eclipse Public License (EPL)
version 1.
© 2018 OpenMTC
© 2018-2019 OpenMTC

View File

@ -2,7 +2,7 @@
Transfer OpenMTC Data to an InfluxDB
"""
__version__ = "1.2.0"
__version__ = "1.3.0"
__description__ = "InfluxdbApp"
__author_name__ = "Christian Klopp"
__author_mail__ = "christian.klopp@fokus.fraunhofer.de"

View File

@ -3,7 +3,7 @@ This App will forward all incoming sensor traffic to the Fiware Orion Context
Broker
"""
__version__ = "1.2.0"
__version__ = "1.3.0"
__description__ = "OrionContextBroker"
__author_name__ = "Christian Klopp"
__author_mail__ = "christian.klopp@fokus.fraunhofer.de"

View File

@ -1,5 +1,6 @@
from urllib.parse import urljoin
import logging
from datetime import datetime
import requests
@ -89,7 +90,8 @@ class OrionAPI(LoggerMixin):
"type": self._get_type(data_senml["v"]),
"metadata": {
"timestamp": {
"value": data_senml["t"],
"value": datetime.fromtimestamp(float(data_senml["t"])).replace(microsecond=0).isoformat()
if data_senml["t"] != "none" else data_senml["t"],
"type": "String"
},
"bn": {

View File

@ -2,7 +2,7 @@
App to inject data from a csv file to OpenMTC
"""
__version__ = "1.2.0"
__version__ = "1.3.0"
__description__ = "csvInjector"
__author_name__ = "Christian Klopp"
__author_mail__ = "christian.klopp@fokus.fraunhofer.de"

View File

@ -2,7 +2,7 @@
TODO: Add description here
"""
__version__ = "1.2.0"
__version__ = "1.3.0"
__description__ = "mqttConnector"
__author_name__ = "Ronald Steinke"
__author_mail__ = "ronald.steinke@fokus.fraunhofer.de"

View File

@ -43,6 +43,6 @@ if __name__ == "__main__":
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
ep = "http://localhost:8000"
Runner(DataVisualization(), port=6050, host='auto').run(ep)
Runner(DataVisualization(poas=['http://localhost:21345'])).run(ep)

View File

@ -91,4 +91,4 @@ if __name__ == "__main__":
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
ep = "http://localhost:8000"
Runner(DataAggregation(), port=6050, host='auto').run(ep)
Runner(DataAggregation(poas=['http://localhost:21346'])).run(ep)

View File

@ -19,4 +19,4 @@ if __name__ == "__main__":
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
ep = "http://localhost:8000"
Runner(SimpleDecision2(), port=6050, host='auto').run(ep)
Runner(SimpleDecision2(poas=['http://localhost:21387'])).run(ep)

View File

@ -47,4 +47,4 @@ if __name__ == "__main__":
from openmtc_app.flask_runner import SimpleFlaskRunner as Runner
ep = "http://localhost:8000"
Runner(SimpleDecision(), port=6050, host='auto').run(ep)
Runner(SimpleDecision(poas=['http://localhost:22245'])).run(ep)

View File

@ -31,5 +31,6 @@ app_file=${app_array[$[${choice}-1]]}
################################################################################
# run app_file
cd ${base_path}
. ../../common/prep-env.sh
python ${app_file}
cd ..
. ../common/prep-env.sh
python3 ${app_file}

View File

@ -2,7 +2,7 @@
Interworking Proxy for Cul868 devices.
"""
__version__ = "1.2.0"
__version__ = "1.3.0"
__description__ = "The OpenMTC Cul868IPE"
__author_name__ = "Ronny Kreuch"
__author_mail__ = "ronny.kreuch@fokus.fraunhofer.de"

View File

@ -7,7 +7,7 @@
"default_content_type": "application/json"
},
"database": {
"driver": "openmtc_server.db.mongodb.MongoDB",
"driver": "openmtc_server.db.nodb2.NoDB2",
"dropDB": true
},
"logging": {

View File

@ -0,0 +1 @@
dependencies.txt

15
roadmap.md Normal file
View File

@ -0,0 +1,15 @@
## Short Term
onem2m Release 2a compatibility
Group Resource
Pub/Sub improvements (rateLimit and batchNotify)
Persistence Enhancement
## Medium Term
onem2m Release 3 compatibility
Announcements
FlexContainer Resource
Node Resource
## Long Term
CoAP(s) & MQTTS
XML

View File

@ -1,148 +0,0 @@
from openmtc_server.db import DBAdapter, Shelve, DBError
from openmtc_server.db import BasicSession
from copy import copy
from collections import defaultdict, OrderedDict
from openmtc_server.db.exc import DBConflict, DBNotFound
from openmtc_onem2m.model import OneM2MResource, CSEBase, AE, Container, ContentInstance, Subscription, RemoteCSE
from pymongo import MongoClient
res_type = {'2' : AE,
'3' : Container,
'4' : ContentInstance,
'5' : CSEBase,
'16' : RemoteCSE,
'23' : Subscription}
class MongoDBSession(BasicSession):
def __init__(self, db, std_type, *args, **kw):
self.db = db
self.std_type = std_type
self.resources = db['resources']
def store(self, resource):
path = resource.path
resource_type = type(resource)
document = resource.values
document ['path'] = path
self.logger.debug("Adding resource to db: %s -> %s (%s)",
path, resource, resource_type)
self.resources.insert(document)
def _get(self, path):
pass
def get(self, path):
document = self.resources.find_one({'path': path}, {'_id': False})
if document is None:
document = self.resources.find_one({'resourceID':path}, {'_id': False})
if document is None:
raise DBNotFound
res = self.func (document)
return res
def func (self, document):
res_type_value = document['resourceType']
modelclass = res_type[str(res_type_value)]
#print modelclass(**document)
return modelclass(**document)
def get_collection(self, resource_type, parent, filter_criteria=None):
self.logger.debug("Getting %s children of %s (%s)", resource_type,
parent, parent.__model_name__)
parentID = parent.resourceID
find_children = self.resources.find({'parentID':parentID}, {'_id': False})
children = map (self.func, find_children)
return children
def exists(self, resource_type, fields):
self.logger.debug("Checking existence of %s with %s", resource_type,
fields)
pass
def update(self, resource, fields=None):
document = resource.values
path = resource.path
# document ['path'] = path
#field = document [fields]
if fields == None or fields == []:
document = document
else:
# change that document
pass
modify = self.resources.find_one_and_update({'path': path}, {'$set': document })
#print doc
#document[fields] = fields
def delete(self, resource):
document = resource.values
self.resources.remove(document)
def commit(self):
pass
def rollback(self):
pass
class MongoDBShelve(dict, Shelve):
def commit(self):
pass
def rollback(self):
pass
class MongoDB(DBAdapter):
def __init__(self, *args, **kw):
super(MongoDB, self).__init__(*args, **kw)
client = MongoClient('localhost', 27017)
client.drop_database('mongodb')
self.db = client['mongodb']
#self.db.drop_collection()
self.onem2m_resources = None
self.shelves = None
self.initialized = False
def initialize(self, force=False):
if not force and self.is_initialized():
raise Exception("Already initialized")
#self.onem2m_resources = None
self.shelves = defaultdict(MongoDBShelve)
self.initialized = True
def get_shelve(self, name):
return self.shelves[name]
def start_session(self, std_type):
return MongoDBSession(self.db, std_type)
def is_initialized(self):
return self.initialized

View File

@ -57,7 +57,7 @@ class NoDB2Session(BasicSession):
assert path is not None
self.logger.debug("Getting resource: %s", path)
resource = self._get(path)
return copy(self._get(path))
return copy(resource)
def get_collection(self, resource_type, parent, filter_criteria=None):
self.logger.debug("Getting %s children of %s (%s)", resource_type,

View File

@ -13,7 +13,7 @@ from utils import (get_packages, OpenMTCSdist, OpenMTCBuildPy,
# name and version
SETUP_NAME = "openmtc-all"
SETUP_VERSION = "1.2.0"
SETUP_VERSION = "1.3.0"
SETUP_DESCRIPTION = "The OpenMTC Backend and Gateway (GEvent version)"
# meta

View File

@ -7,7 +7,7 @@ from utils import get_packages, OpenMTCSdist
# name and version
NAME = "sdk"
SETUP_NAME = "openmtc-" + NAME
SETUP_VERSION = "1.2.0"
SETUP_VERSION = "1.3.0"
SETUP_DESCRIPTION = "The OpenMTC Python SDK"
# meta