module ietf-trans-client-service {
  /* TODO: FIXME */
    yang-version 1.1;

  namespace "urn:ietf:params:xml:ns:yang:ietf-trans-client-service";
  prefix "clntsvc";

  import ietf-te-types {
    prefix "te-types";
    //reference "RFC 8776 - Traffic Engineering Common YANG Types";
  }

  import ietf-layer1-types {
    prefix "layer1-types";
    //reference "RFC ZZZZ - A YANG Data Model for Layer 1 Types";
  }

  import ietf-yang-types {
    prefix "yang";
    //reference "RFC 6991 - Common YANG Data Types";
  }

 import ietf-trans-client-svc-types {
   prefix "clntsvc-types";
   //reference "RFC XXXX - A YANG Data Model for
   //           Transport Network Client Signals";
 }

  organization
    "Internet Engineering Task Force (IETF) CCAMP WG";
  contact
    "
      ID-draft editor:
        Haomian Zheng (zhenghaomian@huawei.com);
        Aihua Guo (aihuaguo.ietf@gmail.com);
        Italo Busi (italo.busi@huawei.com);
        Anton Snitser (antons@sedonasys.com);
        Francesco Lazzeri (francesco.lazzeri@ericsson.com);
        Yunbin Xu (xuyunbin@caict.ac.cn);
        Yang Zhao (zhaoyangyjy@chinamobile.com);
        Xufeng Liu (Xufeng_Liu@jabil.com);
        Giuseppe Fioccola (giuseppe.fioccola@huawei.com);
    ";

  description
    "This module defines a YANG data model for describing
     transport network client services. The model fully conforms
     to the Network Management Datastore Architecture (NMDA).

     Copyright (c) 2021 IETF Trust and the persons
     identified as authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (https://trustee.ietf.org/license-info).
     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.";
  revision 2021-01-11 {
    description
      "version -04 as a WG document";
    reference
      "draft-ietf-ccamp-client-signal-yang";
  }

  /*
   * Groupings
   */
  grouping client-svc-access-parameters {
    description
      "Transport network client signals access parameters";

    leaf access-node-id {
      type te-types:te-node-id;
      description
        "The identifier of the access node in the underlying
         transport network topology.";
    }

    leaf access-ltp-id {
      type te-types:te-tp-id;
      description
        "The TE link termination point identifier, used together with
         access-node-id to identify the access LTP.";
    }

    leaf client-signal {
      type identityref {
        base layer1-types:client-signal;
      }
      description
        "Identify the client signal type associated with this port";
    }

  }

  grouping client-svc-tunnel-parameters {
    description
      "Transport network client signals tunnel parameters";

    leaf tunnel-name {
      type string;
      description
        "TE tunnel instance name.";
    }
  }

  grouping  client-svc-instance-config {
    description
      "Configuration parameters for client services.";
    leaf client-svc-name {
      type string;
      description
        "Identifier of the p2p transport network client signals.";
    }

    leaf client-svc-title {
      type string;
      description
        "Name of the p2p transport network client signals.";
    }

    leaf client-svc-descr {
      type string;
      description
        "Description of the transport network client signals.";
    }

    leaf client-svc-customer {
      type string;
      description
        "Customer of the transport network client signals.";
    }

    container resilience {
      description "Place holder for resilience functionalities";
    }

    uses te-types:te-topology-identifier;

    leaf admin-status {
      type identityref {
        base te-types:tunnel-admin-state-type;
      }
      default te-types:tunnel-admin-state-up;
      description "Client signals administrative state.";
    }

    container src-access-ports {
      description
        "Source access port of a client signal.";
      uses client-svc-access-parameters;
    }
    container dst-access-ports {
      description
        "Destination access port of a client signal.";
      uses client-svc-access-parameters;
    }

    leaf direction {
      type identityref {
        base clntsvc-types:direction;
      }
      description "Uni-dir or Bi-dir for the client signal.";
    }

    list svc-tunnels {
      key tunnel-name;
      description
        "List of the TE Tunnels supporting the client signal.";
      uses client-svc-tunnel-parameters;
    }
  }

  grouping  client-svc-instance-state {
    description
      "State parameters for client services.";
    leaf operational-state {
      type identityref {
            base te-types:tunnel-state-type;
      }
      config false;
      description "Client signal operational state.";
    }
    leaf provisioning-state {
      type identityref {
            base te-types:lsp-state-type;
      }
      config false;
      description "Client signal provisioning state.";
    }
    leaf creation-time {
      type yang:date-and-time;
      config false;
      description "The time of the client signal be created.";
    }
    leaf last-updated-time {
      type yang:date-and-time;
      config false;
      description "The time of the client signal's latest update.";
    }
    leaf created-by {
      type string;
      config false;
      description
        "The client signal is created by whom,
         can be a system or staff ID.";
    }
    leaf last-updated-by {
      type string;
      config false;
      description
        "The client signal is last updated by whom,
         can be a system or staff ID.";
    }
    leaf owned-by {
      type string;
      config false;
      description
        "The client signal is owned by whom,
         can be a system ID.";
    }
  }

  /*
   * Data nodes
   */

  container client-svc {
    description
      "Transport client services.";

    list client-svc-instances {
      key client-svc-name;
      description
        "The list of p2p transport client service instances";

          uses client-svc-instance-config;
          uses client-svc-instance-state;
    }
  }
}