Jeremy Ronquillo | 5263c73 | 2020-10-13 09:42:19 -0700 | [diff] [blame] | 1 | # Copyright 2018-present Open Networking Foundation |
| 2 | # |
Andy Bavier | 2c42773 | 2022-02-03 15:16:46 -0700 | [diff] [blame] | 3 | # SPDX-License-Identifier: Apache-2.0 |
Jeremy Ronquillo | 5263c73 | 2020-10-13 09:42:19 -0700 | [diff] [blame] | 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 | |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 14 | 4G_CORE_VALUES ?= $(MAKEDIR)/sd-core-4g-values.yaml |
| 15 | 5G_CORE_VALUES ?= $(MAKEDIR)/sd-core-5g-values.yaml |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 16 | OAISIM_VALUES ?= $(MAKEDIR)/oaisim-values.yaml |
Andy Bavier | 794566f | 2022-02-04 16:10:18 -0700 | [diff] [blame] | 17 | ROC_VALUES ?= $(MAKEDIR)/roc-values.yaml |
Andy Bavier | 794566f | 2022-02-04 16:10:18 -0700 | [diff] [blame] | 18 | ROC_4G_MODELS ?= $(MAKEDIR)/roc-4g-models.json |
| 19 | ROC_5G_MODELS ?= $(MAKEDIR)/roc-5g-models.json |
Osman Amjad | 488a022 | 2022-01-12 11:58:43 -0600 | [diff] [blame] | 20 | TEST_APP_VALUES?= $(MAKEDIR)/5g-test-apps-values.yaml |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 21 | |
Hyunsun Moon | 8c3fe40 | 2021-10-04 18:06:07 -0700 | [diff] [blame] | 22 | KUBESPRAY_VERSION ?= release-2.17 |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 23 | DOCKER_VERSION ?= '20.10' |
| 24 | K8S_VERSION ?= v1.20.11 |
| 25 | HELM_VERSION ?= v3.6.3 |
| 26 | |
| 27 | ENABLE_ROUTER ?= true |
| 28 | ENABLE_OAISIM ?= true |
| 29 | ENABLE_GNBSIM ?= true |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 30 | ENABLE_SUBSCRIBER_PROXY ?= false |
Andy Bavier | cd93a20 | 2022-01-10 18:03:26 -0800 | [diff] [blame] | 31 | GNBSIM_COLORS ?= true |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 32 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 33 | DATA_IFACE ?= data |
| 34 | ifeq ($(DATA_IFACE), data) |
| 35 | RAN_SUBNET := 192.168.251.0/24 |
| 36 | else |
| 37 | RAN_SUBNET := $(shell ip route | grep $${DATA_IFACE} | awk '/kernel/ {print $$1}') |
| 38 | endif |
| 39 | NODE_IP ?= $(shell ip route list default | awk -F 'src' '{ print $$2; exit }' | awk '{ print $$1 }') |
| 40 | MME_IP ?= |
| 41 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 42 | HELM_GLOBAL_ARGS ?= |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 43 | |
| 44 | # Allow installing local charts or specific versions of published charts. |
| 45 | # E.g., to install the Aether 1.5 release: |
| 46 | # CHARTS=release-1.5 make test |
| 47 | # Default is to install from the local charts. |
| 48 | CHARTS ?= local |
| 49 | CONFIGFILE := configs/$(CHARTS) |
| 50 | include $(CONFIGFILE) |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 51 | |
| 52 | cpu_family := $(shell lscpu | grep 'CPU family:' | awk '{print $$3}') |
| 53 | cpu_model := $(shell lscpu | grep 'Model:' | awk '{print $$2}') |
| 54 | os_vendor := $(shell lsb_release -i -s) |
| 55 | os_release := $(shell lsb_release -r -s) |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 56 | USER := $(shell whoami) |
| 57 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 58 | .PHONY: 4g-core 5g-core oaisim test reset-test reset-ue reset-5g-test clean |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 59 | |
| 60 | $(M): |
| 61 | mkdir -p $(M) |
| 62 | |
| 63 | $(M)/system-check: | $(M) |
| 64 | @if [[ $(cpu_family) -eq 6 ]]; then \ |
| 65 | if [[ $(cpu_model) -lt 60 ]]; then \ |
| 66 | echo "FATAL: haswell CPU or newer is required."; \ |
| 67 | exit 1; \ |
| 68 | fi \ |
| 69 | else \ |
| 70 | echo "FATAL: unsupported CPU family."; \ |
| 71 | exit 1; \ |
| 72 | fi |
| 73 | @if [[ $(os_vendor) =~ (Ubuntu) ]]; then \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 74 | if [[ ! $(os_release) =~ (18.04) ]]; then \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 75 | echo "WARN: $(os_vendor) $(os_release) has not been tested."; \ |
| 76 | fi; \ |
| 77 | if dpkg --compare-versions 4.15 gt $(shell uname -r); then \ |
| 78 | echo "FATAL: kernel 4.15 or later is required."; \ |
| 79 | echo "Please upgrade your kernel by running" \ |
| 80 | "apt install --install-recommends linux-generic-hwe-$(os_release)"; \ |
| 81 | exit 1; \ |
| 82 | fi \ |
| 83 | else \ |
| 84 | echo "FAIL: unsupported OS."; \ |
| 85 | exit 1; \ |
| 86 | fi |
| 87 | touch $@ |
| 88 | |
| 89 | $(M)/setup: | $(M) |
| 90 | sudo $(SCRIPTDIR)/cloudlab-disksetup.sh |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 91 | 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] | 92 | touch $@ |
| 93 | |
| 94 | $(BUILD)/kubespray: | $(M)/setup |
| 95 | mkdir -p $(BUILD) |
| 96 | cd $(BUILD); git clone https://github.com/kubernetes-incubator/kubespray.git -b $(KUBESPRAY_VERSION) |
| 97 | |
| 98 | $(VENV)/bin/activate: | $(M)/setup |
Hyunsun Moon | 82e47c2 | 2021-06-28 12:30:20 -0500 | [diff] [blame] | 99 | python3 -m venv $(VENV) |
Wei-Yu Chen | 7edb7e7 | 2021-07-28 11:37:55 +0800 | [diff] [blame] | 100 | source "$(VENV)/bin/activate" && \ |
| 101 | python -m pip install -U pip && \ |
| 102 | deactivate |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 103 | |
| 104 | $(M)/kubespray-requirements: $(BUILD)/kubespray | $(VENV)/bin/activate |
| 105 | source "$(VENV)/bin/activate" && \ |
| 106 | pip install -r $(BUILD)/kubespray/requirements.txt |
| 107 | touch $@ |
| 108 | |
| 109 | $(M)/k8s-ready: | $(M)/setup $(BUILD)/kubespray $(VENV)/bin/activate $(M)/kubespray-requirements |
| 110 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
| 111 | ansible-playbook -b -i inventory/local/hosts.ini \ |
| 112 | -e "{'override_system_hostname' : False, 'disable_swap' : True}" \ |
| 113 | -e "{'docker_version' : $(DOCKER_VERSION)}" \ |
| 114 | -e "{'docker_iptables_enabled' : True}" \ |
| 115 | -e "{'kube_version' : $(K8S_VERSION)}" \ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 116 | -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] | 117 | -e "{'kube_proxy_metrics_bind_address' : 0.0.0.0:10249}" \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 118 | -e "{'kube_pods_subnet' : 192.168.84.0/24, 'kube_service_addresses' : 192.168.85.0/24}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 119 | -e "{'kube_apiserver_node_port_range' : 2000-36767}" \ |
| 120 | -e "{'kubeadm_enabled': True}" \ |
| 121 | -e "{'kube_feature_gates' : [SCTPSupport=True]}" \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 122 | -e "{'kubelet_custom_flags' : [--allowed-unsafe-sysctls=net.*, --node-ip=$(NODE_IP)]}" \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 123 | -e "{'dns_min_replicas' : 1}" \ |
| 124 | -e "{'helm_enabled' : True, 'helm_version' : $(HELM_VERSION)}" \ |
| 125 | cluster.yml |
| 126 | mkdir -p $(HOME)/.kube |
| 127 | sudo cp -f /etc/kubernetes/admin.conf $(HOME)/.kube/config |
| 128 | sudo chown $(shell id -u):$(shell id -g) $(HOME)/.kube/config |
| 129 | kubectl wait pod -n kube-system --for=condition=Ready --all |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 130 | sudo adduser $(USER) docker |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 131 | touch $@ |
| 132 | |
| 133 | $(M)/helm-ready: | $(M)/k8s-ready |
Woojoong Kim | 8425cb3 | 2021-01-08 16:18:53 -0800 | [diff] [blame] | 134 | helm repo add incubator https://charts.helm.sh/incubator |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 135 | helm repo add cord https://charts.opencord.org |
Andy Bavier | eda466b | 2021-08-27 15:00:36 -0700 | [diff] [blame] | 136 | helm repo add atomix https://charts.atomix.io |
| 137 | helm repo add onosproject https://charts.onosproject.org |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 138 | helm repo add aether https://charts.aetherproject.org |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 139 | touch $@ |
| 140 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 141 | /opt/cni/bin/static: | $(M)/k8s-ready |
| 142 | mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \ |
| 143 | wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \ |
| 144 | tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz |
| 145 | sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/ |
| 146 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 147 | node-prep: | $(M)/helm-ready /opt/cni/bin/static |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 148 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 149 | $(M)/router-pod: |
| 150 | sudo ip link add $(DATA_IFACE) type dummy || true; |
| 151 | sudo ip link set $(DATA_IFACE) up || true; |
| 152 | DATA_IFACE=$(DATA_IFACE) envsubst < $(RESOURCEDIR)/router.yaml | kubectl apply -f - |
| 153 | kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s |
| 154 | @touch $@ |
| 155 | |
| 156 | $(M)/router-host: |
| 157 | sudo ip link add core link $(DATA_IFACE) type macvlan mode bridge |
| 158 | sudo ip link set core up |
| 159 | sudo ip addr add 192.168.250.1/24 dev core |
| 160 | sudo ip link add access link $(DATA_IFACE) type macvlan mode bridge |
| 161 | sudo ip link set access up |
| 162 | sudo ip addr add 192.168.252.1/24 dev access |
| 163 | sudo sysctl -w net.ipv4.ip_forward=1; |
| 164 | $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }')) |
| 165 | sudo ip route add 172.250.0.0/16 via 192.168.250.3 |
| 166 | sudo iptables -t nat -A POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE |
| 167 | @touch $@ |
| 168 | |
| 169 | 4g-core: node-prep |
| 170 | ifeq ($(ENABLE_ROUTER),true) |
| 171 | ifeq ($(ENABLE_OAISIM),true) |
| 172 | 4g-core: $(M)/router-pod |
| 173 | else |
| 174 | 4g-core: $(M)/router-host |
| 175 | endif |
| 176 | endif |
| 177 | 4g-core: $(M)/omec |
| 178 | $(M)/omec: |
| 179 | @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \ |
| 180 | helm dep up $(SD_CORE_CHART); \ |
| 181 | else \ |
| 182 | helm repo update; \ |
| 183 | fi |
| 184 | NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(4G_CORE_VALUES) | \ |
| 185 | helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 186 | --namespace omec \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 187 | --values - \ |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 188 | sd-core \ |
| 189 | $(SD_CORE_CHART) |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 190 | @if [[ "${ENABLE_OAISIM}" == "false" ]]; then \ |
| 191 | $(eval mme_ip := $(shell ip -4 -o addr show $${DATA_IFACE} | awk '{print $$4}' | cut -d'/' -f1)) \ |
| 192 | echo "Your MME IP is $(mme_ip)"; \ |
| 193 | fi |
| 194 | @touch $@ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 195 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 196 | 5g-core: node-prep |
| 197 | ifeq ($(ENABLE_ROUTER),true) |
| 198 | ifeq ($(ENABLE_GNBSIM),true) |
| 199 | 5g-core: $(M)/router-pod |
| 200 | else |
| 201 | 5g-core: $(M)/router-host |
| 202 | endif |
| 203 | endif |
| 204 | 5g-core: $(M)/5g-core |
| 205 | $(M)/5g-core: |
| 206 | @if [[ "${CHARTS}" == "local" || "${CHARTS}" == "local-sdcore" ]]; then \ |
| 207 | helm dep up $(SD_CORE_CHART); \ |
| 208 | else \ |
| 209 | helm repo update; \ |
| 210 | fi |
| 211 | NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(5G_CORE_VALUES) | \ |
| 212 | helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \ |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 213 | --namespace omec \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 214 | --values - \ |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 215 | sd-core \ |
| 216 | $(SD_CORE_CHART) |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 217 | touch $@ |
| 218 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 219 | # UE images includes kernel module, ue_ip.ko |
| 220 | # which should be built in the exactly same kernel version of the host machine |
| 221 | $(BUILD)/openairinterface: | $(M)/setup |
| 222 | mkdir -p $(BUILD) |
| 223 | cd $(BUILD); git clone https://github.com/opencord/openairinterface.git |
| 224 | |
Andy Bavier | d6de561 | 2021-11-08 10:39:17 -0700 | [diff] [blame] | 225 | download-ue-image: | $(M)/k8s-ready |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 226 | sg docker -c "docker pull ${OAISIM_UE_IMAGE} && \ |
| 227 | docker tag ${OAISIM_UE_IMAGE} omecproject/lte-uesoftmodem:1.1.0" |
Andy Bavier | d6de561 | 2021-11-08 10:39:17 -0700 | [diff] [blame] | 228 | touch $(M)/ue-image |
| 229 | |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 230 | $(M)/ue-image: | $(M)/k8s-ready $(BUILD)/openairinterface |
| 231 | cd $(BUILD)/openairinterface; \ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 232 | sg docker -c "docker build . --target lte-uesoftmodem \ |
Hyunsun | 7b64051 | 2020-10-27 19:49:51 -0500 | [diff] [blame] | 233 | --build-arg build_base=omecproject/oai-base:1.1.0 \ |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 234 | --file Dockerfile.ue \ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 235 | --tag omecproject/lte-uesoftmodem:1.1.0" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 236 | touch $@ |
| 237 | |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 238 | $(M)/oaisim-lo: |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 239 | @sudo ip addr add 127.0.0.2/8 dev lo || true |
| 240 | @touch $@ |
Andy Bavier | 9ee69d0 | 2022-02-11 10:31:21 -0700 | [diff] [blame] | 241 | |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 242 | oaisim-standalone: | $(M)/helm-ready $(M)/ue-image $(M)/oaisim-lo |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 243 | @ip link show $(DATA_IFACE) > /dev/null || (echo DATA_IFACE is not set or does not exist; exit 1) |
| 244 | @if [[ "${MME_IP}" == "" ]]; then \ |
| 245 | echo MME_IP is not set; \ |
| 246 | exit 1; \ |
| 247 | else \ |
| 248 | ping -c 3 $(MME_IP) > /dev/null || (echo MME $(MME_IP) is not reachable; exit 1) \ |
| 249 | fi |
| 250 | sudo ip route add 192.168.252.0/24 via $(MME_IP) |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 251 | helm repo update |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 252 | helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \ |
| 253 | --set config.enb.networks.s1u.interface=$(DATA_IFACE) \ |
| 254 | --set config.enb.networks.s1_mme.interface=$(DATA_IFACE) \ |
| 255 | --set config.enb.mme.address=$(MME_IP) \ |
| 256 | --set config.enb.mme.isLocal=false \ |
| 257 | --set images.pullPolicy=IfNotPresent |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 258 | kubectl rollout status -n omec statefulset ue |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 259 | @echo "Test: registration" |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 260 | @timeout 60s bash -c \ |
| 261 | "until ip addr show oip1 | grep -q inet; \ |
| 262 | do \ |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 263 | echo 'Waiting for UE 1 gets IP address'; \ |
| 264 | sleep 3; \ |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 265 | done" |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 266 | @echo "Test: ping from UE to 8.8.8.8" |
| 267 | ping -I oip1 8.8.8.8 -c 3 |
| 268 | @touch $(M)/oaisim $(M)/omec |
Andy Bavier | 7b01b68 | 2022-03-17 13:26:55 -0700 | [diff] [blame] | 269 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 270 | oaisim: | $(M)/oaisim |
| 271 | $(M)/oaisim: | $(M)/ue-image $(M)/router-pod $(M)/oaisim-lo |
| 272 | sudo ip link add enb link $(DATA_IFACE) type macvlan mode bridge || true |
| 273 | sudo ip link set enb up || true |
| 274 | sudo ip addr add 192.168.251.3/24 dev enb || true |
| 275 | sudo ip route add 192.168.252.0/24 via 192.168.251.1 || true |
| 276 | helm upgrade --create-namespace --install $(HELM_GLOBAL_ARGS) --namespace omec oaisim cord/oaisim -f $(OAISIM_VALUES) \ |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 277 | --set images.pullPolicy=IfNotPresent |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 278 | kubectl rollout status -n omec statefulset ue |
| 279 | @timeout 60s bash -c \ |
| 280 | "until ip addr show oip1 | grep -q inet; \ |
| 281 | do \ |
| 282 | echo 'Waiting for UE 1 gets IP address'; \ |
| 283 | sleep 3; \ |
| 284 | done" |
| 285 | touch $@ |
| 286 | |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 287 | roc: $(M)/roc |
| 288 | $(M)/roc: $(M)/helm-ready |
| 289 | kubectl get namespace aether-roc 2> /dev/null || kubectl create namespace aether-roc |
| 290 | helm repo update |
| 291 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(AETHER_ROC_UMBRELLA_CHART); fi |
| 292 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 293 | --namespace kube-system \ |
| 294 | --values $(ROC_VALUES) \ |
| 295 | atomix-controller \ |
| 296 | $(ATOMIX_CONTROLLER_CHART) |
| 297 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 298 | --namespace kube-system \ |
| 299 | --values $(ROC_VALUES) \ |
| 300 | atomix-raft-storage \ |
| 301 | $(ATOMIX_RAFT_STORAGE_CHART) |
| 302 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 303 | --namespace kube-system \ |
| 304 | --values $(ROC_VALUES) \ |
| 305 | onos-operator \ |
| 306 | $(ONOS_OPERATOR_CHART) |
| 307 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 308 | --namespace aether-roc \ |
| 309 | --values $(ROC_VALUES) \ |
| 310 | aether-roc-umbrella \ |
| 311 | $(AETHER_ROC_UMBRELLA_CHART) |
| 312 | touch $@ |
| 313 | |
| 314 | # Load the ROC 4G models. Disable loading network slice from SimApp. |
| 315 | roc-4g-models: $(M)/roc |
| 316 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(4G_CORE_VALUES) |
| 317 | sed -i 's/# syncUrl/syncUrl/' $(4G_CORE_VALUES) |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 318 | if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \ |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 319 | sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(4G_CORE_VALUES) ; \ |
| 320 | sed -i 's/# addr: sub/ addr: sub/' $(4G_CORE_VALUES) ; \ |
| 321 | sed -i 's/# port: 5000/ port: 5000/' $(4G_CORE_VALUES) ; \ |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 322 | fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 323 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 324 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 325 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 326 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 327 | --header 'Content-Type: application/json' \ |
| 328 | --data-raw "$$(cat ${ROC_4G_MODELS})"; do sleep 5; done |
| 329 | |
| 330 | # Load the ROC 5G models. Disable loading network slice from SimApp. |
| 331 | roc-5g-models: $(M)/roc |
| 332 | sed -i 's/provision-network-slice: true/provision-network-slice: false/' $(5G_CORE_VALUES) |
| 333 | sed -i 's/# syncUrl/syncUrl/' $(5G_CORE_VALUES) |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 334 | if [ "${ENABLE_SUBSCRIBER_PROXY}" == "true" ] ; then \ |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 335 | sed -i 's/# sub-proxy-endpt:/sub-proxy-endpt:/' $(5G_CORE_VALUES) ; \ |
| 336 | sed -i 's/# addr: sub/ addr: sub/' $(5G_CORE_VALUES) ; \ |
| 337 | sed -i 's/# port: 5000/ port: 5000/' $(5G_CORE_VALUES) ; \ |
Amit Wankhede | 01b20c3 | 2021-12-01 12:45:58 +0530 | [diff] [blame] | 338 | fi |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 339 | $(eval ONOS_CLI_POD := $(shell kubectl -n aether-roc get pods -l name=onos-cli -o name)) |
| 340 | echo "ONOS CLI pod: ${ONOS_CLI_POD}" |
| 341 | until kubectl -n aether-roc exec ${ONOS_CLI_POD} -- \ |
| 342 | curl -s -f -L -X PATCH "http://aether-roc-api:8181/aether-roc-api" \ |
| 343 | --header 'Content-Type: application/json' \ |
| 344 | --data-raw "$$(cat ${ROC_5G_MODELS})"; do sleep 5; done |
| 345 | |
| 346 | roc-clean: |
| 347 | @echo "This could take 2-3 minutes..." |
| 348 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(4G_CORE_VALUES) |
| 349 | sed -i 's/ syncUrl/ # syncUrl/' $(4G_CORE_VALUES) |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 350 | sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(4G_CORE_VALUES) |
| 351 | sed -i 's/ addr: sub/ # addr: sub/' $(4G_CORE_VALUES) |
| 352 | sed -i 's/ port: 5000/ # port: 5000/' $(4G_CORE_VALUES) |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 353 | sed -i 's/provision-network-slice: false/provision-network-slice: true/' $(5G_CORE_VALUES) |
| 354 | sed -i 's/ syncUrl/ # syncUrl/' $(5G_CORE_VALUES) |
Amit Wankhede | fdf10ff | 2022-02-16 08:37:20 -0600 | [diff] [blame] | 355 | sed -i 's/ sub-proxy-endpt:/ # sub-proxy-endpt:/' $(5G_CORE_VALUES) |
| 356 | sed -i 's/ addr: sub/ # addr: sub/' $(5G_CORE_VALUES) |
| 357 | sed -i 's/ port: 5000/ # port: 5000/' $(5G_CORE_VALUES) |
Andy Bavier | ebf479c | 2021-09-08 15:47:58 -0700 | [diff] [blame] | 358 | kubectl delete namespace aether-roc || true |
| 359 | rm -rf $(M)/roc |
| 360 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 361 | omec-clean: |
| 362 | helm delete -n omec $$(helm -n omec ls -qa) || true |
| 363 | @echo "" |
| 364 | @echo "Wait for all pods to terminate..." |
| 365 | kubectl wait -n omec --for=delete --all=true -l app!=ue pod --timeout=180s || true |
| 366 | |
| 367 | router-clean: |
| 368 | @kubectl delete net-attach-def router-net 2>/dev/null || true |
| 369 | @kubectl delete po router 2>/dev/null || true |
| 370 | kubectl wait --for=delete -l app=router pod --timeout=180s 2>/dev/null || true |
| 371 | sudo ip link del access || true |
| 372 | sudo ip link del core || true |
| 373 | $(eval oiface := $(shell ip route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }')) |
| 374 | sudo iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o $(oiface) -j MASQUERADE || true |
| 375 | @sudo ip link del data 2>/dev/null || true |
| 376 | @cd $(M); rm -f router-pod router-host |
| 377 | |
| 378 | oaisim-clean: reset-ue |
| 379 | @sudo ip addr del 127.0.0.2/8 dev lo 2>/dev/null || true |
| 380 | @sudo ip link del enb 2>/dev/null || true |
| 381 | @sudo ip route del 192.168.252.0/24 || true |
| 382 | @cd $(M); rm -f oaisim-lo |
| 383 | |
| 384 | test: | 4g-core $(M)/oaisim |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 385 | @sleep 5 |
| 386 | @echo "Test1: ping from UE to SGI network gateway" |
Hyunsun Moon | 0bd8cec | 2020-09-28 00:38:26 -0500 | [diff] [blame] | 387 | ping -I oip1 192.168.250.1 -c 15 |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 388 | @echo "Test2: ping from UE to 8.8.8.8" |
| 389 | ping -I oip1 8.8.8.8 -c 3 |
Hyunsun Moon | 0bd8cec | 2020-09-28 00:38:26 -0500 | [diff] [blame] | 390 | @echo "Test3: ping from UE to google.com" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 391 | ping -I oip1 google.com -c 3 |
| 392 | @echo "Finished to test" |
| 393 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 394 | 5g-test: | 5g-core |
Andy Bavier | 31dfb9e | 2022-02-15 15:24:57 -0700 | [diff] [blame] | 395 | @if [[ "${CHARTS}" == "release-1.6" ]]; then echo "[NOTE] 5G Test not supported for Aether 1.6, exiting..."; exit 1; fi |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 396 | @echo "Test: Registration + UE initiated PDU Session Establishment + User Data packets" |
Andy Bavier | 0e4906f | 2022-03-03 15:31:48 -0700 | [diff] [blame] | 397 | @sleep 60 |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 398 | @rm -f /tmp/gnbsim.out |
Andy Bavier | cd93a20 | 2022-01-10 18:03:26 -0800 | [diff] [blame] | 399 | @if [[ ${GNBSIM_COLORS} == "true" ]]; then \ |
| 400 | kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | tee /tmp/gnbsim.out; \ |
| 401 | else \ |
| 402 | kubectl -n omec exec gnbsim-0 -- ./gnbsim 2>&1 | sed -u "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee /tmp/gnbsim.out; \ |
| 403 | fi |
Andy Bavier | 094d6ef | 2022-03-08 13:21:52 -0700 | [diff] [blame] | 404 | @grep -q "Simulation Result: PASS" /tmp/gnbsim.out |
Andy Bavier | 0a055a5 | 2022-01-07 10:46:17 -0700 | [diff] [blame] | 405 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 406 | reset-test: | oaisim-clean omec-clean router-clean |
| 407 | @cd $(M); rm -f omec oaisim 5g-core |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 408 | |
Andy Bavier | 8819b9f | 2022-01-28 16:54:06 -0700 | [diff] [blame] | 409 | reset-ue: |
| 410 | helm delete -n omec oaisim || true |
| 411 | kubectl wait -n omec --for=delete pod enb-0 || true |
| 412 | kubectl wait -n omec --for=delete pod ue-0 || true |
| 413 | cd $(M); rm -f oaisim |
| 414 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 415 | reset-5g-test: omec-clean |
Badhrinath | 3e081e2 | 2020-12-02 15:02:08 -0600 | [diff] [blame] | 416 | cd $(M); rm -f 5g-core |
| 417 | |
Osman Amjad | 488a022 | 2022-01-12 11:58:43 -0600 | [diff] [blame] | 418 | reset-dbtestapp: |
| 419 | helm uninstall --namespace omec 5g-test-app |
| 420 | |
| 421 | dbtestapp: |
| 422 | helm repo update |
| 423 | if [ "$(CHARTS)" == "local" ]; then helm dep up $(5G_TEST_APPS_CHART); fi |
| 424 | helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \ |
| 425 | --namespace omec \ |
| 426 | 5g-test-app \ |
| 427 | --values $(TEST_APP_VALUES) \ |
| 428 | $(5G_TEST_APPS_CHART) |
| 429 | @echo "Finished to dbtestapp" |
| 430 | |
Hyunsun Moon | cbdac11 | 2022-03-19 22:01:27 -0600 | [diff] [blame] | 431 | clean: | oaisim-clean router-clean |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 432 | source "$(VENV)/bin/activate" && cd $(BUILD)/kubespray; \ |
Andy Bavier | 125baa0 | 2021-10-26 16:26:44 -0700 | [diff] [blame] | 433 | ansible-playbook -b -i inventory/local/hosts.ini reset.yml --extra-vars "reset_confirmation=yes" |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 434 | @if [ -d /usr/local/etc/emulab ]; then \ |
| 435 | mount | grep /mnt/extra/kubelet/pods | cut -d" " -f3 | sudo xargs umount; \ |
| 436 | sudo rm -rf /mnt/extra/kubelet; \ |
| 437 | fi |
| 438 | rm -rf $(M) |