From 18f83facaf75b04a4a80acb35076c4a9eaae6f90 Mon Sep 17 00:00:00 2001 From: Woojoong Kim Date: Fri, 11 Mar 2022 08:55:58 +0900 Subject: [PATCH] Add Vagrantfiles for HW setup and update doc (#159) --- docs/HW_Installation_intro.md | 95 ++++++++++++++++++++------------ docs/Installation_OAI_nFAPI.md | 37 ------------- docs/Installation_RANSim_FBAH.md | 37 ------------- docs/Installation_RANSim_MHO.md | 37 ------------- docs/Installation_RANSim_MLB.md | 37 ------------- docs/Installation_RANSim_PCI.md | 37 ------------- vagrant/destroy_omec_vm.sh | 10 ++++ vagrant/destroy_ran_vm.sh | 10 ++++ vagrant/destroy_ric_vm.sh | 10 ++++ vagrant/destroy_vms.sh | 11 ++++ vagrant/halt_omec_vm.sh | 10 ++++ vagrant/halt_ran_vm.sh | 10 ++++ vagrant/halt_ric_vm.sh | 10 ++++ vagrant/halt_vms.sh | 11 ++++ vagrant/omec/Vagrantfile | 28 ++++++++++ vagrant/ran/Vagrantfile | 29 ++++++++++ vagrant/ric/Vagrantfile | 28 ++++++++++ vagrant/run_omec_vm.sh | 10 ++++ vagrant/run_ran_vm.sh | 10 ++++ vagrant/run_ric_vm.sh | 10 ++++ vagrant/run_vms.sh | 11 ++++ vagrant/setup.sh | 24 ++++++++ vagrant/vcmd.sh | 9 +++ 23 files changed, 301 insertions(+), 220 deletions(-) create mode 100755 vagrant/destroy_omec_vm.sh create mode 100755 vagrant/destroy_ran_vm.sh create mode 100755 vagrant/destroy_ric_vm.sh create mode 100755 vagrant/destroy_vms.sh create mode 100755 vagrant/halt_omec_vm.sh create mode 100755 vagrant/halt_ran_vm.sh create mode 100755 vagrant/halt_ric_vm.sh create mode 100755 vagrant/halt_vms.sh create mode 100644 vagrant/omec/Vagrantfile create mode 100644 vagrant/ran/Vagrantfile create mode 100644 vagrant/ric/Vagrantfile create mode 100755 vagrant/run_omec_vm.sh create mode 100755 vagrant/run_ran_vm.sh create mode 100755 vagrant/run_ric_vm.sh create mode 100755 vagrant/run_vms.sh create mode 100755 vagrant/setup.sh create mode 100755 vagrant/vcmd.sh diff --git a/docs/HW_Installation_intro.md b/docs/HW_Installation_intro.md index 99faa80..a13abab 100644 --- a/docs/HW_Installation_intro.md +++ b/docs/HW_Installation_intro.md @@ -26,40 +26,6 @@ In the diagram above are presented the 4 machines described in this setup (NUC O In addition, this setup has three internal subnets: (i) enb subnet - 192.168.11.8/29, (ii) core subnet - 192.168.11.0/29, and (iii) access subnet - 192.168.11.16/29. The enb subnet is to make a connection between CU/DU machine and Quagga internal router in OMEC machine. The core subnet is for S1u interface whereas the access subnet is for Sgi interface. -## Credentials -The tutorials here presented utilize the sdRan-in-a-Box (RiaB) repository, while installing and running the RiaB components, we might have to write some credentials for (i) opencord gerrit, (ii) onosproject github, and (iii) sdran private Helm chart repository. Make sure you have this member-only credentials before starting to install RiaB. - -```bash -aether-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires HTTPS key -Cloning into '/users/wkim/helm-charts/aether-helm-charts'... -Username for 'https://gerrit.opencord.org': -Password for 'https://@gerrit.opencord.org': -remote: Total 1103 (delta 0), reused 1103 (delta 0) -Receiving objects: 100% (1103/1103), 526.14 KiB | 5.31 MiB/s, done. -Resolving deltas: 100% (604/604), done. -sdran-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires Github credential -Cloning into '/users/wkim/helm-charts/sdran-helm-charts'... -Username for 'https://github.com': -Password for 'https://@github.com': -remote: Enumerating objects: 19, done. -remote: Counting objects: 100% (19/19), done. -remote: Compressing objects: 100% (17/17), done. -remote: Total 2259 (delta 7), reused 3 (delta 2), pack-reused 2240 -Receiving objects: 100% (2259/2259), 559.35 KiB | 2.60 MiB/s, done. -Resolving deltas: 100% (1558/1558), done. - -..... - -helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ -"incubator" has been added to your repositories -helm repo add cord https://charts.opencord.org -"cord" has been added to your repositories -Username for ONF SDRAN private chart: -Password for ONF SDRAN private chart: -"sdran" has been added to your repositories -touch /tmp/build/milestones/helm-ready -``` - ## Get the RiaB source code To get the source code, please see: `https://github.com/onosproject/sdran-in-a-box`. @@ -388,4 +354,63 @@ OMEC_DEFAULT_INTERFACE := $(shell ip -4 route list default | awk -F 'dev' ' OMEC_MACHINE_IP := 192.168.10.21/29 ``` -*Note: please do not forget to write the subnet mask at the end of IP address or subnet.* \ No newline at end of file +*Note: please do not forget to write the subnet mask at the end of IP address or subnet.* + +## Vagrantfiles (optional) +If we want to test this hardware installation over VMs not baremetal server directly, RiaB supports Vagrantfiles for RIC, RAN, and OMEC. +By using the below commands, we can deploy VMs on the single baremetal server (host machine). +``` +# install virsh qemu, etc +host$ sudo apt install qemu-kvm libvirt-bin bridge-utils virt-manager openvswitch-switch -y +host$ sudo apt install qemu libvirt-daemon-system libvirt-clients libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev ruby-libvirt ebtables dnsmasq-base -y + +# Vagrant install +host$ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - +host$ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" +host$ sudo apt-get update && sudo apt-get install vagrant -y +host$ vagrant plugin install vagrant-libvirt +host$ vagrant plugin install vagrant-mutate + +# OVS install +host$ sudo apt update; sudo apt-get install openvswitch-switch -y + +# OVS setup +host$ sudo ovs-vsctl --may-exist add-br br0 + +# to create VMs +host$ cd /path/to/sdran-in-a-box/vagrant +host$ ./run.vms.sh + +# to stop VMs +host$ cd /path/to/sdran-in-a-box/vagrant +host$ ./halt_vms.sh + +# to destroy VMs +host$ cd /path/to/sdran-in-a-box/vagrant +host$ ./destroy_vms.sh + +# if we want to push a vagrant command +host$ cd /path/to/sdran-in-a-box/vagrant +host$ ./vcmd.sh ric # for RIC VM +host$ ./vcmd.sh ran # for RIC VM +host$ ./vcmd.sh ric # for RIC VM + +# If we want to ssh each VM +host$ cd /path/to/sdran-in-a-box/vagrant +host$ ./vcmd.sh ric ssh # for RIC VM +host$ ./vcmd.sh ran ssh # for RIC VM +host$ ./vcmd.sh ric ssh # for RIC VM +``` + +*Note: If we want to deploy VMs on the multiple baremetal servers, we should create OpenVSwitch bridge `br0` for each baremetal server and create a VXLAN tunnel between bridges. Example:* +``` +# on the first server +host1$ sudo ovs-vsctl add-port br0 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip= +host1$ sudo ovs-vsctl add-port br0 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip= + +# on the second server +host2$ sudo ovs-vsctl add-port br0 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip= + +# on the third server +host3$ sudo ovs-vsctl add-port br0 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip= +``` \ No newline at end of file diff --git a/docs/Installation_OAI_nFAPI.md b/docs/Installation_OAI_nFAPI.md index c0c3ded..57cb011 100644 --- a/docs/Installation_OAI_nFAPI.md +++ b/docs/Installation_OAI_nFAPI.md @@ -47,43 +47,6 @@ $ make riab OPT=oai VER=dev # for dev (KPIMON and RSM) Once we push one of above commands, the deployment procedure starts. -### Credentials -In the deployment procedure, we should type some credentials on the prompt: -* OpenCORD username and HTTPS key -* GitHub username and password -* Aether/SD-RAN Helm chart repository credentials - -```bash -aether-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires HTTPS key -Cloning into '/users/wkim/helm-charts/aether-helm-charts'... -Username for 'https://gerrit.opencord.org': -Password for 'https://@gerrit.opencord.org': -remote: Total 1103 (delta 0), reused 1103 (delta 0) -Receiving objects: 100% (1103/1103), 526.14 KiB | 5.31 MiB/s, done. -Resolving deltas: 100% (604/604), done. -sdran-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires Github credential -Cloning into '/users/wkim/helm-charts/sdran-helm-charts'... -Username for 'https://github.com': -Password for 'https://@github.com': -remote: Enumerating objects: 19, done. -remote: Counting objects: 100% (19/19), done. -remote: Compressing objects: 100% (17/17), done. -remote: Total 2259 (delta 7), reused 3 (delta 2), pack-reused 2240 -Receiving objects: 100% (2259/2259), 559.35 KiB | 2.60 MiB/s, done. -Resolving deltas: 100% (1558/1558), done. - -..... - -helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ -"incubator" has been added to your repositories -helm repo add cord https://charts.opencord.org -"cord" has been added to your repositories -Username for ONF SDRAN private chart: -Password for ONF SDRAN private chart: -"sdran" has been added to your repositories -touch /tmp/build/milestones/helm-ready -``` - If we don't see any error or failure messages, everything is deployed. ```bash $ kubectl get po --all-namespaces diff --git a/docs/Installation_RANSim_FBAH.md b/docs/Installation_RANSim_FBAH.md index 90f500f..e6ab1e2 100644 --- a/docs/Installation_RANSim_FBAH.md +++ b/docs/Installation_RANSim_FBAH.md @@ -43,43 +43,6 @@ $ make riab OPT=fbah VER=dev # for dev version Once we push one of above commands, the deployment procedure starts. -### Credentials -In the deployment procedure, we should type some credentials on the prompt: -* OpenCORD username and HTTPS key -* GitHub username and password -* Aether/SD-RAN Helm chart repository credentials - -```bash -aether-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires HTTPS key -Cloning into '/users/wkim/helm-charts/aether-helm-charts'... -Username for 'https://gerrit.opencord.org': -Password for 'https://@gerrit.opencord.org': -remote: Total 1103 (delta 0), reused 1103 (delta 0) -Receiving objects: 100% (1103/1103), 526.14 KiB | 5.31 MiB/s, done. -Resolving deltas: 100% (604/604), done. -sdran-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires Github credential -Cloning into '/users/wkim/helm-charts/sdran-helm-charts'... -Username for 'https://github.com': -Password for 'https://@github.com': -remote: Enumerating objects: 19, done. -remote: Counting objects: 100% (19/19), done. -remote: Compressing objects: 100% (17/17), done. -remote: Total 2259 (delta 7), reused 3 (delta 2), pack-reused 2240 -Receiving objects: 100% (2259/2259), 559.35 KiB | 2.60 MiB/s, done. -Resolving deltas: 100% (1558/1558), done. - -..... - -helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ -"incubator" has been added to your repositories -helm repo add cord https://charts.opencord.org -"cord" has been added to your repositories -Username for ONF SDRAN private chart: -Password for ONF SDRAN private chart: -"sdran" has been added to your repositories -touch /tmp/build/milestones/helm-ready -``` - If we don't see any error or failure messages, everything is deployed. ```bash $ kubectl get po --all-namespaces diff --git a/docs/Installation_RANSim_MHO.md b/docs/Installation_RANSim_MHO.md index 750d36f..856a13e 100644 --- a/docs/Installation_RANSim_MHO.md +++ b/docs/Installation_RANSim_MHO.md @@ -38,43 +38,6 @@ $ make riab OPT=mho VER=dev # for dev version Once we push one of above commands, the deployment procedure starts. -### Credentials -In the deployment procedure, we should type some credentials on the prompt: -* OpenCORD username and HTTPS key -* GitHub username and password -* Aether/SD-RAN Helm chart repository credentials - -```bash -aether-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires HTTPS key -Cloning into '/users/wkim/helm-charts/aether-helm-charts'... -Username for 'https://gerrit.opencord.org': -Password for 'https://@gerrit.opencord.org': -remote: Total 1103 (delta 0), reused 1103 (delta 0) -Receiving objects: 100% (1103/1103), 526.14 KiB | 5.31 MiB/s, done. -Resolving deltas: 100% (604/604), done. -sdran-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires Github credential -Cloning into '/users/wkim/helm-charts/sdran-helm-charts'... -Username for 'https://github.com': -Password for 'https://@github.com': -remote: Enumerating objects: 19, done. -remote: Counting objects: 100% (19/19), done. -remote: Compressing objects: 100% (17/17), done. -remote: Total 2259 (delta 7), reused 3 (delta 2), pack-reused 2240 -Receiving objects: 100% (2259/2259), 559.35 KiB | 2.60 MiB/s, done. -Resolving deltas: 100% (1558/1558), done. - -..... - -helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ -"incubator" has been added to your repositories -helm repo add cord https://charts.opencord.org -"cord" has been added to your repositories -Username for ONF SDRAN private chart: -Password for ONF SDRAN private chart: -"sdran" has been added to your repositories -touch /tmp/build/milestones/helm-ready -``` - If we don't see any error or failure messages, everything is deployed. ```bash $ kubectl get po --all-namespaces diff --git a/docs/Installation_RANSim_MLB.md b/docs/Installation_RANSim_MLB.md index 277482d..d07c26b 100644 --- a/docs/Installation_RANSim_MLB.md +++ b/docs/Installation_RANSim_MLB.md @@ -40,43 +40,6 @@ $ make riab OPT=mlb VER=dev # for dev version Once we push one of above commands, the deployment procedure starts. -### Credentials -In the deployment procedure, we should type some credentials on the prompt: -* OpenCORD username and HTTPS key -* GitHub username and password -* Aether/SD-RAN Helm chart repository credentials - -```bash -aether-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires HTTPS key -Cloning into '/users/wkim/helm-charts/aether-helm-charts'... -Username for 'https://gerrit.opencord.org': -Password for 'https://@gerrit.opencord.org': -remote: Total 1103 (delta 0), reused 1103 (delta 0) -Receiving objects: 100% (1103/1103), 526.14 KiB | 5.31 MiB/s, done. -Resolving deltas: 100% (604/604), done. -sdran-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires Github credential -Cloning into '/users/wkim/helm-charts/sdran-helm-charts'... -Username for 'https://github.com': -Password for 'https://@github.com': -remote: Enumerating objects: 19, done. -remote: Counting objects: 100% (19/19), done. -remote: Compressing objects: 100% (17/17), done. -remote: Total 2259 (delta 7), reused 3 (delta 2), pack-reused 2240 -Receiving objects: 100% (2259/2259), 559.35 KiB | 2.60 MiB/s, done. -Resolving deltas: 100% (1558/1558), done. - -..... - -helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ -"incubator" has been added to your repositories -helm repo add cord https://charts.opencord.org -"cord" has been added to your repositories -Username for ONF SDRAN private chart: -Password for ONF SDRAN private chart: -"sdran" has been added to your repositories -touch /tmp/build/milestones/helm-ready -``` - If we don't see any error or failure messages, everything is deployed. ```bash $ kubectl get po --all-namespaces diff --git a/docs/Installation_RANSim_PCI.md b/docs/Installation_RANSim_PCI.md index 936802b..571289c 100644 --- a/docs/Installation_RANSim_PCI.md +++ b/docs/Installation_RANSim_PCI.md @@ -46,43 +46,6 @@ $ make riab OPT=ransim VER=dev # for dev version Once we push one of above commands, the deployment procedure starts. -### Credentials -In the deployment procedure, we should type some credentials on the prompt: -* OpenCORD username and HTTPS key -* GitHub username and password -* Aether/SD-RAN Helm chart repository credentials - -```bash -aether-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires HTTPS key -Cloning into '/users/wkim/helm-charts/aether-helm-charts'... -Username for 'https://gerrit.opencord.org': -Password for 'https://@gerrit.opencord.org': -remote: Total 1103 (delta 0), reused 1103 (delta 0) -Receiving objects: 100% (1103/1103), 526.14 KiB | 5.31 MiB/s, done. -Resolving deltas: 100% (604/604), done. -sdran-helm-chart repo is not in /users/wkim/helm-charts directory. Start to clone - it requires Github credential -Cloning into '/users/wkim/helm-charts/sdran-helm-charts'... -Username for 'https://github.com': -Password for 'https://@github.com': -remote: Enumerating objects: 19, done. -remote: Counting objects: 100% (19/19), done. -remote: Compressing objects: 100% (17/17), done. -remote: Total 2259 (delta 7), reused 3 (delta 2), pack-reused 2240 -Receiving objects: 100% (2259/2259), 559.35 KiB | 2.60 MiB/s, done. -Resolving deltas: 100% (1558/1558), done. - -..... - -helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ -"incubator" has been added to your repositories -helm repo add cord https://charts.opencord.org -"cord" has been added to your repositories -Username for ONF SDRAN private chart: -Password for ONF SDRAN private chart: -"sdran" has been added to your repositories -touch /tmp/build/milestones/helm-ready -``` - If we don't see any error or failure messages, everything is deployed. ```bash NAMESPACE NAME READY STATUS RESTARTS AGE 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..34d7883 --- /dev/null +++ b/vagrant/ran/Vagrantfile @@ -0,0 +1,29 @@ +# 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.11.10/24 up || true + sudo ip addr add 192.168.13.21/24 dev eth1 || 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.sh b/vagrant/vcmd.sh new file mode 100755 index 0000000..4edb2fd --- /dev/null +++ b/vagrant/vcmd.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