Add PONSim installation scripts 31/1131/4
authorCiprian Barbu <ciprian.barbu@enea.com>
Tue, 2 Jul 2019 10:48:16 +0000 (13:48 +0300)
committerCiprian Barbu <ciprian.barbu@enea.com>
Wed, 10 Jul 2019 10:44:42 +0000 (13:44 +0300)
Also refactored the existing BBSim installation scripts and re-organized
the scripts into separate bbsim and ponsim folders

Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
Change-Id: I114169cfbcee70985eb098561491ea341b26e4b2

src/use_cases/seba_on_arm/install/install.sh
src/use_cases/seba_on_arm/install/util.sh [changed mode: 0644->0755]
src/use_cases/seba_on_arm/src_repo/helm-charts
src/use_cases/seba_on_arm/test/README [new file with mode: 0644]
src/use_cases/seba_on_arm/test/bbsim/fabric.yaml [moved from src/use_cases/seba_on_arm/install/fabric.yaml with 100% similarity]
src/use_cases/seba_on_arm/test/bbsim/install.sh [new file with mode: 0755]
src/use_cases/seba_on_arm/test/bbsim/olt.yaml [moved from src/use_cases/seba_on_arm/install/olt.yaml with 100% similarity]
src/use_cases/seba_on_arm/test/bbsim/test.sh [moved from src/use_cases/seba_on_arm/install/test.sh with 53% similarity, mode: 0755]
src/use_cases/seba_on_arm/test/ponsim/install.sh [new file with mode: 0755]

