Update rApp generator to generate rApp from different folders 25/12425/1
authoraravind.est <aravindhan.a@est.tech>
Mon, 8 Jan 2024 15:33:50 +0000 (15:33 +0000)
committeraravind.est <aravindhan.a@est.tech>
Mon, 8 Jan 2024 15:33:50 +0000 (15:33 +0000)
csar-generator renamed to sample-rapp-generator
generator script modified to support the folder name as an argument.

Issue-ID: NONRTRIC-964
Signed-off-by: aravind.est <aravindhan.a@est.tech>
Change-Id: I86adc2746da63a1252ca64893aca31b7396155af

35 files changed:
sample-rapp-generator/generate.bat [moved from csar-generator/generate.bat with 61% similarity]
sample-rapp-generator/generate.sh [moved from csar-generator/generate.sh with 67% similarity]
sample-rapp-generator/rapp-all/Definitions/asd.yaml [moved from csar-generator/resources/Definitions/asd.yaml with 100% similarity]
sample-rapp-generator/rapp-all/Definitions/asd_types.yaml [moved from csar-generator/resources/Definitions/asd_types.yaml with 100% similarity]
sample-rapp-generator/rapp-all/Files/Acm/definition/compositions.json [moved from csar-generator/resources/Files/Acm/definition/compositions.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Acm/instances/a1pms-instance.json [moved from csar-generator/resources/Files/Acm/instances/a1pms-instance.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Acm/instances/all-instance.json [moved from csar-generator/resources/Files/Acm/instances/all-instance.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Acm/instances/k8s-instance.json [moved from csar-generator/resources/Files/Acm/instances/k8s-instance.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Acm/instances/kserve-instance.json [moved from csar-generator/resources/Files/Acm/instances/kserve-instance.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/ChangeLog.txt [moved from csar-generator/resources/Files/ChangeLog.txt with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/consumerinfotypes/json-file-data-from-filestore.json [moved from csar-generator/resources/Files/Dme/consumerinfotypes/json-file-data-from-filestore.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/consumerinfotypes/xml-file-data-from-filestore.json [moved from csar-generator/resources/Files/Dme/consumerinfotypes/xml-file-data-from-filestore.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/infoconsumers/json-file-consumer.json [moved from csar-generator/resources/Files/Dme/infoconsumers/json-file-consumer.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/infoconsumers/xml-file-consumer.json [moved from csar-generator/resources/Files/Dme/infoconsumers/xml-file-consumer.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/infoproducers/json-file-data-producer.json [moved from csar-generator/resources/Files/Dme/infoproducers/json-file-data-producer.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/infoproducers/xml-file-data-producer.json [moved from csar-generator/resources/Files/Dme/infoproducers/xml-file-data-producer.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/producerinfotypes/json-file-data-from-filestore.json [moved from csar-generator/resources/Files/Dme/producerinfotypes/json-file-data-from-filestore.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Dme/producerinfotypes/xml-file-data-from-filestore.json [moved from csar-generator/resources/Files/Dme/producerinfotypes/xml-file-data-from-filestore.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Events/MyASD_v1.yaml [moved from csar-generator/resources/Files/Events/MyASD_v1.yaml with 100% similarity]
sample-rapp-generator/rapp-all/Files/Guides/user_guide.txt [moved from csar-generator/resources/Files/Guides/user_guide.txt with 100% similarity]
sample-rapp-generator/rapp-all/Files/Measurements/PM_Dictionary.yaml [moved from csar-generator/resources/Files/Measurements/PM_Dictionary.yaml with 100% similarity]
sample-rapp-generator/rapp-all/Files/Scripts/my_script.sh [moved from csar-generator/resources/Files/Scripts/my_script.sh with 100% similarity]
sample-rapp-generator/rapp-all/Files/Sme/invokers/invoker-app1.json [moved from csar-generator/resources/Files/Sme/invokers/invoker-app1.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Sme/invokers/invoker-app2.json [moved from csar-generator/resources/Files/Sme/invokers/invoker-app2.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Sme/providers/provider-function-1.json [moved from csar-generator/resources/Files/Sme/providers/provider-function-1.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Sme/providers/provider-function-2.json [moved from csar-generator/resources/Files/Sme/providers/provider-function-2.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Sme/providers/provider-function-3.json [moved from csar-generator/resources/Files/Sme/providers/provider-function-3.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Sme/serviceapis/api-set-1.json [moved from csar-generator/resources/Files/Sme/serviceapis/api-set-1.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Sme/serviceapis/api-set-2.json [moved from csar-generator/resources/Files/Sme/serviceapis/api-set-2.json with 100% similarity]
sample-rapp-generator/rapp-all/Files/Yang_module/mynetconf.yang [moved from csar-generator/resources/Files/Yang_module/mynetconf.yang with 100% similarity]
sample-rapp-generator/rapp-all/Files/rapp1/rapp.zip [moved from csar-generator/resources/Files/rapp1/rapp.zip with 100% similarity]
sample-rapp-generator/rapp-all/HELM/free5gc-1.1.3.tgz [moved from csar-generator/resources/HELM/free5gc-1.1.3.tgz with 100% similarity]
sample-rapp-generator/rapp-all/HELM/ueransim-2.0.14.tgz [moved from csar-generator/resources/HELM/ueransim-2.0.14.tgz with 100% similarity]
sample-rapp-generator/rapp-all/TOSCA-Metadata/TOSCA.meta [moved from csar-generator/resources/TOSCA-Metadata/TOSCA.meta with 100% similarity]
sample-rapp-generator/rapp-all/asd.mf [moved from csar-generator/resources/asd.mf with 100% similarity]

similarity index 61%
rename from csar-generator/generate.bat
rename to sample-rapp-generator/generate.bat
index 1e34698..ccf3049 100755 (executable)
@@ -1,5 +1,6 @@
 :: ============LICENSE_START===============================================
 ::  Copyright (C) 2023 Nordix Foundation. All rights reserved.
+::  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.
 ::
 
 @echo off
-SET CSARFILE=rapp.csar
-SET ZIPFILE=rapp.zip
-del %CSARFILE% 2>nul
-pushd resources
-tar -a -cf ..\%ZIPFILE% *
-popd
-rename %ZIPFILE% %CSARFILE%
+
+if [%1]==[] goto usage
+SET DIRECTORY=%1
+if %DIRECTORY:~-1%==\ (
+    SET DIRECTORY=%DIRECTORY:~0,-1%
+)
+if exist %DIRECTORY% (
+    SET CSARFILE=%DIRECTORY%.csar
+    SET ZIPFILE=%DIRECTORY%.zip
+    del %CSARFILE% 2>nul
+    pushd %DIRECTORY%
+    tar -a -cf ..\%ZIPFILE% *
+    popd
+    rename %ZIPFILE% %CSARFILE%
+    @echo rApp package %CSARFILE% generated.
+) else (
+    @echo Directory %DIRECTORY% doesn't exists.
+)
+goto :eof
+
+:usage
+@echo USAGE: %0% ^<rApp-resource-folder-name^>
similarity index 67%
rename from csar-generator/generate.sh
rename to sample-rapp-generator/generate.sh
index 3bb223a..a4eeba4 100755 (executable)
@@ -2,6 +2,7 @@
 
 #  ============LICENSE_START===============================================
 #  Copyright (C) 2023 Nordix Foundation. All rights reserved.
+#  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.
 #  ============LICENSE_END=================================================
 #
 
-rm rapp.csar
-pushd resources
-zip -r ../rapp.csar *
-popd
+if [[ $# -ne 1 ]]; then
+  echo "USAGE: $0 <rApp-resource-folder-name>"
+  exit 1
+fi
+
+DIRECTORY=${1%/}
+PACKAGENAME="$DIRECTORY.csar"
+
+if [ -d "$DIRECTORY" ]; then
+  rm $PACKAGENAME 2> /dev/null
+  pushd $DIRECTORY
+  zip -r ../$PACKAGENAME *
+  popd
+  echo -e "rApp package $PACKAGENAME generated."
+else
+  echo "Directory $DIRECTORY doesn't exists."
+fi