From fc7bd12e44a6be327ec7bcb8af0dbca34178dcd3 Mon Sep 17 00:00:00 2001
From: AnilKR123 <anilrao@arista.com>
Date: Mon, 16 Dec 2024 22:51:07 +0000
Subject: [PATCH 1/4] Add Bfd diagnostic code for when neighbor signaled
 session down.

---
 release/models/bfd/openconfig-bfd.yang | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/release/models/bfd/openconfig-bfd.yang b/release/models/bfd/openconfig-bfd.yang
index 8f5041b79..429a220f8 100644
--- a/release/models/bfd/openconfig-bfd.yang
+++ b/release/models/bfd/openconfig-bfd.yang
@@ -28,6 +28,13 @@ module openconfig-bfd {
 
   oc-ext:openconfig-version "0.3.0";
 
+  revision "2024-12-16" {
+    description
+      "Add Bfd diagnostic code for when
+       neighbor signaled session down. Specified in RFC5880.";
+    reference "0.3.1";
+ }
+
   revision "2024-03-05" {
     description
       "Add configuration of min interval, multiplier when
@@ -157,21 +164,27 @@ module openconfig-bfd {
           "The BFD echo function failed - echo packets have not been
           received for the required period of time.";
       }
-      enum FORWARDING_RESET {
+      enum NEIGHBOR_DOWN {
         value 3;
+        description
+          "The Bfd neighbor signaled session down - Bfd packet was received with
+           neighbor state down.";
+      }
+      enum FORWARDING_RESET {
+        value 4;
         description
           "The forwarding plane in the local system was reset - such
           that the remote system cannot rely on the forwarding state of
           the device specifying this error code.";
       }
       enum PATH_DOWN {
-        value 4;
+        value 5;
         description
           "Signalling outside of BFD specified that the path underlying
           this session has failed.";
       }
       enum CONCATENATED_PATH_DOWN {
-        value 5;
+        value 6;
         description
           "When a BFD session runs over a series of path segments, this
           error code indicates that a subsequent path segment (i.e.,
@@ -179,13 +192,13 @@ module openconfig-bfd {
           of the session) has failed.";
       }
       enum ADMIN_DOWN {
-        value 6;
+        value 7;
         description
           "The BFD session has been administratively disabled by the
           peer.";
       }
       enum REVERSE_CONCATENATED_PATH_DOWN {
-        value 7;
+        value 8;
         description
           "In the case that a BFD session is running over a series of
           path segments, this error code indicates that a path segment

From 52ddf09adf1023b77e0abc14f693f5c54d95a4cd Mon Sep 17 00:00:00 2001
From: AnilKR123 <anilrao@arista.com>
Date: Tue, 17 Dec 2024 15:25:34 +0000
Subject: [PATCH 2/4] Move NEIGHBOR_DOWN to the end of the enums list to
 preserve the original ordering.

---
 release/models/bfd/openconfig-bfd.yang | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/release/models/bfd/openconfig-bfd.yang b/release/models/bfd/openconfig-bfd.yang
index 429a220f8..f4e40e956 100644
--- a/release/models/bfd/openconfig-bfd.yang
+++ b/release/models/bfd/openconfig-bfd.yang
@@ -164,27 +164,21 @@ module openconfig-bfd {
           "The BFD echo function failed - echo packets have not been
           received for the required period of time.";
       }
-      enum NEIGHBOR_DOWN {
-        value 3;
-        description
-          "The Bfd neighbor signaled session down - Bfd packet was received with
-           neighbor state down.";
-      }
       enum FORWARDING_RESET {
-        value 4;
+        value 3;
         description
           "The forwarding plane in the local system was reset - such
           that the remote system cannot rely on the forwarding state of
           the device specifying this error code.";
       }
       enum PATH_DOWN {
-        value 5;
+        value 4;
         description
           "Signalling outside of BFD specified that the path underlying
           this session has failed.";
       }
       enum CONCATENATED_PATH_DOWN {
-        value 6;
+        value 5;
         description
           "When a BFD session runs over a series of path segments, this
           error code indicates that a subsequent path segment (i.e.,
@@ -192,19 +186,25 @@ module openconfig-bfd {
           of the session) has failed.";
       }
       enum ADMIN_DOWN {
-        value 7;
+        value 6;
         description
           "The BFD session has been administratively disabled by the
           peer.";
       }
       enum REVERSE_CONCATENATED_PATH_DOWN {
-        value 8;
+        value 7;
         description
           "In the case that a BFD session is running over a series of
           path segments, this error code indicates that a path segment
           on the reverse path (i.e., in the transmit direction from the
           destination to the source of the session) has failed.";
       }
+      enum NEIGHBOR_DOWN {
+        value 8;
+        description
+          "The Bfd neighbor signaled session down - Bfd packet was received with
+          neighbor state down.";
+      }
     }
     description
       "Diagnostic codes defined by BFD. These typically indicate the

From 63bd2546c398f03a439d9d950ac77b6ac7731bc4 Mon Sep 17 00:00:00 2001
From: AnilKR123 <anilrao@arista.com>
Date: Tue, 17 Dec 2024 18:44:40 +0000
Subject: [PATCH 3/4] Add comment about RFC5880 deviation.

---
 release/models/bfd/openconfig-bfd.yang | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/release/models/bfd/openconfig-bfd.yang b/release/models/bfd/openconfig-bfd.yang
index f4e40e956..942e15a92 100644
--- a/release/models/bfd/openconfig-bfd.yang
+++ b/release/models/bfd/openconfig-bfd.yang
@@ -208,7 +208,12 @@ module openconfig-bfd {
     }
     description
       "Diagnostic codes defined by BFD. These typically indicate the
-      reason for a change of session state.";
+      reason for a change of session state. The NEIGHBOR_DOWN diagnostic
+      was added to the enum at value 8 to avoid making a breaking change.
+      This deviates from RFC5880 where the enum is value 3. This also
+      shifts the following values by 1, in relation to RFC5880:
+      FORWARDING_RESET, PATH_DOWN, CONCATENATED_PATH_DOWN,
+      ADMIN_DOWN, REVERSE_CONCATENATED_PATH_DOWN.";
     reference
       "RFC5880 - Bidirectional Forwarding Detection, Section
       4.1";

From b3229cb84d1c1c322c4cdc1054060c5f2639ef35 Mon Sep 17 00:00:00 2001
From: AnilKR123 <anilrao@arista.com>
Date: Tue, 11 Feb 2025 22:11:08 +0000
Subject: [PATCH 4/4] Bump version number.

---
 release/models/bfd/openconfig-bfd.yang | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/release/models/bfd/openconfig-bfd.yang b/release/models/bfd/openconfig-bfd.yang
index 942e15a92..840411d8d 100644
--- a/release/models/bfd/openconfig-bfd.yang
+++ b/release/models/bfd/openconfig-bfd.yang
@@ -26,7 +26,7 @@ module openconfig-bfd {
     "An OpenConfig model of Bi-Directional Forwarding Detection (BFD)
     configuration and operational state.";
 
-  oc-ext:openconfig-version "0.3.0";
+  oc-ext:openconfig-version "0.3.1";
 
   revision "2024-12-16" {
     description