vagrant-cosmic 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/CHANGELOG.md +8 -0
  4. data/Docker/.dockerignore +2 -0
  5. data/Docker/Dockerfile +48 -0
  6. data/Docker/Dockerfile.chefdk_0_17 +49 -0
  7. data/Docker/Dockerfile.latest_dependencies +49 -0
  8. data/Docker/README.md +95 -0
  9. data/Docker/vac.ps1 +29 -0
  10. data/Docker/vac.sh +30 -0
  11. data/Gemfile +21 -0
  12. data/Gemfile.lock +187 -0
  13. data/LICENSE +8 -0
  14. data/README.md +409 -0
  15. data/Rakefile +106 -0
  16. data/build_rpm.sh +7 -0
  17. data/functional-tests/basic/Vagrantfile.basic_networking +34 -0
  18. data/functional-tests/basic/basic_spec.rb +15 -0
  19. data/functional-tests/networking/Vagrantfile.advanced_networking +106 -0
  20. data/functional-tests/networking/networking_spec.rb +14 -0
  21. data/functional-tests/rsync/Vagrantfile.advanced_networking +40 -0
  22. data/functional-tests/rsync/rsync_spec.rb +9 -0
  23. data/functional-tests/vmlifecycle/Vagrantfile.advanced_networking +64 -0
  24. data/functional-tests/vmlifecycle/vmlifecycle_spec.rb +25 -0
  25. data/lib/vagrant-cosmic/action/connect_cosmic.rb +47 -0
  26. data/lib/vagrant-cosmic/action/is_created.rb +18 -0
  27. data/lib/vagrant-cosmic/action/is_stopped.rb +18 -0
  28. data/lib/vagrant-cosmic/action/message_already_created.rb +16 -0
  29. data/lib/vagrant-cosmic/action/message_not_created.rb +16 -0
  30. data/lib/vagrant-cosmic/action/message_will_not_destroy.rb +16 -0
  31. data/lib/vagrant-cosmic/action/read_rdp_info.rb +42 -0
  32. data/lib/vagrant-cosmic/action/read_ssh_info.rb +70 -0
  33. data/lib/vagrant-cosmic/action/read_state.rb +38 -0
  34. data/lib/vagrant-cosmic/action/read_transport_info.rb +59 -0
  35. data/lib/vagrant-cosmic/action/read_winrm_info.rb +69 -0
  36. data/lib/vagrant-cosmic/action/run_instance.rb +819 -0
  37. data/lib/vagrant-cosmic/action/start_instance.rb +81 -0
  38. data/lib/vagrant-cosmic/action/stop_instance.rb +28 -0
  39. data/lib/vagrant-cosmic/action/terminate_instance.rb +208 -0
  40. data/lib/vagrant-cosmic/action/timed_provision.rb +21 -0
  41. data/lib/vagrant-cosmic/action/wait_for_state.rb +41 -0
  42. data/lib/vagrant-cosmic/action/warn_networks.rb +19 -0
  43. data/lib/vagrant-cosmic/action.rb +210 -0
  44. data/lib/vagrant-cosmic/capabilities/rdp.rb +12 -0
  45. data/lib/vagrant-cosmic/capabilities/winrm.rb +12 -0
  46. data/lib/vagrant-cosmic/config.rb +422 -0
  47. data/lib/vagrant-cosmic/errors.rb +27 -0
  48. data/lib/vagrant-cosmic/exceptions/exceptions.rb +15 -0
  49. data/lib/vagrant-cosmic/model/cosmic_resource.rb +51 -0
  50. data/lib/vagrant-cosmic/plugin.rb +82 -0
  51. data/lib/vagrant-cosmic/provider.rb +58 -0
  52. data/lib/vagrant-cosmic/service/cosmic_resource_service.rb +76 -0
  53. data/lib/vagrant-cosmic/util/timer.rb +17 -0
  54. data/lib/vagrant-cosmic/version.rb +5 -0
  55. data/lib/vagrant-cosmic.rb +17 -0
  56. data/locales/en.yml +131 -0
  57. data/spec/spec_helper.rb +53 -0
  58. data/spec/vagrant-cosmic/action/read_ssh_info_spec.rb +80 -0
  59. data/spec/vagrant-cosmic/action/retrieve_public_ip_port_spec.rb +94 -0
  60. data/spec/vagrant-cosmic/action/run_instance_spec.rb +573 -0
  61. data/spec/vagrant-cosmic/action/terminate_instance_spec.rb +207 -0
  62. data/spec/vagrant-cosmic/config_spec.rb +340 -0
  63. data/spec/vagrant-cosmic/model/cosmic_resource_spec.rb +95 -0
  64. data/spec/vagrant-cosmic/service/cosmic_resource_service_spec.rb +43 -0
  65. data/spec/vagrant-cosmic/support/be_a_resource.rb +6 -0
  66. data/vagrant-cosmic.gemspec +59 -0
  67. data/vagrant-cosmic.spec +42 -0
  68. metadata +218 -0
