<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2918 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2918.xml">
<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC7854 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7854.xml">
<!ENTITY RFC6396 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6396.xml">
<!ENTITY I-D.ietf-grow-bmp-tlv SYSTEM "https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-grow-bmp-tlv.xml">
<!ENTITY I-D.ietf-grow-bmp-rel SYSTEM "https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-grow-bmp-rel.xml">
<!ENTITY I-D.petrie-grow-mrt-bmp SYSTEM "https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.petrie-grow-mrt-bmp.xml">
<!ENTITY IANA_PS_MSG_TYPE "TBD1">
<!ENTITY IANA_PS_SNAPSHOT_ID_TLV "TBD2">
<!ENTITY IANA_PS_SNAPSHOT_ERROR_TLV "TBD3">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<rfc category="std" docName="draft-lucente-grow-bmp-offline-02" ipr="trust200902" submissionType="IETF" updates="7854">
  <front>
    <title>
      BMP Snapshots
    </title>
    <author fullname="Luuk Hendriks" initials="L" surname="Hendriks">
      <organization>NLnet Labs</organization>
      <address>
        <postal>
          <street>Science Park 400</street>
          <city>Amsterdam</city>
          <code>1098 XH</code>
          <country>NL</country>
        </postal>
        <email>luuk@nlnetlabs.nl</email>
      </address>
    </author>
    <author fullname="Paolo Lucente" initials="P" surname="Lucente">
      <organization>NTT</organization>
      <address>
        <postal>
          <street>Veemweg 23</street>
          <city>Barneveld</city>
          <code>3771 MT</code>
          <country>NL</country>
        </postal>
        <email>paolo@ntt.net</email>
      </address>
    </author>
    <author fullname="Camilo Cardona" initials="C" surname="Cardona">
      <organization>NTT</organization>
      <address>
        <postal>
          <street>164-168, Carrer de Numancia</street>
          <city>Barcelona</city>
          <code>08029</code>
          <country>Spain</country>
        </postal>
        <email>camilo@ntt.net</email>
      </address>
    </author>
    <author fullname="Colin Petrie" initials="C" surname="Petrie">
      <organization>NTT</organization>
      <address>
        <postal>
          <street>Veemweg 23</street>
          <city>Barneveld</city>
          <code>3771 MT</code>
          <country>NL</country>
        </postal>
        <email>colin@ntt.net</email>
      </address>
    </author>
    <date year="2025"/>
    <area>General</area>
    <workgroup>Global Routing Operations</workgroup>
    <keyword>BMP</keyword>
    <abstract>
      <t>
        BMP (BGP Monitoring Protocol) is perfectly suited for real-time
        consumption but less ideal in stream processing and off-wire
        historical scenarios. The issue is that the necessary information to
        produce a complete view and enabling correct processing of all messages
        in the stream, is only sent out at the beginning of the BMP session.
        This document introduces the concept of BMP Snapshots, enabling BMP
        stations to synchronize mid-stream, and, providing the basis for
        self-contained, time-binned archiving of BMP data.
      </t>
    </abstract>
  </front>
  <middle>
    <section title="Introduction" anchor="Introduction">
      <t>
        BMP (BGP Monitoring Protocol) is perfectly suited for real-time
        consumption but less ideal in stream processing and off-wire
        historical scenarios. The issue is that the necessary information to
        produce a complete view and enabling correct processing of all messages
        in the stream, is only sent out at the beginning of the BMP session.
        This document introduces the concept of BMP Snapshots, enabling BMP
        stations to synchronize mid-stream, and, providing the basis for
        self-contained, time-binned archiving of BMP data.
      </t>
      <t>
        At the very start of a BMP session, two types of information are
        sent from exporter to monitor. Firstly, session state, describing all
        established BGP sessions on the monitored router. Secondly, the RIB
        contents, i.e. all the routes the monitored router has learned thus far.
        Missing either of these cause different problems: the session state
        contains information (Capabilities in the BGP Open messages,
        encapsulated in the Peer Up Notification) crucial to correctly parse
        messages in the stream, and the RIB contents represent the starting
        state to apply deltas (BGP Updates encapsulated in Route Monitoring
        messages) in the BMP stream to.
        In order to construct a complete and correct view of the
        network, one can not rely on those deltas alone. While constructing the
        state purely on deltas might, eventually, get close to the 'actual'
        state of the network, there is no control over how long one is working
        with an incorrect state, nor is there any guarantee that it ever will
        be correct.
      </t>
      <t>
        There is no mechanism in BMP to facilitate the synchronisation of either
        the session state or the RIB contents mid-stream. 
        <xref target="I-D.ietf-grow-bmp-tlv">
          Stateless Parsing TLVs
        </xref>
        could provide the required parsing information, but there is no
        guarantee these are present and even if they are, they do not cover
        for all the missing session information.
      </t>
      <t>
        This document introduces Snapshots, enabling synchronisation of both
        BGP session information and RIB contents anywhere in a BMP session.
        A Snapshot is not one single message, but a collection of messages, all
        containing a Snapshot Id TLV (introduced in this document) carrying the
        same Snapshot Id. The session state and RIB contents are carried in Peer
        Up Notification messages and Route Monitoring messages, respectively,
        exactly like the initial synchronisation upon establishment of a new BMP
        session.
        In addition to the Peer Up Notification and Route Monitoring messages,
        two Snapshot Messages (introduced in this document) are included
        in a Snapshot. One preceding all the other messages, signalling the
        start of the Snapshot and optionally containing TLVs carrying metadata
        about the Snapshot. And one Snapshot Message at the very end,
        signalling the end of the Snapshot, again optionally containing TLVs
        carrying metadata. These TLVs are described in
        <xref target="meta-data-tlvs"/>.
      </t>
    <section title="Exporter vs Station">
    <t>
      The new concepts described in this document are not restricted to
      either the BMP exporter or the BMP station, as all newly introduced pieces
      are in-protocol and do not rely on any specific characteristic of either
      exporter or station.
      However, as the process of emitting a Snapshot can presumably be
      expensive, it is not to be expected that BMP exporter implementations on
      routers will support the concepts introduced in this document. A BMP
      station on the other hand, likely has more resources available and will
      have received all the necessary information (in terms of session state and
      RIB contents) from the router already. To not burden limited routers
      more than necessary, the authors assume the 'first' BMP station implements
      the concepts described so any stations 'downstream' can leverage the
      Snapshot functionality, while not imposing any additional load on the
      router originally emitting the BMP stream.
    </t>
    <section title="Considerations regarding alternative approaches">
        <t>
          <cref>
            This section is included as a record of discussion, and is to be
            removed/reduced at a later stage.
          </cref>
        </t>
        <t>
          Emitting all contents of a RIB is very similar, if not identical, to
          the process of a Route Refresh <xref target="RFC2918"/>.
          For routers exporting BMP streams, the assumption is that they support
          Route Refresh.
          The authors evaluated if mimicking a Route Refresh could provide
          functionality similar to Snapshots, but at lower (computational)
          cost. While a full overview of key features/requirements is listed in
          <xref target="tbl-comparison-rr"/>,
            it was concluded that a Route Refresh lacks (too) many of the
            features of a Snapshot. Moreover, it would still be considered too
            expensive to perform on any regular basis on routers.
        </t>
        <table anchor="tbl-comparison-rr">
            <name>
                Overview of feature/requirement comparison between the approach
                described in this document and a approach based on Route Refresh
                messages
            </name>
            <thead>
                <tr>
                    <td></td>
                    <td>Snapshots</td>
                    <td>Route Refresh</td>
                </tr>
            </thead>
            <tbody>
                <tr><td colspan="3">Feature/quality:</td></tr>
                <tr><td>In-protocol</td>              <td>y</td><td>y</td></tr>
                <tr><td>Signal begin/end</td>         <td>y</td><td>y</td></tr>
                <tr><td>RIB contents</td>             <td>y</td><td>y</td></tr>
                <tr><td>Session info</td>             <td>y</td><td>n</td></tr>
                <tr><td>Distinguish sync vs live</td> <td>y</td><td>n</td></tr>
                <tr><td>Distinguish between syncs</td><td>y</td><td>n</td></tr>
                <tr><td>Per address family</td>       <td>y</td><td>y</td></tr>
                <tr><td>Additional metadata</td>      <td>y</td><td>n</td></tr>
                <tr><td>Extensible</td>               <td>y</td><td>n</td></tr>
                <tr><td>Expensive</td>                <td>y</td><td>Less</td></tr>

                <tr><td colspan="3">Protocol requirement:</td></tr>
                <tr><td>New message type or TLV</td>   <td>both</td><td>either</td></tr>
        </tbody>
        </table>
    </section>
  </section>
  <section title="Flexibility and extensibility">
    <t>
      By building upon TLVs,
      supported in all BMP message types from BMPv4, the Snapshot approach
      imposes minimal requirements over the initial synchronisation in BMP
      today. Furthermore, if at any point in the future another message
      type needs to be incorporated in a Snapshot, it will be a simple
      matter of attaching the Snapshot Id TLV to those messages. No
      existing message types have to be adapted to support Snapshots.
    </t>
  </section>

    </section>
    <section title="Terminology">
      <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">RFC 2119</xref>
        <xref target="RFC8174">RFC 8174</xref>
        when, and only when, they
        appear in all capitals, as shown here.
      </t>
      <section title="Terms in this document">
        <dl>
          <dt>Exporter:</dt>
          <dd>
            <t>
              The sender of BMP messages over the TCP session. This could be a
              router, or a BMP Station sending BMP messages onwards.
            </t>
          </dd>
          <dt>Station:</dt>
          <dd>
            <t>
              The receiver of BMP messages. Colloquially also often called the
              'collector'. A Station receives BMP messages from an Exporter. If
              a Station sends out BMP messages, it is considered an Exporter for
              those egress connections.
            </t>
          </dd>
          <dt>Snapshot:</dt>
          <dd>
            <t>
              The logical concept of a collection of Peer Up Notification
              messages and Route Monitoring messages, preceded and followed by a
              Snapshot Message. A Snapshot is not a single message/PDU itself.
            </t>
          </dd>
          <dt>Snapshot Message:</dt>
          <dd>
            <t>
              A BMP message type, introduced in this document, to signal the
              start or end of a Snapshot. The first and last message of a
              Snapshot are of this message type.
            </t>
          </dd>
          <dt>Snapshot message</dt>
          <dd>
            <t>
              A BMP message that is part of a Snapshot, but not of type Snapshot
              Message. For example, a Route Monitoring message that is part of a
              Snapshot is considered a Snapshot message.
            </t>
          </dd>
        </dl>
      </section>
    </section>
    <section title="Snapshot Message" anchor="snapshot-message">
      <t>
      Every Snapshot contains exactly two messages of the Snapshot Message type: one
      Snapshot Message preceding all the Peer Up Notifications and Route Monitoring messages
      containing the actual data, and one Snapshot Message to signal the end.
      Both follow the same wireformat.
      </t>

      <section title="Wireformat">
        <t>
          The Snapshot Message starts with a BMP Common Header as
            defined in <xref target="RFC7854">Section 4.1 of</xref>.
            The Common Header is directly followed by TLVs. The
            Snapshot Id TLV defined in <xref target="snapshot-id-tlv"/> MUST be
            present and SHOULD be the first of the TLVs. All additional TLVs
            listed in <xref target="meta-data-tlvs"/> are optional.

<figure title="The Snapshot Message wireformat, including the BMP Common Header and
the Snapshot Id TLV."><artset><artwork  type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="336" width="528" viewBox="0 0 528 336" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
<path d="M 8,64 L 8,304" fill="none" stroke="black"/>
<path d="M 136,64 L 136,96" fill="none" stroke="black"/>
<path d="M 136,128 L 136,160" fill="none" stroke="black"/>
<path d="M 264,160 L 264,224" fill="none" stroke="black"/>
<path d="M 520,96 L 520,128" fill="none" stroke="black"/>
<path d="M 520,160 L 520,192" fill="none" stroke="black"/>
<path d="M 520,224 L 520,304" fill="none" stroke="black"/>
<path d="M 8,64 L 136,64" fill="none" stroke="black"/>
<path d="M 8,96 L 520,96" fill="none" stroke="black"/>
<path d="M 8,128 L 520,128" fill="none" stroke="black"/>
<path d="M 8,160 L 520,160" fill="none" stroke="black"/>
<path d="M 8,192 L 520,192" fill="none" stroke="black"/>
<path d="M 8,224 L 520,224" fill="none" stroke="black"/>
<path d="M 8,304 L 520,304" fill="none" stroke="black"/>
<g class="text">
<text x="16" y="36">0</text>
<text x="176" y="36">1</text>
<text x="336" y="36">2</text>
<text x="496" y="36">3</text>
<text x="16" y="52">0</text>
<text x="32" y="52">1</text>
<text x="48" y="52">2</text>
<text x="64" y="52">3</text>
<text x="80" y="52">4</text>
<text x="96" y="52">5</text>
<text x="112" y="52">6</text>
<text x="128" y="52">7</text>
<text x="144" y="52">8</text>
<text x="160" y="52">9</text>
<text x="176" y="52">0</text>
<text x="192" y="52">1</text>
<text x="208" y="52">2</text>
<text x="224" y="52">3</text>
<text x="240" y="52">4</text>
<text x="256" y="52">5</text>
<text x="272" y="52">6</text>
<text x="288" y="52">7</text>
<text x="304" y="52">8</text>
<text x="320" y="52">9</text>
<text x="336" y="52">0</text>
<text x="352" y="52">1</text>
<text x="368" y="52">2</text>
<text x="384" y="52">3</text>
<text x="400" y="52">4</text>
<text x="416" y="52">5</text>
<text x="432" y="52">6</text>
<text x="448" y="52">7</text>
<text x="464" y="52">8</text>
<text x="480" y="52">9</text>
<text x="496" y="52">0</text>
<text x="512" y="52">1</text>
<text x="72" y="84">Version=4</text>
<text x="232" y="116">Message</text>
<text x="292" y="116">Length</text>
<text x="332" y="116">&gt;=</text>
<text x="352" y="116">6</text>
<text x="368" y="116">+</text>
<text x="384" y="116">6</text>
<text x="400" y="116">+</text>
<text x="420" y="116">16</text>
<text x="32" y="148">Msg</text>
<text x="88" y="148">Type=TBD1</text>
<text x="88" y="180">TLV</text>
<text x="124" y="180">Type</text>
<text x="152" y="180">=</text>
<text x="180" y="180">TBD2</text>
<text x="364" y="180">Length</text>
<text x="400" y="180">=</text>
<text x="420" y="180">16</text>
<text x="96" y="212">Index</text>
<text x="128" y="212">=</text>
<text x="164" y="212">0x0000</text>
<text x="204" y="260">Snapshot</text>
<text x="252" y="260">Id</text>
<text x="280" y="260">(16</text>
<text x="328" y="260">octets)</text>
</g>
</svg>
</artwork><artwork  type="ascii-art"><![CDATA[
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +---------------+
  |   Version=4   |
  +---------------+-----------------------------------------------+
  |                        Message Length >= 6 + 6 + 16           |
  +---------------+-----------------------------------------------+
  | Msg Type=TBD1 |
  +---------------+---------------+-------------------------------+
  |        TLV Type = TBD2        |         Length = 16           |
  +-------------------------------+-------------------------------+
  |        Index = 0x0000         |
  +-------------------------------+-------------------------------+
  |                                                               |
  |                    Snapshot Id (16 octets)                    |
  |                                                               |
  |                                                               |
  +---------------------------------------------------------------+
]]></artwork></artset></figure>
          </t>
          <t>
            The Snapshot (Messages) can be generated by a BMP exporter or
            by a BMP station, as long as all required data for the
            Peer Up Notification and Route Monitoring messages pertaining to
            the Snapshot are available. The Snapshot Message MUST be
            followed by those messages, with the Snapshot Id TLV attached to
            every message. Finally, the end of the Snapshot is signalled by
            another Snapshot Message. An example flow of these messages is
            visualized in <xref target="fig-flow"/>.
          </t>

