blob: bd2b3398386b5d7d0af530f54e391808c7777758 [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
Zack Williamsf0b8e942019-07-23 16:21:28 -070018HELM_VERSION ?= "2.14.2"
19HELM_SHA256SUM ?= "9f50e69cf5cfa7268b28686728ad0227507a169e52bf59c99ada872ddd9679f0"
Andy Bavier35053b62018-09-20 13:45:45 -070020HELM_PLATFORM ?= "linux-amd64"
21
Himanshu Bhandari7451f112020-05-19 09:35:12 +053022CORDCTL_VERSION ?= v1.1.5
23CORDCTL_SHA256SUM ?= 9f93090cc7e0fad5b8a382efb7599bbfe65307f880d9b23c58fa07132aabedb3
Andy Bavier48f8f552019-06-05 15:37:04 -070024CORDCTL_PLATFORM ?= linux-amd64
25
Zack Williams2a6a1072019-01-07 11:15:12 -070026KAFKA_CHART_VERSION ?= 0.13.3
Andy Bavier1d5b9922019-01-02 15:30:55 -070027KAFKA_POD := "pod/cord-kafka-0"
Zack Williams3bcdc262018-09-27 11:00:38 -070028
Zack Williams5c16dc82019-01-08 10:57:08 -070029ETCD_OPERATOR_VERSION ?= 0.8.3
30
Zack Williams8fa04e72018-11-04 22:16:58 -070031# Arguments passed to helm install/upgrade for all or specific charts
32HELM_GLOBAL_ARGS ?=
33HELM_NEM_ARGS ?= $(HELM_GLOBAL_ARGS)
34HELM_ONOS_ARGS ?= $(HELM_GLOBAL_ARGS)
35HELM_VOLTHA_ARGS ?= $(HELM_GLOBAL_ARGS)
36
Andy Bavierb101bd12019-03-15 15:23:08 -070037NEM_WORKFLOW ?= att-workflow
Andy Bavierb4b866a2019-05-30 12:35:45 -070038NUM_OLTS ?= 1
39NUM_ONUS_PER_OLT ?= 1
Andy Bavierb101bd12019-03-15 15:23:08 -070040
Matteo Scandolo83d1ee62019-06-07 10:37:53 -070041# BBSim related Arguments
42BBSIM_OLT_TOSCA ?= examples/bbsim-16.yaml
43BBSIM_DHCP_TOSCA ?= examples/bbsim-dhcp.yaml
Andy Bavier9c8c8b92019-07-18 15:19:53 -070044BBSIM_TECH_PROF_TOSCA ?= examples/technology-profile.yaml
Matteo Scandolo83d1ee62019-06-07 10:37:53 -070045
stevenchiu30801ee102c12019-10-12 01:45:36 +080046# Driver of fabric switches (e.g. ofdpa-ovs, stratum-bmv2)
47FABRIC_DRIVER ?= ofdpa-ovs
48
Zack Williamsd0c12f02018-11-21 11:54:36 -070049# Targets
Andy Bavierc6d16d72019-06-25 14:28:43 -070050ponsim: validate_args $(M)/siab
Zack Williamsd0c12f02018-11-21 11:54:36 -070051
52bbsim: $(M)/bbsim-tosca
53
Matteo Scandolo83d1ee62019-06-07 10:37:53 -070054bbsim-latest: SEBAVALUES := configs/seba-ponsim-latest.yaml
Matteo Scandolo83d1ee62019-06-07 10:37:53 -070055bbsim-latest: $(M)/bbsim-tosca
56
Zack Williamsd0c12f02018-11-21 11:54:36 -070057both: BBSIM_DHCP_TOSCA =
58both: $(M)/siab $(M)/bbsim-tosca
Andy Bavier35053b62018-09-20 13:45:45 -070059
Andy Baviere5a16f62018-10-11 14:07:15 -070060# https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html#SEC69
Daniele Moro3cbb72b2019-12-13 17:50:35 -080061latest: SEBAVALUES := configs/seba-ponsim.yaml,configs/seba-ponsim-latest.yaml
Andy Bavier2a5a78e2019-01-08 16:47:47 -070062latest: ponsim
Andy Baviere5a16f62018-10-11 14:07:15 -070063
64stable: SEBAVALUES := configs/seba-ponsim.yaml
Andy Bavier2a5a78e2019-01-08 16:47:47 -070065stable: ponsim
Andy Baviere5a16f62018-10-11 14:07:15 -070066
Zack Williams2f8ce3b2019-07-03 11:42:16 -070067siab-2.0-alpha1: SEBAVALUES := configs/siab-v2.0.0-alpha1.yaml
68siab-2.0-alpha1: KAFKA_POD := "pod/cord-platform-kafka-0"
69# Parallel make won't work here; need to install seba-2.0.0 before siab
70siab-2.0-alpha1: $(M)/seba-2.0.0-alpha1 $(M)/siab
Andy Bavier1d5b9922019-01-02 15:30:55 -070071
Daniele Moro3cbb72b2019-12-13 17:50:35 -080072stratum-stable: SEBAVALUES := configs/seba-ponsim.yaml,configs/seba-ponsim-stratum.yaml
73stratum-stable: FABRIC_DRIVER := stratum-bmv2
74stratum-stable: ponsim
75
76stratum-latest: SEBAVALUES += configs/seba-ponsim.yaml,configs/seba-ponsim-stratum.yaml,configs/seba-ponsim-latest.yaml
77stratum-latest: FABRIC_DRIVER := stratum-bmv2
78stratum-latest: ponsim
79
80sdbng-stable: SEBAVALUES := configs/seba-ponsim.yaml,configs/seba-ponsim-sdbng.yaml
81sdbng-stable: FABRIC_DRIVER := stratum-bmv2
82sdbng-stable: NEM_WORKFLOW := dt-workflow
83sdbng-stable: ponsim
84
85sdbng-latest: SEBAVALUES := configs/seba-ponsim.yaml,configs/seba-ponsim-sdbng.yaml,configs/seba-ponsim-latest.yaml
86sdbng-latest: FABRIC_DRIVER := stratum-bmv2
87sdbng-latest: NEM_WORKFLOW := dt-workflow
88sdbng-latest: ponsim
89
Andy Bavierc6d16d72019-06-25 14:28:43 -070090validate_args:
91 if ! ([[ $(NUM_OLTS) == ?(-)+([0-9]) ]] && [ $(NUM_OLTS) -ge 1 ] && [ $(NUM_OLTS) -le 4 ]); \
92 then \
93 echo "Invalid value: NUM_OLTS must between 1 and 4"; \
94 exit 1; \
95 fi
96 if ! ([[ $(NUM_ONUS_PER_OLT) == ?(-)+([0-9]) ]] && [ $(NUM_ONUS_PER_OLT) -ge 1 ] && [ $(NUM_ONUS_PER_OLT) -le 4 ]); \
97 then \
98 echo "Invalid value: NUM_ONUS_PER_OLT must between 1 and 4"; \
99 exit 1; \
100 fi
101
Andy Bavier35053b62018-09-20 13:45:45 -0700102$(M)/setup:
Andy Bavier9d8aae52019-03-14 09:41:11 -0700103 sudo $(MAKEDIR)/../scripts/portcheck.sh
Andy Bavier35053b62018-09-20 13:45:45 -0700104 mkdir -p $(M)
105 sudo apt update
106 sudo apt install -y httpie jq software-properties-common
107 sudo swapoff -a
Hyunsun Moon81c8e232019-05-21 03:40:22 -0600108 if [ -d /usr/local/etc/emulab ]; then $(MAKEDIR)/../scripts/cloudlab-disksetup.sh; fi
Andy Bavier35053b62018-09-20 13:45:45 -0700109 touch $@
110
111/usr/bin/docker: | $(M)/setup
112 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 0EBFCD88
113 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(shell lsb_release -cs) stable"
114 sudo apt update
Zack Williams2a6a1072019-01-07 11:15:12 -0700115 sudo apt install -y "docker-ce=${DOCKER_VERSION}*"
Andy Bavier35053b62018-09-20 13:45:45 -0700116
117/usr/bin/kubeadm: | $(M)/setup /usr/bin/docker
118 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
119 echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /tmp/kubernetes.list
120 sudo cp /tmp/kubernetes.list /etc/apt/sources.list.d/kubernetes.list
121 sudo apt update
Zack Williams2a6a1072019-01-07 11:15:12 -0700122 sudo apt install -y "kubeadm=${K8S_VERSION}-*" "kubelet=${K8S_VERSION}-*" "kubectl=${K8S_VERSION}-*"
Andy Bavier35053b62018-09-20 13:45:45 -0700123
124/usr/local/bin/helm:
125 curl -L -o /tmp/helm.tgz "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-${HELM_PLATFORM}.tar.gz"
126 echo "${HELM_SHA256SUM} /tmp/helm.tgz" | sha256sum -c -
127 cd /tmp; tar -xzvf helm.tgz; sudo mv ${HELM_PLATFORM}/helm /usr/local/bin/helm
128 sudo chmod a+x /usr/local/bin/helm
129 rm -rf /tmp/helm.tgz /tmp/${HELM_PLATFORM}
130
Andy Bavier48f8f552019-06-05 15:37:04 -0700131/usr/local/bin/cordctl:
132 curl -L -o /tmp/cordctl "https://github.com/opencord/cordctl/releases/download/${CORDCTL_VERSION}/cordctl-${CORDCTL_PLATFORM}"
133 echo "${CORDCTL_SHA256SUM} /tmp/cordctl" | sha256sum -c -
134 sudo mv /tmp/cordctl /usr/local/bin/cordctl
135 sudo chmod a+x /usr/local/bin/cordctl
136 mkdir -p ~/.cord
Andy Bavier03afc232019-06-08 11:10:50 -0700137 printf "server: 127.0.0.1:30011\nusername: admin@opencord.org\npassword: letmein\ngrpc:\n timeout: 10s\n" > ~/.cord/config
Andy Bavier48f8f552019-06-05 15:37:04 -0700138
Andy Bavier35053b62018-09-20 13:45:45 -0700139$(M)/kubeadm: | $(M)/setup /usr/bin/kubeadm
140 sudo kubeadm init --pod-network-cidr=192.168.0.0/16
Andy Baviera7c6a4e2018-09-28 13:29:43 -0700141 mkdir -p $(HOME)/.kube
142 sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config
143 sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config
Zack Williams2a6a1072019-01-07 11:15:12 -0700144 kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
145 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 -0700146 kubectl taint nodes --all node-role.kubernetes.io/master-
147 touch $@
148
149$(M)/helm-init: | $(M)/kubeadm /usr/local/bin/helm
150 kubectl create serviceaccount --namespace kube-system tiller
151 kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
152 helm init --service-account tiller
153 until helm ls >& /dev/null; \
154 do \
155 echo "Waiting for Helm to be ready"; \
156 sleep 5; \
157 done
Zack Williams3bcdc262018-09-27 11:00:38 -0700158 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
Andy Bavier1d5b9922019-01-02 15:30:55 -0700159 helm repo add cord https://charts.opencord.org
Andy Bavierdef246b2019-09-17 14:44:30 -0700160 helm repo update
Andy Bavier35053b62018-09-20 13:45:45 -0700161 touch $@
162
163$(WORKSPACE)/cord/helm-charts: | $(M)/setup
164 mkdir -p $(WORKSPACE)/cord
165 cd $(WORKSPACE)/cord; git clone https://gerrit.opencord.org/helm-charts
166
167$(M)/kafka: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init
Zack Williams3bcdc262018-09-27 11:00:38 -0700168 cd $(WORKSPACE)/cord/helm-charts && \
Zack Williams8fa04e72018-11-04 22:16:58 -0700169 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 -0700170 touch $@
171
172$(M)/kafka-running: | $(M)/kafka
Andy Bavier1d5b9922019-01-02 15:30:55 -0700173 kubectl wait $(KAFKA_POD) --for condition=Ready --timeout=180s
Andy Bavier35053b62018-09-20 13:45:45 -0700174 touch $@
175
Zack Williams3bcdc262018-09-27 11:00:38 -0700176$(M)/nem-monitoring: | $(M)/kafka-running
177 cd $(WORKSPACE)/cord/helm-charts && \
178 helm dep up nem-monitoring && \
Daniele Moro3cbb72b2019-12-13 17:50:35 -0800179 helm upgrade --install $(HELM_GLOBAL_ARGS) nem-monitoring nem-monitoring -f $(SEBAVALUES)
Zack Williams3bcdc262018-09-27 11:00:38 -0700180 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
181 touch $@
182
183$(M)/logging: | $(M)/kafka-running
184 cd $(WORKSPACE)/cord/helm-charts && \
185 helm dep up logging && \
Zack Williams8fa04e72018-11-04 22:16:58 -0700186 helm upgrade --install $(HELM_GLOBAL_ARGS) logging -f examples/logging-single.yaml logging
Zack Williams3bcdc262018-09-27 11:00:38 -0700187 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
188 touch $@
189
Andy Bavier35053b62018-09-20 13:45:45 -0700190# Dependency on NEM is there to force ordering for parallel install
191# The idea is to install VOLTHA / ONOS / Mininet while NEM is initializing
Zack Williams3bcdc262018-09-27 11:00:38 -0700192$(M)/onos: | $(M)/kafka-running $(M)/nem $(INFRA_PREREQS)
Zack Williams8fa04e72018-11-04 22:16:58 -0700193 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_ONOS_ARGS) onos onos -f $(SEBAVALUES)
Andy Bavier35053b62018-09-20 13:45:45 -0700194 touch $@
195
Andy Bavier46c64622019-02-04 16:05:22 -0700196# SEBA-440 Sometimes VOLTHA install fails with 'namespaces "voltha" not found'
197# Work around by repeatedly trying to install the chart until it succeeds
Andy Bavier1e3e9522018-11-06 11:12:00 -0700198$(M)/voltha: | $(M)/kafka-running $(INFRA_PREREQS) $(M)/etcd-operator-ready
Andy Bavierbab9b332019-02-07 07:54:32 -0700199 sudo sh -c "echo 1048576 > /proc/sys/fs/inotify/max_user_watches"
Andy Bavier35053b62018-09-20 13:45:45 -0700200 cd $(WORKSPACE)/cord/helm-charts; helm dep up voltha
Andy Bavier46c64622019-02-04 16:05:22 -0700201 cd $(WORKSPACE)/cord/helm-charts; \
202 for i in 1 2 3; \
203 do \
204 helm upgrade --install $(HELM_VOLTHA_ARGS) voltha voltha -f $(SEBAVALUES) && break; \
205 echo "VOLTHA chart install failed; cleaning up and trying again"; \
206 helm delete --purge voltha; \
207 until ! kubectl get namespace voltha; \
208 do \
209 sleep 5; \
210 done; \
211 sleep 5; \
212 done
Andy Bavier35053b62018-09-20 13:45:45 -0700213 touch $@
214
Andy Bavier1e3e9522018-11-06 11:12:00 -0700215$(M)/etcd-operator-ready: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init
Zack Williams5c16dc82019-01-08 10:57:08 -0700216 cd $(WORKSPACE)/cord/helm-charts; \
217 helm upgrade --install etcd-operator --version $(ETCD_OPERATOR_VERSION) stable/etcd-operator -f $(SEBAVALUES)
Andy Bavier46c64622019-02-04 16:05:22 -0700218 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 -0700219 touch $@
220
Andy Bavier1e3e9522018-11-06 11:12:00 -0700221$(M)/voltha-running: | $(M)/voltha
Kailashbff9eb72018-11-16 13:03:59 -0800222 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 -0700223 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh voltha
224 touch $@
225
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700226$(M)/ponnet: | $(M)/voltha
Andy Bavierbe3d3612019-06-13 15:19:27 -0700227 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) ponnet ponnet --set numOlts=$(NUM_OLTS) --set numOnus=$(NUM_ONUS_PER_OLT)
Andy Bavier35053b62018-09-20 13:45:45 -0700228 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh kube-system
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700229 touch $@
230
231$(M)/ponsim: | $(M)/ponnet $(M)/voltha
Andy Bavierbe3d3612019-06-13 15:19:27 -0700232 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) ponsimv2 ponsimv2 -f $(SEBAVALUES) --set numOlts=$(NUM_OLTS) --set numOnus=$(NUM_ONUS_PER_OLT)
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700233 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh voltha
Andy Bavier35053b62018-09-20 13:45:45 -0700234 touch $@
235
Andy Bavierbe3d3612019-06-13 15:19:27 -0700236# For each ONU, set up forwarding on the ponX bridge
Andy Bavierb4b866a2019-05-30 12:35:45 -0700237$(M)/ponX_fwd: | $(M)/ponsim
238 echo 8 > /tmp/group_fwd_mask
Andy Bavierbe3d3612019-06-13 15:19:27 -0700239 for bridge in /sys/class/net/pon*; \
Andy Bavier35053b62018-09-20 13:45:45 -0700240 do \
Andy Bavierbe3d3612019-06-13 15:19:27 -0700241 echo Setting up forwarding on `basename $$bridge`; \
242 sudo cp /tmp/group_fwd_mask $$bridge/bridge/group_fwd_mask; \
Andy Bavier35053b62018-09-20 13:45:45 -0700243 done
Andy Bavierb4b866a2019-05-30 12:35:45 -0700244 rm /tmp/group_fwd_mask
Andy Bavier35053b62018-09-20 13:45:45 -0700245 touch $@
246
Andy Bavierf9a426d2019-04-04 11:19:19 -0700247# Make sure that we're using the ofdpa-ovs driver with OvS.
Andy Bavierb4b866a2019-05-30 12:35:45 -0700248$(M)/mininet: | $(M)/onos $(M)/ponsim $(M)/ponX_fwd $(M)/ponsim-tosca
Andy Bavier35053b62018-09-20 13:45:45 -0700249 sudo modprobe openvswitch
stevenchiu30801ee102c12019-10-12 01:45:36 +0800250 timeout 60s bash -c "cordctl model sync Switch -f 'driver=$(FABRIC_DRIVER)'"
Andy Bavier3ac50462019-06-14 09:32:33 -0700251 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) mininet mininet -f $(SEBAVALUES) --set numOlts=$(NUM_OLTS) --set numOnus=$(NUM_ONUS_PER_OLT)
Andy Bavier35053b62018-09-20 13:45:45 -0700252 touch $@
253
Andy Bavier81ab4052019-06-07 07:14:40 -0700254$(M)/nem: | /usr/local/bin/cordctl $(M)/kafka-running $(INFRA_PREREQS)
Andy Bavier35053b62018-09-20 13:45:45 -0700255 cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-core
Zack Williams8fa04e72018-11-04 22:16:58 -0700256 cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) xos-core xos-core -f $(SEBAVALUES)
Matteo Scandolof3ceb4c2018-12-12 15:48:38 -0800257 cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-profiles/seba-services
Zack Williams8fa04e72018-11-04 22:16:58 -0700258 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 -0700259 cd $(WORKSPACE)/cord/helm-charts; helm dep update workflows/$(NEM_WORKFLOW)
260 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 -0700261 cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-profiles/base-kubernetes
Zack Williams8fa04e72018-11-04 22:16:58 -0700262 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 -0700263 touch $@
264
Zack Williamsd0c12f02018-11-21 11:54:36 -0700265$(M)/nem-running: | $(M)/nem
Andy Bavier35053b62018-09-20 13:45:45 -0700266 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
267 touch $@
268
Andy Bavierf9a426d2019-04-04 11:19:19 -0700269$(M)/ponsim-tosca: | $(M)/onos $(M)/nem-running
Andy Bavier48f8f552019-06-05 15:37:04 -0700270 timeout 60s bash -c "cordctl model sync ServiceInstanceAttribute -f 'id>0' -y"
271 timeout 60s bash -c "cordctl model sync ONOSApp -f 'id>0' -y"
Andy Bavier905ec802018-10-04 11:08:37 -0700272 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 Bavierbe3d3612019-06-13 15:19:27 -0700273 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) --set numOnus=$(NUM_ONUS_PER_OLT)
Andy Bavier35053b62018-09-20 13:45:45 -0700274 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
275 touch $@
276
277$(M)/siab: | $(M)/voltha-running $(M)/mininet $(M)/ponsim-tosca
278 until http -a karaf:karaf --ignore-stdin --check-status GET http://127.0.0.1:30120/onos/v1/configuration/org.opencord.olt.impl.Olt; \
279 do \
280 sleep 5; \
281 done
282 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 -0700283 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"
284 echo "[passed] VOLTHA is HEALTHY"
Andy Bavierbe3d3612019-06-13 15:19:27 -0700285 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 $$(( $(NUM_OLTS) + $(NUM_ONUS_PER_OLT) * $(NUM_OLTS) )); do echo 'Waiting for OLT and ONU to be enabled in VOLTHA'; sleep 10; done"
Andy Bavier905ec802018-10-04 11:08:37 -0700286 echo "[passed] OLT and ONU are enabled in VOLTHA"
Andy Bavierb4b866a2019-05-30 12:35:45 -0700287 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 -0700288 echo "[passed] VOLTHA logical device and agg switch are available in ONOS"
Daniele Moro3cbb72b2019-12-13 17:50:35 -0800289 if [ $(NEM_WORKFLOW) = att-workflow ]; then \
290 timeout 10s bash -c "until cordctl model list AttWorkflowDriverServiceInstance -q -f 'authentication_state=AWAITING' | wc -l | grep -q $$(( $(NUM_OLTS) * $(NUM_ONUS_PER_OLT) )); do echo 'waiting for ATT Workflow Driver ServiceInstance to be in AWAITING state'; sleep 10; done"; \
291 echo "[passed] ATT Workflow Driver ServiceInstance is in AWAITING state"; \
292 fi
293 if [ $(NEM_WORKFLOW) = tt-workflow ]; then \
294 timeout 10s bash -c "until cordctl model list TtWorkflowDriverServiceInstance -q -f 'dhcp_state=AWAITING' | wc -l | grep -q $$(( $(NUM_OLTS) * $(NUM_ONUS_PER_OLT) )); do echo 'waiting for TT Workflow Driver ServiceInstance to be in AWAITING state'; sleep 10; done"; \
295 echo "[passed] TT Workflow Driver ServiceInstance is in AWAITING state"; \
296 fi
297 if [ $(NEM_WORKFLOW) = dt-workflow ]; then \
298 timeout 10s bash -c "until cordctl model list DtWorkflowDriverServiceInstance -q -f 'authentication_state=AWAITING' | wc -l | grep -q $$(( $(NUM_OLTS) * $(NUM_ONUS_PER_OLT) )); do echo 'waiting for DT Workflow Driver ServiceInstance to be in AWAITING state'; sleep 10; done"; \
299 echo "[passed] DT Workflow Driver ServiceInstance is in AWAITING state"; \
300 fi
Andy Bavierecb2bf32019-03-12 09:50:10 -0700301 sudo iptables -P FORWARD ACCEPT
302 sudo apparmor_parser -R /etc/apparmor.d/sbin.dhclient || true
Andy Baviera85fdc02019-05-17 10:50:49 -0700303 sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.tcpdump || true
Andy Bavier35053b62018-09-20 13:45:45 -0700304 touch $@
305 echo "SEBA-in-a-Box installation finished!"
306
Zack Williams2f8ce3b2019-07-03 11:42:16 -0700307$(M)/seba-2.0.0-alpha1: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init
308 helm install -n cord-platform cord/cord-platform --version=7.0.0 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES)
Andy Bavier1d5b9922019-01-02 15:30:55 -0700309 until kubectl get crd | grep etcdclusters; \
310 do \
311 echo "Waiting for etcdclusters CRD to be available"; \
312 sleep 5; \
313 done
314 touch $(M)/kafka
315 touch $(M)/onos
316 touch $(M)/etcd-operator-ready
Zack Williams2f8ce3b2019-07-03 11:42:16 -0700317 helm install -n seba cord/seba --version=2.0.0-alpha1 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES)
318 helm install -n att-workflow cord/att-workflow --version=1.2.4 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES)
Andy Bavier1d5b9922019-01-02 15:30:55 -0700319 touch $(M)/voltha
320 touch $(M)/nem
321 touch $@
322
Matteo Scandolo83d1ee62019-06-07 10:37:53 -0700323# BBSim Targets
Zack Williamsd0c12f02018-11-21 11:54:36 -0700324
325$(M)/bbsim: | $(M)/onos $(M)/voltha-running $(M)/nem-running
326 cd $(WORKSPACE)/cord/helm-charts && \
327 helm upgrade --install bbsim bbsim -f $(SEBAVALUES) && \
328 scripts/wait_for_pods.sh voltha && \
329 touch $@
330
331$(M)/bbsim-tosca: | $(M)/bbsim
332 cd $(WORKSPACE)/cord/helm-charts && \
Andy Bavier9c8c8b92019-07-18 15:19:53 -0700333 echo "Loading BBSim TOSCA: $(BBSIM_DHCP_TOSCA) $(BBSIM_OLT_TOSCA) $(BBSIM_TECH_PROF_TOSCA)" && \
334 for tosca in $(BBSIM_DHCP_TOSCA) $(BBSIM_OLT_TOSCA) $(BBSIM_TECH_PROF_TOSCA) ; do \
Zack Williamsd0c12f02018-11-21 11:54:36 -0700335 curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @$$tosca http://127.0.0.1:30007/run ; \
336 done && \
337 touch $@
338
339run-tests: | $(M)/qatests
Andy Bavier0b216232019-07-01 19:29:22 -0700340run-tests: PYBOT_ARGS := -v SUBSCRIBER_FILENAME:SIABSubscriberLatest -v WHITELIST_FILENAME:SIABWhitelistLatest -v OLT_DEVICE_FILENAME:SIABOLT0Device
Kailash4257f1a2019-05-14 09:27:11 -0700341
342run-tests-latest: | $(M)/qatests
Andy Bavierb4b866a2019-05-30 12:35:45 -0700343run-tests-latest: PYBOT_ARGS := -v SUBSCRIBER_FILENAME:SIABSubscriberLatest -v WHITELIST_FILENAME:SIABWhitelistLatest -v OLT_DEVICE_FILENAME:SIABOLT0Device
Andy Bavier81b0b582019-04-29 15:33:50 -0700344
Andy Bavier01449932018-10-01 16:19:40 -0700345$(M)/qatests-prereqs:
346 sudo apt install -y python-pip virtualenv
Andy Bavier35053b62018-09-20 13:45:45 -0700347 touch $@
348
Andy Bavier01449932018-10-01 16:19:40 -0700349$(WORKSPACE)/cord/test/cord-tester: | $(M)/setup
350 mkdir -p $(WORKSPACE)/cord/test
351 cd $(WORKSPACE)/cord/test && git clone https://gerrit.opencord.org/cord-tester
Andy Bavier35053b62018-09-20 13:45:45 -0700352
Kailash45ad32e2019-03-06 14:37:16 -0800353$(WORKSPACE)/cord/incubator/voltha: | $(M)/setup
354 mkdir -p $(WORKSPACE)/cord/incubator
355 cd $(WORKSPACE)/cord/incubator && git clone https://gerrit.opencord.org/voltha
Kailashd6061102019-03-06 08:14:36 -0800356
Zack Williamsd0c12f02018-11-21 11:54:36 -0700357PYBOT_ARGS ?=
Kailash45ad32e2019-03-06 14:37:16 -0800358$(M)/qatests: | $(M)/siab $(M)/qatests-prereqs $(WORKSPACE)/cord/test/cord-tester $(WORKSPACE)/cord/incubator/voltha
Zack Williams46c57d22020-01-15 15:10:15 -0700359 cd $(WORKSPACE)/cord/test/cord-tester/ ;\
Andy Baviera83226d2020-02-24 11:10:15 -0700360 make venv_cord; source venv_cord/bin/activate ; set -u;\
Zack Williams46c57d22020-01-15 15:10:15 -0700361 cd src/test/cord-api/Tests/WorkflowValidations/ ;\
Kailash45ad32e2019-03-06 14:37:16 -0800362 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 -0700363 touch $@
364
Matteo Scandoloae7cf952019-08-01 11:23:41 -0700365remove-chart-milestones: remove-bbsim-milestones
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700366 cd $(M); rm -f kafka-running onos voltha etcd-operator-ready etcd-cluster \
Matteo Scandoloae7cf952019-08-01 11:23:41 -0700367 voltha-running ponsim mininet nem nem-running ponsim-tosca siab \
Zack Williams2f8ce3b2019-07-03 11:42:16 -0700368 logging nem-monitoring seba-2.0.0-alpha1 ponX_fwd
Andy Bavier35053b62018-09-20 13:45:45 -0700369
Matteo Scandoloae7cf952019-08-01 11:23:41 -0700370remove-bbsim-milestones:
371 cd $(M); rm -f bbsim bbsim-tosca
372
Andy Bavier35053b62018-09-20 13:45:45 -0700373remove-kube-milestones:
374 cd $(M); rm -f kubeadm helm-init
375
376remove-test-milestones:
Kailashf8ff8122018-12-03 10:44:06 -0800377 cd $(M); rm -f qatests qatests-prereqs
Andy Bavier35053b62018-09-20 13:45:45 -0700378
379teardown-charts: remove-chart-milestones
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700380 helm delete --purge $(shell helm ls -q | grep -v -E "docker-registry|mavenrepo|ponnet|kafka")
381 $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh
Andy Bavier35053b62018-09-20 13:45:45 -0700382
Matteo Scandoloae7cf952019-08-01 11:23:41 -0700383teardown-bbsim: remove-bbsim-milestones
384 cd $(M); rm -f voltha-running voltha
385 cordctl model delete RCORDSubscriber --all || true
386 timeout 60s bash -c "until cordctl model list VOLTServiceInstance --format json | wc -l | grep -q 0; do echo 'Waiting for Subscribers to be removed'; sleep 5; done"
387 cordctl model delete OLTDevice --all || true
388 cordctl model delete AttWorkflowDriverServiceInstance --all || true
389 timeout 60s bash -c "until http GET http://127.0.0.1:30125/api/v1/devices | jq '.items | length' | grep -q 0; do echo 'Waiting for OLTs to be removed'; sleep 5; done"
390 helm del --purge bbsim voltha
391
Kailashf8ff8122018-12-03 10:44:06 -0800392reset-kubeadm: remove-chart-milestones remove-kube-milestones remove-test-milestones
Matteo Scandolo50a6e492019-05-03 13:39:00 -0700393 cd $(M); rm -f kafka ponnet
Andy Bavier5a02e6d2019-01-16 15:54:30 -0700394 sudo kubeadm reset -f || true
Andy Bavier35053b62018-09-20 13:45:45 -0700395 sudo iptables -F && sudo iptables -t nat -F && sudo iptables -t mangle -F && sudo iptables -X
Andy Bavierb4b866a2019-05-30 12:35:45 -0700396 sudo rm -f /var/lib/cni/networks/pon*/* || true
397 sudo rm -f /var/lib/cni/networks/nni*/* || true
Andy Bavier5a02e6d2019-01-16 15:54:30 -0700398 sudo rm -f /var/lib/cni/networks/k8s-pod-network/* || true
Andy Bavierbe3d3612019-06-13 15:19:27 -0700399 for br in /sys/class/net/pon*; do sudo ip link delete `basename $$br` type bridge; done || true
400 for br in /sys/class/net/nni*; do sudo ip link delete `basename $$br` type bridge; done || true
Matteo Scandoloae7cf952019-08-01 11:23:41 -0700401