@takodotid/circuit 0.34.3 → 0.36.0
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 +14 -15
- package/dist/chunks/index-20kcjxjg.js +174 -0
- package/dist/chunks/index-2r4bbhac.js +977 -0
- package/dist/chunks/index-n7w3tg5y.js +149 -0
- package/dist/chunks/new-w3zys5y4.js +172 -0
- package/dist/chunks/server-gzsf5me5.js +259 -0
- package/dist/cli/index.js +11345 -9024
- package/dist/helpers/index.js +594 -0
- package/dist/index.js +9 -28
- package/dist/types/core/{addresses.d.ts → address-space.d.ts} +23 -7
- package/dist/types/core/address.d.ts +44 -0
- package/dist/types/core/cabling.d.ts +41 -0
- package/dist/types/core/cross-checks.d.ts +28 -0
- package/dist/types/core/define.d.ts +25 -3
- package/dist/types/core/project-files.d.ts +12 -0
- package/dist/types/core/schema-docs.d.ts +13 -4
- package/dist/types/core/secrets.d.ts +62 -21
- package/dist/types/core/{graph.d.ts → topology.d.ts} +32 -12
- package/dist/types/core/utils.d.ts +8 -0
- package/dist/types/core/validator.d.ts +19 -0
- package/dist/types/helpers/bgp.d.ts +97 -0
- package/dist/types/helpers/checks.d.ts +32 -0
- package/dist/types/helpers/exchange.d.ts +49 -0
- package/dist/types/helpers/filters.d.ts +51 -0
- package/dist/types/helpers/index.d.ts +10 -0
- package/dist/types/helpers/route-server.d.ts +52 -0
- package/dist/types/index.d.ts +5 -3
- package/dist/types/integrations/librenms.d.ts +60 -0
- package/dist/types/integrations/netbox.d.ts +89 -0
- package/dist/types/integrations/peeringdb.d.ts +24 -0
- package/dist/types/integrations/prometheus.d.ts +24 -0
- package/dist/types/integrations/registries.d.ts +8 -0
- package/dist/types/platforms/bgp-wait.d.ts +18 -0
- package/dist/types/platforms/catalog.d.ts +109 -0
- package/dist/types/platforms/derive.d.ts +17 -0
- package/dist/types/platforms/fortios/firewall.d.ts +45 -0
- package/dist/types/platforms/fortios/index.d.ts +134 -0
- package/dist/types/platforms/fortios/names.d.ts +52 -0
- package/dist/types/platforms/fortios/plan.d.ts +104 -0
- package/dist/types/platforms/fortios/render.d.ts +75 -0
- package/dist/types/platforms/fortios/routing.d.ts +56 -0
- package/dist/types/platforms/fortios/tree.d.ts +37 -0
- package/dist/types/platforms/index.d.ts +13 -0
- package/dist/types/platforms/junos/bgp.d.ts +44 -0
- package/dist/types/platforms/junos/index.d.ts +114 -0
- package/dist/types/platforms/junos/render.d.ts +154 -0
- package/dist/types/platforms/line-diff.d.ts +67 -0
- package/dist/types/platforms/platform.d.ts +120 -0
- package/dist/types/platforms/raisecom-ros/index.d.ts +71 -0
- package/dist/types/platforms/raisecom-ros/render.d.ts +41 -0
- package/dist/types/platforms/routeros/export.d.ts +59 -0
- package/dist/types/platforms/routeros/index.d.ts +96 -0
- package/dist/types/{adapters/devices → platforms}/routeros/models.d.ts +4 -0
- package/dist/types/platforms/routeros/plan.d.ts +54 -0
- package/dist/types/platforms/routeros/render.d.ts +240 -0
- package/dist/types/platforms/vrp/index.d.ts +83 -0
- package/dist/types/platforms/vrp/render.d.ts +96 -0
- package/dist/types/schema/common.d.ts +12 -6
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/interfaces.d.ts +14 -6
- package/dist/types/schema/policy.d.ts +18 -10
- package/dist/types/schema/routing.d.ts +14 -1
- package/dist/types/schema/system.d.ts +16 -6
- package/dist/types/schema/time-zones.d.ts +2 -0
- package/dist/types/transport/console.d.ts +79 -23
- package/dist/types/transport/path-check.d.ts +32 -0
- package/dist/types/transport/ssh.d.ts +17 -15
- package/package.json +18 -12
- package/src/cli/graph-format.ts +91 -0
- package/src/cli/index.ts +1074 -484
- package/src/cli/new.ts +208 -175
- package/src/cli/rename.ts +97 -91
- package/src/core/address-space.ts +320 -0
- package/src/core/address.ts +202 -0
- package/src/core/cabling.ts +154 -0
- package/src/core/cross-checks.ts +364 -0
- package/src/core/define.ts +26 -3
- package/src/core/project-files.ts +35 -0
- package/src/core/schema-docs.ts +138 -130
- package/src/core/secrets.ts +170 -76
- package/src/core/topology.ts +656 -0
- package/src/core/utils.ts +37 -0
- package/src/core/validator.ts +407 -0
- package/src/helpers/bgp.ts +301 -0
- package/src/helpers/checks.ts +178 -0
- package/src/helpers/exchange.ts +117 -0
- package/src/helpers/filters.ts +107 -0
- package/src/helpers/index.ts +12 -0
- package/src/helpers/route-server.ts +212 -0
- package/src/index.ts +6 -3
- package/src/integrations/librenms.ts +291 -0
- package/src/integrations/netbox.ts +620 -0
- package/src/integrations/peeringdb.ts +173 -0
- package/src/integrations/prometheus.ts +90 -0
- package/src/integrations/registries.ts +25 -0
- package/src/platforms/bgp-wait.ts +41 -0
- package/src/platforms/catalog.ts +69 -0
- package/src/platforms/derive.ts +117 -0
- package/src/{adapters/devices → platforms}/fortios/TRAPS.md +6 -0
- package/src/platforms/fortios/firewall.ts +377 -0
- package/src/platforms/fortios/index.ts +1060 -0
- package/src/platforms/fortios/names.ts +130 -0
- package/src/platforms/fortios/plan.ts +929 -0
- package/src/platforms/fortios/render.ts +779 -0
- package/src/platforms/fortios/routing.ts +476 -0
- package/src/platforms/fortios/tree.ts +129 -0
- package/src/platforms/index.ts +36 -0
- package/src/{adapters/devices → platforms}/junos/TRAPS.md +8 -0
- package/src/platforms/junos/bgp.ts +293 -0
- package/src/platforms/junos/index.ts +1006 -0
- package/src/platforms/junos/render.ts +967 -0
- package/src/platforms/line-diff.ts +244 -0
- package/src/platforms/platform.ts +122 -0
- package/src/platforms/raisecom-ros/TRAPS.md +40 -0
- package/src/platforms/raisecom-ros/index.ts +731 -0
- package/src/platforms/raisecom-ros/render.ts +328 -0
- package/src/{adapters/devices → platforms}/routeros/TRAPS.md +16 -2
- package/src/platforms/routeros/export.ts +342 -0
- package/src/platforms/routeros/index.ts +636 -0
- package/src/{adapters/devices → platforms}/routeros/models.ts +2 -0
- package/src/platforms/routeros/plan.ts +444 -0
- package/src/platforms/routeros/render.ts +1483 -0
- package/src/platforms/vrp/TRAPS.md +45 -0
- package/src/platforms/vrp/index.ts +652 -0
- package/src/platforms/vrp/render.ts +615 -0
- package/src/schema/common.ts +15 -6
- package/src/schema/index.ts +1 -0
- package/src/schema/interfaces.ts +15 -5
- package/src/schema/policy.ts +22 -10
- package/src/schema/routing.ts +16 -1
- package/src/schema/system.ts +16 -6
- package/src/schema/time-zones.ts +482 -0
- package/src/studio/data.ts +172 -168
- package/src/studio/git.ts +95 -90
- package/src/studio/public/app.js +161 -150
- package/src/studio/public/compare.js +219 -212
- package/src/studio/public/diff.js +77 -75
- package/src/studio/public/dom.js +118 -108
- package/src/studio/public/evaluate.js +584 -545
- package/src/studio/public/export.js +120 -118
- package/src/studio/public/graph.js +1343 -1266
- package/src/studio/public/net.js +115 -109
- package/src/studio/public/tables.js +1135 -1083
- package/src/studio/public/tools.js +561 -529
- package/src/studio/server.ts +202 -196
- package/src/transport/console.ts +363 -271
- package/src/transport/path-check.ts +91 -0
- package/src/transport/ssh.ts +98 -94
- package/templates/colocation/checks.ts +11 -6
- package/templates/colocation/edge-01.ts +9 -9
- package/templates/colocation/routing.ts +2 -2
- package/templates/colocation/tenancy.ts +3 -3
- package/templates/colocation/tor-01.ts +3 -3
- package/templates/edge-router/checks.ts +4 -4
- package/templates/edge-router/edge-01.ts +5 -5
- package/templates/edge-router/routing.ts +2 -2
- package/templates/project/AGENTS.md +5 -1
- package/templates/single-site/checks.ts +2 -2
- package/dist/chunks/index-47debt16.js +0 -956
- package/dist/chunks/index-v8zgr7wm.js +0 -128
- package/dist/chunks/new-ny89s7y7.js +0 -166
- package/dist/chunks/server-tjbb3rqc.js +0 -251
- package/dist/presets/index.js +0 -394
- package/dist/types/adapters/devices/catalog.d.ts +0 -86
- package/dist/types/adapters/devices/derive.d.ts +0 -7
- package/dist/types/adapters/devices/fortios/firewall.d.ts +0 -23
- package/dist/types/adapters/devices/fortios/index.d.ts +0 -58
- package/dist/types/adapters/devices/fortios/names.d.ts +0 -48
- package/dist/types/adapters/devices/fortios/plan.d.ts +0 -28
- package/dist/types/adapters/devices/fortios/render.d.ts +0 -38
- package/dist/types/adapters/devices/fortios/routing.d.ts +0 -32
- package/dist/types/adapters/devices/fortios/tree.d.ts +0 -33
- package/dist/types/adapters/devices/index.d.ts +0 -3
- package/dist/types/adapters/devices/junos/bgp.d.ts +0 -11
- package/dist/types/adapters/devices/junos/index.d.ts +0 -42
- package/dist/types/adapters/devices/junos/render.d.ts +0 -52
- package/dist/types/adapters/devices/lines.d.ts +0 -56
- package/dist/types/adapters/devices/raisecom-ros/index.d.ts +0 -28
- package/dist/types/adapters/devices/routeros/export.d.ts +0 -39
- package/dist/types/adapters/devices/routeros/index.d.ts +0 -30
- package/dist/types/adapters/devices/routeros/plan.d.ts +0 -4
- package/dist/types/adapters/devices/routeros/render.d.ts +0 -100
- package/dist/types/adapters/devices/types.d.ts +0 -40
- package/dist/types/adapters/devices/vrp/index.d.ts +0 -27
- package/dist/types/adapters/registries/index.d.ts +0 -3
- package/dist/types/adapters/registries/librenms.d.ts +0 -15
- package/dist/types/adapters/registries/peeringdb.d.ts +0 -16
- package/dist/types/adapters/registries/prometheus.d.ts +0 -16
- package/dist/types/core/across.d.ts +0 -4
- package/dist/types/core/addr.d.ts +0 -34
- package/dist/types/core/files.d.ts +0 -6
- package/dist/types/core/merge.d.ts +0 -4
- package/dist/types/core/time.d.ts +0 -2
- package/dist/types/core/validate.d.ts +0 -2
- package/dist/types/presets/index.d.ts +0 -183
- package/src/adapters/devices/catalog.ts +0 -41
- package/src/adapters/devices/derive.ts +0 -59
- package/src/adapters/devices/fortios/firewall.ts +0 -362
- package/src/adapters/devices/fortios/index.ts +0 -923
- package/src/adapters/devices/fortios/names.ts +0 -115
- package/src/adapters/devices/fortios/plan.ts +0 -888
- package/src/adapters/devices/fortios/render.ts +0 -768
- package/src/adapters/devices/fortios/routing.ts +0 -444
- package/src/adapters/devices/fortios/tree.ts +0 -121
- package/src/adapters/devices/index.ts +0 -9
- package/src/adapters/devices/junos/bgp.ts +0 -269
- package/src/adapters/devices/junos/index.ts +0 -862
- package/src/adapters/devices/junos/render.ts +0 -872
- package/src/adapters/devices/lines.ts +0 -212
- package/src/adapters/devices/raisecom-ros/TRAPS.md +0 -26
- package/src/adapters/devices/raisecom-ros/index.ts +0 -700
- package/src/adapters/devices/routeros/export.ts +0 -321
- package/src/adapters/devices/routeros/index.ts +0 -346
- package/src/adapters/devices/routeros/plan.ts +0 -398
- package/src/adapters/devices/routeros/render.ts +0 -1490
- package/src/adapters/devices/types.ts +0 -38
- package/src/adapters/devices/vrp/TRAPS.md +0 -26
- package/src/adapters/devices/vrp/index.ts +0 -865
- package/src/adapters/registries/index.ts +0 -19
- package/src/adapters/registries/librenms.ts +0 -92
- package/src/adapters/registries/peeringdb.ts +0 -169
- package/src/adapters/registries/prometheus.ts +0 -71
- package/src/cli/graph.ts +0 -89
- package/src/core/across.ts +0 -350
- package/src/core/addr.ts +0 -174
- package/src/core/addresses.ts +0 -316
- package/src/core/files.ts +0 -32
- package/src/core/graph.ts +0 -640
- package/src/core/merge.ts +0 -19
- package/src/core/time.ts +0 -15
- package/src/core/validate.ts +0 -348
- package/src/presets/index.ts +0 -579
- /package/dist/types/{adapters/devices → platforms}/fortios/models.d.ts +0 -0
- /package/dist/types/{adapters/devices → platforms}/junos/models.d.ts +0 -0
- /package/dist/types/{adapters/devices → platforms}/raisecom-ros/models.d.ts +0 -0
- /package/dist/types/{adapters/devices → platforms}/vrp/models.d.ts +0 -0
- /package/src/{adapters/devices → platforms}/fortios/models.ts +0 -0
- /package/src/{adapters/devices → platforms}/junos/models.ts +0 -0
- /package/src/{adapters/devices → platforms}/raisecom-ros/models.ts +0 -0
- /package/src/{adapters/devices → platforms}/vrp/models.ts +0 -0
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Device, Helper, Severity } from "../../../schema";
|
|
2
|
-
/** Where the pre-login banner's text is kept. */
|
|
3
|
-
export declare const BANNER = "system replacemsg admin \"pre_admin-disclaimer-text\"";
|
|
4
|
-
/** Every section Circuit manages, in the order a change goes in: what others name comes first. */
|
|
5
|
-
export declare const SECTIONS: readonly ["vpn certificate local", "vpn certificate ca", "system global", "system replacemsg admin \"pre_admin-disclaimer-text\"", "system settings", "system accprofile", "system admin", "system interface", "system gre-tunnel", "system vxlan", "system dns", "system dns-server", "system ntp", "system snmp sysinfo", "system snmp community", "system snmp user", "log memory setting", "log memory filter", "log disk setting", ...string[], "system sflow", "system netflow", "system dhcp server", "router static", "router static6", "router prefix-list", "router prefix-list6", "router community-list", "router route-map", "router ospf", "router ospf6", "router bgp", "system session-helper", "firewall address", "firewall address6", "firewall addrgrp", "firewall addrgrp6", "firewall service custom", "firewall ippool", "firewall vip", "firewall policy", "firewall policy6", "firewall local-in-policy", "firewall local-in-policy6", "firewall central-snat-map", "firewall acl", "firewall acl6"];
|
|
6
|
-
export type Section = (typeof SECTIONS)[number];
|
|
7
|
-
/** Sections `show` prints without what matters, which `show full-configuration` prints: a certificate's text. */
|
|
8
|
-
export declare const FULL: readonly string[];
|
|
9
|
-
/** The zone number for an IANA zone. UTC when the config names none. */
|
|
10
|
-
export declare function zoneOf(timezone?: string): string | undefined;
|
|
11
|
-
/** What each role may do: the factory profile for an admin, and a profile Circuit adds for the others. */
|
|
12
|
-
export declare const PROFILE: {
|
|
13
|
-
readonly admin: "super_admin";
|
|
14
|
-
readonly operator: "circuit-operator";
|
|
15
|
-
readonly "read-only": "circuit-read-only";
|
|
16
|
-
};
|
|
17
|
-
/** The most public keys a user holds. */
|
|
18
|
-
export declare const SSH_KEYS = 3;
|
|
19
|
-
/** The most resolvers the device and a DHCP server hold, per family. */
|
|
20
|
-
export declare const RESOLVERS: {
|
|
21
|
-
readonly device: 2;
|
|
22
|
-
readonly dhcp: 4;
|
|
23
|
-
};
|
|
24
|
-
/** The most syslog collectors the device sends to. */
|
|
25
|
-
export declare const COLLECTORS = 4;
|
|
26
|
-
/** The most VRFs the device holds besides its default table. */
|
|
27
|
-
export declare const VRFS = 31;
|
|
28
|
-
/** A severity as the platform names it. */
|
|
29
|
-
export declare const LEVEL: Record<Severity, string>;
|
|
30
|
-
/** The helpers the factory runs, by the name a config gives them: protocol and port of each. */
|
|
31
|
-
export declare const HELPERS: Partial<Record<Helper, readonly [string, number, number][]>>;
|
|
32
|
-
/** Speed by the platform's spelling, for each class a port's cage takes. */
|
|
33
|
-
export declare const SPEEDS: Record<string, Partial<Record<string, string>>>;
|
|
34
|
-
/** The management address of a device in transparent mode, which is reached only through its console: link-local, on no network it can reach. */
|
|
35
|
-
export declare const TRANSPARENT_MANAGEIP = "169.254.0.1/255.255.255.255";
|
|
36
|
-
export declare function render(device: Device): string;
|
|
37
|
-
/** The one port or LAG that carries a VLAN tagged, which its VLAN interface sits on. `unsupported()` refuses any other case. */
|
|
38
|
-
export declare function vlanParent(device: Device, vlan: string): string | undefined;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Device, Family, Neighbor, NeighborSettings, PolicyRule } from "../../../schema";
|
|
2
|
-
import { Block } from "./tree";
|
|
3
|
-
type AnyRule = PolicyRule<string, string>;
|
|
4
|
-
type AnyNeighbor = Neighbor<string, string>;
|
|
5
|
-
/** The route map a session takes when its config states none, so it learns or announces nothing. */
|
|
6
|
-
export declare const REJECT_ALL = "circuit-reject-all";
|
|
7
|
-
/** The start of the comment on a prefix list `refresh` fills. The plan keeps the entries the device holds in one. */
|
|
8
|
-
export declare const FILLED = "Filled by circuit refresh";
|
|
9
|
-
/** The table a prefix list of one family sits in. */
|
|
10
|
-
export declare const PREFIX_LIST: {
|
|
11
|
-
readonly ipv4: "router prefix-list";
|
|
12
|
-
readonly ipv6: "router prefix-list6";
|
|
13
|
-
};
|
|
14
|
-
/** The longest prefix of each family. */
|
|
15
|
-
export declare const BITS: {
|
|
16
|
-
readonly ipv4: 32;
|
|
17
|
-
readonly ipv6: 128;
|
|
18
|
-
};
|
|
19
|
-
/** A neighbor's settings with its group's beneath them. */
|
|
20
|
-
export declare function neighborSettings(device: Device, neighbor: AnyNeighbor): NeighborSettings<string>;
|
|
21
|
-
/** The families a session carries: its own, or the family of its address. */
|
|
22
|
-
export declare function familiesOfNeighbor(device: Device, neighbor: AnyNeighbor): Family[];
|
|
23
|
-
/** Whether OSPF or BGP detects a dead neighbor with BFD, which the device then runs. */
|
|
24
|
-
export declare function usesBfd(device: Device): boolean;
|
|
25
|
-
export declare function routing(root: Block, device: Device): void;
|
|
26
|
-
/** The family a rule is limited to, by its match: a family, a prefix, or a prefix set of one family. */
|
|
27
|
-
export declare function familyOfRule(device: Device, rule: AnyRule): Family | undefined;
|
|
28
|
-
/** A policy's rules with each call replaced by the rules it calls, in order. A called policy that decides nothing hands back to the caller. */
|
|
29
|
-
export declare function flatten(device: Device, policy: string, seen?: string[]): AnyRule[];
|
|
30
|
-
/** Routing the platform cannot express, or that this adapter does not yet write. */
|
|
31
|
-
export declare function routingGaps(device: Device): string[];
|
|
32
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/** A setting the device prints as `unset <key>`, a key it holds empty on purpose, such as an ICMP service's type. */
|
|
2
|
-
export declare const UNSET = "\0unset";
|
|
3
|
-
/** One `edit` of a table: its name as written, and what it holds. */
|
|
4
|
-
export type Entry = {
|
|
5
|
-
id: string;
|
|
6
|
-
block: Block;
|
|
7
|
-
};
|
|
8
|
-
export declare class Block {
|
|
9
|
-
readonly settings: Map<string, string>;
|
|
10
|
-
readonly blocks: Map<string, Block>;
|
|
11
|
-
readonly entries: Map<string, Entry>;
|
|
12
|
-
/** Set a key. A value of several words is written as given. */
|
|
13
|
-
set(key: string, value: string | number): this;
|
|
14
|
-
/** The nested `config` block with this header, created when absent. */
|
|
15
|
-
block(header: string): Block;
|
|
16
|
-
/** The table entry with this name, created when absent. A name is quoted unless it is a number, or the table prints it bare, such as an OSPF area or an IPv6 prefix. */
|
|
17
|
-
entry(id: string | number, plain?: boolean): Block;
|
|
18
|
-
isEmpty(): boolean;
|
|
19
|
-
}
|
|
20
|
-
/** A string as the CLI takes it, in double quotes. */
|
|
21
|
-
export declare function quote(text: string): string;
|
|
22
|
-
/** Each of several strings quoted, as a list setting takes them. */
|
|
23
|
-
export declare const quoteAll: (texts: readonly string[]) => string;
|
|
24
|
-
/** A value's words; a quoted string is one word with its quotes. */
|
|
25
|
-
export declare function wordsOf(value: string): string[];
|
|
26
|
-
/** A word as the device means it, without quotes or escapes. */
|
|
27
|
-
export declare function bare(word: string): string;
|
|
28
|
-
/** The lines that build a block, at an indent, in the form `show` prints and the CLI takes. */
|
|
29
|
-
export declare function linesOf(block: Block, indent?: string): string[];
|
|
30
|
-
/** The whole configuration: each top-level block as `config <section>` to `end`. */
|
|
31
|
-
export declare function print(root: Block): string;
|
|
32
|
-
/** The tree of what `show` printed. Lines that are not configuration, such as the version header, are skipped. */
|
|
33
|
-
export declare function parse(text: string): Block;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Device, Neighbor, NeighborSettings } from "../../../schema";
|
|
2
|
-
import { type Statements } from "./render";
|
|
3
|
-
type AnyNeighbor = Neighbor<string, string>;
|
|
4
|
-
/** The policy a session uses when it states none, so that it learns or announces nothing. */
|
|
5
|
-
export declare const REJECT_ALL = "circuit-reject-all";
|
|
6
|
-
/** A comment in the render naming a path whose statements `refresh` fills, so the plan keeps what the device holds there. */
|
|
7
|
-
export declare const GENERATED = "# generated ";
|
|
8
|
-
/** A neighbor's settings with its group's beneath them. */
|
|
9
|
-
export declare function settingsOf(device: Device, neighbor: AnyNeighbor): NeighborSettings<string>;
|
|
10
|
-
export declare function renderBgp(out: Statements, device: Device): void;
|
|
11
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Client, ClientChannel } from "ssh2";
|
|
2
|
-
import type { Device, Family } from "../../../schema";
|
|
3
|
-
import { type ConsoleDialect } from "../../../transport/console";
|
|
4
|
-
import type { ApplyOptions, DeviceAdapter, Plan, ReadOptions } from "../types";
|
|
5
|
-
/** A statement's words; a quoted value is one word with its quotes. */
|
|
6
|
-
export declare function wordsOf(statement: string): string[];
|
|
7
|
-
/** The device prints a password as a hash, an SNMP key as a reversible cipher, and a community as itself. None leave the read. */
|
|
8
|
-
export declare function scrub(text: string): string;
|
|
9
|
-
/** The configuration's statements from what `show configuration | display set` printed. */
|
|
10
|
-
export declare function clean(output: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* What changes, by section.
|
|
13
|
-
*
|
|
14
|
-
* 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.
|
|
15
|
-
*
|
|
16
|
-
* 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.
|
|
17
|
-
*/
|
|
18
|
-
export declare function plan(desired: string, current: string, options: Pick<ApplyOptions, "secrets">): Plan;
|
|
19
|
-
export declare function login(device: Device): Promise<Client>;
|
|
20
|
-
export declare function read(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
21
|
-
/** 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. */
|
|
22
|
-
export declare const JUNOS_CONSOLE: ConsoleDialect;
|
|
23
|
-
/** An interactive CLI with paging off. Root lands in a shell and starts the CLI from there. */
|
|
24
|
-
export declare function openCli(channel: ClientChannel): Promise<void>;
|
|
25
|
-
/** How a commit that could cut access is guarded: it rolls back after `minutes` unless `prove` shows access survived. */
|
|
26
|
-
export type Guard = {
|
|
27
|
-
minutes: number;
|
|
28
|
-
prove: () => Promise<void>;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* 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.
|
|
32
|
-
*
|
|
33
|
-
* Deletions go before the statements that are set, so a path deleted and set again in one plan ends up set.
|
|
34
|
-
*/
|
|
35
|
-
export declare function configure(channel: ClientChannel, plan: Plan, guard?: Guard, paced?: boolean): Promise<void>;
|
|
36
|
-
export declare function apply(device: Device, _network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
|
|
37
|
-
export declare function unsupported(device: Device): string[];
|
|
38
|
-
/** The plan that replaces a prefix list's entries with what a registry returned. */
|
|
39
|
-
export declare function fillPlan(set: string, prefixes: string[]): Plan;
|
|
40
|
-
/** Replace a prefix list `refresh` fetched. It cannot cut access, so it is committed without a rollback. */
|
|
41
|
-
export declare function fill(device: Device, _network: readonly Device[], set: string, _family: Family, prefixes: string[]): Promise<void>;
|
|
42
|
-
export declare const junos: DeviceAdapter;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Device, Interface, Port, Vrrp } from "../../../schema";
|
|
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
|
-
/** The statement each kind of public key is written under, by the key's own prefix. */
|
|
9
|
-
export declare const KEY_STATEMENT: Record<string, string>;
|
|
10
|
-
/** Detection under a second: three missed packets 300 ms apart. */
|
|
11
|
-
export declare const BFD_INTERVAL = 300;
|
|
12
|
-
/** Quote a value unless it is a plain word. Quoting more than the platform would is harmless: the comparison ignores quotes. */
|
|
13
|
-
export declare function quote(value: string): string;
|
|
14
|
-
/** Collects `set` statements, and comments the plan reads. */
|
|
15
|
-
export declare class Statements {
|
|
16
|
-
private readonly lines;
|
|
17
|
-
private readonly notes;
|
|
18
|
-
set(...words: (string | number)[]): void;
|
|
19
|
-
note(comment: string): void;
|
|
20
|
-
/** The statements as the device prints them: each once, and none that another one extends, because the platform prints only the longest. */
|
|
21
|
-
text(): string;
|
|
22
|
-
}
|
|
23
|
-
/** What the platform calls a port, a LAG, a VLAN interface or a loopback. */
|
|
24
|
-
export declare class Names {
|
|
25
|
-
private readonly device;
|
|
26
|
-
readonly lags: Map<string, number>;
|
|
27
|
-
readonly loopbacks: Map<string, number>;
|
|
28
|
-
readonly tunnels: Map<string, number>;
|
|
29
|
-
constructor(device: Device);
|
|
30
|
-
/** A physical port. A 10G cage holding a 1G optic is `ge-`, not `xe-`. */
|
|
31
|
-
port(port: string): string;
|
|
32
|
-
/** The physical interface a port or a LAG is: `xe-0/0/1`, `ae1`. */
|
|
33
|
-
physical(name: string): string;
|
|
34
|
-
/** The logical interface that holds addresses: `xe-0/0/1.0`, `ae1.0`, `irb.10`, `lo0.0`. */
|
|
35
|
-
unit(name: string): string;
|
|
36
|
-
/** The physical ports behind a port or a LAG. */
|
|
37
|
-
members(name: string): string[];
|
|
38
|
-
}
|
|
39
|
-
/** The address a VRRP group sits on: the one whose network holds the virtual address. */
|
|
40
|
-
export declare function vrrpAddress(addresses: readonly string[], group: Vrrp): string | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* 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.
|
|
43
|
-
*/
|
|
44
|
-
export declare function stormProfile(settings: Switched): {
|
|
45
|
-
name: string;
|
|
46
|
-
percent: number;
|
|
47
|
-
left: string[];
|
|
48
|
-
} | undefined;
|
|
49
|
-
export declare function render(device: Device): string;
|
|
50
|
-
/** The size a port's frames may reach for an IP MTU: the Ethernet header, and a VLAN tag when the port switches. */
|
|
51
|
-
export declare const frameSize: (mtu: number, switched: boolean) => number;
|
|
52
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { Plan } from "./types";
|
|
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
|
-
export declare function entries(text: string, dialect: Dialect): Entry[];
|
|
28
|
-
/** 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. */
|
|
29
|
-
export declare function head(line: string): string;
|
|
30
|
-
/** What changes inside one block. */
|
|
31
|
-
export type Group = {
|
|
32
|
-
path: string[];
|
|
33
|
-
remove: string[];
|
|
34
|
-
add: string[];
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* What differs, by block.
|
|
38
|
-
*
|
|
39
|
-
* 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.
|
|
40
|
-
*/
|
|
41
|
-
export declare function compare(desired: string, current: string, dialect: Dialect): Group[];
|
|
42
|
-
/**
|
|
43
|
-
* Replace a changed VLAN list line with only what changed.
|
|
44
|
-
*
|
|
45
|
-
* 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.
|
|
46
|
-
*/
|
|
47
|
-
export declare function vlanListChange(groups: Group[], prefix: string, parse: (line: string) => number[], format: (ids: number[]) => string[], removal: (ids: number[]) => string[]): void;
|
|
48
|
-
/** Commands a platform needs around one group, such as releasing a binding before a change and restoring it after. */
|
|
49
|
-
export type Around = (group: Group) => {
|
|
50
|
-
before: string[];
|
|
51
|
-
after: string[];
|
|
52
|
-
};
|
|
53
|
-
/** The steps for the groups: enter each block of the path, undo, add, then leave each level. */
|
|
54
|
-
export declare function steps(groups: Group[], dialect: Dialect, around?: Around): Plan["steps"];
|
|
55
|
-
/** A device prints stored credentials as ciphers. They never leave the read. */
|
|
56
|
-
export declare const scrub: (text: string) => string;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ClientChannel } from "ssh2";
|
|
2
|
-
import type { Device } from "../../../schema";
|
|
3
|
-
import { type ConsoleDialect } from "../../../transport/console";
|
|
4
|
-
import { type Dialect } from "../lines";
|
|
5
|
-
import type { ApplyOptions, DeviceAdapter, Plan, ReadOptions } from "../types";
|
|
6
|
-
export declare const dialect: Dialect;
|
|
7
|
-
/** The access-list that guards every management service. */
|
|
8
|
-
export declare const MANAGEMENT_ACL = 1000;
|
|
9
|
-
/** `99,200-201,999`, the platform's compression of a VLAN list. */
|
|
10
|
-
export declare function vlanList(ids: number[]): string;
|
|
11
|
-
export declare function render(device: Device): string;
|
|
12
|
-
/** A session, and how to prove access in a fresh login: a new SSH session, or logging out and in again on the console. */
|
|
13
|
-
export type Session = {
|
|
14
|
-
channel: ClientChannel;
|
|
15
|
-
close: () => void;
|
|
16
|
-
fresh: () => Promise<Session>;
|
|
17
|
-
};
|
|
18
|
-
/** How the console asks for a login. Not yet proved on a device: the RAX721's console was never cabled to a jump host. */
|
|
19
|
-
export declare const RAISECOM_CONSOLE: ConsoleDialect;
|
|
20
|
-
/** 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. */
|
|
21
|
-
export declare function open(device: Device, options?: ReadOptions): Promise<Session>;
|
|
22
|
-
/** What the device runs, credentials scrubbed. */
|
|
23
|
-
export declare function read(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
24
|
-
export declare function unsupported(device: Device): string[];
|
|
25
|
-
export declare function apply(device: Device, _network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
|
|
26
|
-
/** The VLAN IDs of a `create vlan 10,20-30 active` line. */
|
|
27
|
-
export declare function createdIds(line: string): number[];
|
|
28
|
-
export declare const raisecom: DeviceAdapter;
|
|
@@ -1,39 +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 function parse(text: string): Parsed;
|
|
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
|
-
export declare const DEFAULTS: Record<string, Record<string, string>>;
|
|
24
|
-
/** The default of one property of a command, or undefined when it is not known. */
|
|
25
|
-
export declare function defaultOf(command: Command, property: string): string | undefined;
|
|
26
|
-
/** 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. */
|
|
27
|
-
export declare const CLEARED_WITH: Record<string, Record<string, string>>;
|
|
28
|
-
/** Properties whose value cannot be read back from the device. They are compared only by the presence of what holds them. */
|
|
29
|
-
export declare const SECRET_KEYS: Set<string>;
|
|
30
|
-
/** How the renderer writes a secret. */
|
|
31
|
-
export declare const isSecretMarker: (value: string) => boolean;
|
|
32
|
-
/** A command's properties without defaults or secrets, in the form both sides compare in. */
|
|
33
|
-
export declare function normal(command: Command): Record<string, string>;
|
|
34
|
-
/** What identifies an `add` entry, so that the same entry is found on both sides. */
|
|
35
|
-
export declare function identity(command: Command): Record<string, string>;
|
|
36
|
-
/** Menus whose entries are an ordered list without names. They are rewritten whole, in the order the render gives. */
|
|
37
|
-
export declare const ORDERED: Set<string>;
|
|
38
|
-
/** One command as a string that is equal for equal commands. */
|
|
39
|
-
export declare function canonical(command: Command): string;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Client } from "ssh2";
|
|
2
|
-
import type { Device, Family } from "../../../schema";
|
|
3
|
-
import { type ConsoleDialect } from "../../../transport/console";
|
|
4
|
-
import type { ApplyOptions, DeviceAdapter, Plan, ReadOptions } from "../types";
|
|
5
|
-
/** The major version this adapter renders for. Version 6 has a different BGP and filter language altogether. */
|
|
6
|
-
export declare const SUPPORTED_MAJOR = 7;
|
|
7
|
-
export declare function login(device: Device): Promise<Client>;
|
|
8
|
-
/** 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. */
|
|
9
|
-
export declare const ROUTEROS_CONSOLE: ConsoleDialect;
|
|
10
|
-
/** Where commands run, one at a time, each returning what it printed: an SSH session, or the console. */
|
|
11
|
-
type Session = {
|
|
12
|
-
run(command: string, timeout?: number): Promise<string>;
|
|
13
|
-
/** Write a file to the device. Only SSH can. */
|
|
14
|
-
upload?(path: string, content: string): Promise<void>;
|
|
15
|
-
/** A fresh login, which proves access survived: this session ends and a new SSH session opens, or the console logs out and in again. */
|
|
16
|
-
fresh(): Promise<Session>;
|
|
17
|
-
end(): void;
|
|
18
|
-
};
|
|
19
|
-
/** Refuse a device on a version this adapter does not render for, before anything is read or sent. */
|
|
20
|
-
export declare function checkVersion(session: Session, device: Device): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* What the device runs: its export, its users, and its certificates. Secrets are not part of an export.
|
|
23
|
-
*/
|
|
24
|
-
export declare function read(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
25
|
-
export declare function unsupported(device: Device): string[];
|
|
26
|
-
export declare function apply(device: Device, _network: readonly Device[], changes: Plan, options: ApplyOptions): Promise<void>;
|
|
27
|
-
/** Replace a list's entries in batches, so each command stays a sane length. */
|
|
28
|
-
export declare function fill(device: Device, _network: readonly Device[], set: string, family: Family, prefixes: string[]): Promise<void>;
|
|
29
|
-
export declare const routeros: DeviceAdapter;
|
|
30
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ApplyOptions, Plan } from "../types";
|
|
2
|
-
/** A plan line the apply handles itself: upload a certificate and its key, and import them. */
|
|
3
|
-
export declare const INSTALL_CERTIFICATE = "#install-certificate ";
|
|
4
|
-
export declare function plan(desired: string, current: string, options: Pick<ApplyOptions, "secrets">): Plan;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import type { Device, Family, Interface, Port, Ports } from "../../../schema";
|
|
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
|
-
/** Collects commands under their menu. */
|
|
5
|
-
export declare class Output {
|
|
6
|
-
private readonly menus;
|
|
7
|
-
/** Add a command to a menu. */
|
|
8
|
-
add(menu: string, command: string): void;
|
|
9
|
-
/** The whole configuration as text. */
|
|
10
|
-
text(): string;
|
|
11
|
-
}
|
|
12
|
-
/** Quote a value when it holds anything but plain characters. */
|
|
13
|
-
export declare function quote(value: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* A command: a verb such as `add` or `set [ find name=x ]`, then `property=value` for every property that has a value.
|
|
16
|
-
*
|
|
17
|
-
* Properties are written in the order given.
|
|
18
|
-
*/
|
|
19
|
-
export declare function command(verb: string, properties: Record<string, Value>): string;
|
|
20
|
-
/** `yes` or `no`. */
|
|
21
|
-
export declare const yesNo: (on: boolean | undefined) => string;
|
|
22
|
-
/** `V4` or `V6`, the suffix of a chain rendered for one family. */
|
|
23
|
-
export declare const familySuffix: (family: Family) => string;
|
|
24
|
-
/** Each port or range of ports as the platform writes it: `53`, `0-52`. */
|
|
25
|
-
export declare const eachPort: (ports: Ports) => string[];
|
|
26
|
-
/** One port, a range, or a list of them, as `53,0-52`. */
|
|
27
|
-
export declare function portList(ports: Ports | undefined): string | undefined;
|
|
28
|
-
/** Seconds as the platform writes a duration: `3600` becomes `1h`, `90` becomes `1m30s`. */
|
|
29
|
-
export declare function duration(seconds: number): string;
|
|
30
|
-
/** A rate as the switch chip takes it: `2G` becomes `2.0Gbps`. */
|
|
31
|
-
export declare function bitrate(rate: string): string;
|
|
32
|
-
/** 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`. */
|
|
33
|
-
export declare function dottedMask(cidr: string): string;
|
|
34
|
-
/** A community pattern with `*` as a regular expression the platform matches on: `64500:*:*` becomes `^64500:[0-9]+:[0-9]+$`. */
|
|
35
|
-
export declare function communityPattern(pattern: string): string;
|
|
36
|
-
/** The bridge every switched port joins. One per device. */
|
|
37
|
-
export declare const BRIDGE = "bridge";
|
|
38
|
-
export type AnyPort = Port<string, string, string, string>;
|
|
39
|
-
export type AnyInterface = Interface<string, string>;
|
|
40
|
-
export declare class Context {
|
|
41
|
-
readonly device: Device;
|
|
42
|
-
readonly ports: Record<string, AnyPort>;
|
|
43
|
-
readonly interfaces: Record<string, AnyInterface>;
|
|
44
|
-
constructor(device: Device);
|
|
45
|
-
/** What the platform calls a port or an interface. A port is spelled by the model; an interface keeps its config name. */
|
|
46
|
-
name(portOrInterface: string): string;
|
|
47
|
-
/** The number of a VLAN, by its config name. */
|
|
48
|
-
vlanId(vlan: string): number;
|
|
49
|
-
/** Ports and LAGs that are layer 2 members of a VLAN, with their settings. A port in a LAG is represented by the LAG. */
|
|
50
|
-
switched(): [string, AnyPort | Extract<AnyInterface, {
|
|
51
|
-
type: "lag";
|
|
52
|
-
}>][];
|
|
53
|
-
/** VLAN interfaces, with their settings. */
|
|
54
|
-
vlanInterfaces(): [string, Extract<AnyInterface, {
|
|
55
|
-
type: "vlan";
|
|
56
|
-
}>][];
|
|
57
|
-
/** Every port and interface that holds addresses or other layer 3 settings. Ports are named as the platform spells them. */
|
|
58
|
-
routed(): {
|
|
59
|
-
name: string;
|
|
60
|
-
settings: AnyPort | AnyInterface;
|
|
61
|
-
}[];
|
|
62
|
-
}
|
|
63
|
-
export declare function renderInterfaces(out: Output, ctx: Context): void;
|
|
64
|
-
type Speed = NonNullable<AnyPort["speed"]>;
|
|
65
|
-
/** The platform's name for a fixed speed on a port, or undefined when it has none. */
|
|
66
|
-
export declare function mediumOf(platformPortName: string, speed: Speed): string | undefined;
|
|
67
|
-
/** The name of the VLAN interface under one with a MAC of its own, which takes the configured name itself. */
|
|
68
|
-
export declare const underMacvlan: (name: string) => string;
|
|
69
|
-
/** The interface holding one VRRP group. */
|
|
70
|
-
export declare const vrrpName: (iface: string, id: number) => string;
|
|
71
|
-
/**
|
|
72
|
-
* Where LLDP runs, when it is limited to some ports. Undefined when it runs everywhere or nowhere, which the discovery settings say directly.
|
|
73
|
-
*/
|
|
74
|
-
export declare function lldpMembers(ctx: Context): string[] | undefined;
|
|
75
|
-
/** Address lists holding the prefixes BGP originates. A session reads the one of its family. */
|
|
76
|
-
export declare const NETWORKS: Record<Family, string>;
|
|
77
|
-
export declare function renderAddressing(out: Output, ctx: Context): void;
|
|
78
|
-
export declare function renderFirewall(out: Output, ctx: Context): void;
|
|
79
|
-
/** The validator group every RPKI server joins. */
|
|
80
|
-
export declare const RPKI_GROUP = "rpki";
|
|
81
|
-
/** The chain a session without a policy uses, so that it learns or announces nothing. */
|
|
82
|
-
export declare const REJECT_ALL = "REJECT-ALL";
|
|
83
|
-
export declare function renderRouting(out: Output, ctx: Context): void;
|
|
84
|
-
/** Neutral service name to the platform's. `native` is the platform's own desktop client. */
|
|
85
|
-
export declare const SERVICES: {
|
|
86
|
-
readonly ftp: "ftp";
|
|
87
|
-
readonly ssh: "ssh";
|
|
88
|
-
readonly telnet: "telnet";
|
|
89
|
-
readonly http: "www";
|
|
90
|
-
readonly https: "www-ssl";
|
|
91
|
-
readonly api: "api";
|
|
92
|
-
readonly api_tls: "api-ssl";
|
|
93
|
-
readonly native: "winbox";
|
|
94
|
-
};
|
|
95
|
-
export declare function renderManagement(out: Output, ctx: Context): void;
|
|
96
|
-
/** SHA-256 of the certificate's DER encoding, lowercase hex, as the platform prints it. */
|
|
97
|
-
export declare function fingerprint(pem: string): string;
|
|
98
|
-
export declare function renderSystem(out: Output, ctx: Context): void;
|
|
99
|
-
export declare function render(device: Device): string;
|
|
100
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Device, Family } from "../../schema";
|
|
2
|
-
/** One part of a plan: what a reviewer reads, and what is sent. */
|
|
3
|
-
export type Step = {
|
|
4
|
-
title: string;
|
|
5
|
-
show: string[];
|
|
6
|
-
send: string[];
|
|
7
|
-
};
|
|
8
|
-
/** The commands that turn what a device runs into what its config says. `problems` blocks an apply: something the adapter cannot converge. */
|
|
9
|
-
export type Plan = {
|
|
10
|
-
steps: Step[];
|
|
11
|
-
problems: string[];
|
|
12
|
-
};
|
|
13
|
-
export type ApplyOptions = {
|
|
14
|
-
/** 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. */
|
|
15
|
-
secrets: boolean;
|
|
16
|
-
/** Minutes before a platform that can restore itself does so, if the run does not prove access survived. */
|
|
17
|
-
rollback: number;
|
|
18
|
-
/** Reach the device through its serial console, `connection.console`, instead of SSH to its management address. */
|
|
19
|
-
console?: boolean;
|
|
20
|
-
};
|
|
21
|
-
/** How a device is read. */
|
|
22
|
-
export type ReadOptions = Pick<ApplyOptions, "console">;
|
|
23
|
-
export type DeviceAdapter = {
|
|
24
|
-
/** File extension of a saved snapshot, for syntax highlighting. */
|
|
25
|
-
extension: string;
|
|
26
|
-
/** Fields this platform cannot express. Validation fails on any of them, so nothing is skipped silently. */
|
|
27
|
-
unsupported(device: Device): string[];
|
|
28
|
-
/** The platform can be read and applied through a serial console, `--console`. */
|
|
29
|
-
console?: true;
|
|
30
|
-
/** The whole configuration the device should run. Secrets appear as markers, never values. */
|
|
31
|
-
render(device: Device): string;
|
|
32
|
-
/** What the device runs now, secrets removed, in the form `render` produces where the platform allows. */
|
|
33
|
-
read(device: Device, network: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
34
|
-
/** What it takes to go from `current` to `desired`. */
|
|
35
|
-
plan(desired: string, current: string, options: ApplyOptions): Plan;
|
|
36
|
-
/** Replace the contents of a prefix set fetched from a registry. Absent on a platform that cannot hold one. */
|
|
37
|
-
fill?(device: Device, network: readonly Device[], set: string, family: Family, prefixes: string[]): Promise<void>;
|
|
38
|
-
/** Send a plan, keeping the device reachable or restoring it. */
|
|
39
|
-
apply(device: Device, network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
|
|
40
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Client, ClientChannel } from "ssh2";
|
|
2
|
-
import type { Device } from "../../../schema";
|
|
3
|
-
import { type ConsoleDialect } from "../../../transport/console";
|
|
4
|
-
import { type Dialect } from "../lines";
|
|
5
|
-
import type { ApplyOptions, DeviceAdapter, Plan, ReadOptions } from "../types";
|
|
6
|
-
export declare const dialect: Dialect;
|
|
7
|
-
/** The ACL that guards every management service. */
|
|
8
|
-
export declare const MANAGEMENT_ACL = 2000;
|
|
9
|
-
/** `99 999 to 1000 2000`, the platform's compression of a VLAN list. */
|
|
10
|
-
/** The VLAN IDs of a `vlan batch` line: `vlan batch 10 20 to 30`. */
|
|
11
|
-
export declare function batchIds(line: string): number[];
|
|
12
|
-
export declare function vlanBatch(ids: number[]): string;
|
|
13
|
-
export declare function render(device: Device): string;
|
|
14
|
-
export declare function login(device: Device): Promise<Client>;
|
|
15
|
-
/**
|
|
16
|
-
* An interactive shell at the user prompt, paging off.
|
|
17
|
-
*
|
|
18
|
-
* 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.
|
|
19
|
-
*/
|
|
20
|
-
export declare function openShell(client: Client): Promise<ClientChannel>;
|
|
21
|
-
/** 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. */
|
|
22
|
-
export declare const VRP_CONSOLE: ConsoleDialect;
|
|
23
|
-
/** What the device runs, credentials scrubbed. */
|
|
24
|
-
export declare function read(device: Device, _network?: readonly Device[], options?: ReadOptions): Promise<string>;
|
|
25
|
-
export declare function unsupported(device: Device): string[];
|
|
26
|
-
export declare function apply(device: Device, _network: readonly Device[], plan: Plan, options: ApplyOptions): Promise<void>;
|
|
27
|
-
export declare const vrp: DeviceAdapter;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Network } from "../../core/define";
|
|
2
|
-
import type { Device } from "../../schema";
|
|
3
|
-
/** What `librenms` would do. */
|
|
4
|
-
export type LibreNmsPlan = {
|
|
5
|
-
/** Devices to add. */
|
|
6
|
-
additions: Device[];
|
|
7
|
-
/** Devices that cannot be added: their config turns SNMP off. */
|
|
8
|
-
withoutSnmp: Device[];
|
|
9
|
-
/** Hostnames LibreNMS holds that no device in the config has. */
|
|
10
|
-
unknown: string[];
|
|
11
|
-
};
|
|
12
|
-
/** Compare the config with what LibreNMS monitors. A device is known to LibreNMS by its management address. */
|
|
13
|
-
export declare function planLibreNms(network: Network): Promise<LibreNmsPlan>;
|
|
14
|
-
/** Add each device, named after its `name` and polled with the credentials from its config. */
|
|
15
|
-
export declare function sendLibreNms(network: Network, additions: readonly Device[]): Promise<void>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Network } from "../../core/define";
|
|
2
|
-
/** A change to send. `id` is set when the record exists and is updated in place. */
|
|
3
|
-
export type PeeringDbChange = {
|
|
4
|
-
summary: string;
|
|
5
|
-
id?: number;
|
|
6
|
-
body: Record<string, unknown>;
|
|
7
|
-
};
|
|
8
|
-
export type PeeringDbPlan = {
|
|
9
|
-
changes: PeeringDbChange[];
|
|
10
|
-
/** Records PeeringDB holds that the config does not. */
|
|
11
|
-
unknown: string[];
|
|
12
|
-
};
|
|
13
|
-
/** What would change at PeeringDB. Reads the public API; needs no key. */
|
|
14
|
-
export declare function planPeeringDb(network: Network): Promise<PeeringDbPlan>;
|
|
15
|
-
/** Send the changes, with the network's API key. */
|
|
16
|
-
export declare function sendPeeringDb(network: Network, changes: PeeringDbChange[]): Promise<void>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Network } from "../../core/define";
|
|
2
|
-
import type { Device } from "../../schema";
|
|
3
|
-
export type PrometheusTarget = {
|
|
4
|
-
targets: string[];
|
|
5
|
-
labels: Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
/** The targets, and the devices left out because their config turns SNMP off. */
|
|
8
|
-
export declare function prometheusTargets(network: Network): {
|
|
9
|
-
targets: PrometheusTarget[];
|
|
10
|
-
withoutSnmp: Device[];
|
|
11
|
-
};
|
|
12
|
-
/** The `auths` section, as YAML, and what the operator must still fill in by hand. */
|
|
13
|
-
export declare function snmpExporterAuths(network: Network): {
|
|
14
|
-
yaml: string;
|
|
15
|
-
notes: string[];
|
|
16
|
-
};
|