Skip to content

Commit

Permalink
Merge pull request telefonicaid#1009 from FIWARE/keyvalues/special-su…
Browse files Browse the repository at this point in the history
…b-attrs

Forgot the special sub-attrs for the PATCH Attribute request with key-values
  • Loading branch information
kzangeli authored Feb 1, 2022
2 parents da6998b + 52c1498 commit df89bb3
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 187 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile-debug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fiware/orion-ld-base AS build-stage
FROM fiware/orion-ld-base

ARG PATH_TO_SRC='opt/orion/'

Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile-test
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ RUN pip2.7 install Flask
RUN pip2.7 install paho-mqtt
RUN pip2.7 install pyopenssl

RUN yum install --nogpgcheck -y gmock-devel
RUN yum -y install https://rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Packages/gtest-1.8.0-5.el8.x86_64.rpm
RUN yum -y install https://rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Packages/gmock-1.8.0-5.el8.x86_64.rpm
RUN yum -y install https://rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Packages/gmock-devel-1.8.0-5.el8.x86_64.rpm
RUN yum install -y procps

RUN wget https://src.fedoraproject.org/repo/pkgs/gmock/gmock-1.5.0.tar.bz2/d738cfee341ad10ce0d7a0cc4209dd5e/gmock-1.5.0.tar.bz2
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile-ubi-base
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM registry.access.redhat.com/ubi8/ubi:8.5
ENV ROOT_FOLDER='/opt'
ENV PAHO_VERSION='v1.3.1'

COPY ./docker/subscription-manager.conf /etc/yum/pluginconf.d/subscription-manager.conf
COPY ./docker/ubi.repo /etc/yum.repos.d/ubi.repo

RUN mkdir /tmp/build

COPY ./docker/build-ubi/install-build-dependencies.sh /tmp/build/install-build-dependencies.sh
Expand Down
35 changes: 22 additions & 13 deletions docker/build-ubi/install-gnutls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,27 @@
# iot_support at tid dot es

set -e

yum makecache --refresh
yum -y install gmp gnutls gnutls-utils
# gnutls-devel is not available in the ubi-repos, so we install it from the centos8 reposhttps://rpmfind.net/linux/rpm2html/search.php?query=pkgconfig

yum -y install https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/gmp-c++-6.1.2-10.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/gmp-devel-6.1.2-10.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/nettle-devel-3.4.1-7.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/p11-kit-devel-0.23.22-1.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/gnutls-c++-3.6.16-4.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/nettle-devel-3.4.1-7.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/libidn2-devel-2.2.0-1.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/libtasn1-devel-4.13-3.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/gnutls-c++-3.6.16-4.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/gnutls-devel-3.6.16-4.el8.x86_64.rpm

# gnutls-devel is not available in the ubi-repos, so we install it from the centos8 repos
yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/gmp-c++-6.1.2-10.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/gmp-devel-6.1.2-10.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/pkgconf-pkg-config-1.4.2-1.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/nettle-devel-3.4.1-7.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/libidn2-devel-2.2.0-1.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/libtasn1-devel-4.13-3.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/nettle-devel-3.4.1-7.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/p11-kit-devel-0.23.22-1.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/pkgconf-pkg-config-1.4.2-1.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/gnutls-c++-3.6.16-4.el8.x86_64.rpm
yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/gnutls-devel-3.6.16-4.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/gmp-devel-6.1.2-10.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/pkgconf-pkg-config-1.4.2-1.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/nettle-devel-3.4.1-7.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/libidn2-devel-2.2.0-1.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/libtasn1-devel-4.13-3.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/nettle-devel-3.4.1-7.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/p11-kit-devel-0.23.22-1.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/pkgconf-pkg-config-1.4.2-1.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/gnutls-c++-3.6.16-4.el8.x86_64.rpm
9 changes: 6 additions & 3 deletions docker/build-ubi/install-postgres-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_6
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum -y --nogpgcheck install postgresql12 postgresql12-contrib

yum -y install https://rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Packages/libdap-3.19.1-2.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Packages/SuperLU-5.2.0-7.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/blas-3.8.0-8.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/lapack-3.8.0-8.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/epel/8/Everything/x86_64/Packages/a/armadillo-9.700.2-1.el8.x86_64.rpm

echo "Add repos"
yum-config-manager --add-repo http://mirror.centos.org/centos/8/AppStream/x86_64/os/
yum-config-manager --add-repo http://mirror.centos.org/centos/8/PowerTools/x86_64/os/
yum update -y --nogpgcheck


