@takodotid/circuit 0.18.3 → 0.18.5

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
@@ -792,7 +792,8 @@ async function apply(device, _network, plan) {
792
792
  for (const step of plan.steps) {
793
793
  for (const line of step.send) {
794
794
  let answer = await send(channel, substitute(line), 20000, 2000);
795
- if (/[[(]y\/n[\])]|input 'y'/i.test(answer) || CONFIRM.test(line))
795
+ const asks = /[[(]y\/n[\])]|input 'y'/i.test(answer) || CONFIRM.test(line) && !/set successfully/i.test(answer);
796
+ if (asks)
796
797
  answer += await send(channel, "y", 1e4, 1000);
797
798
  if (REFUSED.test(answer))
798
799
  throw new Error(`${step.title}: ${line}
@@ -1206,7 +1207,8 @@ var DYNAMIC = new Set([
1206
1207
  "/ipv6 firewall mangle",
1207
1208
  "/ip firewall raw",
1208
1209
  "/ipv6 firewall raw",
1209
- "/ip dhcp-server lease"
1210
+ "/ip dhcp-server lease",
1211
+ "/interface bridge vlan"
1210
1212
  ]);
1211
1213
  var quote = (value) => `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\$/g, "\\$")}"`;
1212
1214
  var value = (raw) => /^[\w.:/@,!-]+$/.test(raw) ? raw : quote(raw);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takodotid/circuit",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "description": "Declarative, vendor-neutral network configuration: describe each device in TypeScript, and Circuit makes the device match. Alpha.",
5
5
  "keywords": [
6
6
  "network",
@@ -7,7 +7,7 @@ Behaviour that looks like something else. Each one has been hit on a RAX721 runn
7
7
  - `show running-config` stops about halfway with no error unless `terminal page-break disable` is sent first and the read waits several seconds of silence.
8
8
  - A `?` sent by a script is executed. Once it applied an address with a /8 mask.
9
9
  - An access-list cannot change while any service holds it: `ACL 1000 is in use`. Every holder is released first and bound again after. `no ssh2 access-list` needs the list number.
10
- - `portswitch`, `switchport trunk allowed vlan` and `switchport mode` ask for `y` and do nothing without it.
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
12
  - The factory account `raisecom` cannot be removed and its service type cannot change. Only its password is ours.
13
13
  - Factory SNMP communities survive hardening, and `private` can write. The render removes both.
@@ -479,7 +479,9 @@ export async function apply(device: Device, _network: readonly Device[], plan: P
479
479
  for (const step of plan.steps) {
480
480
  for (const line of step.send) {
481
481
  let answer = await send(channel, substitute(line), 20_000, 2000);
482
- if (/[[(]y\/n[\])]|input 'y'/i.test(answer) || CONFIRM.test(line)) answer += await send(channel, "y", 10_000, 1000);
482
+ // A confirming line asks for `y` unless the change needs no confirming, when the device sets it at once.
483
+ const asks = /[[(]y\/n[\])]|input 'y'/i.test(answer) || (CONFIRM.test(line) && !/set successfully/i.test(answer));
484
+ if (asks) answer += await send(channel, "y", 10_000, 1000);
483
485
  if (REFUSED.test(answer)) throw new Error(`${step.title}: ${line}\n device said: ${answer.trim().slice(0, 300)}`);
484
486
 
485
487
  const release = RELEASE.exec(line);
@@ -15,6 +15,7 @@ Behaviour that looks like something else. Each one has been hit on a real device
15
15
  - Incoming GRE is subject to the input chain. Accept it before testing the tunnel.
16
16
  - A WireGuard peer's name is unique on the device, and a new key under the same name is refused as a new peer, `entry with this name already exists`. The plan finds a peer by name, so a new key is a `set`.
17
17
  - `monitor-traffic` on a VLAN interface counts only what the CPU handles, and not consistently: during a flood a VLAN showed 14 Mbps leaving while its physical port sent 0.45 Mbps. Measure on the physical port, `/interface ethernet print stats`, which the switch chip counts.
18
+ - A VLAN interface on the bridge adds a dynamic bridge VLAN entry for its VLAN, "added by vlan on bridge", beside the static one. A selector by `vlan-ids` then finds both, and a `set` on the pair fails with `no such item`. Selectors on bridge VLANs skip dynamic entries.
18
19
  - Switch-chip rules have no address lists and no connection state. A drop is an empty `new-dst-ports`.
19
20
  - A switch-chip rule's `rate` did not limit traffic the CPU routes. On a CCR2216 on 7.23.5, under a 12 Gbps flood, a rule at `2G` and then at `100M` changed nothing that reached the CPU, while a drop with the same match left 3 Mbps. Drop what you can recognise instead of limiting it.
20
21
  - The switch chip reads a UDP fragment after the first as port 0. `src-port=0` drops the rest of a fragmented flood whose first fragments another rule dropped by port; without it they reach the CPU, which holds them waiting for a first fragment that never comes.
@@ -80,6 +80,7 @@ const DYNAMIC = new Set([
80
80
  "/ip firewall raw",
81
81
  "/ipv6 firewall raw",
82
82
  "/ip dhcp-server lease",
83
+ "/interface bridge vlan",
83
84
  ]);
84
85
 
85
86
  /** Quote a value for a command. */