<figure title="Flow of messages in a Snapshot, from exporter to station" anchor="fig-flow"><artset><artwork  type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="272" width="568" viewBox="0 0 568 272" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px" stroke-linecap="round">
<path d="M 8,64 L 8,128" fill="none" stroke="black"/>
<path d="M 96,64 L 96,128" fill="none" stroke="black"/>
<path d="M 112,64 L 112,192" fill="none" stroke="black"/>
<path d="M 200,64 L 200,192" fill="none" stroke="black"/>
<path d="M 216,64 L 216,192" fill="none" stroke="black"/>
<path d="M 304,64 L 304,192" fill="none" stroke="black"/>
<path d="M 320,64 L 320,192" fill="none" stroke="black"/>
<path d="M 432,64 L 432,192" fill="none" stroke="black"/>
<path d="M 448,64 L 448,192" fill="none" stroke="black"/>
<path d="M 536,64 L 536,192" fill="none" stroke="black"/>
<path d="M 8,64 L 96,64" fill="none" stroke="black"/>
<path d="M 112,64 L 200,64" fill="none" stroke="black"/>
<path d="M 216,64 L 304,64" fill="none" stroke="black"/>
<path d="M 320,64 L 432,64" fill="none" stroke="black"/>
<path d="M 448,64 L 536,64" fill="none" stroke="black"/>
<path d="M 8,96 L 96,96" fill="none" stroke="black"/>
<path d="M 112,96 L 200,96" fill="none" stroke="black"/>
<path d="M 216,96 L 304,96" fill="none" stroke="black"/>
<path d="M 320,96 L 432,96" fill="none" stroke="black"/>
<path d="M 448,96 L 536,96" fill="none" stroke="black"/>
<path d="M 8,128 L 96,128" fill="none" stroke="black"/>
<path d="M 448,128 L 536,128" fill="none" stroke="black"/>
<path d="M 112,160 Q 114,156.8 116,160 Q 118,163.2 120,160 Q 122,156.8 124,160 Q 126,163.2 128,160 Q 130,156.8 132,160 Q 134,163.2 136,160 Q 138,156.8 140,160 Q 142,163.2 144,160 Q 146,156.8 148,160 Q 150,163.2 152,160 Q 154,156.8 156,160 Q 158,163.2 160,160 Q 162,156.8 164,160 Q 166,163.2 168,160 Q 170,156.8 172,160 Q 174,163.2 176,160 Q 178,156.8 180,160 Q 182,163.2 184,160 Q 186,156.8 188,160 Q 190,163.2 192,160 Q 194,156.8 196,160 Q 198,163.2 200,160 " fill="none" stroke="black"/>
<path d="M 216,160 Q 218,156.8 220,160 Q 222,163.2 224,160 Q 226,156.8 228,160 Q 230,163.2 232,160 Q 234,156.8 236,160 Q 238,163.2 240,160 Q 242,156.8 244,160 Q 246,163.2 248,160 Q 250,156.8 252,160 Q 254,163.2 256,160 Q 258,156.8 260,160 Q 262,163.2 264,160 Q 266,156.8 268,160 Q 270,163.2 272,160 Q 274,156.8 276,160 Q 278,163.2 280,160 Q 282,156.8 284,160 Q 286,163.2 288,160 Q 290,156.8 292,160 Q 294,163.2 296,160 Q 298,156.8 300,160 Q 302,163.2 304,160 " fill="none" stroke="black"/>
<path d="M 320,160 Q 322,156.8 324,160 Q 326,163.2 328,160 Q 330,156.8 332,160 Q 334,163.2 336,160 Q 338,156.8 340,160 Q 342,163.2 344,160 Q 346,156.8 348,160 Q 350,163.2 352,160 Q 354,156.8 356,160 Q 358,163.2 360,160 Q 362,156.8 364,160 Q 366,163.2 368,160 Q 370,156.8 372,160 Q 374,163.2 376,160 Q 378,156.8 380,160 Q 382,163.2 384,160 Q 386,156.8 388,160 Q 390,163.2 392,160 Q 394,156.8 396,160 Q 398,163.2 400,160 Q 402,156.8 404,160 Q 406,163.2 408,160 Q 410,156.8 412,160 Q 414,163.2 416,160 Q 418,156.8 420,160 Q 422,163.2 424,160 Q 426,156.8 428,160 Q 430,163.2 432,160 " fill="none" stroke="black"/>
<path d="M 448,160 L 536,160" fill="none" stroke="black"/>
<path d="M 112,192 L 200,192" fill="none" stroke="black"/>
<path d="M 216,192 L 304,192" fill="none" stroke="black"/>
<path d="M 320,192 L 432,192" fill="none" stroke="black"/>
<path d="M 448,192 L 536,192" fill="none" stroke="black"/>
<path d="M 8,208 L 536,208" fill="none" stroke="black"/>
<polygon class="arrowhead" points="544,208 532,202.4 532,213.6" fill="black" transform="rotate(0,536,208)"/>
<g class="text">
<text x="56" y="36">(End-of-)</text>
<text x="492" y="36">(Start-of)</text>
<text x="52" y="84">Snapshot</text>
<text x="156" y="84">RouteMon</text>
<text x="260" y="84">RouteMon</text>
<text x="376" y="84">PeerUpNotif</text>
<text x="492" y="84">Snapshot</text>
<text x="36" y="116">Id</text>
<text x="64" y="116">TLV</text>
<text x="476" y="116">Id</text>
<text x="504" y="116">TLV</text>
<text x="476" y="148">Meta</text>
<text x="512" y="148">TLV</text>
<text x="140" y="180">Id</text>
<text x="168" y="180">TLV</text>
<text x="244" y="180">Id</text>
<text x="272" y="180">TLV</text>
<text x="348" y="180">Id</text>
<text x="376" y="180">TLV</text>
<text x="476" y="180">Meta</text>
<text x="512" y="180">TLV</text>
<text x="40" y="244">Exporting</text>
<text x="100" y="244">side</text>
<text x="472" y="244">Station</text>
<text x="524" y="244">side</text>
</g>
</svg>
</artwork><artwork  type="ascii-art"><![CDATA[
  (End-of-)                                             (Start-of)

+----------+ +----------+ +----------+ +-------------+ +----------+   
| Snapshot | | RouteMon | | RouteMon | | PeerUpNotif | | Snapshot |   
+----------+ +----------+ +----------+ +-------------+ +----------+   
|  Id TLV  | |          | |          | |             | |  Id TLV  |   
+----------+ |          | |          | |             | +----------+   
             |          | |          | |             | | Meta TLV |   
             +~~~~~~~~~~+ +~~~~~~~~~~+ +~~~~~~~~~~~~~+ +----------+   
             |  Id TLV  | |  Id TLV  | |  Id TLV     | | Meta TLV |   
             +----------+ +----------+ +-------------+ +----------+
------------------------------------------------------------------>

Exporting side                                         Station side

]]></artwork></artset></figure>

        </section>
      <section title="Start-of-snapshot">
        <t>
          The Snapshot Message preceding all other messages in the Snapshot MUST
          contain the Snapshot Id TLV, and should also contain TLVs providing
          useful metadata for the consumer of the Snapshot. For example, the
          timestamp of snapshot generation, and information about the exporter
          (IP address, software version). Furthermore, they can describe which
          address families are included in the snapshot, and for which RIB views
          (e.g. Adj-RIB-In Pre-policy). Note that, as all meta-data TLVs are
          optional, a consumer of snapshots should never rely on presence of any
          of these TLVs.
        </t>
      </section>
      <section title="End-of-snapshot">
        <t>
          After all Peer Up Notification and Route Monitoring messages of the
          Snapshot, the end of the Snapshot is signalled by means of another
          Snapshot Message. This Snapshot Message MUST contain the Snapshot Id TLV
          like all other messages comprising the Snapshot. This Snapshot Message
          can also contain meta-data TLVs, most notably the Snapshot Error TLV.
          If, for whatever reason, the sending side can not complete the
          Snapshot, it MUST send a Snapshot Message containing a Snapshot Error
          TLV to signal the Snapshot is incomplete and/or incorrect. For
          discussion on operational consequences, see
          <xref target="snapshot-error"/>.
        </t>
      </section>
    </section>
    <section title="Snapshot Information TLVs">
      <section title="Snapshot Id TLV" anchor="snapshot-id-tlv">
        <t>
          The Snapshot Id TLV is the only mandatory TLV of a 
          Snapshot Message as defined in
          <xref target="snapshot-message"/>.
          It is an indexed TLV (as it will be included in Route Monitoring
          messages, with index zero), structured as defined
          in
          <xref target="I-D.ietf-grow-bmp-tlv" section="4"/>,
          with a fixed value length of 16 bytes. This allows the
          use of UUID identifiers, or provides sufficient space
          for alternative schemes. Different approaches for schemes
          are discussed in
          <xref target="opcon"/>.
        </t>
      </section>
      <section title="Snapshot Error TLV">
        <t>
          The Snapshot Error TLV is used to signal that a sender can not
          complete a currently in-flight Snapshot, and MUST be included in the
          End-of-snapshot Snapshot Message the sender sends to signal the end of
          the (in this case incorrect/incomplete) Snapshot. Sending out the
          End-of-snapshot Snapshot Message is crucial, as failing to do so
          leaves the consuming end in a state where it expects more messages
          pertaining to the Snapshot.

          The value in a Snapshot Error TLV is a UTF-8 string of arbitrary
          length, describing the failure reason.
          Note that the Snapshot Error TLV is useful for live connections, but
          less so for offline data on persistent storage: as it's clear the
          Snapshot is incorrect or incomplete, one would likely want to replace
          it with a valid Snapshot instead of archiving the incorrect one. 
        </t>
      </section>
      <section title="Optional meta-data TLVs" anchor="meta-data-tlvs">
        <t>
          The Snapshot Message SHOULD carry TLVs providing additional
          information on the BMP session being summarized. These Snapshot
          Information TLVs describe the BMP exporter and station involved,
          and the date and time the snapshot was generated. By embedding
          these TLVs in the offline file, a consumer of the file does not
          have to rely on the filename or other external data to get these
          types of information. All TLVs are non-indexed.
          <list style="symbols"><t>
            Type = TBD4: Datetime of snapshot
              <list style="empty"><t>
                Length: 8 bytes
                  </t><t>
                  Value: 64bit UNIX epoch, in seconds
              </t></list>
              </t><t>
              Type = TBD5: Exporter IP address
              <list style="empty"><t>
                Length: 16 bytes
                  </t><t>
                  Value: IPv6 or IPv4-mapped IPv6 address
              </t></list>
              </t><t>
              Type = TBD6: Exporter sysName
              <list style="empty"><t>
                Length: variable, non-zero, describing the number of bytes
                  </t><t>
                  Value: UTF-8 string
              </t></list>
              </t><t>
              Type = TBD7: Exporter sysDesc
              <list style="empty"><t>
                Length: variable, non-zero, describing the number of bytes
                  </t><t>
                  Value: UTF-8 string
              </t></list>
              </t><t>
              Type = TBD8: Station IP address
              <list style="empty"><t>
                Length: variable, non-zero, describing the number of bytes
                  </t><t>
                  Value: IPv6 or IPv4-mapped IPv6 address
              </t></list>
              </t><t>
              Type = TBD9: Station sysName
              <list style="empty"><t>
                Length: variable, non-zero, describing the number of bytes
                  </t><t>
                  Value: UTF-8 string
              </t></list>
              </t><t>
              Type = TBD10: Station sysDesc
              <list style="empty"><t>
                Length: variable, non-zero, describing the number of bytes
                  </t><t>
                  Value: UTF-8 string
              </t></list>
          </t></list>
        </t>
      </section>
    </section>
  <section title="Backwards (in)compatibility">
    <t>
      If an implementation lacking support for Snapshots receives a Snapshot, it
      should ignore the Snapshot Messages and the Snapshot Id TLVs, as these are
      all optional. However, this reduces a Snapshot to a set of Peer Up
      Notification and Route Monitoring messages indistinguishable from 'normal'
      Peer Up Notification and Route Monitoring messages. This introduces the
      following problems:
      <list style="symbols">
        <t>
          Peer Up Notifications from a Snapshot will be interpreted as normal
          Peer Up Notifications, though for a peer that was already considered
          'up'. This situation is not explicitly described in
          <xref target="RFC7854" section="3.3"/>,
          and can be considered unexpected.
          Even though application of Peer Up Notifications could be considered
          idempotent (the state after processing the message is 'this peer is
          up' regardless of how often that message is received and processed),
          receiving the message implicitly signals the peer was down
          before, which is incorrect, and is possibly a source of confusion.
        </t>
        <t>
          Route Monitoring messages from a Snapshot interpreted as normal Route
          Monitoring messages would not come as unexpected in the life cycle of
          a BMP session. Similarly to Peer Up Notification messages, their
          application is idempotent in nature as the result of processing the
          message is 'this route is reachable'. Note that Route Monitoring
          messages from a Snapshot will always be announcements, not
          withdrawals. However, as with Peer Up Notification messages, a normal
          Route Monitoring message implicitly signals 'this route was not
          reachable before' or 'attributes for this route have changed',
          which is incorrect in the case of Route Monitoring messages that were
          actually part of a Snapshot.
        </t>
      </list>
    </t>

    <section title="Possible workaround">
      <t>
        <list style="symbols">
          <t>
            Partial support on the consuming side: dropping messages based on
            Snapshot Id TLV presence
            <t>
              If a station implementation does not support Snapshots, it
              should be able to recognize Snapshot Id TLVs relatively easily.
              With BMPv4, the BGP Update is carried in a TLV in the Route
              Monitoring message, so any implementation will be able to process
              TLVs to a certain extent. It then only needs to be aware of the
              type code of the Snapshot Id TLV type: as all messages in a
              Snapshot will carry a TLV of this type, the implementation can
              simply skip/drop those messages, and preclude any of the problems
              described above.
            </t>
            <t>
            </t>
          </t>
          <t>
            In-protocol: Introducing a flag in the Per Peer Header
            <t>
              Setting a flag for messages that are part of a Snapshot will allow
              consumers to distinguish between such messages and 'normal' Peer
              Up Notification and Route Monitoring messages. An additional
              benefit of a flag would be the enabling of optimisations on
              the receiving end, where messages pertaining to a Snapshot can now
              easily be treated differently (specific queue or thread) or
              discarded in case the receiver has not interest in Snapshots.
            </t>
            <t>
              Note that this approach also requires (minimal) changes to the
              receiving side, namely the recognition of such a flag.
            </t>
          </t>
        </list>
      </t>
    </section>
  </section>
    <section title="Third party off-wire encoding formats">
      <t>
        While this document does define a way to facilitate stream processing,
        replay and, more in general, consumption of raw BMP data offline,
        similar benefits may be harnessed by third party off-wire formats in
        replay and, more in general, consumption of raw BMP data offline,
        similar benefits may be harnessed by third party off-wire formats in
        which BMP can be encapsulated into, for example MRT (Multi-Threaded
        Routing Toolkit) as defined by
        <xref target="RFC6396">RFC 6396</xref>.
        As a result of that, this document does not recommend a preferred way
        to stream process or store BMP data offline.
      </t>
    </section>
    <section title="Operational Considerations" anchor="opcon">
      <section title="End-of-snapshot with an Error TLV" anchor="snapshot-error">
        <t>
          Receiving a Snapshot Message containing a Snapshot Error TLV signals
          the Snapshot is incomplete or incorrect. Possible actions at this
          point depend on the situation, on who is consuming the Snapshot, and
          to which end. In an online scenario where the Snapshot was explicitly
          requested (see also <xref target="sec-trigger"/>), one could opt for a
          retry by requesting another Snapshot.
          If one encounters an Error TLV in a Snapshot Message part of archived,
          offline data, there is no way to request a new Snapshot. While such a
          Snapshot could be used to infer some things, it can not be used to
          rebuild a complete view of the network.
        </t>
      </section>
      <section title="Snapshot Id scheme ">
        <t>
          The generation and form of the Snapshot Ids introduced in this
          document is left to implementations. This document does not
          enforce any specific approach, though at least the following
          points should be considered. Note that implementations are not
          limited to supporting only one Id scheme, but ideally support
          multiple schemes via local configuration.
        </t>
        <section title="Global uniqueness">
          <t>
            In deployments where information is received from multiple
            BMP vantage points, unique Snapshot Ids might prove handy or
            even crucial in order to distinguish Snapshot A originally
            sent by BMP exporter X, from Snapshot B sent by exporter Y.
            If all exporting processes rely on an algorithm producing
            globally unique identifiers, e.g. UUID version 4, they all
            can send out Snapshots without possibly using an identical
            Snapshot Id generated by another exporter.
          </t>
        </section>
        <section title="Increasing identifiers">
          <t>
            Generating (linearly) increasing identifiers enable the BMP
            station to order Snapshots, and, to spot any missing
            Snapshots. Furthermore, in a (long running) BMP session where
            the exporter generates Snapshots, the Snapshot Id doubles as
            a counter signalling how many Snapshots have been sent so
            far. Note that some of these can be deduced via
            other means: ordering of Snapshots can be done based
            on the Timestamp TLV (TBD3), and the number of sent
            Snapshots could be included in the Stats Report
            message (<xref target="RFC7854" section="4.8"/>).
          </t>
        </section>
      </section>
      <section title="Requesting/triggering snapshots" anchor="sec-trigger">
        <t>
          BMP being a unidirectional protocol from exporter to station means there
          is no way for a station to request or trigger the creation of a
          Snapshot in-protocol. This document does not define or advocate for any
          specific out-of-band way to do such triggering. But as any
          implementation of Snapshots requires at least one way to trigger their
          creation, some possible approaches are briefly discussed.
        </t>
        <section title="Timer-based">
          <t>
            An exporter could be configured to generate and emit Snapshots on a
            regular interval, without a request from the station. Depending on
            the timing parameters and the size of the Snapshots (i.e, the
            amount of sessions and routes), this might cause high loads on
            either or both sides of the BMP session. This approach should only
            be considered if the station needs a full view on a regular basis,
            which is not necessary in typical deployments.
          </t>
          <t>
            A timer-based approach could be a suitable approach for a station
            generating Snapshots and writing them to persistent storage, e.g.
            doing time-binned historical archiving.
          </t>
        </section>
        <section title="Manual triggers">
          <t>
            In situations where a Snapshot is only used to recover from a broken
            state at a station (either directly connected to the exporter or a
            station further downstream), a dedicated command on the exporter to
            generate and emit a Snapshot could be used. 
          </t>
          <t>
            Note that, for most situations where the station is directly
            connected to the exporter, a re-establishing the TCP connection for
            the BMP stream might be a simpler and perhaps even cheaper
            alternative.
          </t>
        </section>
        <section title="Out-of-band request via other protocols">
          <t>
            For more complex setups where e.g. the BMP messages continue on
            a messages bus, the generation and sending of Snapshots could be
            requested via that message bus or another protocol/API. Such
            requests could include parameters to ask for a Snapshot containing
            only a subset of all the data, e.g. only a certain address family,
            or only a certain RIB view.
            The concept of Snapshots as described in this document allows
            for such subsets, but such an out-of-band protocol and its
            parameters are out of scope.
          </t>
        </section>
      </section>
    </section>
    <section title="Discussion">
      <section title="No EoRs in Snapshots">
        <t>
          This document describes the logical concept of a Snapshot as a
          collection of Peer Up Notifications and Route Monitoring messages,
          preceded and followed by a Snapshot Message. Comparing this to the
          initial synchronisation at the start of a BMP session, there is a
          discrepancy, as the Snapshot does not include EoRs to signal a RIB
          (view) has been fully sent. An EoR in this context is a
          RouteMonitoring message for a certain RIB view (e.g. Adj-RIB-In
          Post-policy, as defined by the flags in the Per Peer Header),
          containing a BGP Update for a certain address family with no
          announcements and no withdrawals.
        </t>
        <t>
          With the Snapshot Message signalling end-of-snapshot, the EoRs are not
          a necessity. One reason for inclusion would be consistency, though the
          current state of EoRs seems to be inconsistent between
          implementations, and the text describing them leaves room for
          interpretation. Including EoRs in a Snapshot perhaps only
          adds to the confusion, and therefore leaving them out could be
          preferable.
        </t>
      </section>
    </section>
    <section title="Security Considerations">
      <t>
        It is not believed that this document adds any additional security
        considerations.
      </t>
    </section>
    <section title="IANA Considerations">
      <t>
        IANA is asked to allocate a new Snapshot Message type in the BMP
        Message Types registry with value &IANA_PS_MSG_TYPE;. IANA is also asked
        to create a registry within the BMP group, named "BMP Snapshot
        Message TLVs".
      </t>
      <t>
        Registration procedures for this new registry are:
      </t>
      <t>
        <cref>
          Note that these have been adapted to the proposed ranges as described
          in <xref target="I-D.ietf-grow-bmp-tlv"/> version -19.
        </cref>
      </t>
      <texttable>
        <ttcol align="center">
          Range
        </ttcol>
        <ttcol align="center">
          Registration Procedures
        </ttcol>
        <c>0-16383</c>
        <c>Standards Action</c>
        <c>16384-32767</c>
        <c>First Come, First Served</c>
        <c>65535</c>
        <c>Reserved</c>
      </texttable>
      <t>
        Initial values for this registry are:
      </t>
      <t>
        <cref>
          Update this table once we have converged on
          <xref target="meta-data-tlvs"/>.
        </cref>
      </t>
      <texttable>
        <ttcol align="center">
          Type
        </ttcol>
        <ttcol align="center">
          Description
        </ttcol>
        <ttcol align="center">
          Reference
        </ttcol>
        <c>&IANA_PS_SNAPSHOT_ID_TLV;</c>
        <c>Snapshot Id</c>
        <c>this document</c>
        <c>&IANA_PS_SNAPSHOT_ERROR_TLV;</c>
        <c>Snapshot Error</c>
        <c>this document</c>
      </texttable>
      <t>
        IANA is also asked to allocate codepoints for the Snapshot Id TLVs in
        the BMP Peer Up Message TLV registery and the BMP Route Monitoring TLV
        registery. Considering the Snapshot Id TLV then appears in three
        registries, ideally the same codepoint is allocated in all registries.
        However, this will not be possible without introducing gaps in the
        registries, which might be undesirable.
      </t>
    </section>
  </middle>
  <back>
    <references title="Normative References">
    &RFC2119; &RFC8174;
    <?rfc include="reference.RFC.7854.xml"?>
    <?rfc include="reference.RFC.6396.xml"?>

      &I-D.ietf-grow-bmp-tlv;
      &I-D.ietf-grow-bmp-rel; &I-D.petrie-grow-mrt-bmp;
    </references>
    <references title="Informative References">
    &RFC2918;
    </references>
    <section anchor="Acknowledgements" title="Acknowledgements" numbered="no">
      <t>
        TBD
      </t>
    </section>
  </back>
</rfc>