echo "Install libs"
yum -y --nogpgcheck install hdf5 xerces-c gdal-libs

Expand Down
6 changes: 6 additions & 0 deletions docker/subscription-manager.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[main]
enabled=0

# When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
# every time subscription-manager plugin is triggered by dnf or yum
disable_system_repos=0
62 changes: 62 additions & 0 deletions docker/ubi.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[ubi-8-baseos]
name = Red Hat Universal Base Image 8 (RPMs) - BaseOS
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/baseos/os
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-baseos-debug]
name = Red Hat Universal Base Image 8 (Debug RPMs) - BaseOS
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/baseos/debug
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-baseos-source]
name = Red Hat Universal Base Image 8 (Source RPMs) - BaseOS
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/baseos/source/SRPMS
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-appstream]
name = Red Hat Universal Base Image 8 (RPMs) - AppStream
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/appstream/os
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-appstream-debug]
name = Red Hat Universal Base Image 8 (Debug RPMs) - AppStream
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/appstream/debug
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-appstream-source]
name = Red Hat Universal Base Image 8 (Source RPMs) - AppStream
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/appstream/source/SRPMS
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-codeready-builder]
name = Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/codeready-builder/os
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-codeready-builder-debug]
name = Red Hat Universal Base Image 8 (Debug RPMs) - CodeReady Builder
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/codeready-builder/debug
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-codeready-builder-source]
name = Red Hat Universal Base Image 8 (Source RPMs) - CodeReady Builder
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/codeready-builder/source/SRPMS
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1
2 changes: 1 addition & 1 deletion scripts/check_files_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def ignore(root, file):
return True

# Some files in docker/ directory are not processed
if 'docker' in root and file in ['Dockerfile', 'Dockerfile-base', 'Dockerfile-ubi-base', 'Dockerfile-ubi', 'Dockerfile-test', 'Dockerfile-debug', 'Dockerfile-gdb', 'gdbinit', 'docker-compose.yml']:
if 'docker' in root and file in ['Dockerfile', 'Dockerfile-base', 'Dockerfile-ubi-base', 'Dockerfile-ubi', 'Dockerfile-test', 'Dockerfile-debug', 'Dockerfile-gdb', 'gdbinit', 'docker-compose.yml', 'subscription-manager.conf', 'ubi.repo']:
return True

# Some files in test/acceptance/behave directory are not processed
Expand Down
28 changes: 25 additions & 3 deletions src/lib/orionld/serviceRoutines/orionldPatchAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,20 @@ OrionldAttributeType attributeTypeFromUriParam(const char* attrShortName)
return Property;
}

static const char* attributeTypeString[] = { "Property", "Relationship", "GeoProperty", "LanguageProperty" };


// -----------------------------------------------------------------------------
//
// attributeTypeString -
//
static const char* attributeTypeString[] =
{
"Property",
"Relationship",
"GeoProperty",
"LanguageProperty"
};



// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -757,7 +770,7 @@ static KjNode* kjKeyValueTransformAttribute(KjNode* attrP, KjNode* dbAttributeP,
// 3. Look up value/object/..., remove it from the tree and add it to "outTreeP"
//
// Not Present?
// That's OK - this is a PATCH operation ... right ... ?
// That's OK - this is a PATCH operation ... all A-OK
//
valueP = kjLookup(attrP, valueNodeName);
if (valueP != NULL)
Expand All @@ -772,11 +785,20 @@ static KjNode* kjKeyValueTransformAttribute(KjNode* attrP, KjNode* dbAttributeP,
//
KjNode* nodeP = attrP->value.firstChildP;
KjNode* next;

while (nodeP != NULL)
{
next = nodeP->next;

kjChildRemove(attrP, nodeP);

if ((strcmp(nodeP->name, "unitCode") == 0) || (strcmp(nodeP->name, "observedAt") == 0) || (strcmp(nodeP->name, "datasetId") == 0))
{
kjChildAdd(outTreeP, nodeP);
nodeP = next;
continue;
}

KjNode* objectP = kjObject(orionldState.kjsonP, nodeP->name);
OrionldAttributeType attributeType = attributeTypeFromUriParam(nodeP->name);

Expand Down Expand Up @@ -1026,7 +1048,7 @@ bool orionldPatchAttribute(void)


//
// 6. Extract createdAt and type from dbAttributeP
// 6. REMOVE createdAt and type from dbAttributeP
//
KjNode* dbCreatedAt = kjLookup(dbAttributeP, "creDate");
if (dbCreatedAt == NULL)
Expand Down
Loading

0 comments on commit df89bb3

Please sign in to comment.