Bug-3075: BMP messages yang model 31/20231/16
authorMilos Fabian <milfabia@cisco.com>
Sat, 23 May 2015 20:01:55 +0000 (22:01 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 2 Jun 2015 14:20:58 +0000 (14:20 +0000)
-created yang model reprsenting BMP v3 messages
-ref.: https://tools.ietf.org/html/draft-ietf-grow-bmp-07

Change-Id: I2ef8b52d12f397c95bb69781c7bb4af0f4477bb2
Signed-off-by: Milos Fabian <milfabia@cisco.com>
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
bgp/bmp-api/.project [new file with mode: 0644]
bgp/bmp-api/pom.xml [new file with mode: 0644]
bgp/bmp-api/src/main/yang/bmp-message.yang [new file with mode: 0644]
bgp/pom.xml

diff --git a/bgp/bmp-api/.project b/bgp/bmp-api/.project
new file mode 100644 (file)
index 0000000..5ce11a4
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>bgp-bmp-api</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/bgp/bmp-api/pom.xml b/bgp/bmp-api/pom.xml
new file mode 100644 (file)
index 0000000..2724e73
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <scm>
+        <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
+        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
+        <url>https://wiki.opendaylight.org/view/BGP_LS_PCEP:Main</url>
+        <tag>HEAD</tag>
+    </scm>
+    <parent>
+        <groupId>org.opendaylight.bgpcep</groupId>
+        <artifactId>bgp-parent</artifactId>
+        <version>0.5.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>bgp-bmp-api</artifactId>
+    <description>BMP API</description>
+    <packaging>bundle</packaging>
+    <name>${project.artifactId}</name>
+    <prerequisites>
+        <maven>3.0.4</maven>
+    </prerequisites>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-inet-types</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-yang-types</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-buffer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bgp-parser-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bgp-rib-api</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+      <plugins>
+          <plugin>
+              <groupId>org.opendaylight.yangtools</groupId>
+              <artifactId>yang-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+              <groupId>org.apache.felix</groupId>
+              <artifactId>maven-bundle-plugin</artifactId>
+              <extensions>true</extensions>
+              <configuration>
+                  <instructions>
+                      <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  </instructions>
+              </configuration>
+          </plugin>
+      </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/bgp/bmp-api/src/main/yang/bmp-message.yang b/bgp/bmp-api/src/main/yang/bmp-message.yang
new file mode 100644 (file)
index 0000000..e9c84a3
--- /dev/null
@@ -0,0 +1,495 @@
+module bmp-message {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:bmp-message";
+    prefix "bmp-msg";
+
+    import bgp-message { prefix bgp-msg; revision-date 2013-09-19; }
+    import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
+    import ietf-yang-types { prefix yang; revision-date 2010-09-24; }
+
+    organization "Cisco Systems, Inc.";
+    contact "Milos Fabian <milfabia@cisco.com>";
+
+    description
+        "This module contains the base data model of a BMP messages.
+        It rolls up the definitions contained in draft-ietf-grow-bmp-07.
+
+        Copyright (c)2015 Cisco Systems, Inc. All rights reserved.
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+   reference
+        "https://tools.ietf.org/html/draft-ietf-grow-bmp-07";
+
+    revision "2015-05-12" {
+        description
+            "Initial revision.";
+    }
+
+    typedef reason {
+        type enumeration {
+            enum administratively-closed {
+                value 0;
+                description
+                    "Session administratively closed.";
+            }
+            enum unspecified {
+                value 1;
+                description
+                    "Unspecified reason.";
+            }
+            enum out-of-resources {
+                value 2;
+                description
+                    "Out of resources. The router has exhausted
+                     resources available for the BMP session.";
+            }
+            enum redundant-connection {
+                value 3;
+                description
+                    "Redundant connection. The router has determined
+                     that this connection is redundant with another one.";
+            }
+        }
+    }
+
+    typedef adj-rib-in-type {
+        type enumeration {
+            enum pre-policy {
+                value 0;
+            }
+            enum post-policy {
+                value 1;
+            }
+        }
+        description
+            "If set to 1, indicates that the message reflects
+             the post-policy Adj-RIB-In (i.e., it reflects the application
+             of inbound policy).  It is set to 0 if the message reflects the
+             pre-policy Adj-RIB-In.";
+    }
+
+    typedef peer-type {
+        type enumeration {
+            enum global {
+                value 0;
+                description "Global Instance Peer.";
+            }
+            enum l3vpn {
+                value 1;
+                description "L3 VPN Instance Peer.";
+            }
+        }
+    }
+
+    typedef distinguisher-type {
+        type enumeration {
+            enum type0 {
+                value 0;
+            }
+            enum type1 {
+                value 1;
+            }
+            enum type2 {
+                value 2;
+            }
+        }
+    }
+
+    grouping tlv {
+        description
+            "Common marker for all BMP TLVs.";
+    }
+
+    grouping string-tlv {
+        container string-tlv {
+            uses tlv;
+            leaf string-info {
+                type string;
+            }
+            description
+                "Type = 0: String. The Information field contains a free-form
+                 UTF-8 string whose length is given by the Information Length
+                 field. Inclusion of this TLV is optional.
+                 Multiple String TLVs MAY be included in the message.";
+        }
+    }
+
+    grouping description-tlv {
+        container description-tlv {
+            uses tlv;
+            leaf description {
+                type string;
+                mandatory true;
+            }
+            description
+                "Type = 1: sysDescr. The Information field contains an ASCII
+                 string whose value MUST be set to be equal to the value of the
+                 sysDescr MIB-II [RFC1213] object.  Inclusion of this TLV is
+                 mandatory.";
+        }
+    }
+
+    grouping name-tlv {
+        container name-tlv {
+            uses tlv;
+            leaf name {
+                type string;
+                mandatory true;
+            }
+            description
+                "Type = 2: sysName. The Information field contains a ASCII
+                 string whose value MUST be set to be equal to the value of the
+                 sysName MIB-II [RFC1213] object.  Inclusion of this TLV is
+                 mandatory.";
+        }
+    }
+
+    grouping string-informations {
+        list string-information {
+            uses string-tlv;
+        }
+    }
+
+    grouping initiation-tlvs {
+        uses string-informations;
+        uses description-tlv;
+        uses name-tlv;
+        description
+            "TLVs containing information about the monitored router";
+    }
+
+    grouping reason-tlv {
+        container reason-tlv {
+            uses tlv;
+            leaf reason {
+                type reason;
+                mandatory true;
+            }
+            description
+                "Type = 1: Reason. The Information field contains a two-byte
+                 code indicating the reason the connection was terminated.  Some
+                 reasons may have further TLVs associated with them.  Inclusion
+                 of this TLV is not optional.";
+        }
+    }
+
+    grouping termination-tlvs {
+        uses string-informations;
+        uses reason-tlv;
+        description
+            "TLVs containing information about the reason for the
+             termination.";
+    }
+
+    grouping count-tlv {
+        uses tlv;
+        leaf count {
+            type yang:counter32;
+        }
+    }
+
+    grouping gauge-tlv {
+        uses tlv;
+        leaf count {
+            type yang:gauge64;
+        }
+    }
+
+    grouping stat-tlvs {
+        container rejected-prefixes-tlv {
+            uses count-tlv;
+            description
+                "Stat Type = 0: (32-bit Counter) Number of prefixes rejected by
+                 inbound policy.";
+        }
+        container duplicate-prefix-advertisements-tlv {
+            uses count-tlv;
+            description
+                "Stat Type = 1: (32-bit Counter) Number of (known) duplicate prefix
+                 advertisements.";
+        }
+        container duplicate-withdraws-tlv {
+            uses count-tlv;
+            description
+                "Stat Type = 2: (32-bit Counter) Number of (known) duplicate
+                 withdraws.";
+        }
+        container invalidated-cluster-list-loop-tlv {
+            uses count-tlv;
+            description
+                "Stat Type = 3: (32-bit Counter) Number of updates invalidated due
+                 to CLUSTER_LIST loop.";
+        }
+        container invalidated-as-path-loop-tlv {
+            uses count-tlv;
+            description
+                "Stat Type = 4: (32-bit Counter) Number of updates invalidated due
+                 to AS_PATH loop.";
+        }
+        container invalidated-originator-id-tlv {
+            uses count-tlv;
+            description
+                "Stat Type = 5: (32-bit Counter) Number of updates invalidated due
+                 to ORIGINATOR_ID.";
+        }
+        container invalidated-as-confed-loop-tlv {
+            uses count-tlv;
+            description
+                "Stat Type = 6: (32-bit Counter) Number of updates invalidated due
+                 to AS_CONFED loop.";
+        }
+        container adj-ribs-in-routes-tlv {
+            uses gauge-tlv;
+            description
+                "Stat Type = 7: (64-bit Gauge) Number of routes in Adj-RIBs-In.";
+        }
+        container loc-rib-routes-tlv {
+            uses gauge-tlv;
+            description
+                "Stat Type = 8: (64-bit Gauge) Number of routes in Loc-RIB.";
+        }
+        description
+            "Each counter is encoded as a TLV.";
+    }
+
+    grouping timestamp {
+        leaf timestamp-sec {
+            type yang:timestamp;
+            default 0;
+            description
+                "Timestamp with seconds precision.";
+        }
+        leaf timestamp-micro {
+            type yang:timestamp;
+            default 0;
+            description
+                "Timestamp with microseconds precision.";
+        }
+        description
+            "The time when the encapsulated routes were received
+             (one may also think of this as the time when they were installed
+             in the Adj-RIB-In), expressed in seconds and microseconds since
+             midnight (zero hour), January 1, 1970 (UTC).  If zero, the time is
+             unavailable.  Precision of the timestamp is implementation-
+             dependent.";
+    }
+
+    grouping peer {
+        leaf type {
+            type peer-type;
+            mandatory true;
+        }
+        container distinguisher {
+            leaf distinguisher-type {
+                type distinguisher-type;
+            }
+            leaf distinguisher {
+                type string;
+            }
+            description
+                "Routers today can have multiple
+                 instances (example L3VPNs).  This field is present to distinguish
+                 peers that belong to one address domain from the other.
+                 If the peer is a L3VPN Instance Peer, it is set to the
+                 route distinguisher of the particular L3VPN instance that the peer
+                 belongs to.";
+        }
+        leaf address {
+            type inet:ip-address;
+            mandatory true;
+            description
+                "The remote IP address associated with the TCP
+                 session over which the encapsulated PDU was received.  It is 4
+                 bytes long if an IPv4 address is carried in this field (with most
+                 significant bytes zero filled) and 16 bytes long if an IPv6
+                 address is carried in this field.";
+        }
+        leaf as {
+            type inet:as-number;
+            mandatory true;
+            description
+                "The Autonomous System number of the peer from which the
+                 encapsulated PDU was received.  If a 16 bit AS number is stored in
+                 this field [RFC4893], it should be padded with zeroes in the most
+                 significant bits.";
+        }
+        leaf bgp-id {
+            type inet:ipv4-address;
+            mandatory true;
+            description
+                "The BGP Identifier of the peer from which the
+                 encapsulated PDU was received.";
+        }
+    }
+
+    grouping peer-header {
+        container peer-header {
+            uses peer;
+            uses timestamp;
+            leaf adj-rib-in-type {
+                type adj-rib-in-type;
+                mandatory true;
+            }
+            leaf ipv4 {
+                type boolean;
+                mandatory true;
+                description
+                    "Indicates if peer's address is IPv4. If set to false address is IPv6.";
+            }
+        }
+        description
+            "The per-peer header follows the common header for most BMP messages.
+              The rest of the data in a BMP message is dependent on the Message
+              Type field in the common header.";
+        reference
+            "https://tools.ietf.org/html/draft-ietf-grow-bmp-07#section-4.2";
+    }
+
+    grouping stat {
+        container tlvs {
+            uses stat-tlvs;
+        }
+    }
+
+    grouping peer-up {
+        leaf local-address {
+            type inet:ip-address;
+            mandatory true;
+            description
+                "The local IP address associated with the peering
+                 TCP session.";
+        }
+        leaf local-port {
+            type inet:port-number;
+            mandatory true;
+            description
+                "The local port number associated with the peering TCP
+                 session.";
+        }
+        leaf remote-port {
+            type inet:port-number;
+            mandatory true;
+            description
+                "The remote port number associated with the peering
+                 TCP session.";
+        }
+        container sent-open {
+            uses bgp-msg:open-message;
+            description
+                "The full OPEN message transmitted by the
+                 monitored router to its peer.";
+        }
+        container received-open {
+            uses bgp-msg:open-message;
+            description
+                "The full OPEN message received by the
+                 monitored router from its peer.";
+        }
+    }
+
+    grouping peer-down {
+        leaf local-system-closed {
+            type boolean;
+            mandatory true;
+            description
+                "If set true, the local system closed the session.
+                 Otherwise the remote system closed the session.";
+        }
+        choice data {
+            container notification {
+                uses bgp-msg:notify-message;
+                description
+                    "BGP PDU containing the BGP
+                     NOTIFICATION message as received from the peer.";
+            }
+            leaf fsm-event-code {
+                type uint16;
+                default 0;
+                description
+                    "Containing the code corresponding to the FSM Event which caused
+                     the system to close the session.
+                     Two bytes both set to zero are used to indicate that no relevant
+                     Event code is defined.";
+            }
+        }
+    }
+
+    grouping initiation {
+        container tlvs {
+            uses initiation-tlvs;
+        }
+    }
+
+    grouping termination {
+        container tlvs {
+            uses termination-tlvs;
+        }
+    }
+
+    notification initiation-message {
+        uses initiation;
+        description
+            "The initiation message provides a means for the monitored router to
+             inform the monitoring station of its vendor, software version, and so on.";
+        reference
+            "https://tools.ietf.org/html/draft-ietf-grow-bmp-07#section-4.3";
+    }
+
+    notification termination-message {
+        uses termination;
+        description
+            "The termination message provides a way for a monitored router to
+             indicate why it is terminating a session.";
+        reference
+            "https://tools.ietf.org/html/draft-ietf-grow-bmp-07#section-4.4";
+    }
+
+    notification route-monitoring-message {
+        uses peer-header;
+        container update {
+            uses bgp-msg:update-message;
+        }
+        description
+            "Route Monitoring messages are used for initial synchronization of
+             ADJ-RIBs-In.  They are also used for ongoing monitoring of received
+             advertisements and withdraws.";
+        reference
+            "https://tools.ietf.org/html/draft-ietf-grow-bmp-07#section-4.5";
+    }
+
+    notification stats-reports-message {
+        uses peer-header;
+        uses stat;
+        description
+            "These messages contain information that could be used by the
+             monitoring station to observe interesting events that occur on the
+             router.";
+        reference
+            "https://tools.ietf.org/html/draft-ietf-grow-bmp-07#section-4.6";
+    }
+
+    notification peer-down-notification {
+        uses peer-header;
+        uses peer-down;
+        description
+            "This message is used to indicate that a peering session was
+             terminated.";
+        reference
+            "https://tools.ietf.org/html/draft-ietf-grow-bmp-07#section-4.7";
+    }
+
+    notification peer-up-notification {
+        uses peer-header;
+        uses peer-up;
+        description
+            "The Peer Up message is used to indicate that a peering session has
+             come up (i.e., has transitioned into ESTABLISHED state).";
+        reference
+            "https://tools.ietf.org/html/draft-ietf-grow-bmp-07#section-4.8";
+    }
+
+}
\ No newline at end of file
index f5c9f9c20e859d12d5d8545debc2ca1f431cfea0..2fc1e5b78f207e262fb3ac5e4332471d7fb2e1fa 100644 (file)
@@ -45,7 +45,9 @@
         <module>testtool</module>
         <module>topology-provider</module>
         <module>util</module>
+        <module>bmp-api</module>
 
         <module>controller-config</module>
+
     </modules>
 </project>