1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add support for multiple VPN tunnels.

This commit is contained in:
Josh Myers 2015-07-25 14:28:54 +01:00
parent 7ac955047f
commit 8902341086
2 changed files with 33 additions and 32 deletions

View file

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

View file

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