mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 00:50:46 +08:00
Show aux commands in biz-state UI; keep only config_vrf under BGP VRF summary.
Add an Aux column for each monitor item. Drop ip_route/ipv6_route as summary enrich aux so FIB stays a standalone collect profile. Export defaults to primary commands only. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
67930bb348
commit
089c88d35e
9 changed files with 116 additions and 29 deletions
|
|
@ -76,19 +76,30 @@ class BizStateExportCommandsTests(unittest.TestCase):
|
|||
)
|
||||
self.db.commit()
|
||||
|
||||
plan = plan_task_collect_commands(self.db, self.task.id, include_aux=True)
|
||||
plan = plan_task_collect_commands(self.db, self.task.id)
|
||||
self.assertEqual(plan["ne_name"], "PE1")
|
||||
self.assertGreaterEqual(plan["command_count"], 2)
|
||||
cmds = plan["commands"]
|
||||
self.assertTrue(any("lldp" in c.lower() for c in cmds))
|
||||
self.assertTrue(any("CUST_A" in c for c in cmds))
|
||||
self.assertTrue(any("CUST_A" in c and "summary" in c for c in cmds))
|
||||
# Default export is primary-only (no FIB/config aux under BGP summary)
|
||||
self.assertFalse(any("forwarding route" in c for c in cmds))
|
||||
self.assertFalse(any("running-config vrf" in c for c in cmds))
|
||||
# Disabled item excluded by default
|
||||
self.assertFalse(any("isis" in c.lower() for c in cmds))
|
||||
|
||||
with_aux = plan_task_collect_commands(
|
||||
self.db, self.task.id, include_aux=True
|
||||
)
|
||||
# BGP VRF summary aux is only config_vrf (FIB is a separate monitor item)
|
||||
self.assertTrue(any("running-config vrf" in c for c in with_aux["commands"]))
|
||||
self.assertFalse(any("forwarding route" in c for c in with_aux["commands"]))
|
||||
|
||||
text = export_task_commands_text(self.db, self.task.id)
|
||||
self.assertIn("task_id=t_export", text)
|
||||
self.assertIn("show lldp neighbor brief", text)
|
||||
self.assertIn("CUST_A", text)
|
||||
self.assertNotIn("# aux:", text)
|
||||
self.assertIn("# ---- flat unique commands ----", text)
|
||||
|
||||
def test_unbound_required_placeholder_noted(self) -> None:
|
||||
|
|
|
|||
|
|
@ -578,20 +578,20 @@ class ZteExtendedParserTests(unittest.TestCase):
|
|||
|
||||
v4 = get_profile("zte.bgp_vpnv4_vrf_summary")
|
||||
assert v4 is not None
|
||||
self.assertTrue(any(a.key == "ip_route" for a in v4.aux_commands))
|
||||
self.assertEqual([a.key for a in v4.aux_commands], ["config_vrf"])
|
||||
with self.assertRaises(ValueError):
|
||||
expand_from_bindings(profile=v4, bindings=[])
|
||||
bound = expand_from_bindings(profile=v4, bindings=[{"vrf": "CUST_A"}])
|
||||
self.assertEqual(bound[0][0], "show bgp vpnv4 unicast vrf CUST_A summary | one-line")
|
||||
ra_ip = resolve_aux_command(
|
||||
next(a for a in v4.aux_commands if a.key == "ip_route"),
|
||||
ra_cfg = resolve_aux_command(
|
||||
next(a for a in v4.aux_commands if a.key == "config_vrf"),
|
||||
params={"vrf": "CUST_A"},
|
||||
)
|
||||
self.assertEqual(ra_ip.command, "show ip forwarding route vrf CUST_A | one-line")
|
||||
self.assertEqual(ra_cfg.command, "show running-config vrf | one-line")
|
||||
|
||||
v6 = get_profile("zte.bgp_vpnv6_vrf_summary")
|
||||
assert v6 is not None
|
||||
self.assertTrue(any(a.key == "ipv6_route" for a in v6.aux_commands))
|
||||
self.assertEqual([a.key for a in v6.aux_commands], ["config_vrf"])
|
||||
|
||||
records = [
|
||||
{"vrf_name": "CUST_A", "address_families": "ipv4,ipv6", "rd": "100:1"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue