lib/network.rb in forj-0.0.18 vs lib/network.rb in forj-0.0.19
- old
+ new
@@ -20,20 +20,20 @@
include Connection
module Network
def create_network(name)
- network = Connection.network.networks.create(:name => name)
+ Connection.network.networks.create(:name => name)
end
def delete_network(network_name)
network = Connection.network.networks.all(:name => network_name)[0]
Connection.network.networks.get(network.id).destroy
end
def create_subnet(network_id, name)
- subnet = Connection.network.subnets.create(
+ Connection.network.subnets.create(
:network_id => network_id,
:name => name,
:cidr => get_next_subnet,
:ip_version => '4'
)
@@ -42,31 +42,33 @@
def delete_subnet(subnet_id)
Connection.network.subnets.get(subnet_id).destroy
end
def get_subnet(name)
- subnet = Connection.network.subnets.all(:name => name)[0]
+ Connection.network.subnets.all(:name => name)[0]
end
def get_router(name)
routers = Connection.network.routers.all({:name => name})
router = nil
- for r in routers do
+
+ routers.each do|r|
router = r
end
+
router
end
def create_router_interface(subnet_id, router)
- interface = router.add_interface(subnet_id, nil)
+ router.add_interface(subnet_id, nil)
end
def delete_router_interface(subnet_id, router)
router.remove_interface(subnet_id)
end
def create_router(name)
- router = Connection.network.routers.create(
+ Connection.network.routers.create(
:name => name,
:admin_state_up => true
)
end
\ No newline at end of file