Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 1 | SHELL := /bin/bash |
| 2 | BUILD ?= /tmp |
| 3 | M ?= $(BUILD)/milestones |
| 4 | MAKEDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) |
| 5 | WORKSPACE ?= $(HOME) |
Andy Bavier | 6ce277e | 2018-10-02 10:29:21 -0700 | [diff] [blame] | 6 | VIRTUALENV ?= $(WORKSPACE)/cord/test |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 7 | SEBAVALUES ?= configs/seba-ponsim.yaml |
Kailash Khalasi | 98dabd0 | 2018-10-19 13:00:12 -0700 | [diff] [blame] | 8 | TESTTAGS ?= stable |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 9 | |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 10 | # used to start logging/monitoring and other infrastructure charts |
| 11 | INFRA_CHARTS ?= |
| 12 | INFRA_PREREQS = $(foreach chart,$(INFRA_CHARTS),$(M)/$(chart)) |
| 13 | |
Zack Williams | 2a6a107 | 2019-01-07 11:15:12 -0700 | [diff] [blame] | 14 | DOCKER_VERSION ?= "17.06" |
| 15 | |
Zack Williams | f9940be | 2019-03-26 15:21:44 -0700 | [diff] [blame] | 16 | K8S_VERSION ?= "1.12.7" |
Zack Williams | 2a6a107 | 2019-01-07 11:15:12 -0700 | [diff] [blame] | 17 | |
Zack Williams | f0b8e94 | 2019-07-23 16:21:28 -0700 | [diff] [blame] | 18 | HELM_VERSION ?= "2.14.2" |
| 19 | HELM_SHA256SUM ?= "9f50e69cf5cfa7268b28686728ad0227507a169e52bf59c99ada872ddd9679f0" |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 20 | HELM_PLATFORM ?= "linux-amd64" |
| 21 | |
Andy Bavier | 1678059 | 2019-07-09 09:20:18 -0700 | [diff] [blame] | 22 | CORDCTL_VERSION ?= 1.1.2 |
| 23 | CORDCTL_SHA256SUM ?= 41f629dea3e94d98855af2ce3751c6522750d1fe61da2b3b05604402387631cf |
Andy Bavier | 48f8f55 | 2019-06-05 15:37:04 -0700 | [diff] [blame] | 24 | CORDCTL_PLATFORM ?= linux-amd64 |
| 25 | |
Zack Williams | 2a6a107 | 2019-01-07 11:15:12 -0700 | [diff] [blame] | 26 | KAFKA_CHART_VERSION ?= 0.13.3 |
Andy Bavier | 1d5b992 | 2019-01-02 15:30:55 -0700 | [diff] [blame] | 27 | KAFKA_POD := "pod/cord-kafka-0" |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 28 | |
Zack Williams | 5c16dc8 | 2019-01-08 10:57:08 -0700 | [diff] [blame] | 29 | ETCD_OPERATOR_VERSION ?= 0.8.3 |
| 30 | |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 31 | # Arguments passed to helm install/upgrade for all or specific charts |
| 32 | HELM_GLOBAL_ARGS ?= |
| 33 | HELM_NEM_ARGS ?= $(HELM_GLOBAL_ARGS) |
| 34 | HELM_ONOS_ARGS ?= $(HELM_GLOBAL_ARGS) |
| 35 | HELM_VOLTHA_ARGS ?= $(HELM_GLOBAL_ARGS) |
| 36 | |
Andy Bavier | b101bd1 | 2019-03-15 15:23:08 -0700 | [diff] [blame] | 37 | NEM_WORKFLOW ?= att-workflow |
Andy Bavier | b4b866a | 2019-05-30 12:35:45 -0700 | [diff] [blame] | 38 | NUM_OLTS ?= 1 |
| 39 | NUM_ONUS_PER_OLT ?= 1 |
Andy Bavier | b101bd1 | 2019-03-15 15:23:08 -0700 | [diff] [blame] | 40 | |
Matteo Scandolo | 83d1ee6 | 2019-06-07 10:37:53 -0700 | [diff] [blame] | 41 | # BBSim related Arguments |
| 42 | BBSIM_OLT_TOSCA ?= examples/bbsim-16.yaml |
| 43 | BBSIM_DHCP_TOSCA ?= examples/bbsim-dhcp.yaml |
Andy Bavier | 9c8c8b9 | 2019-07-18 15:19:53 -0700 | [diff] [blame] | 44 | BBSIM_TECH_PROF_TOSCA ?= examples/technology-profile.yaml |
Matteo Scandolo | 83d1ee6 | 2019-06-07 10:37:53 -0700 | [diff] [blame] | 45 | |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 46 | # Targets |
Andy Bavier | c6d16d7 | 2019-06-25 14:28:43 -0700 | [diff] [blame] | 47 | ponsim: validate_args $(M)/siab |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 48 | |
| 49 | bbsim: $(M)/bbsim-tosca |
| 50 | |
Matteo Scandolo | 83d1ee6 | 2019-06-07 10:37:53 -0700 | [diff] [blame] | 51 | bbsim-latest: SEBAVALUES := configs/seba-ponsim-latest.yaml |
Matteo Scandolo | 83d1ee6 | 2019-06-07 10:37:53 -0700 | [diff] [blame] | 52 | bbsim-latest: $(M)/bbsim-tosca |
| 53 | |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 54 | both: BBSIM_DHCP_TOSCA = |
| 55 | both: $(M)/siab $(M)/bbsim-tosca |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 56 | |
Andy Bavier | e5a16f6 | 2018-10-11 14:07:15 -0700 | [diff] [blame] | 57 | # https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html#SEC69 |
| 58 | latest: SEBAVALUES := configs/seba-ponsim-latest.yaml |
Andy Bavier | 2a5a78e | 2019-01-08 16:47:47 -0700 | [diff] [blame] | 59 | latest: ponsim |
Andy Bavier | e5a16f6 | 2018-10-11 14:07:15 -0700 | [diff] [blame] | 60 | |
| 61 | stable: SEBAVALUES := configs/seba-ponsim.yaml |
Andy Bavier | 2a5a78e | 2019-01-08 16:47:47 -0700 | [diff] [blame] | 62 | stable: ponsim |
Andy Bavier | e5a16f6 | 2018-10-11 14:07:15 -0700 | [diff] [blame] | 63 | |
Zack Williams | 2f8ce3b | 2019-07-03 11:42:16 -0700 | [diff] [blame] | 64 | siab-2.0-alpha1: SEBAVALUES := configs/siab-v2.0.0-alpha1.yaml |
| 65 | siab-2.0-alpha1: KAFKA_POD := "pod/cord-platform-kafka-0" |
| 66 | # Parallel make won't work here; need to install seba-2.0.0 before siab |
| 67 | siab-2.0-alpha1: $(M)/seba-2.0.0-alpha1 $(M)/siab |
Andy Bavier | 1d5b992 | 2019-01-02 15:30:55 -0700 | [diff] [blame] | 68 | |
Andy Bavier | c6d16d7 | 2019-06-25 14:28:43 -0700 | [diff] [blame] | 69 | validate_args: |
| 70 | if ! ([[ $(NUM_OLTS) == ?(-)+([0-9]) ]] && [ $(NUM_OLTS) -ge 1 ] && [ $(NUM_OLTS) -le 4 ]); \ |
| 71 | then \ |
| 72 | echo "Invalid value: NUM_OLTS must between 1 and 4"; \ |
| 73 | exit 1; \ |
| 74 | fi |
| 75 | if ! ([[ $(NUM_ONUS_PER_OLT) == ?(-)+([0-9]) ]] && [ $(NUM_ONUS_PER_OLT) -ge 1 ] && [ $(NUM_ONUS_PER_OLT) -le 4 ]); \ |
| 76 | then \ |
| 77 | echo "Invalid value: NUM_ONUS_PER_OLT must between 1 and 4"; \ |
| 78 | exit 1; \ |
| 79 | fi |
| 80 | |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 81 | $(M)/setup: |
Andy Bavier | 9d8aae5 | 2019-03-14 09:41:11 -0700 | [diff] [blame] | 82 | sudo $(MAKEDIR)/../scripts/portcheck.sh |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 83 | mkdir -p $(M) |
| 84 | sudo apt update |
| 85 | sudo apt install -y httpie jq software-properties-common |
| 86 | sudo swapoff -a |
Hyunsun Moon | 81c8e23 | 2019-05-21 03:40:22 -0600 | [diff] [blame] | 87 | if [ -d /usr/local/etc/emulab ]; then $(MAKEDIR)/../scripts/cloudlab-disksetup.sh; fi |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 88 | touch $@ |
| 89 | |
| 90 | /usr/bin/docker: | $(M)/setup |
| 91 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 0EBFCD88 |
| 92 | sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(shell lsb_release -cs) stable" |
| 93 | sudo apt update |
Zack Williams | 2a6a107 | 2019-01-07 11:15:12 -0700 | [diff] [blame] | 94 | sudo apt install -y "docker-ce=${DOCKER_VERSION}*" |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 95 | |
| 96 | /usr/bin/kubeadm: | $(M)/setup /usr/bin/docker |
| 97 | curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - |
| 98 | echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /tmp/kubernetes.list |
| 99 | sudo cp /tmp/kubernetes.list /etc/apt/sources.list.d/kubernetes.list |
| 100 | sudo apt update |
Zack Williams | 2a6a107 | 2019-01-07 11:15:12 -0700 | [diff] [blame] | 101 | sudo apt install -y "kubeadm=${K8S_VERSION}-*" "kubelet=${K8S_VERSION}-*" "kubectl=${K8S_VERSION}-*" |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 102 | |
| 103 | /usr/local/bin/helm: |
| 104 | curl -L -o /tmp/helm.tgz "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-${HELM_PLATFORM}.tar.gz" |
| 105 | echo "${HELM_SHA256SUM} /tmp/helm.tgz" | sha256sum -c - |
| 106 | cd /tmp; tar -xzvf helm.tgz; sudo mv ${HELM_PLATFORM}/helm /usr/local/bin/helm |
| 107 | sudo chmod a+x /usr/local/bin/helm |
| 108 | rm -rf /tmp/helm.tgz /tmp/${HELM_PLATFORM} |
| 109 | |
Andy Bavier | 48f8f55 | 2019-06-05 15:37:04 -0700 | [diff] [blame] | 110 | /usr/local/bin/cordctl: |
| 111 | curl -L -o /tmp/cordctl "https://github.com/opencord/cordctl/releases/download/${CORDCTL_VERSION}/cordctl-${CORDCTL_PLATFORM}" |
| 112 | echo "${CORDCTL_SHA256SUM} /tmp/cordctl" | sha256sum -c - |
| 113 | sudo mv /tmp/cordctl /usr/local/bin/cordctl |
| 114 | sudo chmod a+x /usr/local/bin/cordctl |
| 115 | mkdir -p ~/.cord |
Andy Bavier | 03afc23 | 2019-06-08 11:10:50 -0700 | [diff] [blame] | 116 | printf "server: 127.0.0.1:30011\nusername: admin@opencord.org\npassword: letmein\ngrpc:\n timeout: 10s\n" > ~/.cord/config |
Andy Bavier | 48f8f55 | 2019-06-05 15:37:04 -0700 | [diff] [blame] | 117 | |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 118 | $(M)/kubeadm: | $(M)/setup /usr/bin/kubeadm |
| 119 | sudo kubeadm init --pod-network-cidr=192.168.0.0/16 |
Andy Bavier | a7c6a4e | 2018-09-28 13:29:43 -0700 | [diff] [blame] | 120 | mkdir -p $(HOME)/.kube |
| 121 | sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config |
| 122 | sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config |
Zack Williams | 2a6a107 | 2019-01-07 11:15:12 -0700 | [diff] [blame] | 123 | kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml |
| 124 | kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 125 | kubectl taint nodes --all node-role.kubernetes.io/master- |
| 126 | touch $@ |
| 127 | |
| 128 | $(M)/helm-init: | $(M)/kubeadm /usr/local/bin/helm |
| 129 | kubectl create serviceaccount --namespace kube-system tiller |
| 130 | kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller |
| 131 | helm init --service-account tiller |
| 132 | until helm ls >& /dev/null; \ |
| 133 | do \ |
| 134 | echo "Waiting for Helm to be ready"; \ |
| 135 | sleep 5; \ |
| 136 | done |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 137 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ |
Andy Bavier | 1d5b992 | 2019-01-02 15:30:55 -0700 | [diff] [blame] | 138 | helm repo add cord https://charts.opencord.org |
Andy Bavier | def246b | 2019-09-17 14:44:30 -0700 | [diff] [blame] | 139 | helm repo update |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 140 | touch $@ |
| 141 | |
| 142 | $(WORKSPACE)/cord/helm-charts: | $(M)/setup |
| 143 | mkdir -p $(WORKSPACE)/cord |
| 144 | cd $(WORKSPACE)/cord; git clone https://gerrit.opencord.org/helm-charts |
| 145 | |
| 146 | $(M)/kafka: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 147 | cd $(WORKSPACE)/cord/helm-charts && \ |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 148 | helm upgrade --install $(HELM_GLOBAL_ARGS) cord-kafka --version $(KAFKA_CHART_VERSION) -f examples/kafka-single.yaml incubator/kafka |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 149 | touch $@ |
| 150 | |
| 151 | $(M)/kafka-running: | $(M)/kafka |
Andy Bavier | 1d5b992 | 2019-01-02 15:30:55 -0700 | [diff] [blame] | 152 | kubectl wait $(KAFKA_POD) --for condition=Ready --timeout=180s |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 153 | touch $@ |
| 154 | |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 155 | $(M)/nem-monitoring: | $(M)/kafka-running |
| 156 | cd $(WORKSPACE)/cord/helm-charts && \ |
| 157 | helm dep up nem-monitoring && \ |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 158 | helm upgrade --install $(HELM_GLOBAL_ARGS) nem-monitoring nem-monitoring |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 159 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh |
| 160 | touch $@ |
| 161 | |
| 162 | $(M)/logging: | $(M)/kafka-running |
| 163 | cd $(WORKSPACE)/cord/helm-charts && \ |
| 164 | helm dep up logging && \ |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 165 | helm upgrade --install $(HELM_GLOBAL_ARGS) logging -f examples/logging-single.yaml logging |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 166 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh |
| 167 | touch $@ |
| 168 | |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 169 | # Dependency on NEM is there to force ordering for parallel install |
| 170 | # The idea is to install VOLTHA / ONOS / Mininet while NEM is initializing |
Zack Williams | 3bcdc26 | 2018-09-27 11:00:38 -0700 | [diff] [blame] | 171 | $(M)/onos: | $(M)/kafka-running $(M)/nem $(INFRA_PREREQS) |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 172 | cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_ONOS_ARGS) onos onos -f $(SEBAVALUES) |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 173 | touch $@ |
| 174 | |
Andy Bavier | 46c6462 | 2019-02-04 16:05:22 -0700 | [diff] [blame] | 175 | # SEBA-440 Sometimes VOLTHA install fails with 'namespaces "voltha" not found' |
| 176 | # Work around by repeatedly trying to install the chart until it succeeds |
Andy Bavier | 1e3e952 | 2018-11-06 11:12:00 -0700 | [diff] [blame] | 177 | $(M)/voltha: | $(M)/kafka-running $(INFRA_PREREQS) $(M)/etcd-operator-ready |
Andy Bavier | bab9b33 | 2019-02-07 07:54:32 -0700 | [diff] [blame] | 178 | sudo sh -c "echo 1048576 > /proc/sys/fs/inotify/max_user_watches" |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 179 | cd $(WORKSPACE)/cord/helm-charts; helm dep up voltha |
Andy Bavier | 46c6462 | 2019-02-04 16:05:22 -0700 | [diff] [blame] | 180 | cd $(WORKSPACE)/cord/helm-charts; \ |
| 181 | for i in 1 2 3; \ |
| 182 | do \ |
| 183 | helm upgrade --install $(HELM_VOLTHA_ARGS) voltha voltha -f $(SEBAVALUES) && break; \ |
| 184 | echo "VOLTHA chart install failed; cleaning up and trying again"; \ |
| 185 | helm delete --purge voltha; \ |
| 186 | until ! kubectl get namespace voltha; \ |
| 187 | do \ |
| 188 | sleep 5; \ |
| 189 | done; \ |
| 190 | sleep 5; \ |
| 191 | done |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 192 | touch $@ |
| 193 | |
Andy Bavier | 1e3e952 | 2018-11-06 11:12:00 -0700 | [diff] [blame] | 194 | $(M)/etcd-operator-ready: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init |
Zack Williams | 5c16dc8 | 2019-01-08 10:57:08 -0700 | [diff] [blame] | 195 | cd $(WORKSPACE)/cord/helm-charts; \ |
| 196 | helm upgrade --install etcd-operator --version $(ETCD_OPERATOR_VERSION) stable/etcd-operator -f $(SEBAVALUES) |
Andy Bavier | 46c6462 | 2019-02-04 16:05:22 -0700 | [diff] [blame] | 197 | timeout 120s bash -c "until kubectl get crd | grep etcdclusters; do echo 'Waiting for etcdclusters CRD to be available'; sleep 5; done" |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 198 | touch $@ |
| 199 | |
Andy Bavier | 1e3e952 | 2018-11-06 11:12:00 -0700 | [diff] [blame] | 200 | $(M)/voltha-running: | $(M)/voltha |
Kailash | bff9eb7 | 2018-11-16 13:03:59 -0800 | [diff] [blame] | 201 | 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 Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 202 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh voltha |
| 203 | touch $@ |
| 204 | |
Matteo Scandolo | 50a6e49 | 2019-05-03 13:39:00 -0700 | [diff] [blame] | 205 | $(M)/ponnet: | $(M)/voltha |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 206 | cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_GLOBAL_ARGS) ponnet ponnet --set numOlts=$(NUM_OLTS) --set numOnus=$(NUM_ONUS_PER_OLT) |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 207 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh kube-system |
Matteo Scandolo | 50a6e49 | 2019-05-03 13:39:00 -0700 | [diff] [blame] | 208 | touch $@ |
| 209 | |
| 210 | $(M)/ponsim: | $(M)/ponnet $(M)/voltha |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 211 | 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 Scandolo | 50a6e49 | 2019-05-03 13:39:00 -0700 | [diff] [blame] | 212 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh voltha |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 213 | touch $@ |
| 214 | |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 215 | # For each ONU, set up forwarding on the ponX bridge |
Andy Bavier | b4b866a | 2019-05-30 12:35:45 -0700 | [diff] [blame] | 216 | $(M)/ponX_fwd: | $(M)/ponsim |
| 217 | echo 8 > /tmp/group_fwd_mask |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 218 | for bridge in /sys/class/net/pon*; \ |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 219 | do \ |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 220 | echo Setting up forwarding on `basename $$bridge`; \ |
| 221 | sudo cp /tmp/group_fwd_mask $$bridge/bridge/group_fwd_mask; \ |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 222 | done |
Andy Bavier | b4b866a | 2019-05-30 12:35:45 -0700 | [diff] [blame] | 223 | rm /tmp/group_fwd_mask |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 224 | touch $@ |
| 225 | |
Andy Bavier | f9a426d | 2019-04-04 11:19:19 -0700 | [diff] [blame] | 226 | # Make sure that we're using the ofdpa-ovs driver with OvS. |
Andy Bavier | b4b866a | 2019-05-30 12:35:45 -0700 | [diff] [blame] | 227 | $(M)/mininet: | $(M)/onos $(M)/ponsim $(M)/ponX_fwd $(M)/ponsim-tosca |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 228 | sudo modprobe openvswitch |
Andy Bavier | 48f8f55 | 2019-06-05 15:37:04 -0700 | [diff] [blame] | 229 | timeout 60s bash -c "cordctl model sync Switch -f 'driver=ofdpa-ovs'" |
Andy Bavier | 3ac5046 | 2019-06-14 09:32:33 -0700 | [diff] [blame] | 230 | 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 Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 231 | touch $@ |
| 232 | |
Andy Bavier | 81ab405 | 2019-06-07 07:14:40 -0700 | [diff] [blame] | 233 | $(M)/nem: | /usr/local/bin/cordctl $(M)/kafka-running $(INFRA_PREREQS) |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 234 | cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-core |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 235 | cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) xos-core xos-core -f $(SEBAVALUES) |
Matteo Scandolo | f3ceb4c | 2018-12-12 15:48:38 -0800 | [diff] [blame] | 236 | cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-profiles/seba-services |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 237 | cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) seba-services xos-profiles/seba-services -f $(SEBAVALUES) |
Andy Bavier | b101bd1 | 2019-03-15 15:23:08 -0700 | [diff] [blame] | 238 | cd $(WORKSPACE)/cord/helm-charts; helm dep update workflows/$(NEM_WORKFLOW) |
| 239 | cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) $(NEM_WORKFLOW) workflows/$(NEM_WORKFLOW) -f $(SEBAVALUES) |
Andy Bavier | de4537d | 2018-11-29 11:48:25 -0700 | [diff] [blame] | 240 | cd $(WORKSPACE)/cord/helm-charts; helm dep update xos-profiles/base-kubernetes |
Zack Williams | 8fa04e7 | 2018-11-04 22:16:58 -0700 | [diff] [blame] | 241 | cd $(WORKSPACE)/cord/helm-charts; helm upgrade --install $(HELM_NEM_ARGS) base-kubernetes xos-profiles/base-kubernetes -f $(SEBAVALUES) |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 242 | touch $@ |
| 243 | |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 244 | $(M)/nem-running: | $(M)/nem |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 245 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh |
| 246 | touch $@ |
| 247 | |
Andy Bavier | f9a426d | 2019-04-04 11:19:19 -0700 | [diff] [blame] | 248 | $(M)/ponsim-tosca: | $(M)/onos $(M)/nem-running |
Andy Bavier | 48f8f55 | 2019-06-05 15:37:04 -0700 | [diff] [blame] | 249 | timeout 60s bash -c "cordctl model sync ServiceInstanceAttribute -f 'id>0' -y" |
| 250 | timeout 60s bash -c "cordctl model sync ONOSApp -f 'id>0' -y" |
Andy Bavier | 905ec80 | 2018-10-04 11:08:37 -0700 | [diff] [blame] | 251 | 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 Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 252 | 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 Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 253 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh |
| 254 | touch $@ |
| 255 | |
| 256 | $(M)/siab: | $(M)/voltha-running $(M)/mininet $(M)/ponsim-tosca |
| 257 | until http -a karaf:karaf --ignore-stdin --check-status GET http://127.0.0.1:30120/onos/v1/configuration/org.opencord.olt.impl.Olt; \ |
| 258 | do \ |
| 259 | sleep 5; \ |
| 260 | done |
| 261 | http -a karaf:karaf --ignore-stdin POST http://127.0.0.1:30120/onos/v1/configuration/org.opencord.olt.impl.Olt defaultVlan=65535 |
Andy Bavier | 905ec80 | 2018-10-04 11:08:37 -0700 | [diff] [blame] | 262 | 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" |
| 263 | echo "[passed] VOLTHA is HEALTHY" |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 264 | 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 Bavier | 905ec80 | 2018-10-04 11:08:37 -0700 | [diff] [blame] | 265 | echo "[passed] OLT and ONU are enabled in VOLTHA" |
Andy Bavier | b4b866a | 2019-05-30 12:35:45 -0700 | [diff] [blame] | 266 | 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 Bavier | 905ec80 | 2018-10-04 11:08:37 -0700 | [diff] [blame] | 267 | echo "[passed] VOLTHA logical device and agg switch are available in ONOS" |
Andy Bavier | a5ef3a1 | 2019-03-18 12:06:46 -0700 | [diff] [blame] | 268 | ifeq ($(NEM_WORKFLOW),att-workflow) |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 269 | timeout 2m 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" |
Andy Bavier | 905ec80 | 2018-10-04 11:08:37 -0700 | [diff] [blame] | 270 | echo "[passed] ATT Workflow Driver ServiceInstance is in AWAITING state" |
Andy Bavier | a5ef3a1 | 2019-03-18 12:06:46 -0700 | [diff] [blame] | 271 | endif |
| 272 | ifeq ($(NEM_WORKFLOW),tt-workflow) |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 273 | timeout 2m 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" |
Andy Bavier | a5ef3a1 | 2019-03-18 12:06:46 -0700 | [diff] [blame] | 274 | echo "[passed] TT Workflow Driver ServiceInstance is in AWAITING state" |
| 275 | endif |
Andy Bavier | ecb2bf3 | 2019-03-12 09:50:10 -0700 | [diff] [blame] | 276 | sudo iptables -P FORWARD ACCEPT |
| 277 | sudo apparmor_parser -R /etc/apparmor.d/sbin.dhclient || true |
Andy Bavier | a85fdc0 | 2019-05-17 10:50:49 -0700 | [diff] [blame] | 278 | sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.tcpdump || true |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 279 | touch $@ |
| 280 | echo "SEBA-in-a-Box installation finished!" |
| 281 | |
Zack Williams | 2f8ce3b | 2019-07-03 11:42:16 -0700 | [diff] [blame] | 282 | $(M)/seba-2.0.0-alpha1: | $(WORKSPACE)/cord/helm-charts $(M)/helm-init |
| 283 | helm install -n cord-platform cord/cord-platform --version=7.0.0 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES) |
Andy Bavier | 1d5b992 | 2019-01-02 15:30:55 -0700 | [diff] [blame] | 284 | until kubectl get crd | grep etcdclusters; \ |
| 285 | do \ |
| 286 | echo "Waiting for etcdclusters CRD to be available"; \ |
| 287 | sleep 5; \ |
| 288 | done |
| 289 | touch $(M)/kafka |
| 290 | touch $(M)/onos |
| 291 | touch $(M)/etcd-operator-ready |
Zack Williams | 2f8ce3b | 2019-07-03 11:42:16 -0700 | [diff] [blame] | 292 | helm install -n seba cord/seba --version=2.0.0-alpha1 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES) |
| 293 | helm install -n att-workflow cord/att-workflow --version=1.2.4 -f $(WORKSPACE)/cord/helm-charts/$(SEBAVALUES) |
Andy Bavier | 1d5b992 | 2019-01-02 15:30:55 -0700 | [diff] [blame] | 294 | touch $(M)/voltha |
| 295 | touch $(M)/nem |
| 296 | touch $@ |
| 297 | |
Matteo Scandolo | 83d1ee6 | 2019-06-07 10:37:53 -0700 | [diff] [blame] | 298 | # BBSim Targets |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 299 | |
| 300 | $(M)/bbsim: | $(M)/onos $(M)/voltha-running $(M)/nem-running |
| 301 | cd $(WORKSPACE)/cord/helm-charts && \ |
| 302 | helm upgrade --install bbsim bbsim -f $(SEBAVALUES) && \ |
| 303 | scripts/wait_for_pods.sh voltha && \ |
| 304 | touch $@ |
| 305 | |
| 306 | $(M)/bbsim-tosca: | $(M)/bbsim |
| 307 | cd $(WORKSPACE)/cord/helm-charts && \ |
Andy Bavier | 9c8c8b9 | 2019-07-18 15:19:53 -0700 | [diff] [blame] | 308 | echo "Loading BBSim TOSCA: $(BBSIM_DHCP_TOSCA) $(BBSIM_OLT_TOSCA) $(BBSIM_TECH_PROF_TOSCA)" && \ |
| 309 | for tosca in $(BBSIM_DHCP_TOSCA) $(BBSIM_OLT_TOSCA) $(BBSIM_TECH_PROF_TOSCA) ; do \ |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 310 | curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @$$tosca http://127.0.0.1:30007/run ; \ |
| 311 | done && \ |
| 312 | touch $@ |
| 313 | |
| 314 | run-tests: | $(M)/qatests |
Andy Bavier | 0b21623 | 2019-07-01 19:29:22 -0700 | [diff] [blame] | 315 | run-tests: PYBOT_ARGS := -v SUBSCRIBER_FILENAME:SIABSubscriberLatest -v WHITELIST_FILENAME:SIABWhitelistLatest -v OLT_DEVICE_FILENAME:SIABOLT0Device |
Kailash | 4257f1a | 2019-05-14 09:27:11 -0700 | [diff] [blame] | 316 | |
| 317 | run-tests-latest: | $(M)/qatests |
Andy Bavier | b4b866a | 2019-05-30 12:35:45 -0700 | [diff] [blame] | 318 | run-tests-latest: PYBOT_ARGS := -v SUBSCRIBER_FILENAME:SIABSubscriberLatest -v WHITELIST_FILENAME:SIABWhitelistLatest -v OLT_DEVICE_FILENAME:SIABOLT0Device |
Andy Bavier | 81b0b58 | 2019-04-29 15:33:50 -0700 | [diff] [blame] | 319 | |
Andy Bavier | 0144993 | 2018-10-01 16:19:40 -0700 | [diff] [blame] | 320 | $(M)/qatests-prereqs: |
| 321 | sudo apt install -y python-pip virtualenv |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 322 | touch $@ |
| 323 | |
Andy Bavier | 0144993 | 2018-10-01 16:19:40 -0700 | [diff] [blame] | 324 | $(WORKSPACE)/cord/test/cord-tester: | $(M)/setup |
| 325 | mkdir -p $(WORKSPACE)/cord/test |
| 326 | cd $(WORKSPACE)/cord/test && git clone https://gerrit.opencord.org/cord-tester |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 327 | |
Kailash | 45ad32e | 2019-03-06 14:37:16 -0800 | [diff] [blame] | 328 | $(WORKSPACE)/cord/incubator/voltha: | $(M)/setup |
| 329 | mkdir -p $(WORKSPACE)/cord/incubator |
| 330 | cd $(WORKSPACE)/cord/incubator && git clone https://gerrit.opencord.org/voltha |
Kailash | d606110 | 2019-03-06 08:14:36 -0800 | [diff] [blame] | 331 | |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 332 | PYBOT_ARGS ?= |
Kailash | 45ad32e | 2019-03-06 14:37:16 -0800 | [diff] [blame] | 333 | $(M)/qatests: | $(M)/siab $(M)/qatests-prereqs $(WORKSPACE)/cord/test/cord-tester $(WORKSPACE)/cord/incubator/voltha |
Andy Bavier | 0144993 | 2018-10-01 16:19:40 -0700 | [diff] [blame] | 334 | cd $(WORKSPACE)/cord/test/cord-tester/src/test/cord-api/ && \ |
Kailash | 45ad32e | 2019-03-06 14:37:16 -0800 | [diff] [blame] | 335 | WORKSPACE=$(VIRTUALENV) bash ./setup_venv.sh && \ |
| 336 | source $(VIRTUALENV)/venv-cord-tester/bin/activate && \ |
| 337 | cd Tests/WorkflowValidations/ && \ |
| 338 | robot $(PYBOT_ARGS) --removekeywords wuks -e notready -i $(TESTTAGS) -v VOLTHA_DIR:$(WORKSPACE)/cord/incubator/voltha SIAB.robot |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 339 | touch $@ |
| 340 | |
| 341 | remove-chart-milestones: |
Matteo Scandolo | 50a6e49 | 2019-05-03 13:39:00 -0700 | [diff] [blame] | 342 | cd $(M); rm -f kafka-running onos voltha etcd-operator-ready etcd-cluster \ |
Zack Williams | d0c12f0 | 2018-11-21 11:54:36 -0700 | [diff] [blame] | 343 | voltha-running ponsim mininet nem nem-running ponsim-tosca siab bbsim bbsim-tosca \ |
Zack Williams | 2f8ce3b | 2019-07-03 11:42:16 -0700 | [diff] [blame] | 344 | logging nem-monitoring seba-2.0.0-alpha1 ponX_fwd |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 345 | |
| 346 | remove-kube-milestones: |
| 347 | cd $(M); rm -f kubeadm helm-init |
| 348 | |
| 349 | remove-test-milestones: |
Kailash | f8ff812 | 2018-12-03 10:44:06 -0800 | [diff] [blame] | 350 | cd $(M); rm -f qatests qatests-prereqs |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 351 | |
| 352 | teardown-charts: remove-chart-milestones |
Matteo Scandolo | 50a6e49 | 2019-05-03 13:39:00 -0700 | [diff] [blame] | 353 | helm delete --purge $(shell helm ls -q | grep -v -E "docker-registry|mavenrepo|ponnet|kafka") |
| 354 | $(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 355 | |
Kailash | f8ff812 | 2018-12-03 10:44:06 -0800 | [diff] [blame] | 356 | reset-kubeadm: remove-chart-milestones remove-kube-milestones remove-test-milestones |
Matteo Scandolo | 50a6e49 | 2019-05-03 13:39:00 -0700 | [diff] [blame] | 357 | cd $(M); rm -f kafka ponnet |
Andy Bavier | 5a02e6d | 2019-01-16 15:54:30 -0700 | [diff] [blame] | 358 | sudo kubeadm reset -f || true |
Andy Bavier | 35053b6 | 2018-09-20 13:45:45 -0700 | [diff] [blame] | 359 | sudo iptables -F && sudo iptables -t nat -F && sudo iptables -t mangle -F && sudo iptables -X |
Andy Bavier | b4b866a | 2019-05-30 12:35:45 -0700 | [diff] [blame] | 360 | sudo rm -f /var/lib/cni/networks/pon*/* || true |
| 361 | sudo rm -f /var/lib/cni/networks/nni*/* || true |
Andy Bavier | 5a02e6d | 2019-01-16 15:54:30 -0700 | [diff] [blame] | 362 | sudo rm -f /var/lib/cni/networks/k8s-pod-network/* || true |
Andy Bavier | be3d361 | 2019-06-13 15:19:27 -0700 | [diff] [blame] | 363 | for br in /sys/class/net/pon*; do sudo ip link delete `basename $$br` type bridge; done || true |
| 364 | for br in /sys/class/net/nni*; do sudo ip link delete `basename $$br` type bridge; done || true |