Merge "Hashmark support in 3gpp objects"
diff --git a/.gitignore b/.gitignore
index 5f77b3b..a721cb4 100755
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
*.war
*.log
*.log.zip
+*.*~
cps-ncmp-rest-stub/dependency-reduced-pom.xml
cps-application/archunit_store
diff --git a/checkstyle/pom.xml b/checkstyle/pom.xml
index 893af40..ca5068f 100644
--- a/checkstyle/pom.xml
+++ b/checkstyle/pom.xml
@@ -54,7 +54,7 @@
</profiles>
<properties>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
<sonar.skip>true</sonar.skip>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
@@ -66,7 +66,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
+ <version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
@@ -106,12 +106,12 @@
<repository>
<id>ecomp-releases</id>
<name>ECOMP Release Repository</name>
- <url>${nexusproxy}${releaseNexusPath}</url>
+ <url>${onap.nexus.url}${releaseNexusPath}</url>
</repository>
<snapshotRepository>
<id>ecomp-snapshots</id>
<name>ECOMP Snapshot Repository</name>
- <url>${nexusproxy}${snapshotNexusPath}</url>
+ <url>${onap.nexus.url}${snapshotNexusPath}</url>
</snapshotRepository>
</distributionManagement>
</project>
\ No newline at end of file
diff --git a/checkstyle/src/main/resources/apache-license-2.regexp.txt b/checkstyle/src/main/resources/apache-license-2.regexp.txt
new file mode 100644
index 0000000..80f7be3
--- /dev/null
+++ b/checkstyle/src/main/resources/apache-license-2.regexp.txt
@@ -0,0 +1,15 @@
+^/[*]+$
+^ \* Copyright .*$
+^ \*( )?$
+^ \* Licensed under the Apache License, Version 2.0 \(the "License"\);$
+^ \* you may not use this file except in compliance with the License.$
+^ \* You may obtain a copy of the License at$
+^ \*( )?$
+^ \*( )*http://www.apache.org/licenses/LICENSE-2.0$
+^ \*( )?$
+^ \* Unless required by applicable law or agreed to in writing, software
+^ \* distributed under the License is distributed on an "AS IS" BASIS,
+^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+^ \* See the License for the specific language governing permissions and
+^ \* limitations under the License.
+^ [*]+/$
\ No newline at end of file
diff --git a/checkstyle/src/main/resources/cps-checkstyle/check-license.xml b/checkstyle/src/main/resources/cps-checkstyle/check-license.xml
new file mode 100644
index 0000000..a19dbe9
--- /dev/null
+++ b/checkstyle/src/main/resources/cps-checkstyle/check-license.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+# ============LICENSE_START=======================================================
+# Copyright (C) 2024 Nordix Foundation
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+-->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+<!-- Checks the license headers expected by ONAP. -->
+<module name="Checker">
+ <property name="charset" value="UTF-8"/>
+ <property name="severity" value="error"/>
+ <module name="RegexpSingleline">
+ <property name="format" value="under the Apache License, Version 2\.0"/>
+ <property name="minimum" value="1"/>
+ <property name="maximum" value="10"/>
+ </module>
+ <module name="RegexpSingleline">
+ <property name="format" value="http://www.apache\.org/licenses/LICENSE-2\.0"/>
+ <property name="minimum" value="1"/>
+ <property name="maximum" value="10"/>
+ </module>
+</module>
\ No newline at end of file
diff --git a/checkstyle/src/main/resources/cps-checkstyle/cps-java-style.xml b/checkstyle/src/main/resources/cps-checkstyle/cps-java-style.xml
new file mode 100644
index 0000000..6e1664a
--- /dev/null
+++ b/checkstyle/src/main/resources/cps-checkstyle/cps-java-style.xml
@@ -0,0 +1,342 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) 2024 Nordix Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE module PUBLIC
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
+
+<!--
+ Checkstyle configuration that checks the Google coding conventions from Google Java Style
+ that can be found at https://google.github.io/styleguide/javaguide.html
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.org (or in your downloaded distribution).
+
+ To completely disable a check, just comment it out or delete it from the file.
+ To suppress certain violations please review suppression filters.
+
+ Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
+ -->
+
+<!--
+To update the checkstyle version in ONAP see:
+https://lf-onap.atlassian.net/wiki/spaces/DW/pages/16429749/How+to+update+ONAP+checkstyle+when+Checkstyle+steps+their+version
+ -->
+
+<module name="Checker">
+ <property name="charset" value="UTF-8" />
+
+ <property name="severity" value="warning" />
+
+ <property name="fileExtensions" value="java, properties, xml" />
+ <!-- Excludes all 'module-info.java' files -->
+ <!-- See https://checkstyle.org/config_filefilters.html -->
+ <module name="BeforeExecutionExclusionFileFilter">
+ <property name="fileNamePattern" value="module\-info\.java$" />
+ </module>
+ <!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
+ <module name="SuppressionFilter">
+ <property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
+ default="checkstyle-suppressions.xml" />
+ <property name="optional" value="true" />
+ </module>
+ <module name="SuppressWarningsFilter"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.org/config_whitespace.html -->
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true" />
+ </module>
+
+ <module name="LineLength">
+ <property name="fileExtensions" value="java" />
+ <property name="max" value="120" />
+ <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://" />
+ </module>
+
+ <module name="TreeWalker">
+ <module name="OuterTypeFilename" />
+ <module name="IllegalTokenText">
+ <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL" />
+ <property name="format"
+ value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)" />
+ <property name="message"
+ value="Consider using special escape sequence instead of octal value or Unicode escaped value." />
+ </module>
+ <module name="AvoidEscapedUnicodeCharacters">
+ <property name="allowEscapesForControlCharacters" value="true" />
+ <property name="allowByTailComment" value="true" />
+ <property name="allowNonPrintableEscapes" value="true" />
+ </module>
+ <module name="AvoidStarImport" />
+ <module name="OneTopLevelClass" />
+ <module name="NoLineWrap">
+ <property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT" />
+ </module>
+ <module name="EmptyBlock">
+ <property name="option" value="TEXT" />
+ <property name="tokens"
+ value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH" />
+ </module>
+ <module name="NeedBraces">
+ <property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE" />
+ </module>
+ <module name="LeftCurly">
+ <property name="tokens"
+ value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
+ INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
+ LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
+ LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
+ OBJBLOCK, STATIC_INIT" />
+ </module>
+ <module name="RightCurly">
+ <property name="id" value="RightCurlySame" />
+ <property name="tokens"
+ value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
+ LITERAL_DO" />
+ </module>
+ <module name="RightCurly">
+ <property name="id" value="RightCurlyAlone" />
+ <property name="option" value="alone" />
+ <property name="tokens"
+ value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
+ INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF" />
+ </module>
+ <module name="SuppressionXpathSingleFilter">
+ <!-- suppression is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
+ <property name="id" value="RightCurlyAlone" />
+ <property name="query"
+ value="//RCURLY[parent::SLIST[count(./*)=1]
+ or preceding-sibling::*[last()][self::LCURLY]]" />
+ </module>
+ <module name="WhitespaceAfter">
+ <property name="tokens"
+ value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE,
+ LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE" />
+ </module>
+ <module name="WhitespaceAround">
+ <property name="allowEmptyConstructors" value="true" />
+ <property name="allowEmptyLambdas" value="true" />
+ <property name="allowEmptyMethods" value="true" />
+ <property name="allowEmptyTypes" value="true" />
+ <property name="allowEmptyLoops" value="true" />
+ <property name="tokens"
+ value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
+ BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
+ LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
+ LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
+ LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
+ NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
+ SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND" />
+ <message key="ws.notFollowed"
+ value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)" />
+ <message key="ws.notPreceded" value="WhitespaceAround: ''{0}'' is not preceded with whitespace." />
+ </module>
+ <module name="OneStatementPerLine" />
+ <module name="MultipleVariableDeclarations" />
+ <module name="ArrayTypeStyle" />
+ <module name="MissingSwitchDefault" />
+ <module name="FallThrough" />
+ <module name="UpperEll" />
+ <module name="ModifierOrder" />
+ <module name="EmptyLineSeparator">
+ <property name="tokens"
+ value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
+ STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF" />
+ <property name="allowNoEmptyLineBetweenFields" value="true" />
+ </module>
+ <module name="SeparatorWrap">
+ <property name="id" value="SeparatorWrapDot" />
+ <property name="tokens" value="DOT" />
+ <property name="option" value="nl" />
+ </module>
+ <module name="SeparatorWrap">
+ <property name="id" value="SeparatorWrapComma" />
+ <property name="tokens" value="COMMA" />
+ <property name="option" value="EOL" />
+ </module>
+ <module name="SeparatorWrap">
+ <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
+ <property name="id" value="SeparatorWrapEllipsis" />
+ <property name="tokens" value="ELLIPSIS" />
+ <property name="option" value="EOL" />
+ </module>
+ <module name="SeparatorWrap">
+ <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
+ <property name="id" value="SeparatorWrapArrayDeclarator" />
+ <property name="tokens" value="ARRAY_DECLARATOR" />
+ <property name="option" value="EOL" />
+ </module>
+ <module name="SeparatorWrap">
+ <property name="id" value="SeparatorWrapMethodRef" />
+ <property name="tokens" value="METHOD_REF" />
+ <property name="option" value="nl" />
+ </module>
+ <module name="PackageName">
+ <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$" />
+ <message key="name.invalidPattern" value="Package name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="TypeName">
+ <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF" />
+ <message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="MemberName">
+ <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$" />
+ <message key="name.invalidPattern" value="Member name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="ParameterName">
+ <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
+ <message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="LambdaParameterName">
+ <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
+ <message key="name.invalidPattern" value="Lambda parameter name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="CatchParameterName">
+ <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
+ <message key="name.invalidPattern" value="Catch parameter name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="LocalVariableName">
+ <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
+ <message key="name.invalidPattern" value="Local variable name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="ClassTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
+ <message key="name.invalidPattern" value="Class type name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="MethodTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
+ <message key="name.invalidPattern" value="Method type name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="InterfaceTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
+ <message key="name.invalidPattern" value="Interface type name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="NoFinalizer" />
+ <module name="GenericWhitespace">
+ <message key="ws.followed" value="GenericWhitespace ''{0}'' is followed by whitespace." />
+ <message key="ws.preceded" value="GenericWhitespace ''{0}'' is preceded with whitespace." />
+ <message key="ws.illegalFollow" value="GenericWhitespace ''{0}'' should followed by whitespace." />
+ <message key="ws.notPreceded" value="GenericWhitespace ''{0}'' is not preceded with whitespace." />
+ </module>
+ <module name="Indentation">
+ <property name="basicOffset" value="4" />
+ <property name="braceAdjustment" value="0" />
+ <property name="caseIndent" value="4" />
+ <property name="throwsIndent" value="4" />
+ <property name="lineWrappingIndentation" value="4" />
+ <property name="arrayInitIndent" value="4" />
+ </module>
+ <module name="AbbreviationAsWordInName">
+ <property name="ignoreFinal" value="false" />
+ <property name="allowedAbbreviationLength" value="1" />
+ <property name="tokens"
+ value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
+ PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF" />
+ </module>
+ <module name="OverloadMethodsDeclarationOrder" />
+ <module name="VariableDeclarationUsageDistance" />
+ <module name="CustomImportOrder">
+ <property name="sortImportsInGroupAlphabetically" value="true" />
+ <property name="separateLineBetweenGroups" value="true" />
+ <property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE" />
+ <property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF" />
+ </module>
+ <module name="MethodParamPad">
+ <property name="tokens"
+ value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
+ SUPER_CTOR_CALL, ENUM_CONSTANT_DEF" />
+ </module>
+ <module name="NoWhitespaceBefore">
+ <property name="tokens"
+ value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS,
+ LABELED_STAT, METHOD_REF" />
+ <property name="allowLineBreaks" value="true" />
+ </module>
+ <module name="ParenPad">
+ <property name="tokens"
+ value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
+ EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
+ LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
+ METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA" />
+ </module>
+ <module name="OperatorWrap">
+ <property name="option" value="NL" />
+ <property name="tokens"
+ value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
+ LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF " />
+ </module>
+ <module name="AnnotationLocation">
+ <property name="id" value="AnnotationLocationMostCases" />
+ <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF" />
+ </module>
+ <module name="AnnotationLocation">
+ <property name="id" value="AnnotationLocationVariables" />
+ <property name="tokens" value="VARIABLE_DEF" />
+ <property name="allowSamelineMultipleAnnotations" value="true" />
+ </module>
+ <module name="NonEmptyAtclauseDescription" />
+ <module name="InvalidJavadocPosition" />
+ <module name="JavadocTagContinuationIndentation" />
+ <module name="SummaryJavadoc">
+ <property name="forbiddenSummaryFragments"
+ value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )" />
+ </module>
+ <module name="JavadocParagraph" />
+ <module name="AtclauseOrder">
+ <property name="tagOrder" value="@param, @return, @throws, @deprecated" />
+ <property name="target"
+ value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF" />
+ </module>
+ <module name="JavadocMethod">
+ <property name="allowMissingParamTags" value="true" />
+ <property name="allowMissingReturnTag" value="true" />
+ <property name="allowedAnnotations" value="Override, Test" />
+ <property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF" />
+ </module>
+ <module name="MissingJavadocMethod">
+ <property name="minLineCount" value="2" />
+ <property name="allowedAnnotations" value="Override, Test" />
+ <property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF" />
+ <property name="ignoreMethodNamesRegex" value="^(test|before|after)[a-zA-Z0-9_]*$" />
+ </module>
+ <module name="MethodName">
+ <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$" />
+ <message key="name.invalidPattern" value="Method name ''{0}'' must match pattern ''{1}''." />
+ </module>
+ <module name="SingleLineJavadoc">
+ <property name="ignoreInlineTags" value="false" />
+ </module>
+ <module name="EmptyCatchBlock">
+ <property name="exceptionVariableName" value="expected" />
+ </module>
+ <module name="CommentsIndentation">
+ <property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN" />
+ </module>
+ <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
+ <module name="SuppressionXpathFilter">
+ <property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}"
+ default="checkstyle-xpath-suppressions.xml" />
+ <property name="optional" value="true" />
+ </module>
+ <module name="SuppressWarningsHolder"/>
+ <module name="FinalLocalVariable">
+ <property name="tokens" value="VARIABLE_DEF,PARAMETER_DEF"/>
+ <property name="validateEnhancedForLoopVariable" value="true"/>
+ </module>
+ <module name="UnusedImports"/>
+ </module>
+</module>
\ No newline at end of file
diff --git a/checkstyle/src/main/resources/cps-java-style.xml b/checkstyle/src/main/resources/cps-java-style.xml
deleted file mode 100644
index d10484c..0000000
--- a/checkstyle/src/main/resources/cps-java-style.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-============LICENSE_START=======================================================
- Copyright (C) 2020 Pantheon.tech
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
--->
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
-<module name="Checker">
- <property name="charset" value="UTF-8"/>
- <property name="severity" value="warning"/>
- <property name="fileExtensions" value="java, properties, xml"/>
-
- <module name="TreeWalker">
- <module name="FinalLocalVariable">
- <property name="tokens" value="VARIABLE_DEF,PARAMETER_DEF"/>
- <property name="validateEnhancedForLoopVariable" value="true"/>
- </module>
- <module name="UnusedImports"/>
- </module>
-</module>
diff --git a/cps-bom/pom.xml b/cps-bom/pom.xml
index 6521830..57de09b 100644
--- a/cps-bom/pom.xml
+++ b/cps-bom/pom.xml
@@ -31,7 +31,7 @@
<description>This artifact contains dependencyManagement declarations of all published CPS components.</description>
<properties>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
<sonar.skip>true</sonar.skip>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
@@ -43,7 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
+ <version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
@@ -53,12 +53,12 @@
<repository>
<id>ecomp-releases</id>
<name>ECOMP Release Repository</name>
- <url>${nexusproxy}${releaseNexusPath}</url>
+ <url>${onap.nexus.url}${releaseNexusPath}</url>
</repository>
<snapshotRepository>
<id>ecomp-snapshots</id>
<name>ECOMP Snapshot Repository</name>
- <url>${nexusproxy}${snapshotNexusPath}</url>
+ <url>${onap.nexus.url}${snapshotNexusPath}</url>
</snapshotRepository>
</distributionManagement>
diff --git a/cps-dependencies/pom.xml b/cps-dependencies/pom.xml
index a95e5f4..ad1828e 100644
--- a/cps-dependencies/pom.xml
+++ b/cps-dependencies/pom.xml
@@ -35,7 +35,7 @@
<properties>
<groovy.version>3.0.18</groovy.version>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
<sonar.skip>true</sonar.skip>
@@ -51,7 +51,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
+ <version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
@@ -61,12 +61,12 @@
<repository>
<id>ecomp-releases</id>
<name>ECOMP Release Repository</name>
- <url>${nexusproxy}${releaseNexusPath}</url>
+ <url>${onap.nexus.url}${releaseNexusPath}</url>
</repository>
<snapshotRepository>
<id>ecomp-snapshots</id>
<name>ECOMP Snapshot Repository</name>
- <url>${nexusproxy}${snapshotNexusPath}</url>
+ <url>${onap.nexus.url}${snapshotNexusPath}</url>
</snapshotRepository>
</distributionManagement>
diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml
index 99072c4..a8da693 100644
--- a/cps-ncmp-rest/docs/openapi/components.yaml
+++ b/cps-ncmp-rest/docs/openapi/components.yaml
@@ -366,7 +366,7 @@
type: array
items:
type: string
- description: targeted cm handles, maximum of 50 supported. If this limit is exceeded the request wil be refused.
+ description: targeted cm handle references, maximum of 200 supported. If this limit is exceeded the request wil be refused.
example: [ "da310eecdb8d44c2acc0ddaae01174b1","c748c58f8e0b438f9fd1f28370b17d47" ]
examples:
@@ -516,7 +516,7 @@
outputAlternateIdOptionInQuery:
name: outputAlternateId
in: query
- description: Boolean parameter to determine if returned value(s) will be cmHandle Ids or Alternate Ids for a given query
+ description: Boolean parameter to determine if returned value(s) will be cm handle references for a given query
required: false
schema:
type: boolean
diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml
index a3ddc3f..4624bc1 100755
--- a/cps-ncmp-rest/docs/openapi/ncmp.yml
+++ b/cps-ncmp-rest/docs/openapi/ncmp.yml
@@ -193,7 +193,7 @@
post:
tags:
- network-cm-proxy
- summary: Execute a data operation for group of cm handle ids
+ summary: Execute a data operation for group of cm handle references
description: This request will be handled asynchronously using messaging to the supplied topic. The rest response will be an acknowledge with a requestId to identify the relevant messages. A maximum of 200 cm handles per operation is supported.
operationId: executeDataOperationForCmHandles
parameters:
diff --git a/cps-ncmp-rest/pom.xml b/cps-ncmp-rest/pom.xml
index c78fe55..a7b2b76 100644
--- a/cps-ncmp-rest/pom.xml
+++ b/cps-ncmp-rest/pom.xml
@@ -35,6 +35,7 @@
<properties>
<minimum-coverage>0.99</minimum-coverage>
+ <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
</properties>
<dependencies>
@@ -211,6 +212,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
+ <version>${maven-resources-plugin.version}</version>
<executions>
<execution>
<id>copy-resources</id>
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DataOperationRequestMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DataOperationRequestMapper.java
index 42622a2..1e73aca 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DataOperationRequestMapper.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DataOperationRequestMapper.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
DataOperationRequest toDataOperationRequest(
org.onap.cps.ncmp.rest.model.DataOperationRequest dataOperationRequest);
- @Mapping(source = "targetIds", target = "cmHandleIds")
+ @Mapping(source = "targetIds", target = "cmHandleReferences")
DataOperationDefinition toDataOperationDefinition(
org.onap.cps.ncmp.rest.model.DataOperationDefinition dataOperationDefinition);
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java
index 7492c1f..f5804d7 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/DeprecationHelper.java
@@ -36,13 +36,19 @@
private final JsonObjectMapper jsonObjectMapper;
/**
- * Convert the old condition properties to the new schema.
- * !!! remove it after the old condition removed !!!
- * it only works for module names
+ * Converts the old condition properties from {@link CmHandleQueryParameters}
+ * to the new schema defined in {@link CmHandleQueryApiParameters}.
*
- * @deprecated this method will be removed in Release 12 (No Name know yet)
+ * <p>This method transforms the old module name-based condition properties to the new format.
+ * It should only be used for backward compatibility until the old conditions
+ * are removed in future releases.
*
- * @param cmHandleQueryParameters the original input parameter
+ * <p><b>Important:</b> This method will be removed in next release(release name not finalized yet).</p>
+ *
+ * @param cmHandleQueryParameters the original query parameters containing old condition properties
+ * @return an instance of {@link CmHandleQueryApiParameters} with the transformed condition properties
+ * @deprecated This method is deprecated and will be removed in Release 12.
+ * Use the new condition handling approach instead.
*/
@Deprecated
public CmHandleQueryApiParameters mapOldConditionProperties(
@@ -69,7 +75,6 @@
}
);
}
-
return cmHandleQueryApiParameters;
}
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/data/models/DataOperationDefinition.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/data/models/DataOperationDefinition.java
index d1ff1a5..79da44a 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/data/models/DataOperationDefinition.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/data/models/DataOperationDefinition.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,5 +45,5 @@
@JsonProperty("targetIds")
@Valid
- private List<String> cmHandleIds = new ArrayList<>();
+ private List<String> cmHandleReferences = new ArrayList<>();
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumer.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumer.java
index 9e90eab..2d1f648 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumer.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumer.java
@@ -46,7 +46,8 @@
private final EventsPublisher<CloudEvent> eventsPublisher;
/**
- * Incoming AvcEvent in the form of Consumer Record.
+ * Incoming Cm AvcEvent in the form of Consumer Record, it will be forwarded as is to a target topic.
+ * The key from incoming record will be used as key for the target topic as well to preserve the message ordering.
*
* @param cmAvcEventAsConsumerRecord Incoming raw consumer record
*/
@@ -55,7 +56,8 @@
public void consumeAndForward(
final ConsumerRecord<String, CloudEvent> cmAvcEventAsConsumerRecord) {
final CloudEvent outgoingAvcEvent = cmAvcEventAsConsumerRecord.value();
- log.debug("Consuming AVC event {} ...", outgoingAvcEvent);
- eventsPublisher.publishCloudEvent(cmEventsTopicName, outgoingAvcEvent.getId(), outgoingAvcEvent);
+ final String outgoingAvcEventKey = cmAvcEventAsConsumerRecord.key();
+ log.debug("Consuming AVC event with key : {} and value : {}", outgoingAvcEventKey, outgoingAvcEvent);
+ eventsPublisher.publishCloudEvent(cmEventsTopicName, outgoingAvcEventKey, outgoingAvcEvent);
}
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java
index 301b819..c4bdc1c 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java
@@ -139,10 +139,10 @@
final String requestId,
final String authorization) {
- final Set<String> cmHandlesIds = getDistinctCmHandleIds(dataOperationRequest);
+ final Set<String> cmHandlesReferences = getDistinctCmHandleReferences(dataOperationRequest);
final Collection<YangModelCmHandle> yangModelCmHandles
- = inventoryPersistence.getYangModelCmHandles(cmHandlesIds);
+ = inventoryPersistence.getYangModelCmHandlesFromCmHandleReferences(cmHandlesReferences);
final Map<String, List<DmiDataOperation>> operationsOutPerDmiServiceName
= DmiDataOperationsHelper.processPerDefinitionInDataOperationsRequest(topicParamInQuery,
@@ -246,10 +246,10 @@
}
}
- private static Set<String> getDistinctCmHandleIds(final DataOperationRequest dataOperationRequest) {
+ private static Set<String> getDistinctCmHandleReferences(final DataOperationRequest dataOperationRequest) {
return dataOperationRequest.getDataOperationDefinitions().stream()
.flatMap(dataOperationDefinition ->
- dataOperationDefinition.getCmHandleIds().stream()).collect(Collectors.toSet());
+ dataOperationDefinition.getCmHandleReferences().stream()).collect(Collectors.toSet());
}
private void asyncSendMultipleRequest(final String requestId, final String topicParamInQuery,
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/NcmpPassthroughResourceRequestHandler.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/NcmpPassthroughResourceRequestHandler.java
index a21210c..8920839 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/NcmpPassthroughResourceRequestHandler.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/NcmpPassthroughResourceRequestHandler.java
@@ -91,10 +91,10 @@
throw new InvalidDatastoreException(dataOperationDefinition.getDatastore()
+ " datastore is not supported");
}
- if (dataOperationDefinition.getCmHandleIds().size() > MAXIMUM_CM_HANDLES_PER_OPERATION) {
+ if (dataOperationDefinition.getCmHandleReferences().size() > MAXIMUM_CM_HANDLES_PER_OPERATION) {
final String errorMessage = String.format(PAYLOAD_TOO_LARGE_TEMPLATE,
dataOperationDefinition.getOperationId(),
- dataOperationDefinition.getCmHandleIds().size());
+ dataOperationDefinition.getCmHandleReferences().size());
throw new PayloadTooLargeException(errorMessage);
}
});
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java
index 3104be5..f1dc9af 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java
@@ -31,7 +31,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.stream.Collectors;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -71,8 +70,9 @@
final Map<String, List<DmiDataOperation>> dmiDataOperationsOutPerDmiServiceName = new HashMap<>();
final MultiValueMap<DmiDataOperation, Map<NcmpResponseStatus,
- List<String>>> cmHandleIdsPerResponseCodesPerOperation = new LinkedMultiValueMap<>();
- final Set<String> nonReadyCmHandleIdsLookup = filterAndGetNonReadyCmHandleIds(yangModelCmHandles);
+ List<String>>> cmHandleReferencesPerResponseCodesPerOperation = new LinkedMultiValueMap<>();
+ final Map<String, String> nonReadyCmHandleReferencesLookup =
+ filterAndGetNonReadyCmHandleReferences(yangModelCmHandles);
final Map<String, Map<String, Map<String, String>>> dmiPropertiesPerCmHandleIdPerServiceName =
DmiServiceNameOrganizer.getDmiPropertiesPerCmHandleIdPerServiceName(yangModelCmHandles);
@@ -84,17 +84,19 @@
for (final DataOperationDefinition dataOperationDefinitionIn :
dataOperationRequestIn.getDataOperationDefinitions()) {
- final List<String> nonExistingCmHandleIds = new ArrayList<>();
- final List<String> nonReadyCmHandleIds = new ArrayList<>();
- for (final String cmHandleId : dataOperationDefinitionIn.getCmHandleIds()) {
- if (nonReadyCmHandleIdsLookup.contains(cmHandleId)) {
- nonReadyCmHandleIds.add(cmHandleId);
+ final List<String> nonExistingCmHandleReferences = new ArrayList<>();
+ final List<String> nonReadyCmHandleReferences = new ArrayList<>();
+ for (final String cmHandleReference : dataOperationDefinitionIn.getCmHandleReferences()) {
+ if (nonReadyCmHandleReferencesLookup.containsKey(cmHandleReference)
+ || nonReadyCmHandleReferencesLookup.containsValue(cmHandleReference)) {
+ nonReadyCmHandleReferences.add(cmHandleReference);
} else {
+ final String cmHandleId = getCmHandleId(cmHandleReference, yangModelCmHandles);
final String dmiServiceName = dmiServiceNamesPerCmHandleId.get(cmHandleId);
final Map<String, String> cmHandleIdProperties
= dmiPropertiesPerCmHandleIdPerServiceName.get(dmiServiceName).get(cmHandleId);
if (cmHandleIdProperties == null) {
- nonExistingCmHandleIds.add(cmHandleId);
+ nonExistingCmHandleReferences.add(cmHandleReference);
} else {
final DmiDataOperation dmiBatchOperationOut = getOrAddDmiBatchOperation(dmiServiceName,
dataOperationDefinitionIn, dmiDataOperationsOutPerDmiServiceName);
@@ -105,14 +107,14 @@
}
}
}
- populateCmHandleIdsPerOperationIdPerResponseCode(cmHandleIdsPerResponseCodesPerOperation,
+ populateCmHandleIdsPerOperationIdPerResponseCode(cmHandleReferencesPerResponseCodesPerOperation,
DmiDataOperation.buildDmiDataOperationRequestBodyWithoutCmHandles(dataOperationDefinitionIn),
- CM_HANDLES_NOT_FOUND, nonExistingCmHandleIds);
- populateCmHandleIdsPerOperationIdPerResponseCode(cmHandleIdsPerResponseCodesPerOperation,
+ CM_HANDLES_NOT_FOUND, nonExistingCmHandleReferences);
+ populateCmHandleIdsPerOperationIdPerResponseCode(cmHandleReferencesPerResponseCodesPerOperation,
DmiDataOperation.buildDmiDataOperationRequestBodyWithoutCmHandles(dataOperationDefinitionIn),
- CM_HANDLES_NOT_READY, nonReadyCmHandleIds);
+ CM_HANDLES_NOT_READY, nonReadyCmHandleReferences);
}
- publishErrorMessageToClientTopic(topicParamInQuery, requestId, cmHandleIdsPerResponseCodesPerOperation);
+ publishErrorMessageToClientTopic(topicParamInQuery, requestId, cmHandleReferencesPerResponseCodesPerOperation);
return dmiDataOperationsOutPerDmiServiceName;
}
@@ -182,10 +184,26 @@
return dmiBatchOperationsOut.get(dmiBatchOperationsOut.size() - 1);
}
- private static Set<String> filterAndGetNonReadyCmHandleIds(final Collection<YangModelCmHandle> yangModelCmHandles) {
- return yangModelCmHandles.stream()
- .filter(yangModelCmHandle -> yangModelCmHandle.getCompositeState().getCmHandleState()
- != CmHandleState.READY).map(YangModelCmHandle::getId).collect(Collectors.toSet());
+ private static Map<String, String> filterAndGetNonReadyCmHandleReferences(
+ final Collection<YangModelCmHandle> yangModelCmHandles) {
+ final Map<String, String> cmHandleReferenceMap = new HashMap<>(yangModelCmHandles.size());
+ for (final YangModelCmHandle yangModelCmHandle: yangModelCmHandles) {
+ if (yangModelCmHandle.getCompositeState().getCmHandleState() != CmHandleState.READY) {
+ cmHandleReferenceMap.put(yangModelCmHandle.getId(), yangModelCmHandle.getAlternateId());
+ }
+ }
+ return cmHandleReferenceMap;
+ }
+
+ private static String getCmHandleId(final String cmHandleReference,
+ final Collection<YangModelCmHandle> yangModelCmHandles) {
+ for (final YangModelCmHandle yangModelCmHandle: yangModelCmHandles) {
+ if (cmHandleReference.equals(yangModelCmHandle.getId())
+ || cmHandleReference.equals(yangModelCmHandle.getAlternateId())) {
+ return yangModelCmHandle.getId();
+ }
+ }
+ return cmHandleReference;
}
private static void populateCmHandleIdsPerOperationIdPerResponseCode(final MultiValueMap<DmiDataOperation,
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java
index 850edf7..de8e8e8 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java
@@ -72,6 +72,14 @@
Collection<YangModelCmHandle> getYangModelCmHandles(Collection<String> cmHandleIds);
/**
+ * This method retrieves DMI service name, DMI properties and the state for a given list of cm handle references.
+ *
+ * @param cmHandleReferences a list of the ids of the cm handles
+ * @return collection of yang model cm handles
+ */
+ Collection<YangModelCmHandle> getYangModelCmHandlesFromCmHandleReferences(Collection<String> cmHandleReferences);
+
+ /**
* Method to return module definitions by cmHandleId.
*
* @param cmHandleId cm handle ID
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java
index 655d843..d73fae9 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java
@@ -22,6 +22,7 @@
package org.onap.cps.ncmp.impl.inventory;
+import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
import com.google.common.collect.Lists;
@@ -33,6 +34,7 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataService;
@@ -133,6 +135,19 @@
}
@Override
+ public Collection<YangModelCmHandle> getYangModelCmHandlesFromCmHandleReferences(
+ final Collection<String> cmHandleReferences) {
+
+ final String cpsPathForCmHandlesByReferences = getCpsPathForCmHandlesByReferences(cmHandleReferences);
+
+ final Collection<DataNode> cmHandlesAsDataNodes =
+ cmHandleQueryService.queryNcmpRegistryByCpsPath(
+ cpsPathForCmHandlesByReferences, INCLUDE_ALL_DESCENDANTS);
+
+ return YangDataConverter.toYangModelCmHandles(cmHandlesAsDataNodes);
+ }
+
+ @Override
public Collection<ModuleDefinition> getModuleDefinitionsByCmHandleId(final String cmHandleId) {
return cpsModuleService.getModuleDefinitionsByAnchorName(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, cmHandleId);
}
@@ -190,7 +205,8 @@
return Collections.emptyList();
}
final String cpsPathForCmHandlesByAlternateIds = getCpsPathForCmHandlesByAlternateIds(alternateIds);
- return cmHandleQueryService.queryNcmpRegistryByCpsPath(cpsPathForCmHandlesByAlternateIds, OMIT_DESCENDANTS);
+ return cmHandleQueryService.queryNcmpRegistryByCpsPath(cpsPathForCmHandlesByAlternateIds,
+ INCLUDE_ALL_DESCENDANTS);
}
@Override
@@ -234,6 +250,12 @@
NCMP_DMI_REGISTRY_PARENT + "/cm-handles[@alternate-id='", "']"));
}
+ private String getCpsPathForCmHandlesByReferences(final Collection<String> cmHandleReferences) {
+ return cmHandleReferences.stream()
+ .flatMap(id -> Stream.of("@id='" + id + "'", "@alternate-id='" + id + "'"))
+ .collect(Collectors.joining(" or ", NCMP_DMI_REGISTRY_PARENT + "/cm-handles[", "]"));
+ }
+
private static String createStateJsonData(final String state) {
return "{\"state\":" + state + "}";
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java
index 8ae942e..eefabd1 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/http/WebClientConfiguration.java
@@ -57,7 +57,7 @@
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, serviceConfig.getConnectionTimeoutInSeconds() * 1000)
.doOnConnected(connection -> connection.addHandlerLast(new ReadTimeoutHandler(
serviceConfig.getReadTimeoutInSeconds(), TimeUnit.SECONDS)).addHandlerLast(
- new WriteTimeoutHandler(serviceConfig.getWriteTimeoutInSeconds(), TimeUnit.SECONDS)))
+ new WriteTimeoutHandler(serviceConfig.getWriteTimeoutInSeconds(), TimeUnit.SECONDS)))
.resolver(DefaultAddressResolverGroup.INSTANCE)
.compress(true);
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumerSpec.groovy
index 06651be..ad5f42e 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumerSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/cmavc/CmAvcEventConsumerSpec.groovy
@@ -64,6 +64,7 @@
cloudEventKafkaConsumer.subscribe([cmEventsTopicName] as List<String>)
and: 'an event is sent'
def jsonData = TestUtils.getResourceFileContent('sampleAvcInputEvent.json')
+ def testEventKey = 'sample-eventid-key'
def testEventSent = jsonObjectMapper.convertJsonString(jsonData, AvcEvent.class)
def testCloudEventSent = CloudEventBuilder.v1()
.withData(jsonObjectMapper.asJsonBytes(testEventSent))
@@ -72,17 +73,19 @@
.withSource(URI.create('sample-test-source'))
.withExtension('correlationid', 'test-cmhandle1').build()
and: 'event has header information'
- def consumerRecord = new ConsumerRecord<String, CloudEvent>(cmEventsTopicName, 0, 0, 'sample-eventid', testCloudEventSent)
- when: 'the event is consumed'
+ def consumerRecord = new ConsumerRecord<String, CloudEvent>(cmEventsTopicName, 0, 0, testEventKey, testCloudEventSent)
+ when: 'the event is consumed and forwarded to target topic'
acvEventConsumer.consumeAndForward(consumerRecord)
- and: 'the topic is polled'
+ and: 'the target topic is polled'
def records = cloudEventKafkaConsumer.poll(Duration.ofMillis(1500))
then: 'poll returns one record'
assert records.size() == 1
- and: 'record can be converted to AVC event'
+ and: 'target record can be converted to AVC event'
def record = records.iterator().next()
def cloudEvent = record.value() as CloudEvent
def convertedAvcEvent = toTargetEvent(cloudEvent, AvcEvent.class)
+ and: 'the target event has the same key as the source event to maintain the ordering in a partition'
+ assert record.key() == consumerRecord.key()
and: 'we have correct headers forwarded where correlation id matches'
assert KafkaHeaders.getParsedKafkaHeader(record.headers(), 'ce_correlationid') == 'test-cmhandle1'
and: 'event id is same between consumed and forwarded'
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy
index fd76abb..b046c12 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy
@@ -112,7 +112,7 @@
mockYangModelCmHandleCollectionRetrieval([yangModelCmHandleProperty])
def dataOperationBatchRequestJsonData = TestUtils.getResourceFileContent('dataOperationRequest.json')
def dataOperationRequest = spiedJsonObjectMapper.convertJsonString(dataOperationBatchRequestJsonData, DataOperationRequest.class)
- dataOperationRequest.dataOperationDefinitions[0].cmHandleIds = [cmHandleId]
+ dataOperationRequest.dataOperationDefinitions[0].cmHandleReferences = [cmHandleId]
and: 'a positive response from DMI service when it is called with valid request parameters'
def responseFromDmi = Mono.just(new ResponseEntity<Object>(HttpStatus.ACCEPTED))
def expectedUrlTemplateWithVariables = new UrlTemplateParameters('myServiceName/dmi/v1/data?requestId={requestId}&topic={topic}', ['requestId': 'requestId', 'topic': 'my-topic-name'])
@@ -129,7 +129,7 @@
mockYangModelCmHandleCollectionRetrieval([yangModelCmHandleProperty])
def dataOperationBatchRequestJsonData = TestUtils.getResourceFileContent('dataOperationRequest.json')
def dataOperationRequest = spiedJsonObjectMapper.convertJsonString(dataOperationBatchRequestJsonData, DataOperationRequest.class)
- dataOperationRequest.dataOperationDefinitions[0].cmHandleIds = [cmHandleId]
+ dataOperationRequest.dataOperationDefinitions[0].cmHandleReferences = [cmHandleId]
and: 'the published cloud event will be captured'
def actualDataOperationCloudEvent = null
eventsPublisher.publishCloudEvent('my-topic-name', 'my-request-id', _) >> { args -> actualDataOperationCloudEvent = args[2] }
@@ -143,7 +143,7 @@
assert eventDataValue.statusMessage == UNKNOWN_ERROR.message
and: 'the event contains the correct operation details'
assert eventDataValue.operationId == dataOperationRequest.dataOperationDefinitions[0].operationId
- assert eventDataValue.ids == dataOperationRequest.dataOperationDefinitions[0].cmHandleIds
+ assert eventDataValue.ids == dataOperationRequest.dataOperationDefinitions[0].cmHandleReferences
}
def 'call get all resource data.'() {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/NcmpDatastoreRequestHandlerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/NcmpDatastoreRequestHandlerSpec.groovy
index d5db24c..d5f705f 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/NcmpDatastoreRequestHandlerSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/NcmpDatastoreRequestHandlerSpec.groovy
@@ -73,7 +73,7 @@
and: 'notification feature is turned on/off'
objectUnderTest.notificationFeatureEnabled = notificationFeatureEnabled
when: 'data operation request is executed'
- def dataOperationDefinition = new DataOperationDefinition(operation: 'read', datastore: 'ncmp-datastore:passthrough-running', cmHandleIds: ['ch'])
+ def dataOperationDefinition = new DataOperationDefinition(operation: 'read', datastore: 'ncmp-datastore:passthrough-running', cmHandleReferences: ['ch'])
def result = objectUnderTest.executeAsynchronousRequest('someTopic', new DataOperationRequest(dataOperationDefinitions:[dataOperationDefinition]), NO_AUTH_HEADER)
then: 'the task is executed in an async fashion or not'
expectedCalls * dmiDataOperations.requestResourceDataFromDmi('someTopic', _, _, NO_AUTH_HEADER)
@@ -120,7 +120,7 @@
given: 'a data operation definition with too many cm handles'
def tooMany = objectUnderTest.MAXIMUM_CM_HANDLES_PER_OPERATION + 1
def cmHandleIds = new String[tooMany]
- def dataOperationDefinition = new DataOperationDefinition(operationId: 'abc', operation: 'read', datastore: 'ncmp-datastore:passthrough-running', cmHandleIds: cmHandleIds)
+ def dataOperationDefinition = new DataOperationDefinition(operationId: 'abc', operation: 'read', datastore: 'ncmp-datastore:passthrough-running', cmHandleReferences: cmHandleIds)
when: 'data operation request is executed'
objectUnderTest.executeAsynchronousRequest('someTopic', new DataOperationRequest(dataOperationDefinitions:[dataOperationDefinition]), NO_AUTH_HEADER)
then: 'a payload too large exception is thrown'
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelperSpec.groovy
index 84eafb0..77e2c4f 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelperSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelperSpec.groovy
@@ -74,15 +74,16 @@
assert dmiDataOperationRequestBodyAsJsonNode.get('operationId').asText() == expectedOperationId
assert dmiDataOperationRequestBodyAsJsonNode.get('datastore').asText() == expectedDatastore
and: 'the correct cm handles (just for #serviceName)'
- assert dmiDataOperationRequestBodyAsJsonNode.get('cmHandles').size() == expectedCmHandleIds.size()
- expectedCmHandleIds.each {
+ assert dmiDataOperationRequestBodyAsJsonNode.get('cmHandles').size() == expectedCmHandleReferences.size()
+ expectedCmHandleReferences.each {
dmiDataOperationRequestBodyAsJsonNode.get('cmHandles').toString().contains(it)
}
where: 'the following dmi service and operations are checked'
- serviceName | operationIndex || expectedOperationId | expectedDatastore | expectedCmHandleIds
+ serviceName | operationIndex || expectedOperationId | expectedDatastore | expectedCmHandleReferences
'dmi1' | 0 || 'operational-14' | 'ncmp-datastore:passthrough-operational' | ['ch6-dmi1']
'dmi1' | 1 || 'running-12' | 'ncmp-datastore:passthrough-running' | ['ch1-dmi1', 'ch2-dmi1']
'dmi1' | 2 || 'operational-15' | 'ncmp-datastore:passthrough-operational' | ['ch6-dmi1']
+ 'dmi1' | 3 || 'operational-16' | 'ncmp-datastore:passthrough-operational' | ['alt6-dmi1']
'dmi2' | 0 || 'operational-14' | 'ncmp-datastore:passthrough-operational' | ['ch3-dmi2']
'dmi2' | 1 || 'running-12' | 'ncmp-datastore:passthrough-running' | ['ch7-dmi2']
'dmi2' | 2 || 'operational-15' | 'ncmp-datastore:passthrough-operational' | ['ch4-dmi2']
@@ -137,14 +138,14 @@
def dmiProperties = [new YangModelCmHandle.Property('prop', 'some DMI property')]
def readyState = new CompositeStateBuilder().withCmHandleState(READY).withLastUpdatedTimeNow().build()
def advisedState = new CompositeStateBuilder().withCmHandleState(ADVISED).withLastUpdatedTimeNow().build()
- return [new YangModelCmHandle(id: 'ch1-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch2-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch6-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch8-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch3-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch4-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch7-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'non-ready-cm-handle', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: advisedState)
+ return [new YangModelCmHandle(id: 'ch1-dmi1', 'alternateId': 'alt1-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch2-dmi1', 'alternateId': 'alt2-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch6-dmi1', 'alternateId': 'alt6-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch8-dmi1', 'alternateId': 'alt8-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch3-dmi2', 'alternateId': 'alt3-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch4-dmi2', 'alternateId': 'alt4-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch7-dmi2', 'alternateId': 'alt7-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'non-ready-cm-handle', 'alternateId': 'non-ready-alternate', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: advisedState)
]
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy
index 65fda87..d00d3ab 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/dmi/DmiOperationsBaseSpec.groovy
@@ -61,7 +61,7 @@
def mockYangModelCmHandleCollectionRetrieval(dmiProperties) {
populateYangModelCmHandle(dmiProperties, '')
- mockInventoryPersistence.getYangModelCmHandles(_) >> [yangModelCmHandle]
+ mockInventoryPersistence.getYangModelCmHandlesFromCmHandleReferences(_) >> [yangModelCmHandle]
}
def populateYangModelCmHandle(dmiProperties, moduleSetTag) {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy
index e2261f4..34d9374 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy
@@ -38,7 +38,6 @@
import org.onap.cps.spi.model.ModuleReference
import org.onap.cps.utils.ContentType
import org.onap.cps.utils.JsonObjectMapper
-import org.testcontainers.shaded.com.fasterxml.jackson.databind.introspect.BasicClassIntrospector
import spock.lang.Shared
import spock.lang.Specification
@@ -75,12 +74,16 @@
.format(OffsetDateTime.of(2022, 12, 31, 20, 30, 40, 1, ZoneOffset.UTC))
def cmHandleId = 'some-cm-handle'
- def leaves = ["id":cmHandleId,"dmi-service-name":"common service name","dmi-data-service-name":"data service name","dmi-model-service-name":"model service name"]
+ def alternateId = 'some-alternate-id'
+ def leaves = ["id":cmHandleId, "alternateId":alternateId,"dmi-service-name":"common service name","dmi-data-service-name":"data service name","dmi-model-service-name":"model service name"]
def xpath = "/dmi-registry/cm-handles[@id='some-cm-handle']"
def cmHandleId2 = 'another-cm-handle'
+ def alternateId2 = 'another-alternate-id'
def xpath2 = "/dmi-registry/cm-handles[@id='another-cm-handle']"
+ def dataNode = new DataNode(xpath: "/dmi-registry/cm-handles[@id='some cm handle']/additional-properties[@name='name1']", leaves: ["name":"name1", "value":"value1"])
+
@Shared
def childDataNodesForCmHandleWithAllProperties = [new DataNode(xpath: "/dmi-registry/cm-handles[@id='some cm handle']/additional-properties[@name='name1']", leaves: ["name":"name1", "value":"value1"]),
new DataNode(xpath: "/dmi-registry/cm-handles[@id='some cm handle']/public-properties[@name='name2']", leaves: ["name":"name2","value":"value2"])]
@@ -135,7 +138,7 @@
1 * mockCpsValidator.validateNameCharacters(cmHandleId)
}
- def "Retrieve multiple YangModelCmHandles"() {
+ def "Retrieve multiple YangModelCmHandles using cm handle ids"() {
given: 'the cps data service returns 2 data nodes from the DMI registry'
def dataNodes = [new DataNode(xpath: xpath, leaves: ['id': cmHandleId]), new DataNode(xpath: xpath2, leaves: ['id': cmHandleId2])]
mockCpsDataService.getDataNodesForMultipleXpaths(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, [xpath, xpath2] , INCLUDE_ALL_DESCENDANTS) >> dataNodes
@@ -146,6 +149,17 @@
assert results.id.containsAll([cmHandleId, cmHandleId2])
}
+ def "Retrieve multiple YangModelCmHandles using cm handle references"() {
+ given: 'the cps data service returns 2 data nodes from the DMI registry'
+ def dataNodes = [new DataNode(xpath: xpath, leaves: ['id': cmHandleId, 'alternate-id':alternateId]), new DataNode(xpath: xpath2, leaves: ['id': cmHandleId2,'alternate-id':alternateId2])]
+ mockCmHandleQueries.queryNcmpRegistryByCpsPath(_, INCLUDE_ALL_DESCENDANTS) >> dataNodes
+ when: 'retrieving the yang modelled cm handle'
+ def results = objectUnderTest.getYangModelCmHandlesFromCmHandleReferences([cmHandleId, cmHandleId2])
+ then: 'verify both have returned and cmhandleIds are correct'
+ assert results.size() == 2
+ assert results.id.containsAll([cmHandleId, cmHandleId2])
+ }
+
def 'Get a Cm Handle Composite State'() {
given: 'a valid cm handle id'
def cmHandleId = 'Some-Cm-Handle'
@@ -317,15 +331,6 @@
assert thrownException.getMessage().contains('DataNode not found')
}
- def 'Get multiple cm handle data nodes by alternate ids'() {
- given: 'expected xPath to get cmHandle data node'
- def expectedXPath = "/dmi-registry/cm-handles[@alternate-id='A' or @alternate-id='B']"
- when: 'getting the cm handle data node'
- objectUnderTest.getCmHandleDataNodesByAlternateIds(['A', 'B'])
- then: 'query service is invoked with expected xpath'
- 1 * mockCmHandleQueries.queryNcmpRegistryByCpsPath(expectedXPath, OMIT_DESCENDANTS)
- }
-
def 'Get multiple cm handle data nodes by alternate ids, passing empty collection'() {
when: 'getting the cm handle data node for no alternate ids'
objectUnderTest.getCmHandleDataNodesByAlternateIds([])
@@ -372,4 +377,13 @@
then: 'the cps data service method to delete data nodes is invoked once with the same xPaths'
1 * mockCpsDataService.deleteDataNodes(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, ['xpath1', 'xpath2'], NO_TIMESTAMP);
}
+
+ def 'Check if cm handle exists for a given cm handle id'() {
+ given: 'data service returns a datanode with correct cm handle id'
+ mockCpsDataService.getDataNodes(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, xpath, INCLUDE_ALL_DESCENDANTS) >> [dataNode]
+ when: 'method is called to check if cm handle exists from cm handle id'
+ def result = objectUnderTest.isExistingCmHandleId('some-cm-handle')
+ then: 'check if cm handle id in datanode is equal to given cm handle id'
+ assert result == true
+ }
}
diff --git a/cps-ncmp-service/src/test/resources/dataOperationRequest.json b/cps-ncmp-service/src/test/resources/dataOperationRequest.json
index f69b876..3faaf2b 100644
--- a/cps-ncmp-service/src/test/resources/dataOperationRequest.json
+++ b/cps-ncmp-service/src/test/resources/dataOperationRequest.json
@@ -36,6 +36,17 @@
"ch4-dmi2",
"ch6-dmi1"
]
+ },
+ {
+ "operation": "read",
+ "operationId": "operational-16",
+ "datastore": "ncmp-datastore:passthrough-operational",
+ "options": "some option",
+ "resourceIdentifier": "some resource identifier",
+ "targetIds": [
+ "ch4-dmi2",
+ "alt6-dmi1"
+ ]
}
]
}
diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml
index a83278d..12103ed 100644
--- a/cps-parent/pom.xml
+++ b/cps-parent/pom.xml
@@ -22,33 +22,96 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>3.2.0</version>
- <relativePath/>
- </parent>
- <modelVersion>4.0.0</modelVersion>
+ <!-- Project Metadata -->
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
<version>3.5.5-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
+ <!-- Set UTF-8 encoding for consistent builds across platforms -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <!-- Application Configuration -->
<app>org.onap.cps.Application</app>
- <java.version>17</java.version>
- <minimum-coverage>1.00</minimum-coverage>
- <postgres.version>42.5.1</postgres.version>
+ <!-- Parent Directory Configuration -->
+ <parent.directory>${project.basedir}/..</parent.directory>
+
+ <!-- Global properties for version management -->
+ <bug.pattern.version>1.5.0</bug.pattern.version>
+ <dependency.check.version>9.2.0</dependency.check.version>
+ <git.commit.id.version>9.0.1</git.commit.id.version>
+ <gmavenplus.plugin.version>4.0.1</gmavenplus.plugin.version>
+ <jacoco.version>0.8.11</jacoco.version>
+ <java.version>17</java.version>
+ <jsonschema2pojo.maven.plugin.version>1.2.1</jsonschema2pojo.maven.plugin.version>
+ <maven.checkstyle.plugin.version>3.3.1</maven.checkstyle.plugin.version>
+ <maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
+ <maven.compiler.release>17</maven.compiler.release>
+ <maven.failsafe.plugin.version>3.5.2</maven.failsafe.plugin.version>
+ <maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
+ <maven.site.plugin.version>4.0.0-M13</maven.site.plugin.version>
+ <maven.surefire.plugin.version>3.3.1</maven.surefire.plugin.version>
+ <postgres.version>42.5.1</postgres.version>
+ <slf4j.simple.version>2.0.6</slf4j.simple.version>
+ <sonar.version>4.0.0.4121</sonar.version>
+ <spotbugs.plugin.version>4.8.6.4</spotbugs.plugin.version>
+ <spotbugs.version>4.8.6</spotbugs.version>
+ <spring.boot.maven.plugin.version>3.3.1</spring.boot.maven.plugin.version>
+ <swagger.codegen.version>1.2.1</swagger.codegen.version>
+
+ <!-- Reporting paths and coverage -->
+ <jacoco.execFile>${project.build.directory}/code-coverage/jacoco-ut.exec</jacoco.execFile>
+ <jacoco.outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</jacoco.outputDirectory>
<jacoco.reportDirectory.aggregate>${project.reporting.outputDirectory}/jacoco-aggregate</jacoco.reportDirectory.aggregate>
+ <minimum-coverage>1.00</minimum-coverage>
<sonar.coverage.jacoco.xmlReportPaths>
../jacoco-report/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
- <parent.directory>${project.basedir}/..</parent.directory>
- <maven.compiler.release>17</maven.compiler.release>
+
+ <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
+ <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
+ <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
</properties>
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>ECOMP Release Repository</name>
+ <url>${onap.nexus.url}${releaseNexusPath}</url>
+ </repository>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>ECOMP Snapshot Repository</name>
+ <url>${onap.nexus.url}${snapshotNexusPath}</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <!-- Dependency Management, Profiles, Build, and Plugins -->
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>cps-dependencies</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>cps-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<profiles>
<profile>
<id>Windows</id>
@@ -72,27 +135,57 @@
<script.executor>python3</script.executor>
</properties>
</profile>
+ <profile>
+ <id>dependency-vulnerability-check</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.owasp</groupId>
+ <artifactId>dependency-check-maven</artifactId>
+ <version>${dependency.check.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <!-- Performance tests are run with maven-failsafe-plugin using a separate profile, so they will
+ not affect Jacoco coverage. Heap size is set here to ensure consistent test environment. -->
+ <profile>
+ <id>include-performance</id>
+ <properties>
+ <failsafeArgLine>-Xms512m -Xmx512m</failsafeArgLine>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven.failsafe.plugin.version}</version>
+ <configuration>
+ <includes>
+ <include>**/*PerfTest.java</include>
+ </includes>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.cps</groupId>
- <artifactId>cps-dependencies</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.cps</groupId>
- <artifactId>cps-bom</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<build>
<resources>
<resource>
@@ -118,7 +211,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>3.2.4</version>
+ <version>${spring.boot.maven.plugin.version}</version>
<executions>
<execution>
<goals>
@@ -130,7 +223,7 @@
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
- <version>9.0.0</version>
+ <version>${git.commit.id.version}</version>
<executions>
<execution>
<id>get-git-info</id>
@@ -141,11 +234,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>3.0.0-M5</version>
- </plugin>
<!-- Swagger code generation. -->
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
@@ -167,12 +255,12 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
- <version>4.8.6.4</version>
+ <version>${spotbugs.plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
- <version>4.8.6</version>
+ <version>${spotbugs.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -183,7 +271,7 @@
<!-- The SpotBugs Maven plugin uses SLF4J 1.8 beta 2 -->
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>2.0.6</version>
+ <version>${slf4j.simple.version}</version>
</dependency>
</dependencies>
<configuration>
@@ -191,7 +279,7 @@
<plugin>
<groupId>jp.skypencil.findbugs.slf4j</groupId>
<artifactId>bug-pattern</artifactId>
- <version>1.5.0</version>
+ <version>${bug.pattern.version}</version>
</plugin>
</plugins>
<!--
@@ -228,7 +316,7 @@
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
- <version>1.2.1</version>
+ <version>${jsonschema2pojo.maven.plugin.version}</version>
<configuration>
<targetVersion>${java.version}</targetVersion>
</configuration>
@@ -246,11 +334,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.11.0</version>
+ <version>${maven.compiler.plugin.version}</version>
+ <configuration>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${maven.checkstyle.plugin.version}</version>
<executions>
<execution>
<id>onap-license</id>
@@ -259,7 +351,7 @@
</goals>
<phase>process-sources</phase>
<configuration>
- <configLocation>onap-checkstyle/check-license.xml</configLocation>
+ <configLocation>cps-checkstyle/check-license.xml</configLocation>
<includeResources>false</includeResources>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<includeTestResources>false</includeTestResources>
@@ -272,13 +364,13 @@
</configuration>
</execution>
<execution>
- <id>onap-java-style</id>
+ <id>cps-java-style</id>
<goals>
<goal>check</goal>
</goals>
<phase>process-sources</phase>
<configuration>
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+ <configLocation>cps-checkstyle/cps-java-style.xml</configLocation>
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
</sourceDirectories>
@@ -290,33 +382,9 @@
<failOnViolation>true</failOnViolation>
</configuration>
</execution>
- <execution>
- <id>cps-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <configLocation>cps-java-style.xml</configLocation>
- <sourceDirectories>
- <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
- </sourceDirectories>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <consoleOutput>true</consoleOutput>
- <violationSeverity>warning</violationSeverity>
- <failOnViolation>true</failOnViolation>
- </configuration>
- </execution>
</executions>
<dependencies>
<dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>3.2.0</version>
- </dependency>
- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>checkstyle</artifactId>
<version>${project.version}</version>
@@ -329,7 +397,7 @@
To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
- <version>1.9.0</version>
+ <version>${gmavenplus.plugin.version}</version>
<executions>
<execution>
<goals>
@@ -343,6 +411,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>${maven.surefire.plugin.version}</version>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<argLine>${surefireArgLine}</argLine>
@@ -371,17 +440,18 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.10</version>
+ <version>${jacoco.version}</version>
<configuration>
- <!--All exclusions below are referring to generated code-->
+ <!-- Exclude all generated classes or specific patterns if necessary -->
<excludes>
- <exclude>org/onap/cps/event/model/*</exclude>
+ <exclude>org/onap/cps/events/model/*</exclude>
<exclude>org/onap/cps/rest/model/*</exclude>
<exclude>org/onap/cps/cpspath/parser/antlr4/*</exclude>
<exclude>org/onap/cps/ncmp/rest/model/*</exclude>
<exclude>org/onap/cps/**/*MapperImpl.class</exclude>
<exclude>org/onap/cps/ncmp/rest/stub/*</exclude>
<exclude>org/onap/cps/policyexecutor/stub/model/*</exclude>
+ <exclude>**/pom.xml</exclude>
</excludes>
</configuration>
<executions>
@@ -390,14 +460,19 @@
<goals>
<goal>prepare-agent</goal>
</goals>
+ <configuration>
+ <destFile>${jacoco.execFile}</destFile>
+ <propertyName>surefireArgLine</propertyName>
+ </configuration>
</execution>
<execution>
<id>coverage-check</id>
+ <phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
- <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
+ <dataFile>${jacoco.execFile}</dataFile>
<rules>
<rule>
<element>BUNDLE</element>
@@ -412,17 +487,48 @@
</rules>
</configuration>
</execution>
+ <execution>
+ <id>post-unit-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <outputEncoding>${project.reporting.outputEncoding}</outputEncoding>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${jacoco.execFile}</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${jacoco.outputDirectory}</outputDirectory>
+ </configuration>
+ </execution>
</executions>
</plugin>
- <plugin>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-maven-plugin</artifactId>
- </plugin>
+
+ <!-- Sonar Plugin for Code Quality -->
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
- <version>3.9.1.2184</version>
+ <version>${sonar.version}</version>
+ </plugin>
+
+ <!-- Maven Site Plugin for Site Generation -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>${maven.site.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>default-site</id>
+ <phase>site</phase>
+ <goals><goal>site</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>3.1.2</version>
</plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
diff --git a/cps-path-parser/pom.xml b/cps-path-parser/pom.xml
index 57b1e6b..b876c48 100644
--- a/cps-path-parser/pom.xml
+++ b/cps-path-parser/pom.xml
@@ -82,30 +82,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>%regex[.*PerfTest.*]</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>include-performance</id>
- </profile>
- </profiles>
-
</project>
diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml
index 71395c2..f270a58 100644
--- a/cps-rest/pom.xml
+++ b/cps-rest/pom.xml
@@ -31,6 +31,10 @@
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
+ <properties>
+ <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
+ </properties>
+
<artifactId>cps-rest</artifactId>
<dependencies>
@@ -177,6 +181,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
+ <version>${maven-resources-plugin.version}</version>
<executions>
<execution>
<id>copy-resources</id>
diff --git a/cps-ri/src/main/resources/changelog/changelog-master.yaml b/cps-ri/src/main/resources/changelog/changelog-master.yaml
index 5909ef1..2011655 100644
--- a/cps-ri/src/main/resources/changelog/changelog-master.yaml
+++ b/cps-ri/src/main/resources/changelog/changelog-master.yaml
@@ -20,3 +20,5 @@
file: changelog/db/changes/01-createCPSTables.yaml
- include:
file: changelog/db/changes/22-fragment-id-sequence.yaml
+ - include:
+ file: changelog/db/changes/23-yang-resource-index.yaml
diff --git a/cps-ri/src/main/resources/changelog/db/changes/23-yang-resource-index.yaml b/cps-ri/src/main/resources/changelog/db/changes/23-yang-resource-index.yaml
new file mode 100644
index 0000000..0dff471
--- /dev/null
+++ b/cps-ri/src/main/resources/changelog/db/changes/23-yang-resource-index.yaml
@@ -0,0 +1,31 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2024 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+databaseChangeLog:
+ - changeSet:
+ author: cps
+ id: 23
+ changes:
+ - createIndex:
+ columns:
+ - column:
+ name: module_name
+ - column:
+ name: revision
+ indexName: IDX_YANG_RESOURCE_MODULE_NAME_AND_REVISION
+ tableName: yang_resource
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java
index 931209c..bbfe496 100644
--- a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java
+++ b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java
@@ -178,8 +178,8 @@
* an attribute key-value pair used in the WHERE clause for parent fragments.
* @param childAttributes a map of attributes to filter child fragments. Each entry in this map represents
* an attribute key-value pair used in the WHERE clause for child fragments.
- * @return a collection of {@link ModuleReference} objects that match the given criteria. Each
- * {@code ModuleReference} contains information about a module's name and revision.
+ * @return a collection of {@link ModuleReference} objects that match the given criteria.
+ * Each {@code ModuleReference} contains information about a module's name and revision.
* @implNote The method assumes that both `parentAttributes` and `childAttributes` maps contain at least
* one entry. The first entry from `parentAttributes` is used to filter parent fragments,
* and the first entry from `childAttributes` is used to filter child fragments.
diff --git a/docs/api/swagger/ncmp/openapi-inventory.yaml b/docs/api/swagger/ncmp/openapi-inventory.yaml
index 8552ad5..c72f47a 100644
--- a/docs/api/swagger/ncmp/openapi-inventory.yaml
+++ b/docs/api/swagger/ncmp/openapi-inventory.yaml
@@ -136,8 +136,8 @@
\ plugin)."
operationId: searchCmHandleIds
parameters:
- - description: Boolean parameter to determine if returned value(s) will be cmHandle
- Ids or Alternate Ids for a given query
+ - description: Boolean parameter to determine if returned value(s) will be cm
+ handle references for a given query
in: query
name: outputAlternateId
required: false
diff --git a/docs/api/swagger/ncmp/openapi.yaml b/docs/api/swagger/ncmp/openapi.yaml
index aa732c8..024aed6 100644
--- a/docs/api/swagger/ncmp/openapi.yaml
+++ b/docs/api/swagger/ncmp/openapi.yaml
@@ -698,7 +698,7 @@
schema:
$ref: '#/components/schemas/DmiErrorMessage'
description: Bad Gateway
- summary: Execute a data operation for group of cm handle ids
+ summary: Execute a data operation for group of cm handle references
tags:
- network-cm-proxy
/v1/ch/{cm-handle}/data/ds/{datastore-name}/query:
@@ -1141,8 +1141,8 @@
this query.
operationId: searchCmHandleIds
parameters:
- - description: Boolean parameter to determine if returned value(s) will be cmHandle
- Ids or Alternate Ids for a given query
+ - description: Boolean parameter to determine if returned value(s) will be cm
+ handle references for a given query
in: query
name: outputAlternateId
required: false
@@ -1618,8 +1618,8 @@
example: 2024-01-22
type: string
outputAlternateIdOptionInQuery:
- description: Boolean parameter to determine if returned value(s) will be cmHandle
- Ids or Alternate Ids for a given query
+ description: Boolean parameter to determine if returned value(s) will be cm
+ handle references for a given query
in: query
name: outputAlternateId
required: false
@@ -1789,8 +1789,8 @@
type: string
targetIds:
items:
- description: "targeted cm handles, maximum of 50 supported. If this limit\
- \ is exceeded the request wil be refused."
+ description: "targeted cm handle references, maximum of 200 supported.\
+ \ If this limit is exceeded the request wil be refused."
example: "[\"da310eecdb8d44c2acc0ddaae01174b1\",\"c748c58f8e0b438f9fd1f28370b17d47\"\
]"
type: string
diff --git a/docs/cm-notification-subscriptions.rst b/docs/cm-notification-subscriptions.rst
index 14e871a..e1d1c2f 100644
--- a/docs/cm-notification-subscriptions.rst
+++ b/docs/cm-notification-subscriptions.rst
@@ -6,14 +6,14 @@
.. _cmNotificationSubscriptions:
-CM Data Subscriptions
-#####################
+CM Data Subscriptions and Notifications
+#######################################
.. toctree::
:maxdepth: 1
-Introduction
-============
+CM Data Subscriptions
+=====================
CM Subscriptions are created to subscribe to notifications for CM related changes that happened in the network based on predicates.
Predicates can be used to filter on CM Handle (id), Datastore and Xpath.
@@ -44,5 +44,17 @@
**Note.** The Cm Subscription feature relies on the DMI Plugin support for applying the subscriptions. This support is currently not implemented in the ONAP DMI Plugin.
+CM Data Notifications
+=====================
+CM Notifications are triggered by any change in the network, provided the client has already set up a CM Subscription to receive such notifications. Once the events are generated, they are processed by NCMP and forwarded to the client in the same format.
+
+**Note.** Currently, CM Notifications are sent regardless of the CM Subscriptions. Notifications controlled by CM Subscription have not yet been delivered.
+
+The CM Notification Event follows the structure outlined in the schema below:
+
+:download:`CM Data Notification Event Schema <schemas/dmidataavc/avc-event-schema-1.0.0.json>`
+
+**Note.** NCMP uses the CM Notification event key from the source topic to forward notifications to the client, ensuring that the order of notifications within a topic partition is maintained during forwarding.
+**Note.** If the notification key from the source topic is null, NCMP cannot guarantee the order of events within a topic partition when forwarding.
diff --git a/docs/schemas/dmidataavc/avc-event-schema-1.0.0.json b/docs/schemas/dmidataavc/avc-event-schema-1.0.0.json
new file mode 100644
index 0000000..474520d
--- /dev/null
+++ b/docs/schemas/dmidataavc/avc-event-schema-1.0.0.json
@@ -0,0 +1,88 @@
+{
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "urn:cps:org.onap.cps.ncmp.events:avc-event-schema:1.0.0",
+ "$ref": "#/definitions/AvcEvent",
+ "definitions": {
+ "Edit": {
+ "additionalProperties": false,
+ "properties": {
+ "edit-id": {
+ "type": "string"
+ },
+ "operation": {
+ "type": "string"
+ },
+ "target": {
+ "type": "string"
+ },
+ "value": {
+ "type": "object",
+ "existingJavaType": "java.lang.Object"
+ }
+ },
+ "required": [
+ "edit-id",
+ "operation",
+ "target"
+ ]
+ },
+ "AvcEvent": {
+ "description": "The payload for AVC event.",
+ "type": "object",
+ "javaType": "org.onap.cps.ncmp.events.avc1_0_0.AvcEvent",
+ "properties": {
+ "data": {
+ "description": "The AVC event content compliant with RFC8641 format",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "push-change-update": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "datastore-changes": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ietf-yang-patch:yang-patch": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "patch-id": {
+ "type": "string"
+ },
+ "edit": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/Edit"
+ }
+ }
+ },
+ "required": [
+ "patch-id",
+ "edit"
+ ]
+ }
+ },
+ "required": [
+ "ietf-yang-patch:yang-patch"
+ ]
+ }
+ },
+ "required": [
+ "datastore-changes"
+ ]
+ }
+ },
+ "required": [
+ "push-change-update"
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ],
+ "additionalProperties": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/integration-test/pom.xml b/integration-test/pom.xml
index b39c198..7ac9460 100644
--- a/integration-test/pom.xml
+++ b/integration-test/pom.xml
@@ -113,29 +113,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <profiles>
- <!-- Performance tests are run with maven-failsafe-plugin using a separate profile, so they will
- not affect Jacoco coverage. Heap size is set here to ensure consistent test environment. -->
- <profile>
- <id>include-performance</id>
- <properties>
- <failsafeArgLine>-Xms512m -Xmx512m</failsafeArgLine>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/*PerfTest.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
</project>
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/BearerTokenPassthroughSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/BearerTokenPassthroughSpec.groovy
index 99e8032..a81058f 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/BearerTokenPassthroughSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/BearerTokenPassthroughSpec.groovy
@@ -37,11 +37,14 @@
def setup() {
dmiDispatcher1.moduleNamesPerCmHandleId['ch-1'] = ['M1', 'M2']
- registerCmHandle(DMI1_URL, 'ch-1', NO_MODULE_SET_TAG)
+ dmiDispatcher1.moduleNamesPerCmHandleId['ch-2'] = ['M1', 'M3']
+ registerCmHandle(DMI1_URL, 'ch-1', NO_MODULE_SET_TAG, 'alt-1')
+ registerCmHandle(DMI1_URL, 'ch-2', NO_MODULE_SET_TAG, 'alt-2')
}
def cleanup() {
deregisterCmHandle(DMI1_URL, 'ch-1')
+ deregisterCmHandle(DMI1_URL, 'ch-2')
}
def 'Bearer token is passed from NCMP to DMI in pass-through data operations.'() {
@@ -83,7 +86,7 @@
"operationId": "operational-1",
"datastore": "ncmp-datastore:passthrough-running",
"resourceIdentifier": "my-resource-id",
- "targetIds": ["ch-1"]
+ "targetIds": ["ch-1","alt-2"]
}]}"""
mvc.perform(request(POST, '/ncmp/v1/data')
.queryParam('topic', 'my-topic')
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy
index 00ce38f..ffcba02 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy
@@ -242,7 +242,7 @@
if (retryAttempts == 0)
break
}
- consumerRecords
+ return consumerRecords
}
}
diff --git a/k6-tests/once-off-test/kafka/produce-avc-event.js b/k6-tests/once-off-test/kafka/produce-avc-event.js
index 981a21a..db222f6 100644
--- a/k6-tests/once-off-test/kafka/produce-avc-event.js
+++ b/k6-tests/once-off-test/kafka/produce-avc-event.js
@@ -50,6 +50,11 @@
}
};
+const getRandomNetworkElement = () => {
+ const networkElementIds = Array.from({ length: 10 }, (_, i) => `neType-${i + 1}`);
+ return networkElementIds[Math.floor(Math.random() * networkElementIds.length)];
+};
+
function getCloudEventHeaders() {
return {
ce_type: 'org.onap.cps.ncmp.events.avc1_0_0.AvcEvent',
@@ -65,10 +70,11 @@
export function sendKafkaMessages() {
const cloudEventHeaders = getCloudEventHeaders();
+ const networkElementId = getRandomNetworkElement();
const avcCloudEvent = {
key: schemaRegistry.serialize({
- data: cloudEventHeaders.ce_correlationid,
+ data: networkElementId,
schemaType: SCHEMA_TYPE_STRING,
}),
value: schemaRegistry.serialize({
diff --git a/pom.xml b/pom.xml
index 6c34a19..f95573e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,13 +23,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>3.2.0</version>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.onap.cps</groupId>
<artifactId>cps-aggregator</artifactId>
<version>3.5.5-SNAPSHOT</version>
@@ -46,6 +41,10 @@
<properties>
<maven.deploy.skip>false</maven.deploy.skip>
<maven.install.skip>false</maven.install.skip>
+ <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
+ <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
+ <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
</properties>
<modules>
@@ -69,6 +68,19 @@
<module>policy-executor-stub</module>
</modules>
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>ECOMP Release Repository</name>
+ <url>${onap.nexus.url}${releaseNexusPath}</url>
+ </repository>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>ECOMP Snapshot Repository</name>
+ <url>${onap.nexus.url}${snapshotNexusPath}</url>
+ </snapshotRepository>
+ </distributionManagement>
+
<build>
<plugins>
<plugin>
diff --git a/spotbugs/pom.xml b/spotbugs/pom.xml
index 293612e..f2b4175 100644
--- a/spotbugs/pom.xml
+++ b/spotbugs/pom.xml
@@ -28,7 +28,7 @@
<version>3.5.5-SNAPSHOT</version>
<properties>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
</properties>
@@ -39,7 +39,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
+ <version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
@@ -49,12 +49,12 @@
<repository>
<id>ecomp-releases</id>
<name>ECOMP Release Repository</name>
- <url>${nexusproxy}${releaseNexusPath}</url>
+ <url>${onap.nexus.url}${releaseNexusPath}</url>
</repository>
<snapshotRepository>
<id>ecomp-snapshots</id>
<name>ECOMP Snapshot Repository</name>
- <url>${nexusproxy}${snapshotNexusPath}</url>
+ <url>${onap.nexus.url}${snapshotNexusPath}</url>
</snapshotRepository>
</distributionManagement>
</project>
\ No newline at end of file