Skip to content

Commit

Permalink
Merge pull request #39 from dang03/development
Browse files Browse the repository at this point in the history
Development merge
  • Loading branch information
dang03 authored May 17, 2017
2 parents afc785e + 17b5b4f commit 3673986
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
2 changes: 2 additions & 0 deletions config/adapter.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
# Connecto to GK API
address: sp.int3.sonata-nfv.eu
port: 5600

api_ver: /api/v1

public_key_path: /public-key
Expand Down
1 change: 1 addition & 0 deletions config/catalogue_token.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJacXBqN0NXLUg5OW1abm1aUDJVZi1mM3oyNFFMcXc4MWtTazcyTE81a1o0In0.eyJqdGkiOiJhYWQ4ZTU3ZS1kZDc1LTRlYmYtYTEyMy1hNDAwZmJhN2E0NTUiLCJleHAiOjE0ODg5MjUwNzQsIm5iZiI6MCwiaWF0IjoxNDg4OTI0Nzc0LCJpc3MiOiJodHRwOi8vMTcyLjE5LjAuMzo4MDgwL2F1dGgvcmVhbG1zL3NvbmF0YSIsImF1ZCI6InNvbi1jYXRhbG9ndWUiLCJzdWIiOiJhNDllMDVmYi0xNTczLTQ2N2ItYjE2NC03MmVjYzU4ZjNmMGIiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJzb24tY2F0YWxvZ3VlIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiYzliNTk4ZTMtOGRiNS00YjZiLTkxY2MtYTgxZGVkZmVhMDUyIiwiYWNyIjoiMSIsImNsaWVudF9zZXNzaW9uIjoiZWE1NzYzNzEtNDQ2OC00YTM3LWFlZjYtNmU4MWE5ODI0OTRiIiwiYWxsb3dlZC1vcmlnaW5zIjpbXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbInNvbi1jYXRhbG9ndWUiXX0sInJlc291cmNlX2FjY2VzcyI6e30sImNsaWVudEhvc3QiOiIxNzIuMTkuMC4yIiwiY2xpZW50SWQiOiJzb24tY2F0YWxvZ3VlIiwibmFtZSI6IiIsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2UtYWNjb3VudC1zb24tY2F0YWxvZ3VlIiwiY2xpZW50QWRkcmVzcyI6IjE3Mi4xOS4wLjIiLCJlbWFpbCI6InNlcnZpY2UtYWNjb3VudC1zb24tY2F0YWxvZ3VlQHBsYWNlaG9sZGVyLm9yZyJ9.mcGJokXc5KomW_UaMozkK0maChXRfMqr3C7r_sm45rpcSFk0h7MXlvzSmZs3kCdZdu6DCrPu62v5FK1pZZeAcTA-lLCErt2NZ_tdI4HkuGPiisoK9v1Rdiao7XvTwGqNBbaL4iwNmg0RhXu-pxGqo3PyrKjZ9Qg_XIMpsKPk7B502JNfDx3ovwnyMmeIweZaG7mfEivbeg4EI3OGkQNjzWLkNK3d5wj-Fhgd3p0xAr_dl4jdvBhgdn4fxxri7yqd9t-wFAeghTfOgFBhXkMtBABndu5MZ9DRHt2PM3p4HwodcM67YHSpLY5ekoR8xYPjSiqhLwehhaQDZVNudNv2Tg
1 change: 1 addition & 0 deletions helpers/sonata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def register_service(address, port, api_ver, path)
else
#raise 'Error: registration failure'
return false

end
end

Expand Down
28 changes: 15 additions & 13 deletions models/catalogue_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,18 @@ class FileContainer
field :username, type: String
end

# Sonata class for Catalogue Services
# class Vnf_Ns_map ## Temporary name
# include Mongoid::Document
# include Mongoid::Timestamps
# include Mongoid::Pagination
# include Mongoid::Attributes::Dynamic
# store_in session: 'map_db'

# field :vendor, type: String
# field :name, type: String
# field :version, type: String
# validates :vendor, :name, :version, :presence => true
# end
# Sonata class for Catalogue Element Dependencies
class Dependencies_mapping ## Temporary name
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Pagination
include Mongoid::Attributes::Dynamic
store_in session: 'mapping_db'

field :son_package_uuid, type: String
field :pd, type: String
field :nsds, type: String
field :vnfds, type: String
field :deps, type: string
validates :son_package_uuid, :pd, :nsds, :vnfds, :presence => true
end
10 changes: 8 additions & 2 deletions routes/catalogue_pd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,11 @@ class CatalogueV2 < SonataCatalogue
rescue Mongoid::Errors::DocumentNotFound => e
json_error 404, "The PD Vendor #{keyed_params[:vendor]}, Name #{keyed_params[:name]}, Version #{keyed_params[:version]} does not exist"
end
logger.debug "Catalogue: leaving DELETE /api/v2/packages?#{query_string}\" with PD #{pks}"

# TODO: Implement Intelligent DELETE feature

pks.destroy
logger.debug "Catalogue: leaving DELETE /api/v2/packages?#{query_string}\" with PD #{pks}"
halt 200, 'OK: PD removed'
end
logger.debug "Catalogue: leaving DELETE /api/v2/packages?#{query_string} with 'No PD Vendor, Name, Version specified'"
Expand All @@ -1142,8 +1145,11 @@ class CatalogueV2 < SonataCatalogue
logger.error e
json_error 404, "The PD ID #{params[:id]} does not exist" unless pks
end
logger.debug "Catalogue: leaving DELETE /api/v2/packages/#{params[:id]}\" with PD #{pks}"

# TODO: Implement Intelligent DELETE feature

pks.destroy
logger.debug "Catalogue: leaving DELETE /api/v2/packages/#{params[:id]}\" with PD #{pks}"
halt 200, 'OK: PD removed'
end
logger.debug "Catalogue: leaving DELETE /api/v2/packages/#{params[:id]} with 'No PD ID specified'"
Expand Down
9 changes: 9 additions & 0 deletions routes/catalogue_sonp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,15 @@ class CatalogueV2 < SonataCatalogue
end
logger.debug "Catalogue: leaving POST /api/v2/son-packages/ with #{grid_file.id}"
response = {"uuid" => sonp_id}

# TODO: BEFORE SENDING BACK RESPONSE, A DEPENDENCIES MAPPING DOCUMENT MUST BE BUILT AND SAVED IN THE CATALOGUE
#
# TODO: CALL METHOD OR IMPLEMENT LOGICS HERE
# Requirements:
# sonp_id, pd_name.trio, nsds_name.trio, vnfds_name.trio
#
#

# halt 201, grid_file.id.to_json
halt 201, {'Content-type' => 'application/json'}, response.to_json
end
Expand Down

0 comments on commit 3673986

Please sign in to comment.