index daf2223..eb9fbc1 100755 (executable)
@@ -8,8 +8,6 @@ CORD_REPO=${CORD_REPO:-https://charts.opencord.org}
 CORD_PLATFORM_VERSION=${CORD_PLATFORM_VERSION:-6.1.0}
 SEBA_VERSION=${SEBA_VERSION:-1.0.0}
 ATT_WORKFLOW_VERSION=${ATT_WORKFLOW_VERSION:-1.0.2}
-BBSIM_VERSION=${SEBA_VERSION:-1.0.0}
-
 CORD_CHART=${CORD_CHART:-${basepath}/../src_repo/seba_charts}
 
 # TODO(alav): Make each step re-entrant
@@ -45,6 +43,3 @@ wait_for 500 'test $(kubectl get pods | grep -vcE "(\s(.+)/\2.*Running|tosca-loa
 helm install -n att-workflow --version "${ATT_WORKFLOW_VERSION}" ${CORD_CHART}/att-workflow
 wait_for 300 'test $(kubectl get pods | grep -vcE "(\s(.+)/\2.*Running|tosca-loader.*Completed)") -eq 1' || true
 
-# Install bbsim
-export BBSIM_VERSION
-#helm install -n bbsim --version ${BBSIM_VERSION} ${CORD_CHART}/bbsim
old mode 100644 (file)
new mode 100755 (executable)
index b168859..cf7a61b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b168859840d479cf32ac10263117adcdebfca4d5
+Subproject commit cf7a61bc13ccd58ff9c131d46c44b85aee87bc2a
diff --git a/src/use_cases/seba_on_arm/test/README b/src/use_cases/seba_on_arm/test/README
new file mode 100644 (file)
index 0000000..1cd68df
--- /dev/null
@@ -0,0 +1,5 @@
+Thie folder contains installation scripts and other resources for testing SEBA.
+For now we rely on virtualized PON and OLT software, such as BBSim and PONSim.
+
+Each folder/testing method should contain an install.sh and test.sh scripts
+respectively.
diff --git a/src/use_cases/seba_on_arm/test/bbsim/install.sh b/src/use_cases/seba_on_arm/test/bbsim/install.sh
new file mode 100755 (executable)
index 0000000..e9cd0ab
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash -ex
+# shellcheck disable=SC2016
+
+basepath=$(cd "$(dirname "$0")"; pwd)
+BBSIM_VERSION=${BBSIM_VERSION:-1.0.0}
+CORD_CHART=${CORD_CHART:-${basepath}/../../src_repo/seba_charts}
+
+# shellcheck disable=SC1090
+source "${basepath}/../../install/util.sh"
+
+# Install bbsim
+helm install -n bbsim --version "${BBSIM_VERSION}" "${CORD_CHART}/bbsim"
+wait_for 300 'test $(kubectl get pods | grep -vcE "(\s(.+)/\2.*Running|bbsim.*Running)") -eq 1' || true
old mode 100644 (file)
new mode 100755 (executable)
similarity index 53%
rename from src/use_cases/seba_on_arm/install/test.sh
rename to src/use_cases/seba_on_arm/test/bbsim/test.sh
index 3577d3f..b64acdd
@@ -1,11 +1,9 @@
 #!/bin/bash -ex
 # shellcheck disable=SC2016
 
-#Modified from https://github.com/cachengo/seba_charts/blob/master/scripts/mini_test.sh
-
-TOSCA_POD=`kubectl get pods | grep xos-tosca | cut -d " " -f1`
-TOSCA_IP=`kubectl describe pod $TOSCA_POD | grep Node: | cut -d "/" -f2`
-BBSIM_IP=`kubectl get services -n voltha | grep bbsim | tr -s ' ' | cut -d " " -f3`
+TOSCA_POD=$(kubectl get pods | grep xos-tosca | cut -d " " -f1)
+TOSCA_IP=$(kubectl describe pod "$TOSCA_POD" | grep Node: | cut -d "/" -f2)
+BBSIM_IP=$(kubectl get services -n voltha | grep bbsim | tr -s ' ' | cut -d " " -f3)
 
 
 # Create the first model
@@ -14,7 +12,7 @@ curl \
   -H "xos-password: letmein" \
   -X POST \
   --data-binary @fabric.yaml \
-  http://$TOSCA_IP:30007/run
+  "http://$TOSCA_IP:30007/run"
 
 # Create the second model
 sed "s/{{bbsim_ip}}/$BBSIM_IP/g" olt.yaml > olt.yaml.tmp
@@ -23,5 +21,5 @@ curl \
   -H "xos-password: letmein" \
   -X POST \
   --data-binary @olt.yaml.tmp \
-  http://$TOSCA_IP:30007/run
+  "http://$TOSCA_IP:30007/run"
 rm olt.yaml.tmp
diff --git a/src/use_cases/seba_on_arm/test/ponsim/install.sh b/src/use_cases/seba_on_arm/test/ponsim/install.sh
new file mode 100755 (executable)
index 0000000..6aa728b
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/bash
+# shellcheck disable=SC2016
+
+set -ex
+
+basepath=$(cd "$(dirname "$0")"; pwd)
+
+# Using opencord automation-tools from the cord-6.1 maintenance branch
+AUTO_TOOLS_GIT="https://github.com/opencord/automation-tools.git"
+AUTO_TOOLS_VER=${AUTO_TOOLS_VER:-cord-6.1}
+
+export M=/tmp/milestones
+export SEBAVALUE=
+export WORKSPACE=${HOME}
+
+mkdir -p ${M} "${WORKSPACE}/cord/test"
+
+# Update helm-charts submdule needed later
+# ignore subproject commit and use latest remote version
+git submodule update --init --remote "${basepath}/../../src_repo/helm-charts"
+
+cd "${WORKSPACE}"
+test -d automation-tools || git clone "${AUTO_TOOLS_GIT}"
+cd "${WORKSPACE}/automation-tools" && git checkout "${AUTO_TOOLS_VER}"
+
+# Fake the setup phase so that portcheck.sh is not called
+# also install some required packages
+sudo apt install -y httpie jq software-properties-common bridge-utils make
+# add iptbles rule needed to forward DHCP packets comming from the RG_POD
+sudo iptables -P FORWARD ACCEPT
+touch "${M}/setup"
+
+# Skip helm installation if it already exists and fake /usr/local/bin/helm
+if xhelm=$(command -v helm)
+then
+  if [ "${xhelm}" != "/usr/local/bin/helm" ]
+  then
+     echo "helm is installed at ${xhelm}; symlinking to /usr/local/bin/helm"
+     mkdir -p /usr/local/bin/ || true
+     sudo ln -sf "${xhelm}" /usr/local/bin/helm
+  fi
+else
+  echo "helm is not installed"
+fi
+
+# Faking helm-charts repo clone to our own git submodule if not already there
+CHARTS="${WORKSPACE}/cord/helm-charts"
+test -d "${CHARTS}" || test -h "${CHARTS}" || \
+    ln -s "${basepath}/../../src_repo/helm-charts" "${CHARTS}"
+
+# Fake SiaB components setup since they are already installed
+milestones="kubeadm helm-init kafka kafka-running etcd-operator-ready voltha \
+            voltha-running nem onos siab"
+
+for m in ${milestones}
+do
+  echo "Faking SiaB milestone ${M}/${m}"
+  test -f "${M}/${m}" || touch "${M}/${m}"
+done
+
+# Now calling make, to install PONSim
+cd "${WORKSPACE}/automation-tools/seba-in-a-box"
+make stable
+