/* * * Copyright 2016 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-image-mgmt.yang * @author Austin Cormier * @date 2016/06/01 * @brief Image Management Yang */ module rw-image-mgmt { namespace "http://riftio.com/ns/riftware-1.0/rw-image-mgmt"; prefix "rw-image-mgmt"; import ietf-yang-types { prefix "yang"; } import rw-pb-ext { prefix "rwpb"; } import rw-cli-ext { prefix "rwcli"; } import rw-cloud { prefix "rwcloud"; } import rwcal { prefix "rwcal"; } revision 2016-06-01 { description "Initial revision."; } typedef job-status { type enumeration { enum QUEUED; enum IN_PROGRESS; enum CANCELLING; enum CANCELLED; enum COMPLETED; enum FAILED; } } typedef upload-task-status { type enumeration { enum QUEUED; enum CHECK_IMAGE_EXISTS; enum UPLOADING; enum CANCELLING; enum CANCELLED; enum COMPLETED; enum FAILED; } } grouping image-upload-info { leaf image-id { description "The image id that exists in the image catalog"; type string; } leaf image-name { description "The image name that exists in the image catalog"; type string; } leaf image-checksum { description "The image md5 checksum"; type string; } } grouping upload-task-status { leaf status { description "The status of the upload task"; type upload-task-status; default QUEUED; } leaf detail { description "Detailed upload status message"; type string; } leaf progress-percent { description "The image upload progress percentage (0-100)"; type uint8; default 0; } leaf bytes_written { description "The number of bytes written"; 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 "The image upload start time (unix epoch)"; type uint32; } leaf stop-time { description "The image upload stop time (unix epoch)"; type uint32; } } grouping upload-task { leaf cloud-account { description "The cloud account to upload the image to"; type leafref { path "/rwcloud:cloud/rwcloud:account/rwcloud:name"; } } uses image-upload-info; uses upload-task-status; } container upload-jobs { rwpb:msg-new UploadJobs; description "Image upload jobs"; config false; list job { rwpb:msg-new UploadJob; key "id"; leaf id { description "Unique image upload job-id"; type uint32; } leaf status { description "Current job status"; type job-status; } leaf start-time { description "The job start time (unix epoch)"; type uint32; } leaf stop-time { description "The job stop time (unix epoch)"; type uint32; } list upload-tasks { rwpb:msg-new UploadTask; description "The upload tasks that are part of this job"; uses upload-task; } } } rpc create-upload-job { input { rwpb:msg-new CreateUploadJob; choice image-selection { case onboarded-image { description "Use an image previously onboarded in the image catalog"; container onboarded-image { uses image-upload-info; } } case external-url { description "Use an HTTP URL to pull the image from"; container external-url { leaf image-url { description "The image HTTP URL to pull the image from"; type string; } uses image-upload-info; leaf disk-format { description "Format of the Disk"; type rwcal:disk-format; } leaf container-format { description "Format of the container"; type rwcal:container-format; default "bare"; } } } } leaf-list cloud-account { description "List of cloud accounts to upload the image to"; type leafref { path "/rwcloud:cloud/rwcloud:account/rwcloud:name"; } } } output { rwpb:msg-new CreateUploadJobOutput; leaf job-id { description "The upload job-id to cancel"; type uint32; } } } rpc cancel-upload-job { input { rwpb:msg-new CancelUploadJob; leaf job-id { type uint32; } } } }