]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
ASPA: Finish official test case coverage
authorEvann DREUMONT <evann@grifon.fr>
Sat, 7 Feb 2026 22:59:12 +0000 (23:59 +0100)
committerMaria Matejka <mq@ucw.cz>
Sat, 14 Mar 2026 21:34:35 +0000 (22:34 +0100)
This commit implements missing test cases based on the official ASPA
path verification examples to expand coverage.

Also, one of the custom test was incorrect, because while there is no valid
ASPA this could be seen, from a downstream perspective, as peering.

This commit was originally a complete fix of the ASPA verification.
Reduced significantly by committer.

filter/test.conf

index 704ddc83628c602af1e5cb5e40e4888295a0ad7b..390d7c15806e4525142a86aae9cc2722006c20a1 100644 (file)
@@ -2505,7 +2505,7 @@ function t_aspa_check()
        bgppath p3 = +empty+;
        p3.prepend(65541);
        p3.prepend(65544);
-       bt_assert(aspa_check(at, p3, false) = ASPA_INVALID);
+       bt_assert(aspa_check(at, p3, false) = ASPA_VALID);
        bt_assert(aspa_check(at, p3, true) = ASPA_INVALID);
 
        bgppath p4 = +empty+;
@@ -2542,6 +2542,13 @@ protocol static
        route aspa 65543 providers 65546;
        route aspa 65544 providers 65546, 65547;
        route aspa 65547 transit;
+       route aspa 65548 transit;
+       route aspa 65550 transit;
+       route aspa 65551 providers 65550;
+       route aspa 65552 transit;
+       route aspa 65553 transit;
+       route aspa 65554 providers 65553;
+       route aspa 65555 providers 65554;
 }
 
 function t_aspa_check_official()
@@ -2551,6 +2558,7 @@ function t_aspa_check_official()
        bool UP = true; bool DOWN = false;
        bgppath p;
 
+       # Examples of Upstream Path Verification
        # F-G is a lateral peer, we do not prepend
        p = +empty+.prepend(A).prepend(C).prepend(F);
        bt_assert(aspa_check(at_official, p, UP) = ASPA_VALID);
@@ -2586,6 +2594,50 @@ function t_aspa_check_official()
        # E-D is a lateral peer, we do not prepend
        p = +empty+.prepend(B).prepend(E);
        bt_assert(aspa_check(at_official, p, UP) = ASPA_VALID);
+
+       # Examples of Downstream Path Verification
+       p = +empty+.prepend(A).prepend(C).prepend(F).prepend(G).prepend(E);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_UNKNOWN);
+
+       p = +empty+.prepend(A).prepend(D).prepend(G).prepend(E);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_VALID);
+
+       p = +empty+.prepend(A).prepend(C).prepend(D).prepend(E);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_UNKNOWN);
+
+       p = +empty+.prepend(A).prepend(C).prepend(D).prepend(G).prepend(E);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_INVALID);
+
+       p = +empty+.prepend(G).prepend(D).prepend(F).prepend(C);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_UNKNOWN);
+
+       p = +empty+.prepend(B).prepend(E).prepend(G).prepend(D);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_VALID);
+
+       p = +empty+.prepend(B).prepend(E).prepend(G).prepend(D).prepend(C);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_INVALID);
+
+       p = +empty+.prepend(A).prepend(C).prepend(F);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_VALID);
+
+       # Topology Contains Complex BGP Relationships
+       int H = 65548; int J = 65549; int K = 65550; int L = 65551;
+       int P = 65552; int Q = 65553; int R = 65554; int S = 65555;
+
+       p = +empty+.prepend(H).prepend(J);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_INVALID);
+
+       p = +empty+.prepend(H).prepend(J).prepend(K);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_INVALID);
+
+       p = +empty+.prepend(P).prepend(Q);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_INVALID);
+
+       p = +empty+.prepend(P).prepend(Q);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_VALID);
+
+       p = +empty+.prepend(P).prepend(Q).prepend(R);
+       bt_assert(aspa_check(at_official, p, DOWN) = ASPA_VALID);
 }
 
 bt_test_suite(t_aspa_check_official, "Testing ASPA (official tests)");