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