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