OPCFoundation / UA-CloudLibrary

OPC UA Information Model database with a REST and GraphQL interface, as well as user management. The global instance of this (hosted by the OPC Foundation) can be found at https://uacloudlibrary.opcfoundation.org.
Other
37 stars 18 forks source link

Cannot upload any NodeSet2.xml via UA-CloudViewer #170

Closed sebwiendl closed 1 year ago

sebwiendl commented 1 year ago

Hello everyone,

I am trying to setup a UA-CloudLibrary. Currently I'm working locally in a trivial/minimal environment defined by this compose.yaml:

services:
  uacv:
    image: ghcr.io/digitaltwinconsortium/ua-cloudviewer:main
    ports:
      - 8080:80
  uacl:
    image: ghcr.io/opcfoundation/ua-cloudlibrary:latest
    ports:
      - 8081:80
    environment:
      - PostgreSQLEndpoint=db
      - PostgreSQLUsername=uacl
      - PostgreSQLPassword=uacl
      - ServicePassword=uacl
    depends_on:
      - db
  db:
    image: postgres:latest
    environment:
      - POSTGRES_USER=uacl
      - POSTGRES_PASSWORD=uacl
      - POSTGRES_DB=uacl

I can visit the UA-CloudLibrary under http://localhost:8081 and register for an account. I can then use this account to login from the UA-CloudViewer from http://localhost:8080. I can also upload and browse any (of the ones I tried; one was proprietary, one was PackML from https://github.com/OPCFoundation/UA-Nodeset/blob/latest/PackML/Opc.Ua.PackML.NodeSet2.xml) NodeSet2.xml files to the UA-CloudViewer.

However, trying to use the UA-CloudViewer to upload any NodeSet2.xml to the UA-CloudLibrary (with all required fields filled out and all non-required fields empty) always fails with PublicationDate in metadata does not match nodeset XML.. However, my UA-CloudViewer upload dialog has no PublicationDate form field. The validation in question seems to be: https://github.com/OPCFoundation/UA-CloudLibrary/blob/e5db7aa877d796550d72d42956e6fb7ee623a107/UACloudLibraryServer/Controllers/InfoModelController.cs#L265

What am I missing here? Any help is much appreciated.

Best Regards Sebastian

MarkusHorstmann commented 1 year ago

It looks like this validation was added in August 2022 to prevent inconsistencies between the metadata in the database and the nodeset. With the new, stricter metadata mechanism we could now just always use the data from the nodeset itself, maybe just log a warning if the metadata being passed in is out of date? Or we could allow that the PublicationDate and other metadata not be specified, but still check for consistency if they are? It appears that the UA-CloudViewer does not set this metadata, so a fix/workaround would be to change the UA-CloudViewer, but it seems better if we make the Cloud Library itself more lenient here. Happy to make the fix if everybody agrees.

barnstee commented 1 year ago

Thanks Markus for taking a look. I agree that we should harden UA Cloud Lib. Let's discuss in our next meeting on Tuesday.

barnstee commented 1 year ago

Let's keep publication date and return it for queries but ignore it on upload and always take the publication date from the nodeset file.

sebwiendl commented 1 year ago

Thanks for your feedback on this issue. The solution sounds feasible.

In the meantime, I successfully used the UA-CloudLibrary REST API to directly upload information models, bypassing the UA-CloudViewer UI.