diff --git a/mk/epc.mk b/mk/epc.mk index 6d019d4..814b9d1 100644 --- a/mk/epc.mk +++ b/mk/epc.mk @@ -7,7 +7,7 @@ EPC_PHONY := omec 5gc omec: $(M)/omec 5gc: $(M)/5gc -$(M)/omec: | version $(M)/helm-ready $(M)/fabric +$(M)/omec: | version $(M)/helm-ready $(M)/fabric-core kubectl get namespace $(RIAB_NAMESPACE) 2> /dev/null || kubectl create namespace $(RIAB_NAMESPACE) helm repo update helm dep up $(AETHERCHARTDIR)/omec/omec-control-plane @@ -29,7 +29,7 @@ $(M)/omec: | version $(M)/helm-ready $(M)/fabric kubectl wait pod -n $(RIAB_NAMESPACE) --for=condition=Ready -l release=omec-user-plane --timeout=300s touch $@ -$(M)/5gc: | version $(M)/helm-ready $(M)/fabric +$(M)/5gc: | version $(M)/helm-ready $(M)/fabric-core kubectl get namespace $(RIAB_NAMESPACE) 2> /dev/null || kubectl create namespace $(RIAB_NAMESPACE) helm repo update helm dep up $(AETHERCHARTDIR)/omec/5g-control-plane diff --git a/mk/infra.mk b/mk/infra.mk index a941acf..5f52148 100644 --- a/mk/infra.mk +++ b/mk/infra.mk @@ -104,6 +104,23 @@ $(M)/fabric-cu-du: | $(M)/setup /opt/cni/bin/simpleovs /opt/cni/bin/static sudo ip link set $(E2_F1_DU_INTERFACE) up touch $@ +$(M)/fabric-core: | $(M)/setup /opt/cni/bin/simpleovs /opt/cni/bin/static + sudo apt install -y openvswitch-switch + sudo ovs-vsctl --may-exist add-br br-enb-net + sudo ovs-vsctl --may-exist add-port br-enb-net enb -- set Interface enb type=internal + sudo ip addr add $(OMEC_ENB_NET_IP) dev enb || true + sudo ip link set enb up + sudo ethtool --offload enb tx off + sudo ip route replace $(ACCESS_SUBNET) via $(shell echo $(ENB_GATEWAY) | awk -F '/' '{print $$1}') dev enb + cp $(RESOURCEDIR)/router-template.yaml $(RESOURCEDIR)/router.yaml + sed -i -e "s#CORE_GATEWAY#$(CORE_GATEWAY)#" $(RESOURCEDIR)/router.yaml + sed -i -e "s#ENB_GATEWAY#$(ENB_GATEWAY)#" $(RESOURCEDIR)/router.yaml + sed -i -e "s#ACCESS_GATEWAY#$(ACCESS_GATEWAY)#" $(RESOURCEDIR)/router.yaml + kubectl apply -f $(RESOURCEDIR)/router.yaml + kubectl wait pod -n default --for=condition=Ready -l app=router --timeout=300s + kubectl -n default exec router ip route add $(UE_IP_POOL)/$(UE_IP_MASK) via $(shell echo $(UPF_CORE_NET_IP) | awk -F '/' '{print $$1}') || true + touch $@ + $(M)/atomix: | $(M)/k8s-ready helm repo update ifeq ($(VER), v1.0.0) diff --git a/vagrant/destroy_omec_vm.sh b/vagrant/destroy_omec_vm.sh new file mode 100755 index 0000000..e390529 --- /dev/null +++ b/vagrant/destroy_omec_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run OMEC node +pushd omec +sudo vagrant destroy +popd \ No newline at end of file diff --git a/vagrant/destroy_ran_vm.sh b/vagrant/destroy_ran_vm.sh new file mode 100755 index 0000000..cfc4161 --- /dev/null +++ b/vagrant/destroy_ran_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run RAN node +pushd ran +sudo vagrant destroy +popd \ No newline at end of file diff --git a/vagrant/destroy_ric_vm.sh b/vagrant/destroy_ric_vm.sh new file mode 100755 index 0000000..8b4b0d2 --- /dev/null +++ b/vagrant/destroy_ric_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run RIC node +pushd ric +sudo vagrant destroy +popd \ No newline at end of file diff --git a/vagrant/destroy_vms.sh b/vagrant/destroy_vms.sh new file mode 100755 index 0000000..8593619 --- /dev/null +++ b/vagrant/destroy_vms.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +./destroy_ran_vm.sh + +./destroy_ric_vm.sh + +./destroy_omec_vm.sh \ No newline at end of file diff --git a/vagrant/halt_omec_vm.sh b/vagrant/halt_omec_vm.sh new file mode 100755 index 0000000..801dada --- /dev/null +++ b/vagrant/halt_omec_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run OMEC node +pushd omec +sudo vagrant halt +popd \ No newline at end of file diff --git a/vagrant/halt_ran_vm.sh b/vagrant/halt_ran_vm.sh new file mode 100755 index 0000000..e241b29 --- /dev/null +++ b/vagrant/halt_ran_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run RAN node +pushd ran +sudo vagrant halt +popd \ No newline at end of file diff --git a/vagrant/halt_ric_vm.sh b/vagrant/halt_ric_vm.sh new file mode 100755 index 0000000..f3f4fba --- /dev/null +++ b/vagrant/halt_ric_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run RIC node +pushd ric +sudo vagrant halt +popd \ No newline at end of file diff --git a/vagrant/halt_vms.sh b/vagrant/halt_vms.sh new file mode 100755 index 0000000..be95716 --- /dev/null +++ b/vagrant/halt_vms.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +./halt_ran_vm.sh + +./halt_ric_vm.sh + +./halt_omec_vm.sh \ No newline at end of file diff --git a/vagrant/omec/Vagrantfile b/vagrant/omec/Vagrantfile new file mode 100644 index 0000000..11b9115 --- /dev/null +++ b/vagrant/omec/Vagrantfile @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: 2020-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +Vagrant.configure(2) do |config| + config.vm.define "omec" do |omec| + omec.vm.box = "generic/ubuntu1804" + omec.vm.disk :disk, size: "30GB", primary: true + omec.vm.hostname = "omec" + omec.vm.network :public_network, :dev => "br0", :ovs => true, :mode => "bridge", :type => "bridge" + omec.vm.provider "libvirt" do |v| + v.cpus = 4 + v.memory = 8192 + end + + omec.vm.provision "shell", inline: <<-SHELL + sudo apt update -y + sudo apt install -y software-properties-common python3-pip jq httpie ipvsadm ethtool + sudo bash -c 'echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf' + SHELL + + omec.vm.provision "shell", run: 'always', inline: <<-SHELL + sudo ifconfig eth1 192.168.10.21/24 up || true + route add -net 192.168.11.0/24 dev eth1 || true + route add -net 192.168.13.0/24 dev eth1 || true + SHELL + end +end \ No newline at end of file diff --git a/vagrant/ran/Vagrantfile b/vagrant/ran/Vagrantfile new file mode 100644 index 0000000..96fd19a --- /dev/null +++ b/vagrant/ran/Vagrantfile @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: 2020-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +Vagrant.configure(2) do |config| + config.vm.define "ran" do |ran| + ran.vm.box = "generic/ubuntu1804" + ran.vm.disk :disk, size: "30GB", primary: true + ran.vm.hostname = "ran" + ran.vm.network :public_network, :dev => "br0", :ovs => true, :mode => "bridge", :type => "bridge" + ran.vm.provider "libvirt" do |v| + v.cpus = 4 + v.memory = 8192 + end + + ran.vm.provision "shell", inline: <<-SHELL + sudo apt update -y + sudo apt install -y software-properties-common python3-pip jq httpie ipvsadm ethtool + sudo bash -c 'echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf' + SHELL + + ran.vm.provision "shell", run: 'always', inline: <<-SHELL + sudo ifconfig eth1 192.168.13.21/24 up || true + sudo route add -net 192.168.10.0/24 dev eth1 || true + sudo route add -net 192.168.11.0/24 dev eth1 || true + SHELL + end +end \ No newline at end of file diff --git a/vagrant/ric/Vagrantfile b/vagrant/ric/Vagrantfile new file mode 100644 index 0000000..5b84673 --- /dev/null +++ b/vagrant/ric/Vagrantfile @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: 2020-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +Vagrant.configure(2) do |config| + config.vm.define "ric" do |ric| + ric.vm.box = "generic/ubuntu1804" + ric.vm.disk :disk, size: "30GB", primary: true + ric.vm.hostname = "ric" + ric.vm.network :public_network, :dev => "br0", :ovs => true, :mode => "bridge", :type => "bridge" + ric.vm.provider "libvirt" do |v| + v.cpus = 4 + v.memory = 8192 + end + + ric.vm.provision "shell", inline: <<-SHELL + sudo apt update -y + sudo apt install -y software-properties-common python3-pip jq httpie ipvsadm ethtool + sudo bash -c 'echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf' + SHELL + + ric.vm.provision "shell", run: 'always', inline: <<-SHELL + sudo ifconfig eth1 192.168.10.22/24 up || true + route add -net 192.168.11.0/24 dev eth1 || true + route add -net 192.168.13.0/24 dev eth1 || true + SHELL + end +end \ No newline at end of file diff --git a/vagrant/run_omec_vm.sh b/vagrant/run_omec_vm.sh new file mode 100755 index 0000000..0678929 --- /dev/null +++ b/vagrant/run_omec_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run OMEC node +pushd omec +sudo vagrant up +popd \ No newline at end of file diff --git a/vagrant/run_ran_vm.sh b/vagrant/run_ran_vm.sh new file mode 100755 index 0000000..0ea77cf --- /dev/null +++ b/vagrant/run_ran_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run RAN node +pushd ran +sudo vagrant up +popd \ No newline at end of file diff --git a/vagrant/run_ric_vm.sh b/vagrant/run_ric_vm.sh new file mode 100755 index 0000000..2c41b5d --- /dev/null +++ b/vagrant/run_ric_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Run RIC node +pushd ric +sudo vagrant up +popd \ No newline at end of file diff --git a/vagrant/run_vms.sh b/vagrant/run_vms.sh new file mode 100755 index 0000000..8b86b1e --- /dev/null +++ b/vagrant/run_vms.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +./run_ran_vm.sh + +./run_ric_vm.sh + +./run_omec_vm.sh \ No newline at end of file diff --git a/vagrant/setup.sh b/vagrant/setup.sh new file mode 100755 index 0000000..eb3115d --- /dev/null +++ b/vagrant/setup.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +echo Install VM hypervisor and OpenVSwitch +sudo apt update +sudo apt install qemu libvirt-daemon-system libvirt-clients libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev ruby-libvirt ebtables dnsmasq-base qemu-kvm libvirt-bin bridge-utils virt-manager openvswitch-switch -y + +echo Install Vagrant +curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - +sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" +sudo apt-get update && sudo apt-get install vagrant -y + +echo Add Vagrant plugins +vagrant plugin install vagrant-libvirt +vagrant plugin install vagrant-mutate + +echo Add OVS +sudo ovs-vsctl --may-exist add-br br0 +sudo ovs-vsctl show + +./run_vms.sh \ No newline at end of file diff --git a/vagrant/vcmd_ric.sh b/vagrant/vcmd_ric.sh new file mode 100755 index 0000000..4edb2fd --- /dev/null +++ b/vagrant/vcmd_ric.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Copyright 2022-present Open Networking Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +pushd $1 +sudo vagrant $2 +popd \ No newline at end of file