Jeremy Ronquillo | 5263c73 | 2020-10-13 09:42:19 -0700 | [diff] [blame] | 1 | # Copyright 2018-present Open Networking Foundation |
| 2 | # |
| 3 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| 4 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 5 | SHELL := /bin/bash |
| 6 | BUILD ?= /tmp/build |
| 7 | M ?= $(BUILD)/milestones |
| 8 | MAKEDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 9 | SCRIPTDIR := $(MAKEDIR)/scripts |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 10 | RESOURCEDIR := $(MAKEDIR)/resources |
| 11 | WORKSPACE ?= $(HOME) |
Jeremy Ronquillo | d3cab74 | 2020-08-24 11:49:00 -0700 | [diff] [blame] | 12 | VENV ?= $(BUILD)/venv/aiab |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 13 | |
| 14 | 4G_CORE_VALUES ?= $(MAKEDIR)/4g-core-values.yaml |
| 15 | 5G_CORE_VALUES ?= $(MAKEDIR)/5g-core-values.yaml |
| 16 | OAISIM_VALUES ?= $(MAKEDIR)/oaisim-values.yaml |
| 17 | ROC_VALUES ?= $(MAKEDIR)/roc-values.yaml |
| 18 | UPF_VALUES ?= $(MAKEDIR)/upf-values.yaml |
| 19 | RANSIM_VALUES ?= $(MAKEDIR)/ransim-values.yaml |
| 20 | ROC_4G_MODELS ?= $(MAKEDIR)/roc-4g-models.json |
| 21 | ROC_5G_MODELS ?= $(MAKEDIR)/roc-5g-models.json |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 22 | |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 23 | KUBESPRAY_VERSION ?= release-2.14 |
| 24 | DOCKER_VERSION ?= 19.03 |
| 25 | K8S_VERSION ?= v1.18.9 |
Scott Baker | 17b70d1 | 2020-09-29 23:26:21 -0700 | [diff] [blame] | 26 | HELM_VERSION ?= v3.2.4 |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 27 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 28 | HELM_GLOBAL_ARGS ?= |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 29 | |
| 30 | # Allow installing local charts or specific versions of published charts. |
| 31 | # E.g., to install the Aether 1.5 release: |
| 32 | # CHARTS=release-1.5 make test |
| 33 | # Default is to install from the local charts. |
| 34 | CHARTS ?= local |
| 35 | CONFIGFILE := configs/$(CHARTS) |
| 36 | include $(CONFIGFILE) |
| 37 | include configs/authentication |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 38 | |
| 39 | cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}') |
| 40 | cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}') |
| 41 | os_vendor := $(shell lsb_release -i -s) |
| 42 | os_release := $(shell lsb_release -r -s) |
| 43 | |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 44 | omec: $(M)/system-check $(M)/omec |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 45 | oaisim: $(M)/oaisim |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 46 | 5gc: $(M)/system-check $(M)/5g-core |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 47 | |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 48 | .PHONY: omec oaisim 5gc test reset-test 5g-core reset-5g-test clean |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 49 | |
| 50 | $(M): |
| 51 | mkdir -p $(M) |
| 52 | |
| 53 | $(M)/system-check: | $(M) |
| 54 | @if [[ $(cpu_family) -eq 6 ]]; then \ |
| 55 | if [[ $(cpu_model) -lt 60 ]]; then \ |
| 56 | echo "FATAL: haswell CPU or newer is required."; \ |
| 57 | exit 1; \ |
| 58 | fi \ |
| 59 | else \ |
| 60 | echo "FATAL: unsupported CPU family."; \ |
| 61 | exit 1; \ |
| 62 | fi |
| 63 | @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 64 | if [[ ! $(os_release) =~ (18.04) ]]; then \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 65 | echo "WARN: $(os_vendor) $(os_release) has not been tested."; \ |
| 66 | fi; \ |
| 67 | if dpkg --compare-versions 4.15 gt $(shell uname -r); then \ |
| 68 | echo "FATAL: kernel 4.15 or later is required."; \ |
| 69 | echo "Please upgrade your kernel by running" \ |
| 70 | "apt install --install-recommends linux-generic-hwe-$(os_release)"; \ |
| 71 | exit 1; \ |
| 72 | fi \ |
| 73 | else \ |
| 74 | echo "FAIL: unsupported OS."; \ |
| 75 | exit 1; \ |
| 76 | fi |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 77 | @if [[ ! -d "$(WORKSPACE)/cord/aether-helm-charts" ]]; then \ |
| 78 | echo "FATAL: Please clone aether-helm-charts under $(WORKSPACE)/cord directory."; \ |
| 79 | exit 1; \ |
| 80 | fi |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 81 | touch $@ |
| 82 | |
| 83 | $(M)/setup: | $(M) |
| 84 | sudo $(SCRIPTDIR)/cloudlab-disksetup.sh |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 85 | sudo apt update; sudo apt install -y software-properties-common python3 python3-pip python3-venv jq httpie ipvsadm |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 86 | touch $@ |
| 87 | |
| 88 | $(BUILD)/kubespray: | $(M)/setup |
| 89 | mkdir -p $(BUILD) |
| 90 | cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION) |
| 91 | |
| 92 | $(VENV)/bin/activate: | $(M)/setup |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 93 | python3 -m venv $(VENV) |
Wei-Yu Chen | 7edb7e7 | 2021-07-28 11:37:55 +0800 | [diff] [blame] | 94 | source "$(VENV)/bin/activate" && \ |
| 95 | python -m pip install -U pip && \ |
| 96 | deactivate |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 97 | |
| 98 | $(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate |
| 99 | source "$(VENV)/bin/activate" && \ |
| 100 | pip install -r $(BUILD)/kubespray/requirements.txt |
| 101 | touch $@ |
| 102 | |
| 103 | $(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements |
| 104 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
| 105 | ansible-playbook -b -i inventory/local/hosts.ini \ |
| 106 | -e "{'override_system_hostname' : False, 'disable_swap' : True}" \ |
| 107 | -e "{'docker_version' : $(DOCKER_VERSION)}" \ |
| 108 | -e "{'docker_iptables_enabled' : True}" \ |
| 109 | -e "{'kube_version' : $(K8S_VERSION)}" \ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 110 | -e "{'kube_network_plugin_multus' : True, 'multus_version' : stable, 'multus_cni_version' : 0.3.1}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 111 | -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \ |
| 112 | -e "{'kube_pods_subnet' : 192.168.0.0/17, 'kube_service_addresses' : 192.168.128.0/17}" \ |
| 113 | -e "{'kube_apiserver_node_port_range' : 2000-36767}" \ |
| 114 | -e "{'kubeadm_enabled': True}" \ |
| 115 | -e "{'kube_feature_gates' : [SCTPSupport=True]}" \ |
| 116 | -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*]}" \ |
| 117 | -e "{'dns_min_replicas' : 1}" \ |
| 118 | -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \ |
| 119 | cluster.yml |
| 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 |
| 123 | kubectl wait pod -n kube-system --for=condition=Ready --all |
| 124 | touch $@ |
| 125 | |
| 126 | $(M)/helm-ready: | $(M)/k8s-ready |
Woojoong Kim | 8425cb3 | 2021-01-08 16:18:53 -0800 | [diff] [blame] | 127 | helm repo add incubator https://charts.helm.sh/incubator |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 128 | helm repo add cord https://charts.opencord.org |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 129 | helm repo add atomix https://charts.atomix.io |
| 130 | helm repo add onosproject https://charts.onosproject.org |
| 131 | if [ "$(REPO_PASSWORD)" ]; then \ |
| 132 | helm repo add aether --username ${REPO_USERNAME} --password ${REPO_PASSWORD} https://charts.aetherproject.org; \ |
| 133 | helm repo add sdran --username ${REPO_USERNAME} --password ${REPO_PASSWORD} https://sdrancharts.onosproject.org; \ |
| 134 | fi |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 135 | touch $@ |
| 136 | |
| 137 | /opt/cni/bin/simpleovs: | $(M)/k8s-ready |
| 138 | sudo cp $(RESOURCEDIR)/simpleovs /opt/cni/bin/ |
| 139 | |
| 140 | /opt/cni/bin/static: | $(M)/k8s-ready |
| 141 | mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \ |
| 142 | wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \ |
| 143 | tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz |
| 144 | sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/ |
| 145 | |
| 146 | # TODO: need to connect ONOS |
| 147 | $(M)/fabric: | $(M)/setup /opt/cni/bin/simpleovs /opt/cni/bin/static |
| 148 | sudo apt install -y openvswitch-switch |
| 149 | sudo ovs-vsctl --may-exist add-br br-enb-net |
| 150 | sudo ovs-vsctl --may-exist add-port br-enb-net enb -- set Interface enb type=internal |
| 151 | sudo ip addr add 192.168.251.4/24 dev enb || true |
| 152 | sudo ip link set enb up |
| 153 | sudo ethtool --offload enb tx off |
| 154 | sudo ip route replace 192.168.252.0/24 via 192.168.251.1 dev enb |
| 155 | kubectl apply -f $(RESOURCEDIR)/router.yaml |
| 156 | kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 157 | kubectl -n default exec router -- ip route add 172.250.0.0/16 via 192.168.250.3 |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 158 | kubectl delete net-attach-def core-net |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 159 | touch $@ |
| 160 | |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 161 | auth-secret: $(RESOURCEDIR)/aether.registry.yaml |
| 162 | $(RESOURCEDIR)/aether.registry.yaml: configs/authentication |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 163 | kubectl -n omec create secret docker-registry aether.registry \ |
| 164 | --docker-server=https://registry.aetherproject.org \ |
| 165 | --docker-username=${REGISTRY_USERNAME} \ |
| 166 | --docker-password=${REGISTRY_CLI_SECRET} \ |
| 167 | --dry-run=client --output=yaml > $@ |
| 168 | |
| 169 | $(M)/omec: | $(M)/helm-ready /opt/cni/bin/simpleovs /opt/cni/bin/static $(M)/fabric $(RESOURCEDIR)/aether.registry.yaml |
Scott Baker | 17b70d1 | 2020-09-29 23:26:21 -0700 | [diff] [blame] | 170 | kubectl get namespace omec 2> /dev/null || kubectl create namespace omec |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 171 | kubectl -n omec get secret aether.registry || kubectl create -f $(RESOURCEDIR)/aether.registry.yaml |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 172 | helm repo update |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 173 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(OMEC_CONTROL_PLANE_CHART); fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 174 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 175 | --namespace omec \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 176 | --values $(4G_CORE_VALUES) \ |
| 177 | sim-app \ |
| 178 | $(OMEC_SUB_PROVISION_CHART) && \ |
| 179 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 180 | --namespace omec \ |
| 181 | --values $(4G_CORE_VALUES) \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 182 | omec-control-plane \ |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 183 | $(OMEC_CONTROL_PLANE_CHART) && \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 184 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 185 | --namespace omec \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 186 | --values $(UPF_VALUES) \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 187 | omec-user-plane \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 188 | $(OMEC_USER_PLANE_CHART) |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 189 | touch $@ |
| 190 | |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 191 | $(M)/5g-core: | $(M)/helm-ready /opt/cni/bin/simpleovs /opt/cni/bin/static $(M)/fabric $(RESOURCEDIR)/aether.registry.yaml |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 192 | kubectl get namespace omec 2> /dev/null || kubectl create namespace omec |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 193 | kubectl -n omec get secret aether.registry || kubectl create -f $(RESOURCEDIR)/aether.registry.yaml |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 194 | helm repo update |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 195 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(5GC_CONTROL_PLANE_CHART); fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 196 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 197 | --namespace omec \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 198 | --values $(5G_CORE_VALUES) \ |
Ajay Lotan Thakur | 980823b | 2021-06-23 18:55:05 -0500 | [diff] [blame] | 199 | sim-app \ |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 200 | $(OMEC_SUB_PROVISION_CHART) && \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 201 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
Ajay Lotan Thakur | 980823b | 2021-06-23 18:55:05 -0500 | [diff] [blame] | 202 | --namespace omec \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 203 | --values $(UPF_VALUES) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 204 | 5g-core-up \ |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 205 | $(OMEC_USER_PLANE_CHART) && \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 206 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 207 | --namespace omec \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 208 | --values $(5G_CORE_VALUES) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 209 | fgc-core \ |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 210 | $(5GC_CONTROL_PLANE_CHART) && \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 211 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 212 | --namespace omec \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 213 | --values $(RANSIM_VALUES) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 214 | 5g-ransim-plane \ |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 215 | $(5G_RAN_SIM_CHART) |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 216 | touch $@ |
| 217 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 218 | # UE images includes kernel module, ue_ip.ko |
| 219 | # which should be built in the exactly same kernel version of the host machine |
| 220 | $(BUILD)/openairinterface: | $(M)/setup |
| 221 | mkdir -p $(BUILD) |
| 222 | cd $(BUILD); git clone https://github.com/opencord/openairinterface.git |
| 223 | |
| 224 | $(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface |
| 225 | cd $(BUILD)/openairinterface; \ |
| 226 | sudo docker build . --target lte-uesoftmodem \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 227 | --build-arg build_base=omecproject/oai-base:1.1.0 \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 228 | --file Dockerfile.ue \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 229 | --tag omecproject/lte-uesoftmodem:1.1.0 |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 230 | touch $@ |
| 231 | |
| 232 | $(M)/oaisim: | $(M)/ue-image $(M)/omec |
| 233 | sudo ip addr add 127.0.0.2/8 dev lo || true |
| 234 | $(eval mme_iface=$(shell ip -4 route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }')) |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 235 | helm upgrade --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \ |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 236 | --set config.enb.networks.s1_mme.interface=$(mme_iface) \ |
| 237 | --set images.pullPolicy=IfNotPresent |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 238 | kubectl rollout status -n omec statefulset ue |
| 239 | @timeout 60s bash -c \ |
| 240 | "until ip addr show oip1 | grep -q inet; \ |
| 241 | do \ |
| 242 | echo 'Waiting for UE 1 gets IP address'; \ |
| 243 | sleep 3; \ |
| 244 | done" |
| 245 | touch $@ |
| 246 | |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 247 | roc: $(M)/roc |
| 248 | $(M)/roc: $(M)/helm-ready |
| 249 | kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc |
| 250 | helm repo update |
| 251 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi |
| 252 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 253 | --namespace kube-system \ |
| 254 | --values $(ROC_VALUES) \ |
| 255 | atomix-controller \ |
| 256 | $(ATOMIX_CONTROLLER_CHART) |
| 257 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 258 | --namespace kube-system \ |
| 259 | --values $(ROC_VALUES) \ |
| 260 | atomix-raft-storage \ |
| 261 | $(ATOMIX_RAFT_STORAGE_CHART) |
| 262 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 263 | --namespace kube-system \ |
| 264 | --values $(ROC_VALUES) \ |
| 265 | onos-operator \ |
| 266 | $(ONOS_OPERATOR_CHART) |
| 267 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 268 | --namespace aether-roc \ |
| 269 | --values $(ROC_VALUES) \ |
| 270 | aether-roc-umbrella \ |
| 271 | $(AETHER_ROC_UMBRELLA_CHART) |
| 272 | touch $@ |
| 273 | |
| 274 | # Load the ROC 4G models. Disable loading network slice from SimApp. |
| 275 | roc-4g-models: $(M)/roc |
| 276 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES) |
| 277 | sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES) |
| 278 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 279 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 280 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 281 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 282 | --header 'Content-Type: application/json' \ |
| 283 | --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done |
| 284 | |
| 285 | # Load the ROC 5G models. Disable loading network slice from SimApp. |
| 286 | roc-5g-models: $(M)/roc |
| 287 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES) |
| 288 | sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES) |
| 289 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 290 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 291 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 292 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 293 | --header 'Content-Type: application/json' \ |
| 294 | --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done |
| 295 | |
| 296 | roc-clean: |
| 297 | @echo "This could take 2-3 minutes..." |
| 298 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES) |
| 299 | sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES) |
| 300 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES) |
| 301 | sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES) |
| 302 | kubectl delete namespace aether-roc || true |
| 303 | rm -rf $(M)/roc |
| 304 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 305 | test: | $(M)/fabric $(M)/omec $(M)/oaisim |
| 306 | @sleep 5 |
| 307 | @echo "Test1: ping from UE to SGI network gateway" |
Hyunsun Moon | 0bd8cec | 2020-09-28 00:38:26 -0500 | [diff] [blame] | 308 | ping -I oip1 192.168.250.1 -c 15 |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 309 | @echo "Test2: ping from UE to 8.8.8.8" |
| 310 | ping -I oip1 8.8.8.8 -c 3 |
Hyunsun Moon | 0bd8cec | 2020-09-28 00:38:26 -0500 | [diff] [blame] | 311 | @echo "Test3: ping from UE to google.com" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 312 | ping -I oip1 google.com -c 3 |
| 313 | @echo "Finished to test" |
| 314 | |
| 315 | reset-test: |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 316 | kubectl delete namespace omec || true |
Jeremy Ronquillo | b2b64ea | 2020-12-09 13:49:03 -0800 | [diff] [blame] | 317 | kubectl delete po router || true |
| 318 | cd $(M); rm -f oaisim omec fabric |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 319 | |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 320 | reset-5g-test: |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame^] | 321 | kubectl delete namespace omec || true |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 322 | cd $(M); rm -f 5g-core |
| 323 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 324 | clean: reset-test |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 325 | kubectl delete po router || true |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 326 | kubectl delete net-attach-def core-net || true |
| 327 | sudo ovs-vsctl del-br br-access-net || true |
| 328 | sudo ovs-vsctl del-br br-core-net || true |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 329 | sudo apt remove --purge openvswitch-switch -y |
| 330 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
| 331 | ansible-playbook -b -i inventory/local/hosts.ini reset.yml |
| 332 | @if [ -d /usr/local/etc/emulab ]; then \ |
| 333 | mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \ |
| 334 | sudo rm -rf /mnt/extra/kubelet; \ |
| 335 | fi |
| 336 | rm -rf $(M) |