Update chart repo url from installation script 53/12553/5
authoraravind.est <aravindhan.a@est.tech>
Tue, 20 Feb 2024 14:28:48 +0000 (14:28 +0000)
committerAravindhan Ayyanathan <aravindhan.a@est.tech>
Thu, 22 Feb 2024 15:04:22 +0000 (15:04 +0000)
String based replacement added to add the proper chartmuseum urls in the configuration.

Issue-ID: NONRTRIC-985
Change-Id: I0b533b0a99cb329fabe6821fa4c3d8187f673da3
Signed-off-by: aravind.est <aravindhan.a@est.tech>
25 files changed:
rapp-manager-acm/src/test/resources/valid-rapp-package.csar
rapp-manager-application/src/test/resources/valid-rapp-package.csar
rapp-manager-dme/src/test/resources/valid-rapp-package-new-info-type.csar
rapp-manager-dme/src/test/resources/valid-rapp-package.csar
rapp-manager-models/src/main/java/com/oransc/rappmanager/models/csar/RappCsarConfigurationHandler.java
rapp-manager-models/src/test/resources/invalid-rapp-package-empty-asd-yaml.csar
rapp-manager-models/src/test/resources/invalid-rapp-package-missing-artifact.csar
rapp-manager-models/src/test/resources/invalid-rapp-package-no-acm-composition.csar
rapp-manager-models/src/test/resources/invalid-rapp-package-no-asd-yaml.csar
rapp-manager-models/src/test/resources/invalid-rapp-package-no-tosca.csar
rapp-manager-models/src/test/resources/valid-rapp-package.csar
rapp-manager-sme/src/test/resources/valid-rapp-package.csar
sample-rapp-generator/rapp-all/Definitions/asd.yaml
sample-rapp-generator/rapp-all/Files/Acm/instances/a1pms-instance.json
sample-rapp-generator/rapp-all/Files/Acm/instances/all-instance.json
sample-rapp-generator/rapp-all/Files/Acm/instances/k8s-instance.json
sample-rapp-generator/rapp-all/Files/Acm/instances/kserve-instance.json
sample-rapp-generator/rapp-all/TOSCA-Metadata/TOSCA.meta
sample-rapp-generator/rapp-hello-world/Definitions/asd.yaml
sample-rapp-generator/rapp-hello-world/Definitions/asd_types.yaml
sample-rapp-generator/rapp-hello-world/Files/Acm/instances/k8s-instance.json
sample-rapp-generator/rapp-kserve/Definitions/asd_types.yaml
sample-rapp-generator/rapp-kserve/Files/Acm/instances/kserve-instance.json
scripts/install/install-all.sh
scripts/install/patch-sample-rapps.sh [new file with mode: 0755]

