fog-openstack 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.hound.yml +2 -0
  4. data/.rubocop.yml +93 -0
  5. data/.travis.yml +13 -10
  6. data/{lib/fog/openstack/CHANGELOG.md → CHANGELOG.md} +0 -0
  7. data/CODE_OF_CONDUCT.md +1 -1
  8. data/Gemfile +2 -0
  9. data/README.md +497 -3
  10. data/Rakefile +5 -1
  11. data/fog-openstack.gemspec +8 -7
  12. data/gemfiles/Gemfile-1.9 +16 -0
  13. data/lib/fog/openstack.rb +55 -30
  14. data/lib/fog/openstack/docs/metering.md +29 -0
  15. data/lib/fog/openstack/metering.rb +6 -1
  16. data/lib/fog/openstack/models/metering/event.rb +16 -0
  17. data/lib/fog/openstack/models/metering/events.rb +23 -0
  18. data/lib/fog/openstack/models/network/floating_ip.rb +1 -24
  19. data/lib/fog/openstack/models/network/ike_policies.rb +32 -0
  20. data/lib/fog/openstack/models/network/ike_policy.rb +43 -0
  21. data/lib/fog/openstack/models/network/ipsec_policies.rb +32 -0
  22. data/lib/fog/openstack/models/network/ipsec_policy.rb +45 -0
  23. data/lib/fog/openstack/models/network/ipsec_site_connection.rb +51 -0
  24. data/lib/fog/openstack/models/network/ipsec_site_connections.rb +33 -0
  25. data/lib/fog/openstack/models/network/vpn_service.rb +42 -0
  26. data/lib/fog/openstack/models/network/vpn_services.rb +32 -0
  27. data/lib/fog/openstack/network.rb +52 -13
  28. data/lib/fog/openstack/requests/compute/create_volume.rb +28 -21
  29. data/lib/fog/openstack/requests/metering/get_event.rb +27 -0
  30. data/lib/fog/openstack/requests/metering/list_events.rb +42 -0
  31. data/lib/fog/openstack/requests/network/associate_floating_ip.rb +15 -10
  32. data/lib/fog/openstack/requests/network/create_floating_ip.rb +1 -1
  33. data/lib/fog/openstack/requests/network/create_ike_policy.rb +53 -0
  34. data/lib/fog/openstack/requests/network/create_ipsec_policy.rb +53 -0
  35. data/lib/fog/openstack/requests/network/create_ipsec_site_connection.rb +66 -0
  36. data/lib/fog/openstack/requests/network/create_vpn_service.rb +51 -0
  37. data/lib/fog/openstack/requests/network/delete_ike_policy.rb +28 -0
  38. data/lib/fog/openstack/requests/network/delete_ipsec_policy.rb +28 -0
  39. data/lib/fog/openstack/requests/network/delete_ipsec_site_connection.rb +29 -0
  40. data/lib/fog/openstack/requests/network/delete_vpn_service.rb +28 -0
  41. data/lib/fog/openstack/requests/network/disassociate_floating_ip.rb +15 -10
  42. data/lib/fog/openstack/requests/network/get_floating_ip.rb +12 -2
  43. data/lib/fog/openstack/requests/network/get_ike_policy.rb +28 -0
  44. data/lib/fog/openstack/requests/network/get_ipsec_policy.rb +28 -0
  45. data/lib/fog/openstack/requests/network/get_ipsec_site_connection.rb +28 -0
  46. data/lib/fog/openstack/requests/network/get_network.rb +1 -13
  47. data/lib/fog/openstack/requests/network/get_vpn_service.rb +28 -0
  48. data/lib/fog/openstack/requests/network/list_ike_policies.rb +25 -0
  49. data/lib/fog/openstack/requests/network/list_ipsec_policies.rb +25 -0
  50. data/lib/fog/openstack/requests/network/list_ipsec_site_connections.rb +25 -0
  51. data/lib/fog/openstack/requests/network/list_vpn_services.rb +25 -0
  52. data/lib/fog/openstack/requests/network/update_ike_policy.rb +49 -0
  53. data/lib/fog/openstack/requests/network/update_ipsec_policy.rb +52 -0
  54. data/lib/fog/openstack/requests/network/update_ipsec_site_connection.rb +64 -0
  55. data/lib/fog/openstack/requests/network/update_vpn_service.rb +46 -0
  56. data/lib/fog/openstack/storage.rb +2 -2
  57. data/lib/fog/openstack/version.rb +1 -1
  58. data/tests/helper.rb +3 -0
  59. data/tests/openstack/models/network/ike_policies_tests.rb +28 -0
  60. data/tests/openstack/models/network/ike_policy_tests.rb +36 -0
  61. data/tests/openstack/models/network/ipsec_policies_tests.rb +26 -0
  62. data/tests/openstack/models/network/ipsec_policy_tests.rb +36 -0
  63. data/tests/openstack/models/network/ipsec_site_connection_tests.rb +50 -0
  64. data/tests/openstack/models/network/ipsec_site_connections_tests.rb +32 -0
  65. data/tests/openstack/models/network/vpn_service_tests.rb +27 -0
  66. data/tests/openstack/models/network/vpn_services_tests.rb +22 -0
  67. data/tests/openstack/requests/metering/event_tests.rb +17 -0
  68. data/tests/openstack/requests/network/ike_policy_tests.rb +65 -0
  69. data/tests/openstack/requests/network/ipsec_policy_tests.rb +65 -0
  70. data/tests/openstack/requests/network/ipsec_site_connection_tests.rb +82 -0
  71. data/tests/openstack/requests/network/vpn_service_tests.rb +61 -0
  72. metadata +109 -47
  73. data/CONTRIBUTORS.md +0 -79
