Validation
Does the twin get it right?
The twin's predictions are checked against two networks it shares no build code with: a reference network built separately on plain Linux, and real Cisco routers. This page gives their configuration, every test, every result, and the routing rules that say what the right answer is.
- 12change scenarios on the reference network, each run twice
- 1.000reachability agreement with the reference network, in every run
- 648 of 648BGP best-path entries identical between twin and reference
- 6 of 6checks passed when the twin's prediction was replayed on real Cisco routers
The setup
Three networks, one description
All three are built from the same network design. Nothing else is shared: each side has its own build code, its own switching, and its own way of reading the result.
| Twin (the system) | Reference network | Cisco lab | |
|---|---|---|---|
| Built by | The system, from the YAML network description | A separate program that imports nothing from the twin | By hand, on Cisco Modeling Labs |
| Devices | Mininet hosts, Open vSwitch switches | Linux network namespaces, veth pairs, Linux bridges (no Mininet, no Open vSwitch) | Cisco IOL routers and IOL-L2 switches, IOS 17.18.2 |
| Routing software | FRRouting | FRRouting, configured by its own generator | Cisco IOS |
| OSPF link type | point-to-point | broadcast (FRR default, with a designated router) | point-to-point |
| How a path is read | The twin's own FIB walk and traced routes | Its own FIB walk over vtysh, and ping for reachability | show ip route on every router, walked hop by hop |
| Networks tested | Campus: 26 nodes, OSPF (reference network) · Fabric: 18 nodes, eBGP leaf-spine (reference network) · 5-node Cisco lab: OSPF plus one eBGP session | ||
How the comparison is kept fair
The twin answers first. Its prediction is saved and committed to git with a SHA-256 hash before the reference network or the real routers are touched. The scoring program refuses to score a prediction that is not committed, so the twin can never see the answer it is graded against.
Results are reported as they were run. Where the two sides disagreed, the disagreement is shown below with its cause.
- Twin predictsPaths, hop counts, reachability, affected hosts
- Prediction committedgit commit + SHA-256, before anything else runs
- Reference measuresSame change, applied on the other network
- ScoreOnly against the committed prediction
The rules
How OSPF and BGP choose a path
These are the rules every router here follows. They fix one correct answer for each test, so each result below can be checked by hand.
OSPF: lowest total cost wins
- Every router interface has a cost. On these networks it is 10 unless a change sets it.
- Each router learns the whole map (the link-state database) and runs Dijkstra's shortest-path algorithm from itself.
- A path's cost is the sum of the outgoing interface costs along it, plus the cost of the destination's loopback (1 on Cisco).
- Cost is set per interface, so it is per direction: raising one end of a link changes traffic leaving that end only. The return path can stay as it was.
- Equal-cost paths are both kept (ECMP).
BGP: policy first, then shortest AS path
- A router rejects any route whose AS path already contains its own AS number (loop prevention).
- Among the rest, the highest local preference wins (default 100).
- Then the shortest AS path.
- Then, as configured here (
bgp bestpath compare-routerid,maximum-paths 1), the lowest router ID. One best path per prefix.
Reference network · OSPF
The campus network
26 nodes: two core routers, four distribution routers, four access switches and 16 hosts in four VLANs. Every routed link costs 10. The guest distribution router is connected to core1 only.
Configuration
This is the OSPF configuration the reference network generates for core2, rendered from its own code. Interface names are shown as in the network description; on the running network they are veth pairs.
The twin builds the same router from the same description with its own generator, using point-to-point links instead of broadcast.
interface eth1 ! to core1
ip ospf cost 10
interface eth2 ! to dist-staff
ip ospf cost 10
interface eth3 ! to dist-student
ip ospf cost 10
interface eth4 ! to dist-server
ip ospf cost 10
!
router ospf
ospf router-id 10.255.0.2
network 10.255.0.2/32 area 0
network 10.0.1.0/30 area 0
network 10.0.3.0/30 area 0
network 10.0.5.0/30 area 0
network 10.0.7.0/30 area 0What was tested and what came back
12 scenarios, each run twice (24 runs). For each, the twin's committed prediction is compared with what the reference network measured: reachability over 30 representative host pairs (every pair, 240, in the access-rule set below), hop count of every router-to-router path the change moves, and the affected hosts (F1 score: 1.000 means the same set exactly).
| Scenario | Change | Reachability | Hop counts | Affected hosts F1 run 1 · run 2 |
|---|---|---|---|---|
| Core mesh link failure | core1–core2 link down | 1.000 | 1.000 | 1.000 · 1.000 |
| Guest uplink failure | dist-guest–core1 link down | 1.000 | 1.000 | 1.000 · 1.000 |
| Staff core1 uplink failure | dist-staff–core1 link down | 1.000 | 1.000 | 1.000 · 1.000 |
| Student core2 uplink failure | dist-student–core2 link down | 1.000 | 1.000 | 1.000 · 1.000 |
| Core mesh deprioritized | OSPF cost 1000 on core1's end of core1–core2 | 1.000 | 1.000 | 0.000 · 0.000 |
| Guest uplink cost | OSPF cost 1000 on core1's end of core1–dist-guest | 1.000 | 1.000 | 1.000 · 1.000 |
| Server prefers core2 | OSPF cost 1000 on core1's end of core1–dist-server | 1.000 | 1.000 | 1.000 · 1.000 |
| Staff prefers core2 | OSPF cost 1000 on core1's end of core1–dist-staff | 1.000 | 1.000 | 1.000 · 1.000 |
| Student prefers core1 | OSPF cost 1000 on core2's end of core2–dist-student | 1.000 | 1.000 | 1.000 · 1.000 |
| staff1 moved to guest VLAN | Access port moved VLAN 10 → 40 | 1.000 | 1.000 | 0.667 · 0.667 |
| staff2 moved to student VLAN | Access port moved VLAN 10 → 20 | 1.000 | 1.000 | 1.000 · 1.000 |
| student2 moved to server VLAN | Access port moved VLAN 20 → 30 | 1.000 | 1.000 | 1.000 · 1.000 |
| Mean over 24 runs | 1.000 | 1.000 | 0.889 (95% CI 0.722–1.000) | |
Worked example
Student prefers core1
Change: ip ospf cost 1000 on core2's interface to dist-student.
| core2 → dist-student, direct | 1000 |
| core2 → core1 → dist-student | 10 + 10 = 20 |
Dijkstra picks 20: the path becomes 2 hops. The reverse direction, dist-student → core2, still leaves through a cost-10 interface, so it stays 1 hop. Hosts behind dist-student now take a longer path toward core2: student1–student7 are affected.
- Twin predicted
- core2 → dist-student 2 hops · affected student1–student7
- Reference measured
- core2 → dist-student 2 hops · dist-student → core2 1 hop · affected student1–student7
Where they differed
Core mesh deprioritized
Change: cost 1000 on core1's end of the core1–core2 link only.
| core1 → core2, direct | 1000 |
| core1 → dist-staff → core2 | 10 + 10 = 20 |
| dist-guest → core1 → (detour) → core2 | 2 → 3 hops |
dist-guest hangs off core1 only, so guest1 and guest2 reach core2 one hop further. The reference network counted them as affected. The twin's own routing tables showed the same 2 → 3 hops, but its path comparison only checked each router pair in one direction, so it reported no affected hosts (F1 0.000).
The second difference, staff1's VLAN move (0.667), came from the twin not yet comparing VLAN membership: it left out guest1, staff1 and student1. Both were fixed on 2026-09-24 and recorded as labelled reruns: the same 12 scenarios and 4 new, held-out ones all scored 1.000 on every measure.
With access rules. A further 16 scenarios, set up in advance with firewall rules on both networks: reachability 1.000, hop counts 1.000, affected hosts 0.996 (95% CI 0.988–1.000). The one difference, guest uplink failure (0.933): the reference network also lists svc-auth and svc-file, servers the guests were never allowed to reach. The twin leaves them out because access was already blocked before the change.
Reference network · BGP
The leaf-spine fabric
18 nodes: two spines in AS 65000, four leaves in AS 65001–65004, one rack of hosts per leaf. leaf4 connects to spine1 only.
Configuration
leaf1's BGP configuration as the reference network generates it. It peers with both spines, announces its loopback and rack subnet, and keeps one best path per prefix.
Because both spines share AS 65000, a spine rejects any route that has already passed through a spine: spine2 never learns leaf4's routes, and neither spine learns the other's loopback.
router bgp 65001
bgp router-id 10.255.1.1
no bgp ebgp-requires-policy
bgp bestpath compare-routerid
neighbor 10.0.11.1 remote-as 65000 ! spine1
neighbor 10.0.21.1 remote-as 65000 ! spine2
!
address-family ipv4 unicast
network 10.255.1.1/32
network 10.11.0.0/24
maximum-paths 1
exit-address-familyWhat was tested and what came back
For every BGP router and every router loopback (36 entries per run), the best path is compared: reachable or not, next hop, AS path and local preference. A third answer, worked out from the BGP rules alone without running any router, is compared too.
| Case | Change | Runs | Twin = reference | Twin = rules |
|---|---|---|---|---|
| Baseline | No change | 9 | 324 / 324 | 324 / 324 |
| leaf1 prefers spine2 | local-pref 200 on routes from spine2 | 3 | 108 / 108 | 108 / 108 |
| leaf1 shuts spine1 session | BGP neighbor shutdown | 3 | 108 / 108 | 108 / 108 |
| spine1–leaf2 link fails | Link down | 3 | 108 / 108 | 108 / 108 |
Worked example
leaf1 prefers spine2
Before: leaf2's loopback reaches leaf1 two ways, both with AS path [65000, 65002]. Tie, so the lower router ID wins: via spine1.
After local-preference 200 on routes from spine2, local preference is compared first, 200 > 100: via spine2. leaf4's routes stay on spine1 at 100, because spine2 never has them.
- All three answers
- leaf1 → leaf2, leaf3: via spine2, local-pref 200 · leaf1 → leaf4: via spine1, local-pref 100
Worked example
leaf1 shuts its spine1 session
leaf1 now hears only spine2. leaf4 is behind spine1 only, and the route to it could only reach spine2 by passing through spine1 first. Its AS path would then already contain 65000, so spine2 rejects it.
- All three answers
- leaf1 → leaf2: via spine2, AS path [65000, 65002] · leaf1 → leaf4: unreachable · leaf1 → spine1 loopback: unreachable
Real routers
The Cisco lab
Three routers and two access switches on Cisco Modeling Labs (IOL and IOL-L2, IOS 17.18.2). OSPF area 0 on every router link, an eBGP session between r1 (AS 65001) and r2 (AS 65002), and VLAN trunks from core to the access switches.
Configuration
The routing part of the applied configuration, as typed into the lab. Every router link is point-to-point; IOS gives an Ethernet interface cost 10 by default, confirmed on the lab with show ip ospf interface (Cost: 10).
! r2
interface Ethernet0/0
description to r1
ip address 10.0.12.2 255.255.255.252
ip ospf network point-to-point
interface Ethernet0/1
description to core
ip address 10.0.23.1 255.255.255.252
ip ospf network point-to-point
router ospf 1
router-id 10.255.0.2
network 10.255.0.2 0.0.0.0 area 0
network 10.0.12.0 0.0.0.3 area 0
network 10.0.23.0 0.0.0.3 area 0
router bgp 65002
neighbor 10.0.12.1 remote-as 65001
address-family ipv4
network 10.255.0.2 mask 255.255.255.255
!
! core
interface Ethernet0/2
switchport trunk allowed vlan 10
switchport mode trunk
router ospf 1
router-id 10.255.0.3
passive-interface Vlan10
passive-interface Vlan20
network 10.255.0.3 0.0.0.0 area 0
network 10.0.13.0 0.0.0.3 area 0
network 10.0.23.0 0.0.0.3 area 0The test: a cost change predicted, then applied
- DiscoverThe system read the live lab over SSH and drafted its network description; link bandwidths, which IOS does not report here, were filled in by hand.
- Predict and commitThe twin built the lab, applied the change, and its result was committed with its SHA-256 before the lab was touched.
- Apply on r2
interface Ethernet0/1·ip ospf cost 50 - Capture and scoreThree captures of every router's routes before and after, walked hop by hop and compared with the twin.
What OSPF says should happen
r2 to core's loopback
| Before: r2 → core direct | 10 + 1 = 11 |
| After: r2 → core direct | 50 + 1 = 51 |
| After: r2 → r1 → core | 10 + 10 + 1 = 21 |
21 is lower than 51, so r2 now goes through r1: 1 → 2 hops. core → r2 leaves through core's own cost-10 interface, so it stays direct. Nothing becomes unreachable.
What the real router showed
r2, show ip route
! before
O 10.255.0.3/32 [110/11] via 10.0.23.2, Ethernet0/1
! after
O 10.255.0.3/32 [110/21] via 10.0.12.1, Ethernet0/0Metric 11 → 21, next hop moved from core to r1, exactly the arithmetic on the left.
- Twin predicted
- r2 → core 1 → 2 hops; no other path changes; nothing lost
- Real lab
- r2 → core 1 → 2 hops; the other 5 router pairs unchanged; no route gone or new on any router
| Check | Result |
|---|---|
| All three captures on each side agree with each other | pass |
| Same routers in the twin and the lab | pass |
| Every twin node exists in the lab | pass |
| Path changes identical (none only in the twin, none only in the lab) | pass |
| Lost paths identical (none on either side) | pass |
| Reachability identical (no prefix lost or gained) | pass |
The twin runs FRRouting, not IOS, so this compares routing decisions (paths, next hops and which prefixes exist), which both implement from the same OSPF standard. The lab has no end hosts, so paths are compared between routers.
Timing
How long routing takes to settle
The same 16 changes on both campus builds, five times each, timed from the first to the last kernel route update. The median of five is compared.
| Measure (16 changes, median of 5 each) | Value |
|---|---|
| Changes that move no route: both sides report no route update | 5 of 5 |
| Mean absolute difference, twin vs reference (11 changes) | 6.5 ms |
| Average difference (twin slower by) | 5.9 ms |
| 95% limits of agreement | −16.4 to +28.1 ms |
| Mean absolute percentage error | 188% |
Both sides settle within tens of milliseconds. The reference network settles some changes in 1–5 ms, so a few milliseconds of difference is a large percentage; the absolute difference is the more telling figure.