Giter VIP home page Giter VIP logo

acme-onem2m-cse's Introduction

acme-onem2m-cse's People

Contributors

ankraft avatar bobfiv avatar dependabot[bot] avatar jirid85 avatar luke1734 avatar reinaortega avatar tsengia avatar yanngarcia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

acme-onem2m-cse's Issues

crash: '/id-in?fu=1&rcn=4'

development branch only, works in master:

5190046203486207, permission: 32, selfPrivileges: False                                    SecurityManager.py:66
           DEBUG    5902 - Retrieve resource: acp3119621421175847417                                                                                                              Dispatcher.py:172
           DEBUG    5902 - Permission granted                                                                                                                                SecurityManager.py:118
           DEBUG    5902 - Retrieve resource: id-in                                                                                                                               Dispatcher.py:172
           DEBUG    5902 - <== Response (RSC: 2000):                                                                                                                              HttpServer.py:231
                    [<resources.FCNT_LA.FCNT_LA object at 0x7f923202fd00>, <resources.FCNT_OL.FCNT_OL object at 0x7f923202f3d0>]                                                                   
[12:09:04] ERROR    5902 - Exception on /id-in [GET]                                                                                                                                    app.py:2450
                    Traceback (most recent call last):                                                                                                                                             
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app                                                                                  
                        response = self.full_dispatch_request()                                                                                                                                    
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request                                                                     
                        rv = self.handle_user_exception(e)                                                                                                                                         
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception                                                                     
                        reraise(exc_type, exc_value, tb)                                                                                                                                           
                      File "/home/me/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise                                                                                 
                        raise value                                                                                                                                                                
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request                                                                     
                        rv = self.dispatch_request()                                                                                                                                               
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request                                                                          
                        return self.view_functions[rule.endpoint](**req.view_args)                                                                                                                 
                      File "acme/HttpServer.py", line 110, in handleGET                                                                                                                            
                        return self._prepareResponse(request, resource, rc)                                                                                                                        
                      File "acme/HttpServer.py", line 232, in _prepareResponse                                                                                                                     
                        resp = make_response(r)                                                                                                                                                    
                      File "/home/me/.local/lib/python3.8/site-packages/flask/helpers.py", line 223, in make_response                                                                          
                        return current_app.make_response(args)                                                                                                                                     
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 2127, in make_response                                                                             
                        raise TypeError(                                                                                                                                                           
                    TypeError: The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a                 
                    list.                                                                                                                                                                          
           DEBUG    5902 - "GET /id-in?fu=1&rcn=4 HTTP/1.1" - 500                                                                                                                 HttpServer.py:298

Error thrown when try to discover resource that use ACP with ty under acod

Hi,

Currently i try to create ACP with ACOD like sample below

"acod": [
    {
        "ty": 2,
        "chty": [2, 3, 4, 23]
    }
]

As far as i know, in specification ty field is an int, but it throw error when i want to discover the resource that use the ACP.

Traceback (most recent call last):
  File "/ACME-oneM2M-CSE/acme/services/HttpServer.py", line 229, in _handleRequest
    responseResult = CSE.request.handleRequest(dissectResult.request)
  File "/ACME-oneM2M-CSE/acme/services/RequestManager.py", line 144, in handleRequest
    return self.requestHandlers[request.op].ownRequest(request)
  File "/ACME-oneM2M-CSE/acme/services/RequestManager.py", line 183, in retrieveRequest
    return CSE.dispatcher.processRetrieveRequest(request, request.originator)
  File "/ACME-oneM2M-CSE/acme/services/Dispatcher.py", line 198, in processRetrieveRequest
    if not (res := self.discoverResources(id, originator, request.fc, permission = permission)).status: # not found?
  File "/ACME-oneM2M-CSE/acme/services/Dispatcher.py", line 342, in discoverResources
    discoveredResources = self._discoverResources(rootResource,
  File "/ACME-oneM2M-CSE/acme/services/Dispatcher.py", line 398, in _discoverResources
    filterCriteria) and CSE.security.hasAccess(originator, resource, permission):
  File "/ACME-oneM2M-CSE/acme/services/SecurityManager.py", line 272, in hasAccess
    if acp.checkPermission(originator, requestedPermission, ty):
  File "/ACME-oneM2M-CSE/acme/resources/ACP.py", line 183, in checkPermission
    if ty not in eachAcod.get('ty'):
TypeError: argument of type 'int' is not iterable

Then i check https://github.com/ankraft/ACME-oneM2M-CSE/blob/master/acme/resources/ACP.py#L183, that line try to iterate ty value when it suppose to compare. I change that line and now it works fine.

if ty is not None and ty is not eachAcod.get('ty'):
    continue

ACME CSE using release version 0.11.2

Discovery

Hello,

I'm attempting to discover resources based on labels.

I'm running ACME as an in-cse and executing the following command in the terminal:

curl -X GET -H 'X-M2M-Origin:Cmysensor' -H 'X-M2M-RI:123' -H 'X-M2M-RVI:3' -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/cse-in/MySensor/Container?fu=2&lbl=tag:temperature&rcn=8

However, I'm receiving the representation of the Container resource in the response body instead of the representation of the resource containing 'tag:temperature' as the label attribute value.

When I execute the request using the RESTClient provided by the ACME web interface, I get the expected result.

Could you please explain why it's not working with the terminal?

Best regards,

Creating Flex Container without specifiying Resource ID

Hi, I'm not sure if this is truely a bug, or if I am not fully understanding oneM2M.
I am attempting to create a FlexContainer using a custom definition that I've placed in the init folder.
My flex container definition is below (ignore the line numbers of the left):

  1 [
  2     {
  3         "type": "traffic:trfint",
  4         "lname": "trafficLightIntersection",
  5         "cnd": "edu.psu.cse.traffic.trafficLightIntersection",
  6
  7         "attributes": [
  8             {
  9                 "sname":"id",
 10                 "lname": "identifier",
 11                 "type":"string",
 12                 "car":"1"
 13            },
 14            {
 15                 "sname":"bts",
 16                 "lname": "bluetoothState",
 17                 "type":"string",
 18                 "car":"1"
 19            },
 20            {
 21                 "sname":"l1s",
 22                 "lname": "light1State",
 23                 "type":"string",
 24                 "car":"1"
 25            },
 26            {
 27                 "sname":"l2s",
 28                 "lname": "light2State",
 29                 "type":"string",
 30                 "car":"1"
 31            }
 32         ]
 33     }
 34 ]

The REST request that I'm sending is here:

{
    "my-flex-cnt": {
        "acpi": [
            "/id-in/acpCreateACPs"
        ],
        "cnd": "traffic:trfint",
        "rn": "light1-rn",
        "id": "thingy91intersectionA",
        "bts": "connected",
        "l1s": "yellow",
        "l2s": "red"
    }
}

This results in the following error and stack trace:

Traceback (most recent call last):                                       Utils.py:875
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/HttpServer.py", line 215, in
                   _handleRequest
                       responseResult = CSE.request.handleRequest(dissectResult.request)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/RequestManager.py", line 124, in
                   handleRequest
                       return self.requestHandlers[request.op].ownRequest(request)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/RequestManager.py", line 179, in
                   createRequest
                       res = CSE.dispatcher.processCreateRequest(request, request.headers.originator)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/Dispatcher.py", line 493, in
                   processCreateRequest
                       if not (nres := Factory.resourceFromDict(deepcopy(request.pc),
                   pi=parentResource.ri, ty=ty)).resource:      # something wrong, perhaps wrong type
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/Factory.py", line 208, in
                   resourceFromDict
                       return Result(status = True, rsc = RC.OK, resource = factory[1](resDict, tpe, pi,
                   create))
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/Factory.py", line 98, in
                   <lambda>
                       T.FCNT                      : (FCNT,                lambda dct, tpe, pi, create :
                   FCNT(dct, pi = pi, fcntType = tpe, create = create)),
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/FCNT.py", line 66, in __init__
                       super().__init__(T.FCNT, dct, pi, tpe = fcntType, create = create)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/AnnounceableResource.py", line
                   21, in __init__
                       super().__init__(ty, dct, pi, tpe = tpe, create = create, inheritACP =
                   inheritACP, readOnly = readOnly, rn = rn,)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/Resource.py", line 107, in
                   __init__
                       self.setAttribute('ri', Utils.uniqueRI(self.tpe), overwrite = False)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/etc/Utils.py", line 39, in uniqueRI
                       return f'{noNamespace(prefix)}{uniqueID()}'
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/etc/Utils.py", line 110, in noNamespace
                       _, found, tail = id.partition(':')
                   AttributeError: 'NoneType' object has no attribute 'partition'


                   Traceback (most recent call last):
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/HttpServer.py", line 215, in
                   _handleRequest
                       responseResult = CSE.request.handleRequest(dissectResult.request)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/RequestManager.py", line 124, in
                   handleRequest
                       return self.requestHandlers[request.op].ownRequest(request)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/RequestManager.py", line 179, in
                   createRequest
                       res = CSE.dispatcher.processCreateRequest(request, request.headers.originator)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/services/Dispatcher.py", line 493, in
                   processCreateRequest
                       if not (nres := Factory.resourceFromDict(deepcopy(request.pc),
                   pi=parentResource.ri, ty=ty)).resource:      # something wrong, perhaps wrong type
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/Factory.py", line 208, in
                   resourceFromDict
                       return Result(status = True, rsc = RC.OK, resource = factory[1](resDict, tpe, pi,
                   create))
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/Factory.py", line 98, in
                   <lambda>
                       T.FCNT                      : (FCNT,                lambda dct, tpe, pi, create :
                   FCNT(dct, pi = pi, fcntType = tpe, create = create)),
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/FCNT.py", line 66, in __init__
                       super().__init__(T.FCNT, dct, pi, tpe = fcntType, create = create)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/AnnounceableResource.py", line
                   21, in __init__
                       super().__init__(ty, dct, pi, tpe = tpe, create = create, inheritACP =
                   inheritACP, readOnly = readOnly, rn = rn,)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/resources/Resource.py", line 107, in
                   __init__
                       self.setAttribute('ri', Utils.uniqueRI(self.tpe), overwrite = False)
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/etc/Utils.py", line 39, in uniqueRI
                       return f'{noNamespace(prefix)}{uniqueID()}'
                     File "/home/ec2-user/ACME-oneM2M-CSE/acme/etc/Utils.py", line 110, in noNamespace
                       _, found, tail = id.partition(':')
                   AttributeError: 'NoneType' object has no attribute 'partition'

Following this trace I found a section of code in resources/Resource.py that seems to be the root cause of this error.
On line 90 of Resource.py, the self.tpe assignment is skipped if the resource being created is a FlexContainer:

if ty not in [ T.FCNT, T.FCI ]:
self.tpe = ty.tpe() if not tpe else tpe

Later in the same function, a resourceID is assigned using self.tpe:

if not self.hasAttribute('ri'):
self.setAttribute('ri', Utils.uniqueRI(self.tpe), overwrite = False)

Because self.tpe was never set, this results in the NoneType object has no attribute 'partition'

Is this expected behavior? Am I allowed to request the creation of a FlexContainer without giving a resourceID in my request?
Or do I have to specify the resourceID in the request?

Thanks!

incorrect rcn response types

i believe the handling of rcn response types is wrong.

for example, ts-0004 table 7.5.2-2 lists R/6 as returning an m2m:resourceRefList, whereas this code returns an m2m:URIList.

also, this code doesn't return anything for rcn=6 unless fu=1 is passed.

oneM2M Cross Origin Requests

Hi Andreas,

I have a feeling that Bob Flynn has already mentioned this to you, but I am current developing a React JS single page application (SPA) that requests data from the ACME CSE.

The problem with this approach that I am taking is that the SPA has to be hosted on a different IP (and/or port number) than the ACME CSE. This means that when the JavaScript code in the SPA makes an XHR/AJAX/HTTP request to the ACME CSE, the user's web browser will block the response if the ACME CSE does not specifically allow the Cross Origin Request.

For now, I've created a very bad workout one my own fork and branch: https://github.com/ExpandingDev/ACME-oneM2M-CSE/tree/cors-shim
The changes I make in there do two things:

  1. Adds flask-cors as a dependency
  2. Uses the flask cors to enable CORS requests from ALL origins. This is a security vulnerability.

I am aware that the way I am getting around these CORS problems is a hack and should not be used in the mainstream ACME CSE/oneM2M.

To me, the ideal solution would be something like this:

  1. Allow oneM2M to treat the Origin header as the same as the X-M2M-Origin header
  2. Ignore the X-M2M-Origin header if the plain Origin header is present
  3. Reply with Access-Control-Allow-Origin only if the Origin in the response matches with an originator specified in an ACP

I don't fully know if this would be a secure approach, I would be then concerned about attackers registering a domain name to match the originator present in an ACP in order to get their payload through.

Subscription notification using MQTT wrong receiver in topic and 'to'

Hi,

I found that when POA of AE is using MQTT, CSE notify to the wrong receiver. What i expect is when new contentInstance under container control-glass created, i get notification since i already create subscription resource under the container.

AE attributes

{
    "m2m:ae": {
        "acpi": [
            "acp1994839229681685407"
        ],
        "api": "NCGlass",
        "rr": true,
        "poa": [
            "mqtt://localhost:1883"
        ],
        "srv": [
            "3"
        ],
        "rn": "CGlass",
        "ri": "CGlass",
        "pi": "id-asn",
        "ct": "20230120T082858,465351",
        "lt": "20230120T192335,443259",
        "et": "20280119T082858,465402",
        "ty": 2,
        "aei": "CGlass"
    }
}

Container attributes

{
    "m2m:cnt": {
        "acpi": [
            "acp1994839229681685407"
        ],
        "mbs": 10000,
        "mni": 10,
        "rn": "control-glass",
        "ri": "cnt3472203593848019878",
        "pi": "CGlass",
        "ct": "20230120T093353,618096",
        "lt": "20230120T093353,618096",
        "et": "20280119T093353,618155",
        "ty": 3,
        "cni": 10,
        "cbs": 62,
        "st": 29
    }
}

Subscription attributes

{
    "m2m:sub": {
        "acpi": [
            "acp1994839229681685407"
        ],
        "enc": {
            "net": [
                1,
                2,
                3,
                4
            ]
        },
        "nu": [
            "/id-asn/cse-asn/CGlass"
        ],
        "rn": "sub-control-glass",
        "ri": "sub8641760446866483662",
        "pi": "cnt3472203593848019878",
        "ct": "20230120T094106,999444",
        "lt": "20230122T095921,074178",
        "et": "20280119T094106,999529",
        "ty": 23,
        "nct": 1
    }
}

CSE log debug

HTCR_10634 - ==> HTTP Request: cnt3472203593848019878                                                                                                                 HttpServer.py:205
           DEBUG   HTCR_10634 - Operation: CREATE                                                                                                                                        HttpServer.py:206
           DEBUG   HTCR_10634 - Headers:                                                                                                                                                 HttpServer.py:207
                   Host: localhost:8082
                   Connection: keep-alive
                   Content-Length: 49
                   Sec-Ch-Ua: "Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"
                   Sec-Ch-Ua-Mobile: ?0
                   User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
                   X-M2M-Ri: fivh17hl7bp
                   Content-Type: application/json;ty=4
                   Accept: application/json
                   X-M2M-Origin: CAdmin
                   X-M2M-Rvi: 3
                   Sec-Ch-Ua-Platform: "macOS"
                   Origin: http://localhost:8082
                   Sec-Fetch-Site: same-origin
                   Sec-Fetch-Mode: cors
                   Sec-Fetch-Dest: empty
                   Referer: http://localhost:8082/webui/index.html?ri=id-asn&or=CAdmin
                   Accept-Encoding: gzip, deflate, br
                   Accept-Language: en-US,en;q=0.9
           DEBUG   HTCR_10634 - Body:                                                                                                                                                    HttpServer.py:213
                   b'{\n    "m2m:cin": {\n        "con": "halow"\n    }\n}'
           DEBUG   HTCR_10634 - CREATE ID: cnt3472203593848019878, originator: CAdmin                                                                                                RequestManager.py:204
           DEBUG   HTCR_10634 - Process CREATE request for id: cnt3472203593848019878|None                                                                                               Dispatcher.py:519
           DEBUG   HTCR_10634 - Get parent resource and check permissions: cnt3472203593848019878                                                                                        Dispatcher.py:549
           DEBUG   HTCR_10634 - Retrieve local resource: cnt3472203593848019878|None for originator: None                                                                                Dispatcher.py:281
           DEBUG   HTCR_10634 - Request from CSE Originator. OK.                                                                                                                     SecurityManager.py:91
           DEBUG   HTCR_10634 - CREATING resource ri: cin486656427157705761, type: 4                                                                                                     Dispatcher.py:676
           DEBUG   HTCR_10634 - Parent ri: cnt3472203593848019878                                                                                                                        Dispatcher.py:679
           DEBUG   HTCR_10634 - Activating resource: cin486656427157705761                                                                                                                 Resource.py:213
           DEBUG   HTCR_10634 - Validating attributes                                                                                                                                      Validator.py:89
           DEBUG   HTCR_10634 - Validating resource: cin486656427157705761                                                                                                                 Resource.py:501
           DEBUG   HTCR_10634 - Child resource added: cin486656427157705761                                                                                                                     CNT.py:144
           DEBUG   HTCR_10634 - Checking subscriptions (createDirectChild) ri: cnt3472203593848019878                                                                           NotificationManager.py:231
           DEBUG   HTCR_10634 - Handling notification for notificationEventType: createDirectChild                                                                             NotificationManager.py:1016
           DEBUG   HTCR_10634 - Sending notification to: /id-asn/cse-asn/CGlass, reason: createDirectChild, asynchronous: True                                                 NotificationManager.py:1032
           DEBUG   NOT_sub864 - Sending NOTIFY request to: /id-asn/cse-asn/CGlass for Originator: /id-asn                                                                           RequestManager.py:1022
           DEBUG   NOT_sub864 - Retrieve local resource: None|cse-asn/CGlass for originator: None                                                                                        Dispatcher.py:281
           DEBUG   HTCR_10634 - Retrieve local resource: sub8641760446866483662|None for originator: None                                                                                                                                                                                                               MQTTClient.py:402
           DEBUG   NOT_sub864 - MQTT connection already created: localhost:1883                                                                                                          MQTTClient.py:463
           DEBUG   NOT_sub864 - MQTT Request ==>: /oneM2M/req/id-asn/id-asn/json                                                                                                         MQTTClient.py:574
                   Body: {'fr': '/id-asn', 'to': '/id-asn', 'ot': '20230122T093701,431237', 'op': 5, 'rqi': '2569162440163804104', 'rvi': '3', 'pc': {'m2m:sgn': {'nev': {'rep':
                   {'m2m:cin': {'con': 'halow', 'ri': 'cin486656427157705761', 'pi': 'cnt3472203593848019878', 'rn': 'cin_VFqh0lCERH', 'ct': '20230122T093701,391742', 'lt':
                   '20230122T093701,391742', 'et': '20280121T093701,391785', 'ty': 4, 'cs': 5, 'st': 24}}, 'net': createDirectChild}, 'sur': '/id-asn/sub8641760446866483662'}}}
           DEBUG   HTCR_10634 - Validating resource: cnt3472203593848019878                                                                                                                Resource.py:501
           DEBUG   HTCR_10634 - cni > mni: Removing <cin>: cin3449333533774497151                                                                                                               CNT.py:204
           DEBUG   MQTTClient - Starting actor: mid_336.153848849                                                                                                                   BackgroundWorker.py:86
           DEBUG   HTCR_10634 - Removing resource ri: cin3449333533774497151, type: 4                                                                                                    Dispatcher.py:993
           DEBUG   None       - ==> MQTT Request: /oneM2M/req/id-asn/id-asn/json                                                                                                         MQTTClient.py:166
           DEBUG   None       - Operation: NOTIFY                                                                                                                                        MQTTClient.py:158
           DEBUG   None       - Body:                                                                                                                                                    MQTTClient.py:160
                   {"fr": "/id-asn", "to": "/id-asn", "ot": "20230122T093701,431237", "op": 5, "rqi": "2569162440163804104", "rvi": "3", "pc": {"m2m:sgn": {"nev": {"rep": {"m2m:cin":
                   {"con": "halow", "ri": "cin486656427157705761", "pi": "cnt3472203593848019878", "rn": "cin_VFqh0lCERH", "ct": "20230122T093701,391742", "lt":
                   "20230122T093701,391742", "et": "20280121T093701,391785", "ty": 4, "cs": 5, "st": 24}}, "net": 3}, "sur": "/id-asn/sub8641760446866483662"}}}
           DEBUG   HTCR_10634 - Deactivating and removing sub-resources for: cin3449333533774497151                                                                                        Resource.py:255
           DEBUG   None       - <== MQTT Response (badRequest): /oneM2M/resp/id-asn/id-asn/json                                                                                          MQTTClient.py:574
                   Body: {'fr': '/id-asn', 'to': '/id-asn', 'rsc': 4000, 'op': 5, 'rqi': '2569162440163804104', 'rvi': '3', 'pc': {'m2m:dbg': 'ID too short. Must be
                   /<cseid>/<structured|unstructured>.'}}

And when i see in sendMqttRequest "to" parameter haven't been used and when build request topic, it use originator as mqtt topic receiver path.

Or maybe i am doing something wrong since i am new in oneM2M. Thank you!

dynamic updates interrupt UI

development:

it looks like there's some kind of dynamic updates going on which causes the 'Resource ID/URL' input box to get overwritten, in the middle of typing...

development branch: error on startup

$ python3 acme.py 
ACME 0.4.0-pre - An open source CSE Middleware for Education
[10:54:24] INFO     2891 - ============                                                                                                                                                CSE.py:85
           INFO     2891 - Starting CSE                                                                                                                                                CSE.py:86
           INFO     2891 - CSE-Type: IN                                                                                                                                                CSE.py:87
           INFO     2891 - Configuration:                                                                                                                                              CSE.py:88
                      configfile = acme.ini                                                                                                                                                     
                      http.listenIF = 127.0.0.1                                                                                                                                                 
                      http.port = 8080                                                                                                                                                          
                      http.root =                                                                                                                                                               
                      http.address = http://127.0.0.1:8080                                                                                                                                      
                      http.multiThread = True                                                                                                                                                   
                      db.path = ./data                                                                                                                                                          
                      db.inMemory = False                                                                                                                                                       
                      db.cacheSize = 0                                                                                                                                                          
                      db.resetAtStartup = False                                                                                                                                                 
                      logging.enable = True                                                                                                                                                     
                      logging.enableFileLogging = True                                                                                                                                          
                      logging.file = ./logs/cse.log                                                                                                                                             
                      logging.level = 10                                                                                                                                                        
                      logging.size = 100000                                                                                                                                                     
                      logging.count = 10                                                                                                                                                        
                      cse.type = 1                                                                                                                                                              
                      cse.spid = acme                                                                                                                                                           
                      cse.csi = /id-in                                                                                                                                                          
                      cse.ri = id-in                                                                                                                                                            
                      cse.rn = cse-in                                                                                                                                                           
                      cse.resourcesPath = ./init                                                                                                                                                
                      cse.expirationDelta = 31536000                                                                                                                                            
                      cse.enableACPChecks = True                                                                                                                                                
                      cse.adminACPI = acpAdmin                                                                                                                                                  
                      cse.defaultACPI = acpDefault                                                                                                                                              
                      cse.originator = CAdmin                                                                                                                                                   
                      cse.enableApplications = True                                                                                                                                             
                      cse.enableNotifications = True                                                                                                                                            
                      cse.enableRemoteCSE = True                                                                                                                                                
                      cse.enableTransitRequests = True                                                                                                                                          
                      cse.sortDiscoveredResources = True                                                                                                                                        
                      cse.checkExpirationsInterval = 60                                                                                                                                         
                      cse.remote.address = http://127.0.0.1:8081                                                                                                                                
                      cse.remote.root =                                                                                                                                                         
                      cse.remote.csi = /in-cse                                                                                                                                                  
                      cse.remote.rn = cse-in                                                                                                                                                    
                      cse.remote.checkInterval = 30                                                                                                                                             
                      cse.registration.allowedAEOriginators = ['C.*', 'S.*']                                                                                                                    
                      cse.registration.allowedCSROriginators = ['id-mn']                                                                                                                        
                      cse.statistics.writeIntervall = 60                                                                                                                                        
                      cse.cnt.mni = 10                                                                                                                                                          
                      cse.cnt.mbs = 10000                                                                                                                                                       
                      cse.acp.pv.acop = 63                                                                                                                                                      
                      cse.acp.pvs.acop = 51                                                                                                                                                     
                      cse.acp.addAdminOrignator = True                                                                                                                                          
                      cse.webui.enable = True                                                                                                                                                   
                      cse.webui.root = /webui                                                                                                                                                   
                      app.statistics.enable = True                                                                                                                                              
                      app.statistics.aeRN = statistics                                                                                                                                          
                      app.statistics.aeAPI = ae-statistics                                                                                                                                      
                      app.statistics.fcntRN = statistics                                                                                                                                        
                      app.statistics.fcntCND = acme.statistics                                                                                                                                  
                      app.statistics.fcntType = acme:csest                                                                                                                                      
                      app.statistics.originator = C                                                                                                                                             
                      app.statistics.intervall = 10                                                                                                                                             
                      app.csenode.enable = True                                                                                                                                                 
                      app.csenode.nodeRN = cse-node                                                                                                                                             
                      app.csenode.nodeID = cse-node                                                                                                                                             
                      app.csenode.originator = CAdmin                                                                                                                                           
                      app.csenode.batteryLowLevel = 20                                                                                                                                          
                      app.csenode.batteryChargedLevel = 100                                                                                                                                     
                      app.csenode.intervall = 60                                                                                                                                                
                      server.http.mappings = [('/access/v1/devices', '/cse-mn?ty=14&fu=1&fo=2&rcn=8'), ('/access/v1/apps', '/id-mn?ty=2&fu=1&fo=2&rcn=8'),                                      
                    ('/access/v1/devices/battery', '/id-mn?ty=14&mgd=1006&fu=1&fo=2&rcn=8')]                                                                                                    
           INFO     2891 - Using data directory: ./data                                                                                                                            Storage.py:36
           INFO     2891 - Cache Size: 0                                                                                                                                          Storage.py:460
           INFO     2891 - DB in file system                                                                                                                                      Storage.py:483
[10:54:25] INFO     2891 - Starting expiration worker                                                                                                                              Storage.py:50
           DEBUG    2891 - Starting worker thread: expirationDBWorker                                                                                                     BackgroundWorker.py:24
           DEBUG    2893 - Looking for expired resources                                                                                                                          Storage.py:291
           INFO     2891 - Storage initialized                                                                                                                                     Storage.py:55
           INFO     2891 - EventManager initialized                                                                                                                           EventManager.py:33
           INFO     2891 - Starting statistics DB thread                                                                                                                        Statistics.py:43
           DEBUG    2891 - Starting worker thread: statisticsDBWorker                                                                                                     BackgroundWorker.py:24
           DEBUG    2894 - Writing statistics DB                                                                                                                               Statistics.py:153
           INFO     2891 - Statistics initialized                                                                                                                               Statistics.py:58
           INFO     2891 - RegistrationManager initialized                                                                                                             RegistrationManager.py:20
           INFO     2891 - Validator initialized                                                                                                                                Validator.py:130
           INFO     2891 - Dispatcher initialized                                                                                                                               Dispatcher.py:30
           INFO     2891 - SecurityManager initialized                                                                                                                     SecurityManager.py:26
           INFO     2891 - ACP checking ENABLED                                                                                                                            SecurityManager.py:28
           INFO     2891 - Registering http server root at:                                                                                                                     HttpServer.py:33
           INFO     2891 - Registering web ui at: /webui, serving from /home/me/ACME-oneM2M-CSE/webui                                                                       HttpServer.py:53
           INFO     2891 - Registering mapping: /access/v1/devices -> /cse-mn?ty=14&fu=1&fo=2&rcn=8                                                                             HttpServer.py:64
           INFO     2891 - Registering mapping: /access/v1/apps -> /id-mn?ty=2&fu=1&fo=2&rcn=8                                                                                  HttpServer.py:64
           INFO     2891 - Registering mapping: /access/v1/devices/battery -> /id-mn?ty=14&mgd=1006&fu=1&fo=2&rcn=8                                                             HttpServer.py:64
           INFO     2891 - NotificationManager initialized                                                                                                             NotificationManager.py:25
           INFO     2891 - Notifications ENABLED                                                                                                                       NotificationManager.py:27
           INFO     2891 - AnnouncementManager initialized                                                                                                             AnnouncementManager.py:23
           INFO     2891 - GroupManager initialized                                                                                                                           GroupManager.py:22
           INFO     2891 - Importer initialized                                                                                                                                   Importer.py:26
           INFO     2891 - Resources already imported, skipping importing                                                                                                         Importer.py:33
           INFO     2891 - RemoteCSEManager initialized                                                                                                                   RemoteCSEManager.py:37
           INFO     2891 - Starting remote CSE connection monitor                                                                                                         RemoteCSEManager.py:53
           DEBUG    2891 - Starting worker thread: remoteConnectionMonitor                                                                                                BackgroundWorker.py:24
           DEBUG    2895 - Checking connections to remote CSEs                                                                                                           RemoteCSEManager.py:110
           INFO     2891 - CSE started                                                                                                                                                CSE.py:138
 * Serving Flask app "/id-in" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
           INFO     2891 -  * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)                                                                                           serving.py:1008
[10:54:30] INFO     2896 - Starting Apps                                                                                                                                              CSE.py:186
           DEBUG    2896 - Sending request: GET http://127.0.0.1:8080/cse-in/cse-node                                                                                          HttpServer.py:212
           DEBUG    2905 - ==> Retrieve: /cse-in/cse-node                                                                                                                      HttpServer.py:106
           DEBUG    2905 - Headers:                                                                                                                                            HttpServer.py:107
                    Host: 127.0.0.1:8080                                                                                                                                                        
                    User-Agent: python-requests/2.22.0                                                                                                                                          
                    Accept-Encoding: gzip, deflate                                                                                                                                              
                    Accept: */*                                                                                                                                                                 
                    Connection: keep-alive                                                                                                                                                      
                    Content-Type: application/json                                                                                                                                              
                    X-M2M-Origin: CAdmin                                                                                                                                                        
                    X-M2M-Ri: 5723590890982054697                                                                                                                                               
                    X-M2M-Rvi: 3                                                                                                                                                                
                                                                                                                                                                                                
           DEBUG    2905 - RETRIEVE ID: nod2999269730016567733, originator: CAdmin                                                                                              Dispatcher.py:49
           DEBUG    2905 - Handle retrieve resource: nod2999269730016567733                                                                                                     Dispatcher.py:69
           DEBUG    2905 - Get resource: nod2999269730016567733                                                                                                                Dispatcher.py:129
           DEBUG    2905 - Retrieve resource: nod2999269730016567733                                                                                                           Dispatcher.py:172
           DEBUG    2905 - Checking permission for originator: CAdmin, ri: nod2999269730016567733, permission: 2, selfPrivileges: False                                    SecurityManager.py:66
           DEBUG    2905 - Retrieve resource: acpDefault                                                                                                                       Dispatcher.py:172
           ERROR    2905 - Exception on /cse-in/cse-node [GET]                                                                                                                       app.py:2450
                    Traceback (most recent call last):                                                                                                                                          
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app                                                                               
                        response = self.full_dispatch_request()                                                                                                                                 
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request                                                                  
                        rv = self.handle_user_exception(e)                                                                                                                                      
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception                                                                  
                        reraise(exc_type, exc_value, tb)                                                                                                                                        
                      File "/home/me/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise                                                                              
                        raise value                                                                                                                                                             
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request                                                                  
                        rv = self.dispatch_request()                                                                                                                                            
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request                                                                       
                        return self.view_functions[rule.endpoint](**req.view_args)                                                                                                              
                      File "acme/HttpServer.py", line 109, in handleGET                                                                                                                         
                        (resource, rc) = CSE.dispatcher.retrieveRequest(request, Utils.retrieveIDFromPath(path, self.csern, self.cseri))                                                        
                      File "acme/Dispatcher.py", line 65, in retrieveRequest                                                                                                                    
                        return self.handleRetrieveRequest(request, id, originator)                                                                                                              
                      File "acme/Dispatcher.py", line 133, in handleRetrieveRequest                                                                                                             
                        if not CSE.security.hasAccess(originator, resource, C.permRETRIEVE):                                                                                                    
                      File "acme/SecurityManager.py", line 117, in hasAccess                                                                                                                    
                        if acp.checkPermission(originator, requestedPermission):                                                                                                                
                      File "acme/resources/ACP.py", line 92, in checkPermission                                                                                                                 
                        if requestedPermission & p['acop'] == 0:    # permission not fitting at all                                                                                             
                    TypeError: string indices must be integers                                                                                                                                  
           DEBUG    2905 - "GET /cse-in/cse-node HTTP/1.1" - 500                                                                                                               HttpServer.py:298
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "acme/EventManager.py", line 107, in _callThread
    function(*args, **kwargs)
  File "acme/CSE.py", line 191, in startApps
    aeCSENode = CSENode()
  File "apps/CSENode.py", line 21, in __init__
    super().__init__(rn=Configuration.get('app.csenode.nodeRN'),
  File "apps/NodeBase.py", line 33, in __init__
    self.node = self.retrieveCreate(srn=self.srn,
  File "apps/AppBase.py", line 68, in retrieveCreate
    if (result := self.retrieveResource(srn=srn))[1] != C.rcOK:
  File "apps/AppBase.py", line 42, in retrieveResource
    return CSE.httpServer.sendRetrieveRequest(self._id(ri, srn), self.originator)
  File "acme/HttpServer.py", line 190, in sendRetrieveRequest
    return self.sendRequest(requests.get, url, originator)
  File "acme/HttpServer.py", line 218, in sendRequest
    return (r.json() if len(r.content) > 0 else None, rc)
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

[ASK] Redundant value check on announceUpdatedResource()

Hi, hope you all well.

I wonder if it's on purpose to do this

announcedCSIs.append(csi)	# build a list of already announced CSIs
remoteRIs.append(csi) 		# build a list of remote RIs

remoteRIs append csi value too, and doing non-announced check to both list even with the same value.

# Check for any non-announced csi in at, and possibly announce them 
	for csi in CSIsFromAnnounceTo:
		if csi not in announcedCSIs and csi not in remoteRIs:
			self.announceResourceToCSI(resource, csi)

notificationserver.py error (https://github.com/oneM2M/onem2m-jupyter-notebooks/tree/master)


AttributeError Traceback (most recent call last)
File ~\Desktop\onem2m-jupyter-notebooks\tools\NotificationServer\NotificationServer.py:264, in
261 def exitAll() -> None:
262 os.kill(os.getpid(), signal.SIGUSR1)
--> 264 signal.signal(signal.SIGUSR1, exitSignalHandler)
266 if name == 'main':
267 console = Console()

AttributeError: module 'signal' has no attribute 'SIGUSR1'

'rcn=4' vs 'rcn=4&fu=1' differences

i believe there is an issue rendering attributes+child_resources responses, nesting of the resources in the response is different between retrieve and discovery, and i don't believe this is justified in the spec.

for example,

http://127.0.0.1:8081/id-in?rc=4 returns

{
    "m2m:cb": {
        "ri": "id-in",
        "ty": 5,
        "rn": "cse-in",
        "csi": "/id-in",
        "acpi": [
            "acpAdmin"
        ],
        "ct": "20200609T200331,388077",
        "lt": "20200609T202105,236548",
        "et": "20210609T200331,388176",
        "pi": "",
        "rr": false,
        "srt": [
            1,
            2,
            3,
            4,
            5,
            9,
            13,
            14,
            16,
            23,
            28,
            52
        ],
        "csz": [
            "application/json"
        ],
        "srv": [
            "3"
        ],
        "poa": [
            "http://127.0.0.1:8080"
        ],
        "cst": 1,
        "nl": "nod861042590844046387",
        "m2m:acp": [
            {
                "ri": "acp1028273287565921797",
                "rn": "acp_statistics",
                "ct": "20200609T200338,574776",
                "lt": "20200609T200338,574776",
                "et": "20210609T200338,574845",
                "pi": "id-in",
                "ty": 1,
                "pv": {
                    "acr": [
                        {
                            "acop": 63,
                            "acor": [
                                "CAdmin",
                                "CX677vJit2W"
                            ]
                        }
                    ]
                },
                "pvs": {
                    "acr": [
                        {
                            "acop": 51,
                            "acor": [
                                "CAdmin"
                            ]
                        }
                    ]
                }
            },
            {
                "ty": 1,
                "ri": "acpAdmin",
                "rn": "adminACP",
                "pi": "id-in",
                "pv": {
                    "acr": [
                        {
                            "acor": [
                                "CAdmin"
                            ],
                            "acop": 63
                        }
                    ]
                },
                "pvs": {
                    "acr": [
                        {
                            "acor": [
                                "CAdmin"
                            ],
                            "acop": 55
                        }
                    ]
                },
                "ct": "20200609T200331,455044",
                "lt": "20200609T200331,455044",
                "et": "20210609T200331,455162"
            },
            {
                "ty": 1,
                "ri": "acpDefault",
                "rn": "defaultACP",
                "pi": "id-in",
                "pv": {
                    "acr": [
                        {
                            "acor": [
                                "CDefault",
                                "CAdmin"
                            ],
                            "acop": 63
                        }
                    ]
                },
                "pvs": {
                    "acr": [
                        {
                            "acor": [
                                "CAdmin"
                            ],
                            "acop": 55
                        }
                    ]
                },
                "ct": "20200609T200331,513529",
                "lt": "20200609T200331,513529",
                "et": "20210609T200331,513600"
            }
        ],
        "m2m:ae": [
            {
                "rn": "statistics",
                "api": "ae-statistics",
                "nl": "nod861042590844046387",
                "poa": [
                    "http://127.0.0.1:8080"
                ],
                "rr": true,
                "srv": [
                    "3",
                    "4"
                ],
                "ri": "CX677vJit2W",
                "ct": "20200609T200338,558810",
                "lt": "20200609T200338,558810",
                "et": "20210609T200338,558877",
                "pi": "id-in",
                "ty": 2,
                "aei": "CX677vJit2W",
                "acpi": [
                    "acp1028273287565921797"
                ],
                "acme:csest": [
                    {
                        "rn": "statistics",
                        "cnd": "acme.statistics",
                        "acpi": [
                            "acp1028273287565921797"
                        ],
                        "mni": 10,
                        "rmRes": 4984,
                        "crRes": 5003,
                        "htRet": 2251,
                        "htCre": 6,
                        "htUpd": 5114,
                        "htDel": 0,
                        "lgErr": 4,
                        "lgWrn": 9540,
                        "cseSU": "20200708T005406,868457",
                        "cseUT": "0:31:12",
                        "ctRes": 19,
                        "ri": "csest2319516495356652035",
                        "ct": "20200609T200338,971435",
                        "lt": "20200707T182519,810517",
                        "et": "20210609T200338,971524",
                        "pi": "CX677vJit2W",
                        "st": 5006,
                        "ty": 28,
                        "cs": 375,
                        "cr": "CX677vJit2W",
                        "cni": 10,
                        "acme:csest": [
                            {
                                "rn": "statistics_4997",
                                "rmRes": 4975,
                                "crRes": 4994,
                                "htRet": 2212,
                                "htCre": 6,
                                "htUpd": 5099,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:29:41",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest1794142844999499776",
                                "ct": "20200707T182348,711692",
                                "lt": "20200707T182348,711692",
                                "et": "20210707T182348,711708",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_4998",
                                "rmRes": 4976,
                                "crRes": 4995,
                                "htRet": 2213,
                                "htCre": 6,
                                "htUpd": 5100,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:29:51",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest3357060219620329572",
                                "ct": "20200707T182358,823487",
                                "lt": "20200707T182358,823487",
                                "et": "20210707T182358,823501",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_4999",
                                "rmRes": 4977,
                                "crRes": 4996,
                                "htRet": 2213,
                                "htCre": 6,
                                "htUpd": 5101,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:02",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest4226788739776195818",
                                "ct": "20200707T182408,912666",
                                "lt": "20200707T182408,912666",
                                "et": "20210707T182408,912689",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5000",
                                "rmRes": 4978,
                                "crRes": 4997,
                                "htRet": 2213,
                                "htCre": 6,
                                "htUpd": 5105,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:12",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest2267622056735906608",
                                "ct": "20200707T182419,035917",
                                "lt": "20200707T182419,035917",
                                "et": "20210707T182419,035934",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5001",
                                "rmRes": 4979,
                                "crRes": 4998,
                                "htRet": 2231,
                                "htCre": 6,
                                "htUpd": 5106,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:22",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest7183147931901019038",
                                "ct": "20200707T182429,156655",
                                "lt": "20200707T182429,156655",
                                "et": "20210707T182429,156672",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5002",
                                "rmRes": 4980,
                                "crRes": 4999,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5107,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:32",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest7061487257687262039",
                                "ct": "20200707T182439,240053",
                                "lt": "20200707T182439,240053",
                                "et": "20210707T182439,240067",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5003",
                                "rmRes": 4981,
                                "crRes": 5000,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5108,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:42",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest8803525397679550584",
                                "ct": "20200707T182449,360863",
                                "lt": "20200707T182449,360863",
                                "et": "20210707T182449,360893",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5004",
                                "rmRes": 4982,
                                "crRes": 5001,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5109,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:52",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest4214835427562517289",
                                "ct": "20200707T182459,466163",
                                "lt": "20200707T182459,466163",
                                "et": "20210707T182459,466188",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5005",
                                "rmRes": 4983,
                                "crRes": 5002,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5110,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:31:02",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest2570218605739078081",
                                "ct": "20200707T182509,546456",
                                "lt": "20200707T182509,546456",
                                "et": "20210707T182509,546470",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5006",
                                "rmRes": 4984,
                                "crRes": 5003,
                                "htRet": 2251,
                                "htCre": 6,
                                "htUpd": 5114,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:31:12",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest5796550581764529614",
                                "ct": "20200707T182519,813047",
                                "lt": "20200707T182519,813047",
                                "et": "20210707T182519,813074",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            }
                        ]
                    }
                ]
            }
        ],
        "m2m:nod": [
            {
                "rn": "cse-node",
                "ni": "cse-node",
                "ri": "nod861042590844046387",
                "ct": "20200609T200336,857603",
                "lt": "20200609T200338,706035",
                "et": "20210609T200336,857686",
                "pi": "id-in",
                "ty": 14,
                "acpi": [
                    "acpDefault"
                ],
                "hcl": "id-in",
                "hael": [
                    "CX677vJit2W"
                ],
                "m2m:bat": [
                    {
                        "mgd": 1006,
                        "dc": "battery",
                        "rn": "battery",
                        "btl": 0,
                        "bts": 6,
                        "ri": "bat2485569212438296813",
                        "ct": "20200609T200337,533813",
                        "lt": "20200707T182518,985643",
                        "et": "20210609T200337,533879",
                        "pi": "nod861042590844046387",
                        "ty": 13,
                        "acpi": [
                            "acpDefault"
                        ]
                    },
                    {
                        "mgd": 1007,
                        "dc": "deviceInfo",
                        "rn": "deviceinfo",
                        "dlb": "| IP:127.0.1.1 MAC:70:85:c2:d2:51:14",
                        "dvnm": "machine",
                        "osv": "Linux 4.4.0-19041-Microsoft x86_64",
                        "syst": "20200707T182519,021760",
                        "ri": "dvi8024400728351037531",
                        "ct": "20200609T200338,113010",
                        "lt": "20200707T182519,033519",
                        "et": "20210609T200338,113079",
                        "pi": "nod861042590844046387",
                        "ty": 13,
                        "dty": "unknown",
                        "mod": "unknown",
                        "man": "unknown",
                        "acpi": [
                            "acpDefault"
                        ]
                    },
                    {
                        "mgd": 1003,
                        "dc": "memory",
                        "rn": "memory",
                        "mma": 3261923328,
                        "mmt": 16819085312,
                        "ri": "mem9051650140950871829",
                        "ct": "20200609T200337,821163",
                        "lt": "20200707T182519,015745",
                        "et": "20210609T200337,821244",
                        "pi": "nod861042590844046387",
                        "ty": 13,
                        "acpi": [
                            "acpDefault"
                        ]
                    }
                ]
            }
        ]
    }
}

whereas http://127.0.0.1:8081/id-in?rc=4 returns

{
    "m2m:cb": {
        "ri": "id-in",
        "ty": 5,
        "rn": "cse-in",
        "csi": "/id-in",
        "acpi": [
            "acpAdmin"
        ],
        "ct": "20200609T200331,388077",
        "lt": "20200609T202105,236548",
        "et": "20210609T200331,388176",
        "pi": "",
        "rr": false,
        "srt": [
            1,
            2,
            3,
            4,
            5,
            9,
            13,
            14,
            16,
            23,
            28,
            52
        ],
        "csz": [
            "application/json"
        ],
        "srv": [
            "3"
        ],
        "poa": [
            "http://127.0.0.1:8080"
        ],
        "cst": 1,
        "nl": "nod861042590844046387",
        "m2m:acp": [
            {
                "ri": "acp1028273287565921797",
                "rn": "acp_statistics",
                "ct": "20200609T200338,574776",
                "lt": "20200609T200338,574776",
                "et": "20210609T200338,574845",
                "pi": "id-in",
                "ty": 1,
                "pv": {
                    "acr": [
                        {
                            "acop": 63,
                            "acor": [
                                "CAdmin",
                                "CX677vJit2W"
                            ]
                        }
                    ]
                },
                "pvs": {
                    "acr": [
                        {
                            "acop": 51,
                            "acor": [
                                "CAdmin"
                            ]
                        }
                    ]
                }
            },
            {
                "ty": 1,
                "ri": "acpAdmin",
                "rn": "adminACP",
                "pi": "id-in",
                "pv": {
                    "acr": [
                        {
                            "acor": [
                                "CAdmin"
                            ],
                            "acop": 63
                        }
                    ]
                },
                "pvs": {
                    "acr": [
                        {
                            "acor": [
                                "CAdmin"
                            ],
                            "acop": 55
                        }
                    ]
                },
                "ct": "20200609T200331,455044",
                "lt": "20200609T200331,455044",
                "et": "20210609T200331,455162"
            },
            {
                "ty": 1,
                "ri": "acpDefault",
                "rn": "defaultACP",
                "pi": "id-in",
                "pv": {
                    "acr": [
                        {
                            "acor": [
                                "CDefault",
                                "CAdmin"
                            ],
                            "acop": 63
                        }
                    ]
                },
                "pvs": {
                    "acr": [
                        {
                            "acor": [
                                "CAdmin"
                            ],
                            "acop": 55
                        }
                    ]
                },
                "ct": "20200609T200331,513529",
                "lt": "20200609T200331,513529",
                "et": "20210609T200331,513600"
            }
        ],
        "m2m:ae": [
            {
                "rn": "statistics",
                "api": "ae-statistics",
                "nl": "nod861042590844046387",
                "poa": [
                    "http://127.0.0.1:8080"
                ],
                "rr": true,
                "srv": [
                    "3",
                    "4"
                ],
                "ri": "CX677vJit2W",
                "ct": "20200609T200338,558810",
                "lt": "20200609T200338,558810",
                "et": "20210609T200338,558877",
                "pi": "id-in",
                "ty": 2,
                "aei": "CX677vJit2W",
                "acpi": [
                    "acp1028273287565921797"
                ],
                "acme:csest": [
                    {
                        "rn": "statistics",
                        "cnd": "acme.statistics",
                        "acpi": [
                            "acp1028273287565921797"
                        ],
                        "mni": 10,
                        "rmRes": 4984,
                        "crRes": 5003,
                        "htRet": 2251,
                        "htCre": 6,
                        "htUpd": 5114,
                        "htDel": 0,
                        "lgErr": 4,
                        "lgWrn": 9540,
                        "cseSU": "20200708T005406,868457",
                        "cseUT": "0:31:12",
                        "ctRes": 19,
                        "ri": "csest2319516495356652035",
                        "ct": "20200609T200338,971435",
                        "lt": "20200707T182519,810517",
                        "et": "20210609T200338,971524",
                        "pi": "CX677vJit2W",
                        "st": 5006,
                        "ty": 28,
                        "cs": 375,
                        "cr": "CX677vJit2W",
                        "cni": 10,
                        "acme:csest": [
                            {
                                "rn": "statistics_4997",
                                "rmRes": 4975,
                                "crRes": 4994,
                                "htRet": 2212,
                                "htCre": 6,
                                "htUpd": 5099,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:29:41",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest1794142844999499776",
                                "ct": "20200707T182348,711692",
                                "lt": "20200707T182348,711692",
                                "et": "20210707T182348,711708",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_4998",
                                "rmRes": 4976,
                                "crRes": 4995,
                                "htRet": 2213,
                                "htCre": 6,
                                "htUpd": 5100,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:29:51",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest3357060219620329572",
                                "ct": "20200707T182358,823487",
                                "lt": "20200707T182358,823487",
                                "et": "20210707T182358,823501",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_4999",
                                "rmRes": 4977,
                                "crRes": 4996,
                                "htRet": 2213,
                                "htCre": 6,
                                "htUpd": 5101,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:02",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest4226788739776195818",
                                "ct": "20200707T182408,912666",
                                "lt": "20200707T182408,912666",
                                "et": "20210707T182408,912689",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5000",
                                "rmRes": 4978,
                                "crRes": 4997,
                                "htRet": 2213,
                                "htCre": 6,
                                "htUpd": 5105,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:12",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest2267622056735906608",
                                "ct": "20200707T182419,035917",
                                "lt": "20200707T182419,035917",
                                "et": "20210707T182419,035934",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5001",
                                "rmRes": 4979,
                                "crRes": 4998,
                                "htRet": 2231,
                                "htCre": 6,
                                "htUpd": 5106,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:22",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest7183147931901019038",
                                "ct": "20200707T182429,156655",
                                "lt": "20200707T182429,156655",
                                "et": "20210707T182429,156672",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5002",
                                "rmRes": 4980,
                                "crRes": 4999,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5107,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:32",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest7061487257687262039",
                                "ct": "20200707T182439,240053",
                                "lt": "20200707T182439,240053",
                                "et": "20210707T182439,240067",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5003",
                                "rmRes": 4981,
                                "crRes": 5000,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5108,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:42",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest8803525397679550584",
                                "ct": "20200707T182449,360863",
                                "lt": "20200707T182449,360863",
                                "et": "20210707T182449,360893",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5004",
                                "rmRes": 4982,
                                "crRes": 5001,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5109,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:30:52",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest4214835427562517289",
                                "ct": "20200707T182459,466163",
                                "lt": "20200707T182459,466163",
                                "et": "20210707T182459,466188",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5005",
                                "rmRes": 4983,
                                "crRes": 5002,
                                "htRet": 2249,
                                "htCre": 6,
                                "htUpd": 5110,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:31:02",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest2570218605739078081",
                                "ct": "20200707T182509,546456",
                                "lt": "20200707T182509,546456",
                                "et": "20210707T182509,546470",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            },
                            {
                                "rn": "statistics_5006",
                                "rmRes": 4984,
                                "crRes": 5003,
                                "htRet": 2251,
                                "htCre": 6,
                                "htUpd": 5114,
                                "htDel": 0,
                                "lgErr": 4,
                                "lgWrn": 9540,
                                "cseSU": "20200708T005406,868457",
                                "cseUT": "0:31:12",
                                "ctRes": 19,
                                "acpi": [
                                    "acp1028273287565921797"
                                ],
                                "ri": "csest5796550581764529614",
                                "ct": "20200707T182519,813047",
                                "lt": "20200707T182519,813047",
                                "et": "20210707T182519,813074",
                                "pi": "csest2319516495356652035",
                                "st": 0,
                                "ty": 52,
                                "cs": 375
                            }
                        ]
                    }
                ]
            }
        ],
        "m2m:bat": [
            {
                "mgd": 1006,
                "dc": "battery",
                "rn": "battery",
                "btl": 0,
                "bts": 6,
                "ri": "bat2485569212438296813",
                "ct": "20200609T200337,533813",
                "lt": "20200707T182518,985643",
                "et": "20210609T200337,533879",
                "pi": "nod861042590844046387",
                "ty": 13,
                "acpi": [
                    "acpDefault"
                ]
            },
            {
                "mgd": 1007,
                "dc": "deviceInfo",
                "rn": "deviceinfo",
                "dlb": "| IP:127.0.1.1 MAC:70:85:c2:d2:51:14",
                "dvnm": "machine",
                "osv": "Linux 4.4.0-19041-Microsoft x86_64",
                "syst": "20200707T182519,021760",
                "ri": "dvi8024400728351037531",
                "ct": "20200609T200338,113010",
                "lt": "20200707T182519,033519",
                "et": "20210609T200338,113079",
                "pi": "nod861042590844046387",
                "ty": 13,
                "dty": "unknown",
                "mod": "unknown",
                "man": "unknown",
                "acpi": [
                    "acpDefault"
                ]
            },
            {
                "mgd": 1003,
                "dc": "memory",
                "rn": "memory",
                "mma": 3261923328,
                "mmt": 16819085312,
                "ri": "mem9051650140950871829",
                "ct": "20200609T200337,821163",
                "lt": "20200707T182519,015745",
                "et": "20210609T200337,821244",
                "pi": "nod861042590844046387",
                "ty": 13,
                "acpi": [
                    "acpDefault"
                ]
            }
        ],
        "m2m:nod": [
            {
                "rn": "cse-node",
                "ni": "cse-node",
                "ri": "nod861042590844046387",
                "ct": "20200609T200336,857603",
                "lt": "20200609T200338,706035",
                "et": "20210609T200336,857686",
                "pi": "id-in",
                "ty": 14,
                "acpi": [
                    "acpDefault"
                ],
                "hcl": "id-in",
                "hael": [
                    "CX677vJit2W"
                ]
            }
        ]
    }
}

diff these and you'll see that in the fu=1 response the tree is flattened. i believe this is a bug.

'limit' and 'direct child resource'

TS-0001, 8.1.2:

The offset, maximum number/size and maximum level shall be specified in Filter Criteria as offset, limit, and level condition, respectively, by the Originator. Processing of direct child resources, size limitations, maximum nesting level, and offset for the starting of direct child resource processing of the attributes+child-resources option shall apply to this option as well.

I'm not really sure what "direct child resources" means here, as it's never clearly defined in the spec, except maybe in TS-0004:

The level element of the Filter Criteria parameter does not represent a filter condition. It imposes a maximum limit on the depth of child resources in the resource tree that the Hosting CSE shall perform a Retrieve request upon. The level of 1 shall indicate the direct child resources."

However, the code here doesn't seem to act consistently wrt the limit parameter, for example the query /id-in?fu=1&rcn=8&ty=52&ty=28&lim=2 returns:

{
    "acme:csest": [
        {
            "rn": "statistics",
            "cnd": "acme.statistics",
            "acpi": [
                "acp1028273287565921797"
            ],
            "mni": 10,
            "rmRes": 634,
            "crRes": 653,
            "htRet": 1191,
            "htCre": 6,
            "htUpd": 644,
            "htDel": 0,
            "lgErr": 4,
            "lgWrn": 1290,
            "cseSU": "20200610T032059,778926",
            "cseUT": "1:46:01",
            "ctRes": 19,
            "ri": "csest2319516495356652035",
            "ct": "20200609T200338,971435",
            "lt": "20200609T220700,932786",
            "et": "20210609T200338,971524",
            "pi": "CX677vJit2W",
            "st": 651,
            "ty": 28,
            "cs": 375,
            "cr": "CX677vJit2W",
            "cni": 10,
            "acme:csest": [
                {
                    "rn": "statistics_642",
                    "ct": "20200609T220527,280788",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 625,
                    "crRes": 644,
                    "htRet": 1191,
                    "htCre": 6,
                    "htUpd": 635,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1272,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "1:44:27",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest4365045063646020904",
                    "lt": "20200609T220527,296168",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                }
            ]
        }
    ]
}

the lim=2 parameter here seems to be affecting the total number of children returned, not the number of "direct child resources"

the weird thing is that if i query /id-in?fu=1&rcn=8&ty=52&ty=28&lvl=1 instead i get no results, so it's not clear what the lvl parameter is applying to here, or what the "direct child resource" phrase really means.

multiple occurrance of parameters in query string

TS-0009, 6.2.2.2 "Query Component":

Parameters with multiplicity โ€˜0..nโ€™, may occur multiple times in the query-string in the form of = value. For example, if the resourceType element of the Filter Criteria parameter is represented by a list of 3 values โ€˜2 3 4โ€™ (see clause 6.3.4.7 in TS-0004 [3]), it would be mapped to ty=2+3+4 in the query-string. At the receiver side, this query string can be reverted back into the list type of representation. The same representation shall be applied for multiple occurrences of contentType and labels elements.

(( IMHO this encoding of multiple-valued parameters is much less desirable than the one used by browsers to transmit multi-select groups in form GETs: key=value1&key=value2 ))

this code doesn't support the key=value1+value2 encoding: /id-in?fu=1&rcn=8&ty=28+52 returns

{}

whereas /id-in?fu=1&rcn=8&ty=28&ty=52 returns

{
    "acme:csest": [
        {
            "rn": "statistics",
            "cnd": "acme.statistics",
            "acpi": [
                "acp1028273287565921797"
            ],
            "mni": 10,
            "rmRes": 769,
            "crRes": 788,
            "htRet": 1765,
            "htCre": 6,
            "htUpd": 779,
            "htDel": 0,
            "lgErr": 4,
            "lgWrn": 1560,
            "cseSU": "20200610T032059,778926",
            "cseUT": "2:09:27",
            "ctRes": 19,
            "ri": "csest2319516495356652035",
            "ct": "20200609T200338,971435",
            "lt": "20200609T223027,795302",
            "et": "20210609T200338,971524",
            "pi": "CX677vJit2W",
            "st": 786,
            "ty": 28,
            "cs": 375,
            "cr": "CX677vJit2W",
            "cni": 10,
            "acme:csest": [
                {
                    "rn": "statistics_777",
                    "ct": "20200609T222852,666985",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 760,
                    "crRes": 779,
                    "htRet": 1622,
                    "htCre": 6,
                    "htUpd": 770,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1542,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:07:52",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest1371316697918218744",
                    "lt": "20200609T222852,682530",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_778",
                    "ct": "20200609T222903,773534",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 761,
                    "crRes": 780,
                    "htRet": 1643,
                    "htCre": 6,
                    "htUpd": 771,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1544,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:08:03",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest5112893450959866184",
                    "lt": "20200609T222903,884130",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_779",
                    "ct": "20200609T222914,478786",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 762,
                    "crRes": 781,
                    "htRet": 1663,
                    "htCre": 6,
                    "htUpd": 772,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1546,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:08:14",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest6852710586748696449",
                    "lt": "20200609T222914,517521",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_780",
                    "ct": "20200609T222925,454350",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 763,
                    "crRes": 782,
                    "htRet": 1700,
                    "htCre": 6,
                    "htUpd": 773,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1548,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:08:25",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest6394028521532319831",
                    "lt": "20200609T222925,469891",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_781",
                    "ct": "20200609T222935,817785",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 764,
                    "crRes": 783,
                    "htRet": 1700,
                    "htCre": 6,
                    "htUpd": 774,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1550,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:08:35",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest7346541260555276372",
                    "lt": "20200609T222935,832206",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_782",
                    "ct": "20200609T222946,181002",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 765,
                    "crRes": 784,
                    "htRet": 1700,
                    "htCre": 6,
                    "htUpd": 775,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1552,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:08:46",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest6366505983503278387",
                    "lt": "20200609T222946,195991",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_783",
                    "ct": "20200609T222956,616960",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 766,
                    "crRes": 785,
                    "htRet": 1726,
                    "htCre": 6,
                    "htUpd": 776,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1554,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:08:56",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest1065743719070142612",
                    "lt": "20200609T222956,632107",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_784",
                    "ct": "20200609T223006,998955",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 767,
                    "crRes": 786,
                    "htRet": 1726,
                    "htCre": 6,
                    "htUpd": 777,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1556,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:09:07",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest7747391690018505637",
                    "lt": "20200609T223007,014283",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_785",
                    "ct": "20200609T223017,406038",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 768,
                    "crRes": 787,
                    "htRet": 1752,
                    "htCre": 6,
                    "htUpd": 778,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1558,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:09:17",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest2854829023153885085",
                    "lt": "20200609T223017,420553",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                },
                {
                    "rn": "statistics_786",
                    "ct": "20200609T223027,795302",
                    "et": "20210609T200338,971524",
                    "cs": 375,
                    "or": "CX677vJit2W",
                    "rmRes": 769,
                    "crRes": 788,
                    "htRet": 1765,
                    "htCre": 6,
                    "htUpd": 779,
                    "htDel": 0,
                    "lgErr": 4,
                    "lgWrn": 1560,
                    "cseSU": "20200610T032059,778926",
                    "cseUT": "2:09:27",
                    "ctRes": 19,
                    "acpi": [
                        "acp1028273287565921797"
                    ],
                    "ri": "csest7570597054332285404",
                    "lt": "20200609T223027,810095",
                    "pi": "csest2319516495356652035",
                    "st": 0,
                    "ty": 52
                }
            ]
        }
    ]
}

Trouble starting with python 3.10: SyntaxError: f-string: unmatched '('

I just cloned ACME master and ran it with python 3.10.13 on my FreeBSD machine in an venv and got above error.

I had to change two lines in Console.py

diff --git a/acme/services/Console.py b/acme/services/Console.py
index 50e207df..8b5b695c 100644
--- a/acme/services/Console.py
+++ b/acme/services/Console.py
@@ -758,7 +758,7 @@ Available under the BSD 3-Clause License
 			count = 0
 
 			# Create a temporary directory for the export
-			outdir = f'{CSE.Configuration.get('baseDirectory')}/tmp'
+			outdir = f'{CSE.Configuration.get("baseDirectory")}/tmp'
 			os.makedirs(outdir, exist_ok = True)
 
 			filename = f'export-{getResourceDate().rsplit(",", 1)[0]}.sh'
@@ -862,7 +862,7 @@ function createResource() {{
 				L.console(f'No instances found under {ri}', isError = True)
 			else:
 				# Create a temporary directory for the export
-				outdir = f'{CSE.Configuration.get('baseDirectory')}/tmp'
+				outdir = f'{CSE.Configuration.get("baseDirectory")}/tmp'
 				os.makedirs(outdir, exist_ok = True)
 
 				# get the filename and open the file for writing

Anyway, thanks for ACME, this is a great help in understanding oneM2M!

Cheers, Mathias

development branch: error on web request

just typed 'CAdmin' in the "Originator" box and hitting "Connect":

[10:57:31] DEBUG    2971 - ==> Retrieve: /id-in                                                                                                                                HttpServer.py:106
           DEBUG    2971 - Headers:                                                                                                                                            HttpServer.py:107
                    Host: 127.0.0.1:8081                                                                                                                                                        
                    Connection: keep-alive                                                                                                                                                      
                    Accept: application/json                                                                                                                                                    
                    Dnt: 1                                                                                                                                                                      
                    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36                                              
                    X-M2M-Ri: 123                                                                                                                                                               
                    X-M2M-Origin: CAdmin                                                                                                                                                        
                    Sec-Fetch-Site: same-origin                                                                                                                                                 
                    Sec-Fetch-Mode: cors                                                                                                                                                        
                    Sec-Fetch-Dest: empty                                                                                                                                                       
                    Referer: http://127.0.0.1:8081/webui/index.html?ri=/id-in                                                                                                                   
                    Accept-Encoding: gzip, deflate, br                                                                                                                                          
                    Accept-Language: en-US,en;q=0.9,es;q=0.8                                                                                                                                    
                                                                                                                                                                                                
           DEBUG    2971 - RETRIEVE ID: id-in, originator: CAdmin                                                                                                               Dispatcher.py:49
           DEBUG    2971 - Handle retrieve resource: id-in                                                                                                                      Dispatcher.py:69
           DEBUG    2971 - Get resource: id-in                                                                                                                                 Dispatcher.py:129
           DEBUG    2971 - Retrieve resource: id-in                                                                                                                            Dispatcher.py:172
           DEBUG    2971 - Checking permission for originator: CAdmin, ri: id-in, permission: 2, selfPrivileges: False                                                     SecurityManager.py:66
           DEBUG    2971 - Retrieve resource: acpAdmin                                                                                                                         Dispatcher.py:172
           ERROR    2971 - Exception on /id-in [GET]                                                                                                                                 app.py:2450
                    Traceback (most recent call last):                                                                                                                                          
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app                                                                               
                        response = self.full_dispatch_request()                                                                                                                                 
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request                                                                  
                        rv = self.handle_user_exception(e)                                                                                                                                      
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception                                                                  
                        reraise(exc_type, exc_value, tb)                                                                                                                                        
                      File "/home/me/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise                                                                              
                        raise value                                                                                                                                                             
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request                                                                  
                        rv = self.dispatch_request()                                                                                                                                            
                      File "/home/me/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request                                                                       
                        return self.view_functions[rule.endpoint](**req.view_args)                                                                                                              
                      File "acme/HttpServer.py", line 109, in handleGET                                                                                                                         
                        (resource, rc) = CSE.dispatcher.retrieveRequest(request, Utils.retrieveIDFromPath(path, self.csern, self.cseri))                                                        
                      File "acme/Dispatcher.py", line 65, in retrieveRequest                                                                                                                    
                        return self.handleRetrieveRequest(request, id, originator)                                                                                                              
                      File "acme/Dispatcher.py", line 133, in handleRetrieveRequest                                                                                                             
                        if not CSE.security.hasAccess(originator, resource, C.permRETRIEVE):                                                                                                    
                      File "acme/SecurityManager.py", line 117, in hasAccess                                                                                                                    
                        if acp.checkPermission(originator, requestedPermission):                                                                                                                
                      File "acme/resources/ACP.py", line 92, in checkPermission                                                                                                                 
                        if requestedPermission & p['acop'] == 0:    # permission not fitting at all                                                                                             
                    TypeError: string indices must be integers                                                                                                                                  
           DEBUG    2971 - "GET /id-in HTTP/1.1" - 500                                                                                                                         HttpServer.py:298

Being prompted to install missing packages when they are already installed on Python 3.12.1

I am trying to install and start ACME.

OS: Windows 11
Python version: 3.12.1

When starting ACME with python -m acme it is asking to install missing packages, however it seems that all required packages are already installed.

The log:

One or more required packages or modules (distutils) could not be found.
Please install the missing packages, e.g. by running the following command:

        C:\Users\synctechno\AppData\Local\Programs\Python\Python312\python.exe -m pip install -r requirements.txt


Do you want to install the missing packages now? [y/N] y
Requirement already satisfied: blinker==1.6.3 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 7)) (1.6.3)
Requirement already satisfied: cbor2==5.5.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 9)) (5.5.0)
Requirement already satisfied: certifi==2023.7.22 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 11)) (2023.7.22)
Requirement already satisfied: charset-normalizer==3.3.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 13)) (3.3.0)
Requirement already satisfied: click==8.1.7 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 15)) (8.1.7)
Requirement already satisfied: flask==3.0.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 17)) (3.0.0)
Requirement already satisfied: flask-cors==4.0.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 21)) (4.0.0)
Requirement already satisfied: idna==3.4 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 23)) (3.4)
Requirement already satisfied: importlib-metadata==6.8.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 25)) (6.8.0)
Requirement already satisfied: inquirerpy==0.3.4 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 27)) (0.3.4)
Requirement already satisfied: isodate==0.6.1 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 29)) (0.6.1)
Requirement already satisfied: itsdangerous==2.1.2 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 33)) (2.1.2)
Requirement already satisfied: jinja2==3.1.2 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 35)) (3.1.2)
Requirement already satisfied: linkify-it-py==2.0.2 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 37)) (2.0.2)
Requirement already satisfied: markdown-it-py[linkify,plugins]==3.0.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 39)) (3.0.0)
Requirement already satisfied: markupsafe==2.1.3 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 44)) (2.1.3)
Requirement already satisfied: mdit-py-plugins==0.4.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 48)) (0.4.0)
Requirement already satisfied: mdurl==0.1.2 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 50)) (0.1.2)
Requirement already satisfied: numpy==1.26.1 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 52)) (1.26.1)
Requirement already satisfied: paho-mqtt==1.6.1 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 54)) (1.6.1)
Requirement already satisfied: pfzy==0.3.4 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 56)) (0.3.4)
Requirement already satisfied: plotext==5.2.8 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 58)) (5.2.8)
Requirement already satisfied: prompt-toolkit==3.0.39 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 62)) (3.0.39)
Requirement already satisfied: pygments==2.16.1 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 64)) (2.16.1)
Requirement already satisfied: pyparsing==3.1.1 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 66)) (3.1.1)
Requirement already satisfied: python3-dtls==1.3.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 68)) (1.3.0)
Requirement already satisfied: rdflib==7.0.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 70)) (7.0.0)
Requirement already satisfied: requests==2.31.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 72)) (2.31.0)
Requirement already satisfied: rich==13.6.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 74)) (13.6.0)
Requirement already satisfied: shapely==2.0.2 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 78)) (2.0.2)
Requirement already satisfied: six==1.16.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 80)) (1.16.0)
Requirement already satisfied: textual==0.40.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 82)) (0.40.0)
Requirement already satisfied: textual-plotext==0.1.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 86)) (0.1.0)
Requirement already satisfied: tinydb==4.8.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 88)) (4.8.0)
Requirement already satisfied: typing-extensions==4.8.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 90)) (4.8.0)
Requirement already satisfied: uc-micro-py==1.0.2 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 92)) (1.0.2)
Requirement already satisfied: urllib3==2.0.7 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 94)) (2.0.7)
Requirement already satisfied: waitress==2.1.2 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 96)) (2.1.2)
Requirement already satisfied: wcwidth==0.2.8 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 98)) (0.2.8)
Requirement already satisfied: werkzeug==3.0.1 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 100)) (3.0.1)
Requirement already satisfied: zipp==3.17.0 in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 102)) (3.17.0)
Requirement already satisfied: colorama in c:\users\synctechno\appdata\local\programs\python\python312\lib\site-packages (from click==8.1.7->-r requirements.txt (line 15)) (0.4.6)

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

Do you want to start ACME now? [Y/n] y

One or more required packages or modules (distutils) could not be found.
Please install the missing packages, e.g. by running the following command:

        C:\Users\synctechno\AppData\Local\Programs\Python\Python312\python.exe -m pip install -r requirements.txt


Do you want to install the missing packages now? [y/N] 

Pending Notifications

Hi Andreas,

I am wondering if pendingNotifications are supported in ACME?
I noticed that it is on your Roadmap, but I'm not sure if that means you are planning to add them, or if you're planning on improving the already existing functionality.

I am doing some testing and getting some odd results, so just wanted to check.

ResourceReferenceList serialization?

GET id-in?rcn=6&drt=2&fu=1 returns

{
    "m2m:rrl": [
        {
            "nm": "acp_statistics",
            "typ": 1,
            "val": "acp7711211972577804602"
        },
        //...

but the XSD:

  <xs:element name="resourceRefList" type="m2m:listOfChildResourceRef" />

  <xs:complexType name="listOfChildResourceRef">    
    <xs:sequence>  
      <xs:element name="resourceRef" type="m2m:childResourceRef" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence> 	       
  </xs:complexType> 


  <xs:complexType name="childResourceRef">
    <xs:simpleContent>
	<xs:extension base="xs:anyURI">
          <xs:attribute name="name" type="xs:NCName" use="required" />
          <xs:attribute name="type" type="m2m:resourceType" use="required" /> 
          <xs:attribute name="specializationID" type="xs:anyURI" use="optional" /> 
        </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

clearly shows that this is an object with a single field resourceRef (previously childResource), like this:

{
    "m2m:rrl": {
        "ch": [
            {
                "nm": "acp_statistics",
                "typ": 1,
                "val": "acp7711211972577804602"
            },
            //...

so either the XSD is wrong, or the implementation is wrong. which is it?

Support acor to check from group resource member

Hi,

As specification that quoted below:

When the originatorID is the resource-ID of a < group > resource which contains < AE > or < remoteCSE > as member, the Hosting CSE of the resource shall check if the originator of the request matches one of the members in the memberIDs attribute of the < group > resource (e.g. by retrieving the < group > resource). If the < group > resource cannot be retrieved or doesn't exist, the request shall be rejected.

Then i see that currently it is not supported. So i create some changes to accommodate it and it works for the purpose. Please see here.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.