@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.
- package/README.md +115 -37
- package/package.json +21 -58
- package/src/checks/across.ts +402 -0
- package/src/checks/built-in.ts +256 -0
- package/src/checks/device.ts +436 -0
- package/src/checks/index.ts +53 -0
- package/src/cli/advisories.ts +108 -0
- package/src/cli/app.ts +71 -0
- package/src/cli/editor-types.generated.ts +30 -0
- package/src/cli/editor-types.ts +69 -0
- package/src/cli/format.ts +124 -0
- package/src/cli/git-hooks.ts +79 -0
- package/src/cli/index.ts +350 -1170
- package/src/cli/migrate.ts +554 -0
- package/src/cli/project-commands.ts +656 -0
- package/src/cli/releases.ts +374 -0
- package/src/cli/remember.ts +339 -0
- package/src/cli/rename.ts +27 -33
- package/src/cli/secrets-password.ts +60 -0
- package/src/cli/secrets.ts +258 -0
- package/src/cli/setup.ts +300 -0
- package/src/cli/signing.ts +23 -0
- package/src/cli/text-editor.ts +268 -0
- package/src/cli/ui.ts +298 -0
- package/src/cli/version.ts +2 -0
- package/src/cli/versions.ts +158 -0
- package/src/config/address.ts +102 -0
- package/src/config/circuit.d.ts +30 -0
- package/src/config/common.ts +65 -0
- package/src/config/communities.ts +479 -0
- package/src/config/define.ts +684 -0
- package/src/config/device.ts +164 -0
- package/src/config/firewall.ts +150 -0
- package/src/config/index.ts +22 -0
- package/src/{schema → config}/interfaces.ts +121 -85
- package/src/config/keys.ts +434 -0
- package/src/config/management.ts +61 -0
- package/src/config/merge.ts +335 -0
- package/src/config/models.ts +70 -0
- package/src/config/monitoring.ts +64 -0
- package/src/config/network.ts +180 -0
- package/src/config/presets.ts +149 -0
- package/src/config/routing.ts +401 -0
- package/src/config/services.ts +51 -0
- package/src/config/switching.ts +84 -0
- package/src/config/system.ts +103 -0
- package/src/{schema → config}/time-zones.ts +1 -1
- package/src/core/address.ts +1 -1
- package/src/core/cabling.ts +8 -43
- package/src/core/graph.ts +40 -0
- package/src/{integrations → core}/registries.ts +5 -3
- package/src/core/secrets-file.ts +539 -0
- package/src/core/secrets.ts +83 -64
- package/src/core/topology.ts +103 -146
- package/src/core/utils.ts +12 -1
- package/src/model.ts +83 -0
- package/src/platforms/derive.ts +64 -37
- package/src/platforms/finding.ts +9 -0
- package/src/platforms/fortios/firewall.ts +76 -64
- package/src/platforms/fortios/index.ts +189 -125
- package/src/platforms/fortios/names.ts +51 -18
- package/src/platforms/fortios/render.ts +69 -62
- package/src/platforms/fortios/routing.ts +89 -58
- package/src/platforms/fortios/vdoms.ts +47 -16
- package/src/platforms/junos/TRAPS.md +2 -2
- package/src/platforms/junos/bgp.ts +63 -42
- package/src/platforms/junos/index.ts +122 -89
- package/src/platforms/junos/render.ts +139 -104
- package/src/platforms/platform.ts +10 -8
- package/src/platforms/raisecom-ros/TRAPS.md +1 -1
- package/src/platforms/raisecom-ros/index.ts +89 -70
- package/src/platforms/raisecom-ros/render.ts +49 -45
- package/src/platforms/routeros/TRAPS.md +3 -3
- package/src/platforms/routeros/index.ts +121 -60
- package/src/platforms/routeros/render.ts +214 -195
- package/src/platforms/vrp/TRAPS.md +1 -1
- package/src/platforms/vrp/index.ts +74 -50
- package/src/platforms/vrp/render.ts +67 -56
- package/src/project/project.ts +725 -0
- package/src/studio/app/env.d.ts +9 -0
- package/src/studio/app/index.html +18 -0
- package/src/studio/app/src/App.vue +95 -0
- package/src/studio/app/src/components/AddressesView.vue +38 -0
- package/src/studio/app/src/components/CablesView.vue +29 -0
- package/src/studio/app/src/components/CompareView.vue +160 -0
- package/src/studio/app/src/components/DataTable.vue +49 -0
- package/src/studio/app/src/components/DeviceView.vue +237 -0
- package/src/studio/app/src/components/DevicesView.vue +32 -0
- package/src/studio/app/src/components/Faceplate.vue +75 -0
- package/src/studio/app/src/components/GraphView.vue +282 -0
- package/src/studio/app/src/components/LineDiff.vue +24 -0
- package/src/studio/app/src/components/ProblemsView.vue +42 -0
- package/src/studio/app/src/components/SearchView.vue +72 -0
- package/src/studio/app/src/components/SecretsView.vue +112 -0
- package/src/studio/app/src/components/SessionsView.vue +35 -0
- package/src/studio/app/src/components/Settings.vue +95 -0
- package/src/studio/app/src/components/ToolsView.vue +118 -0
- package/src/studio/app/src/components/VlansView.vue +50 -0
- package/src/studio/app/src/lib/csv.ts +19 -0
- package/src/studio/{public/diff.js → app/src/lib/diff.ts} +40 -35
- package/src/studio/app/src/lib/format.ts +38 -0
- package/src/studio/app/src/lib/net.ts +68 -0
- package/src/studio/app/src/lib/secrets-crypto.ts +35 -0
- package/src/studio/app/src/lib/store.ts +71 -0
- package/src/studio/app/src/lib/tools.ts +217 -0
- package/src/studio/app/src/main.ts +9 -0
- package/src/studio/{public → app/src}/style.css +14 -4
- package/src/studio/app/tsconfig.json +17 -0
- package/src/studio/app/vite.config.ts +16 -0
- package/src/studio/assets.generated.ts +3 -0
- package/src/studio/data.ts +96 -188
- package/src/studio/git.ts +27 -43
- package/src/studio/server.ts +196 -107
- package/src/studio/types.ts +141 -0
- package/src/transport/console.ts +3 -3
- package/src/transport/ssh.ts +1 -1
- package/dist/chunks/index-3b343xva.js +0 -177
- package/dist/chunks/index-6wb41q67.js +0 -62
- package/dist/chunks/index-n7w3tg5y.js +0 -149
- package/dist/chunks/index-yzw86rc8.js +0 -921
- package/dist/chunks/new-w3zys5y4.js +0 -172
- package/dist/chunks/server-cxr9ynxc.js +0 -259
- package/dist/cli/index.js +0 -12922
- package/dist/helpers/index.js +0 -881
- package/dist/index.js +0 -28
- package/dist/types/core/address-space.d.ts +0 -62
- package/dist/types/core/address.d.ts +0 -44
- package/dist/types/core/cabling.d.ts +0 -41
- package/dist/types/core/cross-checks.d.ts +0 -28
- package/dist/types/core/define.d.ts +0 -79
- package/dist/types/core/project-files.d.ts +0 -12
- package/dist/types/core/schema-docs.d.ts +0 -25
- package/dist/types/core/secrets.d.ts +0 -62
- package/dist/types/core/topology.d.ts +0 -96
- package/dist/types/core/utils.d.ts +0 -10
- package/dist/types/core/validator.d.ts +0 -23
- package/dist/types/helpers/bgp.d.ts +0 -195
- package/dist/types/helpers/cables.d.ts +0 -69
- package/dist/types/helpers/checks.d.ts +0 -36
- package/dist/types/helpers/exchange.d.ts +0 -55
- package/dist/types/helpers/filters.d.ts +0 -51
- package/dist/types/helpers/index.d.ts +0 -14
- package/dist/types/helpers/route-server.d.ts +0 -52
- package/dist/types/helpers/upstreams.d.ts +0 -192
- package/dist/types/index.d.ts +0 -10
- package/dist/types/integrations/librenms.d.ts +0 -60
- package/dist/types/integrations/netbox.d.ts +0 -89
- package/dist/types/integrations/peeringdb.d.ts +0 -24
- package/dist/types/integrations/prometheus.d.ts +0 -24
- package/dist/types/integrations/registries.d.ts +0 -8
- package/dist/types/platforms/bgp-wait.d.ts +0 -24
- package/dist/types/platforms/catalog.d.ts +0 -109
- package/dist/types/platforms/derive.d.ts +0 -17
- package/dist/types/platforms/fortios/firewall.d.ts +0 -47
- package/dist/types/platforms/fortios/index.d.ts +0 -140
- package/dist/types/platforms/fortios/models.d.ts +0 -14
- package/dist/types/platforms/fortios/names.d.ts +0 -52
- package/dist/types/platforms/fortios/plan.d.ts +0 -114
- package/dist/types/platforms/fortios/render.d.ts +0 -77
- package/dist/types/platforms/fortios/routing.d.ts +0 -56
- package/dist/types/platforms/fortios/tree.d.ts +0 -37
- package/dist/types/platforms/fortios/vdoms.d.ts +0 -50
- package/dist/types/platforms/index.d.ts +0 -13
- package/dist/types/platforms/junos/bgp.d.ts +0 -44
- package/dist/types/platforms/junos/index.d.ts +0 -114
- package/dist/types/platforms/junos/models.d.ts +0 -14
- package/dist/types/platforms/junos/render.d.ts +0 -154
- package/dist/types/platforms/line-diff.d.ts +0 -67
- package/dist/types/platforms/platform.d.ts +0 -135
- package/dist/types/platforms/raisecom-ros/index.d.ts +0 -71
- package/dist/types/platforms/raisecom-ros/models.d.ts +0 -14
- package/dist/types/platforms/raisecom-ros/render.d.ts +0 -41
- package/dist/types/platforms/routeros/export.d.ts +0 -59
- package/dist/types/platforms/routeros/index.d.ts +0 -116
- package/dist/types/platforms/routeros/models.d.ts +0 -18
- package/dist/types/platforms/routeros/plan.d.ts +0 -58
- package/dist/types/platforms/routeros/render.d.ts +0 -250
- package/dist/types/platforms/vrp/index.d.ts +0 -83
- package/dist/types/platforms/vrp/models.d.ts +0 -12
- package/dist/types/platforms/vrp/render.d.ts +0 -96
- package/dist/types/schema/common.d.ts +0 -30
- package/dist/types/schema/device.d.ts +0 -126
- package/dist/types/schema/firewall.d.ts +0 -131
- package/dist/types/schema/index.d.ts +0 -8
- package/dist/types/schema/interfaces.d.ts +0 -205
- package/dist/types/schema/policy.d.ts +0 -107
- package/dist/types/schema/routing.d.ts +0 -161
- package/dist/types/schema/system.d.ts +0 -198
- package/dist/types/schema/time-zones.d.ts +0 -2
- package/dist/types/transport/console.d.ts +0 -115
- package/dist/types/transport/path-check.d.ts +0 -32
- package/dist/types/transport/ssh.d.ts +0 -27
- package/src/cli/graph-format.ts +0 -91
- package/src/cli/new.ts +0 -234
- package/src/core/address-space.ts +0 -320
- package/src/core/cross-checks.ts +0 -369
- package/src/core/define.ts +0 -124
- package/src/core/project-files.ts +0 -35
- package/src/core/schema-docs.ts +0 -174
- package/src/core/validator.ts +0 -508
- package/src/helpers/bgp.ts +0 -473
- package/src/helpers/cables.ts +0 -74
- package/src/helpers/checks.ts +0 -201
- package/src/helpers/exchange.ts +0 -123
- package/src/helpers/filters.ts +0 -107
- package/src/helpers/index.ts +0 -25
- package/src/helpers/route-server.ts +0 -212
- package/src/helpers/upstreams.ts +0 -369
- package/src/index.ts +0 -13
- package/src/integrations/librenms.ts +0 -291
- package/src/integrations/netbox.ts +0 -620
- package/src/integrations/peeringdb.ts +0 -173
- package/src/integrations/prometheus.ts +0 -90
- package/src/schema/common.ts +0 -41
- package/src/schema/device.ts +0 -145
- package/src/schema/firewall.ts +0 -140
- package/src/schema/index.ts +0 -8
- package/src/schema/policy.ts +0 -115
- package/src/schema/routing.ts +0 -173
- package/src/schema/system.ts +0 -203
- package/src/studio/public/app.js +0 -186
- package/src/studio/public/compare.js +0 -250
- package/src/studio/public/dom.js +0 -138
- package/src/studio/public/evaluate.js +0 -687
- package/src/studio/public/export.js +0 -130
- package/src/studio/public/graph.js +0 -1541
- package/src/studio/public/index.html +0 -83
- package/src/studio/public/net.js +0 -134
- package/src/studio/public/tables.js +0 -1289
- package/src/studio/public/tools.js +0 -610
- package/templates/colocation/checks.ts +0 -53
- package/templates/colocation/circuit.config.ts +0 -9
- package/templates/colocation/edge-01.ts +0 -133
- package/templates/colocation/routing.ts +0 -13
- package/templates/colocation/tenancy.ts +0 -76
- package/templates/colocation/tenants/acme.ts +0 -19
- package/templates/colocation/tenants/index.ts +0 -6
- package/templates/colocation/tor-01.ts +0 -33
- package/templates/edge-router/checks.ts +0 -20
- package/templates/edge-router/circuit.config.ts +0 -8
- package/templates/edge-router/edge-01.ts +0 -110
- package/templates/edge-router/routing.ts +0 -13
- package/templates/project/AGENTS.md +0 -51
- package/templates/project/CLAUDE.md +0 -1
- package/templates/project/README.md +0 -16
- package/templates/project/gitignore +0 -5
- package/templates/project/tsconfig.json +0 -13
- package/templates/single-site/checks.ts +0 -26
- package/templates/single-site/circuit.config.ts +0 -8
- package/templates/single-site/router.ts +0 -86
- package/templates/single-site/site.ts +0 -18
- package/templates/single-site/switch.ts +0 -34
- /package/src/studio/{public → app/public}/favicon.svg +0 -0
- /package/src/studio/{public → app/public}/special-gothic-latin-ext.woff2 +0 -0
- /package/src/studio/{public → app/public}/special-gothic-latin.woff2 +0 -0
- /package/src/studio/{public → app/public}/special-gothic-license.txt +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { Neighbor } from "../../core/cabling.js";
|
|
2
|
-
import type { Device, Family } 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
|
-
/** How a commit that could cut access is guarded: it rolls back after `minutes` unless `prove` shows access survived. */
|
|
6
|
-
export type Guard = {
|
|
7
|
-
minutes: number;
|
|
8
|
-
prove: () => Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
export declare class Junos extends Platform {
|
|
11
|
-
/** How the console asks for a login. Root lands in a shell, `%`, every other user in the CLI, `>`; a session left in configuration mode, `#`, leaves it first. Not yet proved on a device. */
|
|
12
|
-
static readonly CONSOLE: ConsoleDialect;
|
|
13
|
-
/** The release this adapter renders for, and was proved on. */
|
|
14
|
-
private static readonly SUPPORTED_MAJOR;
|
|
15
|
-
/** Statements the device keeps for itself: the release it runs and the number it gives each user. */
|
|
16
|
-
private static readonly DEVICE_FACTS;
|
|
17
|
-
/** Names the platform keeps for its own system accounts. A user under one fails the commit check. */
|
|
18
|
-
private static readonly SYSTEM_ACCOUNTS;
|
|
19
|
-
/** A value the device keeps hashed or encrypted, and the render writes as a marker, as one word both sides share. Each keeps the number of words. */
|
|
20
|
-
private static readonly SECRETS;
|
|
21
|
-
/** Lists whose entries are named: a delete cannot stop at the list, `delete interfaces xe-0/0/1 unit`, only at an entry, `unit 0`. A leaf-list such as `vlan members` or `ciphers` can go whole. */
|
|
22
|
-
private static readonly NAMED_LISTS;
|
|
23
|
-
/** A prompt at the end of what the device printed: `user@host> `, `user@host# `, or a shell's `% `. */
|
|
24
|
-
private static readonly PROMPT;
|
|
25
|
-
/** The prompt in configuration mode, under its `[edit]` line. An echoed statement cannot end with it. */
|
|
26
|
-
private static readonly EDIT_PROMPT;
|
|
27
|
-
/** What the device says when it refuses a statement in a load: `terminal:3:(14) syntax error: ...`. A warning, such as a statement not found, is not a refusal. */
|
|
28
|
-
private static readonly REFUSED;
|
|
29
|
-
/** Every LLDP neighbor with the far port, which the brief form leaves out. */
|
|
30
|
-
private static readonly LLDP_NEIGHBORS;
|
|
31
|
-
/** Commands that only read. */
|
|
32
|
-
private static readonly READS;
|
|
33
|
-
/** Features `Derive.unproved` refuses until a platform proves them, proved here on a QFX5100-48S-6Q running Junos 21.4R3. */
|
|
34
|
-
private static readonly PROVED;
|
|
35
|
-
readonly name = "junos";
|
|
36
|
-
readonly os: OsSupport;
|
|
37
|
-
readonly extension = ".conf";
|
|
38
|
-
readonly console: ConsoleDialect;
|
|
39
|
-
unsupported(device: Device): string[];
|
|
40
|
-
render(device: Device): string;
|
|
41
|
-
read(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
42
|
-
/** The LLDP neighbors from `show lldp neighbors detail` as XML. The brief form leaves out the far port, and its table pads columns that a description can fill. */
|
|
43
|
-
neighbors(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<Neighbor[]>;
|
|
44
|
-
/** Each neighbor in the XML the device printed, on our port by Circuit's name. The far end's system name, or its chassis ID when it sends none. */
|
|
45
|
-
static neighborsOf(device: Device, xml: string): Neighbor[];
|
|
46
|
-
private static unescapeXml;
|
|
47
|
-
/**
|
|
48
|
-
* What changes, by section.
|
|
49
|
-
*
|
|
50
|
-
* A statement the render holds and the device does not is set. One the device holds and the render does not is deleted at the shortest path that holds nothing the render wants, so a removed port goes as a whole and a changed value goes alone. A hidden value ends a path by its name alone; a hidden name in a list, such as a community, stays `<redacted>` and the session names each entry when it sends the plan. A statement the device holds deactivated is activated when the render wants it.
|
|
51
|
-
*
|
|
52
|
-
* A policy, a filter or an import or export chain is ordered, so when anything in one changes it is deleted and set again whole, in the render's order. A path the render marks as generated, such as a prefix list `refresh` fills, keeps what the device holds.
|
|
53
|
-
*/
|
|
54
|
-
plan(desired: string, current: string, options: Pick<ApplyOptions, "secrets">): Plan;
|
|
55
|
-
apply(device: Device, _network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
|
|
56
|
-
/** Replace a prefix list `refresh` fetched. It cannot cut access, so it is committed without a rollback. */
|
|
57
|
-
fill(device: Device, _network: readonly Device[], set: string, _family: Family, prefixes: string[]): Promise<void>;
|
|
58
|
-
readOnly(command: string): boolean;
|
|
59
|
-
/** Over SSH, each command runs on its own, as the read does. */
|
|
60
|
-
session(device: Device, options?: ReadOptions): Promise<ReadSession>;
|
|
61
|
-
/** A statement's words; a quoted value is one word with its quotes. */
|
|
62
|
-
private static wordsOf;
|
|
63
|
-
/** A word as the platform means it, without quotes or escapes, so a value quoted on one side and not on the other compares equal. */
|
|
64
|
-
private static bare;
|
|
65
|
-
/** A statement in the form both sides compare in: its words, secrets as one marker, quotes dropped. */
|
|
66
|
-
private static keyOf;
|
|
67
|
-
/** The device prints a password as a hash, an SNMP key as a reversible cipher, and a community as itself. None leave the read. */
|
|
68
|
-
private static scrub;
|
|
69
|
-
/** The configuration's statements from what `show configuration | display set` printed. */
|
|
70
|
-
private static clean;
|
|
71
|
-
/** Whether a delete may stop after `path[index]`. Below the top level a named list may not; `vlan` names a list except in `vlan members`. */
|
|
72
|
-
private static canStopAt;
|
|
73
|
-
/** The section a statement belongs to, for a reviewer: `interfaces xe-0/0/1`, `system login`, `snmp`. */
|
|
74
|
-
private static sectionOf;
|
|
75
|
-
/**
|
|
76
|
-
* The ordered block a statement sits in, and its item there: a policy's or a filter's term, or one policy of an import or export chain. The device keeps their order, and `set` adds at the end.
|
|
77
|
-
*/
|
|
78
|
-
private static orderedBlockOf;
|
|
79
|
-
/** Whether a path starts with another. */
|
|
80
|
-
private static startsWith;
|
|
81
|
-
private static login;
|
|
82
|
-
/** Refuse a device on a release this adapter was not proved on, before anything is read or sent. */
|
|
83
|
-
private static checkVersion;
|
|
84
|
-
/** Send one line and wait for the prompt to come back. */
|
|
85
|
-
private static run;
|
|
86
|
-
/** Send one line in configuration mode and wait for its prompt to come back. */
|
|
87
|
-
private static edit;
|
|
88
|
-
/** Log in on the console and open the CLI. Returns the console, a way to log in afresh, and how to let the console go. */
|
|
89
|
-
private static openConsole;
|
|
90
|
-
/** Log in on the console, open the CLI, and run `work` in it with a way to log in afresh. Logs out after. */
|
|
91
|
-
private static onConsole;
|
|
92
|
-
/** An interactive CLI with paging off. Root lands in a shell and starts the CLI from there. */
|
|
93
|
-
private static openCli;
|
|
94
|
-
/**
|
|
95
|
-
* A delete through a name the read redacted, `delete snmp community <redacted>`, as one delete for each entry the device holds there. The names stay in the session.
|
|
96
|
-
*/
|
|
97
|
-
private static named;
|
|
98
|
-
/**
|
|
99
|
-
* Load the plan into an exclusive candidate and check it. With a guard, commit it to roll back after `minutes`, prove access, then confirm; without one, commit it outright.
|
|
100
|
-
*
|
|
101
|
-
* Deletions go before the statements that are set, so a path deleted and set again in one plan ends up set.
|
|
102
|
-
*/
|
|
103
|
-
private static configure;
|
|
104
|
-
/** The plan that replaces a prefix list's entries with what a registry returned. */
|
|
105
|
-
private static fillPlan;
|
|
106
|
-
/** The IP MTU of every port and LAG that carries a VLAN; 1500 where none is given. */
|
|
107
|
-
private static carriers;
|
|
108
|
-
/** BGP settings Junos 21 has no statement for, and policy steps it cannot take. */
|
|
109
|
-
private static bgpGaps;
|
|
110
|
-
/** Layer 3 settings the platform cannot express on a port or an interface. */
|
|
111
|
-
private static routedGaps;
|
|
112
|
-
/** Storm control in a form a profile holds: one threshold in percent for every kind. */
|
|
113
|
-
private static switchedGaps;
|
|
114
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const models: {
|
|
2
|
-
readonly "QFX5100-48S-6Q": {
|
|
3
|
-
readonly ports: {
|
|
4
|
-
readonly "40g": 6;
|
|
5
|
-
readonly "10g": 48;
|
|
6
|
-
readonly "1g": 2;
|
|
7
|
-
};
|
|
8
|
-
readonly spelling: {
|
|
9
|
-
readonly "40g": "et-0/0/{n+47}";
|
|
10
|
-
readonly "10g": "xe-0/0/{n-1}";
|
|
11
|
-
readonly "1g": "em{n-1}";
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { Device, Interface, Port, Vrrp } from "../../schema/index.js";
|
|
2
|
-
type AnyPort = Port<string, string, string, string>;
|
|
3
|
-
type AnyInterface = Interface<string, string>;
|
|
4
|
-
type LagInterface = Extract<AnyInterface, {
|
|
5
|
-
type: "lag";
|
|
6
|
-
}>;
|
|
7
|
-
type Switched = AnyPort | LagInterface;
|
|
8
|
-
/** Collects `set` statements, and comments the plan reads. */
|
|
9
|
-
export declare class JunosStatements {
|
|
10
|
-
private readonly lines;
|
|
11
|
-
private readonly notes;
|
|
12
|
-
set(...words: (string | number)[]): void;
|
|
13
|
-
note(comment: string): void;
|
|
14
|
-
/** The statements as the device prints them: each once, and none that another one extends, because the platform prints only the longest. */
|
|
15
|
-
text(): string;
|
|
16
|
-
}
|
|
17
|
-
/** What the platform calls a port, a LAG, a VLAN interface or a loopback. */
|
|
18
|
-
export declare class JunosNames {
|
|
19
|
-
private readonly device;
|
|
20
|
-
readonly lags: Map<string, number>;
|
|
21
|
-
readonly loopbacks: Map<string, number>;
|
|
22
|
-
readonly tunnels: Map<string, number>;
|
|
23
|
-
constructor(device: Device);
|
|
24
|
-
/** A physical port. A 10G cage holding a 1G optic is `ge-`, not `xe-`. */
|
|
25
|
-
port(port: string): string;
|
|
26
|
-
/** The physical interface a port or a LAG is: `xe-0/0/1`, `ae1`. */
|
|
27
|
-
physical(name: string): string;
|
|
28
|
-
/** The logical interface that holds addresses: `xe-0/0/1.0`, `ae1.0`, `irb.10`, `lo0.0`. */
|
|
29
|
-
unit(name: string): string;
|
|
30
|
-
/** The physical ports behind a port or a LAG. */
|
|
31
|
-
members(name: string): string[];
|
|
32
|
-
}
|
|
33
|
-
/** The whole configuration of one device, built section by section into one set of statements. */
|
|
34
|
-
export declare class JunosRender {
|
|
35
|
-
private readonly device;
|
|
36
|
-
/** The class each role logs in with. */
|
|
37
|
-
private static readonly USER_CLASS;
|
|
38
|
-
/** The statement each kind of public key is written under, by the key's own prefix. */
|
|
39
|
-
static readonly KEY_STATEMENT: Record<string, string>;
|
|
40
|
-
private static readonly SNMP_AUTH;
|
|
41
|
-
private static readonly SNMP_PRIVACY;
|
|
42
|
-
/** The SNMPv3 group every user joins, with read access to everything. */
|
|
43
|
-
private static readonly SNMP_GROUP;
|
|
44
|
-
/** A severity as the platform names it. It has no debug; `any` takes everything. */
|
|
45
|
-
private static readonly LEVEL;
|
|
46
|
-
/** The filters that decide who reaches the device's own services, one per family. A filter name is unique across families. */
|
|
47
|
-
private static readonly SERVICES_FILTER;
|
|
48
|
-
/** The policy OSPF announces other routes with. */
|
|
49
|
-
private static readonly OSPF_EXPORT;
|
|
50
|
-
/** Strong ciphers, MACs and key exchanges, offered unless `weak_crypto`. */
|
|
51
|
-
private static readonly SSH_CIPHERS;
|
|
52
|
-
private static readonly SSH_MACS;
|
|
53
|
-
private static readonly SSH_KEY_EXCHANGES;
|
|
54
|
-
/** The transport and port each management service listens on. */
|
|
55
|
-
private static readonly SERVICE_PORTS;
|
|
56
|
-
/** Kinds of frame as `ether-type` names them, in the order the render writes them. */
|
|
57
|
-
private static readonly ETHERTYPES;
|
|
58
|
-
/** Detection under a second: three missed packets 300 ms apart. The platform has no interval of its own, and 3 is its multiplier. */
|
|
59
|
-
static readonly BFD_INTERVAL = 300;
|
|
60
|
-
/** Kinds of flooded traffic, with the statement that leaves each out of a storm-control profile. */
|
|
61
|
-
private static readonly STORM_KINDS;
|
|
62
|
-
private readonly out;
|
|
63
|
-
private readonly names;
|
|
64
|
-
private constructor();
|
|
65
|
-
/** The whole configuration the device should run, as `set` statements. */
|
|
66
|
-
static of(device: Device): string;
|
|
67
|
-
/** BFD under a statement: `routing.bfd`'s timers, or every 300 ms when it has none. */
|
|
68
|
-
static bfd(out: JunosStatements, statement: string, device: Device): void;
|
|
69
|
-
/** Quote a value unless it is a plain word. Quoting more than the platform would is harmless: the comparison ignores quotes. */
|
|
70
|
-
static quote(value: string): string;
|
|
71
|
-
/** The address a VRRP group sits on: the one whose network holds the virtual address. */
|
|
72
|
-
static vrrpAddress(addresses: readonly string[], group: Vrrp): string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* The storm-control profile a port or LAG names. A profile holds one threshold for every kind it limits, so a port's kinds must share one in percent; `unsupported()` refuses any other.
|
|
75
|
-
*/
|
|
76
|
-
static stormProfile(settings: Switched): {
|
|
77
|
-
name: string;
|
|
78
|
-
percent: number;
|
|
79
|
-
left: string[];
|
|
80
|
-
} | undefined;
|
|
81
|
-
/** The size a port's frames may reach for an IP MTU: the Ethernet header, and a VLAN tag when the port switches. */
|
|
82
|
-
private static frameSize;
|
|
83
|
-
/** `2g`, a rate as a policer takes it. */
|
|
84
|
-
private static bandwidth;
|
|
85
|
-
/** Bytes a policer lets through at once: 10 ms at its rate, and never less than one full frame. */
|
|
86
|
-
private static burstOf;
|
|
87
|
-
/** Each port or range as the platform writes it: `53`, `1000-2000`. */
|
|
88
|
-
private static eachPort;
|
|
89
|
-
/** The family a hardware ACL rule is limited to, by its family or its addresses. */
|
|
90
|
-
private static aclFamily;
|
|
91
|
-
/** The protocol as an IPv6 header names it. */
|
|
92
|
-
private static nextHeader;
|
|
93
|
-
/** A rule's term name: its place, then its description so a reader sees it on the device. */
|
|
94
|
-
private static ruleName;
|
|
95
|
-
private system;
|
|
96
|
-
/** Every user but root logs in with a class. Root is the platform's own account and takes only its password and keys. */
|
|
97
|
-
private users;
|
|
98
|
-
private services;
|
|
99
|
-
/** SNMP version 2c with one read community, version 3 with users in one read-only group, or both. */
|
|
100
|
-
private snmp;
|
|
101
|
-
private vlans;
|
|
102
|
-
/** Layer 2 membership of a port or LAG. The native VLAN is a member too, or its untagged frames are dropped. */
|
|
103
|
-
private switching;
|
|
104
|
-
/** The filter that lets only these kinds of frame in, named after them: `circuit-ethertypes-ipv4-ipv6-arp`. */
|
|
105
|
-
private static ethertypeFilter;
|
|
106
|
-
/** One filter for each set of kinds a port or LAG lets in: those kinds, then nothing else. */
|
|
107
|
-
private ethertypeFilters;
|
|
108
|
-
/** Addresses and VRRP groups of a logical interface such as `irb.10`. */
|
|
109
|
-
private addressing;
|
|
110
|
-
/** Every port the model has. One the config does not declare is turned off, and so is a 10G cage's name for the optic it does not hold. */
|
|
111
|
-
private ports;
|
|
112
|
-
private lags;
|
|
113
|
-
/** VLAN interfaces, loopbacks and GRE tunnels: a description, a tunnel's ends, addresses and VRRP, and an MTU per family. */
|
|
114
|
-
private routedInterfaces;
|
|
115
|
-
/** One profile per threshold the ports and LAGs name. */
|
|
116
|
-
private stormProfiles;
|
|
117
|
-
/**
|
|
118
|
-
* Who reaches the device's own services: each guarded service from its sources only, time answered only to the servers the device keeps time from, and everything else as it was.
|
|
119
|
-
*
|
|
120
|
-
* The filter sits on every loopback unit and on each management port with an address, so it applies whichever routing table or port a packet arrives on.
|
|
121
|
-
*/
|
|
122
|
-
private servicesFilter;
|
|
123
|
-
/** A VRF is a virtual router: its own table, holding its interfaces. */
|
|
124
|
-
private vrfs;
|
|
125
|
-
/** A route with a distance names its next hop as qualified, so two routes to one prefix can each have their own. */
|
|
126
|
-
private staticRoutes;
|
|
127
|
-
/** Spanning tree on every switched port and LAG, each with its own settings. RSTP when no mode is given. */
|
|
128
|
-
private spanningTree;
|
|
129
|
-
/**
|
|
130
|
-
* LLDP on every port or on those listed, a port's own setting over the device's. LLDP runs on a LAG's member ports.
|
|
131
|
-
*
|
|
132
|
-
* The device sends a port's SNMP index as its port ID unless told to send its name, so a neighbor sees `et-0/0/52` rather than `520`.
|
|
133
|
-
*/
|
|
134
|
-
private lldp;
|
|
135
|
-
/** OSPF for IPv4 and OSPFv3 for IPv6, with the same areas and interfaces. */
|
|
136
|
-
private ospf;
|
|
137
|
-
/** Each relay is a group of servers and the interface it listens on, in the table that interface routes in. */
|
|
138
|
-
private dhcpRelay;
|
|
139
|
-
/** sFlow from the management address, to each collector, on every declared port or those listed. A LAG is observed on its member ports. */
|
|
140
|
-
private sflow;
|
|
141
|
-
/**
|
|
142
|
-
* Hardware ACLs. A switched port takes a filter of the switching family, which matches IPv4 and IPv6 under `ip-version`; a routed port takes one filter per family. Each ends by accepting what no rule matched.
|
|
143
|
-
*/
|
|
144
|
-
private acls;
|
|
145
|
-
/** A rule's decision, through a policer when it has a rate. */
|
|
146
|
-
private aclThen;
|
|
147
|
-
private switchingFilter;
|
|
148
|
-
private routedFilter;
|
|
149
|
-
/** A DHCP server is an address pool with its network, range, options and reservations, served on its interface. */
|
|
150
|
-
private dhcpServers;
|
|
151
|
-
/** Router advertisements announce each IPv6 network of the interface. */
|
|
152
|
-
private routerAdvertisements;
|
|
153
|
-
}
|
|
154
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { Plan } from "./platform.js";
|
|
2
|
-
export type Dialect = {
|
|
3
|
-
/** A line at the margin that opens a block, for platforms that do not indent a block's lines. */
|
|
4
|
-
block: RegExp;
|
|
5
|
-
/** Whether a block's lines are indented under it. When they are, any line followed by deeper lines opens a block. */
|
|
6
|
-
indented: boolean;
|
|
7
|
-
/** A line at the margin that closes every open block. */
|
|
8
|
-
terminator: string;
|
|
9
|
-
/** Lines that describe the device rather than configure it, or that the platform prints whatever is set. */
|
|
10
|
-
ignore: (line: string) => boolean;
|
|
11
|
-
/** The command that removes a line. */
|
|
12
|
-
undo: (line: string) => string;
|
|
13
|
-
/** Leaves one level of block. */
|
|
14
|
-
leave: string;
|
|
15
|
-
/** Lines sent before the undos of their block, because the platform refuses an undo until they are in place. */
|
|
16
|
-
first?: RegExp;
|
|
17
|
-
/** A line in the form both sides compare in, for example a secret the device prints as a cipher. */
|
|
18
|
-
canon?: (line: string) => string;
|
|
19
|
-
/** Where a block is sent among the others, lowest first, so that nothing is referenced before it exists. In the order they differ when absent. */
|
|
20
|
-
order?: (path: string[]) => number;
|
|
21
|
-
};
|
|
22
|
-
/** One line, with the blocks it sits in, outermost first. */
|
|
23
|
-
export type Entry = {
|
|
24
|
-
path: string[];
|
|
25
|
-
line: string;
|
|
26
|
-
};
|
|
27
|
-
/** What changes inside one block. */
|
|
28
|
-
export type Group = {
|
|
29
|
-
path: string[];
|
|
30
|
-
remove: string[];
|
|
31
|
-
add: string[];
|
|
32
|
-
};
|
|
33
|
-
/** Commands a platform needs around one group, such as releasing a binding before a change and restoring it after. */
|
|
34
|
-
export type Around = (group: Group) => {
|
|
35
|
-
before: string[];
|
|
36
|
-
after: string[];
|
|
37
|
-
};
|
|
38
|
-
export declare class LineDiff {
|
|
39
|
-
/** What a switch prints in place of a secret: the cipher of a password, a community or an SNMPv3 key, and a Raisecom community in clear. Never an algorithm list such as `ssh server cipher`. */
|
|
40
|
-
private static readonly STORED_CREDENTIAL;
|
|
41
|
-
/** How deep a line is indented. */
|
|
42
|
-
private static indentOf;
|
|
43
|
-
static entries(text: string, dialect: Dialect): Entry[];
|
|
44
|
-
/** The part of a line that names what it sets: `rule 5`, a free-text keyword, or the line up to its value. Two lines with one head are one setting with two values. */
|
|
45
|
-
static head(line: string): string;
|
|
46
|
-
/**
|
|
47
|
-
* What differs, by block.
|
|
48
|
-
*
|
|
49
|
-
* A device line replaced by a desired line with the same head is not undone; sending the new one is enough. A block the render does not hold goes with its header, and its lines with it.
|
|
50
|
-
*/
|
|
51
|
-
static compare(desired: string, current: string, dialect: Dialect): Group[];
|
|
52
|
-
/**
|
|
53
|
-
* Send every line that holds a secret again, for `apply --secrets`. A device prints a secret as a cipher, so a line whose secret changed compares equal and is otherwise never sent.
|
|
54
|
-
*/
|
|
55
|
-
static withSecrets(groups: Group[], desired: string, dialect: Dialect): Group[];
|
|
56
|
-
/**
|
|
57
|
-
* Replace a changed VLAN list line with only what changed.
|
|
58
|
-
*
|
|
59
|
-
* A platform keeps its VLANs as one line, such as `vlan batch 10 20 to 30`. Undoing the old line would delete VLANs still in use, so the plan adds the new IDs and removes the gone ones instead.
|
|
60
|
-
*/
|
|
61
|
-
static vlanListChange(groups: Group[], prefix: string, parse: (line: string) => number[], format: (ids: number[]) => string[], removal: (ids: number[]) => string[]): void;
|
|
62
|
-
private static nothingAround;
|
|
63
|
-
/** The steps for the groups: enter each block of the path, undo, add, then leave each level. */
|
|
64
|
-
static steps(groups: Group[], dialect: Dialect, around?: Around): Plan["steps"];
|
|
65
|
-
/** A device prints stored credentials as ciphers. They never leave the read. */
|
|
66
|
-
static scrub(text: string): string;
|
|
67
|
-
}
|
|
@@ -1,135 +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 { WaitLimits } from "./bgp-wait.js";
|
|
6
|
-
import type { PlatformName } from "./catalog.js";
|
|
7
|
-
/** One part of a plan: what a reviewer reads, and what is sent. */
|
|
8
|
-
export type Step = {
|
|
9
|
-
title: string;
|
|
10
|
-
show: string[];
|
|
11
|
-
send: string[];
|
|
12
|
-
};
|
|
13
|
-
/** The commands that turn what a device runs into what its config says. `problems` blocks an apply: something the adapter cannot converge. */
|
|
14
|
-
export type Plan = {
|
|
15
|
-
steps: Step[];
|
|
16
|
-
problems: string[];
|
|
17
|
-
};
|
|
18
|
-
export type ApplyOptions = {
|
|
19
|
-
/** 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. */
|
|
20
|
-
secrets: boolean;
|
|
21
|
-
/** Minutes before a platform that can restore itself does so, if the run does not prove access survived. */
|
|
22
|
-
rollback: number;
|
|
23
|
-
/** Reach the device through its serial console, `connection.console`, instead of SSH to its management address. */
|
|
24
|
-
console?: boolean;
|
|
25
|
-
};
|
|
26
|
-
/** How a device is read. */
|
|
27
|
-
export type ReadOptions = Pick<ApplyOptions, "console">;
|
|
28
|
-
/** A login on a device for commands that only read, as `circuit show` runs them. */
|
|
29
|
-
export type ReadSession = {
|
|
30
|
-
/**
|
|
31
|
-
* Run one command and return what it printed, without its echo or the prompt.
|
|
32
|
-
*
|
|
33
|
-
* At `timeout` milliseconds, a command run on its own over SSH is left, and what it printed so far is returned. In a shell or on a console, where it would hold up every command after it, the run fails instead.
|
|
34
|
-
*/
|
|
35
|
-
run(command: string, timeout?: number): Promise<string>;
|
|
36
|
-
/** Log out. */
|
|
37
|
-
close(): void;
|
|
38
|
-
};
|
|
39
|
-
/** How the checks after an apply reach the device, and how long they wait. */
|
|
40
|
-
export type HealthOptions = ReadOptions & {
|
|
41
|
-
/** How long BGP sessions established before the apply have to be established again. `BgpWait.AFTER_APPLY` when absent. */
|
|
42
|
-
bgp?: WaitLimits;
|
|
43
|
-
};
|
|
44
|
-
/** The checks after an apply, holding what they compare against, which was read before the plan was sent. */
|
|
45
|
-
export type HealthCheck = {
|
|
46
|
-
/** Run the checks. Gives one line per problem, each saying what to do; none when the device is healthy. */
|
|
47
|
-
run(): Promise<string[]>;
|
|
48
|
-
};
|
|
49
|
-
/** A BGP neighbor in the config and its live session, as `circuit bgp` shows it. A neighbor with no session is not established. */
|
|
50
|
-
export type BgpSession = {
|
|
51
|
-
/** The neighbor's name in the config. */
|
|
52
|
-
neighbor: string;
|
|
53
|
-
/** The session's remote address, or `-` when there is no session. */
|
|
54
|
-
remote: string;
|
|
55
|
-
/** Whether the session is established. */
|
|
56
|
-
established: boolean;
|
|
57
|
-
/** How many prefixes it received, as the device prints it, or `-`. */
|
|
58
|
-
prefixes: string;
|
|
59
|
-
/** How long it has been up, as the device prints it, or `no session`. */
|
|
60
|
-
uptime: string;
|
|
61
|
-
/** Why it is down, when the device says: `limit exceeded`, `admin down`, `connecting`. */
|
|
62
|
-
reason?: string;
|
|
63
|
-
/** It closed because the neighbor sent more prefixes than its limit, and stays closed until cleared. */
|
|
64
|
-
limit?: BgpLimit;
|
|
65
|
-
};
|
|
66
|
-
/** A session closed on its prefix limit: the limit, and when it closed, as the device prints it and in milliseconds, to compare. */
|
|
67
|
-
export type BgpLimit = {
|
|
68
|
-
max?: number;
|
|
69
|
-
stopped?: string;
|
|
70
|
-
stoppedAt?: number;
|
|
71
|
-
};
|
|
72
|
-
/** One BGP log line: when, as the device printed it, such as `2026-10-24 03:12:44`, and the rest of the line. */
|
|
73
|
-
export type BgpLogLine = {
|
|
74
|
-
at: string;
|
|
75
|
-
message: string;
|
|
76
|
-
};
|
|
77
|
-
/** The operating system a platform runs, and the versions it is proved on. */
|
|
78
|
-
export type OsSupport = {
|
|
79
|
-
/** Its name in full, such as `MikroTik RouterOS`. */
|
|
80
|
-
name: string;
|
|
81
|
-
/** The versions the adapter renders for, such as `7`. */
|
|
82
|
-
versions: string;
|
|
83
|
-
/** The device and version it was proved on, such as `CCR2216-1G-12XS-2XQ, RouterOS 7.23`. */
|
|
84
|
-
provedOn: string;
|
|
85
|
-
/** Whether a read or an apply refuses a device on another version. */
|
|
86
|
-
checked: boolean;
|
|
87
|
-
};
|
|
88
|
-
/** The switch rules a render makes from a device's hardware ACLs, counted. */
|
|
89
|
-
export type SwitchRules = {
|
|
90
|
-
/** How many rules there are. */
|
|
91
|
-
count: number;
|
|
92
|
-
/** How many distinct port ranges they use, such as `0-1023`. */
|
|
93
|
-
ranges: number;
|
|
94
|
-
};
|
|
95
|
-
export declare abstract class Platform {
|
|
96
|
-
/** The name a device's `platform` field takes. */
|
|
97
|
-
abstract readonly name: PlatformName;
|
|
98
|
-
abstract readonly os: OsSupport;
|
|
99
|
-
/** File extension of a saved snapshot, for syntax highlighting. */
|
|
100
|
-
abstract readonly extension: string;
|
|
101
|
-
/** How the platform's serial console asks for a login and shows its prompt. Present when the platform can be read and applied through a console, `--console`, and opened with `circuit console`. */
|
|
102
|
-
readonly console: ConsoleDialect | undefined;
|
|
103
|
-
/** Fields this platform cannot express. Validation fails on any of them, so nothing is skipped silently. */
|
|
104
|
-
abstract unsupported(device: Device): string[];
|
|
105
|
-
/** What the platform does with a config that it may not do elsewhere, each as `validate` reports it: an error stops `diff` and `apply`, a warning is reported only. Absent on a platform with none. */
|
|
106
|
-
checks?(device: Device): Finding[];
|
|
107
|
-
/** The switch rules the render makes from the device's hardware ACLs, so `validate` can hold them to the model's limits. Absent on a platform whose rules are not counted. */
|
|
108
|
-
switchRules?(device: Device): SwitchRules;
|
|
109
|
-
/** The whole configuration the device should run. Secrets appear as markers, never values. */
|
|
110
|
-
abstract render(device: Device): string;
|
|
111
|
-
/** What the device runs now, secrets removed, in the form `render` produces where the platform allows. */
|
|
112
|
-
abstract read(device: Device, network: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
113
|
-
/** The LLDP neighbors the device sees, by Circuit's port names, for `snapshot` to save. Absent on a platform whose LLDP command and its output are not proved on a device yet. */
|
|
114
|
-
neighbors?(device: Device, network: readonly Device[], options?: ReadOptions): Promise<Neighbor[]>;
|
|
115
|
-
/** What it takes to go from `current` to `desired`. */
|
|
116
|
-
abstract plan(desired: string, current: string, options: ApplyOptions): Plan;
|
|
117
|
-
/** Replace the contents of a prefix set fetched from a registry. Absent on a platform that cannot hold one. */
|
|
118
|
-
fill?(device: Device, network: readonly Device[], set: string, family: Family, prefixes: string[]): Promise<void>;
|
|
119
|
-
/** Send a plan, keeping the device reachable or restoring it. */
|
|
120
|
-
abstract apply(device: Device, network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
|
|
121
|
-
/** Whether a command only reads on this platform, so `circuit show` may send it. Anything not known to only read is refused. */
|
|
122
|
-
abstract readOnly(command: string): boolean;
|
|
123
|
-
/** Log in for commands that only read, over SSH or on the console, the way the platform's read logs in. */
|
|
124
|
-
abstract session(device: Device, options?: ReadOptions): Promise<ReadSession>;
|
|
125
|
-
/** Each BGP neighbor in the config, in its order, with its live session, read over a `session()`. Absent on a platform `circuit bgp` does not support yet. */
|
|
126
|
-
bgpSessions?(device: Device, session: ReadSession): Promise<BgpSession[]>;
|
|
127
|
-
/** The device's BGP log lines from the last `minutes`, by the device's own clock, read over a `session()`. */
|
|
128
|
-
bgpLog?(session: ReadSession, minutes: number): Promise<BgpLogLine[]>;
|
|
129
|
-
/** Open again these sessions, each closed on its prefix limit, read by `bgpSessions`. Only a session still closed on its limit is touched. */
|
|
130
|
-
bgpClearLimit?(session: ReadSession, sessions: readonly BgpSession[]): Promise<void>;
|
|
131
|
-
/**
|
|
132
|
-
* Checks that the device is healthy after an apply, not only that it took the commands. Called before the plan is sent, to read what the checks compare against; the CLI runs them after the apply and the snapshot. Absent on a platform with no checks yet.
|
|
133
|
-
*/
|
|
134
|
-
health?(device: Device, plan: Plan, options?: HealthOptions): Promise<HealthCheck>;
|
|
135
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { ClientChannel } from "ssh2";
|
|
2
|
-
import type { Neighbor } from "../../core/cabling.js";
|
|
3
|
-
import type { Device } from "../../schema/index.js";
|
|
4
|
-
import { type ConsoleDialect } from "../../transport/console.js";
|
|
5
|
-
import { type ApplyOptions, type OsSupport, type Plan, type ReadOptions, type ReadSession, Platform } from "../platform.js";
|
|
6
|
-
/** A session, and how to prove access in a fresh login: a new SSH session, or logging out and in again on the console. */
|
|
7
|
-
export type Session = {
|
|
8
|
-
channel: ClientChannel;
|
|
9
|
-
close: () => void;
|
|
10
|
-
fresh: () => Promise<Session>;
|
|
11
|
-
};
|
|
12
|
-
export declare class RaisecomRos extends Platform {
|
|
13
|
-
/** How the console asks for a login and shows its prompt. Not yet proved on a device: the RAX721's console was never cabled to a jump host. */
|
|
14
|
-
static readonly CONSOLE: ConsoleDialect;
|
|
15
|
-
/** Lines the device prints whatever is configured, or that are part of moving around the CLI. */
|
|
16
|
-
private static readonly DEVICE_FACTS;
|
|
17
|
-
/** Lines whose opposite is not `no` and the line. */
|
|
18
|
-
private static readonly OPPOSITES;
|
|
19
|
-
/** Lines whose removal takes only their keyword, not their value. */
|
|
20
|
-
private static readonly UNDO_BY_KEYWORD;
|
|
21
|
-
private static readonly DIALECT;
|
|
22
|
-
/** The firmware offers only an `ssh-rsa` host key, so that one is allowed for this platform alone. Key exchange, cipher and MAC still negotiate modern ones. */
|
|
23
|
-
private static readonly HOST_KEYS;
|
|
24
|
-
/** How long a dump may go quiet before the prompt, as on a lossy path where a retransmit stalls it for seconds, and how long it may take in all. */
|
|
25
|
-
private static readonly DUMP_QUIET;
|
|
26
|
-
private static readonly DUMP_LIMIT;
|
|
27
|
-
/** What the device prints when it refuses a line. */
|
|
28
|
-
private static readonly REFUSED;
|
|
29
|
-
/** Lines that ask for `y` and do nothing without it. */
|
|
30
|
-
private static readonly CONFIRM;
|
|
31
|
-
/** A service letting go of an access-list, so the list can change. */
|
|
32
|
-
private static readonly RELEASE;
|
|
33
|
-
/** Lines that each add one more of a kind rather than set a value: `snmp-server access-list 1001` beside `1000` binds both. */
|
|
34
|
-
private static readonly STANDALONE;
|
|
35
|
-
/** Commands that only read. A `?` sent by a script is run, so a line with one is refused. */
|
|
36
|
-
private static readonly READS;
|
|
37
|
-
readonly name = "raisecom-ros";
|
|
38
|
-
readonly os: OsSupport;
|
|
39
|
-
readonly extension = ".txt";
|
|
40
|
-
readonly console: ConsoleDialect;
|
|
41
|
-
unsupported(device: Device): string[];
|
|
42
|
-
render(device: Device): string;
|
|
43
|
-
/** What the device runs, credentials scrubbed. */
|
|
44
|
-
read(device: Device, _network: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
45
|
-
/** Read `show running-config` until it ends at the prompt, or until it goes quiet for too long or takes too long in all. */
|
|
46
|
-
private static dump;
|
|
47
|
-
/** The LLDP neighbors from `show lldp remote detail`, which spells each port in full. The short form abbreviates ports (`TGE1/3/3`) and pads columns, so a name with a space cannot be told apart there. */
|
|
48
|
-
neighbors(device: Device, _network: readonly Device[], options?: ReadOptions): Promise<Neighbor[]>;
|
|
49
|
-
/**
|
|
50
|
-
* The neighbors in `show lldp remote detail`: a `<port> has N remotes:` line per port, then a block per remote of `Key: value` lines. A long value wraps onto lines that start with spaces, cut mid-word.
|
|
51
|
-
*
|
|
52
|
-
* A remote without a system name is named by its chassis ID. A port the catalog does not have, such as the out-of-band port, is left out.
|
|
53
|
-
*/
|
|
54
|
-
static lldpRemotes(text: string, device: Device): Neighbor[];
|
|
55
|
-
plan(desired: string, current: string, options: ApplyOptions): Plan;
|
|
56
|
-
apply(device: Device, _network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
|
|
57
|
-
readOnly(command: string): boolean;
|
|
58
|
-
/** One shell for every command, as the platform takes commands only there. */
|
|
59
|
-
session(device: Device, options?: ReadOptions): Promise<ReadSession>;
|
|
60
|
-
private static undo;
|
|
61
|
-
/** An interactive shell, paging off, over SSH or on the console. A session that does not answer as ROS is refused, so nothing meant for it can reach another shell. */
|
|
62
|
-
private static open;
|
|
63
|
-
private static sshShell;
|
|
64
|
-
private static consoleShell;
|
|
65
|
-
/** The ports, by their `interface` line, that filter what they take in with an access-list. */
|
|
66
|
-
private static filteredPorts;
|
|
67
|
-
/** Services holding an access-list. It cannot change while any of them does. */
|
|
68
|
-
private static holders;
|
|
69
|
-
/** The VLAN IDs of a `create vlan 10,20-30 active` line. */
|
|
70
|
-
private static createdIds;
|
|
71
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const models: {
|
|
2
|
-
readonly "RAX721-C-6C48": {
|
|
3
|
-
readonly ports: {
|
|
4
|
-
readonly "100g": 6;
|
|
5
|
-
readonly "25g": 24;
|
|
6
|
-
readonly "10g": 24;
|
|
7
|
-
};
|
|
8
|
-
readonly spelling: {
|
|
9
|
-
readonly "100g": "hundredgige 1/1/{n}";
|
|
10
|
-
readonly "25g": "twenty-fivegige 1/2/{n}";
|
|
11
|
-
readonly "10g": "tengigabitethernet 1/3/{n}";
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Device, SnmpUser } from "../../schema/index.js";
|
|
2
|
-
/** The configuration a Raisecom ROS device should run. */
|
|
3
|
-
export declare class RaisecomRosRender {
|
|
4
|
-
/** The access-list that guards every management service. */
|
|
5
|
-
static readonly MANAGEMENT_ACL = 1000;
|
|
6
|
-
/** The access-list that guards SNMP when it has sources of its own. */
|
|
7
|
-
static readonly SNMP_ACL = 1001;
|
|
8
|
-
/** A log level as the platform prints it, a number. It takes the names too (`warnings`), but prints the number. */
|
|
9
|
-
private static readonly LOG_LEVELS;
|
|
10
|
-
/** The most MAC addresses port security takes on a port, and its default. */
|
|
11
|
-
static readonly MAC_LIMIT_MAX = 1024;
|
|
12
|
-
/** A kind of frame as a MAC access-list rule matches it, in the form the device prints. It takes a type as hex without `0x`, and names IPv4 and ARP. */
|
|
13
|
-
private static readonly ETHERTYPES;
|
|
14
|
-
/** The log level and UDP port a log host has unless told otherwise. Neither prints. */
|
|
15
|
-
private static readonly LOG_DEFAULTS;
|
|
16
|
-
/** The SNMPv3 authentication each `auth` takes on this platform. One missing here cannot be expressed. */
|
|
17
|
-
static readonly SNMP_AUTH: Partial<Record<SnmpUser["auth"], string>>;
|
|
18
|
-
/** The OSPF process number. */
|
|
19
|
-
private static readonly OSPF_PROCESS;
|
|
20
|
-
/** The SNMPv3 access group every user belongs to, read-only on the whole tree. */
|
|
21
|
-
private static readonly SNMP_GROUP;
|
|
22
|
-
/** `99,200-201,999`, the platform's compression of a VLAN list. */
|
|
23
|
-
static vlanList(ids: number[]): string;
|
|
24
|
-
/** The whole configuration of a device. */
|
|
25
|
-
static of(device: Device): string;
|
|
26
|
-
/** An access-list permitting `sources`, then denying the rest. Its description takes one word. */
|
|
27
|
-
private static accessList;
|
|
28
|
-
/** Access or trunk membership, for a port or a LAG. */
|
|
29
|
-
private static switching;
|
|
30
|
-
/** A VRRP group. The platform enables a group once it has an address, and preempts unless told not to. */
|
|
31
|
-
private static vrrp;
|
|
32
|
-
/** A port the config does not declare is shut down. A LAG member holds its membership and description; the LAG holds the rest. */
|
|
33
|
-
private static physicalPort;
|
|
34
|
-
/** The MAC access-list of the port at `index` in the catalog, for its `ethertypes`. MAC access-lists are 3000 and up. */
|
|
35
|
-
/** The BFD session for each next hop a static route watches, numbered from 1 in the order the routes come, with the VLAN its interface is on. A next hop on no VLAN interface's network has none. */
|
|
36
|
-
static bfdSessions(device: Device): Map<string, {
|
|
37
|
-
id: number;
|
|
38
|
-
vlan: string;
|
|
39
|
-
}>;
|
|
40
|
-
static ethertypeAcl(index: number): number;
|
|
41
|
-
}
|