/* * * Copyright 2016-2017 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * */ /** * @file rw-pkg-mgmt.yang * @author Varun Prasad * @date 2016/09/21 * @brief Pacakage Management Yang */ module rw-pkg-mgmt { namespace "http://riftio.com/ns/riftware-1.0/rw-pkg-mgmt"; prefix "rw-pkg-mgmt"; import ietf-yang-types { prefix "yang"; } import rw-cli-ext { prefix "rwcli"; } import rw-cloud { prefix "rwcloud"; } import rwcal { prefix "rwcal"; } import mano-types { prefix "manotypes"; } import rw-vnfd { prefix "rwvnfd"; } import rw-nsd { prefix "rwnsd"; } import rw-project-vnfd { prefix "rw-project-vnfd"; } import rw-project-nsd { prefix "rw-project-nsd"; } import rw-project { prefix "rw-project"; } import rw-project-mano { prefix "rw-project-mano"; } revision 2017-02-08 { description "Update model to support projects."; } revision 2016-06-01 { description "Initial revision."; } typedef task-status { type enumeration { enum QUEUED; enum IN_PROGRESS; enum DOWNLOADING; enum CANCELLED; enum COMPLETED; enum FAILED; } } typedef package-file-type { type enumeration { enum ICONS; enum CHARMS; enum SCRIPTS; enum IMAGES; enum CLOUD_INIT; enum README; } } typedef vnfd-file-type { type enumeration { enum ICONS; enum CHARMS; enum SCRIPTS; enum IMAGES; enum CLOUD_INIT; enum README; enum DOC; enum TEST; } } typedef nsd-file-type { type enumeration { enum VNF_CONFIG; enum NS_CONFIG; enum ICONS; enum SCRIPTS; } } typedef export-schema { type enumeration { enum RIFT; enum MANO; } } typedef export-grammar { type enumeration { enum OSM; enum TOSCA; } } typedef export-format { type enumeration { enum YAML; enum JSON; } } grouping external-url-data { leaf external-url { description "Url to download"; type string; } leaf username { description "username if the url uses authentication"; type string; } leaf password { description "password if the url uses authentication"; type string; } } grouping package-identifer { leaf package-type { description "Type of the package"; type manotypes:package-type; } leaf package-id { description "Id of the package"; type string; } } grouping package-file-identifer { uses package-identifer; leaf package-path { description "Relative path in the package"; type string; } } grouping download-task-status { leaf status { description "The status of the download task"; type task-status; default QUEUED; } leaf detail { description "Detailed download status message"; type string; } leaf progress-percent { description "The download progress percentage (0-100)"; type uint8; default 0; } leaf bytes_downloaded { description "The number of bytes downloaded"; type uint64; default 0; } leaf bytes_total { description "The total number of bytes to write"; type uint64; default 0; } leaf bytes_per_second { description "The total number of bytes written per second"; type uint32; default 0; } leaf start-time { description "start time (unix epoch)"; type uint32; } leaf stop-time { description "stop time (unix epoch)"; type uint32; } } grouping copy-task-status { leaf status { description "The status of the copy task"; type task-status; default QUEUED; } } augment "/rw-project:project" { container download-jobs { description "Download jobs"; config false; list job { key "download-id"; leaf download-id { description "Unique UUID"; type string; } leaf url { description "URL of the download"; type string; } uses package-file-identifer; uses download-task-status; } } container copy-jobs { description "Copy jobs"; config false; list job { key "transaction-id"; leaf transaction-id { description "Unique UUID"; type string; } uses copy-task-status; } } container create-jobs { description "Create jobs"; config false; list job { key "transaction-id"; leaf transaction-id { description "Unique UUID"; type string; } uses copy-task-status; } } container update-jobs { description "Update jobs"; config false; list job { key "transaction-id"; leaf transaction-id { description "Unique UUID"; type string; } uses copy-task-status; } } } rpc get-package-endpoint { description "Retrieves the endpoint for the descriptor"; input { uses package-identifer; uses manotypes:rpc-project-name; } output { leaf endpoint { description "Endpoint that contains all the package-related data"; type string; } } } rpc package-copy { description "Copies the package specified in input and returns the copied package id"; input { uses package-identifer; leaf package-name { description "Name of destination package"; type string; } uses manotypes:rpc-project-name; } output { leaf transaction-id { description "Valid ID to track the status of the task"; type string; } uses package-identifer; } } rpc get-package-schema { description "Retrieves the schema for the package type"; input { leaf package-type { description "Type of the package"; type manotypes:package-type; } uses manotypes:rpc-project-name; } output { leaf-list schema { description "List of all top level directories for the package."; type string; } } } rpc package-create { description "Creates a new package"; input { uses package-identifer; uses external-url-data; uses manotypes:rpc-project-name; } output { leaf transaction-id { description "Valid ID to track the status of the task"; type string; } uses manotypes:rpc-project-name; } } rpc package-update { description "Creates a new package"; input { uses package-identifer; uses external-url-data; uses manotypes:rpc-project-name; } output { leaf transaction-id { description "Valid ID to track the status of the task"; type string; } uses manotypes:rpc-project-name; } } rpc package-export { description "Export a package"; input { uses package-identifer; uses manotypes:rpc-project-name; leaf export-schema { description "Schema to export"; type export-schema; default RIFT; } leaf export-grammar { description "Schema to export"; type export-grammar; default OSM; } leaf export-format { description "Format to export"; type export-format; default YAML; } } output { leaf transaction-id { description "Valid ID to track the status of the task"; type string; } leaf filename { description "Valid ID to track the status of the task"; type string; } uses manotypes:rpc-project-name; } } rpc package-file-add { description "Retrieves the file from the URL and store it in the package"; input { uses package-file-identifer; uses external-url-data; uses manotypes:rpc-project-name; choice catalog-type { mandatory true; case VNFD { leaf vnfd-file-type { description "Type of vnfd file being added to the package"; type vnfd-file-type; } } case NSD { leaf nsd-file-type { description "Type of nsd file being added to the package"; type nsd-file-type; } } } } output { leaf task-id { description "Valid ID to track the status of the task"; type string; } uses manotypes:rpc-project-name; } } rpc package-file-delete { description "Retrieves the file from the URL and store it in the package"; input { uses package-file-identifer; uses manotypes:rpc-project-name; choice catalog-type { case VNFD { leaf vnfd-file-type { description "Type of file being removed from the vnfd package"; type vnfd-file-type; } } case NSD { leaf nsd-file-type { description "Type of file being removed from the nsd package"; type nsd-file-type; } } } } output { leaf status { description "Status of the delte operation"; type string; } leaf error-trace { description "Trace in case of a failure"; type string; } uses manotypes:rpc-project-name; } } }