@takodotid/circuit 0.43.1 → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/README.md +115 -37
  2. package/package.json +21 -58
  3. package/src/checks/across.ts +402 -0
  4. package/src/checks/built-in.ts +256 -0
  5. package/src/checks/device.ts +436 -0
  6. package/src/checks/index.ts +53 -0
  7. package/src/cli/advisories.ts +108 -0
  8. package/src/cli/app.ts +71 -0
  9. package/src/cli/editor-types.generated.ts +30 -0
  10. package/src/cli/editor-types.ts +69 -0
  11. package/src/cli/format.ts +124 -0
  12. package/src/cli/git-hooks.ts +79 -0
  13. package/src/cli/index.ts +350 -1170
  14. package/src/cli/migrate.ts +554 -0
  15. package/src/cli/project-commands.ts +656 -0
  16. package/src/cli/releases.ts +374 -0
  17. package/src/cli/remember.ts +339 -0
  18. package/src/cli/rename.ts +27 -33
  19. package/src/cli/secrets-password.ts +60 -0
  20. package/src/cli/secrets.ts +258 -0
  21. package/src/cli/setup.ts +300 -0
  22. package/src/cli/signing.ts +23 -0
  23. package/src/cli/text-editor.ts +268 -0
  24. package/src/cli/ui.ts +298 -0
  25. package/src/cli/version.ts +2 -0
  26. package/src/cli/versions.ts +158 -0
  27. package/src/config/address.ts +102 -0
  28. package/src/config/circuit.d.ts +30 -0
  29. package/src/config/common.ts +65 -0
  30. package/src/config/communities.ts +479 -0
  31. package/src/config/define.ts +684 -0
  32. package/src/config/device.ts +164 -0
  33. package/src/config/firewall.ts +150 -0
  34. package/src/config/index.ts +22 -0
  35. package/src/{schema → config}/interfaces.ts +121 -85
  36. package/src/config/keys.ts +434 -0
  37. package/src/config/management.ts +61 -0
  38. package/src/config/merge.ts +335 -0
  39. package/src/config/models.ts +70 -0
  40. package/src/config/monitoring.ts +64 -0
  41. package/src/config/network.ts +180 -0
  42. package/src/config/presets.ts +149 -0
  43. package/src/config/routing.ts +401 -0
  44. package/src/config/services.ts +51 -0
  45. package/src/config/switching.ts +84 -0
  46. package/src/config/system.ts +103 -0
  47. package/src/{schema → config}/time-zones.ts +1 -1
  48. package/src/core/address.ts +1 -1
  49. package/src/core/cabling.ts +8 -43
  50. package/src/core/graph.ts +40 -0
  51. package/src/{integrations → core}/registries.ts +5 -3
  52. package/src/core/secrets-file.ts +539 -0
  53. package/src/core/secrets.ts +83 -64
  54. package/src/core/topology.ts +103 -146
  55. package/src/core/utils.ts +12 -1
  56. package/src/model.ts +83 -0
  57. package/src/platforms/derive.ts +64 -37
  58. package/src/platforms/finding.ts +9 -0
  59. package/src/platforms/fortios/firewall.ts +76 -64
  60. package/src/platforms/fortios/index.ts +189 -125
  61. package/src/platforms/fortios/names.ts +51 -18
  62. package/src/platforms/fortios/render.ts +69 -62
  63. package/src/platforms/fortios/routing.ts +89 -58
  64. package/src/platforms/fortios/vdoms.ts +47 -16
  65. package/src/platforms/junos/TRAPS.md +2 -2
  66. package/src/platforms/junos/bgp.ts +63 -42
  67. package/src/platforms/junos/index.ts +122 -89
  68. package/src/platforms/junos/render.ts +139 -104
  69. package/src/platforms/platform.ts +10 -8
  70. package/src/platforms/raisecom-ros/TRAPS.md +1 -1
  71. package/src/platforms/raisecom-ros/index.ts +89 -70
  72. package/src/platforms/raisecom-ros/render.ts +49 -45
  73. package/src/platforms/routeros/TRAPS.md +3 -3
  74. package/src/platforms/routeros/index.ts +121 -60
  75. package/src/platforms/routeros/render.ts +214 -195
  76. package/src/platforms/vrp/TRAPS.md +1 -1
  77. package/src/platforms/vrp/index.ts +74 -50
  78. package/src/platforms/vrp/render.ts +67 -56
  79. package/src/project/project.ts +725 -0
  80. package/src/studio/app/env.d.ts +9 -0
  81. package/src/studio/app/index.html +18 -0
  82. package/src/studio/app/src/App.vue +95 -0
  83. package/src/studio/app/src/components/AddressesView.vue +38 -0
  84. package/src/studio/app/src/components/CablesView.vue +29 -0
  85. package/src/studio/app/src/components/CompareView.vue +160 -0
  86. package/src/studio/app/src/components/DataTable.vue +49 -0
  87. package/src/studio/app/src/components/DeviceView.vue +237 -0
  88. package/src/studio/app/src/components/DevicesView.vue +32 -0
  89. package/src/studio/app/src/components/Faceplate.vue +75 -0
  90. package/src/studio/app/src/components/GraphView.vue +282 -0
  91. package/src/studio/app/src/components/LineDiff.vue +24 -0
  92. package/src/studio/app/src/components/ProblemsView.vue +42 -0
  93. package/src/studio/app/src/components/SearchView.vue +72 -0
  94. package/src/studio/app/src/components/SecretsView.vue +112 -0
  95. package/src/studio/app/src/components/SessionsView.vue +35 -0
  96. package/src/studio/app/src/components/Settings.vue +95 -0
  97. package/src/studio/app/src/components/ToolsView.vue +118 -0
  98. package/src/studio/app/src/components/VlansView.vue +50 -0
  99. package/src/studio/app/src/lib/csv.ts +19 -0
  100. package/src/studio/{public/diff.js → app/src/lib/diff.ts} +40 -35
  101. package/src/studio/app/src/lib/format.ts +38 -0
  102. package/src/studio/app/src/lib/net.ts +68 -0
  103. package/src/studio/app/src/lib/secrets-crypto.ts +35 -0
  104. package/src/studio/app/src/lib/store.ts +71 -0
  105. package/src/studio/app/src/lib/tools.ts +217 -0
  106. package/src/studio/app/src/main.ts +9 -0
  107. package/src/studio/{public → app/src}/style.css +14 -4
  108. package/src/studio/app/tsconfig.json +17 -0
  109. package/src/studio/app/vite.config.ts +16 -0
  110. package/src/studio/assets.generated.ts +3 -0
  111. package/src/studio/data.ts +96 -188
  112. package/src/studio/git.ts +27 -43
  113. package/src/studio/server.ts +196 -107
  114. package/src/studio/types.ts +141 -0
  115. package/src/transport/console.ts +3 -3
  116. package/src/transport/ssh.ts +1 -1
  117. package/dist/chunks/index-3b343xva.js +0 -177
  118. package/dist/chunks/index-6wb41q67.js +0 -62
  119. package/dist/chunks/index-n7w3tg5y.js +0 -149
  120. package/dist/chunks/index-yzw86rc8.js +0 -921
  121. package/dist/chunks/new-w3zys5y4.js +0 -172
  122. package/dist/chunks/server-cxr9ynxc.js +0 -259
  123. package/dist/cli/index.js +0 -12922
  124. package/dist/helpers/index.js +0 -881
  125. package/dist/index.js +0 -28
  126. package/dist/types/core/address-space.d.ts +0 -62
  127. package/dist/types/core/address.d.ts +0 -44
  128. package/dist/types/core/cabling.d.ts +0 -41
  129. package/dist/types/core/cross-checks.d.ts +0 -28
  130. package/dist/types/core/define.d.ts +0 -79
  131. package/dist/types/core/project-files.d.ts +0 -12
  132. package/dist/types/core/schema-docs.d.ts +0 -25
  133. package/dist/types/core/secrets.d.ts +0 -62
  134. package/dist/types/core/topology.d.ts +0 -96
  135. package/dist/types/core/utils.d.ts +0 -10
  136. package/dist/types/core/validator.d.ts +0 -23
  137. package/dist/types/helpers/bgp.d.ts +0 -195
  138. package/dist/types/helpers/cables.d.ts +0 -69
  139. package/dist/types/helpers/checks.d.ts +0 -36
  140. package/dist/types/helpers/exchange.d.ts +0 -55
  141. package/dist/types/helpers/filters.d.ts +0 -51
  142. package/dist/types/helpers/index.d.ts +0 -14
  143. package/dist/types/helpers/route-server.d.ts +0 -52
  144. package/dist/types/helpers/upstreams.d.ts +0 -192
  145. package/dist/types/index.d.ts +0 -10
  146. package/dist/types/integrations/librenms.d.ts +0 -60
  147. package/dist/types/integrations/netbox.d.ts +0 -89
  148. package/dist/types/integrations/peeringdb.d.ts +0 -24
  149. package/dist/types/integrations/prometheus.d.ts +0 -24
  150. package/dist/types/integrations/registries.d.ts +0 -8
  151. package/dist/types/platforms/bgp-wait.d.ts +0 -24
  152. package/dist/types/platforms/catalog.d.ts +0 -109
  153. package/dist/types/platforms/derive.d.ts +0 -17
  154. package/dist/types/platforms/fortios/firewall.d.ts +0 -47
  155. package/dist/types/platforms/fortios/index.d.ts +0 -140
  156. package/dist/types/platforms/fortios/models.d.ts +0 -14
  157. package/dist/types/platforms/fortios/names.d.ts +0 -52
  158. package/dist/types/platforms/fortios/plan.d.ts +0 -114
  159. package/dist/types/platforms/fortios/render.d.ts +0 -77
  160. package/dist/types/platforms/fortios/routing.d.ts +0 -56
  161. package/dist/types/platforms/fortios/tree.d.ts +0 -37
  162. package/dist/types/platforms/fortios/vdoms.d.ts +0 -50
  163. package/dist/types/platforms/index.d.ts +0 -13
  164. package/dist/types/platforms/junos/bgp.d.ts +0 -44
  165. package/dist/types/platforms/junos/index.d.ts +0 -114
  166. package/dist/types/platforms/junos/models.d.ts +0 -14
  167. package/dist/types/platforms/junos/render.d.ts +0 -154
  168. package/dist/types/platforms/line-diff.d.ts +0 -67
  169. package/dist/types/platforms/platform.d.ts +0 -135
  170. package/dist/types/platforms/raisecom-ros/index.d.ts +0 -71
  171. package/dist/types/platforms/raisecom-ros/models.d.ts +0 -14
  172. package/dist/types/platforms/raisecom-ros/render.d.ts +0 -41
  173. package/dist/types/platforms/routeros/export.d.ts +0 -59
  174. package/dist/types/platforms/routeros/index.d.ts +0 -116
  175. package/dist/types/platforms/routeros/models.d.ts +0 -18
  176. package/dist/types/platforms/routeros/plan.d.ts +0 -58
  177. package/dist/types/platforms/routeros/render.d.ts +0 -250
  178. package/dist/types/platforms/vrp/index.d.ts +0 -83
  179. package/dist/types/platforms/vrp/models.d.ts +0 -12
  180. package/dist/types/platforms/vrp/render.d.ts +0 -96
  181. package/dist/types/schema/common.d.ts +0 -30
  182. package/dist/types/schema/device.d.ts +0 -126
  183. package/dist/types/schema/firewall.d.ts +0 -131
  184. package/dist/types/schema/index.d.ts +0 -8
  185. package/dist/types/schema/interfaces.d.ts +0 -205
  186. package/dist/types/schema/policy.d.ts +0 -107
  187. package/dist/types/schema/routing.d.ts +0 -161
  188. package/dist/types/schema/system.d.ts +0 -198
  189. package/dist/types/schema/time-zones.d.ts +0 -2
  190. package/dist/types/transport/console.d.ts +0 -115
  191. package/dist/types/transport/path-check.d.ts +0 -32
  192. package/dist/types/transport/ssh.d.ts +0 -27
  193. package/src/cli/graph-format.ts +0 -91
  194. package/src/cli/new.ts +0 -234
  195. package/src/core/address-space.ts +0 -320
  196. package/src/core/cross-checks.ts +0 -369
  197. package/src/core/define.ts +0 -124
  198. package/src/core/project-files.ts +0 -35
  199. package/src/core/schema-docs.ts +0 -174
  200. package/src/core/validator.ts +0 -508
  201. package/src/helpers/bgp.ts +0 -473
  202. package/src/helpers/cables.ts +0 -74
  203. package/src/helpers/checks.ts +0 -201
  204. package/src/helpers/exchange.ts +0 -123
  205. package/src/helpers/filters.ts +0 -107
  206. package/src/helpers/index.ts +0 -25
  207. package/src/helpers/route-server.ts +0 -212
  208. package/src/helpers/upstreams.ts +0 -369
  209. package/src/index.ts +0 -13
  210. package/src/integrations/librenms.ts +0 -291
  211. package/src/integrations/netbox.ts +0 -620
  212. package/src/integrations/peeringdb.ts +0 -173
  213. package/src/integrations/prometheus.ts +0 -90
  214. package/src/schema/common.ts +0 -41
  215. package/src/schema/device.ts +0 -145
  216. package/src/schema/firewall.ts +0 -140
  217. package/src/schema/index.ts +0 -8
  218. package/src/schema/policy.ts +0 -115
  219. package/src/schema/routing.ts +0 -173
  220. package/src/schema/system.ts +0 -203
  221. package/src/studio/public/app.js +0 -186
  222. package/src/studio/public/compare.js +0 -250
  223. package/src/studio/public/dom.js +0 -138
  224. package/src/studio/public/evaluate.js +0 -687
  225. package/src/studio/public/export.js +0 -130
  226. package/src/studio/public/graph.js +0 -1541
  227. package/src/studio/public/index.html +0 -83
  228. package/src/studio/public/net.js +0 -134
  229. package/src/studio/public/tables.js +0 -1289
  230. package/src/studio/public/tools.js +0 -610
  231. package/templates/colocation/checks.ts +0 -53
  232. package/templates/colocation/circuit.config.ts +0 -9
  233. package/templates/colocation/edge-01.ts +0 -133
  234. package/templates/colocation/routing.ts +0 -13
  235. package/templates/colocation/tenancy.ts +0 -76
  236. package/templates/colocation/tenants/acme.ts +0 -19
  237. package/templates/colocation/tenants/index.ts +0 -6
  238. package/templates/colocation/tor-01.ts +0 -33
  239. package/templates/edge-router/checks.ts +0 -20
  240. package/templates/edge-router/circuit.config.ts +0 -8
  241. package/templates/edge-router/edge-01.ts +0 -110
  242. package/templates/edge-router/routing.ts +0 -13
  243. package/templates/project/AGENTS.md +0 -51
  244. package/templates/project/CLAUDE.md +0 -1
  245. package/templates/project/README.md +0 -16
  246. package/templates/project/gitignore +0 -5
  247. package/templates/project/tsconfig.json +0 -13
  248. package/templates/single-site/checks.ts +0 -26
  249. package/templates/single-site/circuit.config.ts +0 -8
  250. package/templates/single-site/router.ts +0 -86
  251. package/templates/single-site/site.ts +0 -18
  252. package/templates/single-site/switch.ts +0 -34
  253. /package/src/studio/{public → app/public}/favicon.svg +0 -0
  254. /package/src/studio/{public → app/public}/special-gothic-latin-ext.woff2 +0 -0
  255. /package/src/studio/{public → app/public}/special-gothic-latin.woff2 +0 -0
  256. /package/src/studio/{public → app/public}/special-gothic-license.txt +0 -0