index a0aa3b2..4856dab 100755 (executable)
Binary files a/rapp-manager-acm/src/test/resources/valid-rapp-package.csar and b/rapp-manager-acm/src/test/resources/valid-rapp-package.csar differ
index 667317e..526d5d9 100755 (executable)
Binary files a/rapp-manager-application/src/test/resources/valid-rapp-package.csar and b/rapp-manager-application/src/test/resources/valid-rapp-package.csar differ
index 1ab8ff9..f51cfb2 100755 (executable)
Binary files a/rapp-manager-dme/src/test/resources/valid-rapp-package-new-info-type.csar and b/rapp-manager-dme/src/test/resources/valid-rapp-package-new-info-type.csar differ
index 1b96b0b..3454443 100755 (executable)
Binary files a/rapp-manager-dme/src/test/resources/valid-rapp-package.csar and b/rapp-manager-dme/src/test/resources/valid-rapp-package.csar differ
index 41c0eaf..1babdd2 100755 (executable)
@@ -67,7 +67,7 @@ public class RappCsarConfigurationHandler {
     public String getInstantiationPayload(Rapp rapp, RappACMInstance rappACMInstance, UUID compositionId) {
         return getPayload(rapp,
                 getResourceUri(RappCsarPathProvider.ACM_INSTANCES_LOCATION, rappACMInstance.getInstance())).replaceAll(
-                "COMPOSITIONID", String.valueOf(compositionId));
+                "DO_NOT_CHANGE_THIS_COMPOSITION_ID", String.valueOf(compositionId));
     }
 
     public ByteArrayResource getArtifactPayload(Rapp rapp, String location) {
index e614a19..e146e59 100755 (executable)
Binary files a/rapp-manager-models/src/test/resources/invalid-rapp-package-empty-asd-yaml.csar and b/rapp-manager-models/src/test/resources/invalid-rapp-package-empty-asd-yaml.csar differ
index d56f4ef..c82fce6 100755 (executable)
Binary files a/rapp-manager-models/src/test/resources/invalid-rapp-package-missing-artifact.csar and b/rapp-manager-models/src/test/resources/invalid-rapp-package-missing-artifact.csar differ
index d986fb4..30a7f04 100755 (executable)
Binary files a/rapp-manager-models/src/test/resources/invalid-rapp-package-no-acm-composition.csar and b/rapp-manager-models/src/test/resources/invalid-rapp-package-no-acm-composition.csar differ
index a2168ff..dade078 100755 (executable)
Binary files a/rapp-manager-models/src/test/resources/invalid-rapp-package-no-asd-yaml.csar and b/rapp-manager-models/src/test/resources/invalid-rapp-package-no-asd-yaml.csar differ
index 7ba7c33..e03ad3a 100755 (executable)
Binary files a/rapp-manager-models/src/test/resources/invalid-rapp-package-no-tosca.csar and b/rapp-manager-models/src/test/resources/invalid-rapp-package-no-tosca.csar differ
index 667317e..a045a6a 100755 (executable)
Binary files a/rapp-manager-models/src/test/resources/valid-rapp-package.csar and b/rapp-manager-models/src/test/resources/valid-rapp-package.csar differ
index 2bbc2ef..e1c17c6 100755 (executable)
Binary files a/rapp-manager-sme/src/test/resources/valid-rapp-package.csar and b/rapp-manager-sme/src/test/resources/valid-rapp-package.csar differ
index 96543b8..af7e64f 100755 (executable)
@@ -16,7 +16,7 @@ topology_template:
         descriptor_version: 1.0\r
         schema_version: 2.0\r
         function_description: rApp description\r
-        provider: EST\r
+        provider: Ericsson Software Technology (O-RAN SC NONRTRIC team)\r
         application_name: rapp-all\r
         application_version: 1.0\r
       artifacts:\r
@@ -26,7 +26,7 @@ topology_template:
           properties:\r
             artifact_type: "helm_chart"\r
             target_server: "chartmuseum"\r
-            target_server_uri: "http://10.101.0.106:8879/charts/api/charts"\r
+            target_server_uri: "UPDATE_THIS_CHART_MUSEUM_POST_CHARTS_URI"\r
             item_id: 1\r
         oru-app:\r
           type: tosca.artifacts.asd.deploymentItem\r
@@ -34,5 +34,5 @@ topology_template:
           properties:\r
             artifact_type: "helm_chart"\r
             target_server: "chartmuseum"\r
-            target_server_uri: "http://10.101.0.106:8879/charts/api/charts"\r
+            target_server_uri: "UPDATE_THIS_CHART_MUSEUM_POST_CHARTS_URI"\r
             item_id: 2
\ No newline at end of file
index fa5d207..2918173 100755 (executable)
@@ -1,7 +1,7 @@
 {
   "name": "A1PMSInstance0",
   "version": "1.0.1",
-  "compositionId": "COMPOSITIONID",
+  "compositionId": "DO_NOT_CHANGE_THIS_COMPOSITION_ID",
   "description": "Demo automation composition instance 0",
   "elements": {
     "709c62b3-8918-41b9-a747-d21eb79c6c12": {
index 20d9a88..4491148 100755 (executable)
@@ -1,7 +1,7 @@
 {
   "name": "AllInstance0",
   "version": "1.0.1",
-  "compositionId": "COMPOSITIONID",
+  "compositionId": "DO_NOT_CHANGE_THIS_COMPOSITION_ID",
   "description": "Demo automation composition instance",
   "elements": {
     "709c62b3-8918-41b9-a747-d21eb79c6c12": {
@@ -42,7 +42,7 @@
           "podName": "ransliceassurance",
           "repository": {
             "repoName": "local",
-            "address": "http://10.101.2.41:8879/charts"
+            "address": "UPDATE_THIS_CHART_MUSEUM_GET_CHARTS_URI"
           }
         }
       }
index 562b5a2..b4416fb 100755 (executable)
@@ -1,7 +1,7 @@
 {
   "name": "DemoInstance0",
   "version": "1.0.1",
-  "compositionId": "COMPOSITIONID",
+  "compositionId": "DO_NOT_CHANGE_THIS_COMPOSITION_ID",
   "description": "Demo automation composition instance 0",
   "elements": {
     "709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -22,7 +22,7 @@
           "podName": "ransliceassurance",
           "repository": {
             "repoName": "local",
-            "address": "http://10.101.2.41:8879/charts"
+            "address": "UPDATE_THIS_CHART_MUSEUM_GET_CHARTS_URI"
           }
         }
       }
index aaf63a1..e0b1b36 100755 (executable)
@@ -1,7 +1,7 @@
 {
   "name": "KserveInstance0",
   "version": "1.0.1",
-  "compositionId": "COMPOSITIONID",
+  "compositionId": "DO_NOT_CHANGE_THIS_COMPOSITION_ID",
   "description": "Demo automation composition instance 0",
   "elements": {
     "709c62b3-8918-41b9-a747-d21eb79c6c20": {
index ed2919e..3da5f0d 100755 (executable)
@@ -1,5 +1,5 @@
 TOSCA-Meta-File-Version: 1.0\r
 CSAR-Version: 1.0\r
-Created-By: EST\r
+Created-By: Ericsson Software Technology (O-RAN SC NONRTRIC team)\r
 Entry-Definitions: Definitions/asd.yaml\r
 ETSI-Entry-Manifest: asd.mf
\ No newline at end of file
index 2968ce8..810455a 100644 (file)
@@ -43,4 +43,6 @@ topology_template:
           file: "Artifacts/Deployment/HELM/hello-world-chart-0.1.0.tgz"\r
           properties:\r
             artifact_type: "helm_chart"\r
-            itemId: 1\r
+            target_server: "chartmuseum"\r
+            target_server_uri: "UPDATE_THIS_CHART_MUSEUM_POST_CHARTS_URI"\r
+            item_id: 1\r
index 237ccfd..c4de6ad 100644 (file)
@@ -77,3 +77,14 @@ tosca.artifacts.asd.deploymentItem:
       type: string\r
       constraints:\r
         - valid_values: ["helm_chart"]\r
+    target_server:\r
+      description: >\r
+        Specify target server for artifact.\r
+      required: true\r
+      type: string\r
+      constraints:\r
+        - valid_values: [ "chartmuseum" ]\r
+    target_server_uri:\r
+      description: "URI of the target server"\r
+      required: true\r
+      type: string
\ No newline at end of file
index 734f0d1..c019541 100644 (file)
@@ -1,7 +1,7 @@
 {\r
   "name": "K8DemoInstance0",\r
   "version": "1.0.1",\r
-  "compositionId": "COMPOSITIONID",\r
+  "compositionId": "DO_NOT_CHANGE_THIS_COMPOSITION_ID",\r
   "description": "Demo automation composition instance 0",\r
   "elements": {\r
     "d7be552e-bcc5-4478-b64d-797dbaec8f55": {\r
@@ -22,7 +22,7 @@
           "podName": "hello-world-chart",\r
           "repository": {\r
             "repoName": "local",\r
-            "address": "http://10.101.1.90:8879/charts"\r
+            "address": "UPDATE_THIS_CHART_MUSEUM_GET_CHARTS_URI"\r
           }\r
         }\r
       }\r
index 237ccfd..c4de6ad 100644 (file)
@@ -77,3 +77,14 @@ tosca.artifacts.asd.deploymentItem:
       type: string\r
       constraints:\r
         - valid_values: ["helm_chart"]\r
+    target_server:\r
+      description: >\r
+        Specify target server for artifact.\r
+      required: true\r
+      type: string\r
+      constraints:\r
+        - valid_values: [ "chartmuseum" ]\r
+    target_server_uri:\r
+      description: "URI of the target server"\r
+      required: true\r
+      type: string
\ No newline at end of file
index 09a5759..9086d8c 100644 (file)
@@ -1,7 +1,7 @@
 {\r
   "name": "DemoKserveInstance0",\r
   "version": "1.0.1",\r
-  "compositionId": "COMPOSITIONID",\r
+  "compositionId": "DO_NOT_CHANGE_THIS_COMPOSITION_ID",\r
   "description": "Demo automation composition instance 0",\r
   "elements": {\r
     "709c62b3-8918-41b9-a747-d21eb79c6c20": {\r
index a8c518a..fa59b3d 100755 (executable)
@@ -34,4 +34,7 @@ echo "Installing ACM components..."
 echo "Patching Kserve..."
 ./patch-kserve.sh
 
+echo "Patching Sample rApps..."
+./patch-sample-rapps.sh
+
 echo "Rapp Manager installation completed."
\ No newline at end of file
diff --git a/scripts/install/patch-sample-rapps.sh b/scripts/install/patch-sample-rapps.sh
new file mode 100755 (executable)
index 0000000..0dfa922
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+#  ========================================================================
+#  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.
+#  ============LICENSE_END=================================================
+#
+
+echo "######### Patching Sample rApps #########"
+
+CWD=$(pwd)
+export WORKSPACE="$CWD/../../sample-rapp-generator"
+
+IP_ADDRESS=$(hostname -I | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | awk '{print $1}')
+echo "IP Address : $IP_ADDRESS"
+
+CHART_REPO_GET_URI=${CHART_REPO_GET_URI:-'http://'$IP_ADDRESS':8879/charts'}
+CHART_REPO_POST_URI=${CHART_REPO_POST_URI:-'http://'$IP_ADDRESS':8879/charts/api/charts'}
+
+echo "Replacing charts repo post url in yaml files....."
+echo "Chart repository post URI : $CHART_REPO_POST_URI"
+for file in $(find $WORKSPACE -type f -name "*.yaml"); do
+  sed -i "s|UPDATE_THIS_CHART_MUSEUM_POST_CHARTS_URI|${CHART_REPO_POST_URI}|g" "$file"
+  if grep -q "$CHART_REPO_POST_URI" "$file"; then
+    echo "$file is updated."
+  fi
+done
+
+echo "Replacing charts repo get url in json files....."
+echo "Chart repository get URI : $CHART_REPO_GET_URI"
+for file in $(find $WORKSPACE -type f -name "*.json"); do
+  sed -i "s|UPDATE_THIS_CHART_MUSEUM_GET_CHARTS_URI|${CHART_REPO_GET_URI}|g" "$file"
+  if grep -q "$CHART_REPO_GET_URI" "$file"; then
+    echo "$file is updated."
+  fi
+done
+
+echo "Patching Sample rApps completed."