minor fixes and style changes in Orion CB AE

This commit is contained in:
Ronald Steinke 2018-01-10 10:32:49 +01:00
parent dccf58709a
commit 4408d69fef
4 changed files with 15 additions and 15 deletions

View File

@ -1,11 +1,11 @@
{
"name": "OrionContextBroker",
"ep": "http://localhost:8000",
"ep": "http://localhost:18000",
"cse_base": "onem2m",
"poas": [
"http://auto:25396"
],
"originator_pre": "//openmtc.org/mn-cse-1",
"originator_pre": "//openmtc.org/in-cse-1",
"ssl_certs": {
"cert_file": null,
"key_file": null,
@ -15,7 +15,7 @@
"level": "ERROR",
"file": null
},
"labels": [""],
"labels": ["openmtc:sensor_data:temperature", "openmtc:sensor_data:humidity"],
"interval": 10,
"orion_host": "http://localhost:1026",
"orion_api": "v2"

View File

@ -16,7 +16,7 @@
"file": "/var/log/openmtc/orioncontextbroker.log"
},
"labels": [],
"interval": 1,
"interval": 10,
"orion_host": "http://localhost:1026",
"orion_api": "v2"
}

View File

@ -7,4 +7,4 @@ __version__ = "0.1"
__description__ = "OrionContextBroker"
__author_name__ = "Christian Klopp"
__author_mail__ = "christian.klopp@fokus.fraunhofer.de"
__requires__ = []
__requires__ = ["requests"]

View File

@ -14,17 +14,17 @@ default_orion_api = "v2"
# args parser
parser = ArgumentParser(
description="Stores OpenMTC Date in an\
instance of the Orion Context Broker",
description="Stores OpenMTC Date in an instance of the "
"Orion Context Broker",
prog="OrionContextBroker",
formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument("-n", "--name", help="Name used for the AE.")
parser.add_argument("-s", "--ep", help="URL of the local Endpoint.")
parser.add_argument("--orion_host", help="URL of Orion CB")
parser.add_argument("--orion_api", help="Orion CB Api version (possible\
values: \"v2\")")
parser.add_argument('--labels', type=str, help='just subscribe to those\
labels', nargs='+')
parser.add_argument("--orion_api", help="Orion CB Api version (possible "
"values: \"v2\")")
parser.add_argument('--labels', type=str, help='just subscribe to those '
'labels', nargs='+')
parser.add_argument('--interval', type=int, help='update interval (s)')
# args, config and logging
@ -37,8 +37,8 @@ ep = get_value("ep", (unicode, str), default_ep, args, config)
poas = config.get("poas", ["http://auto:25396"])
originator_pre = config.get("originator_pre", "//openmtc.org/mn-cse-1")
ssl_certs = config.get("ssl_certs", {})
interval = get_value("interval", (int), default_ep, args, config)
lbl = get_value("labels", (list), default_labels, args, config)
interval = get_value("interval", int, default_ep, args, config)
lbl = get_value("labels", list, default_labels, args, config)
orion_host = get_value("orion_host", (unicode, str),
default_orion_host, args, config)
orion_api = get_value("orion_api", (unicode, str),
@ -46,8 +46,8 @@ orion_api = get_value("orion_api", (unicode, str),
# start
app = OrionContextBroker(
labels=lbl, interval=interval, orion_host=orion_host, orion_api=orion_api,
name=nm, cse_base=cb, poas=poas,
orion_host=orion_host, orion_api=orion_api, labels=lbl,
interval=interval, name=nm, cse_base=cb, poas=poas,
originator_pre=originator_pre, **ssl_certs
)
Runner(app).run(ep)