@@ -1,59 +0,0 @@
1
- export type Command = {
2
- /** The menu the command belongs to, such as `/ip address`. */
3
- menu: string;
4
- verb: "add" | "set";
5
- /** What a `set` addresses: `[ find default-name=ether1 ]`, `ftp`, `1`, or nothing for a menu of one. */
6
- selector: string;
7
- /** Words without a value, such as `blackhole`. */
8
- flags: string[];
9
- /** Properties, unquoted and unescaped. */
10
- attrs: Record<string, string>;
11
- };
12
- export type Parsed = {
13
- commands: Command[];
14
- /** Address lists whose entries are filled by `refresh`, not by the render. */
15
- generated: Set<string>;
16
- };
17
- export declare class RouterOsExport {
18
- /**
19
- * Values the platform holds when nothing was set, per menu, and under `*` for every menu.
20
- *
21
- * A property at its default is dropped from both sides of a comparison, and this is the value a property the config does not state is reset to. A property the device holds that is not here cannot be reset, which the plan reports as a problem.
22
- */
23
- private static readonly DEFAULTS;
24
- /** Whether each `/ip service` ships disabled. */
25
- private static readonly SERVICE_DISABLED;
26
- /** Helpers of `/ip firewall service-port` that ship disabled. The rest ship enabled. */
27
- private static readonly HELPER_DISABLED;
28
- /** A property the device stops printing once another returns to its default. Resetting that other one clears it, so it is never reset on its own. */
29
- static readonly CLEARED_WITH: Record<string, Record<string, string>>;
30
- /** Properties whose value cannot be read back from the device. They are compared only by the presence of what holds them. */
31
- static readonly SECRET_KEYS: Set<string>;
32
- /** Properties that tell two `add` entries of a menu apart. `name` where the menu is not listed. */
33
- private static readonly IDENTITY;
34
- /** Menus whose entries are an ordered list without names. They are rewritten whole, in the order the render gives. */
35
- static readonly ORDERED: Set<string>;
36
- /** Undo the line wrapping an export applies: a backslash at the end of a line continues it. */
37
- private static unwrap;
38
- /** A quoted value without its quotes and escapes. `\_` is an escaped space. */
39
- private static unquote;
40
- /** Split a command into words, keeping quoted values and bracketed selectors whole. */
41
- private static words;
42
- /** One `add` or `set` line into a command. */
43
- private static parseLine;
44
- static parse(text: string): Parsed;
45
- /** The default of one property of a command, or undefined when it is not known. */
46
- static defaultOf(command: Command, property: string): string | undefined;
47
- /** How the renderer writes a secret. */
48
- static isSecretMarker(value: string): boolean;
49
- /** A filter rule as the platform prints it, with its own spacing, squeezed so that only a real change survives. */
50
- private static canonicalRule;
51
- /** One property value in the form both sides compare in. */
52
- private static normalValue;
53
- /** A command's properties without defaults or secrets, in the form both sides compare in. */
54
- static normal(command: Command): Record<string, string>;
55
- /** What identifies an `add` entry, so that the same entry is found on both sides. */
56
- static identity(command: Command): Record<string, string>;
57
- /** One command as a string that is equal for equal commands. */
58
- static canonical(command: Command): string;
59
- }
@@ -1,116 +0,0 @@
1
- import type { Neighbor } from "../../core/cabling.js";
2
- import type { Finding } from "../../core/define.js";
3
- import type { Device, Family } from "../../schema/index.js";
4
- import { type ConsoleDialect } from "../../transport/console.js";
5
- import { type ApplyOptions, type BgpLogLine, type BgpSession, type HealthCheck, type HealthOptions, type OsSupport, type Plan, type ReadOptions, type ReadSession, type SwitchRules, Platform } from "../platform.js";
6
- export declare class RouterOs extends Platform {
7
- /** How the RouterOS console asks for a login. The flags after the user turn off colours and terminal detection, without which the console redraws every line. */
8
- static readonly CONSOLE: ConsoleDialect;
9
- /** Why a MAC limit is refused: neither a bridge port nor a switch port has a learning limit on 7.23.5. */
10
- private static readonly NO_MAC_LIMIT;
11
- /** The major version this adapter renders for. Version 6 has a different BGP and filter language altogether. */
12
- private static readonly SUPPORTED_MAJOR;
13
- /** Both dumps stamp the time they were taken. Without the stamp, an unchanged device reads the same twice. */
14
- private static readonly EXPORT_TIMESTAMP;
15
- /** Lists certificates in the form the renderer writes them, since an export does not include them. One line, because a script sent over exec runs as one. */
16
- private static readonly LIST_CERTIFICATES;
17
- /**
18
- * Every BGP session, one line each: name, remote address, established, prefixes received, uptime, closed on its limit, the limit, when it last closed. Then each disabled connection, `disabled|<name>|<address>`. One line, because a script sent over exec runs as one.
19
- */
20
- private static readonly LIST_BGP_SESSIONS;
21
- /** Open again the session from one address, only while it is closed on its limit. */
22
- /** Each advertisement of these prefixes, one line each: `ADV|<session>|<prefix>`. One line, because a script sent over exec runs as one. */
23
- private static listAdvertisements;
24
- private static clearLimit;
25
- /**
26
- * Every LLDP neighbor, one line each: our interfaces, the port first and then the LAG and bridge it is in, the far system name, and the far port as LLDP reports it. `:tostr` keeps the interface list one value; joined to a string as it is, a list repeats the whole line for each of its items. One line, because a script sent over exec runs as one.
27
- */
28
- private static readonly LIST_NEIGHBORS;
29
- /** BGP log lines, without the `connection ...` lines a session that cannot connect repeats. */
30
- private static readonly BGP_LOG;
31
- /** The device's date and time, in the form its log prints: `2026-10-24 03:12:44`. */
32
- private static readonly CLOCK;
33
- /** The switch chip's rules. A rule it cannot hold is invalid, and so is every rule after it, with no log line (TRAPS.md). */
34
- private static readonly SWITCH_RULES;
35
- private static readonly COUNT_INVALID_SWITCH_RULES;
36
- private static readonly ROLLBACK_SCHEDULER;
37
- /** Commands that only read: print, monitor, ping, traceroute, torch, profile, sniffer quick, an AS-path regex test, export, and `:put`, `:foreach` or `:delay` scripts. */
38
- private static readonly READS;
39
- /** Words that change something, or print secrets. A command with any of them is refused, whatever else it holds. */
40
- private static readonly WRITES;
41
- /** Flags after the user over SSH: no colours, no terminal detection, 300 columns, so output is plain and lines are not cut. */
42
- private static readonly PLAIN_OUTPUT;
43
- readonly name = "routeros";
44
- readonly os: OsSupport;
45
- readonly extension = ".rsc";
46
- readonly console: ConsoleDialect;
47
- /**
48
- * A BGP session with a `table` announces from that table, not from main: each prefix of `networks` it announces needs a route in the table too, or it is not announced (TRAPS.md). A session left with nothing to announce is an error; a prefix missing from its table is a warning, since its export may not announce it anyway.
49
- */
50
- checks(device: Device): Finding[];
51
- unsupported(device: Device): string[];
52
- render(device: Device): string;
53
- switchRules(device: Device): SwitchRules;
54
- /**
55
- * What the device runs: its export, its users, and its certificates. Secrets are not part of an export.
56
- */
57
- read(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<string>;
58
- plan(desired: string, current: string, options: ApplyOptions): Plan;
59
- apply(device: Device, _network: readonly Device[], changes: Plan, options: ApplyOptions): Promise<void>;
60
- readOnly(command: string): boolean;
61
- /** Over SSH, each command runs on its own. */
62
- session(device: Device, options?: ReadOptions): Promise<ReadSession>;
63
- /**
64
- * A session is named `<connection>-<n>`, but a renamed connection keeps its session's old name until the session restarts. So a neighbor is matched by its address first, then by name.
65
- *
66
- * A session that is down says why: closed on its limit, or still connecting. A neighbor with no session and a disabled connection is admin down.
67
- */
68
- bgpSessions(device: Device, session: ReadSession): Promise<BgpSession[]>;
69
- bgpClearLimit(session: ReadSession, sessions: readonly BgpSession[]): Promise<void>;
70
- /** A `time>` filter in `/log print` does not filter, so the lines are kept here by comparing each one's time with the device's clock. */
71
- bgpLog(session: ReadSession, minutes: number): Promise<BgpLogLine[]>;
72
- /**
73
- * Three checks after an apply. When the plan touched switch rules, none may be invalid. BGP sessions established before the apply must be established again, and announce again each of the device's `networks` they announced before, within `BgpWait.AFTER_APPLY`. A session can stay up and stop announcing (TRAPS.md), which the session check alone would not see.
74
- */
75
- health(device: Device, plan: Plan, options?: HealthOptions): Promise<HealthCheck>;
76
- /** The LLDP neighbors the device sees, by Circuit's port names. */
77
- neighbors(device: Device, network: readonly Device[], options?: ReadOptions): Promise<Neighbor[]>;
78
- /** One line of `LIST_NEIGHBORS` as a neighbor. Our port is the first interface, by Circuit's name when it is a port. */
79
- private static neighbor;
80
- /**
81
- * RouterOS reports the far port's description, where it has one, not its name (TRAPS.md). When it is the description of exactly one port of that device in the network, that port is the far port, by Circuit's name; otherwise the report stays as it is.
82
- */
83
- private static farPort;
84
- /** Replace a list's entries in batches, so each command stays a sane length. */
85
- fill(device: Device, _network: readonly Device[], set: string, family: Family, prefixes: string[]): Promise<void>;
86
- /** The names of the configured neighbors whose session is established now. None, without logging in, on a device without BGP neighbors. */
87
- private establishedSessions;
88
- /** Wait until every one of these neighbors is established again, and give a problem for each that is not when time runs out. */
89
- private bgpBack;
90
- /** What each session announces of the device's own `networks`, as `neighbor prefix`. None, without logging in, on a device without networks. */
91
- private announcedNow;
92
- /** The `networks` each session announces, as `neighbor prefix`, sorted. An advertisement names its session, which is matched to its neighbor by address first, as in `bgpSessions`. */
93
- private announced;
94
- /** Wait until each session announces again what it announced before, and give a problem for each prefix a session no longer announces when time runs out. */
95
- private announcedBack;
96
- /** A problem when any switch rule is invalid, saying what to do. */
97
- private static invalidSwitchRules;
98
- /** Log in over SSH. `flags` go after the user, as RouterOS reads them: `+ct300w`. */
99
- private static login;
100
- private static sshSession;
101
- /** Log in on the console. `settle` is the quiet after the prompt a command waits for, as `ConsoleShell` takes it. */
102
- private static consoleSession;
103
- /** Log in over SSH, or on the console when asked. */
104
- private static open;
105
- /** Refuse a device on a version this adapter does not render for, before anything is read or sent. */
106
- private static checkVersion;
107
- /** A time as the clock and the log print it, `2026-10-24 03:12:44`, in milliseconds. Both are read the same way, so the computer's time zone does not matter. Not a number when the text is not such a time. */
108
- private static logTime;
109
- private static withoutTimestamp;
110
- /** Escape a command so it can sit inside a quoted string on the device. */
111
- private static escapeForString;
112
- /** Compile a command on the device without running it. Returns why it was refused, or undefined. */
113
- private static refusal;
114
- /** Upload a certificate and its key, import both under one name, and delete the files. */
115
- private static installCertificate;
116
- }
@@ -1,18 +0,0 @@
1
- export declare const models: {
2
- readonly "CCR2216-1G-12XS-2XQ": {
3
- readonly ports: {
4
- readonly "100g": 2;
5
- readonly "25g": 12;
6
- readonly "1g": 1;
7
- };
8
- readonly spelling: {
9
- readonly "100g": "qsfp28-{n}-1";
10
- readonly "25g": "sfp28-{n}";
11
- readonly "1g": "ether{n}";
12
- };
13
- readonly limits: {
14
- readonly lag_members: 8;
15
- readonly switch_port_ranges: 5;
16
- };
17
- };
18
- };
@@ -1,58 +0,0 @@
1
- import type { ApplyOptions, Plan } from "../platform.js";
2
- export declare class RouterOsPlan {
3
- private readonly sendSecrets;
4
- /** A plan line the apply handles itself: upload a certificate and its key, and import them. */
5
- static readonly INSTALL_CERTIFICATE = "#install-certificate ";
6
- /** Dependency order. A menu not listed sorts after all of these. The longest matching prefix decides. */
7
- private static readonly ORDER;
8
- /** Menus that also hold entries the device learned rather than was told. A selector must not match those. */
9
- private static readonly DYNAMIC;
10
- /** Menus where an entry that keeps its name but changes what it is known by is changed with a `set`, so what points at it by name, such as an address on a VLAN interface, stays attached. In every other menu it is removed and added again. */
11
- private static readonly CHANGED_IN_PLACE;
12
- /**
13
- * Properties a running entry takes only when it restarts. A BGP session given a new `routing-table` stops announcing at once and keeps its routes in the old table until it restarts (TRAPS.md), so the plan disables the connection, changes it and enables it again: one restart, written in the plan.
14
- */
15
- private static readonly RESTART_ON;
16
- /** The variable holding the old rules of an ordered menu while the new ones are added. Removed when the rewrite ends. */
17
- private static readonly OLD_RULES;
18
- /** What blocks an apply: something this plan cannot converge. */
19
- private readonly problems;
20
- /** Also send every secret, so a rotated value reaches the device. */
21
- private constructor();
22
- /** What it takes to go from `current` to `desired`. */
23
- static of(desired: string, current: string, options: Pick<ApplyOptions, "secrets">): Plan;
24
- private static rank;
25
- /** Quote a value for a command. */
26
- private static quote;
27
- /** A value as a command takes it: bare when plain, quoted otherwise. A bare value is checked by `:parse` against the values the property takes; a quoted one is not (TRAPS.md). */
28
- private static value;
29
- /** In a `find`, a quoted `yes` is a string and matches no boolean, while an unquoted slash matches nothing. Plain words go bare, anything else quoted. */
30
- private static findValue;
31
- /** A selector for the entry with this identity. */
32
- private static find;
33
- /** A whole command as sent: menu, verb, selector, flags, then properties. */
34
- private static line;
35
- private static describe;
36
- /** Group commands by menu. */
37
- private static byMenu;
38
- /**
39
- * The properties to send so that the device's entry matches the rendered one. A property the device holds and the render does not state is reset to its default.
40
- */
41
- private changes;
42
- /** Settings addressed by a selector: `set ftp ...`, `set [ find default=yes ] ...`. They are changed, never added or removed. */
43
- private settings;
44
- /** Entries, told apart by identity. New ones are added, changed ones set, and ones the render does not hold removed in the last phase. */
45
- private entries;
46
- /**
47
- * Certificates are installed from the config when missing or different, after the old one of that name is removed. One the device holds under another name, with the same fingerprint and key, is renamed rather than imported a second time. One the config does not hold is removed in the last phase.
48
- */
49
- private static certificates;
50
- /**
51
- * An ordered menu is rewritten whole whenever it differs, so the device lists its rules in the order the render gives.
52
- *
53
- * The old rules are captured, the new ones added after them, then the captured ones removed. Until that moment the old rules keep deciding, so no chain is ever empty or half new.
54
- *
55
- * In a menu with chains, an old rule is removed in this step only if its chain is still wanted. A chain no longer wanted is removed in the last phase, after whatever pointed at it has been changed.
56
- */
57
- private static ordered;
58
- }
@@ -1,250 +0,0 @@
1
- import type { AclRule, Device, Ethertype, Interface, Port } from "../../schema/index.js";
2
- /** A property value as a command takes it. `undefined` and `false` leave the property out. */
3
- export type Value = string | number | undefined | false;
4
- export type AnyPort = Port<string, string, string, string>;
5
- /** One switch rule: the port it is on, the ACL rule it comes from, and the one source and destination port or range it takes. */
6
- export type SwitchRule = {
7
- port: string;
8
- rule: AclRule<string>;
9
- srcPort?: string;
10
- dstPort?: string;
11
- };
12
- export type AnyInterface = Interface<string, string>;
13
- type Speed = NonNullable<AnyPort["speed"]>;
14
- /** One device's render: the device, and the commands collected under their menu. */
15
- export declare class RouterOsRender {
16
- private readonly device;
17
- /** The bridge every switched port joins. One per device. */
18
- private static readonly BRIDGE;
19
- /** Destination of spanning tree BPDUs, so a filter can drop them on one port. */
20
- private static readonly BPDU_DESTINATION;
21
- /** The platform names a fixed speed by its medium: an optic in a cage, or copper. */
22
- private static readonly MEDIUM;
23
- /** Address lists holding the prefixes BGP originates. A session reads the one of its family. */
24
- private static readonly NETWORKS;
25
- /** A kind of frame as a switch rule's `mac-protocol` names it. */
26
- private static readonly MAC_PROTOCOLS;
27
- /** Helpers the platform has, all stated so that one the config does not list is off. */
28
- private static readonly HELPERS;
29
- private static readonly CHAINS;
30
- /** The validator group every RPKI server joins. */
31
- private static readonly RPKI_GROUP;
32
- /** The chain a session without a policy uses, so that it learns or announces nothing. */
33
- private static readonly REJECT_ALL;
34
- private static readonly ROLES;
35
- /** Neutral service name to the platform's. `native` is the platform's own desktop client. */
36
- private static readonly SERVICES;
37
- private static readonly USER_GROUPS;
38
- private static readonly SNMP_AUTH;
39
- private static readonly SNMP_PRIVACY;
40
- /** Severity threshold to the topics the platform logs under, most severe first. */
41
- private static readonly TOPICS;
42
- private static readonly SEVERITY_ORDER;
43
- private readonly ports;
44
- private readonly interfaces;
45
- /** Commands under their menu. */
46
- private readonly menus;
47
- private constructor();
48
- /** The whole configuration the device should run. */
49
- static of(device: Device): string;
50
- /** The platform's name for a fixed speed on a port, or undefined when it has none. */
51
- static medium(platformPortName: string, speed: Speed): string | undefined;
52
- /** Quote a value when it holds anything but plain characters. */
53
- private static quote;
54
- /**
55
- * A command: a verb such as `add` or `set [ find name=x ]`, then `property=value` for every property that has a value.
56
- *
57
- * Properties are written in the order given.
58
- */
59
- private static command;
60
- /** `yes` or `no`. */
61
- private static yesNo;
62
- /** `V4` or `V6`, the suffix of a chain rendered for one family. */
63
- private static familySuffix;
64
- /** Each port or range of ports as the platform writes it: `53`, `0-52`. */
65
- private static eachPort;
66
- /** One port, a range, or a list of them, as `53,0-52`. */
67
- private static portList;
68
- /** Seconds as the platform writes a duration: `3600` becomes `1h`, `90` becomes `1m30s`. */
69
- private static duration;
70
- /** A rate as the switch chip takes it: `2G` becomes `2.0Gbps`. */
71
- private static bitrate;
72
- /** An IPv4 prefix with a dotted mask, as the switch chip takes it: `10.0.0.0/8` becomes `10.0.0.0/255.0.0.0`. */
73
- private static dottedMask;
74
- /** A community pattern with `*` as a regular expression the platform matches on: `64500:*:*` becomes `^64500:[0-9]+:[0-9]+$`. */
75
- private static communityPattern;
76
- /** The name of the VLAN interface under one with a MAC of its own, which takes the configured name itself. */
77
- private static underMacvlan;
78
- /** The interface holding one VRRP group. */
79
- private static vrrpName;
80
- /** `host:port` into its parts. The last colon separates them, so an IPv6 host keeps its own. */
81
- private static splitEndpoint;
82
- /** The chain a policy is rendered as for one family. A policy can test prefix lengths that mean different things per family, so each family gets its own. */
83
- private static chainName;
84
- /** The conditions of a rule, as the platform's filter language writes them. */
85
- private static conditions;
86
- /** What a rule does to a matching route, then its decision. */
87
- private static actions;
88
- /** One rule as the platform writes it: hand off, ask the validator, test, change, decide. */
89
- private static ruleText;
90
- /** SHA-256 of the certificate's DER encoding, lowercase hex, as the platform prints it. */
91
- private static fingerprint;
92
- /** Every topic at or above a severity. Emergency and alert are logged as critical; the platform has no notice topic. */
93
- private static topicsFrom;
94
- /** Add a line to a menu as it is. */
95
- private addLine;
96
- /** Add a command to a menu. */
97
- private add;
98
- /** The whole configuration as text. */
99
- private text;
100
- /** What the platform calls a port or an interface. A port is spelled by the model; an interface keeps its config name. */
101
- private name;
102
- /** The number of a VLAN, by its config name. */
103
- private vlanId;
104
- /** Ports and LAGs that are layer 2 members of a VLAN, with their settings. A port in a LAG is represented by the LAG. */
105
- private switched;
106
- /** VLAN interfaces, with their settings. */
107
- private declaredVlanInterfaces;
108
- /** Every port and interface that holds addresses or other layer 3 settings. Ports are named as the platform spells them. */
109
- private routed;
110
- private interfaceMenus;
111
- /**
112
- * Routing in the switch chip. With it on, routed traffic bypasses the forward chain unless its interface opts out.
113
- *
114
- * Restarting the offload after a failure, and offloading IPv6 too, follow the same switch.
115
- */
116
- private hardwareOffload;
117
- /** One VLAN-filtering bridge carries every switched port. A loopback is a bridge with no ports, the platform's idiom for one. */
118
- private bridge;
119
- /** Every port of the model is stated. One the config does not declare is disabled. */
120
- private ethernet;
121
- /**
122
- * Storm control in the switch chip. The platform takes one rate, in percent, and which kinds of flooded traffic it limits.
123
- *
124
- * `unsupported()` refuses packets per second and different percentages per kind, so here they are always one shared percent.
125
- */
126
- private switchPorts;
127
- /** A LAG is a bonding interface. Its members are named as the platform spells them. */
128
- private lags;
129
- /**
130
- * A VLAN interface sits on the bridge. When the device offloads, one that opts out is routed in software so the firewall applies.
131
- *
132
- * Every VLAN interface on the bridge has the bridge's MAC. One with a MAC of its own is a MACVLAN on top of the VLAN interface: the MACVLAN takes the configured name, so its addresses and every rule naming it land on it.
133
- */
134
- private vlanInterfaces;
135
- private tunnels;
136
- private wireguard;
137
- /** Each VRRP group is an interface of its own, holding the shared address. Version 3 carries IPv6. */
138
- private vrrp;
139
- /** A switched port or LAG joins the bridge. Its untagged VLAN is its port VLAN ID. */
140
- private bridgePorts;
141
- /** A VLAN is tagged on every trunk carrying it, and on the bridge itself when the router has an interface in it. */
142
- private bridgeVlans;
143
- /** The platform cannot take a port out of spanning tree, so `stp: false` drops the BPDUs it would send and receive. */
144
- private bridgeFilters;
145
- /**
146
- * Interface lists scope what works at layer 2: neighbor discovery, and the platform's own client over MAC. The IP firewall never sees either.
147
- */
148
- private interfaceLists;
149
- /**
150
- * Where LLDP runs, when it is limited to some ports. Undefined when it runs everywhere or nowhere, which the discovery settings say directly.
151
- */
152
- private lldpMembers;
153
- /** A VRF lists its interfaces. */
154
- private vrfs;
155
- private addressing;
156
- /** Every address goes on the menu of its family, with the interface's description as its comment. */
157
- private addresses;
158
- private dhcp;
159
- private dns;
160
- /**
161
- * Address lists come from firewall address sets, prefix sets typed in the config, and what BGP originates.
162
- *
163
- * A prefix set fetched from a registry is filled by `refresh`, so only its name is marked, and the plan leaves its entries alone.
164
- */
165
- private addressLists;
166
- private firewall;
167
- /**
168
- * Untracked prefixes skip connection tracking in the raw table, both ways, before a connection is ever made.
169
- *
170
- * An address NAT uses inside one stays tracked, by an `accept` in each direction before every `notrack`: a reply to it that skipped tracking would never be translated back.
171
- */
172
- private untracked;
173
- /** Every address NAT translates to or from: each translation's target, and the address a destination translation matches. Once each, in rule order. */
174
- static natAddresses(device: Device): string[];
175
- /**
176
- * The families a rule applies to. An address in the rule decides it; otherwise it applies to both.
177
- *
178
- * A rule naming an address set applies only to the families the set has members in.
179
- */
180
- private families;
181
- /** The match properties of a rule, as the platform names them. */
182
- private matchProperties;
183
- private filter;
184
- private nat;
185
- private helpers;
186
- /**
187
- * ACLs run in the switch chip on the port traffic arrives on. The chip matches addresses with a dotted mask on IPv4, drops by forwarding to no port, and limits by rate. A rule takes one port or range, so a list becomes one rule for each.
188
- */
189
- private switchAcls;
190
- /**
191
- * A port that takes only some kinds of frame: a rule that lets each kind through, then one that drops the rest. The chip takes the first rule that matches on the port, so these come after the port's ACL, whose rules match only IPv4 or IPv6.
192
- */
193
- private ethertypeFilters;
194
- /** The ports with an ethertype filter, with the kinds each takes. Each makes one switch rule per kind and one more. */
195
- static ethertypeFilters(device: Device): {
196
- port: string;
197
- ethertypes: readonly Ethertype[];
198
- }[];
199
- /** Every switch rule the device's hardware ACLs make, in order: one for each port with an ACL, each rule of it, and each source and destination port or range of the rule. */
200
- static switchRules(device: Device): SwitchRule[];
201
- private routing;
202
- /** A table beside the main one. `fib` puts its routes in the forwarding table, so traffic can be routed by them. */
203
- private routingTables;
204
- /** Rules in the order written. `lookup-only-in-table` drops what the table has no route for, and `lookup` falls back to the main table. */
205
- private routingRules;
206
- private staticRoutes;
207
- private rpki;
208
- /** The default instance exists on every device; it is stated in the form the export prints it. */
209
- private bgpInstance;
210
- /** A neighbor's settings with its group's beneath them. */
211
- private settingsOf;
212
- /** The families a neighbor exchanges: the ones it states, or its address's. */
213
- private familiesOf;
214
- /** Does a rule belong on a family's chain? A rule naming a prefix, a family, or a prefix set of one family belongs only there. */
215
- private appliesTo;
216
- /**
217
- * Policies become filter chains, one per family a session uses, plus every chain those call.
218
- *
219
- * A chain a session uses directly ends in a reject when its last rule does not decide, so a route nothing accepted is rejected on any platform default. A chain only called returns to its caller instead.
220
- */
221
- private policies;
222
- /** One connection per neighbor. The platform carries one family per connection. */
223
- private bgpConnections;
224
- /** One instance per OSPF version, an area per area and instance, and a template per interface. */
225
- private ospf;
226
- /**
227
- * BFD runs where a session or an OSPF interface asks for it, with the device's timers when it states them. One configuration covers every interface. A multihop session has no interface, and BFD for it is forbidden unless a configuration names its address, so each gets one of its own.
228
- */
229
- private bfd;
230
- private management;
231
- /** Every service the platform has is stated. One the config does not name is disabled. */
232
- private services;
233
- /** What works at layer 2: the platform's client over MAC, MAC ping, the bandwidth test server and neighbor discovery. */
234
- private layerTwo;
235
- /**
236
- * The platform keeps one community it will not delete. With version 2c it becomes the read community; without, it is disabled. Version 3 users are communities of their own.
237
- */
238
- private snmp;
239
- private users;
240
- /**
241
- * Certificates are not part of an export, so the reader lists them in this same form: a name, the SHA-256 fingerprint of the certificate, and whether the device holds its private key. A difference is installed from the config, not edited.
242
- */
243
- private certificates;
244
- private system;
245
- /** Local logging uses the platform's built-in disk action, number 1. Each remote collector gets an action of its own. */
246
- private logging;
247
- /** NetFlow version 9 and IPFIX through traffic flow. The platform has no sFlow, which `unsupported()` reports. */
248
- private flowExport;
249
- }
250
- export {};
@@ -1,83 +0,0 @@
1
- import type { Neighbor } from "../../core/cabling.js";
2
- import type { Device } from "../../schema/index.js";
3
- import { type ConsoleDialect } from "../../transport/console.js";
4
- import { type ApplyOptions, type OsSupport, type Plan, type ReadOptions, type ReadSession, Platform } from "../platform.js";
5
- export declare class Vrp extends Platform {
6
- /** How the console asks for a login: the same question to change the password, always answered no, a system view left with `return`, and the line's banner after a logout or a refused password answered with Enter. Not yet proved on a device. */
7
- static readonly CONSOLE: ConsoleDialect;
8
- /** Lines the device prints whatever is configured, or that describe the hardware rather than its configuration. */
9
- private static readonly DEVICE_FACTS;
10
- /** Lines whose removal takes only their keyword, not their value. */
11
- private static readonly UNDO_BY_KEYWORD;
12
- /** Lines a new line of the same kind replaces whole, so the old one is not undone first. */
13
- private static readonly REPLACED_WHOLE;
14
- private static readonly DIALECT;
15
- /** The platform offers an ECDSA host key it then signs wrongly, so RSA is asked for. */
16
- private static readonly HOST_KEYS;
17
- /** What the device prints when it refuses a line. */
18
- private static readonly REFUSED;
19
- /** A setting whose password the platform asks for interactively: the command, then the password, then the password again. */
20
- private static readonly INTERACTIVE;
21
- private static readonly NOT_SAVED;
22
- /** Commands that only read. A `?` sent by a script is run, not taken as help, so a line with one is refused. */
23
- private static readonly READS;
24
- readonly name = "vrp";
25
- readonly os: OsSupport;
26
- readonly extension = ".cfg";
27
- readonly console: ConsoleDialect;
28
- unsupported(device: Device): string[];
29
- render(device: Device): string;
30
- /** What the device runs, credentials scrubbed. */
31
- read(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<string>;
32
- /**
33
- * What changes, in the order the platform accepts.
34
- *
35
- * A VLAN list changes by ID. VLANs no longer used go first, with their VLAN interfaces, so their names and numbers are free before a new VLAN takes them: a VLAN name is unique, and a VLAN with an interface cannot be removed. The whole plan is one candidate, so going first leaves nothing half done.
36
- */
37
- plan(desired: string, current: string, options: ApplyOptions): Plan;
38
- apply(device: Device, _network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
39
- neighbors(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<Neighbor[]>;
40
- /**
41
- * The neighbors in `display lldp neighbor`: a header per port, `10GE1/0/2 has 1 neighbor(s):`, then a block per neighbor where `Port ID` comes before `System name`. A port Circuit does not know, such as the management port, is left out.
42
- */
43
- static neighborsOf(device: Device, output: string): Neighbor[];
44
- readOnly(command: string): boolean;
45
- /** One shell for every command, as the platform takes commands only there. */
46
- session(device: Device, options?: ReadOptions): Promise<ReadSession>;
47
- private static undo;
48
- /** Secrets the device prints as ciphers and the render writes as markers compare equal. */
49
- private static canon;
50
- /** Blocks other blocks refer to come first: VRFs, VLANs, the ACL and users, then device-wide lines, then LAGs, ports, VLAN interfaces, OSPF and logins. */
51
- private static order;
52
- /**
53
- * A log host the config no longer has is removed. One at the default level prints as `info-center loghost <address>`, whose head is the bare command, so a new log host would otherwise seem to replace it.
54
- */
55
- private static removeLoghosts;
56
- /** An ACL rule sent over a rule of the same number merges into it: `rule 10 deny` over `rule 10 permit source A` leaves `rule 10 deny source A`. A changed rule is undone first. */
57
- private static replaceRules;
58
- /** A static route's BFD template sent again replaces the old one whole, options left out included, so the old one is not undone: a route still uses it. */
59
- private static keepReplacedWhole;
60
- /** `undo alarm` is not a command: the `alarm` view goes once each line in it is undone. */
61
- private static emptyAlarmView;
62
- /** The VLAN IDs of a `vlan batch` line: `vlan batch 10 20 to 30`. */
63
- private static batchIds;
64
- private static login;
65
- /**
66
- * An interactive shell at the user prompt, paging off.
67
- *
68
- * Every login asks whether to change the password. Answering yes replaces it at once and every stored credential with it, so the answer is always no. Anything sent before the question is answered is taken as the answer.
69
- */
70
- private static shell;
71
- /** Log in on the console with paging off. Returns the console, a way to log in afresh, and how to let the console go. */
72
- private static openConsole;
73
- /** Log in on the console with paging off, run `work` with a way to log in afresh, and log out. */
74
- private static onConsole;
75
- /** The configuration in a dump, without the prompt or the stamp of the last change. */
76
- private static configurationOf;
77
- /** Send one line, answering a confirmation, and return what the device said. */
78
- private static sendLine;
79
- /** Send a plan into the candidate and commit it. A refused line clears the candidate, which leaves the device as it was. */
80
- private static commitPlan;
81
- /** Save what runs, so a reboot keeps it. */
82
- private static save;
83
- }
@@ -1,12 +0,0 @@
1
- export declare const models: {
2
- readonly "CE6855-48S6Q-HI": {
3
- readonly ports: {
4
- readonly "10g": 48;
5
- readonly "40g": 6;
6
- };
7
- readonly spelling: {
8
- readonly "10g": "10GE1/0/{n}";
9
- readonly "40g": "40GE1/0/{n}";
10
- };
11
- };
12
- };