
/*
 *
 *   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-launchpad.yang
 * @author Joshua Downer
 * @date 2015/09/14
 * @brief Launchpad Yang
 */

module rw-launchpad
{
  namespace "http://riftio.com/ns/riftware-1.0/rw-launchpad";
  prefix "rw-launchpad";

  import ietf-yang-types {
    prefix "yang";
  }

  import rw-pb-ext {
    prefix "rwpb";
  }

  import ietf-inet-types {
    prefix "inet";
  }


  import rw-cli-ext {
    prefix "rwcli";
  }

  import rw-yang-types {
    prefix "rwt";
  }

  import rwcal {
    prefix "rwcal";
  }

  import rw-vnfd {
    prefix "rw-vnfd";
  }

  import vld {
    prefix "vld";
  }

  import rw-nsd {
    prefix "rw-nsd";
  }

  import rw-cloud {
    prefix "rw-cloud";
  }

  import rw-nsr {
    prefix "rw-nsr";
  }

  import rw-conman {
    prefix "rw-conman";
  }

  import rw-config-agent {
    prefix "rw-config-agent";
  }

  import rw-monitor {
    prefix "rw-monitor";
  }

  import rw-image-mgmt {
    prefix "rw-image-mgmt";
  }
  
  import rw-pkg-mgmt {
    prefix "rw-pkg-mgmt";
  }
  

  import mano-types {
    prefix "manotypes";
  }

  revision 2015-09-14 {
    description
      "Initial revision.";
  }

  container datacenters {
    description "OpenMano data centers";

    rwpb:msg-new DataCenters;
    config false;

    list ro-accounts {
      description
          "A list of OpenMano cloud accounts that have data centers associated
          with them";

      rwpb:msg-new ROAccount;
      key "name";

      leaf name {
        description "The name of the cloud account";
        type leafref {
          path "/rw-launchpad:resource-orchestrator/rw-launchpad:name";
        }
      }

      list datacenters {
        rwpb:msg-new DataCenter;
        leaf uuid {
          description "The UUID of the data center";
          type yang:uuid;
        }

        leaf name {
          description "The name of the data center";
          type string;
        }
      }
    }
  }

  typedef resource-orchestrator-account-type {
    description "RO account type";
    type enumeration {
      enum rift-ro;
      enum openmano;
    }
  }

  container resource-orchestrator {
    rwpb:msg-new ResourceOrchestrator;

    leaf name {
       type string;
    }

    leaf account-type {
      type resource-orchestrator-account-type;
    }

    choice resource-orchestrator {
      description
        "The resource orchestrator to use by the Launchpad";
      default rift-ro;

      case rift-ro {
        description
          "Use the RIFT.io resource orchestrator";

        container rift-ro {
          leaf rift-ro {
            type empty;
          }
        }
      }

      case openmano {
        description
          "Use OpenMano as RO";

        container openmano {
          leaf host {
            type string;
            default "localhost";
          }

          leaf port {
            type uint16;
            default 9090;
          }

          leaf tenant-id {
            type string {
              length "36";
            }
            mandatory true;
          }
        }
      }
    }
  }

  container launchpad-config {
    leaf public-ip {
      description
          "An IP address that can, at least, be reached by the host that the
          launchpad is running on. This is not a mandatory but is required for
          alarms to function correctly.";
      type string;
    }
  }
}
