<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>


<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="std"
  docName="draft-lambrechts-onsen-yang-tmf-mapping-00"
  ipr="trust200902"
  obsoletes=""
  updates=""
  submissionType="IETF"
  xml:lang="en"
  version="3">

  <front>
    <title abbrev="YANG-TMF Model &amp; Data Mapping">
      Mapping YANG Schemas and Instance Data to TM Forum Data Models and APIs
    </title>

    <seriesInfo name="Internet-Draft" value="draft-lambrechts-onsen-yang-tmf-mapping-00"/>
   
    <author fullname="Kris Lambrechts" initials="K." surname="Lambrechts">
      <organization>NetEdge</organization>
      <address>
        <email>kris@netedge.plus</email>  
        <uri>https://www.netedge.plus</uri>
      </address>
    </author>
   
    <date year="2026"/>

    <area>General</area>
    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>yang</keyword>
    <keyword>tmf</keyword>
    <keyword>tm forum</keyword>
    <keyword>open api</keyword>
    <keyword>service model</keyword>
    <keyword>resource model</keyword>
    <keyword>characteristic</keyword>
    <keyword>catalog</keyword>
    <keyword>ordering</keyword>
    <keyword>activation</keyword>
    <keyword>mapping</keyword>

    <abstract>
      <t>
        This document describes a mechanism for mapping between YANG schemas
        and instance data and TM Forum (TMF) Data Models and APIs.
        The mapping mechanism enables orchestrators to produce and expose TMF
        compliant interfaces that provide TMF API consumers direct access to a
        YANG data store.
      </t>
      <t>
        Both a mechanism for the mapping of YANG schemas to TMF Catalog
        Specifications (i.e. TMF633/634) and a matching mechanism for the
        mapping of YANG instance data to TMF Order Management (i.e. TMF641/652)
        and Activation Management (i.e. TMF640/702) APIs are described.
      </t>
    </abstract>
 
  </front>

  <middle>
    
    <section>
      <name>Introduction</name>
      <t>
        Service providers commonly use Operational Support Systems (OSS) with
        NETCONF/YANG interfaces (e.g., YANG models <xref target="RFC7950"/>) to
        describe configuration and operational state for network devices and
        services.  Likewise, the TM Forum Open APIs are finding increased adoption in
        Business Support Systems (BSS) for a number of functions, include ordering 
        and lifecycle management of services and resources. 
      </t>

      <t>
        These two ecosystems define different data models and interaction styles 
        for overlapping concepts, which can lead to duplicated modeling effort 
        and inconsistent behavior across platforms.
      </t>
      <t>
        This document addresses this overlap by specifying a mechanism for 
        mapping between YANG schemas and TM Forum Data Models and APIs.
        The goal is to enable consistent representation of resources and services 
        across management interfaces and between domains, removing integration
        barriers and enables the use of YANG models directly in TMF-based BSS/OSS
        implementations.
      </t>
       <t>
        The mapping mechanism is designed to preserve the semantics of the
        original YANG schema tree such as hierarchy, identity, and constraints
        while making them compatible with the TMF data structures and API
        patterns.
        A conscious effort is made to make minimal use of the support for
        polymorphism in the TMF APIs, as this would shift the implementation
        burden to the TMF consumers, hindering adoption and interoperability.
        Instead, the mechanism for mapping leverages existing TMF constructs
        such as Characteristics, Features, and Services/Resources as much as
        possible.
      </t>
      <t>
        The mapping applies to YANG modules in general but is particularly
        relevant to IETF service and network models such as the L3SM <xref target="RFC8299"/>,
        L3NM <xref target="RFC9182"/>, L2SM <xref target="RFC8466"/>, and L2NM <xref target="RFC9291"/>.
      </t>
      <t>
        The scope of this document is limited to the mechanism for mapping
        between YANG schemas/instance data and TM Forum data models and APIs,
        and the associated transformation rules.
        It does not define new protocols, nor does it mandate a specific
        implementation architecture.
        Operational concerns such as service orchestration workflows and
        business processes are out of scope, except where they affect the
        interpretation of the mapped data.
      </t>

      <t>
        The mapping mechanism is only intended for translating YANG modules to 
        TMF standards compliant Open APIs and payloads. The reverse translation
        (from OpenAPI to YANG) is not in scope.
      </t>

      <section>
        <name>Where the TMF Mapping Fits</name>
        <t>
          The TM Forum Open APIs can be divided into several categories. Three
          of those categories are particularly relevant:
        </t>
        <ul>
          <li>Product</li>
          <li>Service</li>
          <li>Resource</li>
        </ul>
        <t>
          The IETF separates service, network, and device models.
          All possible permutations on how these two architectures can be
          reconciled are out of scope for this document, but the mapping
          mechanism defined here is intended to be flexible enough to operate at
          either the TMF Service or Resource layer.
        </t>
        <t>
          The following diagram illustrates a common architecture where TMF Open
          APIs are exposed at the northbound interface of an OSS or Service
          Orchestrator, while YANG-based models and automation drive the
          southbound interfaces to network controllers and devices.
          The mechanism for mapping defined in this document may operate.
        </t> 
        <figure>
          <name>TMF mapping northbound of OSS/Service Orchestrator</name>
          <artwork><![CDATA[
         +----------------------------+
         |   BSS / Customers          |
         | (Consumes TMF APIs)        |
         +-------------+--------------+
                       | TMF Open APIs
                       v (Service/Resource)
         +----------------------------+
         | OSS / Service Orchestrator |
         |    (YANG Service Model)    |
         +-------------+--------------+
                       |
                       v NETCONF/YANG
         +----------------------------+
         |     Network Controllers    |
         |    (YANG Network Model)    |
         +-------------+--------------+
                       |
                       v NETCONF/YANG
         +----------------------------+
         |           Devices          |
         |        (YANG Device)       |
         +----------------------------+
      ]]></artwork>
        </figure>
        <t>
          For operators that handle more of the service lifecycle inside the
          TMF framework, the mapping mechanism can also be applied at the
          northbound interface of the Network Controller.
        </t>
        <figure>
          <name>TMF mapping northbound of Network Controller</name>
          <artwork><![CDATA[
         +----------------------------+
         |   BSS / Customers          |
         | (Consumes TMF APIs)        |
         +-------------+--------------+
                       | TMF Open APIs
                       v (Product/Service/Resource)
         +----------------------------+
         | OSS / Service Orchestrator |
         |    (YANG Service Model)    |
         +-------------+--------------+
                       | TMF Open APIs
                       v (Service/Resource)
         +----------------------------+
         |     Network Controllers    |
         |    (YANG Network Model)    |
         +-------------+--------------+
                       |
                       v NETCONF/YANG
         +----------------------------+
         |           Devices          |
         |        (YANG Device)       |
         +----------------------------+
      ]]></artwork>
        </figure>
        <t>
          These boundaries are illustrative and can be adapted to operator
          architecture as needed. The key principle is that the mapping 
          mechanism defined in this document can be applied at any 
          point where YANG-based models and TMF Open APIs intersect.
        </t>
      </section>
      
      <section>
        <name>Requirements Language</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
          "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
          RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119"/>
          <xref target="RFC8174"/> when, and only when, they appear in
          all capitals, as shown here.</t>
      </section>

    </section>

    <section>
      <name>YANG Schema Trees and the TMF Data Models</name>
      <t>
        YANG schema trees contain data nodes of the following types:
      </t>
      <ul>
        <li>container</li>
        <li>leaf</li>
        <li>leaf-list</li>
        <li>list</li>
        <li>anydata</li>
        <li>anyxml</li>
      </ul>
      <t>
        The following sections describe how each of those constructs
        are mapped to the TMF Data Models and APIs.
        <!-- TODO: Add mapping rules for anydata and anyxml.-->
      </t>
      <section>
        <name>Defining The Mapping Root</name>
        <t>
          The mapping mechanism described in this document can be rooted at any
          container or list in the YANG schema tree. By default, the entire
          subtree starting from the mapping root SHOULD be mapped to TMF,
          except when the operator explicitly indicates that certain nodes or
          subtrees should be ignored by the mapping mechanism, e.g. by using the
          <tt>ignore</tt> extension in the YANG module below.
          Each schema node can be included in at most one mapping subtree, i.e.,
          implementations MUST NOT allow overlapping mapping subtrees.
        </t>
        <t>
          Implementations MAY use the following YANG extension to
          annotate the mapping root and the mapping method for a particular
          YANG subtree:
        </t>
        <sourcecode name="yang-tmf-map.yang"><![CDATA[
<CODE BEGINS> file "yang-tmf-map.yang"

module ietf-yang-tmf-map {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-yang-tmf-map";
  prefix tmf;

  organization
    "IETF ONSEN Working Group.";
  contact
    "Kris Lambrechts
     Email: kris@netedge.plus";
  description
    "This YANG module defines a set of YANG extensions to annotate
     YANG schema nodes with mapping information to TMF Data Models.

     Copyright (c) 2026 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 Revised 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
     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
     for full legal notices.";

  revision 2026-02-23 {
    description
      "Initial revision.";
    reference
      "RFC XXXX";
  }

  extension cfs-service {
    argument name;
    description
      "The TMF CFS Service that this YANG subtree maps to.";
  }

  extension rfs-service {
    argument name;
    description
      "The TMF RFS Service that this YANG subtree maps to.";
  }

  extension resource {
    argument name;
    description
      "The TMF Resource that this YANG subtree maps to.";
  }

  extension ignore {
    description
      "Indicates that the annotated YANG data node and its
       subtree are ignored by the mapping mechanism.";
  }
}

<CODE ENDS>
      ]]></sourcecode>
        <t>
          An operator can use the extension directly in the target YANG
          module, or they can use YANG augmentation to add the mapping to the
          relevant node(s).
          An example of the extension usage is as follows:
        </t>

        <sourcecode name="example-toasters.yang"><![CDATA[
module example-toasters {
  yang-version "1.1";
  ...
  import yang-tmf-map {
    prefix tmf;
  }

  container toasters {
    list toaster {
      key name;
      tmf:cfs-service "Toaster";

      leaf name {
        type string;
        description "Toaster name";
      }
    }
  }
}
      ]]></sourcecode>
      <t>
        In this example, the <tt>toaster</tt> list is annotated with the
        <tt>tmf:cfs-service</tt> extension to indicate that it is mapped to a
        TMF CFS Service named "Toaster". The mapping mechanism will then map
        the child data nodes to the corresponding TMF schema elements based on
        the mapping rules defined in the next sections.
      </t>
      </section>
      <section>
        <name>Mapping containers and lists to (sub)Features</name>
        <t>
          Implementations MUST support mapping YANG schema trees of arbitrary
          depth below the mapping root. Each container or list in the
          schema tree can be represented as a TM Forum Service
          Feature or Resource Feature within the Service or Resource that it
          belongs to.
        </t>
        <t>
          The current TM Forum Data Model does not support Feature nesting, 
          i.e., there is no subFeature-like construct. This can be resolved,
          but requires a change to the TMF Data Model specification and the
          associated OpenAPI specifications. The proposed solution is described
          below.
        </t>

        <t>
          DISCUSSION:         
        </t>
        <t>
          Should this document contain a proposed change to the TMF Data Model
          specification, or is there another preferred process for recommending
          such a change?
        </t>
      </section>
      <section>
        <name>Mapping leafs and leaf-lists to Characteristics</name>
         <t>
          YANG leafs and leaf-lists represent the fundamental data elements in a
          YANG data tree. Each leaf and leaf-list is to be mapped to a corresponding 
          TMF Characteristic.
        </t>
      </section>
    </section>
    <section>
      <name>Rules for Mapping YANG Statements to the TMF Data Model</name>
      <section>
        <name>The "container" Statement</name>
        <t>
          If the container is annotated with the <tt>tmf:cfs-service</tt> or
          <tt>tmf:rfs-service</tt> extension, it MUST be mapped to a TMF CFS
          Service or RFS Resource, respectively. Otherwise, it MUST be mapped to
          a TMF Feature.
        </t>
        <t>
          Data nodes located directly under the mapping root MUST be mapped to
          Service or Resource Characteristics.  Data nodes located in a 
          first-level container or list are mapped to Feature Characteristics, 
          while those located in deeper levels of the YANG schema tree are 
          mapped to subFeature Characteristics and so on.
        </t>
        <t>
          The Feature <tt>name</tt> SHOULD be derived from the YANG node name.
          The child data nodes of the container are mapped to the corresponding
          schema elements within the Feature.
        </t>
      </section>
      <section>
        <name>The "leaf" Statement</name>
        <t>
          Each YANG "leaf" statement MUST be mapped to a TMF Characteristic
          entry. The Characteristic <tt>name</tt> SHOULD be derived from the
          YANG node name. The Characteristic <tt>value</tt> MUST be encoded
          according to the JSON Schema rules for the JSON type matching the YANG
          type, as described in the next section.
        </t>
        <section>
          <name>The leaf's "type" Statement</name>
          <t>
            The YANG "type" statement MUST be fully resolved to a YANG built-in
            type and mapped to a JSON Schema type as follows:
          </t>
          <table>
            <thead>
              <tr><th>YANG Type</th><th>JSON Schema Type</th></tr>
            </thead>
            <tbody>
              <tr><td>boolean</td><td>boolean</td></tr>
              <tr><td>string</td><td>string</td></tr>
              <tr><td>integer types (e.g., int32, uint64)</td><td>integer</td></tr>
              <tr><td>decimal64</td><td>number</td></tr>
              <tr><td>enumeration</td><td>string</td></tr>
              <tr><td>identityref</td><td>string</td></tr>
            </tbody>
          </table>
        </section>
        <section>
          <name>The leaf's "default" Statement</name>
          <t>
            The YANG "default" statement MUST be mapped to a
            CharacteristicValueSpecification entry with the "isDefault" field
            set to true and the "value" field set to the default value specified
            in the YANG model.
          </t>
        </section>
        <section>
          <name>The leaf's "mandatory" Statement</name>
          <t>
            The YANG "mandatory" statement MUST be mapped to the
            CharacteristicSpecification "minCardinality" field with a value of
            1 if the leaf is mandatory, and 0 otherwise.
            If a leaf is part of a list key, it MUST be considered mandatory
            regardless of the presence of the "mandatory" statement.
          </t>
        </section>
      </section>
      <section>
        <name>The "leaf-list" Statement</name>
        <t>
          Each YANG "leaf-list" statement MUST be mapped to a TMF Characteristic
          entry. The Characteristic <tt>name</tt> SHOULD be derived from the
          YANG node name. The Characteristic <tt>value</tt> MUST be encoded as
          an array according to the JSON Schema rules for the JSON type
          matching the YANG type, as described in the previous section.
        </t>
        <section>
          <name>The leaf-list's "type" Statement</name>
          <t>
            The YANG "type" statement for a leaf-list MUST be fully resolved to a
            YANG built-in type and mapped to a JSON Schema type as follows:
          </t>
          <table>
            <thead>
              <tr><th>YANG Type</th><th>JSON Schema Type</th></tr>
            </thead>
            <tbody>
              <tr><td>boolean</td><td>booleanArray</td></tr>
              <tr><td>string</td><td>stringArray</td></tr>
              <tr><td>integer types (e.g., int32, uint64)</td><td>integerArray</td></tr>
              <tr><td>decimal64</td><td>numberArray</td></tr>
              <tr><td>enumeration</td><td>stringArray</td></tr>
              <tr><td>identityref</td><td>stringArray</td></tr>
            </tbody>
          </table>
        </section>
        <section>
          <name>The leaf-list's "default" Statement</name>
          <t>
            The YANG "default" statement for a leaf-list MUST be mapped to a
            CharacteristicValueSpecification entry with the "isDefault" field
            set to true and the "value" field set to an array containing the
            default values specified in the YANG model.
          </t>
      </section>
        <section>
          <name>The leaf-list's "min-elements" Statement</name>
          <t>
            The YANG "min-elements" statement for a leaf-list MUST be mapped to
            the CharacteristicSpecification "minCardinality" field with a value
            corresponding to the constraint specified in the YANG model.
          </t>
        </section>
        <section>
          <name>The leaf-list's "max-elements" Statement</name>
          <t>
            The YANG "max-elements" statement for a leaf-list MUST be mapped to
            the CharacteristicSpecification "maxCardinality" field with a value
            corresponding to the constraint specified in the YANG model.
          </t>
        </section>
      </section>
      <section>
        <name>The "list" Statement</name>
        <t>
          If the list is annotated with the <tt>tmf:cfs-service</tt> or
          <tt>tmf:rfs-service</tt> extension, it MUST be mapped to a TMF CFS
          Service or RFS Resource, respectively. Otherwise, it MUST be mapped
          to a TMF Feature.
        </t>
        <t>
          Data nodes located directly under the mapping root MUST be mapped to
          Service or Resource Characteristics. Data nodes located in a
          first-level container or list are mapped to Feature Characteristics,
          while those located in deeper levels of the YANG schema tree are
          mapped to subFeature Characteristics and so on.
        </t>
        <t>
          The Feature <tt>name</tt> SHOULD be derived from the YANG node name.
          The child data nodes of the list are mapped to the corresponding
          schema elements within the Feature.
        </t>
        <section>
          <name>The list's "key" Statement</name>
          <t>
             The list key(s) MUST be considered mandatory and mapped accordingly
             to the TMF CharacteristicSpecification "minCardinality" field.
          </t>
        </section>
         <section>
           <name>The list's "unique" Statement</name>
           <t>
             The YANG "unique" statement for a list MUST be mapped to the
             CharacteristicSpecification "isUnique" field with a value of true.
           </t>
         </section>
      </section>
    </section>

    <section>
      <name>Mapping YANG Built-In Types</name>
      <section>
        <name>The Integer Built-In Types</name>
        <t>
          All YANG integer built-in types (i.e., int8, int16, int32, int64,
          uint8, uint16, uint32, uint64) MUST be mapped to the integer JSON
          Schema type.
        </t>
        <section>
          <name>The "range" Statement</name>
          <t>
            The YANG "range" statement MUST be mapped to one or more
            CharacteristicValueSpecification entries with the "valueType" field
            set to "integer" and the "rangeInterval" set to "open".
            The "minValue" and "maxValue" fields MUST be set according to the
            range constraints specified in the YANG model.
            If the YANG "range" statement includes multiple intervals
            (separated by "|"), each interval MUST be mapped to a separate
            CharacteristicValueSpecification entry.
          </t>
        </section>
      </section>
      <section>
        <name>The String Built-In Types</name>
        <t>
          The YANG built-in string type MUST be mapped to the string JSON
          Schema type.
        </t>
        <section>
          <name>The "length" Statement</name>
          <t>
            The YANG "length" statement MUST be mapped to one or more
            CharacteristicValueSpecification entries with the "valueType" field
            set to "string" and the "regex" field set to a regular expression
            that enforces the length constraint.
            For example, a length constraint of "1..10" would be mapped to a
            regex of "^.{1,10}$". If the YANG "length" statement includes
            multiple intervals (separated by "|"), each interval MUST be mapped
            to a separate CharacteristicValueSpecification entry with the
            corresponding regex.
          </t>
        </section>
        <section>
          <name>The "pattern" Statement</name>
          <t>
            The YANG "pattern" statement MUST be mapped to the
            CharacteristicSpecification "regex" field with the same regular
            expression as specified in the YANG model.
          </t>
          <!-- TODO: What are the regex flavors used in both YANG and TMF models? -->
        </section>
      </section>
      <section>
        <name>The Boolean Built-In Type</name>
        <t>
          The YANG boolean type MUST be mapped to the boolean JSON Schema type.
        </t>
      </section>
      <section>
        <name>The Enumeration Built-In Type</name>
        <t>
          The YANG enumeration type MUST be mapped to the string JSON Schema
          type.
        </t>
        <section>
          <name>The "enum" Statement</name>
          <t>
            Each enum value defined in the YANG model MUST be mapped to a
            CharacteristicValueSpecification entry with the "valueType" field set
            to "string" and the "value" field set to the enumeration value.
          </t>
        </section>
      </section>
    </section>

    <section>
      <name>Implementation Guidelines</name>
      <t>
        An implementation of the mapping mechanism defined in this document
        SHOULD expose one or more of the following TMF Open APIs to allow TMF
        API comsumers to query the Catalog Service/ResourceSpecifications:
      </t>
      <ul>
        <li>TMF633 Service Catalog Management API <xref target="TMF633"/></li>
        <li>TMF634 Resource Catalog Management API <xref target="TMF634"/></li>
      </ul>
      <t>
        The implementation SHOULD also expose one or more of the following TMF
        Open APIs to allow TMF API consumers to place orders and activate
        services/resources based on the mapped YANG schema tree:
      </t>
      <ul>
        <li>TMF640 Service Activation API <xref target="TMF640"/></li>
        <li>TMF641 Service Order Management API <xref target="TMF641"/></li>
        <li>TMF652 Resource Activation API <xref target="TMF652"/></li>
        <li>TMF702 Resource Order Management API <xref target="TMF702"/></li>
      </ul>
    </section>
    
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <section>
        <name>YANG Module Registry</name>
        <t>
          The YANG module defined in this document, <tt>yang-tmf-map</tt>,
          is intended to be registered in the IANA YANG Module registry.
          The module defines extensions that can be used to annotate YANG
          modules with TMF mapping information.
        </t>
      </section>
    </section>
    
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>
        This document defines a mapping between YANG schemas/instance data and
        TM Forum data models and APIs. The mapping itself introduces no new
        protocol elements, but it can affect how existing security properties
        are preserved when translating data between representations.
      </t>
      <t>
        Implementations of this mapping MUST preserve the confidentiality,
        integrity, and authorization semantics of the source model.
        In particular, access control decisions tied to YANG nodes (including
        read, write, and notification permissions) MUST be enforced equivalently
        on the mapped TM Forum resources and operations. Failing to do
        so can result in privilege escalation or unintended disclosure.
      </t>
      <t>
        When mapping data across administrative or trust boundaries, operators
        MUST ensure that transport security (e.g., TLS) and mutual
        authentication are used as appropriate for the deployed APIs.
        The mapping process MUST NOT bypass auditing, logging, or rate-limiting
        controls that are required for the underlying interfaces.
      </t>
      <t>
        Finally, any reference data used by the mapping (such as schema
        registries, profiles, or transformation rules) SHOULD be protected from
        unauthorized modification, as tampering could lead to incorrect data
        interpretation or security policy violations.
      </t>
    </section>
    
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8299.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8466.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9182.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9291.xml"/>
        
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="TMF633" target="https://www.tmforum.org/oda/open-apis/directory/service-catalog-management-api-TMF633/">
          <front>
            <title>TMF633 Service Catalog Management API</title>
            <author>
              <organization>TM Forum</organization>
            </author>
            <date year="2019"/>
          </front>
          <seriesInfo name="TMF" value="633"/>
        </reference>
        <reference anchor="TMF634" target="https://www.tmforum.org/oda/open-apis/directory/resource-catalog-management-api-TMF634/">
          <front>
            <title>TMF634 Resource Catalog Management API</title>
            <author>
              <organization>TM Forum</organization>
            </author>
            <date year="2019"/>
          </front>
          <seriesInfo name="TMF" value="634"/>
        </reference>
        <reference anchor="TMF640" target="https://www.tmforum.org/oda/open-apis/directory/service-activation-and-configuration-api-TMF640/">
          <front>
            <title>TMF640 Service Activation and Configuration API</title>
            <author>
              <organization>TM Forum</organization>
            </author>
            <date year="2019"/>
          </front>
          <seriesInfo name="TMF" value="640"/>
        </reference>
        <reference anchor="TMF641" target="https://www.tmforum.org/oda/open-apis/directory/service-ordering-api-TMF641/">
          <front>
            <title>TMF641 Service Ordering API</title>
            <author>
              <organization>TM Forum</organization>
            </author>
            <date year="2019"/>
          </front>
          <seriesInfo name="TMF" value="641"/>
        </reference>
        <reference anchor="TMF652" target="https://www.tmforum.org/oda/open-apis/directory/resource-ordering-management-api-TMF652/">
          <front>
            <title>TMF652 Resource Ordering Management API</title>
            <author>
              <organization>TM Forum</organization>
            </author>
            <date year="2019"/>
          </front>
          <seriesInfo name="TMF" value="652"/>
        </reference>
        <reference anchor="TMF702" target="https://www.tmforum.org/oda/open-apis/directory/resource-activation-and-configuration-api-TMF702/">
          <front>
            <title>TMF702 Resource Activation and Configuration API</title>
            <author>
              <organization>TM Forum</organization>
            </author>
            <date year="2019"/>
          </front>
          <seriesInfo name="TMF" value="702"/>
        </reference>
        <reference anchor="TMF630" target="https://www.tmforum.org/resources/specifications/tmf630-rest-api-design-guidelines-4-2-0/">
          <front>
            <title>TMF630 REST API Design Guidelines</title>
            <author>
              <organization>TM Forum</organization>
            </author>
            <date year="2021"/>
          </front>
          <seriesInfo name="TMF" value="630"/>
        </reference>
      </references>
    </references>

    <section>
      <name>Evaluation of mapping approaches for nested structures</name>
      <t>
        YANG schema trees commonly represent complex data structures by
        composing containers, lists, leafs, and leaf-lists into YANG data trees
        that capture hierarchy, optionality, and repeated elements.
        Mapping those constructs into TM Forum Service and Resource Data Models
        can be approached in several ways, each with different trade-offs in
        expressiveness, TMF Service/Resource Catalog behavior, and operational
        clarity. Five possible approaches are identified in this section with
        their respective advantages and disadvantages.
      </t>
      <t>
        The TMF630 REST API Design Guidelines <xref target="TMF630"/> allow
        for two overall patterns. The "strongly typed" pattern is described
        in the first approach. The Characteristic / CharacteristicSpecification
        pattern, has found wide adoption in TMF APIs and it is the basis for
        the remaining approaches.
      </t>
      <section>
        <name>Approach 1: Strongly Typed Pattern</name>
        <t>
          When using the "strongly typed" pattern, it is assumed that each
          Service or Resource has a corresponding YAML or JSON schema defined in
          the @schemaLocation property.

          An example payload for a strongly typed Service may look like this:
          </t>
          <sourcecode><![CDATA[
{
  "id" : "id1234567890",
  "href" : "http//..",
  "state" : "active",
  "@type" : "conferenceBridgeEquipment",
  "@schemaLocation" : "http://../conferenceBridgeEquipment.json",
  "serviceSpecification":{
    "id":"conferenceBridgeEquipment",
    "href":"http://serverlocation:port/catalogManagement/
            serviceSpecification/conferenceBridgeEquipment"
  },
  "numberOfVc500Units": "1",
  "numberOfVc100Units": "2",
  "routerType": "CiscoASR1000",
  "powerSupply": "UK"
}
      ]]></sourcecode>
        <t>
          The downside of this approach is that it relies on the TMF API
          consumer to understand and process the schema referenced in the
          @schemaLocation property. Since this places a burden on the consumer,
          it can hinder adoption and interoperability, especially if the schema
          is complex or not widely supported. Therefore, the mechanism for
          mapping defined in this document focuses on the Characteristic-based
          approaches described in the following sections.
        </t>
      </section>
      <section>
        <name>Approach 2: Complex Characteristics</name>
        <t>
          A complete data structure can be embedded into a single Characteristic
          by using the TM Forum "Object" Value Type. 
        </t>
        <sourcecode><![CDATA[
{
  "id": "123-456",
  "href": "http://serverlocation:port/
           serviceActivationConfiguration/v4/service/123-456",
  "category": "MobileService",
  "description": "Mobile Line ",
  "hasStarted": true,
  "isBundle": false,
  "isServiceEnabled": true,
  "isStateful": true,
  "serviceDate": "020-04-01T12:15:39.434Z",
  "startDate": "2020-04-03T12:15:39.434Z",
  "serviceCharacteristic": [
    {
      "id": "1",
      "name": "VoiceCharacteristic",
      "valueType": "object",
      "value": [
        {
          "voiceStandard": "enable",
          "voWifi": "disable",
          "roaming": "enable",
          "@schemaLocation": "../serviceSpecification/11//VC.json",
          "@type": "VoiceFeatureCharacteristic"
        }
      ],
      "@type": "ServiceCharacteristic"
    }
  ],
  "@type": "Service"
}
      ]]></sourcecode>
        <t>
          This approach has the advantages of fitting in with the
          Characteristic-based model which most TMF API implementations follow,
          but otherwise suffers from the same issue as the strongly typed
          pattern. This approach, too, relies on the consumer to understand and
          process the schema referenced in the @schemaLocation property.
          Additionally, it can make the Characteristic value opaque and
          difficult to validate or manipulate without understanding the schema.
        </t>
      </section>
      <section>
        <name>Approach 3: Decomposition into Services/Resources</name>
        <t>
          Each data tree layer could be mapped to its own TM Forum Service or
          Resource, linked through <tt>supportingService</tt> or corresponding
          Resource relationships.
          This approach enables explicit decomposition and reuse. However,
          each Service or Resource will appear in the Service Catalog or
          Resource Catalog as a separately orderable item.
        </t>
        <t>
          If this approach was uniformly used for each YANG container or list,
          implementations would then need to expose and manage the appropriate
          relationships (e.g., parent-child, requires), and the resulting
          granularity can become too fine to be operationally meaningful.
          Especially for deeply nested YANG models such as the L3SM, this can
          lead to a large number of Services/Resources in the Catalog,
          making it difficult for operators to manage and for consumers to
          understand the available offerings.
        </t>
        <t>
          This document uses this approach at the mapping root only.
        </t>
      </section>
      <section>
        <name>Approach 4: Decomposition into Features</name>
        <t>
          Each data tree layer can be represented as a TM Forum Service
          Feature or Resource Feature within a Service or Resource.
          This approach keeps Catalog entries manageable while still allowing
          for a structural and hierarchical representation inside the Service
          or Resource.
        </t>
        <t>
          The current TM Forum Data Model does not support Feature nesting, 
          i.e., there is no supportingFeature-like construct. Such construct
          COULD be added via a schemaLocation extension to represent feature
          hierarchy. However, it is the author's opinion that for
          maximum interoperability, such nesting SHOULD be standardized in a
          future TM Forum Open API release.
        </t>
        <t>
          This document uses this approach for each YANG container or list that
          is mapped below the root.
        </t>
      </section>
      <section>
        <name>Approach 5: Encode Schema in Characteristic Names</name>
        <t>
          The structure can be flattened by encoding path-like information in
          Characteristic names (e.g., a YANG path fragment). This approach
          would be simple to implement. However, it cannot represent cardinality
          accurately and tends to obscure the original YANG data tree,
          making validation and processing ambiguous.
        </t>
        <t>
          This document does not use this approach, but it is mentioned here for
          completeness as the approach was evaluated during the design of the
          mapping mechanism.
        </t>
      </section>
    </section>
 </back>
</rfc>
