Commit 79e9bb49 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/test-demo-ofc22' into 'develop'

Integrate OFC'22 functional test into develop

See merge request teraflow-h2020/controller!80
parents 27297f40 c9818c6a
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ include:
  - local: '/src/dbscanserving/.gitlab-ci.yml'
  - local: '/src/opticalattackmitigator/.gitlab-ci.yml'
  - local: '/src/opticalcentralizedattackdetector/.gitlab-ci.yml'
  #- local: '/src/tester_integration/.gitlab-ci.yml'
  #- local: '/src/tester_functional/.gitlab-ci.yml'
  - local: '/src/automation/.gitlab-ci.yml'
  - local: '/src/webui/.gitlab-ci.yml'
  # - local: '/src/l3_distributedattackdetector/.gitlab-ci.yml'
+2 −20
Original line number Diff line number Diff line
# TeraFlow OS SDN Controller Installation Instructions 
Assuming you have a running Kubernetes deployment installed following the instructions provided in [Wiki: Installing Kubernetes on your Linux machine](../../../wikis/Installing-Kubernetes-on-your-Linux-machine), the following instructions will let you deploy TeraFlow OS SDN Controller in your local Kubernetes environment.
Assuming you have a running Kubernetes deployment installed following the instructions provided in [Wiki: Installing Kubernetes on your Linux machine](https://gitlab.com/teraflow-h2020/controller/-/wikis/Installing-Kubernetes-on-your-Linux-machine), the following instructions will let you deploy TeraFlow OS SDN Controller in your local Kubernetes environment.

Among others, it is assumed that you can run the command <code> kubectl cluster-info</code> in the machine you use for running the deployment script below.


## 1. Clone the repository
Create a folder (e.g., ~/deploy-test/teraflow/controller) to place the source code, move to that folder, clone the repository, and checkout the target branch you want to deploy (e.g., master or develop):

<code>mkdir -p ~/deploy-test/teraflow/controller; cd ~/deploy-test/teraflow/controller</code>

<code>git clone https://gitlab.com/teraflow-h2020/controller.git .</code>

<code>git checkout develop</code>


## 2. Adapt deployment script
Find the script <code>deploy_to_kubernetes.sh</code> and modify the configuration settings at the top of the script according to your local Kubernetes environment.


## 3. Run the deployment script
Execute the script <code>deploy_to_kubernetes.sh</code> to build and deploy the components at your local Kubernetes environment.
Then, follow the instructions in [Wiki: Deploying a TeraFlow OS test instance](https://gitlab.com/teraflow-h2020/controller/-/wikis/Deploying-a-TeraFlow-OS-test-instance) to deploy your instance of TeraFlow OS.
+8 −1
Original line number Diff line number Diff line
@@ -7,4 +7,11 @@ Branch "master" : [![pipeline status](https://gitlab.com/teraflow-h2020/controll
Branch "develop" : [![pipeline status](https://gitlab.com/teraflow-h2020/controller/badges/develop/pipeline.svg)](https://gitlab.com/teraflow-h2020/controller/-/commits/develop) [![coverage report](https://gitlab.com/teraflow-h2020/controller/badges/develop/coverage.svg)](https://gitlab.com/teraflow-h2020/controller/-/commits/develop)

# Installation Instructions
To install TeraFlow OS SDN Controller in your local Kubernetes deployment, we assume you deployed Kubernetes following the instructions provided in [Wiki: Installing Kubernetes on your Linux machine](../../../wikis/Installing-Kubernetes-on-your-Linux-machine). Then, follow instructions in [INSTALL.md](./INSTALL.md).
To install TeraFlow OS SDN Controller in your local Kubernetes deployment, we assume you deployed Kubernetes following the instructions provided in [Wiki: Installing Kubernetes on your Linux machine](https://gitlab.com/teraflow-h2020/controller/-/wikis/Installing-Kubernetes-on-your-Linux-machine).

Then, follow the instructions in [Wiki: Deploying a TeraFlow OS test instance](https://gitlab.com/teraflow-h2020/controller/-/wikis/Deploying-a-TeraFlow-OS-test-instance) to deploy your instance of TeraFlow OS.

# Functional Tests
A functional test has been defined to enable experimentation with the TeraFlow OS:

[Demo at OFC'22 (Bootstrap devices, Manage L3VPN services, Monitor Device Endpoints)](./src/tests/ofc22)
+24 −16
Original line number Diff line number Diff line
#!/bin/bash

# Set the name of the Kubernetes namespace to deploy to.
K8S_NAMESPACE="tf-dev"
K8S_HOSTNAME="kubernetes-master"
# If not already set, set the name of the Kubernetes namespace and hostname to deploy to.
K8S_NAMESPACE=${K8S_NAMESPACE:-'tf-dev'}
K8S_HOSTNAME=${K8S_HOSTNAME:-'kubernetes-master'}

export INFLUXDB_HOSTNAME=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}')
export INFLUXDB_PORT=$(kubectl get service influx-tests --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==8086)].nodePort}')
export INFLUXDB_USER=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_ADMIN_USER}' | base64 --decode)
export INFLUXDB_PASSWORD=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_ADMIN_PASSWORD}' | base64 --decode)
export INFLUXDB_DATABASE=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_DB}' | base64 --decode)
export INFLUXDB_URL="http://${INFLUXDB_HOSTNAME}:${INFLUXDB_PORT}"
INFLUXDB_USER=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_ADMIN_USER}' | base64 --decode)
INFLUXDB_PASSWORD=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_ADMIN_PASSWORD}' | base64 --decode)
INFLUXDB_DATABASE=$(kubectl --namespace $K8S_NAMESPACE get secrets influxdb-secrets -o jsonpath='{.data.INFLUXDB_DB}' | base64 --decode)

export GRAFANA_HOSTNAME=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}')
export GRAFANA_PORT=$(kubectl get service webuiservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}')
export GRAFANA_USERNAME="admin"
export GRAFANA_PASSWORD="admin123+"
export GRAFANA_URL="http://${GRAFANA_USERNAME}:${GRAFANA_PASSWORD}@${GRAFANA_HOSTNAME}:${GRAFANA_PORT}"
GRAFANA_HOSTNAME=$(kubectl get node $K8S_HOSTNAME -o 'jsonpath={.status.addresses[?(@.type=="InternalIP")].address}')
GRAFANA_PORT=$(kubectl get service webuiservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}')
GRAFANA_USERNAME="admin"
GRAFANA_PASSWORD=${GRAFANA_PASSWORD:-"admin123+"}
GRAFANA_URL="http://${GRAFANA_USERNAME}:${GRAFANA_PASSWORD}@${GRAFANA_HOSTNAME}:${GRAFANA_PORT}"

echo ${GRAFANA_URL}/api/datasources
# Configure Grafana Admin Password
# Ref: https://grafana.com/docs/grafana/latest/http_api/user/#change-password
curl -X PUT -H "Content-Type: application/json" -d '{
  "oldPassword": "admin",
  "newPassword": "'${GRAFANA_PASSWORD}'",
  "confirmNew" : "'${GRAFANA_PASSWORD}'"
}' http://admin:admin@${GRAFANA_HOSTNAME}:${GRAFANA_PORT}/api/user/password
echo

# Create InfluxDB DataSource
# Ref: https://grafana.com/docs/grafana/latest/http_api/data_source/
curl -X POST -H "Content-Type: application/json" -d '{
  "type"     : "influxdb",
  "name"     : "InfluxDB",
  "url"      : "'"$INFLUXDB_URL"'",
  "url"      : "http://monitoringservice:8086",
  "access"   : "proxy",
  "basicAuth": false,
  "user"     : "'"$INFLUXDB_USER"'",
@@ -40,3 +44,7 @@ curl -X POST -H "Content-Type: application/json" \
  -d '@src/webui/grafana_dashboard.json' \
  ${GRAFANA_URL}/api/dashboards/db
echo

DASHBOARD_URL="${GRAFANA_URL}/api/dashboards/uid/tf-l3-monit"
DASHBOARD_ID=$(python -c 'import json, requests; print(requests.get("'${DASHBOARD_URL}'").json()["dashboard"]["id"])')
curl -X POST ${GRAFANA_URL}/api/user/stars/dashboard/${DASHBOARD_ID}
+1 −0
Original line number Diff line number Diff line
*.dot
*.xml
Loading