@takodotid/circuit 0.4.3

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 (38) hide show
  1. package/LICENSE +106 -0
  2. package/README.md +195 -0
  3. package/package.json +83 -0
  4. package/src/adapters/devices/catalog.ts +38 -0
  5. package/src/adapters/devices/derive.ts +27 -0
  6. package/src/adapters/devices/index.ts +7 -0
  7. package/src/adapters/devices/lines.ts +212 -0
  8. package/src/adapters/devices/raisecom-ros/TRAPS.md +22 -0
  9. package/src/adapters/devices/raisecom-ros/index.ts +603 -0
  10. package/src/adapters/devices/raisecom-ros/models.ts +7 -0
  11. package/src/adapters/devices/routeros/TRAPS.md +33 -0
  12. package/src/adapters/devices/routeros/export.ts +319 -0
  13. package/src/adapters/devices/routeros/index.ts +261 -0
  14. package/src/adapters/devices/routeros/models.ts +8 -0
  15. package/src/adapters/devices/routeros/plan.ts +370 -0
  16. package/src/adapters/devices/routeros/render.ts +1431 -0
  17. package/src/adapters/devices/types.ts +31 -0
  18. package/src/adapters/devices/vrp/TRAPS.md +22 -0
  19. package/src/adapters/devices/vrp/index.ts +742 -0
  20. package/src/adapters/devices/vrp/models.ts +4 -0
  21. package/src/adapters/registries/index.ts +19 -0
  22. package/src/adapters/registries/peeringdb.ts +169 -0
  23. package/src/cli/index.ts +295 -0
  24. package/src/core/addr.ts +145 -0
  25. package/src/core/define.ts +94 -0
  26. package/src/core/secrets.ts +68 -0
  27. package/src/core/time.ts +15 -0
  28. package/src/core/validate.ts +380 -0
  29. package/src/index.ts +6 -0
  30. package/src/schema/common.ts +32 -0
  31. package/src/schema/device.ts +95 -0
  32. package/src/schema/firewall.ts +128 -0
  33. package/src/schema/index.ts +7 -0
  34. package/src/schema/interfaces.ts +192 -0
  35. package/src/schema/policy.ts +88 -0
  36. package/src/schema/routing.ts +120 -0
  37. package/src/schema/system.ts +191 -0
  38. package/src/transport/ssh.ts +125 -0
@@ -0,0 +1,31 @@
1
+ import type { Device, Family } from "../../schema";
2
+
3
+ /** One part of a plan: what a reviewer reads, and what is sent. */
4
+ export type Step = { title: string; show: string[]; send: string[] };
5
+
6
+ /** The commands that turn what a device runs into what its config says. `problems` blocks an apply: something the adapter cannot converge. */
7
+ export type Plan = { steps: Step[]; problems: string[] };
8
+
9
+ export type ApplyOptions = {
10
+ /** Also send every secret, so a rotated value reaches the device. Secrets cannot be read back, so they are otherwise only sent when the object holding them is new. */
11
+ secrets: boolean;
12
+ /** Minutes before a platform that can restore itself does so, if the run does not prove access survived. */
13
+ rollback: number;
14
+ };
15
+
16
+ export type DeviceAdapter = {
17
+ /** File extension of a saved snapshot, for syntax highlighting. */
18
+ extension: string;
19
+ /** Fields this platform cannot express. Validation fails on any of them, so nothing is skipped silently. */
20
+ unsupported(device: Device): string[];
21
+ /** The whole configuration the device should run. Secrets appear as markers, never values. */
22
+ render(device: Device): string;
23
+ /** What the device runs now, secrets removed, in the form `render` produces where the platform allows. */
24
+ read(device: Device, network: readonly Device[]): Promise<string>;
25
+ /** What it takes to go from `current` to `desired`. */
26
+ plan(desired: string, current: string, options: ApplyOptions): Plan;
27
+ /** Replace the contents of a prefix set fetched from a registry. Absent on a platform that cannot hold one. */
28
+ fill?(device: Device, network: readonly Device[], set: string, family: Family, prefixes: string[]): Promise<void>;
29
+ /** Send a plan, keeping the device reachable or restoring it. */
30
+ apply(device: Device, network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
31
+ };
@@ -0,0 +1,22 @@
1
+ # VRP traps
2
+
3
+ Behaviour that looks like something else. Each one has been hit on a CE6855 running V200R005.
4
+
5
+ - Changes stage in a candidate and apply at `commit`. `commit` does not write to flash; without `save` a reboot restores the old configuration. `save` asks `[Y/N]`.
6
+ - An ACL bound to a service with no rules denies everything, including the session doing it. Rules and binding go in one commit.
7
+ - The first login asks to change the password. Answering Y replaces it at once and invalidates every stored credential; always answer N.
8
+ - SSH negotiates an ECDSA host key it then signs wrongly, so the handshake fails. Pin `ssh-rsa`.
9
+ - Connections in quick succession are refused before authentication for a while. Connect one at a time.
10
+ - Accounts lock after a few failures and the last ten passwords are refused. A retry loop locks the account out.
11
+ - A `?` sent by a script is executed, not treated as help. Never send one.
12
+ - `reset saved-configuration` erases the management address. Never over the network.
13
+ - The prompt shows commit state: `[~host]` clean, `[*host]` uncommitted. Read `display configuration candidate` when in doubt.
14
+ - LLDP is off by default. A port setting for LLDP is refused until it is on globally.
15
+ - A trunk forwards its native VLAN's untagged frames only when that VLAN is also allowed; the adapter adds it.
16
+ - The name `admin` is refused for a local user.
17
+ - A port joins an Eth-Trunk only while it holds no other setting, including a description.
18
+ - An empty block such as `bfd` enters its view; the next line sent goes into it unless the view is left.
19
+ - SNMPv3 passwords are asked for interactively, twice. `authentication-mode` must come before `privacy-mode`.
20
+ - `abort` is not a command here. `clear configuration candidate` discards uncommitted changes.
21
+ - sFlow samples per port, `sflow sampling rate N`, N from 4096; the default is 8192 and an explicit 8192 is kept as written. A port names a collector only once the collector exists globally; until then it is refused with "collector does not exist".
22
+ - `vlan batch` holds every VLAN on one line, and undoing a list that names a VLAN with an L3 interface is refused. A change sends only the VLANs added and `undo vlan batch` for the ones removed.