1
votes

I've been trying to get a setup running that enables associations the Orion Context Broker.

I've been following the Users and Programmers Guide on the FIWARE wiki, where the functionality is explained by:

First registering "Room1" and "Room2" entities, as described here: https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_Broker_-_Orion_Context_Broker_-_User_and_Programmers_Guide#Register_Context_operation

This works as expected. Then I follow the steps for associations here: https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_Broker_-_Orion_Context_Broker_-_User_and_Programmers_Guide#Associations

All the registrations goes through as expected, however, when I try to "discoverContextAvailability", I get a "NGSI 404" back that looks like this:

REQUEST:

<?xml version="1.0"?>
<discoverContextAvailabilityRequest>
  <entityIdList>
    <entityId type="Room" isPattern="false">
      <id>Room2</id>
    </entityId>
  </entityIdList>
  <attributeList>
    <attribute>temperature</attribute>
  </attributeList>
  <restriction>
    <scope>
      <operationScope>
        <scopeType>IncludeAssociations</scopeType>
        <scopeValue>SOURCES</scopeValue>
      </operationScope>
    </scope>
  </restriction>
</discoverContextAvailabilityRequest>

RESPONSE:

<discoverContextAvailabilityResponse>
  <errorCode>
    <code>404</code>
    <reasonPhrase>No context element found</reasonPhrase>
    <details>Could not query association with combination of entity/attribute</details>
  </errorCode>
</discoverContextAvailabilityResponse>

As an side-note, I would like to mention that I am trying to integrate the Orion Configuration Manager with the NEC IoT Broker, and when the IoT Broker sends a discoverContextAvailability to the Orion, it also includes the restriction that tells Orion to "include associations", which results in the same error described below (even though there are no associations registered in this case).

I could really use some help.

UPDATE 1 Result of echo 'db.registrations.find()' | mongo orion:

{ "_id" : ObjectId("54d4acdfa85d6301365b7240"), "expiration" : NumberLong(1423310431), "contextRegistration" : [        {       "entities" : [  {       "id" : "Filtered000D6F000277BCC0",      "type" : "FilteredSmartPlug" } ],       "attrs" : [  {       "name" : "currentPower",        "type" : "float",       "isDomain" : "false" } ],       "providingApplication" : "http://localhost/EspR4FastData/" } ] }
{ "_id" : ObjectId("54e1c2e7a85d6301365b7314"), "expiration" : NumberLong(1424513639), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C4",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1c2f9a85d6301365b7315"), "expiration" : NumberLong(1424513657), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C4",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1c3aaa85d6301365b7316"), "expiration" : NumberLong(1424513834), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C4",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1c416a85d6301365b7317"), "expiration" : NumberLong(1424513942), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C5",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1ce41a85d6301365b7318"), "expiration" : NumberLong(1424084605), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d2eda85d6301365b7319"), "expiration" : NumberLong(1424085801), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d333a85d6301365b731a"), "expiration" : NumberLong(1424085871), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d334a85d6301365b731b"), "expiration" : NumberLong(1424085872), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d56ea85d6301365b731c"), "expiration" : NumberLong(1424086442), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d922a85d6301365b731d"), "expiration" : NumberLong(1426679330), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d92da85d6301365b731e"), "expiration" : NumberLong(1426679341), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d97ba85d6301365b731f"), "expiration" : NumberLong(1426679419), "contextRegistration" : [        {       "entities" : [  {       "id" : "Room1",         "type" : "Room" },      {       "id" : "Room2",         "type" : "Room" } ],         "attrs" : [     {       "name" : "temperature",         "type" : "float",       "isDomain" : "false" },         {       "name" : "pressure",    "type" : "integer",     "isDomain" : "false" } ],       "providingApplication" : "http://mysensors.com/Rooms" } ] }
{ "_id" : ObjectId("54e1d9afa85d6301365b7320"), "expiration" : NumberLong(1426679471), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1dd0fa85d6369180b7c49"), "expiration" : NumberLong(1426680335), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [  {       "id" : "Room1",         "type" : "Room" },      {       "id" : "Room2",      "type" : "Room" } ],    "attrs" : [     {       "name" : "temperature",         "type" : "float",       "isDomain" : "false" },         {       "name" : "pressure",    "type" : "integer",     "isDomain" : "false" } ],       "providingApplication" : "http://mysensors.com/Rooms" } ] }
{ "_id" : ObjectId("54e1dd47a85d6369180b7c4a"), "expiration" : NumberLong(1426680391), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [  {       "id" : "Room1",         "type" : "Room" },      {       "id" : "Room2",      "type" : "Room" } ],    "attrs" : [     {       "name" : "temperature",         "type" : "float",       "isDomain" : "false" },         {       "name" : "pressure",    "type" : "integer",     "isDomain" : "false" } ],       "providingApplication" : "http://mysensors.com/Rooms" } ] }
{ "_id" : ObjectId("54e1ddc1a85d6369180b7c4d"), "expiration" : NumberLong(1426680513), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1ddc2a85d6369180b7c4e"), "expiration" : NumberLong(1426680514), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1ddc2a85d6369180b7c4f"), "expiration" : NumberLong(1426680514), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1ddc3a85d6369180b7c50"), "expiration" : NumberLong(1426680515), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }

UPDATE 2

After deleting the database, the procedure described in the guide now works. I get a response back when an entity has an assocation. If the entity on the other hand does not have an association, the query still returns the error 'Could not query association with combination of entity/attribute'.

However. My initial problem started by the fact that the NEC IoT Broker made this request to the Configuration Manager (always including the restriction for associations), which means that whenever I query data on the IoT Broker that does NOT have associations, it fails. Is this really the correct behaviour?

1
I have tested that request (after preparing the registrations as described in the manual) and it seems to work (see gist.github.com/fgalan/054a0f72570d429c73a0). So, I would need to have more insight in the contents of your DB to help... could you run the following command echo 'db.registrations.find()' | mongo orion and edit your question to include the output, please? If the responde is too long, you can use gist (as I have done above). In addition, include the Orion Context Broker version you are using.fgalan
Added result of command. I am running v. 0.19Mikael Guldborg
I've just tried following the guide described here: It did find issues, and it was able to fix these. However, the result still seem to be the same. Is there a way to simply reset the database that orion uses? There is no data in there that cannot be replicated.Mikael Guldborg
I don't think is is related with the DB migration scripts to 0.19.0, given that these scripts only touch the entities collections and all the registrations/discovery/associations stuff is related with a different collection (registrations). Anyway, let's try what you suggest: clean up the database (procedure is described here) and try again.fgalan
Added another update. (Update 2, see that)Mikael Guldborg

1 Answers

0
votes

The problem seems related with overlapping registrations in the Orion database. After cleaning the DB and repeat the test, it worked (according to user's report).