update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[osm/SO.git] / rwcm / plugins / yang / rw-conman.yang
index bb1555d..ccb992f 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
  * 
- *   Copyright 2016 RIFT.IO Inc
+ *   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.
@@ -31,20 +31,28 @@ module rw-conman
   namespace "http://riftio.com/ns/riftware-1.0/rw-conman";
   prefix "rw-conman";
 
-  import rw-pb-ext {
-    prefix "rwpb";
-  }
-
   import rw-cli-ext {
     prefix "rwcli";
   }
 
+  import rw-project-vnfd {
+    prefix "rw-project-vnfd";
+  }
+
+  import rw-project-nsd {
+    prefix "rw-project-nsd";
+  }
+
   import nsr {
     prefix "nsr";
   }
 
-  import vnfr {
-    prefix "vnfr";
+  import rw-nsr {
+    prefix "rw-nsr";
+  }
+
+  import rw-vnfr {
+    prefix "rw-vnfr";
   }
 
   import rw-vlr {
@@ -75,6 +83,19 @@ module rw-conman
     prefix "rw-config-agent";
   }
 
+  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 2015-10-27 {
     description
       "Initial revision.";
@@ -106,155 +127,335 @@ module rw-conman
     leaf ro-username {
       description "RO endpoint username";
       type string;
-      default "admin";
+      default "@rift";
     }
     leaf ro-password {
       description "RO endpoint password";
       type string;
-      default "admin";
-    }
-  }
-
-  grouping vnf-cfg-items {
-    leaf configuration-file {
-      description "Location of the confguration file on CM system";
-      type string;
-    }
-    leaf translator-script {
-      description "Script that translates the templates in the configuration-file using VNFR information
-                   Currently, we only use IP address translations.
-                   configuration will use connection point name instead of IP addresses.";
-      type string;
+      default "rift";
     }
   }
   
-  container cm-config {
-    description "Service Orchestrator specific configuration";
-    rwpb:msg-new "SoConfig";
-    rwcli:new-mode "cm-config";
-
-    container ro-endpoint {
-      description "Resource Orchestrator endpoint ip address";
-      rwpb:msg-new "RoEndpoint";
-      uses ro-endpoint;
-    }
-    
-    //uses vnf-cfg-items;
-
-    list nsr {
-      key "id";
-      leaf id {
-        description "Indicates NSR bringup complete, now initiate configuration of the NSR";
-        type yang:uuid;
-      }
-    }
-  }// cm-config
-  
   // =================== SHOW ==================
   typedef record-state {
     type enumeration {
       enum init;
       enum received;
-      enum cfg-delay;
       enum cfg-process;
       enum cfg-process-failed;
       enum cfg-sched;
       enum connecting;
       enum failed-connection;
-      enum netconf-connected;
-      enum netconf-ssh-connected;
-      enum restconf-connected;
       enum cfg-send;
       enum cfg-failed;
       enum ready-no-cfg;
       enum ready;
+      enum terminate;
     }
   }
 
-  // TBD: Do we need this typedef, currently not used anywhere
-  typedef cfg-type {
-    type enumeration {
-      enum none;
-      enum scriptconf;
-      enum netconf;
-      enum restconf;
-      enum jujuconf;
+
+  grouping primitive-parameter {
+    leaf name {
+      description
+          "Name of the parameter.";
+      type string;
     }
-  }
 
+    leaf data-type {
+      description
+          "Data type associated with the name.";
+      type manotypes:parameter-data-type;
+    }
 
-  // This is also used by RO (Resource Orchestrator) to indicate NSR is ready
-  // It will only fill in IDs
-  container cm-state {
-    rwpb:msg-new "CmOpdata";
-    config false;
-    description "CM NS & VNF states";
+    leaf mandatory {
+      description "Is this field mandatory";
+      type boolean;
+      default false;
+    }
 
-    leaf states {
-      description "CM various states";
+    leaf default-value {
+      description "The default value for this field";
       type string;
     }
-    
-    list cm-nsr {
-      description "List of NS Records";
-      key "id";
-      leaf id {
-        type yang:uuid;
+
+    leaf parameter-pool {
+      description "NSD parameter pool name to use for this parameter";
+      type string;
+    }
+
+    leaf read-only {
+      description
+        "The value should be dimmed by the UI.
+        Only applies to parameters with default values.";
+      type boolean;
+      default false;
+    }
+
+    leaf hidden {
+      description
+        "The value should be hidden by the UI.
+        Only applies to parameters with default values.";
+      type boolean;
+      default false;
+    }
+
+    leaf out {
+      description "If this is an output of the primitive execution";
+      type boolean;
+      default false;
+    }
+  }
+
+  grouping vnf-configuration {
+    container vnf-configuration {
+      description
+          "Information about the VNF configuration. Note:
+           If the NS contains multiple instances of the
+           same VNF, each instance could have a different
+           configuration.";
+
+      choice config-method {
+        description
+            "Defines the configuration method for the VNF.";
+        case script {
+          description
+              "Use custom script for configuring the VNF.
+               This script is executed in the context of
+               Orchestrator (The same system and environment
+               as the Launchpad).";
+          container script {
+            leaf script-type {
+              description
+                  "Script type - currently supported - Scripts confirming to Rift CA plugin";
+              type enumeration {
+                enum rift;
+              }
+            }
+          }
+        }
+
+        case juju {
+          description
+            "Configure the VNF through Juju.";
+          container juju {
+            leaf charm {
+              description "Juju charm to use with the VNF.";
+              type string;
+            }
+          }
+        }
       }
-      leaf name {
-        description "NSR name.";
-        type string;
+
+      list config-primitive {
+        description
+          "List of config primitives supported by the
+          configuration agent for this VNF.";
+        key "name";
+
+        leaf name {
+          description
+            "Name of the config primitive.";
+          type string;
+        }
+
+        list parameter {
+          description
+            "List of parameters to the config primitive.";
+          key "name";
+          uses primitive-parameter;
+        }
+
+        leaf user-defined-script {
+          description
+            "A user defined script. If user defined script is defined,
+             the script will be executed using bash";
+          type string;
+        }
       }
-      leaf state {
-        description "State of NSR";
-        type record-state;
+
+      list initial-config-primitive {
+        description
+          "Initial set of configuration primitives.";
+        key "seq";
+        leaf seq {
+          description
+              "Sequence number for the configuration primitive.";
+          type uint64;
+        }
+
+        choice primitive-type {
+          case primitive-definition {
+            leaf name {
+              description
+                "Name of the configuration primitive.";
+              type string;
+            }
+
+            uses manotypes:primitive-parameter-value;
+
+            leaf user-defined-script {
+              description
+                "A user defined script.";
+              type string;
+            }
+          }
+          case primitive-ref {
+            leaf config-primitive-ref {
+              description
+                "Reference to a config primitive name.
+                 NOTE: The config primitive referred should have
+                       all the input parameters predefined either
+                       with default values or dependency references.";
+              type leafref {
+                path "../../config-primitive/name";
+              }
+            }
+          }
+        }
       }
-      leaf state-details {
-        description "Details of the state of NSR, in case of errors";
+    }
+  } // END - grouping vnf-configuration
+
+
+  // This is also used by RO (Resource Orchestrator) to indicate NSR is ready
+  // It will only fill in IDs
+  augment "/rw-project:project" {
+    container cm-state {
+      config false;
+      description "CM NS & VNF states";
+
+      leaf states {
+        description "CM various states";
         type string;
       }
-      
-      list cm-vnfr {
-        description "List of VNF Records within NS Record";
+    
+      list cm-nsr {
+        description "List of NS Records";
         key "id";
         leaf id {
           type yang:uuid;
         }
         leaf name {
-          description "VNFR name.";
+          description "NSR name.";
           type string;
         }
         leaf state {
-          description "Last known state of this VNFR";
+          description "State of NSR";
           type record-state;
         }
-        container mgmt-interface {
-          leaf ip-address {
-            type inet:ip-address;
-          }
-          leaf port {
-            type inet:port-number;
-          }
-        }
-        leaf cfg-type {
+        leaf state-details {
+          description "Details of the state of NSR, in case of errors";
           type string;
         }
-        leaf cfg-location {
-          type inet:uri;
-        }
-        list connection-point {
-          key "name";
+      
+        list cm-vnfr {
+          description "List of VNF Records within NS Record";
+          key "id";
+          leaf id {
+            type yang:uuid;
+          }
           leaf name {
-            description "Connection Point name";
+            description "VNFR name.";
             type string;
           }
-          leaf ip-address {
-            description "IP address assigned to this connection point";
-            type inet:ip-address;
+          leaf state {
+            description "Last known state of this VNFR";
+            type record-state;
           }
-        }
-      } // list VNFR
-    } // list NSR
-  } // cm-state
-  
+
+          container mgmt-interface {
+            leaf ip-address {
+              type inet:ip-address;
+            }
+            leaf port {
+              type inet:port-number;
+            }
+          }
+          leaf cfg-type {
+            type string;
+          }
+          list connection-point {
+            key "name";
+            leaf name {
+              description "Connection Point name";
+              type string;
+            }
+            leaf ip-address {
+              description "IP address assigned to this connection point";
+              type inet:ip-address;
+            }
+            leaf connection-point-id {
+              type string;
+            }
+          }
+
+          // Publish the resolved capabilites and dependecies here
+          container config-parameter {
+            description
+              "The resolved config parameter for a VNF";
+            list config-parameter-source {
+              description "List of resolved sources";
+              key "name";
+
+              leaf name {
+                type string {
+                  length 1..128;
+                }
+                description
+                  "Name of the source as defined in VNFD";
+              }
+              leaf value {
+                type string;
+                description
+                  "Resovled value for the source";
+              }
+              list parameter {
+                key "config-primitive-ref";
+                leaf config-primitive-ref {
+                  type string;
+                }
+                leaf parameter-ref {
+                  type string;
+                }
+              }
+            }
+
+            list config-parameter-request {
+              description
+                "List of resolved requests for the the VNF";
+              key "name";
+
+              leaf name {
+                type string {
+                  length 1..128;
+                }
+                description
+                  "Name of the request as defined in VNFD";
+              }
+              leaf value {
+                type string;
+                description
+                  "Resovled value for the request";
+              }
+              list parameter {
+                key "config-primitive-ref";
+                leaf config-primitive-ref {
+                  type string;
+                }
+                leaf parameter-ref {
+                  type string;
+                }
+              }
+            }
+          }
+
+          // Resolve the VNF config-primitives and publish it
+          // here. VNFR will use this and update config-primitives
+          // from here.
+          uses vnf-configuration;
+        } // list VNFR
+      } // list NSR
+    } // cm-state
+  }
 } // rw-conman