class Wire::SpecTemplatesNetwork

Templates for network-related stuff

Public Class Methods

build_template__bridge_exists() click to toggle source

rubocop:disable Lint/UnusedMethodArgument :reek: UnusedParameters

# File lib/wire/commands/spec_templates.rb, line 60
    def self.build_template__bridge_exists
      <<ERB
  describe 'In zone <%= zone_name %> we should have an ovs bridge named <%= bridge_name %>' do
    describe command "sudo ovs-vsctl list-br" do
      its(:stdout) { should match /<%= bridge_name %>/ }
    end
  end
ERB
    end
build_template__bridge_vlan_id_and_trunk() click to toggle source

rubocop:disable Lint/UnusedMethodArgument :reek: UnusedParameters

# File lib/wire/commands/spec_templates.rb, line 85
    def self.build_template__bridge_vlan_id_and_trunk
      <<ERB
  describe 'In zone <%= zone_name %>, ovs vlan bridge named <%= bridge_name %> ' \
           'should have id <%= vlanid %>' do
    describe command "sudo ovs-vsctl br-to-vlan <%= bridge_name %>" do
      its(:stdout) { should match /<%= vlanid %>/ }
    end
  end
  describe 'In zone <%= zone_name %>, ovs vlan bridge named <%= bridge_name %> ' \
           'should have parent <%= on_trunk %>' do
    describe command "sudo ovs-vsctl br-to-parent <%= bridge_name %>" do
      its(:stdout) { should match /<%= on_trunk %>/ }
    end
  end
ERB
    end
build_template__dhcp_is_valid() click to toggle source

rubocop:disable Lint/UnusedMethodArgument :reek: UnusedParameters requires zone_name, hostip, bridge_name, ip_start, ip_end

# File lib/wire/commands/spec_templates.rb, line 118
    def self.build_template__dhcp_is_valid
      <<ERB
  describe 'In zone <%= zone_name %> we should have dhcp service on ip <%= hostip %> ' \
           'on ovs bridge named <%= bridge_name %>, serving addresses from ' \
           '<%= ip_start %> to <%= ip_end %>' do

    describe file '/etc/dnsmasq.d/wire__<%= zone_name %>__<%= bridge_name %>.conf' do
      it { should be_file }
      its(:content) { should match /<%= ip_start %>/ }
      its(:content) { should match /<%= ip_end %>/ }
      its(:content) { should match /<%= bridge_name %>/ }
    end

    describe process 'dnsmasq' do
      it { should be_running }
    end

    describe port(67) do
      it { should be_listening.with('udp') }
    end

    describe command '/bin/netstat -nlup' do
      its(:stdout) { should match /67.*dnsmasq/ }
    end
  end
ERB
    end
build_template__ip_is_up() click to toggle source

rubocop:disable Lint/UnusedMethodArgument :reek: UnusedParameters

# File lib/wire/commands/spec_templates.rb, line 104
    def self.build_template__ip_is_up
      <<ERB
  describe 'In zone <%= zone_name %> we should have the ip <%= ip %> ' \
           'on ovs bridge named <%= bridge_name %>' do
    describe interface "<%= bridge_name %>" do
      it { should have_ipv4_address '<%= ip %>' }
    end
  end
ERB
    end
build_template__port_exists() click to toggle source

rubocop:disable Lint/UnusedMethodArgument :reek: UnusedParameters

# File lib/wire/commands/spec_templates.rb, line 72
    def self.build_template__port_exists
      <<ERB
  describe 'In zone <%= zone_name %> we should have a port <%= attach_intf %> on ovs ' \
           'bridge <%= bridge_name %>' do
    describe command "sudo ovs-vsctl list-ports <%= bridge_name %>" do
      its(:stdout) { should match /<%= attach_intf %>/ }
    end
  end
ERB
    end