Commit 509aa3500e for frr

commit 509aa3500e29469558f21f50084c4d823da3130e
Author: Minghan Chan <mhchann082@gmail.com>
Date:   Fri Oct 16 14:35:10 2026 +0800

    tests: check OSPF TE metrics above 255 in ospf_te_topo1

    Add a step that sets the OSPF cost of r1 eth0 to 1000, then to 1256,
    and checks that the TED edge and subnet of that link carry the whole
    cost on r1, r2 and r3. The two costs share the low octet, so the second
    change is only seen if the TED keeps the 16-bit metric.

    Without the ospfd fix the TED shows 232 for both costs.

    Signed-off-by: Minghan Chan <mhchann082@gmail.com>

diff --git a/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py b/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py
index cad25fbdb2..7d65782a70 100644
--- a/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py
+++ b/tests/topotests/ospf_te_topo1/test_ospf_te_topo1.py
@@ -252,6 +252,39 @@ def test_step7():
         compare_ted_json_output(tgen, rname, "ted_step7.json")


+def test_step8():
+    "Step8: Set an OSPF cost above 255 on r1 eth0 and verify that the \
+    corresponding Edge and Subnet carry the whole cost as metric in the TED \
+    on all remaining routers"
+
+    tgen = setup_testcase("Step8: Set OSPF cost above 255 on r1 eth0")
+
+    # 1000 and 1256 have the same low octet (0xe8)
+    for cost in [1000, 1256]:
+        tgen.net["r1"].cmd(
+            'vtysh -c "conf t" -c "interface eth0" -c "ip ospf cost {}"'.format(cost)
+        )
+        expected = {
+            "ted": {
+                "edges": [{"edge-id": "10.0.0.1", "metric": cost}],
+                "subnets": [{"subnet-id": "10.0.0.1/32", "metric": cost}],
+            }
+        }
+        for rname in ["r1", "r2", "r3"]:
+            logger.info('Checking router "%s" TED metric %d', rname, cost)
+            test_func = partial(
+                topotest.router_json_cmp,
+                tgen.gears[rname],
+                "show ip ospf mpls-te database json",
+                expected,
+            )
+            _, diff = topotest.run_and_expect(test_func, None, count=30, wait=1)
+            assertmsg = '"{}" TED does not have metric {} for r1 eth0'.format(
+                rname, cost
+            )
+            assert diff is None, assertmsg
+
+
 def test_memory_leak():
     "Run the memory leak test and report results."