From 755948b90913c0562f710dcc6de94a5aa343eca2 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 22 Dec 2016 15:46:44 +0100 Subject: [PATCH] Fixes for various update fednet bugs --- README.md | 4 ++-- client/examples/tenant.json | 10 +++++----- controllers/federatedsdn-server.rb | 2 +- models/fednet_pool.rb | 4 ++-- models/tenant_pool.rb | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 85e93be..0413d7b 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,11 @@ $ bundle install The server can be invoked using the bin/federatedsdn-server script. Before the first execution check config/federatedsdn-server.conf to adjust configuration. -$ bin/federatedsdn-server start +$ cd bin && ./federatedsdn-server start And stopped: -$ bin/federatedsdn-server stop +$ cd bin && ./federatedsdn-server stop ## Client Tools diff --git a/client/examples/tenant.json b/client/examples/tenant.json index 03b42d2..5acb378 100644 --- a/client/examples/tenant.json +++ b/client/examples/tenant.json @@ -2,10 +2,10 @@ "password": "secret", "type": "user", "valid_sites": [ - { - "site_id" : "1", - "user_id_in_site": "0", - "credentials": "oneadmin:opennebula" - } + { + "site_id" : "1", + "user_id_in_site": "0", + "credentials": "oneadmin:opennebula" + } ] } diff --git a/controllers/federatedsdn-server.rb b/controllers/federatedsdn-server.rb index f77cd0e..98b5fb5 100644 --- a/controllers/federatedsdn-server.rb +++ b/controllers/federatedsdn-server.rb @@ -196,7 +196,7 @@ def is_admin st, result = fednet_pool.update(params[:id], @username, is_admin, - Parser.parse_body(request)[0]) + Parser.parse_body(request)) build_response(st, result) end diff --git a/models/fednet_pool.rb b/models/fednet_pool.rb index ffd3e33..a950d37 100644 --- a/models/fednet_pool.rb +++ b/models/fednet_pool.rb @@ -123,8 +123,8 @@ def update(id, username, is_admin, new_fednet) net_array_element = Hash.new net_array_element[:name] = ns[:name] net_array_element[:vnid] = ns[:cmp_net_id] - net_array_element[:site] = FederatedSDN::SitePool.new().get(ns[:site_id]).name - net_array_element[:tenant_id] = FederatedSDN::TenantPool.new().get_tenant_id_in_site(owner, net_array_element[:site]) + net_array_element[:site] = FederatedSDN::SitePool.new().get(ns[:site_id])[1][:name] + net_array_element[:tenant_id] = FederatedSDN::TenantPool.new().get_tenant_id_in_site(username, FederatedSDN::SitePool.new().get(ns[:site_id])[1][:id]) net_array_element[:cmp_blob] = ns[:cmp_blob] net_array << net_array_element diff --git a/models/tenant_pool.rb b/models/tenant_pool.rb index b4e21af..2a9c0f5 100644 --- a/models/tenant_pool.rb +++ b/models/tenant_pool.rb @@ -276,7 +276,7 @@ def is_admin(username) def get_tenant_id_in_site(username, site) tenant_id = @table.filter(:name => username).first[:id] - @table_to_site.filter(:tenant_id => tenant_id).filter(:site_id => site_id).first[:user_id_in_site] + @table_to_site.filter(:tenant_id => tenant_id).filter(:site_id => site).first[:user_id_in_site] end def validate_user(site_type, cmp_endpoint, username, password)