# -*- mode: ruby -*- # vi: set ft=ruby : def get_mac(oui="28:b7:ad") "Generate a MAC address" nic = (1..3).map{"%0.2x"%rand(256)}.join(":") return "#{oui}:#{nic}" end def get_mac_cisco(oui="a0:00:00:00:00") "Generate a MAC address" nic = (1..1).map{"%0.2x"%rand(256)}.join(":") return "#{oui}:#{nic}" end cwd = Dir.pwd.split("/").last username = ENV['USER'] domain_prefix = "#{username}_#{cwd}" Vagrant.configure("2") do |config| config.vm.define "csr1k-01" do |node| guest_name = "csr1k" node.vm.box = "cisco/csr1000v" node.vm.guest = :freebsd node.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true node.ssh.insert_key = false node.vm.boot_timeout = 180 node.vm.provider :libvirt do |domain| domain.nic_adapter_count = 8 #domain.nic_model_type = "e1000" domain.memory = 4096 domain.cpus = 2 domain.driver = "kvm" end node.vm.network :private_network, # csr1k-01 Gi2 <--> csr1k-02 Gi2 #:mac => "a0:00:00:00:00:21", :mac => "#{get_mac_cisco()}", :libvirt__tunnel_type => 'udp', :libvirt__tunnel_local_ip => '127.0.0.1', :libvirt__tunnel_local_port => '8013', :libvirt__tunnel_ip => '127.0.0.2', :libvirt__tunnel_port => '8013', :libvirt__iface_name => 'Gig2', auto_config: false end config.vm.define "csr1k-02" do |node| guest_name = "csr2k" node.vm.box = "cisco/csr1000v" node.vm.guest = :freebsd node.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true node.ssh.insert_key = false node.vm.boot_timeout = 180 node.vm.provider :libvirt do |domain| domain.nic_adapter_count = 8 #domain.nic_model_type = "e1000" domain.memory = 4096 domain.cpus = 2 domain.driver = "kvm" end node.vm.network :private_network, # csr1k-02 Gi2 <--> csr1k-01 Gi2 #:mac => "a0:00:00:00:00:22", :mac => "#{get_mac_cisco()}", :libvirt__tunnel_type => 'udp', :libvirt__tunnel_local_ip => '127.0.0.2', :libvirt__tunnel_local_port => '8013', :libvirt__tunnel_ip => '127.0.0.1', :libvirt__tunnel_port => '8013', :libvirt__iface_name => 'Gig2', auto_config: false end end