RFC 8040 API Support in SO 58/137558/4
authorsx00562924 <SX00562924@techmahindra.com>
Wed, 17 Apr 2024 14:47:55 +0000 (16:47 +0200)
committersx00562924 <SX00562924@techmahindra.com>
Mon, 13 Jan 2025 13:44:07 +0000 (14:44 +0100)
-Support for RFC8040 APIs
-Changes in SelfLink at SO while querying
-Allow rpc GENERIC-RESOURCE-API in SDNC output
-RFC OOM Changes- https://gerrit.onap.org/r/c/oom/+/139164
-SDNC-Northbound-3.0.2 version
-SO Compliance RFC8040-Successful Migration

Issue-ID: SO-4127
Change-ID: I93f84f909a814d488f62f8b36606b0644d8b8608
Signed-off-by: sx00562924 <SX00562924@techmahindra.com>
bpmn/pom.xml
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
so-sdn-clients/pom.xml
so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SDNCClient.java

index 776b52e..9c7f514 100644 (file)
@@ -19,7 +19,8 @@
     <xmlunit.version>2.4.0</xmlunit.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    <sdnc.northbound.version>1.5.2</sdnc.northbound.version>
+    <sdnc.northbound.version>3.0.2</sdnc.northbound.version>
+    <!-- SDNC northbound API latest version -->
     <logback-core.version>1.2.10</logback-core.version>
   </properties>
   <modules>
index 89d62e0..b8586ef 100644 (file)
@@ -70,9 +70,10 @@ public class SDNCQueryTasks {
         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
         GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
 
-        String selfLink =
-                "restconf/config/GENERIC-RESOURCE-API:services/service/" + serviceInstance.getServiceInstanceId()
-                        + "/service-data/vnfs/vnf/" + genericVnf.getVnfId() + "/vnf-data/vnf-topology/";
+        // RFC-8040 URI to query SDNC resource, ?content=config or nonconfig is Optional
+        String selfLink = "rests/data/GENERIC-RESOURCE-API:services/service=" + serviceInstance.getServiceInstanceId()
+                + "/service-data/vnfs/vnf=" + genericVnf.getVnfId() + "/vnf-data/vnf-topology";
+
         try {
             if (genericVnf.getSelflink() == null) {
                 genericVnf.setSelflink(selfLink);
@@ -105,9 +106,11 @@ public class SDNCQueryTasks {
         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
         GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
-        String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
-                + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/" + genericVnf.getVnfId()
-                + "/vnf-data/vf-modules/vf-module/" + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
+
+        // RFC-8040 URI to query SDNC resource, ?content=config or nonconfig is Optional
+        String selfLink = "rests/data/GENERIC-RESOURCE-API:services/service=" + serviceInstance.getServiceInstanceId()
+                + "/service-data/vnfs/vnf=" + genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module="
+                + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology";
         try {
             if (vfModule.getSelflink() == null
                     || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
index 7ed8447..e52866e 100644 (file)
@@ -84,7 +84,8 @@ public class SDNCRequestTasks {
         SDNCRequest request = (SDNCRequest) execution.getVariable(SDNC_REQUEST);
         try {
             String response = sdncClient.post(request.getSDNCPayload(), request.getTopology());
-            String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
+            // SDNC Response with RFC-8040 prefixes GENERIC-RESOURCE-API
+            String finalMessageIndicator = JsonPath.read(response, "$.GENERIC-RESOURCE-API:output.ack-final-indicator");
             execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
         } catch (PathNotFoundException e) {
             logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
index 7871db2..a93adf9 100644 (file)
@@ -8,7 +8,7 @@
   <modelVersion>4.0.0</modelVersion>
   <artifactId>so-sdn-clients</artifactId>
   <properties>
-    <sdnc.northbound.version>1.5.2</sdnc.northbound.version>
+    <sdnc.northbound.version>3.0.2</sdnc.northbound.version>
   </properties>
   <build>
     <plugins>
       <artifactId>aai-client</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <!-- RFC Supporting Dependencies -->
+    <dependency>
+      <groupId>org.onap.sdnc.northbound</groupId>
+      <artifactId>generic-resource-api-model-swagger</artifactId>
+      <version>3.0.2</version>
+      <type>yaml</type>
+    </dependency>
+    <!-- RFC Supporting Dependencies -->
     <dependency>
       <groupId>org.mariadb.jdbc</groupId>
       <artifactId>mariadb-java-client</artifactId>
index e29d658..ab0f354 100644 (file)
@@ -81,10 +81,11 @@ public class SDNCClient {
      * @throws MapperException
      * @throws BadResponseException
      */
+    // Build TargetUrl as per RFC-8040 standards
     public String get(String queryLink) throws MapperException, BadResponseException {
         String request = "";
         String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
-        String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+        String targetUrl = properties.getHost() + "/" + queryLink;
         BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
         STOClient.setTargetUrl(targetUrl);
         HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth(), false);