diff --git a/config/adapter.yml b/config/adapter.yml index ccf6943..d1bf8b5 100644 --- a/config/adapter.yml +++ b/config/adapter.yml @@ -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 diff --git a/config/catalogue_token.json b/config/catalogue_token.json new file mode 100644 index 0000000..c517b9f --- /dev/null +++ b/config/catalogue_token.json @@ -0,0 +1 @@ +eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJacXBqN0NXLUg5OW1abm1aUDJVZi1mM3oyNFFMcXc4MWtTazcyTE81a1o0In0.eyJqdGkiOiJhYWQ4ZTU3ZS1kZDc1LTRlYmYtYTEyMy1hNDAwZmJhN2E0NTUiLCJleHAiOjE0ODg5MjUwNzQsIm5iZiI6MCwiaWF0IjoxNDg4OTI0Nzc0LCJpc3MiOiJodHRwOi8vMTcyLjE5LjAuMzo4MDgwL2F1dGgvcmVhbG1zL3NvbmF0YSIsImF1ZCI6InNvbi1jYXRhbG9ndWUiLCJzdWIiOiJhNDllMDVmYi0xNTczLTQ2N2ItYjE2NC03MmVjYzU4ZjNmMGIiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJzb24tY2F0YWxvZ3VlIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiYzliNTk4ZTMtOGRiNS00YjZiLTkxY2MtYTgxZGVkZmVhMDUyIiwiYWNyIjoiMSIsImNsaWVudF9zZXNzaW9uIjoiZWE1NzYzNzEtNDQ2OC00YTM3LWFlZjYtNmU4MWE5ODI0OTRiIiwiYWxsb3dlZC1vcmlnaW5zIjpbXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbInNvbi1jYXRhbG9ndWUiXX0sInJlc291cmNlX2FjY2VzcyI6e30sImNsaWVudEhvc3QiOiIxNzIuMTkuMC4yIiwiY2xpZW50SWQiOiJzb24tY2F0YWxvZ3VlIiwibmFtZSI6IiIsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2UtYWNjb3VudC1zb24tY2F0YWxvZ3VlIiwiY2xpZW50QWRkcmVzcyI6IjE3Mi4xOS4wLjIiLCJlbWFpbCI6InNlcnZpY2UtYWNjb3VudC1zb24tY2F0YWxvZ3VlQHBsYWNlaG9sZGVyLm9yZyJ9.mcGJokXc5KomW_UaMozkK0maChXRfMqr3C7r_sm45rpcSFk0h7MXlvzSmZs3kCdZdu6DCrPu62v5FK1pZZeAcTA-lLCErt2NZ_tdI4HkuGPiisoK9v1Rdiao7XvTwGqNBbaL4iwNmg0RhXu-pxGqo3PyrKjZ9Qg_XIMpsKPk7B502JNfDx3ovwnyMmeIweZaG7mfEivbeg4EI3OGkQNjzWLkNK3d5wj-Fhgd3p0xAr_dl4jdvBhgdn4fxxri7yqd9t-wFAeghTfOgFBhXkMtBABndu5MZ9DRHt2PM3p4HwodcM67YHSpLY5ekoR8xYPjSiqhLwehhaQDZVNudNv2Tg diff --git a/helpers/sonata.rb b/helpers/sonata.rb index 0e0acc4..3dcdde0 100644 --- a/helpers/sonata.rb +++ b/helpers/sonata.rb @@ -124,6 +124,7 @@ def register_service(address, port, api_ver, path) else #raise 'Error: registration failure' return false + end end diff --git a/models/catalogue_models.rb b/models/catalogue_models.rb index 0c5663b..465f2ea 100644 --- a/models/catalogue_models.rb +++ b/models/catalogue_models.rb @@ -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 \ No newline at end of file +# 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 diff --git a/routes/catalogue_pd.rb b/routes/catalogue_pd.rb index f54585f..5ba2c94 100644 --- a/routes/catalogue_pd.rb +++ b/routes/catalogue_pd.rb @@ -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'" @@ -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'" diff --git a/routes/catalogue_sonp.rb b/routes/catalogue_sonp.rb index b4b0fc2..743cf2b 100644 --- a/routes/catalogue_sonp.rb +++ b/routes/catalogue_sonp.rb @@ -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