summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>2020-03-27 13:40:20 +0100
committerKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>2020-03-30 18:20:07 +0200
commitaf54b39d9bad61bc10bf2eb5ab304819183b11f6 (patch)
tree752170d6e52cacda9a14524a95832fba8dbe7d87
parenta8e1918a02156ecec86409948d400669c2e67bb7 (diff)
ROBOT e2e test cases improvements for csar/zip tosca package validation in VNFSDK and SDC Onbarding
Issue-ID: INT-1240 Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com> Change-Id: I58fbd642057650d76a65fdd4ba08f562acb44522
-rw-r--r--scripts/etescript/vnfsdk-etescript.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/etescript/vnfsdk-etescript.sh b/scripts/etescript/vnfsdk-etescript.sh
new file mode 100644
index 0000000..ff3bb5b
--- /dev/null
+++ b/scripts/etescript/vnfsdk-etescript.sh
@@ -0,0 +1,53 @@
+# 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.
+
+#!/bin/bash
+
+#
+# Create root certificate CA (Certificate Authority) and its private key.
+# Create the package certificate issued by CA
+# Copy the stuff to SDC ONBOARDING and Robot pods.
+#
+
+
+
+SDCVALID=sdc-valid
+SDCINVALID=sdc-invalid
+ROBOTPOD=$(kubectl -n $NAMESPACE get pods --no-headers=true -o custom-columns=:metadata.name | grep robot-robot )
+SDCONBOARDINGPOD=$(kubectl -n $NAMESPACE get pods --no-headers=true -o custom-columns=:metadata.name | grep sdc-onboarding-be | grep -v cassandra)
+
+generate_ca_key_cert_and_package_cert_issued_by_CA () {
+ openssl req -batch -new -nodes -x509 -days 36500 -keyout rootCA-private-robot-$1.key -out rootCA-robot-$1.cert
+ openssl req -batch -new -nodes -keyout package-private-robot-$1.key -out package-robot-$1.csr
+ openssl x509 -req -CA rootCA-robot-$1.cert -CAkey rootCA-private-robot-$1.key -CAcreateserial -in package-robot-$1.csr -out package-robot-$1.cert
+}
+
+
+copy_root_cert_to_sdc_onboarding () {
+ kubectl cp $1/rootCA-robot-$5.cert $2/$3:$4
+}
+
+copy_package_certs_to_robot () {
+ for f in package-robot-$5.cert package-private-robot-$5.key
+ do
+ kubectl cp $1/$f $2/$3:$4
+ done
+}
+
+mkdir "$DIR/$SCRIPTDIR/tmp"
+cd "$DIR/$SCRIPTDIR/tmp"
+if [[ -f rootCA-robot-$SDCVALID.cert && -f package-robot-$SDCVALID.cert && -f package-robot-$SDCINVALID.cert && -f package-private-robot-$SDCVALID.key && -f package-private-robot-$SDCINVALID.key ]]; then
+ echo "All files are present";
+else
+ generate_ca_key_cert_and_package_cert_issued_by_CA $SDCVALID
+ generate_ca_key_cert_and_package_cert_issued_by_CA $SDCINVALID
+
+fi
+cd ../../..
+copy_root_cert_to_sdc_onboarding "$DIR/$SCRIPTDIR/tmp" "$NAMESPACE" "$SDCONBOARDINGPOD" "/var/lib/jetty/cert" $SDCVALID
+copy_package_certs_to_robot "$DIR/$SCRIPTDIR/tmp" "$NAMESPACE" "$ROBOTPOD" "/tmp" $SDCVALID
+copy_package_certs_to_robot "$DIR/$SCRIPTDIR/tmp" "$NAMESPACE" "$ROBOTPOD" "/tmp" $SDCINVALID
+