5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/generator.rb', line 5
def generate_xml(input_configs)
xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.EdgeGatewayServiceConfiguration('xmlns' => 'http://www.vmware.com/vcloud/v1.5') {
xml.GatewayIpsecVpnService {
xml.IsEnabled true
input_configs.each do |input_config|
xml.Tunnel {
xml.Name input_config['name']
xml.Description
xml.IpsecVpnThirdPartyPeer {
xml.PeerId input_config['peerIp']
}
xml.PeerIpAddress input_config['peerIp']
xml.PeerId input_config['peerIp']
xml.LocalIpAddress input_config['localIp']
xml.LocalId input_config['localIp']
xml.LocalSubnet {
xml.Name input_config['localSubnet']['name']
xml.Gateway input_config['localSubnet']['gateway']
xml.Netmask input_config['localSubnet']['netmask']
}
xml.PeerSubnet {
xml.Name input_config['peerSubnet']['name']
xml.Gateway input_config['peerSubnet']['gateway']
xml.Netmask input_config['peerSubnet']['netmask']
}
xml.SharedSecret input_config['sharedSecret']
xml.SharedSecretEncrypted false
xml.EncryptionProtocol 'AES256'
xml.Mtu input_config.fetch('mtu', '1500')
xml.IsEnabled 'true'
xml.IsOperational 'false'
}
end
}
}
end
xml.to_xml
end
|