class VagrantPlugins::Openstack::NeutronClient
Public Class Methods
new()
click to toggle source
# File lib/vagrant-openstack-provider/client/neutron.rb, line 14 def initialize @logger = Log4r::Logger.new('vagrant_openstack::neutron') @session = VagrantPlugins::Openstack.session end
Public Instance Methods
get_all_networks(env)
click to toggle source
# File lib/vagrant-openstack-provider/client/neutron.rb, line 23 def get_all_networks(env) get_networks(env, true) end
get_private_networks(env)
click to toggle source
# File lib/vagrant-openstack-provider/client/neutron.rb, line 19 def get_private_networks(env) get_networks(env, false) end
get_subnets(env)
click to toggle source
# File lib/vagrant-openstack-provider/client/neutron.rb, line 27 def get_subnets(env) subnets_json = get(env, "#{@session.endpoints[:network]}/subnets") subnets = [] JSON.parse(subnets_json)['subnets'].each do |n| subnets << Subnet.new(n['id'], n['name'], n['cidr'], n['enable_dhcp'], n['network_id']) end subnets end
Private Instance Methods
get_networks(env, all)
click to toggle source
# File lib/vagrant-openstack-provider/client/neutron.rb, line 38 def get_networks(env, all) networks_json = get(env, "#{@session.endpoints[:network]}/networks") networks = [] JSON.parse(networks_json)['networks'].each do |n| networks << Item.new(n['id'], n['name']) if all || n['tenant_id'].eql?(@session.project_id) end networks end