All the yang files from SO committed to IM
[osm/IM.git] / models / yang / rw-vnfr.yang
diff --git a/models/yang/rw-vnfr.yang b/models/yang/rw-vnfr.yang
new file mode 100644 (file)
index 0000000..be8acb4
--- /dev/null
@@ -0,0 +1,324 @@
+
+/*
+ * 
+ *   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.
+ *
+ *
+ */
+
+module rw-vnfr
+{
+  namespace "http://riftio.com/ns/riftware-1.0/rw-vnfr";
+  prefix "rw-vnfr";
+
+  import mano-types {
+    prefix "manotypes";
+  }
+
+  import rw-pb-ext { prefix "rwpb"; }
+
+  import vnfr {
+    prefix "vnfr";
+  }
+
+  import vnfd {
+    prefix "vnfd";
+  }
+
+  import rw-cloud {
+    prefix "rw-cloud";
+  }
+
+  import rwvcs-types {
+    prefix "rwvcstypes";
+  }
+
+  import ietf-yang-types {
+    prefix "yang";
+  }
+
+  import ietf-inet-types {
+    prefix "inet";
+  }
+
+  revision 2015-09-10 {
+    description
+      "Initial revision. This YANG file augments
+       the base MANO VNFD";
+    reference
+      "Derived from earlier versions of base YANG files";
+  }
+
+  grouping vnfr-operational-events {
+    list operational-events {
+      key "id";
+      description
+        "Recent operational events for VNFR
+        Though the model does not impose any restrictions on the numbe of events, 
+        the max operational events will be limited to the most recent 10"; 
+
+      leaf id {
+        description "The id of the instance";
+        type uint64;
+      }
+
+      leaf timestamp {
+        description
+          "The timestamp of this event expressed as seconds since
+          unix epoch - 1970-01-01T00:00:00Z";
+        type uint32;
+      }
+      leaf event {
+        description "The event";
+        type enumeration {
+          rwpb:enum-type "VnfrOperationalEvent";
+          enum instantiate-rcvd;
+          enum vl-inited;
+          enum vnf-inited;
+          enum running;
+          enum terminate-rcvd;
+          enum vnf-terminated;
+          enum vl-terminated;
+          enum terminated;
+        }
+      }
+      leaf description {
+        description
+          "The description of this event";
+        type string;
+      }
+    }
+  }
+
+  grouping vdur-operational-events {
+    list operational-events {
+      key "id";
+      description
+        "Recent operational events for VDUR
+        Though the model does not impose any restrictions on the numbe of events, 
+        the max operational events will be limited to the most recent 10"; 
+
+      leaf id {
+        description "The id of the instance";
+        type uint64;
+      }
+
+      leaf timestamp {
+        description
+          "The timestamp of this event expressed as seconds since
+          unix epoch - 1970-01-01T00:00:00Z";
+        type uint32;
+      }
+      leaf event {
+        description "The event";
+        type enumeration {
+          rwpb:enum-type "VdurOperationalEvent";
+          enum instantiate-rcvd;
+          enum vm-allocation-requested;
+          enum running;
+          enum terminate-rcvd;
+          enum vm-terminate-requested;
+          enum terminated;
+        }
+      }
+      leaf description {
+        description
+          "The description of this event";
+        type string;
+      }
+    }
+  }
+
+  augment /vnfr:vnfr-catalog/vnfr:vnfr {
+    uses manotypes:action-param;
+    uses manotypes:control-param;
+
+    leaf cloud-account {
+      description
+        "The cloud account to use when requesting resources for
+         this vnf";
+      type leafref {
+        path "/rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
+      }
+    }
+
+    leaf om-datacenter {
+      description
+          "Openmano datacenter name to use when instantiating
+          the network service.  This is only used when openmano
+          is selected as the cloud account.  This should be superceded
+          by multiple cloud accounts when that becomes available.";
+      type string;
+    }
+
+    container nfvi-metrics {
+      container vm {
+        leaf label {
+          description
+            "Label to show in UI";
+          type string;
+          default "VM";
+        }
+
+        leaf active-vm {
+          description
+            "The number of active VMs.";
+          type uint64;
+        }
+
+        leaf inactive-vm {
+          description
+            "The number of inactive VMs.";
+          type uint64;
+        }
+      }
+      
+      uses manotypes:nfvi-metrics;
+    }
+
+    list component {
+      description
+          "This section defines the RIFT.ware
+           virtual components";
+      key "component-name";
+      rwpb:msg-new VcsComponentOp;
+      rwpb:application-request-point;
+
+      leaf component-name {
+        description "";
+        type string;
+      }
+
+      leaf component-type {
+        description "";
+        type rwvcstypes:component_type;
+        mandatory true;
+      }
+
+      choice component {
+        case rwvcs-rwcollection {
+          uses rwvcstypes:rwvcs-rwcollection;
+        }
+        case rwvcs-rwvm {
+          uses rwvcstypes:rwvcs-rwvm;
+        }
+        case rwvcs-rwproc {
+          uses rwvcstypes:rwvcs-rwproc;
+        }
+        case native-proc {
+          uses rwvcstypes:native-proc;
+        }
+        case rwvcs-rwtasklet {
+          uses rwvcstypes:rwvcs-rwtasklet;
+        }
+      }
+    } // list component
+
+    uses vnfr-operational-events;
+
+    leaf operational-status-details {
+      description
+        "The error message in case of a failed VNFR operational status";
+      type string;
+    }
+  }
+
+  augment /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur {
+    leaf vm-pool {
+      description
+        "The pool from which this vm was allocated from";
+      type string;
+    }
+
+    container nfvi-metrics {
+      uses manotypes:nfvi-metrics;
+    }
+
+    leaf vcs-component-ref {
+      description
+          "This defines the software components using the
+           RIFT.ware Virtual Component System (VCS). This
+           also allows specifying a state machine during
+           the VM startup.
+           NOTE: This is an significant addition to MANO,
+           since MANO doesn't clearly specify a method to
+           identify various software components in a VM.
+           Also using a state machine is not something that
+           is well described in MANO.";
+      type leafref {
+        path "/vnfr:vnfr-catalog/vnfr:vnfr/rw-vnfr:component/rw-vnfr:component-name";
+      }
+    }
+
+    uses vdur-operational-events;
+
+    leaf operational-status-details {
+      description
+        "The error message in case of a failed VDU operational status";
+      type string;
+    }
+  }
+  grouping vnfd-ref-count {
+    list vnfd-ref-count {
+      key "vnfd-id-ref";
+      description "This table maintains the number of VNFRs used by each VNFD";
+
+      leaf vnfd-id-ref {
+        description "Reference to VNFD";
+        type leafref {
+          path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+        }
+      }
+      leaf instance-ref-count {
+        description
+          "Reference count for the number of VNFRs refering this VNFD.
+           Every VNF Record instantiated using this descriptor takes
+           a reference on the VNFD and releases the reference when the
+           virtual network service is terminated. This desciptor cannot
+           be deleted when this counter is non zero";
+        type uint64;
+      }
+    }
+  }
+  augment /vnfr:vnfr-catalog {
+    uses vnfd-ref-count;
+  }
+
+  container vnfr-console {
+    config false;
+    list vnfr {
+      key "id";
+      leaf id {
+        description "Identifier for the VNFR.";
+        type yang:uuid;
+      }
+      list vdur {
+        description "List of Virtual Deployment Units";
+        key "id";
+        leaf id {
+          description "Unique id for the VDU";
+          type yang:uuid;
+        }
+        leaf console-url {
+          description "Console URL for this VDU, if available";
+          type inet:uri;
+        }
+      }
+    }
+  }
+
+}
+
+// vim: sw=2