use lager::LagerBox;use std::time::Duration;let lager = LagerBox::from_env()?;let router = lager.router("router1");let mut uart = lager.uart("uart1")?;router.connect()?;let outcome = (|| -> lager::Result<()> { router.block_internet()?; // The DUT stays on the AP; only routing is gone. let log = uart.wait_for(b"retry", Duration::from_secs(60))?; assert!(!String::from_utf8_lossy(&log).contains("rebooting"), "firmware rebooted instead of retrying"); Ok(())})();router.remove_firewall_rules()?; // always, even if the assertion failedoutcome?;
use serde_json::json;router.command("add_bandwidth_limit", json!({ "target": "192.168.88.50", "max_limit": "256k/256k",}))?;// ... trigger the OTA and wait for it ...router.command("remove_bandwidth_limits", json!({}))?;
这个 Net 不发送角色提示。 一个路由器 Net 可能以 router 角色保存,也可能以旧的 mikrotik 角色保存。Box 会严格校验给出的提示,因此提示在该 Net 未使用的那种写法上一定会失败。您会看到的一个后果是:不存在的路由器 Net 报告的是 Net 'router1' not found,不提角色,而其他 Net 类型报告的是 Net 'x (role adc)' not found。