# Periodic Cost Re-evaluation Test
#
# Topology (explicit 4-node diamond):
#
#      n01 (root)
#      /       \
#    fiber    fiber
#    /         \
#   n02        n03
#    \        /
#    fiber   fiber
#      \   /
#      n04   (test subject)
#
# Initial state: All links are fiber. n04 has two candidate parents at
# depth 1: n02 and n03. Both have identical costs (~1.01), so n04 picks
# n02 (smaller NodeAddr, tiebreak rule).
#
# Mutation: Stochastic netem mutation with a single "degraded" policy
# (Bluetooth-like: 15-40ms delay, 2-8% loss). With fraction=0.5, on
# average 2 of 4 edges degrade each round. Over 12 mutation rounds
# (180s / 15s interval), n02-n04 will be degraded in some rounds.
#
# Expected behavior: When n02-n04 is degraded and n03-n04 stays fiber
# (or vice versa), periodic re-evaluation detects the cost asymmetry
# and switches parents. Look for "trigger = periodic" in logs.
#
# FIPS overrides: reeval_interval_secs=15 (vs default 60) to increase
# the chance of catching a cost asymmetry within the mutation window.
#
# Validation: grep n04 logs for "Parent switched via periodic cost
# re-evaluation" (trigger=periodic). If mutation never creates enough
# asymmetry in a particular seed, the test still validates that periodic
# re-eval runs without interference.

scenario:
  name: "cost-reeval"
  seed: 42
  duration_secs: 180

topology:
  algorithm: explicit
  num_nodes: 4
  params:
    adjacency:
      - [n01, n02]
      - [n01, n03]
      - [n02, n04]
      - [n03, n04]
  subnet: "172.20.0.0/24"
  ip_start: 10

netem:
  enabled: true
  default_policy:
    # Fiber-like baseline
    delay_ms: [1, 5]
    jitter_ms: [0, 1]
    loss_pct: [0, 0.5]
  mutation:
    interval_secs: {min: 12, max: 18}
    fraction: 0.5
    policies:
      degraded:
        delay_ms: [15, 40]
        jitter_ms: [5, 15]
        loss_pct: [2, 8]

link_flaps:
  enabled: false

traffic:
  enabled: true
  max_concurrent: 1
  interval_secs: {min: 15, max: 30}
  duration_secs: {min: 5, max: 10}
  parallel_streams: 2

logging:
  rust_log: "info"
  output_dir: "./sim-results"

fips_overrides:
  node:
    tree:
      reeval_interval_secs: 15
