Sha256: 008d3bd872ce3366f719e8dcf5d8b47cd4bf291a9696e53e3f62f406117a77d4

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

module Vcloud
  describe 'static_routing_service_schema_validations' do
    context 'source and destination ips' do
      it 'should error if network or next_hop IPs are invalid' do
        config = {
          static_routes: [
            {
              name: 'Some Name',
              network: '10.10.10.10/256',
              next_hop: '192.1',
              apply_on: 'interface'
            }
          ]
        }
        validator = Vcloud::Core::ConfigValidator.validate(:base, config, Vcloud::EdgeGateway::Schema::STATIC_ROUTING_SERVICE)
        expect(validator.valid?).to be false
        expect(validator.errors).to eq([
                                        "network: 10.10.10.10/256 is not a valid IP address range. Valid values can be IP address, CIDR, IP range, 'Any','internal' and 'external'.",
                                        "next_hop: 192.1 is not a valid ip_address",
                                       ])
      end

      it 'should validate OK if source_ip/destination_ip are valid IPs' do
        config = {
          static_routes: [
            {
              name: 'Some Name',
              network: '10.10.10.0/24',
              next_hop: '192.168.0.1',
              apply_on: 'interface'
            }
          ]
        }
        validator = Vcloud::Core::ConfigValidator.validate(:base, config, Vcloud::EdgeGateway::Schema::STATIC_ROUTING_SERVICE)
        expect(validator.valid?).to be true
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vcloud-edge_gateway-2.1.1 spec/vcloud/edge_gateway/static_routing_schema_validation_spec.rb
vcloud-edge_gateway-2.1.0 spec/vcloud/edge_gateway/static_routing_schema_validation_spec.rb