]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
ASPA: added official tests
authorMaria Matejka <mq@ucw.cz>
Tue, 18 Mar 2025 04:34:46 +0000 (05:34 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 18 Mar 2025 04:34:46 +0000 (05:34 +0100)
from Sriram Kotikalapudi's presentation for IETF 122.

filter/test.conf

index 053eff0a6867b3e5ec9b0e9c5e05cbf8ccdb0fce..4d4e93077a45ca2a4d262bceb2c1058276bf1520 100644 (file)
@@ -2291,7 +2291,65 @@ function t_aspa_check()
        bt_assert(aspa_check(at, p3, true) = ASPA_INVALID);
 }
 
-bt_test_suite(t_aspa_check, "Testing ASPA");
+bt_test_suite(t_aspa_check, "Testing ASPA (our tests)");
+
+# Tests from https://github.com/ksriram25/IETF/blob/main/ASPA_path_verification_examples.pdf
+aspa table at_official;
+protocol static
+{
+       aspa { table at_official; };
+       route aspa 65541 providers 65543, 65544;
+       route aspa 65542 providers 65545;
+       route aspa 65543 providers 65546;
+       route aspa 65544 providers 65546, 65547;
+       route aspa 65547 transit;
+}
+
+function t_aspa_check_official()
+{
+       int A = 65541; int B = 65542; int C = 65543; int D = 65544;
+       int E = 65545; int F = 65546; int G = 65547;
+       bool UP = true; bool DOWN = false;
+       bgppath p;
+
+       # 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);
+
+       # D-G is a customer, we do prepend
+       p = +empty+.prepend(A).prepend(C).prepend(D).prepend(G);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_INVALID);
+
+       # D-G is a customer, we do prepend
+       p = +empty+.prepend(A).prepend(C).prepend(F).prepend(D).prepend(G);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_UNKNOWN);
+
+       # D-C is a lateral peer, we do not prepend
+       p = +empty+.prepend(B).prepend(E).prepend(D);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_UNKNOWN);
+
+       # A-C is a customer, we do prepend
+       p = +empty+.prepend(B).prepend(E).prepend(D).prepend(A).prepend(C);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_INVALID);
+
+       # A-C is a customer, we do prepend
+       p = +empty+.prepend(B).prepend(E).prepend(G).prepend(D).prepend(A).prepend(C);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_INVALID);
+
+       # A-D is a customer, we do prepend
+       p = +empty+.prepend(F).prepend(C).prepend(A).prepend(D);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_INVALID);
+
+       # A-D is a customer, we do prepend
+       p = +empty+.prepend(G).prepend(F).prepend(C).prepend(A).prepend(D);
+       bt_assert(aspa_check(at_official, p, UP) = ASPA_INVALID);
+
+       # 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);
+}
+
+bt_test_suite(t_aspa_check_official, "Testing ASPA (official tests)");
 
 filter vpn_filter
 {