@@ -0,0 +1,36 @@
1
+ Shindo.tests("Fog::Network[:openstack] | ike_policy", ['openstack']) do
2
+ tests('success') do
3
+ tests('#create').succeeds do
4
+ @instance = Fog::Network[:openstack].ike_policies.create(:name => 'test-ike-policy',
5
+ :description => 'Test VPN IKE Policy',
6
+ :tenant_id => 'tenant_id',
7
+ :auth_algorithm => 'sha1',
8
+ :encryption_algorithm => 'aes-256',
9
+ :pfs => 'group5',
10
+ :phase1_negotiation_mode => 'main',
11
+ :lifetime => {
12
+ 'units' => 'seconds',
13
+ 'value' => 3600
14
+ },
15
+ :ike_version => 'v1')
16
+ !@instance.id.nil?
17
+ end
18
+
19
+ tests('#update').succeeds do
20
+ @instance.name = 'rename-test-ike-policy'
21
+ @instance.description = 'Test VPN IKE Policy'
22
+ @instance.tenant_id = 'baz'
23
+ @instance.auth_algorithm = 'sha512'
24
+ @instance.encryption_algorithm = 'aes-512'
25
+ @pfs = 'group1'
26
+ @phase1_negotiation_mode = 'main'
27
+ @ike_version = 'v1'
28
+ @lifetime = {'units' => 'seconds', 'value' => 3600}
29
+ @instance.update
30
+ end
31
+
32
+ tests('#destroy').succeeds do
33
+ @instance.destroy == true
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,26 @@
1
+ Shindo.tests("Fog::Network[:openstack] | ipsec_policies", ['openstack']) do
2
+ params = {:name => 'test-ipsec-policy',
3
+ :description => 'Test VPN ipsec Policy',
4
+ :tenant_id => 'tenant_id',
5
+ :auth_algorithm => 'sha1',
6
+ :encryption_algorithm => 'aes-128',
7
+ :pfs => 'group5',
8
+ :transform_protocol => 'esp',
9
+ :lifetime => {'units' => 'seconds', 'value' => 3600},
10
+ :encapsulation_mode => 'tunnel'}
11
+ @ipsec_policy = Fog::Network[:openstack].ipsec_policies.create(params)
12
+
13
+ @ipsec_policies = Fog::Network[:openstack].ipsec_policies
14
+
15
+ tests('success') do
16
+ tests('#all').succeeds do
17
+ @ipsec_policies.all
18
+ end
19
+
20
+ tests('#get').succeeds do
21
+ @ipsec_policies.get(@ipsec_policy.id)
22
+ end
23
+ end
24
+
25
+ @ipsec_policy.destroy
26
+ end
@@ -0,0 +1,36 @@
1
+ Shindo.tests("Fog::Network[:openstack] | ipsec_policy", ['openstack']) do
2
+ tests('success') do
3
+ tests('#create').succeeds do
4
+ @instance = Fog::Network[:openstack].ipsec_policies.create(:name => 'test-ipsec-policy',
5
+ :description => 'Test VPN ipsec Policy',
6
+ :tenant_id => 'tenant_id',
7
+ :auth_algorithm => 'sha1',
8
+ :encryption_algorithm => 'aes-128',
9
+ :pfs => 'group5',
10
+ :transform_protocol => 'esp',
11
+ :lifetime => {
12
+ 'units' => 'seconds',
13
+ 'value' => 3600
14
+ },
15
+ :encapsulation_mode => 'tunnel')
16
+ !@instance.id.nil?
17
+ end
18
+
19
+ tests('#update').succeeds do
20
+ @instance.name = 'rename-test-ipsec-policy'
21
+ @instance.description = 'Test VPN ipsec Policy'
22
+ @instance.tenant_id = 'baz'
23
+ @instance.auth_algorithm = 'sha27'
24
+ @instance.encryption_algorithm = 'aes-18'
25
+ @instance.pfs = 'group52'
26
+ @instance.transform_protocol = 'espn'
27
+ @instance.encapsulation_mode = 'tunnel'
28
+ @instance.lifetime = {'units' => 'seconds', 'value' => 3600}
29
+ @instance.update
30
+ end
31
+
32
+ tests('#destroy').succeeds do
33
+ @instance.destroy == true
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,50 @@
1
+ Shindo.tests("Fog::Network[:openstack] | ipsec_site_connection", ['openstack']) do
2
+ tests('success') do
3
+ tests('#create').succeeds do
4
+ params = {:name => 'test-ipsec-site-connection',
5
+ :vpnservice_id => 'vpn',
6
+ :ikepolicy_id => 'ike',
7
+ :ipsecpolicy_id => 'ipsec',
8
+ :description => 'Test VPN IPSec Site Connection',
9
+ :tenant_id => 'tenant_id',
10
+ :peer_address => "172.24.4.226",
11
+ :peer_id => "172.24.4.226",
12
+ :peer_cidrs => [],
13
+ :psk => "secret",
14
+ :mtu => 1500,
15
+ :dpd => {
16
+ "action" => "hold",
17
+ "interval" => 30,
18
+ "timeout" => 120
19
+ },
20
+ :initiator => "bi-directional",
21
+ :admin_state_up => true}
22
+ @instance = Fog::Network[:openstack].ipsec_site_connections.create(params)
23
+ !@instance.id.nil?
24
+ end
25
+
26
+ tests('#update').succeeds do
27
+ @instance.name = 'rename-test-ipsec-site-connection'
28
+ @instance.description = 'Test VPN IPSec Site Connection'
29
+ @instance.tenant_id = 'baz'
30
+ @instance.peer_address = "172.24.4.227"
31
+ @instance.peer_id = "172.24.4.227"
32
+ @instance.peer_cidrs = []
33
+ @instance.psk = "secrets"
34
+ @instance.mtu = 1600
35
+ @instance.initiator = "bi-directional"
36
+ @instance.admin_state_up = false
37
+ @instance.dpd = {
38
+ "action" => "hold",
39
+ "interval" => 50,
40
+ "timeout" => 120
41
+ }
42
+
43
+ @instance.update
44
+ end
45
+
46
+ tests('#destroy').succeeds do
47
+ @instance.destroy == true
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,32 @@
1
+ Shindo.tests("Fog::Network[:openstack] | ipsec_site_connections", ['openstack']) do
2
+ params = {:name => 'test-ipsec-site-connection',
3
+ :vpnservice_id => 'vpn',
4
+ :ikepolicy_id => 'ike',
5
+ :ipsecpolicy_id => 'ipsec',
6
+ :description => 'Test VPN IPSec Site Connection',
7
+ :tenant_id => 'tenant_id',
8
+ :peer_address => "172.24.4.226",
9
+ :peer_id => "172.24.4.226",
10
+ :peer_cidrs => [],
11
+ :psk => "secret",
12
+ :mtu => 1500,
13
+ :dpd => {"action" => "hold", "interval" => 30, "timeout" => 120},
14
+ :initiator => "bi-directional",
15
+ :admin_state_up => true}
16
+
17
+ @ipsec_site_connection = Fog::Network[:openstack].ipsec_site_connections.create(params)
18
+
19
+ @ipsec_site_connections = Fog::Network[:openstack].ipsec_site_connections
20
+
21
+ tests('success') do
22
+ tests('#all').succeeds do
23
+ @ipsec_site_connections.all
24
+ end
25
+
26
+ tests('#get').succeeds do
27
+ @ipsec_site_connections.get(@ipsec_site_connection.id)
28
+ end
29
+ end
30
+
31
+ @ipsec_site_connection.destroy
32
+ end
@@ -0,0 +1,27 @@
1
+ Shindo.tests("Fog::Network[:openstack] | vpn_service", ['openstack']) do
2
+ tests('success') do
3
+ tests('#create').succeeds do
4
+ @instance = Fog::Network[:openstack].vpn_services.create(:subnet_id => 'foo',
5
+ :router_id => 'bar',
6
+ :name => 'test',
7
+ :description => 'test',
8
+ :admin_state_up => true,
9
+ :tenant_id => 'tenant')
10
+ !@instance.id.nil?
11
+ end
12
+
13
+ tests('#update').succeeds do
14
+ @instance.subnet_id = 'new'
15
+ @instance.router_id = 'new'
16
+ @instance.name = 'rename'
17
+ @instance.description = 'new'
18
+ @instance.admin_state_up = false
19
+ @instance.tenant_id = 'baz'
20
+ @instance.update
21
+ end
22
+
23
+ tests('#destroy').succeeds do
24
+ @instance.destroy == true
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ Shindo.tests("Fog::Network[:openstack] | vpn_services", ['openstack']) do
2
+ @vpn_service = Fog::Network[:openstack].vpn_services.create(:subnet_id => 'foo',
3
+ :router_id => 'bar',
4
+ :name => 'test',
5
+ :description => 'test',
6
+ :admin_state_up => true,
7
+ :tenant_id => 'tenant')
8
+
9
+ @vpn_services = Fog::Network[:openstack].vpn_services
10
+
11
+ tests('success') do
12
+ tests('#all').succeeds do
13
+ @vpn_services.all
14
+ end
15
+
16
+ tests('#get').succeeds do
17
+ @vpn_services.get @vpn_service.id
18
+ end
19
+ end
20
+
21
+ @vpn_service.destroy
22
+ end
@@ -0,0 +1,17 @@
1
+ Shindo.tests('Fog::Metering[:openstack] | event requests', ['openstack']) do
2
+
3
+ @event_format = {
4
+ 'message_id' => String,
5
+ 'event_type' => String,
6
+ }
7
+
8
+ tests('success') do
9
+ tests('#list_events').formats([@event_format]) do
10
+ Fog::Metering[:openstack].list_events.body
11
+ end
12
+
13
+ tests('#get_event').formats(@event_format) do
14
+ Fog::Metering[:openstack].get_event('test').body
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,65 @@
1
+ Shindo.tests('Fog::Network[:openstack] | ike_policy requests', ['openstack']) do
2
+ @ike_policy_format = {
3
+ 'id' => String,
4
+ 'name' => String,
5
+ 'description' => String,
6
+ 'tenant_id' => String,
7
+ 'auth_algorithm' => String,
8
+ 'encryption_algorithm' => String,
9
+ 'pfs' => String,
10
+ 'phase1_negotiation_mode' => String,
11
+ 'lifetime' => Hash,
12
+ 'ike_version' => String
13
+ }
14
+
15
+ tests('success') do
16
+ tests('#create_ike_policy').formats('ikepolicy' => @ike_policy_format) do
17
+ attributes = {:name => 'test-ike-policy', :description => 'Test VPN IKE Policy',
18
+ :tenant_id => 'tenant_id', :auth_algorithm => 'sha1',
19
+ :encryption_algorithm => 'aes-256', :pfs => 'group5',
20
+ :phase1_negotiation_mode => 'main', :lifetime => {'units' => 'seconds', 'value' => 3600},
21
+ :ike_version => 'v1'
22
+ }
23
+ Fog::Network[:openstack].create_ike_policy(attributes).body
24
+ end
25
+
26
+ tests('#list_ike_policies').formats('ikepolicies' => [@ike_policy_format]) do
27
+ Fog::Network[:openstack].list_ike_policies.body
28
+ end
29
+
30
+ tests('#get_ike_policy').formats('ikepolicy' => @ike_policy_format) do
31
+ ike_policy_id = Fog::Network[:openstack].ike_policies.all.first.id
32
+ Fog::Network[:openstack].get_ike_policy(ike_policy_id).body
33
+ end
34
+
35
+ tests('#update_ike_policy').formats('ikepolicy' => @ike_policy_format) do
36
+ ike_policy_id = Fog::Network[:openstack].ike_policies.all.first.id
37
+ attributes = {:name => 'rename-test-ike-policy', :description => 'Test VPN IKE Policy',
38
+ :tenant_id => 'tenant_id', :auth_algorithm => 'sha1',
39
+ :encryption_algorithm => 'aes-256', :pfs => 'group5',
40
+ :phase1_negotiation_mode => 'main', :lifetime => {'units' => 'seconds', 'value' => 3600},
41
+ :ike_version => 'v1'
42
+ }
43
+ Fog::Network[:openstack].update_ike_policy(ike_policy_id, attributes).body
44
+ end
45
+
46
+ tests('#delete_ike_policy').succeeds do
47
+ ike_policy_id = Fog::Network[:openstack].ike_policies.all.first.id
48
+ Fog::Network[:openstack].delete_ike_policy(ike_policy_id)
49
+ end
50
+ end
51
+
52
+ tests('failure') do
53
+ tests('#get_ike_policy').raises(Fog::Network::OpenStack::NotFound) do
54
+ Fog::Network[:openstack].get_ike_policy(0)
55
+ end
56
+
57
+ tests('#update_ike_policy').raises(Fog::Network::OpenStack::NotFound) do
58
+ Fog::Network[:openstack].update_ike_policy(0, {})
59
+ end
60
+
61
+ tests('#delete_ike_policy').raises(Fog::Network::OpenStack::NotFound) do
62
+ Fog::Network[:openstack].delete_ike_policy(0)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,65 @@
1
+ Shindo.tests('Fog::Network[:openstack] | ipsec_policy requests', ['openstack']) do
2
+ @ipsec_policy_format = {
3
+ 'id' => String,
4
+ 'name' => String,
5
+ 'description' => String,
6
+ 'tenant_id' => String,
7
+ 'lifetime' => Hash,
8
+ 'pfs' => String,
9
+ 'transform_protocol' => String,
10
+ 'auth_algorithm' => String,
11
+ 'encapsulation_mode' => String,
12
+ 'encryption_algorithm' => String
13
+ }
14
+
15
+ tests('success') do
16
+ tests('#create_ipsec_policy').formats('ipsecpolicy' => @ipsec_policy_format) do
17
+ attributes = {:name => 'test-ipsec-policy', :description => 'Test VPN ipsec Policy',
18
+ :tenant_id => 'tenant_id', :auth_algorithm => 'sha1',
19
+ :encryption_algorithm => 'aes-128', :pfs => 'group5',
20
+ :transform_protocol => 'esp', :lifetime => {'units' => 'seconds', 'value' => 3600},
21
+ :encapsulation_mode => 'tunnel'
22
+ }
23
+ Fog::Network[:openstack].create_ipsec_policy(attributes).body
24
+ end
25
+
26
+ tests('#list_ipsec_policies').formats('ipsecpolicies' => [@ipsec_policy_format]) do
27
+ Fog::Network[:openstack].list_ipsec_policies.body
28
+ end
29
+
30
+ tests('#get_ipsec_policy').formats('ipsecpolicy' => @ipsec_policy_format) do
31
+ ipsec_policy_id = Fog::Network[:openstack].ipsec_policies.all.first.id
32
+ Fog::Network[:openstack].get_ipsec_policy(ipsec_policy_id).body
33
+ end
34
+
35
+ tests('#update_ipsec_policy').formats('ipsecpolicy' => @ipsec_policy_format) do
36
+ ipsec_policy_id = Fog::Network[:openstack].ipsec_policies.all.first.id
37
+ attributes = {:name => 'rename-test-ipsec-policy', :description => 'Test VPN ipsec Policy',
38
+ :tenant_id => 'tenant_id', :auth_algorithm => 'sha1',
39
+ :encryption_algorithm => 'aes-128', :pfs => 'group5',
40
+ :transform_protocol => 'esp', :lifetime => {'units' => 'seconds', 'value' => 3600},
41
+ :encapsulation_mode => 'tunnel'
42
+ }
43
+ Fog::Network[:openstack].update_ipsec_policy(ipsec_policy_id, attributes).body
44
+ end
45
+
46
+ tests('#delete_ipsec_policy').succeeds do
47
+ ipsec_policy_id = Fog::Network[:openstack].ipsec_policies.all.first.id
48
+ Fog::Network[:openstack].delete_ipsec_policy(ipsec_policy_id)
49
+ end
50
+ end
51
+
52
+ tests('failure') do
53
+ tests('#get_ipsec_policy').raises(Fog::Network::OpenStack::NotFound) do
54
+ Fog::Network[:openstack].get_ipsec_policy(0)
55
+ end
56
+
57
+ tests('#update_ipsec_policy').raises(Fog::Network::OpenStack::NotFound) do
58
+ Fog::Network[:openstack].update_ipsec_policy(0, {})
59
+ end
60
+
61
+ tests('#delete_ipsec_policy').raises(Fog::Network::OpenStack::NotFound) do
62
+ Fog::Network[:openstack].delete_ipsec_policy(0)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,82 @@
1
+ Shindo.tests('Fog::Network[:openstack] | ipsec_site_connection requests', ['openstack']) do
2
+ @ipsec_site_connection_format = {
3
+ 'id' => String,
4
+ 'name' => String,
5
+ 'description' => String,
6
+ 'status' => String,
7
+ 'tenant_id' => String,
8
+ 'admin_state_up' => Fog::Boolean,
9
+ 'psk' => String,
10
+ 'initiator' => String,
11
+ 'auth_mode' => String,
12
+ 'peer_cidrs' => Array,
13
+ 'mtu' => Integer,
14
+ 'peer_ep_group_id' => String,
15
+ 'ikepolicy_id' => String,
16
+ 'vpnservice_id' => String,
17
+ 'dpd' => Hash,
18
+ 'route_mode' => String,
19
+ 'ipsecpolicy_id' => String,
20
+ 'local_ep_group_id' => String,
21
+ 'peer_address' => String,
22
+ 'peer_id' => String
23
+ }
24
+
25
+ tests('success') do
26
+ tests('#create_ipsec_site_connection').formats('ipsec_site_connection' => @ipsec_site_connection_format) do
27
+ vpnservice_id = "vpn"
28
+ ikepolicy_id = "ike"
29
+ ipsecpolicy_id = "ipsec"
30
+
31
+ attributes = {:name => 'test-ipsec-site-connection', :description => 'Test VPN IPSec Site Connection',
32
+ :tenant_id => 'tenant_id',
33
+ :peer_address => "172.24.4.226", :peer_id => "172.24.4.226", :peer_cidrs => [],
34
+ :psk => "secret", :mtu => 1500, :dpd => {"action" => "hold", "interval" => 30, "timeout" => 120},
35
+ :initiator => "bi-directional", :admin_state_up => true
36
+ }
37
+ Fog::Network[:openstack].create_ipsec_site_connection(vpnservice_id,
38
+ ikepolicy_id,
39
+ ipsecpolicy_id,
40
+ attributes).body
41
+ end
42
+
43
+ tests('#list_ipsec_site_connections').formats('ipsec_site_connections' => [@ipsec_site_connection_format]) do
44
+ Fog::Network[:openstack].list_ipsec_site_connections.body
45
+ end
46
+
47
+ tests('#get_ipsec_site_connection').formats('ipsec_site_connection' => @ipsec_site_connection_format) do
48
+ ipsec_site_connection_id = Fog::Network[:openstack].ipsec_site_connections.all.first.id
49
+ Fog::Network[:openstack].get_ipsec_site_connection(ipsec_site_connection_id).body
50
+ end
51
+
52
+ tests('#update_ipsec_site_connection').formats('ipsec_site_connection' => @ipsec_site_connection_format) do
53
+ ipsec_site_connection_id = Fog::Network[:openstack].ipsec_site_connections.all.first.id
54
+
55
+ attributes = {:name => 'rename-test-ipsec-site-connection', :description => 'Test VPN IPSec Site Connection',
56
+ :tenant_id => 'tenant_id',
57
+ :peer_address => "172.24.4.226", :peer_id => "172.24.4.226", :peer_cidrs => [],
58
+ :psk => "secret", :mtu => 1500, :dpd => {"action" => "hold", "interval" => 30, "timeout" => 120},
59
+ :initiator => "bi-directional", :admin_state_up => true}
60
+ Fog::Network[:openstack].update_ipsec_site_connection(ipsec_site_connection_id, attributes).body
61
+ end
62
+
63
+ tests('#delete_ipsec_site_connection').succeeds do
64
+ ipsec_site_connection_id = Fog::Network[:openstack].ipsec_site_connections.all.first.id
65
+ Fog::Network[:openstack].delete_ipsec_site_connection(ipsec_site_connection_id)
66
+ end
67
+ end
68
+
69
+ tests('failure') do
70
+ tests('#get_ipsec_site_connection').raises(Fog::Network::OpenStack::NotFound) do
71
+ Fog::Network[:openstack].get_ipsec_site_connection(0)
72
+ end
73
+
74
+ tests('#update_ipsec_site_connection').raises(Fog::Network::OpenStack::NotFound) do
75
+ Fog::Network[:openstack].update_ipsec_site_connection(0, {})
76
+ end
77
+
78
+ tests('#delete_ipsec_site_connection').raises(Fog::Network::OpenStack::NotFound) do
79
+ Fog::Network[:openstack].delete_ipsec_site_connection(0)
80
+ end
81
+ end
82
+ end