class Openstack::QuantumClient::Port

Public Class Methods

new(quantum_url) click to toggle source
# File lib/openstack-quantum-client/l2l3/port.rb, line 4
def initialize(quantum_url)
  @quantum_url = quantum_url
end

Public Instance Methods

create(network_id) click to toggle source
# File lib/openstack-quantum-client/l2l3/port.rb, line 8
def create(network_id)
  full_url = "#{@quantum_url}/networks/#{network_id}/ports.json"
  post_to_quantum(full_url, nil)
end
delete(network_id, id) click to toggle source
# File lib/openstack-quantum-client/l2l3/port.rb, line 25
def delete(network_id, id)
  HTTParty.delete("#{@quantum_url}/networks/#{network_id}/ports/#{id}.json")
end
list(network_id, filters={}) click to toggle source
# File lib/openstack-quantum-client/l2l3/port.rb, line 29
def list(network_id, filters={})
  HTTParty.get("#{@quantum_url}/networks/#{network_id}/ports.json", :query => filters)
end
plug(network_id, id, interface_id) click to toggle source
# File lib/openstack-quantum-client/l2l3/port.rb, line 13
def plug(network_id, id, interface_id)
  full_url = "#{@quantum_url}/networks/#{network_id}/ports/#{id}/attachment.json"
  response = put_to_quantum(full_url, {"attachment" => {"id" => interface_id}})
  response.code < 300
end
unplug(network_id, id) click to toggle source
# File lib/openstack-quantum-client/l2l3/port.rb, line 19
def unplug(network_id, id)
  full_url = "#{@quantum_url}/networks/#{network_id}/ports/#{id}/attachment.json"
  response = HTTParty.delete(full_url)
  response.code < 300
end