Repository: openconfig/featureprofiles
Pull request #4191: To Include BGP session Adjacency with Martian IP
Author: login: Swetha-haridasula
Created: 2025-05-11T18:22:19Z | Merged: 2025-05-21T08:44:39Z

This Test is to include BGP session check with Martian IP


Diff:
diff --git a/feature/bgp/otg_tests/base_bgp_session_parameters/README.md b/feature/bgp/otg_tests/base_bgp_session_parameters/README.md
index 8bdeb896e1a..aa0813fea04 100644
--- a/feature/bgp/otg_tests/base_bgp_session_parameters/README.md
+++ b/feature/bgp/otg_tests/base_bgp_session_parameters/README.md
@@ -44,10 +44,43 @@ Test the normal session establishment and termination:
 
     And include the following session parameters for all cases:
 
-    *   Explicitly specified Router ID.
+    *   Explicitly specified Router ID with Martian IP and regular IP.
     *   Explicit holdtime interval and keepalive interval.
     *   Explicit connect retry interval.
 
+## Canonical OpenConfig for keepalive-interval and hold-time at neighbour and peer-group level for BGP
+
+```json
+  "network-instances": {
+    "network-instance": {
+      "DEFAULT": {
+        "state": {
+          "router-id": "240.0.0.100"
+        }
+        "protocols": {
+          "protocol": {
+            "BGP": {
+              "BGP": {
+                "bgp": {
+                  "neighbors": {
+                    "neighbor": {
+                      "192.0.2.1": {
+                        "state": {
+                          "last-established": 1747804639000000000
+                        }
+                      },
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      },
+  }
+}
+```
+
 ## OpenConfig Path and RPC Coverage
 ```yaml
 paths:
diff --git a/feature/bgp/otg_tests/base_bgp_session_parameters/base_bgp_session_parameters_test.go b/feature/bgp/otg_tests/base_bgp_session_parameters/base_bgp_session_parameters_test.go
index 576f1267096..e076643f22a 100644
--- a/feature/bgp/otg_tests/base_bgp_session_parameters/base_bgp_session_parameters_test.go
+++ b/feature/bgp/otg_tests/base_bgp_session_parameters/base_bgp_session_parameters_test.go
@@ -63,6 +63,7 @@ const (
 	connRetryTime    = 100
 	ateHoldTime      = 135
 	dutKeepaliveTime = 30
+	martianIP        = "240.0.0.100"
 )
 
 type connType string
@@ -108,6 +109,7 @@ func verifyPortsUp(t *testing.T, dev *ondatra.Device) {
 type bgpTestParams struct {
 	localAS, peerAS, nbrLocalAS uint32
 	peerIP                      string
+	RouterID                    string
 }
 
 // bgpClearConfig removes all BGP configuration from the DUT.
@@ -137,7 +139,7 @@ func bgpCreateNbr(bgpParams *bgpTestParams, dut *ondatra.DUTDevice) *oc.NetworkI
 	global := bgp.GetOrCreateGlobal()
 	global.As = ygot.Uint32(bgpParams.localAS)
 
-	global.RouterId = ygot.String(dutAttrs.IPv4)
+	global.RouterId = ygot.String(bgpParams.RouterID)
 	global.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)
 	// Note: we have to define the peer group even if we aren't setting any policy because it's
 	// invalid OC for the neighbor to be part of a peer group that doesn't exist.
@@ -307,7 +309,7 @@ func TestEstablishAndDisconnect(t *testing.T) {
 	nbrPath := statePath.Neighbor(ateAttrs.IPv4)
 
 	bgpClearConfig(t, dut)
-	dutConf := bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS}, dut)
+	dutConf := bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS, RouterID: dutAttrs.IPv4}, dut)
 	gnmi.Replace(t, dut, dutConfPath.Config(), dutConf)
 	t.Log("Configure matching Md5 auth password on DUT")
 	gnmi.Replace(t, dut, dutConfPath.Bgp().Neighbor(ateAttrs.IPv4).AuthPassword().Config(), authPassword)
@@ -386,7 +388,7 @@ func TestPassword(t *testing.T) {
 	nbrPath := statePath.Neighbor(ateAttrs.IPv4)
 
 	bgpClearConfig(t, dut)
-	dutConf := bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS}, dut)
+	dutConf := bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS, RouterID: dutAttrs.IPv4}, dut)
 	gnmi.Replace(t, dut, dutConfPath.Config(), dutConf)
 	t.Log("Configure matching Md5 auth password on DUT")
 	gnmi.Replace(t, dut, dutConfPath.Bgp().Neighbor(ateAttrs.IPv4).AuthPassword().Config(), authPassword)
@@ -482,24 +484,44 @@ func TestParameters(t *testing.T) {
 	}{
 		{
 			name:    "Test the eBGP session establishment: Global AS",
-			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS}, dut),
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS, RouterID: dutAttrs.IPv4}, dut),
 			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS, peerIP: dutIP}, connExternal, noAuth),
 		},
 		{
 			name:    "Test the eBGP session establishment: Neighbor AS",
-			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS2, peerAS: ateAS, nbrLocalAS: dutAS}, dut),
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS2, peerAS: ateAS, nbrLocalAS: dutAS, RouterID: dutAttrs.IPv4}, dut),
 			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS, peerIP: dutIP}, connExternal, noAuth),
 		},
 		{
 			name:    "Test the iBGP session establishment: Global AS",
-			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS2, peerAS: ateAS2}, dut),
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS2, peerAS: ateAS2, RouterID: dutAttrs.IPv4}, dut),
 			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS2, peerIP: dutIP}, connInternal, noAuth),
 		},
 		{
 			name:    "Test the iBGP session establishment: Neighbor AS",
-			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS2, nbrLocalAS: dutAS2}, dut),
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS2, nbrLocalAS: dutAS2, RouterID: dutAttrs.IPv4}, dut),
 			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS2, peerIP: dutIP}, connInternal, noAuth),
 		},
+		{
+			name:    "Test the eBGP session establishment with martian IP as Router ID: Global AS",
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS, RouterID: martianIP}, dut),
+			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS, peerIP: dutIP, RouterID: ateAttrs.IPv4}, connExternal, noAuth),
+		},
+		{
+			name:    "Test the eBGP session establishment with martian IP as Router ID: Neighbor AS",
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS2, peerAS: ateAS, nbrLocalAS: dutAS, RouterID: martianIP}, dut),
+			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS, peerIP: dutIP, RouterID: ateAttrs.IPv4}, connExternal, noAuth),
+		},
+		{
+			name:    "Test the iBGP session establishment with martian IP as Router ID: Global AS",
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS2, peerAS: ateAS2, RouterID: martianIP}, dut),
+			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS2, peerIP: dutIP, RouterID: ateAttrs.IPv4}, connInternal, noAuth),
+		},
+		{
+			name:    "Test the iBGP session establishment with martian IP as Router ID: Neighbor AS",
+			dutConf: bgpCreateNbr(&bgpTestParams{localAS: dutAS, peerAS: ateAS2, nbrLocalAS: dutAS2, RouterID: martianIP}, dut),
+			ateConf: configureATE(t, &bgpTestParams{localAS: ateAS2, peerIP: dutIP, RouterID: ateAttrs.IPv4}, connInternal, noAuth),
+		},
 	}
 	for _, tc := range cases {
 		t.Run(tc.name, func(t *testing.T) {


Reviews:
user: login: ram-mac
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-20T04:13:26Z
user: login: Swetha-haridasula
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-20T15:12:48Z
user: login: ram-mac
body: Looks good to me after changes.
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-21T06:33:07Z
user: login: rohit-rp
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-21T08:36:58Z

Review comments:
diff_hunk: @@ -526,3 +528,72 @@ func TestParameters(t *testing.T) {
 		})
 	}
 }
+
+// TestBGPMartianIPNeighbor is to verify BGP session establishment with Martian IP.
+// Verification is done through BGP adjacency implicitly.
+func TestBgpMartianIPNeighbor(t *testing.T) {
path: feature/bgp/otg_tests/base_bgp_session_parameters/base_bgp_session_parameters_test.go
user: login: ram-mac
body: @Swetha-haridasula - Couple of comments
1. We are specifically adding a martian ip coverage. Should we not be adding in the README too?
2. Can we not use the existing function and add the additional argument in the function to cover this testcase instead of creating a new function?

created_at: 2025-05-20T04:13:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -526,3 +528,72 @@ func TestParameters(t *testing.T) {
 		})
 	}
 }
+
+// TestBGPMartianIPNeighbor is to verify BGP session establishment with Martian IP.
+// Verification is done through BGP adjacency implicitly.
+func TestBgpMartianIPNeighbor(t *testing.T) {
path: feature/bgp/otg_tests/base_bgp_session_parameters/base_bgp_session_parameters_test.go
user: login: Swetha-haridasula
body: Yes. Will add it in README
Yes will include change in existing test block
created_at: 2025-05-20T15:12:47Z
author_association: CONTRIBUTOR

PR comments:
user: login: OpenConfigBot
created_at: 2025-05-11T18:22:53Z
body: ## Pull Request Functional Test Report for #4191 / 8fd9752de886f79c9b44efbd503c3013ba6c0cff


### Virtual Devices

| Device | Test | Test Documentation | Job | Raw Log |
| --- | --- | --- | --- | --- |
| Arista cEOS | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.ARISTA_cEOS.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> | [792ffafe](https://console.cloud.google.com/cloud-build/builds;region=us-west1/792ffafe-d84d-453e-ba3c-0d75f23932cd?project=6848975133) | [Log](https://storage.cloud.google.com/featureprofiles-ci-logs-arista/log-792ffafe-d84d-453e-ba3c-0d75f23932cd.txt) |
| Cisco 8000E | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.CISCO_8000E.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> | [272b8ec8](https://console.cloud.google.com/cloud-build/builds;region=us-west1/272b8ec8-f529-434b-8a1b-e282331793e5?project=6848975133) | [Log](https://storage.cloud.google.com/featureprofiles-ci-logs-cisco/log-272b8ec8-f529-434b-8a1b-e282331793e5.txt) |
| Cisco XRd | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.CISCO_XRd.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> | [9a649ed6](https://console.cloud.google.com/cloud-build/builds;region=us-west1/9a649ed6-018d-4be2-8cee-96501849d4ef?project=6848975133) | [Log](https://storage.cloud.google.com/featureprofiles-ci-logs-cisco/log-9a649ed6-018d-4be2-8cee-96501849d4ef.txt) |
| Juniper ncPTX | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.JUNIPER_ncPTX.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> | [eb4e9f75](https://console.cloud.google.com/cloud-build/builds;region=us-west1/eb4e9f75-9c09-4b0a-a6a7-c097e579db33?project=6848975133) | [Log](https://storage.cloud.google.com/featureprofiles-ci-logs-juniper/log-eb4e9f75-9c09-4b0a-a6a7-c097e579db33.txt) |
| Nokia SR Linux | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.NOKIA_SR_Linux.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> | [8162a59e](https://console.cloud.google.com/cloud-build/builds;region=us-west1/8162a59e-2dae-4ec0-98af-d912d08c7060?project=6848975133) | [Log](https://storage.cloud.google.com/featureprofiles-ci-logs-nokia/log-8162a59e-2dae-4ec0-98af-d912d08c7060.txt) |
| Openconfig Lemming | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.OPENCONFIG_Lemming.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> | [4cecba9d](https://console.cloud.google.com/cloud-build/builds;region=us-west1/4cecba9d-63ef-4ed8-9f19-cc259ea4abe1?project=6848975133) | [Log](https://storage.cloud.google.com/featureprofiles-ci-logs-openconfig/log-4cecba9d-63ef-4ed8-9f19-cc259ea4abe1.txt) |

### Hardware Devices

| Device | Test | Test Documentation | Raw Log |
| --- | --- | --- | --- |
| Arista 7808 | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.ARISTA_7808.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> |  |
| Cisco 8808 | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.CISCO_8808.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> |  |
| Juniper PTX10008 | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.JUNIPER_PTX10008.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> |  |
| Nokia 7250 IXR-10e | [![status](https://storage.googleapis.com/featureprofiles-ci/badges/4191/8fd9752de886f79c9b44efbd503c3013ba6c0cff/ZmVhdHVyZS9iZ3Avb3RnX3Rlc3RzL2Jhc2VfYmdwX3Nlc3Npb25fcGFyYW1ldGVycw.NOKIA_7250_IXR-10e.svg)](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters)<br /> | [RT-1.1: Base BGP Session Parameters](https://github.com/openconfig/featureprofiles/blob/8fd9752de886f79c9b44efbd503c3013ba6c0cff/feature/bgp/otg_tests/base_bgp_session_parameters/README.md)<br /> |  |

[Help](https://gist.github.com/OpenConfigBot/7dadd09b7c3133c9d8bc0d08fcb19b46)
author_association: NONE
user: login: coveralls
created_at: 2025-05-11T18:26:18Z
body: ## Pull Request Test Coverage Report for [Build 15157518219](https://coveralls.io/builds/73772937)


### Details

* **0** of **0**   changed or added relevant lines in **0** files are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage remained the same at **17.97%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/73772937/badge)](https://coveralls.io/builds/73772937) |
| :-- | --: |
| Change from base [Build 15156045083](https://coveralls.io/builds/73771803): |  0.0% |
| Covered Lines: | 2481 |
| Relevant Lines: | 13806 |

---
##### 💛  - [Coveralls](https://coveralls.io)

author_association: NONE