Removing need for bash script 89/84689/1
authorAndyWalshe <andy.walshe@est.tech>
Tue, 9 Apr 2019 14:05:08 +0000 (14:05 +0000)
committerAndyWalshe <andy.walshe@est.tech>
Tue, 9 Apr 2019 14:05:08 +0000 (14:05 +0000)
Change-Id: I447ed1d0e791ee38f4434d78a450edc02c222816
Issue-ID: INT-949
Signed-off-by: AndyWalshe <andy.walshe@est.tech>
test/mocks/pnf-onboarding/README.md [new file with mode: 0644]
test/mocks/pnf-onboarding/pom.xml
test/mocks/pnf-onboarding/readme.md [deleted file]
test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh [deleted file]

diff --git a/test/mocks/pnf-onboarding/README.md b/test/mocks/pnf-onboarding/README.md
new file mode 100644 (file)
index 0000000..8440b34
--- /dev/null
@@ -0,0 +1,25 @@
+
+PNF Package for Integration Test
+================================
+
+**NOTE: Currently this solution only works on Linux OS and requires openssl to be preinstalled.**
+
+This module builds 2 PNF packages based on the files in `/src/main/resources/csarContent/`
+
+1. unsigned package:   `sample-pnf-1.0.1-SNAPSHOT.csar`
+2. signed package:     `sample-signed-pnf-1.0.1-SNAPSHOT.zip`
+
+The signed package is based on ETSI SOL004 Security Option 2. It contains the csar, cert and cms files.
+
+The packages are generated by running the following command in the same directory as this readme file i.e. pnf-onboarding directory:
+>      `$ mvn clean install`
+
+The packages will be stored in the maven generated `target` directory.
+
+To be able to use the signed package in SDC the `src/main/resources/securityContent/root.cert` file has to be loaded into SDC onboarding backend container.
+
+If SDC is running in containers locally then the following commands could be used to copy the root.cert to the default location in SDC Onboarding Container. It is assumed that the commands are executed from inside pnf-onboarding directory.
+
+>      `$ docker exec -it <sdc-onboard-backend-container-id> mkdir -p /var/lib/jetty/cert`
+
+>      `$ docker cp src/main/resources/securityContent/root.cert <sdc-onboard-backend-container-id>:/var/lib/jetty`
index 569d1e2..7f513eb 100644 (file)
           </execution>
         </executions>
         <configuration>
-          <executable>src/main/scripts/generate-signature.sh</executable>
+          <executable>openssl</executable>
           <arguments>
-            <argument>src/main/resources/securityContent/sample-pnf.cert</argument>
-            <argument>src/main/resources/securityContent/sample-pnf-private-key.pem</argument>
+            <argument>cms</argument>
+            <argument>-sign</argument>
+            <argument>-binary</argument>
+            <argument>-nocerts</argument>
+            <argument>-outform</argument>
+            <argument>pem</argument>
+            <argument>-signer</argument>
+            <argument>${project.basedir}/src/main/resources/securityContent/sample-pnf.cert</argument>
+            <argument>-inkey</argument>
+            <argument>${project.basedir}/src/main/resources/securityContent/sample-pnf-private-key.pem</argument>
+            <argument>-in</argument>
             <argument>${project.build.directory}/signed-csar/${csar.name}.csar</argument>
+            <argument>-out</argument>
             <argument>${project.build.directory}/signed-csar/${csar.name}.cms</argument>
           </arguments>
         </configuration>
diff --git a/test/mocks/pnf-onboarding/readme.md b/test/mocks/pnf-onboarding/readme.md
deleted file mode 100644 (file)
index 4ddf701..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# PNF Package for Integration Test
-
-
-
-Builds 2 PNF packages based on the files in `/src/main/resources/csarContent/`
-
-
-
-1. unsigned package:
-
-       `sample-pnf-1.0.1-SNAPSHOT.csar`
-
-
-
-2. signed package:
-
-       `sample-signed-pnf-1.0.1-SNAPSHOT.zip`
-The signed package is based on ETSI SOL004 Security Option 2. It contains csar, cert and cms files.
-
-The packages are generated by running the following command in the same directory as this readme file i.e. pnf-onboarding directory:
->      `mvn clean install`
-
-
-
-The packages will be stored in target folder under the pnf-onboarding directory.
-**NOTE: Currently this solution works for Linux OS only.**
-
-
-
-To be able to use the signed package in SDC the `src/main/resources/securityContent/root.cert` file has to be loaded into SDC onboarding backend container.
-
-
-
-If SDC is running in containers locally then the following commands could be used to copy the root.cert to the default location in SDC Onboarding Container. It is assumed that the commands are executed from inside pnf-onboarding directory.
-
-```
-       docker exec -it <sdc-onboard-backend-container-id> mkdir -p /var/lib/jetty/cert
-       docker cp src/main/resources/securityContent/root.cert <sdc-onboard-backend-container-id>:/var/lib/jetty
-```
-
diff --git a/test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh b/test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh
deleted file mode 100644 (file)
index f9950cf..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-signingCertificate=$1
-signingCertPrivateKey=$2
-csarFile=$3
-signatureName=$4
-
-echo Creating signature file with following inputs
-printf "\t%s = %s\n" "signingCertificate" $signingCertificate
-printf "\t%s = %s\n" "signingCertPrivateKey" $signingCertPrivateKey
-printf "\t%s = %s\n" "csarFile" $csarFile
-
-openssl cms -sign -signer $signingCertificate -inkey $signingCertPrivateKey -outform pem -binary -nocerts < $csarFile > $signatureName
-
-retVal=$?
-if [ $retVal -eq 0 ]; then
-    echo Signature file $signatureName created successfully
-else
-    echo Failed to create Signature file $signatureName
-fi
-
-exit $retVal