Merge "ICS sample producer and consumer"
authorJohn Keeney <john.keeney@est.tech>
Fri, 26 Apr 2024 09:36:24 +0000 (09:36 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Fri, 26 Apr 2024 09:36:24 +0000 (09:36 +0000)
.github/workflows/gerrit-novote-merge.yaml [new file with mode: 0644]
sample-services/hello-world-sme-invoker/Dockerfile
sample-services/hello-world-sme-invoker/README.md
sample-services/hello-world-sme-invoker/hello-world-sme-invoker-build-start.sh
sample-services/hello-world-sme-invoker/hello-world-sme-invoker/templates/deployment.yaml
sample-services/hello-world-sme-invoker/hello-world-sme-invoker/values.yaml
sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/HelloWorldSmeInvokerApplication.java
sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/rest/HelloWorldSmeInvokerComponent.java [new file with mode: 0644]
sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/rest/HelloWorldSmeInvokerController.java [deleted file]

diff --git a/.github/workflows/gerrit-novote-merge.yaml b/.github/workflows/gerrit-novote-merge.yaml
new file mode 100644 (file)
index 0000000..995b8bd
--- /dev/null
@@ -0,0 +1,122 @@
+---
+name: Gerrit Merge
+
+# yamllint disable-line rule:truthy
+on:
+  workflow_dispatch:
+    inputs:
+      GERRIT_BRANCH:
+        description: "Branch that change is against"
+        required: true
+        type: string
+      GERRIT_CHANGE_ID:
+        description: "The ID for the change"
+        required: true
+        type: string
+      GERRIT_CHANGE_NUMBER:
+        description: "The Gerrit number"
+        required: true
+        type: string
+      GERRIT_CHANGE_URL:
+        description: "URL to the change"
+        required: true
+        type: string
+      GERRIT_EVENT_TYPE:
+        description: "Type of Gerrit event"
+        required: true
+        type: string
+      GERRIT_PATCHSET_NUMBER:
+        description: "The patch number for the change"
+        required: true
+        type: string
+      GERRIT_PATCHSET_REVISION:
+        description: "The revision sha"
+        required: true
+        type: string
+      GERRIT_PROJECT:
+        description: "Project in Gerrit"
+        required: true
+        type: string
+      GERRIT_REFSPEC:
+        description: "Gerrit refspec of change"
+        required: true
+        type: string
+    secrets:
+      SONAR_TOKEN:
+        description: "Sonar Cloud access token"
+        required: true
+
+concurrency:
+  # yamllint disable-line rule:line-length
+  group: gerrit-merge-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
+  cancel-in-progress: true
+
+jobs:
+  notify:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Notify job start
+        # yamllint disable-line rule:line-length
+        uses: lfit/gerrit-review-action@7c30179c3c9389545fccb0d458df59879372ae6a  # v0.6
+        with:
+          host: ${{ vars.GERRIT_SERVER }}
+          username: ${{ vars.GERRIT_SSH_USER }}
+          key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
+          known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
+          gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
+          gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
+          vote-type: clear
+          comment-only: true
+      - name: Allow replication
+        run: sleep 10s
+
+  call-prescan-sonarcloud:
+    needs: notify
+    # yamllint disable-line rule:line-length
+    uses: lfit/releng-reusable-workflows/.github/workflows/composed-prescan-sonar-cloud.yaml@main
+    with:
+      GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
+      GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
+      GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
+      GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
+      GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
+      GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
+      GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
+      GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
+      GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
+      JDK_VERSION: "17"
+      # yamllint disable-line rule:line-length
+      PRE_BUILD_SCRIPT_URL: "https://raw.githubusercontent.com/o-ran-sc/ci-management/master/jjb/nonrtric/prescan-nonrtric-auth-token-fetch-ubuntu.sh"
+      SONAR_ARGS: >
+        -Dsonar.organization=o-ran-sc
+        -Dsonar.projectKey=o-ran-sc_nonrtric
+        -Dsonar.projectName=nonrtric
+        -Dsonar.build.sourceEncoding=UTF-8
+        -Dsonar.language=go
+        -Dsonar.sources=.
+        -Dsonar.go.coverage.reportPaths=auth-token-fetch/coverage.txt
+        -Dsonar.inclusions=auth-token-fetch/**.go
+        -Dsonar.exclusions=auth-token-fetch/**_test.go
+        -Dsonar.verbose=true
+    secrets:
+      SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+
+  report-status:
+    if: ${{ always() }}
+    needs: [notify, call-prescan-sonarcloud]
+    runs-on: ubuntu-latest
+    steps:
+      - name: Get workflow conclusion
+        uses: technote-space/workflow-conclusion-action@v3
+      - name: Report workflow conclusion
+        # yamllint disable-line rule:line-length
+        uses: lfit/gerrit-review-action@7c30179c3c9389545fccb0d458df59879372ae6a  # v0.6
+        with:
+          host: ${{ vars.GERRIT_SERVER }}
+          username: ${{ vars.GERRIT_SSH_USER }}
+          key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
+          known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
+          gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
+          gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
+          vote-type: ${{ env.WORKFLOW_CONCLUSION }}
+          comment-only: true
index 4885a48..05b4db2 100644 (file)
@@ -13,8 +13,6 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 #
-#   This source code is part of the near-RT RIC (RAN Intelligent Controller)
-#   platform project (RICP).
 #==================================================================================
 
 
index 95822a7..be6cf1e 100644 (file)
@@ -1,6 +1,6 @@
 # Hello World Sme Invoker Service\r
 \r
-This repository contains a Spring Boot application serving few Hello World SME endpoints. \r
+This repository contains a Spring Boot application serving as Hello World SME invoker application.\r
 The application can be built and run using the provided script - ``hello-world-sme-invoker-build-start.sh``.\r
 \r
 ## Prerequisites\r
@@ -16,13 +16,7 @@ Run the script:
 \r
 The script will build a Docker image and run a container with the Hello World SME service. After the container starts,\r
 wait for a few seconds to ensure the Spring Boot application is fully initialized. Next, it will make an HTTP request to the\r
-Hello World SME endpoint and display the response:\r
-\r
-```bash\r
-  response=$(curl -s http://localhost:8080/helloworld/v1/sme)\r
-  echo "Response from the Hello World SME endpoint:"\r
-  echo "$response"\r
-```\r
+Hello World SME endpoint on the interval of 5 seconds and displays the response:\r
 \r
 To stop and remove the Docker container:\r
 \r
@@ -31,7 +25,3 @@ To stop and remove the Docker container:
   docker rm hello-world-sme-invoker\r
 ```\r
 \r
-## Additional Information\r
-\r
-- The Hello World SME endpoint is available at http://localhost:8080/helloworld/v1/sme.\r
-\r
index a20bd35..1baf2c0 100644 (file)
@@ -26,10 +26,3 @@ IMAGE_NAME="o-ran-sc/nonrtric-sample-helloworld-sme-invoker"
 docker build -t $IMAGE_NAME:latest .
 
 docker run --rm -d -p 8080:8080 --name $NAME $IMAGE_NAME
-
-sleep 10
-
-echo "Make an HTTP request to the Hello World Sme Invoker endpoint and display the response"
-response=$(curl -s http://localhost:8080/helloworld/v1/sme)
-echo "Response from the /helloworld/v1/sme endpoint: "
-echo "$response"
index bbf621a..f32bb9a 100644 (file)
@@ -36,10 +36,10 @@ spec:
         - name: {{ .Chart.Name }}
           image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
           env:
-            - name: RAPP_INSTANCE_ID
-              value: "{{ .Values.environment.RAPP_INSTANCE_ID }}"
+            - name: APP_ID
+              value: "{{ .Values.environment.appId }}"
             - name: SME_DISCOVERY_ENDPOINT
-              value: "{{ .Values.environment.SME_DISCOVERY_ENDPOINT }}"
+              value: "{{ .Values.environment.smeDiscoveryEndpoint }}"
           ports:
             - name: http
               containerPort: {{ .Values.service.port }}
index 94c3b4f..69c367e 100644 (file)
@@ -29,7 +29,7 @@ service:
   port: 8080
 
 environment:
-  APP_ID: Invoker_Rapp_Id
-  SME_DISCOVERY_ENDPOINT: capifcore.nonrtric.svc.cluster.local:8090/service-apis/v1/allServiceAPIs
+  appId:
+  smeDiscoveryEndpoint:
 
 
index 0a384f4..163eab9 100644 (file)
@@ -24,9 +24,11 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;\r
 import org.springframework.boot.web.client.RestTemplateBuilder;\r
 import org.springframework.context.annotation.Bean;\r
+import org.springframework.scheduling.annotation.EnableScheduling;\r
 import org.springframework.web.client.RestTemplate;\r
 \r
 @SpringBootApplication(scanBasePackages = "org.oransc.nonrtric.sample")\r
+@EnableScheduling\r
 public class HelloWorldSmeInvokerApplication {\r
     public static void main(String[] args) {\r
         SpringApplication.run(HelloWorldSmeInvokerApplication.class, args);\r
diff --git a/sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/rest/HelloWorldSmeInvokerComponent.java b/sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/rest/HelloWorldSmeInvokerComponent.java
new file mode 100644 (file)
index 0000000..7d76b4f
--- /dev/null
@@ -0,0 +1,161 @@
+/*-\r
+ * ========================LICENSE_START=================================\r
+ * O-RAN-SC\r
+ * %%\r
+ * Copyright (C) 2024 OpenInfra Foundation Europe.\r
+ * %%\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ========================LICENSE_END===================================\r
+ */\r
+\r
+package org.oransc.nonrtric.sample.rest;\r
+\r
+import com.fasterxml.jackson.databind.ObjectMapper;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import org.oransc.nonrtric.sample.exception.CapifAccessException;\r
+import org.oransc.nonrtric.sample.rest.response.ApiResponse;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.scheduling.annotation.Scheduled;\r
+import org.springframework.stereotype.Component;\r
+import org.springframework.web.client.RestTemplate;\r
+\r
+@Component\r
+public class HelloWorldSmeInvokerComponent {\r
+\r
+    private final RestTemplate restTemplate;\r
+    private final ObjectMapper objectMapper;\r
+    private static final Logger logger = LoggerFactory.getLogger(HelloWorldSmeInvokerComponent.class);\r
+\r
+    public HelloWorldSmeInvokerComponent(RestTemplate restTemplate, ObjectMapper objectMapper) {\r
+        this.restTemplate = restTemplate;\r
+        this.objectMapper = objectMapper;\r
+    }\r
+\r
+    @Scheduled(fixedRate = 5000)\r
+    public void accessHelloWorldByInvoker() {\r
+        String capifUrl = createCapifUrl();\r
+        if (capifUrl != null && !capifUrl.isEmpty()) {\r
+            String baseUrl = "";\r
+            ApiResponse apiResponse;\r
+            try {\r
+                apiResponse = restTemplate.getForObject(capifUrl, ApiResponse.class);\r
+                logger.info("Discovery endpoint response is {}",\r
+                        objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(apiResponse));\r
+                baseUrl = getBaseUrl(apiResponse);\r
+            } catch (IllegalArgumentException e) {\r
+                throw new CapifAccessException("Error accessing the URL :- " + capifUrl);\r
+            } catch (Exception e) {\r
+                throw new CapifAccessException("Unexpected error");\r
+            }\r
+\r
+            //TODO The below should be uncommented once SME Manager provides an accessible URI\r
+\r
+//            String helloWorldEndpoint = "";\r
+//            List<String> apiSetEndpoints = getApiSetEndpoints(apiResponse, baseUrl);\r
+//            if (apiSetEndpoints != null && !apiSetEndpoints.isEmpty()) {\r
+//                helloWorldEndpoint = apiSetEndpoints.get(0);\r
+//            }\r
+//\r
+//            if (helloWorldEndpoint != null && !helloWorldEndpoint.isEmpty()) {\r
+//                try {\r
+//                    String responseHelloWorld = restTemplate.getForObject(helloWorldEndpoint, String.class);\r
+//                    logger.info("Response :- ", responseHelloWorld);\r
+//                } catch (IllegalArgumentException e) {\r
+//                    throw new CapifAccessException("Error accessing the URL :- " + helloWorldEndpoint);\r
+//                } catch (Exception e) {\r
+//                    throw new CapifAccessException("Unexpected error");\r
+//                }\r
+//            }\r
+        }\r
+    }\r
+\r
+    private String createCapifUrl() {\r
+        String appId = System.getenv("APP_ID");\r
+        String invokerId = "";\r
+        String capifUrl = "";\r
+        if (appId != null) {\r
+            logger.info("APP_ID: " + appId);\r
+            invokerId = "api_invoker_id_" + appId;\r
+            logger.info("invokerId: " + invokerId);\r
+        } else {\r
+            logger.info("APP_ID environment variable is not set. ");\r
+        }\r
+\r
+        String smeDiscoveryEndpoint = System.getenv("SME_DISCOVERY_ENDPOINT");\r
+        if (smeDiscoveryEndpoint != null) {\r
+            logger.info("SME_DISCOVERY_ENDPOINT: " + smeDiscoveryEndpoint);\r
+            capifUrl = smeDiscoveryEndpoint + "?api-invoker-id=" + invokerId;\r
+            logger.info("capifUrl: " + capifUrl);\r
+        } else {\r
+            logger.info("SME_DISCOVERY_ENDPOINT environment variable is not set.");\r
+        }\r
+        return capifUrl;\r
+    }\r
+\r
+    private static String getBaseUrl(ApiResponse apiResponse) {\r
+        if (apiResponse != null && apiResponse.getServiceAPIDescriptions() != null && !apiResponse.getServiceAPIDescriptions()\r
+                .isEmpty()) {\r
+\r
+            ApiResponse.ServiceAPIDescription serviceAPIDescription = apiResponse.getServiceAPIDescriptions().get(0);\r
+\r
+            if (serviceAPIDescription.getAefProfiles() != null && !serviceAPIDescription.getAefProfiles().isEmpty()) {\r
+\r
+                ApiResponse.AefProfile aefProfile = serviceAPIDescription.getAefProfiles().get(0);\r
+\r
+                if (aefProfile.getInterfaceDescriptions() != null && !aefProfile.getInterfaceDescriptions().isEmpty()) {\r
+                    ApiResponse.InterfaceDescription interfaceDescription = aefProfile.getInterfaceDescriptions().get(0);\r
+                    return "http://" + interfaceDescription.getIpv4Addr() + ":" + interfaceDescription.getPort();\r
+                }\r
+            }\r
+        }\r
+        return "";\r
+    }\r
+\r
+    private static List<String> getApiSetEndpoints(ApiResponse apiResponse, String baseUrl) {\r
+\r
+        String helloWorldEndpoint = "";\r
+        List<String> apiSetEndpoints = new ArrayList<>(5);\r
+\r
+        if (apiResponse != null && apiResponse.getServiceAPIDescriptions() != null && !apiResponse.getServiceAPIDescriptions()\r
+                .isEmpty()) {\r
+\r
+            ApiResponse.ServiceAPIDescription serviceAPIDescription = apiResponse.getServiceAPIDescriptions().get(0);\r
+\r
+            if (serviceAPIDescription.getAefProfiles() != null && !serviceAPIDescription.getAefProfiles().isEmpty()) {\r
+\r
+                ApiResponse.AefProfile aefProfile = serviceAPIDescription.getAefProfiles().get(0);\r
+\r
+                if (aefProfile.getInterfaceDescriptions() != null && !aefProfile.getInterfaceDescriptions().isEmpty()) {\r
+\r
+                    if (aefProfile.getVersions() != null && !aefProfile.getVersions().isEmpty()) {\r
+\r
+                        ApiResponse.ApiVersion apiVersion = aefProfile.getVersions().get(0);\r
+\r
+                        if (apiVersion.getResources() != null && !apiVersion.getResources().isEmpty()) {\r
+\r
+                            for (ApiResponse.Resource resource : apiVersion.getResources()) {\r
+                                helloWorldEndpoint = baseUrl + resource.getUri();\r
+                                logger.info("Complete URL for resource " + helloWorldEndpoint);\r
+                                apiSetEndpoints.add(helloWorldEndpoint);\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return apiSetEndpoints;\r
+    }\r
+\r
+}\r
diff --git a/sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/rest/HelloWorldSmeInvokerController.java b/sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/rest/HelloWorldSmeInvokerController.java
deleted file mode 100644 (file)
index 5782092..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/*-\r
- * ========================LICENSE_START=================================\r
- * O-RAN-SC\r
- * %%\r
- * Copyright (C) 2024 OpenInfra Foundation Europe.\r
- * %%\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ========================LICENSE_END===================================\r
- */\r
-\r
-package org.oransc.nonrtric.sample.rest;\r
-\r
-import jakarta.servlet.http.HttpServletRequest;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import org.oransc.nonrtric.sample.exception.CapifAccessException;\r
-import org.oransc.nonrtric.sample.rest.response.ApiResponse;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.springframework.http.ResponseEntity;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RestController;\r
-import org.springframework.web.client.RestTemplate;\r
-\r
-@RestController\r
-public class HelloWorldSmeInvokerController {\r
-\r
-    private final RestTemplate restTemplate;\r
-    private static final Logger logger = LoggerFactory.getLogger(HelloWorldSmeInvokerController.class);\r
-\r
-    public HelloWorldSmeInvokerController(RestTemplate restTemplate) {\r
-        this.restTemplate = restTemplate;\r
-    }\r
-\r
-    @RequestMapping("/helloworld/v1/sme")\r
-    public String helloWorld(HttpServletRequest request) {\r
-        String path = logRequestPath(request);\r
-        return "Hello from " + path;\r
-    }\r
-\r
-    @RequestMapping("/helloworld/sme/invoker/v1/apiset")\r
-    public ResponseEntity<ApiResponse> helloWorldSmeInvoker(HttpServletRequest request) {\r
-        String path = logRequestPath(request);\r
-        String capifUrl = createCapifUrl();\r
-        try {\r
-            ApiResponse apiResponse = restTemplate.getForObject(capifUrl, ApiResponse.class);\r
-            return ResponseEntity.ok(apiResponse);\r
-        } catch (IllegalArgumentException e) {\r
-            throw new CapifAccessException("Error accessing the URL :- "+capifUrl);\r
-        } catch (Exception e) {\r
-            throw new CapifAccessException("Unexpected error");\r
-        }\r
-    }\r
-\r
-    @RequestMapping("/helloworld/sme/invoker/v1")\r
-    public ResponseEntity<String> accessHelloWorldByInvoker(HttpServletRequest request) {\r
-        String path = logRequestPath(request);\r
-        String capifUrl = createCapifUrl();\r
-        String baseUrl = "";\r
-        ApiResponse apiResponse = new ApiResponse();\r
-        try {\r
-            apiResponse = restTemplate.getForObject(capifUrl, ApiResponse.class);\r
-            baseUrl = getBaseUrl(apiResponse);\r
-        } catch (IllegalArgumentException e) {\r
-            throw new CapifAccessException("Error accessing the URL :- "+capifUrl);\r
-        } catch (Exception e) {\r
-            throw new CapifAccessException("Unexpected error");\r
-        }\r
-\r
-        String helloWorldEndpoint = "";\r
-        List<String> apiSetEndpoints = getApiSetEndpoints(apiResponse, baseUrl);\r
-        if(apiSetEndpoints != null && !apiSetEndpoints.isEmpty()){\r
-            helloWorldEndpoint = apiSetEndpoints.get(0);\r
-        }\r
-\r
-        try {\r
-            String responseHelloWorld = restTemplate.getForObject(helloWorldEndpoint, String.class);\r
-            logger.info("Response :- ", responseHelloWorld);\r
-            return ResponseEntity.ok(responseHelloWorld);\r
-        } catch (IllegalArgumentException e) {\r
-            throw new CapifAccessException("Error accessing the URL :- "+helloWorldEndpoint);\r
-        } catch (Exception e) {\r
-            throw new CapifAccessException("Unexpected error");\r
-        }\r
-    }\r
-\r
-    private String logRequestPath(HttpServletRequest request) {\r
-        String path = request.getRequestURI();\r
-        logger.info("Received request for path: {}", path);\r
-        return path;\r
-    }\r
-\r
-    private String createCapifUrl() {\r
-        String appId = System.getenv("APP_ID");\r
-        if (appId != null) {\r
-            logger.info("APP_ID: " + appId);\r
-        } else {\r
-            logger.info("APP_ID environment variable is not set. ");\r
-            appId = "Invoker_App_1";\r
-            logger.info("APP_ID default value :- " + appId);\r
-        }\r
-\r
-        String smeDiscoveryEndpoint = System.getenv("SME_DISCOVERY_ENDPOINT");\r
-        if (smeDiscoveryEndpoint != null) {\r
-            logger.info("SME_DISCOVERY_ENDPOINT: " + smeDiscoveryEndpoint);\r
-        } else {\r
-            logger.info("SME_DISCOVERY_ENDPOINT environment variable is not set.");\r
-            smeDiscoveryEndpoint = "capifcore.nonrtric.svc.cluster.local:8090/service-apis/v1/allServiceAPIs";\r
-            logger.info("SME_DISCOVERY_ENDPOINT default value :- " + smeDiscoveryEndpoint);\r
-        }\r
-\r
-        String invokerId = "api_invoker_id_Invoker_App_1";\r
-        if (appId != null) {\r
-            invokerId = "api_invoker_id_" + appId;\r
-        }\r
-        logger.info("invokerId: " + invokerId);\r
-\r
-        String capifUrl =\r
-            "http://capifcore.nonrtric.svc.cluster.local:8090/service-apis/v1/allServiceAPIs" + "?api-invoker-id=" +\r
-                invokerId;\r
-        if (smeDiscoveryEndpoint != null) {\r
-            capifUrl = smeDiscoveryEndpoint + "?api-invoker-id=" + invokerId;\r
-        }\r
-        logger.info("capifUrl: " + capifUrl);\r
-\r
-        return capifUrl;\r
-    }\r
-\r
-    private static String getBaseUrl(ApiResponse apiResponse) {\r
-        if (apiResponse != null &&\r
-            apiResponse.getServiceAPIDescriptions() != null &&\r
-            !apiResponse.getServiceAPIDescriptions().isEmpty()) {\r
-\r
-            ApiResponse.ServiceAPIDescription serviceAPIDescription = apiResponse.getServiceAPIDescriptions().get(0);\r
-\r
-            if (serviceAPIDescription.getAefProfiles() != null &&\r
-                !serviceAPIDescription.getAefProfiles().isEmpty()) {\r
-\r
-                ApiResponse.AefProfile aefProfile = serviceAPIDescription.getAefProfiles().get(0);\r
-\r
-                if (aefProfile.getInterfaceDescriptions() != null &&\r
-                    !aefProfile.getInterfaceDescriptions().isEmpty()) {\r
-                    ApiResponse.InterfaceDescription interfaceDescription = aefProfile.getInterfaceDescriptions().get(0);\r
-                    return "http://" + interfaceDescription.getIpv4Addr() + ":" + interfaceDescription.getPort();\r
-                }\r
-            }\r
-        }\r
-        return "";\r
-    }\r
-\r
-    private static List<String> getApiSetEndpoints(ApiResponse apiResponse, String baseUrl){\r
-\r
-        String helloWorldEndpoint = "";\r
-        List<String> apiSetEndpoints = new ArrayList<>(5);\r
-\r
-        if (apiResponse != null &&\r
-            apiResponse.getServiceAPIDescriptions() != null &&\r
-            !apiResponse.getServiceAPIDescriptions().isEmpty()) {\r
-\r
-            ApiResponse.ServiceAPIDescription serviceAPIDescription = apiResponse.getServiceAPIDescriptions().get(0);\r
-\r
-            if (serviceAPIDescription.getAefProfiles() != null &&\r
-                !serviceAPIDescription.getAefProfiles().isEmpty()) {\r
-\r
-                ApiResponse.AefProfile aefProfile = serviceAPIDescription.getAefProfiles().get(0);\r
-\r
-                if (aefProfile.getInterfaceDescriptions() != null &&\r
-                    !aefProfile.getInterfaceDescriptions().isEmpty()) {\r
-\r
-                    ApiResponse.InterfaceDescription interfaceDescription = aefProfile.getInterfaceDescriptions().get(0);\r
-\r
-                    if (aefProfile.getVersions() != null &&\r
-                        !aefProfile.getVersions().isEmpty()) {\r
-\r
-                        ApiResponse.ApiVersion apiVersion = aefProfile.getVersions().get(0);\r
-\r
-                        if (apiVersion.getResources() != null &&\r
-                            !apiVersion.getResources().isEmpty()) {\r
-\r
-                            for(ApiResponse.Resource resource : apiVersion.getResources()) {\r
-                                helloWorldEndpoint = baseUrl + resource.getUri();\r
-                                logger.info("Complete URL for resource " + helloWorldEndpoint);\r
-                                apiSetEndpoints.add(helloWorldEndpoint);\r
-                            }\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return apiSetEndpoints;\r
-    }\r
-\r
-}\r