@takodotid/circuit 0.18.2 → 0.18.4

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}
@@ -1086,7 +1087,6 @@ function normal(command) {
1086
1087
  return result;
1087
1088
  }
1088
1089
  var IDENTITY = {
1089
- "/interface wireguard peers": ["public-key"],
1090
1090
  "/interface list member": ["list", "interface"],
1091
1091
  "/ip firewall address-list": ["list", "address"],
1092
1092
  "/ipv6 firewall address-list": ["list", "address"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takodotid/circuit",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
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);
@@ -13,6 +13,8 @@ Behaviour that looks like something else. Each one has been hit on a real device
13
13
  - A session that never established is missing from `/routing bgp session print`; look at `/routing bgp connection print`.
14
14
  - `tcp-md5-key` set from the CLI has been seen discarded without an error, and a mismatch logs nothing. Confirm with `/tool sniffer quick port=179`.
15
15
  - Incoming GRE is subject to the input chain. Accept it before testing the tunnel.
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
+ - `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.
16
18
  - Switch-chip rules have no address lists and no connection state. A drop is an empty `new-dst-ports`.
17
19
  - 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.
18
20
  - 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.
@@ -254,7 +254,6 @@ export function normal(command: Command): Record<string, string> {
254
254
 
255
255
  /** Properties that tell two `add` entries of a menu apart. `name` where the menu is not listed. */
256
256
  const IDENTITY: Record<string, string[]> = {
257
- "/interface wireguard peers": ["public-key"],
258
257
  "/interface list member": ["list", "interface"],
259
258
  "/ip firewall address-list": ["list", "address"],
260
259
  "/ipv6 firewall address-list": ["list", "address"],