Class: Openstack::QuantumMessager::Network
- Inherits:
-
L2l3
- Object
- L2l3
- Openstack::QuantumMessager::Network
show all
- Defined in:
- lib/openstack-quantum-messager/l2l3/network.rb
Instance Attribute Summary
Attributes inherited from L2l3
#quantum_extension_url, #quantum_url
Instance Method Summary
collapse
Methods inherited from L2l3
#attachment_detail, #dhcp, #dhcp_entry, #filter_rule, #filtered_range, #firewall, #network, #port
Constructor Details
#initialize(quantum_url) ⇒ Network
Returns a new instance of Network.
5
6
7
|
# File 'lib/openstack-quantum-messager/l2l3/network.rb', line 5
def initialize(quantum_url)
@quantum_url = quantum_url
end
|
Instance Method Details
#create(name) ⇒ Object
9
10
11
12
|
# File 'lib/openstack-quantum-messager/l2l3/network.rb', line 9
def create(name)
full_url = "#{@quantum_url}/networks.json"
post_to_quantum(full_url, {"network" => {"name" => name}})
end
|
#find_or_create_by_name(network_name) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/openstack-quantum-messager/l2l3/network.rb', line 22
def find_or_create_by_name(network_name)
networks = list(:name => network_name)["networks"]
if networks.empty?
create(network_name)
end
list(:name => network_name)["networks"].last
end
|
#list(filters = {}) ⇒ Object
14
15
16
|
# File 'lib/openstack-quantum-messager/l2l3/network.rb', line 14
def list(filters={})
HTTParty.get("#{@quantum_url}/networks.json", :query => filters)
end
|
#show(id) ⇒ Object
18
19
20
|
# File 'lib/openstack-quantum-messager/l2l3/network.rb', line 18
def show(id)
HTTParty.get("#{@quantum_url}/networks/#{id}.json")
end
|