<?xml version="1.0" encoding="US-ASCII"?>
<!-- This is built from a template for a generic Internet Draft. Suggestions for
     improvement welcome - write to Brian Carpenter, brian.e.carpenter @ gmail.com 
     This can be converted using the Web service at http://xml.resource.org/ -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<!-- You want a table of contents -->
<!-- Use symbolic labels for references -->
<!-- This sorts the references -->
<!-- Change to "yes" if someone has disclosed IPR for the draft -->
<!-- This defines the specific filename and version number of your draft (and inserts the appropriate IETF boilerplate -->
<?rfc sortrefs="yes"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc topblock="yes"?>
<?rfc comments="no"?>
<rfc category="std" docName="draft-wbbpb-ivy-network-inventory-location-02"
     ipr="trust200902">
  <front>
    <title abbrev="Network Inventory Location">A YANG Data Model for Network
    Inventory Location</title>

    <author fullname="Bo Wu" initials="B." surname="Wu">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>101 Software Avenue, Yuhua District</street>

          <city>Nanjing</city>

          <region>Jiangsu</region>

          <code>210012</code>

          <country>China</country>
        </postal>

        <email>lana.wubo@huawei.com</email>
      </address>
    </author>

    <author fullname="Sergio Belotti" initials="S." surname="Belotti">
      <organization>Nokia</organization>

      <address>
        <email>sergio.belotti@nokia.com</email>
      </address>
    </author>

    <author fullname="Jean-Francois Bouquier" initials="J.-F."
            surname="Bouquier">
      <organization>Vodafone</organization>

      <address>
        <email>jeff.bouquier@vodafone.com</email>
      </address>
    </author>

    <author fullname="Fabio Peruzzini" initials="F." surname="Peruzzini">
      <organization>TIM</organization>

      <address>
        <email>fabio.peruzzini@telecomitalia.it</email>
      </address>
    </author>

    <author fullname="Phil Bedard" initials="P." surname="Bedard">
      <organization>Cisco</organization>

      <address>
        <email>phbedard@cisco.com</email>
      </address>
    </author>

    <!---->

    <date day="" month="" year="2024"/>

    <area>OPS Area</area>

    <workgroup>IVY</workgroup>

    <keyword>Network Inventory Location</keyword>

    <abstract>
      <t>This document defines a YANG data model for Network Inventory
      location (e.g., site, room, rack, geo-location data), which provides
      location information with different granularity levels for inventoried
      network elements.</t>

      <t>Accurate location information is useful for network planning,
      deployment, and maintenance. However, such information cannot be
      obtained or verified from the Network Elements themselves. This document
      defines a location model for network inventory that extends the base
      inventory with comprehensive location data.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t>NEs can be grouped by location to provide more information for
      network planning, deployment, and maintenance (e.g., easily locate
      problematic NEs, optimize network resources, or help planning
      forecasts). The location can reflect outdoor or indoor information. An
      indoor location may be represented as a building, room, or other similar
      organizational structures. Outdoor locations can be walls, poles, or
      other mount places.</t>

      <t>The information about sites, equipment rooms, and other more precise
      locations is critical, but it cannot be automatically populated and
      retrieved from network elements (NEs). Instead, it is usually configured
      manually.</t>

      <t>The Network Inventory location model is to record physical locations,
      such as sites, building, equipment rooms, racks, and so on.
      Additionally, it includes provisions for physical addresses or
      geo-location data (geographic coordinates). The location model can
      extend the base network inventory <xref
      target="I-D.ietf-ivy-network-inventory-yang"/> to enrich NEs with
      location information.</t>

      <t>The Network Inventory location model is classified as a network
      configuration model (Section 4 of <xref target="RFC8309"/>).</t>

      <t>The Network Inventory location YANG model conforms to the Network
      Management Datastore Architecture (NMDA) <xref target="RFC8342"/>.</t>

      <section title="Terminology and Notations">
        <t>The following terms are defined in <xref target="RFC7950"/> and are
        not redefined here: <list style="symbols">
            <t>client</t>

            <t>server</t>

            <t>augment</t>

            <t>data model</t>

            <t>data node</t>
          </list></t>

        <t>The following terms are defined in <xref target="RFC6241"/> and are
        not redefined here: <list style="symbols">
            <t>configuration data</t>

            <t>state data</t>
          </list></t>

        <t>The tree diagram used in this document follows the notation defined
        in <xref target="RFC8340"/>.</t>
      </section>

      <section title="Requirements Language">
        <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 title="Hierarchical Locations of Network Inventory">
      <t>The "location" list is generalized to support a variety of geographic
      location, such as sites, rooms, buildings.</t>

      <t>A site represents a general geographic location to group a set of NEs
      and corresponding inventory components. NEs, racks, equipment rooms, and
      buildings can be grouped within a site.</t>

      <t>A room is a facility, a space for network elements and other
      equipment (such as servers, storage) with power supply systems, air
      conditioning system, etc.</t>

      <t>Locations can be nested to form a hierarchy. For example, buildings
      may be within a site, and a room may be within a building.</t>

      <t>The "location-type" is defined as a YANG identity to identify the
      type of an inventory location, which may be site, equipment room,
      building, etc.</t>

      <figure title="YANG Subtree of Location">
        <artwork><![CDATA[  +--rw locations
     +--rw location* [id]
     |  +--rw id                  string
     |  +--ro uuid?               yang:uuid
     |  +--rw name?               string
     |  +--rw description?        string
     |  +--rw alias?              string
     |  +--rw type?               identityref
     |  +--rw parent?             -> ../../location/id
     |  +--rw child*              -> ../../location/id
     |  +--rw physical-address
     |  |     ...
     |  +--rw geo-location
     |        ...
]]></artwork>
      </figure>
    </section>

    <section title="Rack">
      <t>"racks" represent physical equipment racks in which NEs can be
      installed, which facilitate device maintenance. Through "rack-location",
      each rack can be assigned to a site or a specific location within a
      site, such as an equipment room.</t>

      <t>Each rack is assigned a unique ID and a name in the context of a
      facility, e.g. a site. A rack may have some specific attributes, such as
      appearance-related attributes and electricity-related attributes. The
      height, depth and width are described by <xref target="fig-rack"/>
      (please consider that the door of the rack is facing the user).</t>

      <t>Note: Further discussion is needed to decide whether to separate
      "racks" from the list of "location".</t>

      <figure anchor="fig-rack" title="Height, Width and Depth of Rack">
        <artwork><![CDATA[                    ----------------      ---
                   /|              /|      |
                  / |             / |      |
                 /  |            /  |      |
                ----|-----------|   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |    height
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   | Door    Q |   |      |
                |   |         Q |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   |           |   |      |
                |   /-----------|----     ---
                |  /            |   /      /
                | /             |  /      depth
                |/              | /      /
                -----------------      ---
                |______width____|
                |               |]]></artwork>
      </figure>

      <t>The rack attributes include:</t>

      <figure title="YANG Subtree of Rack">
        <artwork><![CDATA[     +--rw racks
        +--rw rack* [id]
           +--rw id                     string
           |     ...
           +--rw height?                uint16
           +--rw width?                 uint16
           +--rw depth?                 uint16
           +--rw max-voltage?           uint16
           +--rw max-allocated-power?   uint16
           +--rw contained-chassis* [relative-position]
                 ...
]]></artwork>
      </figure>

      <t>Max-voltage: the maximum voltage supported by the rack.</t>
    </section>

    <section title="Network Inventory Location Tree">
      <t><xref target="fig-tree-inl"/> provides an overview of the data model
      for "ietf-ni-location" module.</t>

      <figure anchor="fig-tree-inl"
              title="Network Inventory Location Tree Structure">
        <artwork><![CDATA[module: ietf-ni-location
  +--rw locations
     +--rw location* [id]
     |  +--rw id                  string
     |  +--ro uuid?               yang:uuid
     |  +--rw name?               string
     |  +--rw description?        string
     |  +--rw alias?              string
     |  +--rw type?               identityref
     |  +--rw parent?             -> ../../location/id
     |  +--rw child*              -> ../../location/id
     |  +--rw physical-address
     |  |  +--rw address?        string
     |  |  +--rw postal-code?    string
     |  |  +--rw state?          string
     |  |  +--rw city?           string
     |  |  +--rw country-code?   string
     |  +--rw geo-location
     |     +--rw reference-frame
     |     |  +--rw alternate-system?    string
     |     |  |       {alternate-systems}?
     |     |  +--rw astronomical-body?   string
     |     |  +--rw geodetic-system
     |     |     +--rw geodetic-datum?    string
     |     |     +--rw coord-accuracy?    decimal64
     |     |     +--rw height-accuracy?   decimal64
     |     +--rw (location)?
     |     |  +--:(ellipsoid)
     |     |  |  +--rw latitude?    decimal64
     |     |  |  +--rw longitude?   decimal64
     |     |  |  +--rw height?      decimal64
     |     |  +--:(cartesian)
     |     |     +--rw x?           decimal64
     |     |     +--rw y?           decimal64
     |     |     +--rw z?           decimal64
     |     +--rw velocity
     |     |  +--rw v-north?   decimal64
     |     |  +--rw v-east?    decimal64
     |     |  +--rw v-up?      decimal64
     |     +--rw timestamp?         yang:date-and-time
     |     +--rw valid-until?       yang:date-and-time
     +--rw racks
        +--rw rack* [id]
           +--rw id                     string
           +--ro uuid?                  yang:uuid
           +--rw name?                  string
           +--rw description?           string
           +--rw alias?                 string
           +--rw rack-location
           |  +--rw location-ref?    ni-location-ref
           |  +--rw row-number?      uint32
           |  +--rw column-number?   uint32
           +--rw height?                uint16
           +--rw width?                 uint16
           +--rw depth?                 uint16
           +--rw max-voltage?           uint16
           +--rw max-allocated-power?   uint16
           +--rw contained-chassis* [relative-position]
              +--rw relative-position    uint8
              +--rw ne-ref?              leafref
              +--rw component-ref?       leafref

  augment /nwi:network-inventory/nwi:network-elements
            /nwi:network-element:
    +--rw locations
       +--rw location*   ni-location-ref
       +--rw rack?       -> /locations/racks/rack/id

]]></artwork>
      </figure>
    </section>

    <section title="YANG Data model for Network Inventory Location">
      <t>The "ietf-ni-location" module uses types defined in <xref
      target="RFC9179"/>, <xref
      target="I-D.ietf-ivy-network-inventory-yang"/>.</t>

      <figure>
        <artwork><![CDATA[<CODE BEGINS> file="ietf-ni-location@2024-08-19.yang"
module ietf-ni-location {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-ni-location";
  prefix nil;

  import ietf-network-inventory {
    prefix nwi;
    reference
      "RFCAAAA: A YANG Data Model for Network Inventory";
  }
  import ietf-geo-location {
    prefix geo;
    reference
      "RFC 9179: A YANG Grouping for Geographic Locations";
  }

  organization
    "IETF Network Inventory YANG (ivy) Working Group";
  contact
    "WG Web:   <https://datatracker.ietf.org/wg/ivy>
     WG List:  <mailto:inventory-yang@ietf.org>

     Editor: Bo Wu
          <lana.wubo@huawei.com>
     Editor: Sergio Belotti
          <sergio.belotti@nokia.com>
     Editor: Jean-Francois Bouquier
          <jeff.bouquier@vodafone.com>
     Editor: Fabio Peruzzini
          <fabio.peruzzini@telecomitalia.it>
     Editor: Phil Bedard
          <phbedard@cisco.com>";
  description
    "This YANG module defines a model for Network Inventory
     location.

     Copyright (c) 2024 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; see
     the RFC itself for full legal notices.";

  revision 2024-08-19 {
    description
      "Initial version";
    reference
      "RFC XXXX: A YANG Data Model for Network Inventory location.";
    //RFC Editor: Please replace XXXX with actual RFC number,
    //update date information and remove this note
  }

  /* Identities */

  identity inventory-location-type {
    description
      "Base identity for network inventory location types, e.g. site,
       room, building, and floor.";
  }

  identity site {
    base inventory-location-type;
    description
      "Indicates site as location type.";
  }

  identity room {
    base inventory-location-type;
    description
      "Indicates equipment room as location type.";
  }

  identity building {
    base inventory-location-type;
    description
      "Indicates building as location type.";
  }

  /* Typedef */

  typedef ni-location-ref {
    type leafref {
      path "/nil:locations/nil:location/nil:id";
    }
    description
      "This type is used by data models that need to reference
       network inventory location.";
  }

  /* Grouping */

  grouping physical-address-grouping {
    description
      "The grouping of the physical address.";
    container physical-address {
      description
        "Top level container for the physical address.";
      leaf address {
        type string;
        description
          "Specifies an address (number and street).";
      }
      leaf postal-code {
        type string;
        description
          "Specifies a postal code.";
      }
      leaf state {
        type string;
        description
          "Specifies a state. This leaf can also be
           used to describe a region for a country that
           does not have states.";
      }
      leaf city {
        type string;
        description
          "Specifies a city.";
      }
      leaf country-code {
        type string {
          pattern '[A-Z]{2}';
        }
        description
          "Specifies a country.
           Expressed as ISO ALPHA-2 code.";
      }
    }
  }

  grouping locations-grouping {
    description
      "The grouping of the locations.";
    list location {
      key "id";
      description
        "The list of locations within the network.";
      leaf id {
        type string;
        description
          "An identifier of the location.";
      }
      uses nwi:common-entity-attributes;
      leaf type {
        type identityref {
          base inventory-location-type;
        }
        description
          "The type of network inventory location, e.g.
           equipment room, building, or site.";
      }
      leaf parent {
        type leafref {
          path "../../location/id";
        }
        description
          "The name of the location that physically contains this
           location.";
      }
      leaf-list child {
        type leafref {
          path "../../location/id";
        }
        description
          "The name of the contained child locations.";
      }
      uses physical-address-grouping;
      uses geo:geo-location;
    }
  }

  grouping rack-grouping {
    description
      "The attributes of the rack.";
    container racks {
      description
        "Top level container for the list of racks.";
      list rack {
        key "id";
        description
          "The list of racks within a location,
           e.g. equipment room.";
        leaf id {
          type string;
          description
            "An identifier that uniquely identifies the rack
             within a location, e.g. equipment room.";
        }
        uses nwi:common-entity-attributes;
        container rack-location {
          description
            "The location information of the rack, which
             comprises the name of the location, row number, and
             column number.";
          leaf location-ref {
            type ni-location-ref;
            description
              "Name of location where this rack is located.";
          }
          leaf row-number {
            type uint32;
            description
              "Identifies the row within the equipment room where
               the rack is located.";
          }
          leaf column-number {
            type uint32;
            description
              "Identifies the physical location of the rack within
               the column.";
          }
        }
        leaf height {
          type uint16;
          units "millimeter";
          description
            "Rack height.";
        }
        leaf width {
          type uint16;
          units "millimeter";
          description
            "Rack width.";
        }
        leaf depth {
          type uint16;
          units "millimeter";
          description
            "Rack depth.";
        }
        leaf max-voltage {
          type uint16;
          units "volt";
          description
            "The maximum voltage could be supported by the rack.";
        }
        leaf max-allocated-power {
          type uint16;
          units "watts";
          description
            "The maximum allocated power to the rack.";
        }
        list contained-chassis {
          key "relative-position";
          description
            "The list of chassis within a rack.";
          leaf relative-position {
            type uint8;
            description
              "A relative position of chassis within
               the rack";
          }
          leaf ne-ref {
            type leafref {
              path "/nwi:network-inventory/nwi:network-elements"
                 + "/nwi:network-element/nwi:ne-id";
            }
            description
              "The reference to the network element containing
               the chassis component.";
          }
          leaf component-ref {
            type leafref {
              path "/nwi:network-inventory/nwi:network-elements"
                 + "/nwi:network-element[nwi:ne-id=current()/.."
                 + "/ne-ref]/nwi:components/nwi:component"
                 + "/nwi:component-id";
            }
            description
              "The reference to the chassis component within
               the network element and contained by the rack.";
          }
        }
      }
    }
  }

  grouping locations-ref-grouping {
    description
      "The attributes of the locations.";
    container locations {
      description
        "The container for the location.";
      leaf-list location {
        type ni-location-ref;
        description
          "The reference of the location.";
      }
      leaf rack {
        type leafref {
          path "/nil:locations/nil:racks"
             + "/nil:rack/nil:id";
        }
        description
          "The reference to the rack.";
      }
    }
  }

  container locations {
    description
      "The top-level container for the NE location information.";
    uses locations-grouping;
    uses rack-grouping;
  }

  augment
    "/nwi:network-inventory/nwi:network-elements/nwi:network-element" {
      description
        "Provides location information for network inventory.";
      uses locations-ref-grouping;
  }
}
<CODE ENDS>]]></artwork>
      </figure>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The YANG module specified in this document defines a data schema
      designed to be accessed through network management protocols such as
      NETCONF <xref target="RFC6241"/>or RESTCONF <xref target="RFC8040"/>.
      The lowest NETCONF layer is the secure transport layer, and the required
      secure transport is Secure Shell (SSH) <xref target="RFC6242"/>. The
      lowest RESTCONF layer is HTTPS, and the required secure transport is TLS
      <xref target="RFC8446"/>.</t>

      <t>The Network Configuration Access Control Model (NACM) <xref
      target="RFC8341"/> provides a means of restricting access to specific
      NETCONF or RESTCONF users to a preconfigured subset of all available
      NETCONF or RESTCONF protocol operations and contents. Thus, NACM SHOULD
      be used to restrict the NSF registration from unauthorized users.</t>

      <t>There are a number of data nodes defined in this YANG module that are
      writable, creatable, and deletable (i.e., config true, which is the
      default). These data nodes may be considered sensitive or vulnerable in
      some network environments. Write operations to these data nodes could
      have a negative effect on network and security operations.</t>

      <t>Some of the readable data nodes in this YANG module may be considered
      sensitive or vulnerable in some network environments. It is thus
      important to control read access (e.g., via get, get-config, or
      notification) to these data nodes. These are the subtrees and data nodes
      and their sensitivity/vulnerability:</t>

      <t>&lt;&lt;&lt;to be completed&gt;&gt;&gt;</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document registers a URI in the "IETF XML Registry" <xref
      target="RFC3688"/>. Following the format in <xref target="RFC3688"/>,
      the following registration has been made.</t>

      <figure>
        <artwork><![CDATA[     URI: urn:ietf:params:xml:ns:yang:ietf-ni-location
     Registrant Contact: The IESG.
     XML: N/A, the requested URI is an XML namespace.]]></artwork>
      </figure>

      <t>This document registers a YANG module in the "YANG Module Names"
      registry<xref target="RFC7950"/> .</t>

      <figure>
        <artwork><![CDATA[     name:         ietf-ni-location
     namespace:    urn:ietf:params:xml:ns:yang:ietf-ni-location
     prefix:       nil
     maintained by IANA: N
     reference:    RFC xxxx
]]></artwork>
      </figure>
    </section>

    <section title="Acknowledgements">
      <t>The authors would like to thank the authors and contributors of <xref
      target="I-D.ietf-ccamp-network-inventory-yang"/> to trigger this work.
      During the discussion of base Network Inventory (NI) model, it is agreed
      that the definition of the equipment room and rack can be a separate
      location model and support manual configuration, while the NI model
      aggregates the inventory data of the Network Elements (NEs) on the
      network. Usually the information about sites or equipment rooms is not
      detectable by network controller and configured manually.</t>

      <t>The authors wish to thank Mohamed Boucadair and many others for their
      helpful comments and suggestions.</t>
    </section>

    <section title="Contributors">
      <t>The following authors contributed significantly to this document:</t>

      <figure>
        <artwork><![CDATA[   Italo Busi
   Huawei Technologies
   Email: italo.busi@huawei.com

   Chaode Yu
   Huawei Technologies
   Email: yuchaode@huawei.com

]]></artwork>
      </figure>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include='reference.RFC.3688'?>

      <?rfc include='reference.RFC.6242'?>

      <?rfc include='reference.RFC.7950'?>

      <?rfc include='reference.RFC.8040'?>

      <?rfc include='reference.RFC.8446'?>

      <?rfc include='reference.RFC.8341'?>

      <?rfc include="reference.RFC.8174"?>

      <?rfc include="reference.RFC.6241"?>

      <?rfc include="reference.RFC.9179"?>

      <?rfc include='reference.I-D.ietf-ivy-network-inventory-yang'?>
    </references>

    <references title="Informative References">
      <?rfc include="reference.RFC.8340"?>

      <?rfc include="reference.RFC.8342"?>

      <?rfc include='reference.RFC.8309'?>

      <?rfc include='reference.I-D.ietf-ccamp-network-inventory-yang'?>
    </references>
  </back>
</rfc>
