BUG-45 : updated bgp models. Added bgp-linkstate.yang. 69/1269/2
authorDana Kutenicsova <dkutenic@cisco.com>
Wed, 18 Sep 2013 15:46:23 +0000 (17:46 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Wed, 18 Sep 2013 16:15:15 +0000 (18:15 +0200)
Change-Id: Ie8ca74931906c1cbf146efd529885cf53136284a
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
bgp/parser-api/src/main/yang/bgp-linkstate.yang [new file with mode: 0644]
bgp/parser-api/src/main/yang/bgp-message.yang
bgp/parser-api/src/main/yang/bgp-multiprotocol.yang
bgp/parser-api/src/main/yang/bgpls-nlri.yang

diff --git a/bgp/parser-api/src/main/yang/bgp-linkstate.yang b/bgp/parser-api/src/main/yang/bgp-linkstate.yang
new file mode 100644 (file)
index 0000000..865ccf3
--- /dev/null
@@ -0,0 +1,297 @@
+module bgp-linkstate {
+       yang-version 1;
+       namespace "urn:opendaylight:params:xml:ns:yang:bgp-linkstate";
+       prefix "bgp-ls";
+
+       import  ietf-inet-types {
+               prefix inet;
+               revision-date 2010-09-24;
+       }
+       import bgp-message { prefix bgp-msg;}
+       import bgp-multiprotocol { prefix bgp-mp;}
+
+       organization "Cisco Systems, Inc.";
+       contact "Dana Kutenicsova <dkutenic@cisco.com>";
+
+       description
+               "This module contains the base data model of a BGP message.
+               It rolls up the definitions contained in RFC4271
+               and draft-ietf-idr-ls-distribution-03.
+
+               Copyright (c)2013 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";
+
+       revision "2013-09-18" {
+               description
+                       "Initial revision.";
+               reference "draft-ietf-idr-ls-distribution-03";
+       }
+
+       typedef nlri-type {
+               reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
+               type enumeration {
+                       enum node {
+                               value 1;
+                       }
+                       enum link {
+                               value 2;
+                       }
+                       enum ipv4-prefix {
+                               value 3;
+                       }
+                       enum ipv6-prefix {
+                               value 4;
+                       }
+               }
+       }
+
+       typedef protocol-id {
+               reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
+               type enumeration {
+                       enum unknown {
+                               value 0;
+                       }
+                       enum isis-level1 {
+                               value 1;
+                       }
+                       enum isis-level2 {
+                               value 2;
+                       }
+                       enum ospf {
+                               value 3;
+                       }
+                       enum direct {
+                               value 4;
+                       }
+                       enum static {
+                               value 5;
+                       }
+               }
+       }
+
+       typedef ospf-route-type {
+               reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.3.1";
+               type enumeration {
+                       enum intra-area {
+                               value 1;
+                       }
+                       enum inter-area {
+                               value 2;
+                       }
+                       enum external1 {
+                               value 3;
+                       }
+                       enum external2 {
+                               value 4;
+                       }
+                       enum nssa1 {
+                               value 5;
+                       }
+                       enum nssa2 {
+                               value 6;
+                       }
+               }
+       }
+
+       typedef route-distinguisher {
+               type uint64;
+       }
+
+       typedef identifier {
+               type uint64;
+       }
+
+       typedef domain-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               type binary {
+                       length "4";
+               }
+       }
+
+       typedef area-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               type binary {
+                       length "4";
+               }
+       }
+
+       // concepts
+       typedef iso-system-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               type binary {
+                       length "6";
+               }
+       }
+
+       typedef ipv4-interface-identifier {
+               reference "http://tools.ietf.org/html/rfc5305#section-3.2";
+               type inet:ipv4-address;
+       }
+
+       typedef ipv6-interface-identifier {
+               reference "http://tools.ietf.org/html/rfc6119#section-4.2";
+               type inet:ipv6-address;
+       }
+
+       typedef ospf-interface-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               type binary {
+                       length "4";
+               }
+       }
+
+       typedef topology-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.5";
+               type uint16 {
+                       range "0..4095";
+               }
+       }
+
+
+       grouping isis-router-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               leaf iso-system-id {
+                       type iso-system-identifier;
+                       mandatory true;
+               }
+       }
+
+       grouping isis-lan-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               container is-is-router-identifier {
+                       uses isis-router-identifier;
+               }
+               leaf psn {
+                       type uint8 {
+                               range "1..255";
+                       }
+                       mandatory true;
+               }
+       }
+
+       grouping ospf-router-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               leaf ospf-router-id {
+                       type binary {
+                               length "4";
+                       }
+                       mandatory true;
+               }
+       }
+
+       grouping ospf-v2-lan-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               uses ospf-router-identifier;
+               leaf ipv4-address {
+                       type ipv4-interface-identifier;
+                       mandatory true;
+               }
+       }
+
+       grouping ospf-v3-lan-identifier {
+               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
+               uses ospf-router-identifier;
+               leaf lan-interface {
+                       type ospf-interface-identifier;
+                       mandatory true;
+               }
+       }
+
+       grouping node-identifier {
+               leaf as-number {
+                       type inet:as-number;
+               }
+               leaf area-id {
+                       type area-identifier;
+               }
+               leaf domain-id {
+                       type domain-identifier;
+               }
+               choice router-identifier {
+                       case isis-node {
+                               container isis-node {
+                                       uses isis-router-identifier;
+                               }
+                       }
+
+                       case isis-pseudonode {
+                               container isis-pseudonode {
+                                       uses isis-lan-identifier;
+                               }
+                       }
+
+                       case ospf-node {
+                               container ospf-node {
+                                       uses ospf-router-identifier;
+                               }
+                       }
+
+                       case ospf-pseudonode {
+                               container ospf-pseudonode {
+                                       uses ospf-v3-lan-identifier;
+                               }
+                       }
+               }
+       }
+
+       augment "/bgp-msg:update/bgp-msg:path-attributes/bgp-mp:mp-reach-nlri/bgp-mp:nlri/bgp-mp:nlri-type" {
+               case linkstate {
+                       leaf nlri-type {
+                               type nlri-type;
+                       }
+                       leaf distinguisher {
+                               type route-distinguisher;
+                       }
+                       container ls-nlri {
+                               leaf protocol-id {
+                                       type protocol-id;
+                               }
+                               leaf identifier {
+                                       type identifier;
+                               }
+                               container local-node-descriptors {
+                                       uses node-identifier;
+                               }
+                               container remote-node-descriptors {
+                                       when "../nlri-type = link";
+                                       uses node-identifier;
+                               }
+                               container Link-Descriptors {
+                                       when "../nlri-type = link";
+                                       leaf ipv4-interface-address {
+                                               type ipv4-interface-identifier;
+                                       }
+                                       leaf ipv6-interface-address {
+                                               type ipv6-interface-identifier;
+                                       }
+                                       leaf ipv4-neighbor-address {
+                                               type ipv4-interface-identifier;
+                                       }
+                                       leaf ipv6-neighbor-address {
+                                               type ipv6-interface-identifier;
+                                       }
+                                       leaf multi-topology-id {
+                                               type topology-identifier;
+                                       }
+                               }
+                               container prefix-descriptors {
+                                       when "../nlri-type = 'ipv4-prefix' or ../nlri-type = 'ipv6-prefix'";
+                                       leaf multi-topology-id {
+                                               type topology-identifier;
+                                       }
+                                       leaf ospf-route-type {
+                                               when "../rotocol-id = 'ospf'";
+                                               type ospf-route-type;
+                                       }
+                                       leaf ip-reachability-information {
+                                               type inet:ip-prefix;
+                                       }
+                               }
+                       }
+               }
+       }
+}
index b8df2999656bc51de752a0bd7032d4eee9b57285..dbe246366a6ff30d6d2f385438b5288b85e208d1 100644 (file)
@@ -3,7 +3,7 @@ module bgp-message {
        namespace "urn:opendaylight:params:xml:ns:yang:bgp-message";
        prefix "bgp-msg";
 
-       import  ietf-inet-types { 
+       import ietf-inet-types {
                prefix inet;
                revision-date 2010-09-24;
        }
index 66a668f4d7f91f7f24084a5347cb1ad0bf33223c..3f64f2f3bdf7ca36d40124a83ba160ad873e4cf1 100644 (file)
@@ -70,7 +70,7 @@ module bgp-multiprotocol {
                        type bgp-subsequent-address-family;
                }
        }
-       
+
        augment "/bgp-msg:open/bgp-msg:optional-parameters/bgp-msg:parameters" {
                case multiprotocol {
                        list capabilities {
index 1598752710292bdfa82c93fdd4ef03508567871f..2513daa22386ecf244d5423542dbd2b968a6c090 100644 (file)
@@ -3,11 +3,15 @@ module bgpls-nlri {
        namespace "urn:opendaylight:params:xml:ns:yang:bgpls";
        prefix "nlri";
 
-       import  ietf-inet-types { 
+       import ietf-inet-types {
                prefix inet;
                revision-date 2010-09-24;
        }
 
+       import bgp-linkstate {
+               prefix bgp-ls;
+       }
+
        organization "Cisco Systems, Inc.";
        contact "Dana Kutenicsova <dkutenic@cisco.com>";
 
@@ -29,30 +33,6 @@ module bgpls-nlri {
                reference "RFC4271";
        }
 
-       typedef ospf-route-type {
-               reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.3.1";
-               type enumeration {
-                       enum intra-area {
-                               value 1;
-                       }
-                       enum inter-area {
-                               value 2;
-                       }
-                       enum external1 {
-                               value 3;
-                       }
-                       enum external2 {
-                               value 4;
-                       }
-                       enum nssa1 {
-                               value 5;
-                       }
-                       enum nssa2 {
-                               value 6;
-                       }
-               }
-       }
-
        typedef link-protection-type {
                reference "http://tools.ietf.org/html/rfc5307#section-1.2";
                type enumeration {
@@ -77,37 +57,6 @@ module bgpls-nlri {
                }
        }
 
-       typedef protocol-id {
-               reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
-               type enumeration {
-                       enum unknown {
-                               value 0;
-                       }
-                       enum isis-level1 {
-                               value 1;
-                       }
-                       enum isis-level2 {
-                               value 2;
-                       }
-                       enum ospf {
-                               value 3;
-                       }
-                       enum direct {
-                               value 4;
-                       }
-                       enum static {
-                               value 5;
-                       }
-               }
-       }
-
-       typedef area-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               type binary {
-                       length "4";
-               }
-       }
-
        typedef isis-area-identifier {
                reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1.2";
                type binary {
@@ -115,48 +64,18 @@ module bgpls-nlri {
                }
        }
 
-       typedef domain-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               type binary {
-                       length "4";
-               }
-       }
-
-       // concepts
-       typedef iso-system-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               type binary {
-                       length "6";
-               }
-       }
-
-       typedef ipv4-interface-identifier {
-               reference "http://tools.ietf.org/html/rfc5305#section-3.2";
-               type inet:ipv4-address;
-       }
-
        typedef ipv4-router-identifier {
                reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1.4";
                type inet:ipv4-address;
        }
 
-       typedef ipv6-interface-identifier {
-               reference "http://tools.ietf.org/html/rfc6119#section-4.2";
-               type inet:ipv6-address;
-       }
+
 
        typedef ipv6-router-identifier {
                reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1.4";
                type inet:ipv6-address;
        }
 
-       typedef ospf-interface-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               type binary {
-                       length "4";
-               }
-       }
-
        typedef unnumbered-link-identifier {
                reference "http://tools.ietf.org/html/rfc4202#section-2.1";
                type uint32;
@@ -249,121 +168,27 @@ module bgpls-nlri {
                }
        }
 
-       typedef topology-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.5";
-               type uint16 {
-                       range "0..4095";
-               }
-       }
-
-       grouping isis-router-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               leaf iso-system-id {
-                       type iso-system-identifier;
-                       mandatory true;
-               }
-       }
-
-       grouping isis-lan-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               container is-is-router-identifier {
-                       uses isis-router-identifier;
-               }
-               leaf psn {
-                       type uint8 {
-                               range "1..255";
-                       }
-                       mandatory true;
-               }
-       }
-
-       grouping ospf-router-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               leaf ospf-router-id {
-                       type binary {
-                               length "4";
-                       }
-                       mandatory true;
-               }
-       }
-
-       grouping ospf-v2-lan-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               uses ospf-router-identifier;
-               leaf ipv4-address {
-                       type ipv4-interface-identifier;
-                       mandatory true;
-               }
-       }
-
-       grouping ospf-v3-lan-identifier {
-               reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
-               uses ospf-router-identifier;
-               leaf lan-interface {
-                       type ospf-interface-identifier;
-                       mandatory true;
-               }
-       }
-
-       grouping node-identifier {
-               leaf as-number {
-                       type inet:as-number;
-                       mandatory true;
-               }
-               leaf area-id {
-                       type area-identifier;
-               }
-               leaf domain-id {
-                       type domain-identifier;
-                       mandatory true;
-               }
-               choice router-identifier {
-                       case isis-node {
-                               container isis-node {
-                                       uses isis-router-identifier;
-                               }
-                       }
-
-                       case isis-pseudonode {
-                               container isis-pseudonode {
-                                       uses isis-lan-identifier;
-                               }
-                       }
-
-                       case ospf-node {
-                               container ospf-node {
-                                       uses ospf-router-identifier;
-                               }
-                       }
-
-                       case ospf-pseudonode {
-                               container ospf-pseudonode {
-                                       uses ospf-v3-lan-identifier;
-                               }
-                       }
-               }
-       }
 
        grouping link-anchor {
                container node-identifier {
-                       uses node-identifier;
+                       uses bgp-ls:node-identifier;
                }
                choice interface-identifier {
                        case ipv4-iface-id {
                                leaf ipv4-iface-id {
-                                       type ipv4-interface-identifier;
+                                       type bgp-ls:ipv4-interface-identifier;
                                }
                        }
 
                        case ipv6-iface-id {
                                leaf ipv6-iface-id {
-                                       type ipv6-interface-identifier;
+                                       type bgp-ls:ipv6-interface-identifier;
                                }
                        }
 
                        case ospf-iface-id {
                                leaf ospf-iface-id {
-                                       type ospf-interface-identifier;
+                                       type bgp-ls:ospf-interface-identifier;
                                }
                        }
 
@@ -377,7 +202,7 @@ module bgpls-nlri {
 
        grouping link-identifier {
                leaf topology-identifier {
-                       type topology-identifier;
+                       type bgp-ls:topology-identifier;
                }
                container link-anchor {
                        uses link-anchor;
@@ -386,7 +211,7 @@ module bgpls-nlri {
 
        grouping prefix-identifier {
                container node-identifier {
-                       uses node-identifier;
+                       uses bgp-ls:node-identifier;
                }
                leaf prefix {
                        type inet:ip-prefix;
@@ -396,14 +221,14 @@ module bgpls-nlri {
        grouping ospf-prefix-identifier {
                uses prefix-identifier;
                leaf ospf-route-t {
-                       type ospf-route-type;
+                       type bgp-ls:ospf-route-type;
                }
        }
 
        grouping network-node-state {
                reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1";
                leaf topology-identifier {
-                       type topology-identifier;
+                       type bgp-ls:topology-identifier;
                }
                leaf node-flags {
                        type node-flag-bits;
@@ -517,16 +342,15 @@ module bgpls-nlri {
 
        notification bgpls-pdu {
                reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
-               leaf route-distinguisher {
-                       type uint64;
+               leaf distinguisher {
+                       type bgp-ls:route-distinguisher;
                }
                leaf protocol {
-                       type protocol-id;
+                       type bgp-ls:protocol-id;
                        mandatory true;
                }
                leaf identifier {
-                       type uint64;
-                       mandatory true;
+                       type bgp-ls:identifier;
                }
                choice objects {
                        case nodes {