Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align fiware-service and fiware-servicepath syntax and semantics with Orion #336

Open
jmcanterafonseca opened this issue May 11, 2016 · 13 comments

Comments

@jmcanterafonseca
Copy link
Contributor

IoTA layer must be aligned with CB layer in the syntax and semantics of fiware-service and fiware-servicepath. Currently it is not aligned. Notably, the definition of the syntax and semantics of both headers is described by

http://fiware-orion.readthedocs.io/en/develop/user/service_path/index.html
http://fiware-orion.readthedocs.io/en/develop/user/multitenancy/index.html

and probably we would need a central definition place for both headers and to cross reference it from the different GEs that make use of it.

/cc @fgalan @mrutid

@dmoranj
Copy link
Contributor

dmoranj commented May 11, 2016

Be aware that, for most of the components, the service path is not exactly hierarchical, as they only accept a single level in the hierarchy. The multitenancy mechanism is clearer than the service_path.

@fgalan
Copy link
Member

fgalan commented May 11, 2016

Actually, I'd say that the only one that interprests service path in hierarchicalway in IoTP is Orion. However, this is not a problem, as the single-element case is a particular case of the hierarchical approach.

@dmoranj
Copy link
Contributor

dmoranj commented Aug 31, 2016

There are currently several issues opened concerning how the service and servicepath flags work in the IoTAgents. I'm going to close all of them and leave this one as a single backlog item. We can also hold the appropriate discussions and requests here.

Summarizing, there are three differences in the behavior between the Orion Context Broker and the IoTAgents:

  • Headers are optional in the Context Broker and mandatory in the IoTAgents.
  • Servicepath is hierarchical in the Context Broker and treated as a plain string in the IoTAs.
  • Wildcards behavior is not well defined in the IoTAgents (this has to do with the strange Provisioning API we are using, that should also be redesigned).

We should add this issue to the component backlog and evaluate its importance.

@dcalvoalonso
Copy link
Contributor

Trying to fix unit tests in LWM2M IOTA, I have discovered an additional issue regarding the alignment of fiware-service and fiware-servicepath with Orion Context Broker.

From https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/user/multitenancy.md:

Orion Context Broker interprets the tentant name in lowercase, thus, although you can use tenants such as in updateContext "MyService" it is not advisable, as the notifications related with that tenant will be sent with "myservice" and, in that sense, it is not coherent the tenant you used in updateContext compared with the one that Orion sends in notifyContextRequest.

Actually, the IOTA node library stores devices in its registry with service and subservice including uppercase characters.

function findOrCreate(deviceId, group, callback) {
    getDevice(deviceId, group.service, group.subservice, function(error, device) {
        if (!error && device) {
            callback(null, device, group);
        } else if (error.name === 'DEVICE_NOT_FOUND') {
            var newDevice = {
                id: deviceId,
                service: group.service,
                subservice: group.subservice,
                type: group.type
            };

            if (config.getConfig().iotManager && config.getConfig().iotManager.protocol) {
                newDevice.protocol = config.getConfig().iotManager.protocol;
            }

            registerDevice(newDevice, function(error, device) {
                callback(error, device, group);
            });
        } else {
            callback(error);
        }
    });

@fgalan
Copy link
Member

fgalan commented Dec 18, 2017

In order to avoid the problem you mention @dcalvoalonso the recomendation is to use always service and servicepath in lowercase.

@dcalvoalonso
Copy link
Contributor

Then I see two options regarding this point:

  • To modify LWM2M IOTA tests to use servicepath in lowercase following this recommendation.
  • To implement additional mechanisms in the IOTA library so that servicepath are converted to lowercase.

What do you think @fgalan ?

@fgalan
Copy link
Member

fgalan commented Dec 19, 2017

You mean the test is failing right now? As far as I see at https://github.com/telefonicaid/iotagent-node-lib/commits/master Travis is ok at the present moment at master...

@dcalvoalonso
Copy link
Contributor

Tests are not passed for LWM2M IOTA. I have run them locally and several (passive attributes and commands) fail due to this problem. As you can see in travis.yml, tests are not automatically executed yet.

@fgalan
Copy link
Member

fgalan commented Dec 19, 2017

I think that modifying the library to convert to lowercase could have some degree of backward compatibility risk that needs to be carefully analyzed. Specially for existing integrations using IOTA UL or IOTA JSON.

Thus, I think that at the present moment just adjusting the test is enough. In addition, once you fix it I'd suggest to set Travis in automatic mode at LWM2M IOTA repo (in an independent PR). Could you manage with that, please?

@dcalvoalonso
Copy link
Contributor

Ok, it makes sense to me. I am right now working on it!
Thanks!!!
:)

@dcalvoalonso
Copy link
Contributor

I have just submitted a PR to enable Travis CI for LWM2M IOTA repo and to pass unit tests: telefonicaid/lightweightm2m-iotagent#105

They are still not passed because of #569

@hylowaker
Copy link

Hello. I'm new to Fiware. While following tutorials, I found that a queryContext to Orion with fiware-servicepath headers accepts wildcard ('#').
However, It seems that sending request to /iot/devices/ endpoint returns no result when servicepath has wildcard.
Is it just an issue of IoTA-UL used in tutorials? Or is it still unresolved issue for all IoT Agents?

@fgalan
Copy link
Member

fgalan commented Mar 7, 2019

@hylowaker I think your interpretation is correct. Orion supports # syntax in service paths but currently IOTAs doesn't. This issue is about aligning that but it is still pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants