blob: e516a44bfa03ffd8ef3f4f15579b23e852c1a6c8 [file] [log] [blame]
Andy Bavier35053b62018-09-20 13:45:45 -07001SHELL := /bin/bash
2BUILD ?= /tmp
3M ?= $(BUILD)/milestones
4MAKEDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
5WORKSPACE ?= $(HOME)
Andy Bavier6ce277e2018-10-02 10:29:21 -07006VIRTUALENV ?= $(WORKSPACE)/cord/test
Andy Bavier35053b62018-09-20 13:45:45 -07007SEBAVALUES ?= configs/seba-ponsim.yaml
Kailash Khalasi98dabd02018-10-19 13:00:12 -07008TESTTAGS ?= stable
Andy Bavier35053b62018-09-20 13:45:45 -07009
Zack Williams3bcdc262018-09-27 11:00:38 -070010# used to start logging/monitoring and other infrastructure charts
11INFRA_CHARTS ?=
12INFRA_PREREQS = $(foreach chart,$(INFRA_CHARTS),$(M)/$(chart))
13
Zack Williams2a6a1072019-01-07 11:15:12 -070014DOCKER_VERSION ?= "17.06"
15
Zack Williamsf9940be2019-03-26 15:21:44 -070016K8S_VERSION ?= "1.12.7"
Zack Williams2a6a1072019-01-07 11:15:12 -070017
18HELM_VERSION ?= "2.12.1"
19HELM_SHA256SUM ?= "891004bec55431b39515e2cedc4f4a06e93782aa03a4904f2bd742b168160451"
Andy Bavier35053b62018-09-20 13:45:45 -070020HELM_PLATFORM ?= "linux-amd64"
21
Zack Williams2a6a1072019-01-07 11:15:12 -070022KAFKA_CHART_VERSION ?= 0.13.3
Andy Bavier1d5b9922019-01-02 15:30:55 -070023KAFKA_POD := "pod/cord-kafka-0"
Zack Williams3bcdc262018-09-27 11:00:38 -070024
Zack Williams5c16dc82019-01-08 10:57:08 -070025ETCD_OPERATOR_VERSION ?= 0.8.3
26
Zack Williams8fa04e72018-11-04 22:16:58 -070027# Arguments passed to helm install/upgrade for all or specific charts
28HELM_GLOBAL_ARGS ?=
29HELM_NEM_ARGS ?= $(HELM_GLOBAL_ARGS)
30HELM_ONOS_ARGS ?= $(HELM_GLOBAL_ARGS)
31HELM_VOLTHA_ARGS ?= $(HELM_GLOBAL_ARGS)
32
Andy Bavierb101bd12019-03-15 15:23:08 -070033NEM_WORKFLOW ?= att-workflow
Andy Bavierb4b866a2019-05-30 12:35:45 -070034NUM_OLTS ?= 1
35NUM_ONUS_PER_OLT ?= 1
Andy Bavierb101bd12019-03-15 15:23:08 -070036
Zack Williamsd0c12f02018-11-21 11:54:36 -070037# Targets
38ponsim: $(M)/siab
39
40bbsim: $(M)/bbsim-tosca
41
42both: BBSIM_DHCP_TOSCA =
43both: $(M)/siab $(M)/bbsim-tosca
Andy Bavier35053b62018-09-20 13:45:45 -070044
Andy Baviere5a16f62018-10-11 14:07:15 -070045# https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html#SEC69
46latest: SEBAVALUES := configs/seba-ponsim-latest.yaml
Andy Bavier2a5a78e2019-01-08 16:47:47 -070047latest: ponsim
Andy Baviere5a16f62018-10-11 14:07:15 -070048
49stable: SEBAVALUES := configs/seba-ponsim.yaml
Andy Bavier2a5a78e2019-01-08 16:47:47 -070050stable: ponsim
Andy Baviere5a16f62018-10-11 14:07:15 -070051
Andy Bavier1d5b9922019-01-02 15:30:55 -070052siab-1.0: SEBAVALUES := configs/siab-v1.0.0.yaml
53siab-1.0: KAFKA_POD := "pod/cord-platform-kafka-0"
54# Parallel make won't work here; need to install seba-1.0.0 before siab
55siab-1.0: $(M)/seba-1.0.0 $(M)/siab
56
Andy Bavier35053b62018-09-20 13:45:45 -070057$(M)/setup:
Andy Bavier9d8aae52019-03-14 09:41:11 -070058 sudo $(MAKEDIR)/../scripts/portcheck.sh
Andy Bavier35053b62018-09-20 13:45:45 -070059 mkdir -p $(M)
60 sudo apt update
61 sudo apt install -y httpie jq software-properties-common
62 sudo swapoff -a
Andy Bavier772a54a2019-05-07 09:16:28 -070063 if [ -d /usr/local/etc/emulab ]; then $(MAKEDIR)/../openstack-helm/cloudlab-disk-setup.sh; fi
Andy Bavier35053b62018-09-20 13:45:45 -070064 touch $@
65
66/usr/bin/docker: | $(M)/setup
67 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 0EBFCD88
68 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(shell lsb_release -cs) stable"
69 sudo apt update
Zack Williams2a6a1072019-01-07 11:15:12 -070070 sudo apt install -y "docker-ce=${DOCKER_VERSION}*"
Andy Bavier35053b62018-09-20 13:45:45 -070071
72/usr/bin/kubeadm: | $(M)/setup /usr/bin/docker
73 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
74 echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /tmp/kubernetes.list
75 sudo cp /tmp/kubernetes.list /etc/apt/sources.list.d/kubernetes.list
76 sudo apt update
Zack Williams2a6a1072019-01-07 11:15:12 -070077 sudo apt install -y "kubeadm=${K8S_VERSION}-*" "kubelet=${K8S_VERSION}-*" "kubectl=${K8S_VERSION}-*"
Andy Bavier35053b62018-09-20 13:45:45 -070078
79/usr/local/bin/helm:
80 curl -L -o /tmp/helm.tgz "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-${HELM_PLATFORM}.tar.gz"
81 echo "${HELM_SHA256SUM} /tmp/helm.tgz" | sha256sum -c -
82 cd /tmp; tar -xzvf helm.tgz; sudo mv ${HELM_PLATFORM}/helm /usr/local/bin/helm
83 sudo chmod a+x /usr/local/bin/helm
84 rm -rf /tmp/helm.tgz /tmp/${HELM_PLATFORM}
85
86$(M)/kubeadm: | $(M)/setup /usr/bin/kubeadm
87 sudo kubeadm init --pod-network-cidr=192.168.0.0/16
Andy Baviera7c6a4e2018-09-28 13:29:43 -070088 mkdir -p $(HOME)/.kube
89 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
90 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
Zack Williams2a6a1072019-01-07 11:15:12 -070091 kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
92 kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml
Andy Bavier35053b62018-09-20 13:45:45 -070093 kubectl taint nodes --all node-role.kubernetes.io/master-
94 touch $@
95
96$(M)/helm-init: | $(M)/kubeadm /usr/local/bin/helm
97 kubectl create serviceaccount --namespace kube-system tiller
98 kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
99 helm init --service-account tiller
100 until helm ls >& /dev/null; \
101 do \
102 echo "Waiting for Helm to be ready"; \
103 sleep 5; \
104 done
Zack Williams3bcdc262018-09-27 11:00:38 -0700105 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
Andy Bavier1d5b9922019-01-02 15:30:55 -0700106 helm repo add cord https://charts.opencord.org
Andy Bavier35053b62018-09-20 13:45:45 -0700107 touch $@
108
109$(WORKSPACE)/cord/helm-charts: | $(M)/setup
110 mkdir -p $(WORKSPACE)/cord
111 cd $(WORKSPACE)/cord; git clone https://gerrit.opencord.org/helm-charts
112
113$(M)/kafka: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init
Zack Williams3bcdc262018-09-27 11:00:38 -0700114 cd $(WORKSPACE)/cord/helm-charts && \
Zack Williams8fa04e72018-11-04 22:16:58 -0700115 helm upgrade --install $(HELM_GLOBAL_ARGS) cord-kafka --version $(KAFKA_CHART_VERSION) -f examples/kafka-single.yaml incubator/kafka
Andy Bavier35053b62018-09-20 13:45:45 -0700116 touch $@
117
118$(M)/kafka-running: | $(M)/kafka
Andy Bavier1d5b9922019-01-02 15:30:55 -0700119 kubectl wait $(KAFKA_POD) --for condition=Ready --timeout=180s
Andy Bavier35053b62018-09-20 13:45:45 -0700120 touch $@
121
Zack Williams3bcdc262018-09-27 11:00:38 -0700122$(M)/nem-monitoring: | $(M)/kafka-running
123 cd $(WORKSPACE)/cord/helm-charts && \
124 helm dep up nem-monitoring && \
Zack Williams8fa04e72018-11-04 22:16:58 -0700125 helm upgrade --install $(HELM_GLOBAL_ARGS) nem-monitoring nem-monitoring
Zack Williams3bcdc262018-09-27 11:00:38 -0700126 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
127 touch $@
128
129$(M)/logging: | $(M)/kafka-running
130 cd $(WORKSPACE)/cord/helm-charts && \
131 helm dep up logging && \
Zack Williams8fa04e72018-11-04 22:16:58 -0700132 helm upgrade --install $(HELM_GLOBAL_ARGS) logging -f examples/logging-single.yaml logging
Zack Williams3bcdc262018-09-27 11:00:38 -0700133 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
134 touch $@
135
Andy Bavier35053b62018-09-20 13:45:45 -0700136# Dependency on NEM is there to force ordering for parallel install
137# The idea is to install VOLTHA / ONOS / Mininet while NEM is initializing
Zack Williams3bcdc262018-09-27 11:00:38 -0700138$(M)/onos: | $(M)/kafka-running $(M)/nem $(INFRA_PREREQS)
Zack Williams8fa04e72018-11-04 22:16:58 -0700139 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_ONOS_ARGS) onos onos -f $(SEBAVALUES)
Andy Bavier35053b62018-09-20 13:45:45 -0700140 touch $@
141
Andy Bavier46c64622019-02-04 16:05:22 -0700142# SEBA-440 Sometimes VOLTHA install fails with 'namespaces "voltha" not found'
143# Work around by repeatedly trying to install the chart until it succeeds
Andy Bavier1e3e9522018-11-06 11:12:00 -0700144$(M)/voltha: | $(M)/kafka-running $(INFRA_PREREQS) $(M)/etcd-operator-ready
Andy Bavierbab9b332019-02-07 07:54:32 -0700145 sudo sh -c "echo 1048576 > /proc/sys/fs/inotify/max_user_watches"
Andy Bavier35053b62018-09-20 13:45:45 -0700146 cd $(WORKSPACE)/cord/helm-charts; helm dep up voltha
Andy Bavier46c64622019-02-04 16:05:22 -0700147 cd $(WORKSPACE)/cord/helm-charts; \
148 for i in 1 2 3; \
149 do \
150 helm upgrade --install $(HELM_VOLTHA_ARGS) voltha voltha -f $(SEBAVALUES) && break; \
151 echo "VOLTHA chart install failed; cleaning up and trying again"; \
152 helm delete --purge voltha; \
153 until ! kubectl get namespace voltha; \
154 do \
155 sleep 5; \
156 done; \
157 sleep 5; \
158 done
Andy Bavier35053b62018-09-20 13:45:45 -0700159 touch $@
160
Andy Bavier1e3e9522018-11-06 11:12:00 -0700161$(M)/etcd-operator-ready: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init
Zack Williams5c16dc82019-01-08 10:57:08 -0700162 cd $(WORKSPACE)/cord/helm-charts; \
163 helm upgrade --install etcd-operator --version $(ETCD_OPERATOR_VERSION) stable/etcd-operator -f $(SEBAVALUES)
Andy Bavier46c64622019-02-04 16:05:22 -0700164 timeout 120s bash -c "until kubectl get crd | grep etcdclusters; do echo 'Waiting for etcdclusters CRD to be available'; sleep 5; done"
Andy Bavier35053b62018-09-20 13:45:45 -0700165 touch $@
166
Andy Bavier1e3e9522018-11-06 11:12:00 -0700167$(M)/voltha-running: | $(M)/voltha
Kailashbff9eb72018-11-16 13:03:59 -0800168 timeout 300s bash -c "until kubectl get pod|grep etcd-cluster|grep 1/1; do echo 'Waiting for etcd-cluster to be ready'; sleep 10; done"
Andy Bavier35053b62018-09-20 13:45:45 -0700169 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh voltha
170 touch $@
171
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700172$(M)/ponnet: | $(M)/voltha
Andy Bavierb4b866a2019-05-30 12:35:45 -0700173 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) ponnet ponnet --set numOlts=$(NUM_OLTS)
Andy Bavier35053b62018-09-20 13:45:45 -0700174 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh kube-system
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700175 touch $@
176
177$(M)/ponsim: | $(M)/ponnet $(M)/voltha
Andy Bavierb4b866a2019-05-30 12:35:45 -0700178 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) ponsimv2 ponsimv2 -f $(SEBAVALUES) --set numOlts=$(NUM_OLTS)
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700179 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh voltha
Andy Bavier35053b62018-09-20 13:45:45 -0700180 touch $@
181
Andy Bavierb4b866a2019-05-30 12:35:45 -0700182# For each OLT, set up forwarding on the ponX bridge
183$(M)/ponX_fwd: | $(M)/ponsim
184 echo 8 > /tmp/group_fwd_mask
185 for (( i=0; i<=$(NUM_OLTS)-1; i++ )); \
Andy Bavier35053b62018-09-20 13:45:45 -0700186 do \
Andy Bavierb4b866a2019-05-30 12:35:45 -0700187 until sudo cp /tmp/group_fwd_mask /sys/class/net/pon$$i/bridge/group_fwd_mask; \
188 do \
189 echo "waiting for pon$$i..."; \
190 sleep 5; \
191 done; \
Andy Bavier35053b62018-09-20 13:45:45 -0700192 done
Andy Bavierb4b866a2019-05-30 12:35:45 -0700193 rm /tmp/group_fwd_mask
Andy Bavier35053b62018-09-20 13:45:45 -0700194 touch $@
195
Andy Bavierf9a426d2019-04-04 11:19:19 -0700196# Make sure that we're using the ofdpa-ovs driver with OvS.
Andy Bavierb4b866a2019-05-30 12:35:45 -0700197$(M)/mininet: | $(M)/onos $(M)/ponsim $(M)/ponX_fwd $(M)/ponsim-tosca
Andy Bavier35053b62018-09-20 13:45:45 -0700198 sudo modprobe openvswitch
Andy Bavierf9a426d2019-04-04 11:19:19 -0700199 timeout 60s bash -c "until ! http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/fabric/switches|jq '.items[].driver'|grep -v ofdpa-ovs ; do echo 'waiting for switch driver == ofdpa-ovs'; sleep 5; done"
200 timeout 60s bash -c "until ! http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/fabric/switches|jq '.items[].backend_status'|grep -v OK; do echo 'waiting for switch driver to sync'; sleep 5; done"
Andy Bavierb4b866a2019-05-30 12:35:45 -0700201 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) mininet mininet -f $(SEBAVALUES) --set numOlts=$(NUM_OLTS)
Andy Bavier35053b62018-09-20 13:45:45 -0700202 touch $@
203
Zack Williamsd0c12f02018-11-21 11:54:36 -0700204$(M)/nem: | $(M)/kafka-running $(INFRA_PREREQS)
Andy Bavier35053b62018-09-20 13:45:45 -0700205 cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-core
Zack Williams8fa04e72018-11-04 22:16:58 -0700206 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) xos-core xos-core -f $(SEBAVALUES)
Matteo Scandolof3ceb4c2018-12-12 15:48:38 -0800207 cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-profiles/seba-services
Zack Williams8fa04e72018-11-04 22:16:58 -0700208 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) seba-services xos-profiles/seba-services -f $(SEBAVALUES)
Andy Bavierb101bd12019-03-15 15:23:08 -0700209 cd $(WORKSPACE)/cord/helm-charts; helm dep update workflows/$(NEM_WORKFLOW)
210 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) $(NEM_WORKFLOW) workflows/$(NEM_WORKFLOW) -f $(SEBAVALUES)
Andy Bavierde4537d2018-11-29 11:48:25 -0700211 cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-profiles/base-kubernetes
Zack Williams8fa04e72018-11-04 22:16:58 -0700212 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) base-kubernetes xos-profiles/base-kubernetes -f $(SEBAVALUES)
Andy Bavier35053b62018-09-20 13:45:45 -0700213 touch $@
214
Zack Williamsd0c12f02018-11-21 11:54:36 -0700215$(M)/nem-running: | $(M)/nem
Andy Bavier35053b62018-09-20 13:45:45 -0700216 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
217 touch $@
218
Andy Bavierf9a426d2019-04-04 11:19:19 -0700219$(M)/ponsim-tosca: | $(M)/onos $(M)/nem-running
Andy Bavier35053b62018-09-20 13:45:45 -0700220 timeout 60s bash -c "until ! http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/core/serviceinstanceattributes|jq '.items[].backend_status'|grep -v OK; do echo 'waiting for ONOS config to sync'; sleep 5; done"
221 timeout 60s bash -c "until ! http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/onos/onosapps|jq '.items[].backend_status'|grep -v OK; do echo 'waiting for ONOS apps to sync'; sleep 5; done"
Andy Bavier905ec802018-10-04 11:08:37 -0700222 timeout 60s bash -c "until http -a karaf:karaf GET http://127.0.0.1:30120/onos/v1/applications/org.opencord.kafka|jq '.state'|grep -q ACTIVE; do echo 'Waiting for Kafka app to become ACTIVE'; sleep 5; done"
Andy Bavierb4b866a2019-05-30 12:35:45 -0700223 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) ponsim-pod xos-profiles/ponsim-pod -f $(SEBAVALUES) --set workflow=$(NEM_WORKFLOW) --set numOlts=$(NUM_OLTS)
Andy Bavier35053b62018-09-20 13:45:45 -0700224 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
225 touch $@
226
227$(M)/siab: | $(M)/voltha-running $(M)/mininet $(M)/ponsim-tosca
228 until http -a karaf:karaf --ignore-stdin --check-status GET http://127.0.0.1:30120/onos/v1/configuration/org.opencord.olt.impl.Olt; \
229 do \
230 sleep 5; \
231 done
232 http -a karaf:karaf --ignore-stdin POST http://127.0.0.1:30120/onos/v1/configuration/org.opencord.olt.impl.Olt defaultVlan=65535
Andy Bavier905ec802018-10-04 11:08:37 -0700233 timeout 1m bash -c "until http GET http://127.0.0.1:30125/health|jq '.state'|grep -q HEALTHY; do echo 'Waiting for VOLTHA to be HEALTHY'; sleep 10; done"
234 echo "[passed] VOLTHA is HEALTHY"
Andy Bavierb4b866a2019-05-30 12:35:45 -0700235 timeout 2m bash -c "until http GET http://127.0.0.1:30125/api/v1/devices|jq '.items[].admin_state'|grep ENABLED|wc -l|grep -q $$(( 2 * $(NUM_OLTS) )); do echo 'Waiting for OLT and ONU to be enabled in VOLTHA'; sleep 10; done"
Andy Bavier905ec802018-10-04 11:08:37 -0700236 echo "[passed] OLT and ONU are enabled in VOLTHA"
Andy Bavierb4b866a2019-05-30 12:35:45 -0700237 timeout 2m bash -c "until http -a karaf:karaf GET http://127.0.0.1:30120/onos/v1/devices|jq '.devices[].available'|grep true|wc -l|grep -q $$(( $(NUM_OLTS) + 1 )); do echo 'Waiting for VOLTHA logical device and agg switch to be available in ONOS'; sleep 10; done"
Andy Bavier905ec802018-10-04 11:08:37 -0700238 echo "[passed] VOLTHA logical device and agg switch are available in ONOS"
Andy Bavierf9a426d2019-04-04 11:19:19 -0700239 # For some reason the dhcpl2relay app needs to be restarted after connecting the switch to ONOS's ofdpa-ovs driver.
240 # Without this step the DHCP trap flow is not added to the agg switch.
241 http -a karaf:karaf --ignore-stdin DELETE http://127.0.0.1:30120/onos/v1/applications/org.opencord.dhcpl2relay/active
242 http -a karaf:karaf --ignore-stdin POST http://127.0.0.1:30120/onos/v1/applications/org.opencord.dhcpl2relay/active
243 http -a karaf:karaf --ignore-stdin POST http://127.0.0.1:30120/onos/v1/applications/org.opencord.kafka/active
Andy Baviera5ef3a12019-03-18 12:06:46 -0700244ifeq ($(NEM_WORKFLOW),att-workflow)
Andy Bavier905ec802018-10-04 11:08:37 -0700245 timeout 2m bash -c "until http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |jq '.items[0].authentication_state'|grep -q AWAITING; do echo 'waiting for ATT Workflow Driver ServiceInstance to be in AWAITING state'; sleep 10; done"
246 echo "[passed] ATT Workflow Driver ServiceInstance is in AWAITING state"
Andy Baviera5ef3a12019-03-18 12:06:46 -0700247endif
248ifeq ($(NEM_WORKFLOW),tt-workflow)
249 timeout 2m bash -c "until http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/tt-workflow-driver/ttworkflowdriverserviceinstances |jq '.items[0].dhcp_state'|grep -q AWAITING; do echo 'waiting for TT Workflow Driver ServiceInstance to be in AWAITING state'; sleep 10; done"
250 echo "[passed] TT Workflow Driver ServiceInstance is in AWAITING state"
251endif
Andy Bavierecb2bf32019-03-12 09:50:10 -0700252 sudo iptables -P FORWARD ACCEPT
253 sudo apparmor_parser -R /etc/apparmor.d/sbin.dhclient || true
Andy Baviera85fdc02019-05-17 10:50:49 -0700254 sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.tcpdump || true
Andy Bavier35053b62018-09-20 13:45:45 -0700255 touch $@
256 echo "SEBA-in-a-Box installation finished!"
257
Andy Bavier1d5b9922019-01-02 15:30:55 -0700258$(M)/seba-1.0.0: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init
259 helm install -n cord-platform cord/cord-platform --version=6.1.0 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES)
260 until kubectl get crd | grep etcdclusters; \
261 do \
262 echo "Waiting for etcdclusters CRD to be available"; \
263 sleep 5; \
264 done
265 touch $(M)/kafka
266 touch $(M)/onos
267 touch $(M)/etcd-operator-ready
268 helm install -n seba cord/seba --version=1.0.0 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES)
269 helm install -n att-workflow cord/att-workflow --version=1.0.2 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES)
270 touch $(M)/voltha
271 touch $(M)/nem
272 touch $@
273
Zack Williamsd0c12f02018-11-21 11:54:36 -0700274# BBSim support
275BBSIM_OLT_TOSCA ?= examples/bbsim-16.yaml
276BBSIM_DHCP_TOSCA ?= examples/bbsim-dhcp.yaml
277
278$(M)/bbsim: | $(M)/onos $(M)/voltha-running $(M)/nem-running
279 cd $(WORKSPACE)/cord/helm-charts && \
280 helm upgrade --install bbsim bbsim -f $(SEBAVALUES) && \
281 scripts/wait_for_pods.sh voltha && \
282 touch $@
283
284$(M)/bbsim-tosca: | $(M)/bbsim
285 cd $(WORKSPACE)/cord/helm-charts && \
286 echo "Loading BBSim TOSCA: $(BBSIM_DHCP_TOSCA) $(BBSIM_OLT_TOSCA)" && \
287 for tosca in $(BBSIM_DHCP_TOSCA) $(BBSIM_OLT_TOSCA) ; do \
288 curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @$$tosca http://127.0.0.1:30007/run ; \
289 done && \
290 touch $@
291
292run-tests: | $(M)/qatests
Kailash124139f2019-05-13 19:56:37 -0700293run-tests: PYBOT_ARGS := -v ONU_STATE_VAR:onu_state
Kailash4257f1a2019-05-14 09:27:11 -0700294
295run-tests-latest: | $(M)/qatests
Andy Bavierb4b866a2019-05-30 12:35:45 -0700296run-tests-latest: PYBOT_ARGS := -v SUBSCRIBER_FILENAME:SIABSubscriberLatest -v WHITELIST_FILENAME:SIABWhitelistLatest -v OLT_DEVICE_FILENAME:SIABOLT0Device
Andy Bavier81b0b582019-04-29 15:33:50 -0700297
Andy Bavier01449932018-10-01 16:19:40 -0700298$(M)/qatests-prereqs:
299 sudo apt install -y python-pip virtualenv
Andy Bavier35053b62018-09-20 13:45:45 -0700300 touch $@
301
Andy Bavier01449932018-10-01 16:19:40 -0700302$(WORKSPACE)/cord/test/cord-tester: | $(M)/setup
303 mkdir -p $(WORKSPACE)/cord/test
304 cd $(WORKSPACE)/cord/test && git clone https://gerrit.opencord.org/cord-tester
Andy Bavier35053b62018-09-20 13:45:45 -0700305
Kailash45ad32e2019-03-06 14:37:16 -0800306$(WORKSPACE)/cord/incubator/voltha: | $(M)/setup
307 mkdir -p $(WORKSPACE)/cord/incubator
308 cd $(WORKSPACE)/cord/incubator && git clone https://gerrit.opencord.org/voltha
Kailashd6061102019-03-06 08:14:36 -0800309
Zack Williamsd0c12f02018-11-21 11:54:36 -0700310PYBOT_ARGS ?=
Kailash45ad32e2019-03-06 14:37:16 -0800311$(M)/qatests: | $(M)/siab $(M)/qatests-prereqs $(WORKSPACE)/cord/test/cord-tester $(WORKSPACE)/cord/incubator/voltha
Andy Bavier01449932018-10-01 16:19:40 -0700312 cd $(WORKSPACE)/cord/test/cord-tester/src/test/cord-api/ && \
Kailash45ad32e2019-03-06 14:37:16 -0800313 WORKSPACE=$(VIRTUALENV) bash ./setup_venv.sh && \
314 source $(VIRTUALENV)/venv-cord-tester/bin/activate && \
315 cd Tests/WorkflowValidations/ && \
316 robot $(PYBOT_ARGS) --removekeywords wuks -e notready -i $(TESTTAGS) -v VOLTHA_DIR:$(WORKSPACE)/cord/incubator/voltha SIAB.robot
Andy Bavier35053b62018-09-20 13:45:45 -0700317 touch $@
318
319remove-chart-milestones:
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700320 cd $(M); rm -f kafka-running onos voltha etcd-operator-ready etcd-cluster \
Zack Williamsd0c12f02018-11-21 11:54:36 -0700321 voltha-running ponsim mininet nem nem-running ponsim-tosca siab bbsim bbsim-tosca \
Andy Bavierb4b866a2019-05-30 12:35:45 -0700322 logging nem-monitoring seba-1.0.0 ponX_fwd
Andy Bavier35053b62018-09-20 13:45:45 -0700323
324remove-kube-milestones:
325 cd $(M); rm -f kubeadm helm-init
326
327remove-test-milestones:
Kailashf8ff8122018-12-03 10:44:06 -0800328 cd $(M); rm -f qatests qatests-prereqs
Andy Bavier35053b62018-09-20 13:45:45 -0700329
330teardown-charts: remove-chart-milestones
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700331 helm delete --purge $(shell helm ls -q | grep -v -E "docker-registry|mavenrepo|ponnet|kafka")
332 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
Andy Bavier35053b62018-09-20 13:45:45 -0700333
Kailashf8ff8122018-12-03 10:44:06 -0800334reset-kubeadm: remove-chart-milestones remove-kube-milestones remove-test-milestones
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700335 cd $(M); rm -f kafka ponnet
Andy Bavier5a02e6d2019-01-16 15:54:30 -0700336 sudo kubeadm reset -f || true
Andy Bavier35053b62018-09-20 13:45:45 -0700337 sudo iptables -F && sudo iptables -t nat -F && sudo iptables -t mangle -F && sudo iptables -X
Andy Bavierb4b866a2019-05-30 12:35:45 -0700338 sudo rm -f /var/lib/cni/networks/pon*/* || true
339 sudo rm -f /var/lib/cni/networks/nni*/* || true
Andy Bavier5a02e6d2019-01-16 15:54:30 -0700340 sudo rm -f /var/lib/cni/networks/k8s-pod-network/* || true