20260427_5 支持all5 CIR replay多TAL
This commit is contained in:
@@ -55,6 +55,10 @@ fi
|
||||
if [[ -z "$RPKI_CLIENT_BIN" ]]; then
|
||||
RPKI_CLIENT_BIN="$BUILD_DIR/src/rpki-client"
|
||||
fi
|
||||
if [[ ! -x "$RPKI_CLIENT_BIN" ]]; then
|
||||
echo "rpki-client binary not executable: $RPKI_CLIENT_BIN" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mkdir -p "$OUT_DIR"
|
||||
if [[ ! -x "$CIR_MATERIALIZE_BIN" || ! -x "$CIR_EXTRACT_INPUTS_BIN" || ! -x "$CCR_TO_COMPARE_VIEWS_BIN" ]]; then
|
||||
@@ -113,12 +117,17 @@ dt = datetime.fromisoformat(vt.replace("Z", "+00:00")).astimezone(timezone.utc)
|
||||
print(int(dt.timestamp()))
|
||||
PY
|
||||
)"
|
||||
FIRST_TAL="$(python3 - <<'PY' "$META_JSON"
|
||||
import json,sys
|
||||
print(json.load(open(sys.argv[1]))["talFiles"][0]["path"])
|
||||
mapfile -t TAL_PATHS < <(python3 - <<'PY' "$META_JSON"
|
||||
import json, sys
|
||||
for item in json.load(open(sys.argv[1], encoding="utf-8"))["talFiles"]:
|
||||
print(item["path"])
|
||||
PY
|
||||
)"
|
||||
TA_NAME="$(basename "$FIRST_TAL" .tal)"
|
||||
)
|
||||
CLIENT_TAL_ARGS=()
|
||||
for tal_path in "${TAL_PATHS[@]}"; do
|
||||
CLIENT_TAL_ARGS+=(-t "$tal_path")
|
||||
done
|
||||
COMPARE_TRUST_ANCHOR="unknown"
|
||||
|
||||
export CIR_MIRROR_ROOT="$(python3 - <<'PY' "$MIRROR_ROOT"
|
||||
from pathlib import Path
|
||||
@@ -135,7 +144,7 @@ chmod -R 0777 "$TMP_ROOT"
|
||||
-R \
|
||||
-e "$WRAPPER" \
|
||||
-P "$VALIDATION_EPOCH" \
|
||||
-t "$FIRST_TAL" \
|
||||
"${CLIENT_TAL_ARGS[@]}" \
|
||||
-d "$CACHE_DIR" \
|
||||
"$OUT_CCR_DIR" >"$RUN_LOG" 2>&1
|
||||
|
||||
@@ -144,9 +153,9 @@ if [[ -f "$OUT_CCR_DIR/rpki.ccr" ]]; then
|
||||
--ccr "$OUT_CCR_DIR/rpki.ccr" \
|
||||
--vrps-out "$ACTUAL_VRPS" \
|
||||
--vaps-out "$ACTUAL_VAPS" \
|
||||
--trust-anchor "$TA_NAME"
|
||||
--trust-anchor "$COMPARE_TRUST_ANCHOR"
|
||||
else
|
||||
python3 - <<'PY' "$OUT_CCR_DIR/json" "$ACTUAL_VRPS" "$ACTUAL_VAPS" "$TA_NAME"
|
||||
python3 - <<'PY' "$OUT_CCR_DIR/json" "$ACTUAL_VRPS" "$ACTUAL_VAPS" "$COMPARE_TRUST_ANCHOR"
|
||||
import csv
|
||||
import json
|
||||
import sys
|
||||
@@ -155,7 +164,7 @@ from pathlib import Path
|
||||
json_path = Path(sys.argv[1])
|
||||
vrps_out = Path(sys.argv[2])
|
||||
vaps_out = Path(sys.argv[3])
|
||||
default_ta = sys.argv[4]
|
||||
compare_ta = sys.argv[4]
|
||||
|
||||
if not json_path.is_file():
|
||||
raise SystemExit(f"rpki-client output has neither rpki.ccr nor json: {json_path}")
|
||||
@@ -171,7 +180,7 @@ with vrps_out.open("w", newline="", encoding="utf-8") as fh:
|
||||
f"AS{roa['asn']}",
|
||||
roa["prefix"],
|
||||
str(roa["maxLength"]),
|
||||
roa.get("ta") or default_ta,
|
||||
compare_ta,
|
||||
])
|
||||
|
||||
with vaps_out.open("w", newline="", encoding="utf-8") as fh:
|
||||
@@ -182,7 +191,7 @@ with vaps_out.open("w", newline="", encoding="utf-8") as fh:
|
||||
writer.writerow([
|
||||
f"AS{aspa['customer_asid']}",
|
||||
providers,
|
||||
aspa.get("ta") or default_ta,
|
||||
compare_ta,
|
||||
])
|
||||
PY
|
||||
fi
|
||||
@@ -197,9 +206,9 @@ json.dump({"count": count_rows(sys.argv[1])}, open(sys.argv[3], "w"), indent=2)
|
||||
json.dump({"count": count_rows(sys.argv[2])}, open(sys.argv[4], "w"), indent=2)
|
||||
PY
|
||||
|
||||
"$CCR_TO_COMPARE_VIEWS_BIN" --ccr "$REFERENCE_CCR" --vrps-out "$REF_VRPS" --vaps-out "$REF_VAPS" --trust-anchor "$TA_NAME"
|
||||
"$CCR_TO_COMPARE_VIEWS_BIN" --ccr "$REFERENCE_CCR" --vrps-out "$REF_VRPS" --vaps-out "$REF_VAPS" --trust-anchor "$COMPARE_TRUST_ANCHOR"
|
||||
|
||||
python3 - <<'PY' "$ACTUAL_VRPS" "$REF_VRPS" "$ACTUAL_VAPS" "$REF_VAPS" "$SUMMARY_JSON"
|
||||
python3 - <<'PY' "$ACTUAL_VRPS" "$REF_VRPS" "$ACTUAL_VAPS" "$REF_VAPS" "$SUMMARY_JSON" "$META_JSON"
|
||||
import csv, json, sys
|
||||
def rows(path):
|
||||
with open(path, newline="") as f:
|
||||
@@ -208,7 +217,11 @@ actual_vrps = {tuple(r) for r in rows(sys.argv[1])}
|
||||
ref_vrps = {tuple(r) for r in rows(sys.argv[2])}
|
||||
actual_vaps = {tuple(r) for r in rows(sys.argv[3])}
|
||||
ref_vaps = {tuple(r) for r in rows(sys.argv[4])}
|
||||
meta = json.load(open(sys.argv[6], encoding="utf-8"))
|
||||
summary = {
|
||||
"compareMode": "trust-anchor-agnostic",
|
||||
"talCount": len(meta["talFiles"]),
|
||||
"talPaths": [item["path"] for item in meta["talFiles"]],
|
||||
"vrps": {
|
||||
"actual": len(actual_vrps),
|
||||
"reference": len(ref_vrps),
|
||||
|
||||
Reference in New Issue
Block a user