@@ -0,0 +1,76 @@
1
+ require 'vagrant-cosmic/exceptions/exceptions'
2
+
3
+ module VagrantPlugins
4
+ module Cosmic
5
+ module Service
6
+ class CosmicResourceService
7
+ include VagrantPlugins::Cosmic::Exceptions
8
+
9
+ def initialize(cosmic_compute, ui)
10
+ @cosmic_compute = cosmic_compute
11
+ @ui = ui
12
+ end
13
+
14
+ def sync_resource(resource, api_parameters = {})
15
+ @resource_details = nil
16
+ if resource.id.nil? and !(resource.name.nil? || resource.name.empty? )
17
+ resource.id = name_to_id(resource.name, resource.kind, api_parameters)
18
+ elsif resource.id
19
+ resource.name = id_to_name(resource.id, resource.kind, api_parameters)
20
+ end
21
+
22
+ unless resource.is_id_undefined? || resource.is_name_undefined?
23
+ resource.details = @resource_details
24
+ @ui.detail("Syncronized resource: #{resource}")
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def translate_from_to(resource_type, options)
31
+ if resource_type == 'public_ip_address'
32
+ pluralised_type = 'public_ip_addresses'
33
+ else
34
+ pluralised_type = "#{resource_type}s"
35
+ end
36
+
37
+ full_response = @cosmic_compute.send("list_#{pluralised_type}".to_sym, options)
38
+ full_response["list#{pluralised_type.tr('_', '')}response"][resource_type.tr('_', '')]
39
+ end
40
+
41
+ def resourcefield_to_id(resource_type, resource_field, resource_field_value, options={})
42
+ @ui.info("Fetching UUID for #{resource_type} with #{resource_field} '#{resource_field_value}'")
43
+ full_response = translate_from_to(resource_type, options)
44
+ @resource_details = full_response.find {|type| type[resource_field] == resource_field_value } if full_response
45
+ if @resource_details
46
+ @resource_details['id']
47
+ else
48
+ raise CosmicResourceNotFound.new("No UUID found for #{resource_type} with #{resource_field} '#{resource_field_value}'")
49
+ end
50
+ end
51
+
52
+ def id_to_resourcefield(resource_id, resource_type, resource_field, options={})
53
+ @ui.info("Fetching #{resource_field} for #{resource_type} with UUID '#{resource_id}'")
54
+ options = options.merge({'id' => resource_id})
55
+ begin
56
+ full_response = translate_from_to(resource_type, options)
57
+ rescue Fog::Cosmic::Compute::BadRequest => e
58
+ raise CosmicResourceNotFound.new("No Name found for #{resource_type} with UUID '#{resource_id}', #{e.class.to_s} reports:\n #{e.message}")
59
+ end
60
+ @resource_details = full_response[0]
61
+ @resource_details[resource_field]
62
+ end
63
+
64
+ def name_to_id(resource_name, resource_type, options={})
65
+ resource_field = resource_type == 'public_ip_address' ? 'ipaddress' : 'name'
66
+ resourcefield_to_id(resource_type, resource_field, resource_name, options)
67
+ end
68
+
69
+ def id_to_name(resource_id, resource_type, options={})
70
+ resource_field = resource_type == 'public_ip_address' ? 'ipaddress' : 'name'
71
+ id_to_resourcefield(resource_id, resource_type, resource_field, options)
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,17 @@
1
+ module VagrantPlugins
2
+ module Cosmic
3
+ module Util
4
+ class Timer
5
+ # A basic utility method that times the execution of the given
6
+ # block and returns it.
7
+ def self.time
8
+ start_time = Time.now.to_f
9
+ yield
10
+ end_time = Time.now.to_f
11
+
12
+ end_time - start_time
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module Cosmic
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ require "pathname"
2
+ require "vagrant-cosmic/plugin"
3
+
4
+ module VagrantPlugins
5
+ module Cosmic
6
+ lib_path = Pathname.new(File.expand_path("../vagrant-cosmic", __FILE__))
7
+ autoload :Action, lib_path.join("action")
8
+ autoload :Errors, lib_path.join("errors")
9
+
10
+ # This returns the path to the source of this plugin.
11
+ #
12
+ # @return [Pathname]
13
+ def self.source_root
14
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
15
+ end
16
+ end
17
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,131 @@
1
+ en:
2
+ vagrant_cosmic:
3
+ already_status: |-
4
+ The machine is already %{status}.
5
+ basic_network: |-
6
+ Network name or id defined but zone %{zone_name} is of network type 'Basic'
7
+ Network name or id will be ignored
8
+ launching_instance: |-
9
+ Launching an instance with the following settings...
10
+ launch_no_keypair_no_sshkey: |-
11
+ No keypair or ssh_key specified to launch your instance with.
12
+ Generating a temporary keypair for this instance...
13
+ launch_vpc_warning: |-
14
+ Warning! You're launching this instance into a VPC without an
15
+ elastic IP. Please verify you're properly connected to a VPN so
16
+ you can access this machine, otherwise Vagrant will not be able
17
+ to SSH into it.
18
+ not_created: |-
19
+ Instance is not created. Please run `vagrant up` first.
20
+ ready: |-
21
+ Machine is booted and ready for use!
22
+ rsync_not_found_warning: |-
23
+ Warning! Folder sync disabled because the rsync binary is missing.
24
+ Make sure rsync is installed and the binary can be found in the PATH.
25
+ rsync_folder: |-
26
+ Rsyncing folder: %{hostpath} => %{guestpath}
27
+ security_groups_disabled: |-
28
+ Security groups defined but not supported in the zone %{zone_name}
29
+ Defined security groups will be ignored
30
+ ssh_key_pair_creating: |-
31
+ Creating an SSH keypair in Cosmic...
32
+ ssh_key_pair_removing: |-
33
+ Deleting the SSH keypair in Cosmic...
34
+ ssh_key_pair_no_success_removing: |-
35
+ Removing SSH keypair returned unsuccesful (keypair name: %{name})
36
+ starting: |-
37
+ Starting the instance...
38
+ stopping: |-
39
+ Stopping the instance...
40
+ terminating: |-
41
+ Terminating the instance...
42
+ terminateinstance_done: |-
43
+ Done removing resources
44
+ waiting_for_ready: |-
45
+ Waiting for instance to become "ready"...
46
+ waiting_for_communicator: |-
47
+ Waiting for %{communicator} to become available...
48
+ enabling_static_nat: |-
49
+ Enabling Static NAT for this instance ...
50
+ disabling_static_nat: |-
51
+ Disabling Static NAT ...
52
+ creating_port_forwarding_rule: |-
53
+ Creating a port forwarding rule for this instance ...
54
+ deleting_port_forwarding_rule: |-
55
+ Deleting the port forwarding rule ...
56
+ deleting_volumes: |-
57
+ Deleting additional volumes ...
58
+ delete_volume_failed: |-
59
+ -- Failed to delete volume: %{volume_id}
60
+ detach_volume_failed: |-
61
+ -- Failed to detach volume: %{message}
62
+ creating_firewall_rule: |-
63
+ Creating a firewall rule ...
64
+ deleting_firewall_rule: |-
65
+ Deleting the firewall rule ...
66
+ warn_networks: |-
67
+ Warning! The Cosmic provider doesn't support any of the Vagrant
68
+ high-level network configurations (`config.vm.network`). They
69
+ will be silently ignored.
70
+ will_not_destroy: |-
71
+ The instance '%{name}' will not be destroyed, since the confirmation
72
+ was declined.
73
+ no_instance_found : |-
74
+ No instance found, already destroyed?
75
+
76
+ config:
77
+ api_key_required: |-
78
+ An access key ID must be specified via "api_key"
79
+ template_id_required: |-
80
+ A template_id must be configured via "template_id"
81
+ secret_key_missing: |-
82
+ The specified secret key for Cosmic could not be found
83
+
84
+ errors:
85
+ fog_error: |-
86
+ There was an error talking to Cosmic. The error message is shown
87
+ below:
88
+
89
+ %{message}
90
+ instance_ready_timeout: |-
91
+ The instance never became "ready" in Cosmic. The timeout currently
92
+ set waiting for the instance to become ready is %{timeout} seconds.
93
+ Please verify that the machine properly boots. If you need more time
94
+ set the `instance_ready_timeout` configuration on the Cosmic provider.
95
+ rsync_error: |-
96
+ There was an error when attemping to rsync a share folder.
97
+ Please inspect the error message below for more info.
98
+
99
+ Host path: %{hostpath}
100
+ Guest path: %{guestpath}
101
+ Error: %{stderr}
102
+ user_data_error: |-
103
+ The base64 encoded user data length (%{userdataLength}) is greater than 2048.
104
+
105
+ states:
106
+ short_not_created: |-
107
+ not created
108
+ long_not_created: |-
109
+ The instance is not created. Run `vagrant up` to create it.
110
+
111
+ short_starting: |-
112
+ starting
113
+ long_starting: |-
114
+ The instance is starting.
115
+
116
+ short_stopped: |-
117
+ stopped
118
+ long_stopped: |-
119
+ The instance is stopped. Run `vagrant up` to start it.
120
+
121
+ short_stopping: |-
122
+ stopping
123
+ long_stopping: |-
124
+ The instance is stopping. Wait until is completely stopped to
125
+ run `vagrant up` and start it.
126
+
127
+ short_running: |-
128
+ running
129
+ long_running: |-
130
+ The instance is running. To stop this machine, you can run
131
+ `vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
@@ -0,0 +1,53 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ require 'rspec/its'
4
+ require 'i18n'
5
+
6
+ Dir["#{__dir__}/vagrant-cosmic/support/**/*.rb"].each { |f| require f }
7
+
8
+ SimpleCov.start
9
+ Coveralls.wear!
10
+
11
+ ZONE_NAME = 'Zone Name'.freeze
12
+ ZONE_ID = 'Zone UUID'.freeze
13
+ SERVICE_OFFERING_NAME = 'Service Offering Name'.freeze
14
+ SERVICE_OFFERING_ID = 'Service Offering UUID'.freeze
15
+ TEMPLATE_NAME = 'Template Name'.freeze
16
+ TEMPLATE_ID = 'Template UUID'.freeze
17
+ NETWORK_NAME = 'Network Name'.freeze
18
+ NETWORK_ID = 'Network UUID'.freeze
19
+ VPC_ID = 'VPC UUID'.freeze
20
+ DISPLAY_NAME = 'Display Name'.freeze
21
+ DISK_OFFERING_NAME = 'Disk Offering Name'.freeze
22
+ DISK_OFFERING_ID = 'Disk Offering UUID'.freeze
23
+
24
+ SERVER_ID = 'Server UUID'.freeze
25
+ NETWORK_TYPE_ADVANCED = 'Advanced'.freeze
26
+ NETWORK_TYPE_BASIC = 'Basic'.freeze
27
+ SECURITY_GROUPS_ENABLED = true
28
+ SECURITY_GROUPS_DISABLED = false
29
+ SECURITY_GROUP_ID = 'UUID of Security Group'.freeze
30
+ SECURITY_GROUP_NAME = 'Name of Security Group'.freeze
31
+ SECURITY_GROUP_DESC = 'Description of Security Group'.freeze
32
+
33
+ PF_IP_ADDRESS = 'Public IP for port forwarding'.freeze
34
+ PF_IP_ADDRESS_ID = 'UUID of Public IP for port forwarding'.freeze
35
+ PF_TRUSTED_NETWORKS = 'IP Ranges to allow public access from'.freeze
36
+ PF_RANDOM_START = 49_152
37
+ GUEST_PORT_SSH = 22
38
+ GUEST_PORT_WINRM = 5985
39
+ GUEST_PORT_RDP = 3389
40
+
41
+ COMMUNICATOR_SSH = 'VagrantPlugins::CommunicatorSSH::Communicator'.freeze
42
+ COMMUNICATOR_WINRM = 'VagrantPlugins::CommunicatorWinRM::Communicator'.freeze
43
+
44
+ SSH_GENERATED_PRIVATE_KEY = '-----BEGIN RSA PRIVATE KEY-----\nMIICWwIBA==\n-----END RSA PRIVATE KEY-----'.freeze
45
+ SSH_GENERATED_KEY_NAME = 'SSH Generated Key Name'.freeze
46
+ JOB_ID = 'UUID of a Job'.freeze
47
+ PORT_FORWARDING_RULE_ID = 'UUID of port forwarding rule'.freeze
48
+ ACL_ID = 'UUID of an ACL'.freeze
49
+ GENERATED_PASSWORD = 'Generated password'.freeze
50
+ VOLUME_ID = 'UUID of volume'.freeze
51
+
52
+ I18n.load_path << File.expand_path('../../locales/en.yml', __FILE__)
53
+ I18n.reload!
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+ require 'vagrant-cosmic/action/read_ssh_info'
3
+ require 'vagrant-cosmic/config'
4
+
5
+ describe VagrantPlugins::Cosmic::Action::ReadSSHInfo do
6
+ let(:action) { VagrantPlugins::Cosmic::Action::ReadSSHInfo.new(nil, nil) }
7
+
8
+ describe "#fetch_nic_ip_address" do
9
+ subject { action.fetch_nic_ip_address(nics, domain_config) }
10
+
11
+ let(:nics) do
12
+ [
13
+ { "networkid" => "networkid1", "networkname" => "networkname1", "ipaddress" => "127.0.0.1" },
14
+ { "networkid" => "networkid2", "networkname" => "networkname2", "ipaddress" => "127.0.0.2" },
15
+ { "networkid" => "networkid3", "networkname" => "networkname3", "ipaddress" => "127.0.0.3" },
16
+ ]
17
+ end
18
+
19
+ let(:ssh_network_id) { Vagrant::Plugin::V2::Config::UNSET_VALUE }
20
+ let(:ssh_network_name) { Vagrant::Plugin::V2::Config::UNSET_VALUE }
21
+
22
+ let(:domain_config) do
23
+ config = VagrantPlugins::Cosmic::Config.new
24
+ config.domain_config :cosmic do |cosmic|
25
+ cosmic.ssh_network_id = ssh_network_id
26
+ cosmic.ssh_network_name = ssh_network_name
27
+ end
28
+ config.finalize!
29
+ config.get_domain_config(:cosmic)
30
+ end
31
+
32
+ context "without neither ssh_network_id and ssh_network_name" do
33
+ it { should eq "127.0.0.1" }
34
+ end
35
+
36
+ context "with ssh_network_id" do
37
+ context "when exists in nics" do
38
+ let(:ssh_network_id) { "networkid2" }
39
+
40
+ it { should eq "127.0.0.2" }
41
+ end
42
+
43
+ context "when not exists in nics" do
44
+ let(:ssh_network_id) { "unknown" }
45
+
46
+ it { should eq "127.0.0.1" }
47
+ end
48
+ end
49
+
50
+ context "with ssh_network_id" do
51
+ context "when exists in nics" do
52
+ let(:ssh_network_name) { "networkname3" }
53
+
54
+ it { should eq "127.0.0.3" }
55
+ end
56
+
57
+ context "when not exists in nics" do
58
+ let(:ssh_network_name) { "unknown" }
59
+
60
+ it { should eq "127.0.0.1" }
61
+ end
62
+ end
63
+
64
+ context "with both ssh_network_id and ssh_network_name" do
65
+ context "when exists in nics" do
66
+ let(:ssh_network_id) { "networkid2" }
67
+ let(:ssh_network_name) { "networkname3" }
68
+
69
+ it { should eq "127.0.0.2" }
70
+ end
71
+
72
+ context "when not exists in nics" do
73
+ let(:ssh_network_id) { "unknown" }
74
+ let(:ssh_network_name) { "unknown" }
75
+
76
+ it { should eq "127.0.0.1" }
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,94 @@
1
+ require 'spec_helper'
2
+ require 'vagrant-cosmic/action/read_transport_info'
3
+ require 'vagrant-cosmic/config'
4
+ require 'fog/cosmic'
5
+
6
+ describe VagrantPlugins::Cosmic::Action::ReadTransportInfo do
7
+ let(:action) {VagrantPlugins::Cosmic::Action::ReadTransportInfo.new }
8
+
9
+ describe '#retrieve_public_ip_port' do
10
+ subject { action.retrieve_public_ip_port(cosmic_compute, domain_config, machine) }
11
+
12
+ let(:cosmic_compute) { double('Fog::Cosmic::Compute') }
13
+ let(:machine) { double('Vagrant::Machine')}
14
+
15
+ let(:data_dir) { double('Pathname') }
16
+ let(:pf_public_port_file) { double('Pathname') }
17
+
18
+ let(:pf_ip_address) { 'ip_address_in_config' }
19
+ let(:pf_ip_address_from_server) { 'ip_address_from_server' }
20
+ let(:pf_ip_address_id) { 'ID of ip_address_in_config' }
21
+ let(:pf_public_port) { 'public_port_in_config' }
22
+ let(:pf_public_port_from_file) { 'public_port_from_file' }
23
+
24
+ let(:domain_config) do
25
+ config = VagrantPlugins::Cosmic::Config.new
26
+ config.domain_config :cosmic do |cfg|
27
+ cfg.pf_ip_address = pf_ip_address
28
+ cfg.pf_public_port = pf_public_port
29
+ cfg.pf_ip_address_id = pf_ip_address_id
30
+ end
31
+ config.finalize!
32
+ config.get_domain_config(:cosmic)
33
+ end
34
+
35
+ context 'without both ip address and port in config' do
36
+ it 'retrieves those configured values' do
37
+ should eq [pf_ip_address, pf_public_port]
38
+ end
39
+ end
40
+
41
+ context 'port not configured' do
42
+ let(:pf_public_port) { nil }
43
+
44
+ it 'retrieves the active port stored on filesystem' do
45
+ expect(machine).to receive(:data_dir).and_return(data_dir)
46
+ expect(data_dir).to receive(:join).and_return(pf_public_port_file)
47
+ expect(pf_public_port_file).to receive(:file?).and_return(true)
48
+ expect(File).to receive(:read).and_return(pf_public_port_from_file)
49
+
50
+ expect(subject).to eq [pf_ip_address, pf_public_port_from_file]
51
+ end
52
+ end
53
+
54
+ context 'only ID of ip address specified (and public port)' do
55
+ let(:pf_ip_address) { nil }
56
+
57
+ it 'resolves, and returns, the ip address from the ID' do
58
+ response = {
59
+ 'listpublicipaddressesresponse' => {
60
+ 'count' =>1,
61
+ 'publicipaddress' =>[{
62
+ 'id' => pf_ip_address_id,
63
+ 'ipaddress' => pf_ip_address_from_server,
64
+ 'allocated' => '2016-05-06T13:58:04+0200',
65
+ 'zoneid' => 'UUID',
66
+ 'zonename' => 'Name',
67
+ 'issourcenat' =>false,
68
+ 'account' => 'Name',
69
+ 'domainid' => 'UUID',
70
+ 'domain' => 'Name',
71
+ 'forvirtualnetwork' =>true,
72
+ 'isstaticnat' =>false,
73
+ 'issystem' =>false,
74
+ 'associatednetworkid' => 'UUID',
75
+ 'associatednetworkname' => 'Name',
76
+ 'networkid' => 'UUID',
77
+ 'aclid' => 'UUID',
78
+ 'state' => 'Allocated',
79
+ 'physicalnetworkid' => 'UUID',
80
+ 'vpcid' => 'UUID',
81
+ 'tags' =>[],
82
+ 'isportable' =>false
83
+ }]
84
+ }
85
+ }
86
+ expect(cosmic_compute).to receive(:list_public_ip_addresses)
87
+ .with(:id => pf_ip_address_id)
88
+ .and_return(response)
89
+
90
+ expect(subject).to eq [pf_ip_address_from_server, pf_public_port]
91
+ end
92
+ end
93
+ end
94
+ end