Commit 3e474ea3 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding SOL006 scripts and gitlab-ci.yml

parent 42a0c289
Loading
Loading
Loading
Loading

SOL006/.gitlab-ci.yml

0 → 100644
+43 −0
Original line number Diff line number Diff line
# CI/CD:
# * branch      Continuously Builds & Push TOSCA parser image

variables:
  PIPELINE_SCRIPTS_PROJECT_ID: 680
  IMG_NAME: "sol006"

stages:
  - build
  - validation
  - HTML

Building SOL006 docker image:
  stage: build
  before_script:
    - |
     curl "${CI_API_V4_URL}/projects/$PIPELINE_SCRIPTS_PROJECT_ID/repository/files/SOL006%2FDockerfile/raw?ref=main" >> Dockerfile
    - |
     curl "${CI_API_V4_URL}/projects/$PIPELINE_SCRIPTS_PROJECT_ID/repository/files/SOL006%2Fscripts%2Frun-test%2Esh/raw?ref=main" >> run-test.sh
    - chmod +x run-test.sh
  script:
    - echo "Building SOL006 docker image..."
    - docker build --tag $IMG_NAME .
      
Testing:
  stage: validation
  script:
    - echo "Testing"
    - docker run $IMG_NAME
#  artifacts:
#    when: always
#    paths:
#      - debugPuccini.log

Building HTML tree:
  stage: HTML
  before_script:
    - |
     curl "${CI_API_V4_URL}/projects/$PIPELINE_SCRIPTS_PROJECT_ID/repository/files/SOL006%2Fscripts%2Fbuild_tree%2Esh/raw?ref=main" >> build_tree.sh
    - chmod +x build_tree.sh
  script:
    - ./build_tree.sh
    
 No newline at end of file

SOL006/Dockerfile

0 → 100644
+7 −0
Original line number Diff line number Diff line
FROM mjethanandani/sol-006:latest

ADD example-data/* src/
ADD src/yang/* src/
ADD run-test.sh /

CMD ["/run-test.sh"]
+25 −0
Original line number Diff line number Diff line
#!/bin/bash
#
# Copyright (c) ETSI 2018
# Realeased under the ETSI Software License
#
# https://forge.etsi.org/etsi-software-license

YANG_MODULES="yang/yang/*"
OUTPUT="etsi-nfv-descriptors.html"

CMT=$(git rev-parse --short HEAD)

echo "Building HTML tree"
docker run -v"$(pwd)/src/yang/:/yang/" mjethanandani/pyang \
	"/bin/sh" -c "cd /yang/ && pyang -f jstree -p /yang/ \
	/yang/etsi-nfv-descriptors.yang > etsi-nfv.html"

sed -r -i 's|<a href=\"http://www.tail-f.com">|<a href="http://etsi.org">|g' src/yang/etsi-nfv.html
sed -r -i 's|data\:image/gif\;base64,R0lGODlhS.*RCAA7|https://www.etsi.org/images/ETSILogoTwitter.png\" height=\"100|g' src/yang/etsi-nfv.html

sed -r -i "s|<div class=\"app\">|<p>Commit: <a href=\"https://forge.etsi.org/gitlab/nfv/SOL006/commit/${CMT}\">$CMT</a>, Build:<a href=\"$BUILD_URL\">$BUILD_NUMBER</a></p><div class=\"app\">|g" src/yang/etsi-nfv.html


exit $?
+42 −0
Original line number Diff line number Diff line
#!/bin/bash

echo "Testing"

set -e

source /opt/confd/confdrc
cd src

CONFD_OPTS="--fail-on-warnings"
CONFD_OPTS=""

echo "Testing compilations of VNFD."
confdc -c $CONFD_OPTS -o /opt/confd/etc/confd/etsi-nfv-vnfd.fxs etsi-nfv-vnfd.yang
echo "Testing compilations of PNFD."
confdc -c $CONFD_OPTS -o /opt/confd/etc/confd/etsi-nfv-pnfd.fxs etsi-nfv-pnfd.yang
echo "Testing compilations of NSD."
confdc -c $CONFD_OPTS -o /opt/confd/etc/confd/etsi-nfv-nsd.fxs etsi-nfv-nsd.yang
echo "Testing compilations of descriptors."
confdc -c $CONFD_OPTS -o /opt/confd/etc/confd/etsi-nfv-descriptors.fxs etsi-nfv-descriptors.yang

echo "Starting ConfD"
confd

echo "Loading Data for VNFD"
confd_load -l -m nfv-vnfd.xml

echo "Loading Data for PNFD"
confd_load -l -m nfv-pnfd.xml

echo "Loading Data for NSD"
confd_load -l -m nfv-nsd.xml

echo "Loading Data for descriptors"
confd_load -l -m nfv.xml
echo "Loading data for the complex Vnfd example"
confd_load -l -m complex-vnfd.xml


# Don't do this in the actual test, just waste of cycles
# echo "Stopping ConfD"
# confd --stop