neutron/vagrant/ovn/sparse/Vagrantfile
Brian Haley 88a6c92dc7 [OVN] Merge networking-ovn vagrant into neutron
Move networking-ovn/vagrant into neutron/tools/ovn_vagrant
Also added two sample local.conf files for a DB-only and
VTEP nodes.

Co-Authored-By: zhangyanxian <zhangyanxianmail@163.com>
Co-Authored-By: chen-li <shchenli@cn.ibm.com>
Co-Authored-By: Russell Bryant <rbryant@redhat.com>
Co-Authored-By: Kyle Mestery <mestery@mestery.com
Co-Authored-By: Miguel Angel Ajo <majopela@redhat.com>
Co-Authored-By: Richard Theis <rtheis@us.ibm.com>
Co-Authored-By: JUNJIE NAN <nanjj@cn.ibm.com>
Co-Authored-By: Flavio Fernandes <flavio@flaviof.com>
Co-Authored-By: John Kasperski <jckasper@us.ibm.com>
Co-Authored-By: Matthew Kassawara <mkassawara@gmail.com>
Co-Authored-By: venkatamahesh <venkatamaheshkotha@gmail.com>
Co-Authored-By: Tong Li <litong01@us.ibm.com>
Co-Authored-By: venkata anil <anilvenkata@redhat.com>
Co-Authored-By: Vu Cong Tuan <tuanvc@vn.fujitsu.com>
Co-Authored-By: RYAN D. MOATS <rmoats@us.ibm.com>

Change-Id: I12966d5548a60b46edd5c84ee0035eb11671fd8c
Partially-Implements: blueprint neutron-ovn-merge
2020-02-18 17:26:15 -05:00

97 lines
5.0 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
require 'ipaddr'
require '../provisioning/providers.rb'
vagrant_config = YAML.load_file("instances.yml")
Vagrant.configure(2) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
# Configure cached packages to be shared between instances of the same base box.
# More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
config.cache.scope = :box
end
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder File.expand_path(".."), "/vagrant"
config.vm.synced_folder File.expand_path("../.."), "/home/vagrant/neutron"
# Use the ipaddr library to calculate the netmask of a given network
net = IPAddr.new vagrant_config['provider_network']
netmask = net.inspect().split("/")[1].split(">")[0]
# Build the common args for the setup-base.sh scripts.
setup_base_common_args = "#{vagrant_config['ovndb']['ip']} #{vagrant_config['ovndb']['short_name']} " +
"#{vagrant_config['ovncontroller']['ip']} #{vagrant_config['ovncontroller']['short_name']} " +
"#{vagrant_config['ovncompute1']['ip']} #{vagrant_config['ovncompute1']['short_name']} " +
"#{vagrant_config['ovncompute2']['ip']} #{vagrant_config['ovncompute2']['short_name']} " +
"#{vagrant_config['ovnvtep']['ip']} #{vagrant_config['ovnvtep']['short_name']} "
# Bring up the Devstack ovsdb/ovn-northd node
config.vm.define "ovn-db" do |ovndb|
cfg = vagrant_config['ovndb']
ovndb.vm.host_name = cfg['host_name']
ovndb.vm.network "private_network", ip: cfg['ip']
ovndb.vm.network "private_network", ip: cfg['prov-ip'], netmask: netmask
ovndb.vm.provision "shell", path: "../provisioning/setup-base.sh", privileged: false,
:args => "#{vagrant_config['ovndb']['mtu']} #{setup_base_common_args}"
ovndb.vm.provision "shell", path: "../provisioning/setup-db.sh", privileged: false, :args => "#{vagrant_config['ovncontroller']['ip']}"
configure_providers(ovndb.vm, cfg)
end
# Bring up the Devstack controller node on Virtualbox
config.vm.define "ovn-controller", primary: true do |ovncontroller|
cfg = vagrant_config['ovncontroller']
ovncontroller.vm.host_name = cfg['host_name']
ovncontroller.vm.network "private_network", ip: cfg['ip']
ovncontroller.vm.network "private_network", ip: cfg['prov-ip'], netmask: netmask
ovncontroller.vm.provision "shell", path: "../provisioning/setup-base.sh", privileged: false,
:args => "#{cfg['mtu']} #{setup_base_common_args}"
ovncontroller.vm.provision "shell", path: "../provisioning/setup-controller.sh", privileged: false,
:args => "#{vagrant_config['ovndb']['ip']} #{vagrant_config['provider_start_ip']} #{vagrant_config['provider_end_ip']} " +
"#{vagrant_config['provider_gateway']} #{vagrant_config['provider_network']} #{vagrant_config['ovn_vm_subnet']}"
configure_providers(ovncontroller.vm, cfg)
end
config.vm.define "ovn-vtep", autostart: false do |ovnvtep|
cfg = vagrant_config['ovnvtep']
ovnvtep.vm.host_name = cfg['host_name']
ovnvtep.vm.network "private_network", ip: cfg['ip']
ovnvtep.vm.network "private_network", ip: cfg['prov-ip'], netmask: netmask
ovnvtep.vm.provision "shell", path: "../provisioning/setup-base.sh", privileged: false,
:args => "#{cfg['mtu']} #{setup_base_common_args}"
ovnvtep.vm.provision "shell", path: "../provisioning/setup-vtep.sh", privileged: false, :args => "#{vagrant_config['ovncontroller']['ip']} #{vagrant_config['ovndb']['ip']}"
configure_providers(ovnvtep.vm, cfg)
end
# Bring up the first Devstack compute node on Virtualbox
config.vm.define "ovn-compute1" do |ovncompute1|
cfg = vagrant_config['ovncompute1']
ovncompute1.vm.host_name = cfg['host_name']
ovncompute1.vm.network "private_network", ip: cfg['ip']
ovncompute1.vm.network "private_network", ip: cfg['prov-ip'], netmask: netmask
ovncompute1.vm.provision "shell", path: "../provisioning/setup-base.sh", privileged: false,
:args => "#{cfg['mtu']} #{setup_base_common_args}"
ovncompute1.vm.provision "shell", path: "../provisioning/setup-compute.sh", privileged: false,
:args => "#{vagrant_config['ovncontroller']['ip']} #{vagrant_config['ovndb']['ip']}"
configure_providers(ovncompute1.vm, cfg)
end
# Bring up the second Devstack compute node on Virtualbox
config.vm.define "ovn-compute2" do |ovncompute2|
cfg = vagrant_config['ovncompute2']
ovncompute2.vm.host_name = cfg['host_name']
ovncompute2.vm.network "private_network", ip: cfg['ip']
ovncompute2.vm.network "private_network", ip: cfg['prov-ip'], netmask: netmask
ovncompute2.vm.provision "shell", path: "../provisioning/setup-base.sh", privileged: false,
:args => "#{cfg['mtu']} #{setup_base_common_args}"
ovncompute2.vm.provision "shell", path: "../provisioning/setup-compute.sh", privileged: false,
:args => "#{vagrant_config['ovncontroller']['ip']} #{vagrant_config['ovndb']['ip']}"
configure_providers(ovncompute2.vm, cfg)
end
end