Search code examples
dockerdocker-composefiwareopc-uaopc

IoT-Agent OPC-UA Docker-compose setting for NGSI ld or NGSI v2


In the docker-composer files of the OPC-UA IoT-Agent there are some comments unclear to me, in particular at the line is told to comment if you want to use NGSI-LD or to comment the line if you want to use NGSI-V2.

Reading the strings that should be commented out however, it would seem that it is necessary to remove the comments from both the lines to use NGSI-LD, and comment both of them to use NGS-V2.

Is my interpretation correct? Thanks for clearing it up.

PS: the same issue is present to the file docker-compose-external-server.yml


Solution

  • Setting up NGSI-v2 vs NGSI-LD is common to all IoT Agents. The Installation Guide describes the required configuration - default operation is NGSI-v2.

    If you want to operate NGSI-LD, the ngsiVersion and jsonLdContext must be defined.

    {
        host: '192.168.56.101',
        port: '1026',
        ngsiVersion: 'ld',
        jsonLdContext: 'http://context.json-ld' 
    }
    

    ngsiVersion can be v2, ld or mixed.

    Both settings can also be set up using Environment Variables which is more convenient when using Docker

    Therefore, for NGSI-LD the following minimal set-up is required:

      iotage:
        hostname: iotage
        image: iotagent4fiware/iotagent-opcua:latest
        environment:
          - IOTA_CB_NGSI_VERSION=ld
          - IOTA_JSON_LD_CONTEXT=https://path-to-context-file
          - IOTA_FALLBACK_TENANT=opcua_car
          - IOTA_RELAX_TEMPLATE_VALIDATION=true
    

    For NGSI-v2 the following is required:

      iotage:
        hostname: iotage
        image: iotagent4fiware/iotagent-opcua:latest
        environment:
          - IOTA_CB_NGSI_VERSION=v2
          - IOTA_RELAX_TEMPLATE_VALIDATION=true
    

    IOTA_RELAX_TEMPLATE_VALIDATION is required for OPC-UA to allow the provisioning of OPC-UA topics with = within them which would normally be disallowed.