Class: Fog::Network::OpenStack::Mock
- Inherits:
-
Object
- Object
- Fog::Network::OpenStack::Mock
- Includes:
- OpenStack::Core
- Defined in:
- lib/fog/openstack/network.rb,
lib/fog/openstack/requests/network/get_port.rb,
lib/fog/openstack/requests/network/get_quota.rb,
lib/fog/openstack/requests/network/get_lb_vip.rb,
lib/fog/openstack/requests/network/get_quotas.rb,
lib/fog/openstack/requests/network/get_router.rb,
lib/fog/openstack/requests/network/get_subnet.rb,
lib/fog/openstack/requests/network/list_ports.rb,
lib/fog/openstack/requests/network/set_tenant.rb,
lib/fog/openstack/requests/network/create_port.rb,
lib/fog/openstack/requests/network/delete_port.rb,
lib/fog/openstack/requests/network/get_lb_pool.rb,
lib/fog/openstack/requests/network/get_network.rb,
lib/fog/openstack/requests/network/update_port.rb,
lib/fog/openstack/requests/network/delete_quota.rb,
lib/fog/openstack/requests/network/list_lb_vips.rb,
lib/fog/openstack/requests/network/list_routers.rb,
lib/fog/openstack/requests/network/list_subnets.rb,
lib/fog/openstack/requests/network/update_quota.rb,
lib/fog/openstack/requests/network/create_lb_vip.rb,
lib/fog/openstack/requests/network/create_router.rb,
lib/fog/openstack/requests/network/create_subnet.rb,
lib/fog/openstack/requests/network/delete_lb_vip.rb,
lib/fog/openstack/requests/network/delete_router.rb,
lib/fog/openstack/requests/network/delete_subnet.rb,
lib/fog/openstack/requests/network/get_lb_member.rb,
lib/fog/openstack/requests/network/list_lb_pools.rb,
lib/fog/openstack/requests/network/list_networks.rb,
lib/fog/openstack/requests/network/update_lb_vip.rb,
lib/fog/openstack/requests/network/update_router.rb,
lib/fog/openstack/requests/network/update_subnet.rb,
lib/fog/openstack/requests/network/create_lb_pool.rb,
lib/fog/openstack/requests/network/create_network.rb,
lib/fog/openstack/requests/network/delete_lb_pool.rb,
lib/fog/openstack/requests/network/delete_network.rb,
lib/fog/openstack/requests/network/update_lb_pool.rb,
lib/fog/openstack/requests/network/update_network.rb,
lib/fog/openstack/requests/network/get_floating_ip.rb,
lib/fog/openstack/requests/network/list_lb_members.rb,
lib/fog/openstack/requests/network/create_lb_member.rb,
lib/fog/openstack/requests/network/delete_lb_member.rb,
lib/fog/openstack/requests/network/update_lb_member.rb,
lib/fog/openstack/requests/network/get_lb_pool_stats.rb,
lib/fog/openstack/requests/network/list_floating_ips.rb,
lib/fog/openstack/requests/network/create_floating_ip.rb,
lib/fog/openstack/requests/network/delete_floating_ip.rb,
lib/fog/openstack/requests/network/get_security_group.rb,
lib/fog/openstack/requests/network/add_router_interface.rb,
lib/fog/openstack/requests/network/list_security_groups.rb,
lib/fog/openstack/requests/network/associate_floating_ip.rb,
lib/fog/openstack/requests/network/create_security_group.rb,
lib/fog/openstack/requests/network/delete_security_group.rb,
lib/fog/openstack/requests/network/get_lb_health_monitor.rb,
lib/fog/openstack/requests/network/get_security_group_rule.rb,
lib/fog/openstack/requests/network/list_lb_health_monitors.rb,
lib/fog/openstack/requests/network/remove_router_interface.rb,
lib/fog/openstack/requests/network/create_lb_health_monitor.rb,
lib/fog/openstack/requests/network/delete_lb_health_monitor.rb,
lib/fog/openstack/requests/network/disassociate_floating_ip.rb,
lib/fog/openstack/requests/network/update_lb_health_monitor.rb,
lib/fog/openstack/requests/network/list_security_group_rules.rb,
lib/fog/openstack/requests/network/create_security_group_rule.rb,
lib/fog/openstack/requests/network/delete_security_group_rule.rb,
lib/fog/openstack/requests/network/associate_lb_health_monitor.rb,
lib/fog/openstack/requests/network/disassociate_lb_health_monitor.rb
Instance Attribute Summary
Attributes included from OpenStack::Core
#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_domain_id, #openstack_domain_name, #openstack_identity_prefix, #openstack_project_domain, #openstack_project_domain_id, #openstack_user_domain, #openstack_user_domain_id
Class Method Summary collapse
Instance Method Summary collapse
- #add_router_interface(router_id, subnet_id, options = {}) ⇒ Object
- #associate_floating_ip(floating_ip_id, port_id, options = {}) ⇒ Object
- #associate_lb_health_monitor(pool_id, health_monitor_id) ⇒ Object
- #create_floating_ip(floating_network_id, options = {}) ⇒ Object
- #create_lb_health_monitor(type, delay, timeout, max_retries, options = {}) ⇒ Object
- #create_lb_member(pool_id, address, protocol_port, weight, options = {}) ⇒ Object
- #create_lb_pool(subnet_id, protocol, lb_method, options = {}) ⇒ Object
- #create_lb_vip(subnet_id, pool_id, protocol, protocol_port, options = {}) ⇒ Object
- #create_network(options = {}) ⇒ Object
- #create_port(network_id, options = {}) ⇒ Object
- #create_router(name, options = {}) ⇒ Object
- #create_security_group(options = {}) ⇒ Object
- #create_security_group_rule(security_group_id, direction, options = {}) ⇒ Object
- #create_subnet(network_id, cidr, ip_version, options = {}) ⇒ Object
- #data ⇒ Object
- #delete_floating_ip(floating_ip_id) ⇒ Object
- #delete_lb_health_monitor(health_monitor_id) ⇒ Object
- #delete_lb_member(member_id) ⇒ Object
- #delete_lb_pool(pool_id) ⇒ Object
- #delete_lb_vip(vip_id) ⇒ Object
- #delete_network(network_id) ⇒ Object
- #delete_port(port_id) ⇒ Object
- #delete_quota(tenant_id) ⇒ Object
- #delete_router(router_id) ⇒ Object
- #delete_security_group(security_group_id) ⇒ Object
- #delete_security_group_rule(security_group_rule_id) ⇒ Object
- #delete_subnet(subnet_id) ⇒ Object
- #disassociate_floating_ip(floating_ip_id, options = {}) ⇒ Object
- #disassociate_lb_health_monitor(pool_id, health_monitor_id) ⇒ Object
- #get_floating_ip(floating_ip_id) ⇒ Object
- #get_lb_health_monitor(health_monitor_id) ⇒ Object
- #get_lb_member(member_id) ⇒ Object
- #get_lb_pool(pool_id) ⇒ Object
- #get_lb_pool_stats(pool_id) ⇒ Object
- #get_lb_vip(vip_id) ⇒ Object
- #get_network(network_id) ⇒ Object
- #get_port(port_id) ⇒ Object
- #get_quota(tenant_id) ⇒ Object
- #get_quotas ⇒ Object
- #get_router(router_id) ⇒ Object
- #get_security_group(security_group_id) ⇒ Object
- #get_security_group_rule(security_group_rule_id) ⇒ Object
- #get_subnet(subnet_id) ⇒ Object
-
#initialize(options = {}) ⇒ Mock
constructor
A new instance of Mock.
- #list_floating_ips(filters = {}) ⇒ Object
- #list_lb_health_monitors(filters = {}) ⇒ Object
- #list_lb_members(filters = {}) ⇒ Object
- #list_lb_pools(filters = {}) ⇒ Object
- #list_lb_vips(filters = {}) ⇒ Object
- #list_networks(filters = {}) ⇒ Object
- #list_ports(filters = {}) ⇒ Object
- #list_routers(filters = {}) ⇒ Object
- #list_security_group_rules(options = {}) ⇒ Object
- #list_security_groups(options = {}) ⇒ Object
- #list_subnets(filters = {}) ⇒ Object
- #remove_router_interface(router_id, subnet_id, options = {}) ⇒ Object
- #reset_data ⇒ Object
- #set_tenant(tenant) ⇒ Object
- #update_lb_health_monitor(health_monitor_id, options = {}) ⇒ Object
- #update_lb_member(member_id, options = {}) ⇒ Object
- #update_lb_pool(pool_id, options = {}) ⇒ Object
- #update_lb_vip(vip_id, options = {}) ⇒ Object
- #update_network(network_id, options = {}) ⇒ Object
- #update_port(port_id, options = {}) ⇒ Object
- #update_quota(tenant_id, options = {}) ⇒ Object
- #update_router(router_id, options = {}) ⇒ Object
- #update_subnet(subnet_id, options = {}) ⇒ Object
Methods included from OpenStack::Core
#credentials, #initialize_identity, #reload
Constructor Details
Class Method Details
.data ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/fog/openstack/network.rb', line 141 def self.data @data ||= Hash.new do |hash, key| network_id = Fog::UUID.uuid subnet_id = Fog::UUID.uuid tenant_id = Fog::Mock.random_hex(8) hash[key] = { :networks => { network_id => { 'id' => network_id, 'name' => 'Public', 'subnets' => [subnet_id], 'shared' => true, 'status' => 'ACTIVE', 'tenant_id' => tenant_id, 'provider_network_type' => 'vlan', 'router:external' => false, 'admin_state_up' => true, } }, :ports => {}, :subnets => { subnet_id => { 'id' => subnet_id, 'name' => "Public", 'network_id' => network_id, 'cidr' => "192.168.0.0/22", 'ip_version' => 4, 'gateway_ip' => Fog::Mock.random_ip, 'allocation_pools' => [], 'dns_nameservers' => [Fog::Mock.random_ip, Fog::Mock.random_ip], 'host_routes' => [Fog::Mock.random_ip], 'enable_dhcp' => true, 'tenant_id' => tenant_id, } }, :floating_ips => {}, :routers => {}, :lb_pools => {}, :lb_members => {}, :lb_health_monitors => {}, :lb_vips => {}, :quota => { "subnet" => 10, "router" => 10, "port" => 50, "network" => 10, "floatingip" => 50 }, :quotas => [ { "subnet" => 10, "network" => 10, "floatingip" => 50, "tenant_id" => tenant_id, "router" => 10, "port" => 30 } ], :security_groups => {}, :security_group_rules => {}, } end end |
.reset ⇒ Object
206 207 208 |
# File 'lib/fog/openstack/network.rb', line 206 def self.reset @data = nil end |
Instance Method Details
#add_router_interface(router_id, subnet_id, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fog/openstack/requests/network/add_router_interface.rb', line 28 def add_router_interface(router_id, subnet_id, = {}) response = Excon::Response.new response.status = 201 data = { 'status' => 'ACTIVE', 'name' => '', 'admin_state_up' => true, 'network_id' => '5307648b-e836-4658-8f1a-ff7536870c64', 'tenant_id' => '6b96ff0cb17a4b859e1e575d221683d3', 'device_owner' => 'network:router_interface', 'mac_address' => 'fa:16:3e:f7:d1:9c', 'fixed_ips' => { 'subnet_id' => 'a2f1f29d-571b-4533-907f-5803ab96ead1', 'ip_address' => '10.1.1.1' }, 'id' => '3a44f4e5-1694-493a-a1fb-393881c673a4', 'device_id' => '7177abc4-5ae9-4bb7-b0d4-89e94a4abf3b' } self.data[:routers][data['router_id']] = data response.body = { 'router' => data } response end |
#associate_floating_ip(floating_ip_id, port_id, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/openstack/requests/network/associate_floating_ip.rb', line 27 def associate_floating_ip(floating_ip_id, port_id, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => '00000000-0000-0000-0000-000000000000', 'router_id' => '00000000-0000-0000-0000-000000000000', 'tenant_id' => ["tenant_id"], 'floating_network_id' => ["floating_network_id"], 'fixed_ip_address' => ["fixed_ip_address"], 'floating_ip_address' => ["floating_ip_address"], 'port_id' => port_id, } self.data[:floating_ips][data['floating_ip_id']] = data response.body = { 'floatingip' => data } response end |
#associate_lb_health_monitor(pool_id, health_monitor_id) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/openstack/requests/network/associate_lb_health_monitor.rb', line 22 def associate_lb_health_monitor(pool_id, health_monitor_id) response = Excon::Response.new if pool = list_lb_pools.body['pools'].find { |_| _['id'] == pool_id } pool['health_monitors'] << health_monitor_id self.data[:lb_pools][pool_id] = pool response.body = { 'health_monitor' => {} } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |
#create_floating_ip(floating_network_id, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/openstack/requests/network/create_floating_ip.rb', line 27 def create_floating_ip(floating_network_id, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => floating_network_id, 'floating_network_id' => floating_network_id, 'port_id' => [:port_id], 'tenant_id' => [:tenant_id], 'fixed_ip_address' => [:fixed_ip_address], 'router_id' => nil, } self.data[:floating_ips][data['id']] = data response.body = { 'floatingip' => data } response end |
#create_lb_health_monitor(type, delay, timeout, max_retries, options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fog/openstack/requests/network/create_lb_health_monitor.rb', line 30 def create_lb_health_monitor(type, delay, timeout, max_retries, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'type' => type, 'delay' => delay, 'timeout' => timeout, 'max_retries' => max_retries, 'http_method' => [:http_method], 'url_path' => [:url_path], 'expected_codes' => [:expected_codes], 'status' => 'ACTIVE', 'admin_state_up' => [:admin_state_up], 'tenant_id' => [:tenant_id], } self.data[:lb_health_monitors][data['id']] = data response.body = { 'health_monitor' => data } response end |
#create_lb_member(pool_id, address, protocol_port, weight, options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fog/openstack/requests/network/create_lb_member.rb', line 30 def create_lb_member(pool_id, address, protocol_port, weight, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'pool_id' => pool_id, 'address' => address, 'protocol_port' => protocol_port, 'weight' => weight, 'status' => 'ACTIVE', 'admin_state_up' => [:admin_state_up], 'tenant_id' => [:tenant_id], } self.data[:lb_members][data['id']] = data response.body = { 'member' => data } response end |
#create_lb_pool(subnet_id, protocol, lb_method, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fog/openstack/requests/network/create_lb_pool.rb', line 29 def create_lb_pool(subnet_id, protocol, lb_method, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'subnet_id' => subnet_id, 'protocol' => protocol, 'lb_method' => lb_method, 'name' => [:name], 'description' => [:description], 'health_monitors' => [], 'members' => [], 'status' => 'ACTIVE', 'admin_state_up' => [:admin_state_up], 'vip_id' => nil, 'tenant_id' => [:tenant_id], 'active_connections' => nil, 'bytes_in' => nil, 'bytes_out' => nil, 'total_connections' => nil } self.data[:lb_pools][data['id']] = data response.body = { 'pool' => data } response end |
#create_lb_vip(subnet_id, pool_id, protocol, protocol_port, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fog/openstack/requests/network/create_lb_vip.rb', line 31 def create_lb_vip(subnet_id, pool_id, protocol, protocol_port, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'subnet_id' => subnet_id, 'pool_id' => pool_id, 'protocol' => protocol, 'protocol_port' => protocol_port, 'name' => [:name], 'description' => [:description], 'address' => [:address], 'port_id' => Fog::Mock.random_numbers(6).to_s, 'session_persistence' => [:session_persistence], 'connection_limit' => [:connection_limit], 'status' => 'ACTIVE', 'admin_state_up' => [:admin_state_up], 'tenant_id' => [:tenant_id], } self.data[:lb_vips][data['id']] = data response.body = { 'vip' => data } response end |
#create_network(options = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/fog/openstack/requests/network/create_network.rb', line 57 def create_network( = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'name' => [:name], 'shared' => [:shared], 'subnets' => [], 'status' => 'ACTIVE', 'admin_state_up' => [:admin_state_up], 'tenant_id' => [:tenant_id], } # Add provider specific attributes when found # = [ :router_external, :provider_network_type, :provider_segmentation_id, :provider_physical_network ] aliases = { :provider_network_type => 'provider:network_type', # Not applicable to the "local" or "gre" network types :provider_physical_network => 'provider:physical_network', :provider_segmentation_id => 'provider:segmentation_id', :router_external => 'router:external' } .reject{ |o| [o].nil? }.each do |key| aliased_key = aliases[key] || key data[aliased_key] = [key] end self.data[:networks][data['id']] = data response.body = { 'network' => data } response end |
#create_port(network_id, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fog/openstack/requests/network/create_port.rb', line 29 def create_port(network_id, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'name' => [:name], 'network_id' => network_id, 'fixed_ips' => [:fixed_ips], 'mac_address' => [:mac_address], 'status' => 'ACTIVE', 'admin_state_up' => [:admin_state_up], 'device_owner' => [:device_owner], 'device_id' => [:device_id], 'tenant_id' => [:tenant_id], 'security_groups' => [:security_groups], 'allowed_address_pairs' => [:allowed_address_pairs], } self.data[:ports][data['id']] = data response.body = { 'port' => data } response end |
#create_router(name, options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fog/openstack/requests/network/create_router.rb', line 47 def create_router(name, = {}) response = Excon::Response.new response.status = 201 # remove this in a future egi = [:external_gateway_info] if egi && egi.is_a?(Fog::Network::OpenStack::Network) Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \ Please pass external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]" egi = { :network_id => egi.id } end data = { 'router' => { :id => Fog::Mock.random_numbers(6).to_s, :status => [:status] || 'ACTIVE', :external_gateway_info => egi, :name => name, :admin_state_up => [:admin_state_up], :tenant_id => '6b96ff0cb17a4b859e1e575d221683d3' } } self.data[:routers][data['router'][:id]] = data['router'] response.body = data response end |
#create_security_group(options = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/fog/openstack/requests/network/create_security_group.rb', line 48 def create_security_group( = {}) # Spaces are NOT removed from name and description, as in case of compute sec groups tenant_id = Fog::Mock.random_numbers(14).to_s sec_group_id = Fog::UUID.uuid response = Excon::Response.new response.status = 201 # by default every security group will come setup with an egress rule to "allow all out" data = { "security_group_rules" => [ { "remote_group_id" => nil, "direction" => "egress", "remote_ip_prefix" => nil, "protocol" => nil, "ethertype" => "IPv4", "tenant_id" => tenant_id, "port_range_max" => nil, "port_range_min" => nil, "id" => Fog::UUID.uuid, "security_group_id" => sec_group_id }, { "remote_group_id" => nil, "direction" => "egress", "remote_ip_prefix" => nil, "protocol" => nil, "ethertype" => "IPv6", "tenant_id" => tenant_id, "port_range_max" => nil, "port_range_min" => nil, "id" => Fog::UUID.uuid, "security_group_id" => sec_group_id } ], "id" => sec_group_id, "tenant_id" => tenant_id, "name" => [:name] || "", "description" => [:description] || "" } self.data[:security_groups][data["id"]] = data response.body = {"security_group" => data} response end |
#create_security_group_rule(security_group_id, direction, options = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fog/openstack/requests/network/create_security_group_rule.rb', line 57 def create_security_group_rule(security_group_id, direction, = {}) response = Excon::Response.new data = { "id" => Fog::UUID.uuid, "remote_group_id" => [:remote_group_id], "direction" => direction, "remote_ip_prefix" => [:remote_ip_prefix], "protocol" => [:protocol], "ethertype" => [:ethertype] || "IPv4", "tenant_id" => [:tenant_id] || Fog::Mock.random_numbers(14).to_s, "port_range_max" => [:port_range_max], "port_range_min" => [:port_range_min], "security_group_id" => security_group_id } self.data[:security_group_rules][data["id"]] = data response.status = 201 response.body = {"security_group_rule" => data} response end |
#create_subnet(network_id, cidr, ip_version, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fog/openstack/requests/network/create_subnet.rb', line 31 def create_subnet(network_id, cidr, ip_version, = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'name' => [:name], 'network_id' => network_id, 'cidr' => cidr, 'ip_version' => ip_version, 'gateway_ip' => [:gateway_ip], 'allocation_pools' => [:allocation_pools], 'dns_nameservers' => [:dns_nameservers], 'host_routes' => [:host_routes], 'enable_dhcp' => [:enable_dhcp], 'tenant_id' => [:tenant_id] } self.data[:subnets][data['id']] = data response.body = { 'subnet' => data } response end |
#data ⇒ Object
219 220 221 |
# File 'lib/fog/openstack/network.rb', line 219 def data self.class.data["#{@openstack_username}-#{@openstack_tenant}"] end |
#delete_floating_ip(floating_ip_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_floating_ip.rb', line 15 def delete_floating_ip(floating_ip_id) response = Excon::Response.new if list_floating_ips.body['floatingips'].map { |r| r['id'] }.include? floating_ip_id self.data[:floating_ips].delete(floating_ip_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_lb_health_monitor(health_monitor_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_lb_health_monitor.rb', line 15 def delete_lb_health_monitor(health_monitor_id) response = Excon::Response.new if list_lb_health_monitors.body['health_monitors'].map { |r| r['id'] }.include? health_monitor_id self.data[:lb_health_monitors].delete(health_monitor_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_lb_member(member_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_lb_member.rb', line 15 def delete_lb_member(member_id) response = Excon::Response.new if list_lb_members.body['members'].map { |r| r['id'] }.include? member_id self.data[:lb_members].delete(member_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_lb_pool(pool_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_lb_pool.rb', line 15 def delete_lb_pool(pool_id) response = Excon::Response.new if list_lb_pools.body['pools'].map { |r| r['id'] }.include? pool_id self.data[:lb_pools].delete(pool_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_lb_vip(vip_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_lb_vip.rb', line 15 def delete_lb_vip(vip_id) response = Excon::Response.new if list_lb_vips.body['vips'].map { |r| r['id'] }.include? vip_id self.data[:lb_vips].delete(vip_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_network(network_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_network.rb', line 15 def delete_network(network_id) response = Excon::Response.new if list_networks.body['networks'].map { |r| r['id'] }.include? network_id self.data[:networks].delete(network_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_port(port_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_port.rb', line 15 def delete_port(port_id) response = Excon::Response.new if list_ports.body['ports'].map { |r| r['id'] }.include? port_id self.data[:ports].delete(port_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_quota(tenant_id) ⇒ Object
15 16 17 18 19 |
# File 'lib/fog/openstack/requests/network/delete_quota.rb', line 15 def delete_quota(tenant_id) response = Excon::Response.new response.status = 204 response end |
#delete_router(router_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_router.rb', line 15 def delete_router(router_id) response = Excon::Response.new if list_routers.body['routers'].find { |r| r[:id] == router_id } self.data[:routers].delete(router_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_security_group(security_group_id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/openstack/requests/network/delete_security_group.rb', line 19 def delete_security_group(security_group_id) response = Excon::Response.new if self.data[:security_groups][security_group_id] self.data[:security_groups].delete(security_group_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_security_group_rule(security_group_rule_id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/openstack/requests/network/delete_security_group_rule.rb', line 19 def delete_security_group_rule(security_group_rule_id) response = Excon::Response.new if self.data[:security_group_rules][security_group_rule_id] self.data[:security_group_rules].delete(security_group_rule_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#delete_subnet(subnet_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/delete_subnet.rb', line 15 def delete_subnet(subnet_id) response = Excon::Response.new if list_subnets.body['subnets'].map { |r| r['id'] }.include? subnet_id self.data[:subnets].delete(subnet_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#disassociate_floating_ip(floating_ip_id, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/openstack/requests/network/disassociate_floating_ip.rb', line 27 def disassociate_floating_ip(floating_ip_id, = {}) response = Excon::Response.new response.status = 200 data = { 'id' => '00000000-0000-0000-0000-000000000000', 'router_id' => nil, 'tenant_id' => ["tenant_id"], 'floating_network_id' => ["floating_network_id"], 'fixed_ip_address' => nil, 'floating_ip_address' => ["floating_ip_address"], 'port_id' => ["port_id"], } self.data[:floating_ips][data['floating_ip_id']] = data response.body = { 'floatingip' => data } response end |
#disassociate_lb_health_monitor(pool_id, health_monitor_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fog/openstack/requests/network/disassociate_lb_health_monitor.rb', line 15 def disassociate_lb_health_monitor(pool_id, health_monitor_id) response = Excon::Response.new if pool = list_lb_pools.body['pools'].find { |_| _['id'] == pool_id } pool['health_monitors'].delete(health_monitor_id) self.data[:lb_pools][pool_id] = pool response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end |
#get_floating_ip(floating_ip_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/openstack/requests/network/get_floating_ip.rb', line 15 def get_floating_ip(floating_ip_id) response = Excon::Response.new if data = self.data[:floating_ips][floating_ip_id] response.status = 200 response.body = { "floatingip" => { "id" => "00000000-0000-0000-0000-000000000000", # changed # "floating_ip_id" => floating_ip_id, "port_id" => data["port_id"], "tenant_id" => data["tenant_id"], "fixed_ip_address" => data["fixed_ip_address"], "router_id" => "00000000-0000-0000-0000-000000000000", "floating_ip_address" => data["floating_ip_address"], } } response else raise Fog::Network::OpenStack::NotFound end end |
#get_lb_health_monitor(health_monitor_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/get_lb_health_monitor.rb', line 15 def get_lb_health_monitor(health_monitor_id) response = Excon::Response.new if data = self.data[:lb_health_monitors][health_monitor_id] response.status = 200 response.body = { 'health_monitor' => data } response else raise Fog::Network::OpenStack::NotFound end end |
#get_lb_member(member_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/get_lb_member.rb', line 15 def get_lb_member(member_id) response = Excon::Response.new if data = self.data[:lb_members][member_id] response.status = 200 response.body = { 'member' => data } response else raise Fog::Network::OpenStack::NotFound end end |
#get_lb_pool(pool_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/get_lb_pool.rb', line 15 def get_lb_pool(pool_id) response = Excon::Response.new if data = self.data[:lb_pools][pool_id] response.status = 200 response.body = { 'pool' => data } response else raise Fog::Network::OpenStack::NotFound end end |
#get_lb_pool_stats(pool_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/openstack/requests/network/get_lb_pool_stats.rb', line 15 def get_lb_pool_stats(pool_id) response = Excon::Response.new if data = self.data[:lb_pools][pool_id] stats = {} stats["active_connections"] = 0 stats["bytes_in"] = 0 stats["bytes_out"] = 0 stats["total_connections"] = 0 response.status = 200 response.body = { 'stats' => stats } response else raise Fog::Network::OpenStack::NotFound end end |
#get_lb_vip(vip_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/requests/network/get_lb_vip.rb', line 15 def get_lb_vip(vip_id) response = Excon::Response.new if data = self.data[:lb_vips][vip_id] response.status = 200 response.body = { 'vip' => data } response else raise Fog::Network::OpenStack::NotFound end end |
#get_network(network_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fog/openstack/requests/network/get_network.rb', line 15 def get_network(network_id) response = Excon::Response.new if data = self.data[:networks][network_id] response.status = 200 response.body = { 'network' => { 'id' => 'e624a36d-762b-481f-9b50-4154ceb78bbb', 'name' => 'network_1', 'subnets' => [ '2e4ec6a4-0150-47f5-8523-e899ac03026e' ], 'shared' => false, 'status' => 'ACTIVE', 'admin_state_up' => true, 'tenant_id' => 'f8b26a6032bc47718a7702233ac708b9', } } response else raise Fog::Network::OpenStack::NotFound end end |
#get_port(port_id) ⇒ Object
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 46 47 |
# File 'lib/fog/openstack/requests/network/get_port.rb', line 15 def get_port(port_id) response = Excon::Response.new if data = self.data[:ports][port_id] response.status = 200 response.body = { 'port' => { 'id' => '5c81d975-5fea-4674-9c1f-b8aa10bf9a79', 'name' => 'port_1', 'network_id' => 'e624a36d-762b-481f-9b50-4154ceb78bbb', 'fixed_ips' => [ { 'ip_address' => '10.2.2.2', 'subnet_id' => '2e4ec6a4-0150-47f5-8523-e899ac03026e', } ], 'mac_address' => 'fa:16:3e:62:91:7f', 'status' => 'ACTIVE', 'admin_state_up' => true, 'device_id' => 'dhcp724fc160-2b2e-597e-b9ed-7f65313cd73f-e624a36d-762b-481f-9b50-4154ceb78bbb', 'device_owner' => 'network:dhcp', 'tenant_id' => 'f8b26a6032bc47718a7702233ac708b9', 'security_groups' => ['3ddde803-e550-4737-b5de-0862401dc834'], 'allowed_address_pairs' => [ 'ip_address' => '10.1.1.1', 'mac_address' => 'fa:16:3e:3d:2a:cc' ] } } response else raise Fog::Network::OpenStack::NotFound end end |
#get_quota(tenant_id) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/fog/openstack/requests/network/get_quota.rb', line 15 def get_quota(tenant_id) response = Excon::Response.new response.status = 200 response.body = { 'quota' => (self.data[:quota_updated] or self.data[:quota]) } response end |
#get_quotas ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/fog/openstack/requests/network/get_quotas.rb', line 15 def get_quotas response = Excon::Response.new response.status = 200 response.body = { 'quotas' => self.data[:quotas] } response end |
#get_router(router_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/openstack/requests/network/get_router.rb', line 15 def get_router(router_id) response = Excon::Response.new if data = (self.data[:routers].find { |id,value| id == router_id }) response.status = 200 response.body = { 'router' => data[1], } response else raise Fog::Network::OpenStack::NotFound end end |
#get_security_group(security_group_id) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fog/openstack/requests/network/get_security_group.rb', line 39 def get_security_group(security_group_id) response = Excon::Response.new if sec_group = self.data[:security_groups][security_group_id] response.status = 200 response.body = {"security_group" => sec_group} response else raise Fog::Network::OpenStack::NotFound end end |
#get_security_group_rule(security_group_rule_id) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/openstack/requests/network/get_security_group_rule.rb', line 34 def get_security_group_rule(security_group_rule_id) response = Excon::Response.new if sec_group_rule = self.data[:security_group_rules][security_group_rule_id] response.status = 200 response.body = {"security_group_rule" => sec_group_rule} response else raise Fog::Network::OpenStack::NotFound end end |
#get_subnet(subnet_id) ⇒ Object
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 |
# File 'lib/fog/openstack/requests/network/get_subnet.rb', line 15 def get_subnet(subnet_id) response = Excon::Response.new if data = self.data[:subnets][subnet_id] response.status = 200 response.body = { "subnet" => { "id" => "2e4ec6a4-0150-47f5-8523-e899ac03026e", "name" => "subnet_1", "network_id" => "e624a36d-762b-481f-9b50-4154ceb78bbb", "cidr" => "10.2.2.0/24", "ip_version" => 4, "gateway_ip" => "10.2.2.1", "allocation_pools" => [ { "start" => "10.2.2.2", "end" => "10.2.2.254" } ], "dns_nameservers" => [], "host_routes" => [], "enable_dhcp" => true, "tenant_id" => "f8b26a6032bc47718a7702233ac708b9", } } response else raise Fog::Network::OpenStack::NotFound end end |
#list_floating_ips(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_floating_ips.rb', line 16 def list_floating_ips(filters = {}) Excon::Response.new( :body => { 'floatingips' => self.data[:floating_ips].values }, :status => 200 ) end |
#list_lb_health_monitors(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_lb_health_monitors.rb', line 16 def list_lb_health_monitors(filters = {}) Excon::Response.new( :body => { 'health_monitors' => self.data[:lb_health_monitors].values }, :status => 200 ) end |
#list_lb_members(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_lb_members.rb', line 16 def list_lb_members(filters = {}) Excon::Response.new( :body => { 'members' => self.data[:lb_members].values }, :status => 200 ) end |
#list_lb_pools(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_lb_pools.rb', line 16 def list_lb_pools(filters = {}) Excon::Response.new( :body => { 'pools' => self.data[:lb_pools].values }, :status => 200 ) end |
#list_lb_vips(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_lb_vips.rb', line 16 def list_lb_vips(filters = {}) Excon::Response.new( :body => { 'vips' => self.data[:lb_vips].values }, :status => 200 ) end |
#list_networks(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_networks.rb', line 16 def list_networks(filters = {}) Excon::Response.new( :body => { 'networks' => self.data[:networks].values }, :status => 200 ) end |
#list_ports(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_ports.rb', line 16 def list_ports(filters = {}) Excon::Response.new( :body => { 'ports' => self.data[:ports].values }, :status => 200 ) end |
#list_routers(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_routers.rb', line 16 def list_routers(filters = {}) Excon::Response.new( :body => { 'routers' => self.data[:routers].values }, :status => 200 ) end |
#list_security_group_rules(options = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fog/openstack/requests/network/list_security_group_rules.rb', line 35 def list_security_group_rules( = {}) response = Excon::Response.new sec_group_rules = [] sec_group_rules = self.data[:security_group_rules].values unless self.data[:security_group_rules].nil? response.status = 200 response.body = { 'security_group_rules' => sec_group_rules } response end |
#list_security_groups(options = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fog/openstack/requests/network/list_security_groups.rb', line 40 def list_security_groups( = {}) response = Excon::Response.new sec_groups = [] sec_groups = self.data[:security_groups].values unless self.data[:security_groups].nil? response.status = 200 response.body = { 'security_groups' => sec_groups } response end |
#list_subnets(filters = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/fog/openstack/requests/network/list_subnets.rb', line 16 def list_subnets(filters = {}) Excon::Response.new( :body => { 'subnets' => self.data[:subnets].values }, :status => 200 ) end |
#remove_router_interface(router_id, subnet_id, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/openstack/requests/network/remove_router_interface.rb', line 20 def remove_router_interface(router_id, subnet_id, = {}) response = Excon::Response.new response.status = 201 data = { 'subnet_id' => 'a2f1f29d-571b-4533-907f-5803ab96ead1' } self.data[:routers][data['router_id']] = data response.body = { 'router' => data } response end |
#reset_data ⇒ Object
223 224 225 |
# File 'lib/fog/openstack/network.rb', line 223 def reset_data self.class.data.delete("#{@openstack_username}-#{@openstack_tenant}") end |
#set_tenant(tenant) ⇒ Object
14 15 16 |
# File 'lib/fog/openstack/requests/network/set_tenant.rb', line 14 def set_tenant(tenant) true end |
#update_lb_health_monitor(health_monitor_id, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/openstack/requests/network/update_lb_health_monitor.rb', line 23 def update_lb_health_monitor(health_monitor_id, = {}) response = Excon::Response.new if health_monitor = list_lb_health_monitors.body['health_monitors'].find { |_| _['id'] == health_monitor_id } health_monitor['delay'] = [:delay] health_monitor['timeout'] = [:timeout] health_monitor['max_retries'] = [:max_retries] health_monitor['http_method'] = [:http_method] health_monitor['url_path'] = [:url_path] health_monitor['expected_codes'] = [:expected_codes] health_monitor['admin_state_up'] = [:admin_state_up] response.body = { 'health_monitor' => health_monitor } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |
#update_lb_member(member_id, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/openstack/requests/network/update_lb_member.rb', line 23 def update_lb_member(member_id, = {}) response = Excon::Response.new if member = list_lb_members.body['members'].find { |_| _['id'] == member_id } member['pool_id'] = [:pool_id] member['weight'] = [:weight] member['admin_state_up'] = [:admin_state_up] response.body = { 'member' => member } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |
#update_lb_pool(pool_id, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fog/openstack/requests/network/update_lb_pool.rb', line 23 def update_lb_pool(pool_id, = {}) response = Excon::Response.new if pool = list_lb_pools.body['pools'].find { |_| _['id'] == pool_id } pool['name'] = [:name] pool['description'] = [:description] pool['lb_method'] = [:lb_method] pool['admin_state_up'] = [:admin_state_up] response.body = { 'pool' => pool } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |
#update_lb_vip(vip_id, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fog/openstack/requests/network/update_lb_vip.rb', line 23 def update_lb_vip(vip_id, = {}) response = Excon::Response.new if vip = list_lb_vips.body['vips'].find { |_| _['id'] == vip_id } vip['pool_id'] = [:pool_id] vip['name'] = [:name] vip['description'] = [:description] vip['session_persistence'] = [:session_persistence] vip['connection_limit'] = [:connection_limit] vip['admin_state_up'] = [:admin_state_up] response.body = { 'vip' => vip } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |
#update_network(network_id, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/openstack/requests/network/update_network.rb', line 23 def update_network(network_id, = {}) response = Excon::Response.new if network = list_networks.body['networks'].find { |_| _['id'] == network_id } network['name'] = [:name] network['shared'] = [:shared] network['admin_state_up'] = [:admin_state_up] response.body = { 'network' => network } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |
#update_port(port_id, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/openstack/requests/network/update_port.rb', line 24 def update_port(port_id, = {}) response = Excon::Response.new if port = list_ports.body['ports'].find { |_| _['id'] == port_id } port['name'] = [:name] port['fixed_ips'] = [:fixed_ips] || [] port['admin_state_up'] = [:admin_state_up] port['device_owner'] = [:device_owner] port['device_id'] = [:device_id] port['security_groups'] = [:security_groups] || [] response.body = { 'port' => port } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |
#update_quota(tenant_id, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/fog/openstack/requests/network/update_quota.rb', line 16 def update_quota(tenant_id, = {}) self.data[:quota_updated] = self.data[:quota].merge response = Excon::Response.new response.status = 200 response.body = { 'quota' => self.data[:quota_updated] } response end |
#update_router(router_id, options = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fog/openstack/requests/network/update_router.rb', line 42 def update_router(router_id, = {}) response = Excon::Response.new router = list_routers.body['routers'].find {|r| r[:id] == router_id} raise Fog::Network::OpenStack::NotFound unless router .keys.each {|k| router[k] = [k] } # remove this in a future egi = [:external_gateway_info] if egi if egi.is_a?(Fog::Network::OpenStack::Network) Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \ Please pass external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]" router[:external_gateway_info] = { :network_id => egi.id } else egi.is_a?(Hash) && egi[:network_id] router[:external_gateway_info] = egi end end response.body = { 'router' => router } response.status = 200 response end |
#update_subnet(subnet_id, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/openstack/requests/network/update_subnet.rb', line 24 def update_subnet(subnet_id, = {}) response = Excon::Response.new if subnet = list_subnets.body['subnets'].find { |_| _['id'] == subnet_id } subnet['name'] = [:name] subnet['gateway_ip'] = [:gateway_ip] subnet['dns_nameservers'] = [:dns_nameservers] || [] subnet['host_routes'] = [:host_routes] || [] subnet['allocation_pools'] = [:allocation_pools] || [] subnet['enable_dhcp'] = [:enable_dhcp] response.body = { 'subnet' => subnet } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end |