@takodotid/circuit 0.26.1 → 0.26.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/dist/cli/index.js
CHANGED
|
@@ -3384,11 +3384,14 @@ function servicesFilter(out, device, names) {
|
|
|
3384
3384
|
const [protocol, standardPort] = SERVICE_PORTS[service];
|
|
3385
3385
|
const port = management[service]?.port ?? standardPort;
|
|
3386
3386
|
const term = `${filter} term ${service}`;
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3387
|
+
const allowed = sources.filter(ofFamily);
|
|
3388
|
+
if (allowed.length) {
|
|
3389
|
+
for (const source of allowed)
|
|
3390
|
+
out.set(term, "from source-address", source);
|
|
3391
|
+
out.set(term, "from", protocolWord, protocol);
|
|
3392
|
+
out.set(term, "from destination-port", port);
|
|
3393
|
+
out.set(term, "then accept");
|
|
3394
|
+
}
|
|
3392
3395
|
const others = `${filter} term ${service}-others`;
|
|
3393
3396
|
out.set(others, "from", protocolWord, protocol);
|
|
3394
3397
|
out.set(others, "from destination-port", port);
|
|
@@ -4699,7 +4702,9 @@ var DEVICE_FACTS2 = [
|
|
|
4699
4702
|
"quit",
|
|
4700
4703
|
"config",
|
|
4701
4704
|
"exit",
|
|
4702
|
-
"portswitch"
|
|
4705
|
+
"portswitch",
|
|
4706
|
+
"speed auto",
|
|
4707
|
+
"duplex auto"
|
|
4703
4708
|
];
|
|
4704
4709
|
var OPPOSITES = [
|
|
4705
4710
|
[/^mode manual$/, "mode lacp"],
|
|
@@ -4708,9 +4713,10 @@ var OPPOSITES = [
|
|
|
4708
4713
|
[/^spanning-tree disable$/, "spanning-tree enable"],
|
|
4709
4714
|
[/^switchport mode trunk$/, "switchport mode access"],
|
|
4710
4715
|
[/^telnet-server disable$/, "telnet-server enable"],
|
|
4711
|
-
[/^shutdown$/, "no shutdown"]
|
|
4716
|
+
[/^shutdown$/, "no shutdown"],
|
|
4717
|
+
[/^storm-control mode pps$/, "storm-control mode kbps"]
|
|
4712
4718
|
];
|
|
4713
|
-
var UNDO_BY_KEYWORD = /^(description|switchport access vlan|switchport trunk native vlan|switchport trunk allowed vlan|storm-control broadcast|
|
|
4719
|
+
var UNDO_BY_KEYWORD = /^(description|switchport access vlan|switchport trunk native vlan|switchport trunk allowed vlan|storm-control broadcast|ip address|port-channel|ip ospf cost|ip ospf network)\b/;
|
|
4714
4720
|
function undo(line) {
|
|
4715
4721
|
for (const [pattern, opposite] of OPPOSITES)
|
|
4716
4722
|
if (pattern.test(line))
|
package/package.json
CHANGED
|
@@ -497,11 +497,15 @@ function servicesFilter(out: Statements, device: Device, names: Names): void {
|
|
|
497
497
|
const [protocol, standardPort] = SERVICE_PORTS[service];
|
|
498
498
|
const port = management[service]?.port ?? standardPort;
|
|
499
499
|
const term = `${filter} term ${service}`;
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
500
|
+
const allowed = sources.filter(ofFamily);
|
|
501
|
+
|
|
502
|
+
// A term without a source would accept every source, so a family no source is in gets only the discard.
|
|
503
|
+
if (allowed.length) {
|
|
504
|
+
for (const source of allowed) out.set(term, "from source-address", source);
|
|
505
|
+
out.set(term, "from", protocolWord, protocol);
|
|
506
|
+
out.set(term, "from destination-port", port);
|
|
507
|
+
out.set(term, "then accept");
|
|
508
|
+
}
|
|
505
509
|
|
|
506
510
|
const others = `${filter} term ${service}-others`;
|
|
507
511
|
out.set(others, "from", protocolWord, protocol);
|
|
@@ -9,6 +9,9 @@ Behaviour that looks like something else. Each one has been hit on a RAX721 runn
|
|
|
9
9
|
- An access-list cannot change while any service uses it: `ACL 1000 is in use`. Every service that uses it is unbound first and bound again after. `no ssh2 access-list` needs the list number.
|
|
10
10
|
- `portswitch`, `switchport trunk allowed vlan` and `switchport mode` ask for `y` and do nothing without it, except when they need no confirming: `switchport mode trunk` on a port leaving access mode answers `Set successfully` at once, and a `y` sent after it is refused, `Error input`.
|
|
11
11
|
- A VLAN is removed with `no vlan <id>`, not `no create vlan`.
|
|
12
|
+
- `no storm-control mode` is refused with `Error input`. The modes are `kbps`, the default, which prints nothing, and `pps`; leaving `pps` is setting `kbps`.
|
|
13
|
+
- A port's speed or duplex set to something else and back to auto prints `speed auto` and `duplex auto` from then on, though auto is the default. `no duplex auto` is refused with `Error input`.
|
|
14
|
+
- Tab after a word the CLI does not know answers `Error input`, as if the line were sent. Like `?`, it is not a safe way to explore.
|
|
12
15
|
- The factory account `raisecom` cannot be removed and its service type cannot change. Only its password is ours.
|
|
13
16
|
- Factory SNMP communities survive hardening, and `private` can write. The render removes both.
|
|
14
17
|
- Several commands are not the usual spelling: `terminal page-break disable`, `telnet-server disable`, `ip rarp server disable`.
|
|
@@ -27,6 +27,9 @@ const DEVICE_FACTS = [
|
|
|
27
27
|
"exit",
|
|
28
28
|
// Implied by any layer 2 setting on a port; the plan sends it where needed.
|
|
29
29
|
"portswitch",
|
|
30
|
+
// A port's speed or duplex set back to auto prints as the default it is, and `no duplex` is refused.
|
|
31
|
+
"speed auto",
|
|
32
|
+
"duplex auto",
|
|
30
33
|
];
|
|
31
34
|
|
|
32
35
|
/** Lines whose opposite is not `no` and the line. */
|
|
@@ -38,11 +41,13 @@ const OPPOSITES: [RegExp, string][] = [
|
|
|
38
41
|
[/^switchport mode trunk$/, "switchport mode access"],
|
|
39
42
|
[/^telnet-server disable$/, "telnet-server enable"],
|
|
40
43
|
[/^shutdown$/, "no shutdown"],
|
|
44
|
+
// The device refuses `no storm-control mode`; kbps is its default and prints nothing.
|
|
45
|
+
[/^storm-control mode pps$/, "storm-control mode kbps"],
|
|
41
46
|
];
|
|
42
47
|
|
|
43
48
|
/** Lines whose removal takes only their keyword, not their value. */
|
|
44
49
|
const UNDO_BY_KEYWORD =
|
|
45
|
-
/^(description|switchport access vlan|switchport trunk native vlan|switchport trunk allowed vlan|storm-control broadcast|
|
|
50
|
+
/^(description|switchport access vlan|switchport trunk native vlan|switchport trunk allowed vlan|storm-control broadcast|ip address|port-channel|ip ospf cost|ip ospf network)\b/;
|
|
46
51
|
|
|
47
52
|
function undo(line: string): string {
|
|
48
53
|
for (const [pattern, opposite] of OPPOSITES) if (pattern.test(line)) return opposite;
|