Merge pull request #3639 from joshmyers/support_multiple_vpns

Vcloud Director supports multiple VPN tunnels.
This commit is contained in:
Paulo Henrique Lopes Ribeiro 2015-08-05 13:41:41 -03:00
commit f99adc8907
2 changed files with 33 additions and 32 deletions

View File

@ -47,37 +47,38 @@ module Fog
xml.GatewayIpsecVpnService {
xml.IsEnabled vpn_config[:IsEnabled] if vpn_config.key?(:IsEnabled)
tunnel_config = vpn_config[:Tunnel]
xml.Tunnel {
xml.Name tunnel_config[:Name]
xml.Description tunnel_config[:Description]
xml.IpsecVpnLocalPeer {
xml.Id tunnel_config[:IpsecVpnLocalPeerId]
xml.Name tunnel_config[:IpsecVpnLocalPeerName]
}
xml.PeerIpAddress tunnel_config[:PeerIpAddress]
xml.PeerId tunnel_config[:PeerId]
xml.LocalIpAddress tunnel_config[:LocalIpAddress]
xml.LocalId tunnel_config[:LocalId]
tunnel_config[:LocalSubnet].each do |subnet|
xml.LocalSubnet {
xml.Name subnet[:Name]
xml.Gateway subnet[:Gateway]
xml.Netmask subnet[:Netmask]
vpn_config[:Tunnel].each do |tunnel_config|
xml.Tunnel {
xml.Name tunnel_config[:Name]
xml.Description tunnel_config[:Description]
xml.IpsecVpnLocalPeer {
xml.Id tunnel_config[:IpsecVpnLocalPeerId]
xml.Name tunnel_config[:IpsecVpnLocalPeerName]
}
end
peer_subnet_config = tunnel_config[:PeerSubnet]
xml.PeerSubnet {
xml.Name peer_subnet_config[:Name]
xml.Gateway peer_subnet_config[:Gateway]
xml.Netmask peer_subnet_config[:Netmask]
xml.PeerIpAddress tunnel_config[:PeerIpAddress]
xml.PeerId tunnel_config[:PeerId]
xml.LocalIpAddress tunnel_config[:LocalIpAddress]
xml.LocalId tunnel_config[:LocalId]
tunnel_config[:LocalSubnet].each do |subnet|
xml.LocalSubnet {
xml.Name subnet[:Name]
xml.Gateway subnet[:Gateway]
xml.Netmask subnet[:Netmask]
}
end
peer_subnet_config = tunnel_config[:PeerSubnet]
xml.PeerSubnet {
xml.Name peer_subnet_config[:Name]
xml.Gateway peer_subnet_config[:Gateway]
xml.Netmask peer_subnet_config[:Netmask]
}
xml.SharedSecret tunnel_config[:SharedSecret]
xml.SharedSecretEncrypted tunnel_config[:SharedSecretEncrypted] if tunnel_config.key?(:SharedSecretEncrypted)
xml.EncryptionProtocol tunnel_config[:EncryptionProtocol]
xml.Mtu tunnel_config[:Mtu]
xml.IsEnabled tunnel_config[:IsEnabled]
}
xml.SharedSecret tunnel_config[:SharedSecret]
xml.SharedSecretEncrypted tunnel_config[:SharedSecretEncrypted] if tunnel_config.key?(:SharedSecretEncrypted)
xml.EncryptionProtocol tunnel_config[:EncryptionProtocol]
xml.Mtu tunnel_config[:Mtu]
xml.IsEnabled tunnel_config[:IsEnabled]
}
end
}
end
@ -217,7 +218,7 @@ module Fog
xml.Protocols {
rule[:Protocols].each do |key, value|
xml.send(key.to_s.capitalize, value)
xml.send(key.to_s.capitalize, value)
end
}
xml.IcmpSubType rule[:IcmpSubType] if rule.key?(:IcmpSubType)

View File

@ -20,7 +20,7 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
:GatewayIpsecVpnService =>
{
:IsEnabled => "true",
:Tunnel => {
:Tunnel => [{
:Name => "test vpn",
:PeerIpAddress => "110.110.110.110",
:PeerId => "1223-123UDH-12321",
@ -41,7 +41,7 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
:Gateway => "192.168.90.254",
:Netmask => "255.255.255.0"
}]
}
}]
}
}