Sha256: 9ef5bfe0b53f69d8f9eb3f1e3a11db93bb4bb19311eaa9981802a1509865e3de

Contents?: true

Size: 1.61 KB

Versions: 11

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

module Vcloud
  describe 'firewall_service_schema_validations' do
    context 'source and destination ips' do
      it 'should error if source_ip/destination_ip are invalid IPs' do
        config = {
          firewall_rules: [
            {
              id: '999',
              description: "A rule",
              destination_port_range: "22",
              destination_ip: "10.10",
              source_ip: "192.0",
            }
          ]

        }
        validator = Vcloud::Core::ConfigValidator.validate(:base, config, Vcloud::EdgeGateway::Schema::FIREWALL_SERVICE)
        expect(validator.valid?).to be_false
        expect(validator.errors).to eq([
                                         "source_ip: 192.0 is not a valid IP address range. Valid values can be IP address, CIDR, IP range, 'Any','internal' and 'external'.",
                                         "destination_ip: 10.10 is not a valid IP address range. Valid values can be IP address, CIDR, IP range, 'Any','internal' and 'external'."
                                       ])
      end

      it 'should validate OK if source_ip/destination_ip are valid IPs' do
        config = {
          firewall_rules: [
            {
              id: '999',
              description: "A rule",
              destination_port_range: "22",
              destination_ip: "10.10.10.20",
              source_ip: "192.0.2.2",
            }
          ]

        }
        validator = Vcloud::Core::ConfigValidator.validate(:base, config, Vcloud::EdgeGateway::Schema::FIREWALL_SERVICE)
        expect(validator.valid?).to be_true
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vcloud-edge_gateway-1.5.2 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.5.0 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.4.1 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.4.0 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.3.0 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.2.0 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.1.0 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.0.2 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.0.1 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-1.0.0 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb
vcloud-edge_gateway-0.5.0 spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb