@mark1russell7/harness 0.16.9 → 0.16.10

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.
@@ -0,0 +1,54 @@
1
+ import { Ut as Topology } from "./cell-CYOKWfwg.js";
2
+ /**
3
+ * A layer is a rung of the laboratory (`docs/S7.md`). E1 is containers on one kernel, and E2 is a
4
+ * cluster of containers on one kernel. A lab with `Topology.fabric` writes E3: routers in containers.
5
+ * A lab in a guest of QEMU writes E4 (`substrateHere`). The other layers do not have a runner at this
6
+ * time.
7
+ */
8
+ export declare const LAYERS: readonly ["E0", "E1", "E2", "E3", "E4", "E5", "E6"];
9
+ export type Layer = (typeof LAYERS)[number];
10
+ /** A layer state is the column "State" of the table of the layers in `docs/S7.md`, by its first word. */
11
+ export type LayerState = "today" | "new" | "later" | "waiting";
12
+ /**
13
+ * A limit is a resource that the load of a cell fills, with no fault. The five limits are the accept
14
+ * queue, the port range, the conntrack table, the memory of a cgroup and the egress queue of an
15
+ * interface. The name of a limit is the key of its law in `Prediction`.
16
+ */
17
+ export declare const LIMITS: readonly ["queue", "ports", "conntrack", "memory", "egress"];
18
+ export type Limit = (typeof LIMITS)[number];
19
+ /**
20
+ * The layer facts are one row of the table of the layers in `docs/S7.md`, and what the cells of the
21
+ * harness apply on the layer. A test holds each text equal to the table. A test of the cells holds
22
+ * `faults` and `limits` equal to the cells of each layer.
23
+ */
24
+ export interface LayerFacts {
25
+ /** This text is the column "What it is". */
26
+ readonly name: string;
27
+ /** This text is the column "What it proves". */
28
+ readonly proves: string;
29
+ /** These texts are the column "What it cannot prove", one for each thing. The list is empty for "Nothing that this plan covers". */
30
+ readonly cannot: readonly string[];
31
+ /** These names are the column "Tools". */
32
+ readonly tools: readonly string[];
33
+ readonly state: LayerState;
34
+ /**
35
+ * These names are the faults that the cells of the layer inject, each one time. A name is in the
36
+ * vocabulary of the lab of the layer. The cells of E1 and E3 name a `Fault` of the harness. The cells of
37
+ * E2 are in `@mark1russell7/kind`, and they name the kind of their trigger (`TriggerKind`). The two
38
+ * vocabularies share the names of the faults that they share, for example `blackhole` and `rst`.
39
+ */
40
+ readonly faults: readonly string[];
41
+ /** These limits are the resources that the load of the cells of the layer fills, in the order of `LIMITS`. */
42
+ readonly limits: readonly Limit[];
43
+ }
44
+ /** These are the facts of each layer. The texts come from the table of the layers in `docs/S7.md`. */
45
+ export declare const LAYER_FACTS: Readonly<Record<Layer, LayerFacts>>;
46
+ /** This function gives the layer of a lab of the harness from its topology: E3 with a fabric, E1 without one. */
47
+ export declare const layerOf: (topology: Topology | undefined) => Layer;
48
+ /**
49
+ * This function gives the limits that the prediction of a cell names, in the order of `LIMITS`. It reads
50
+ * a cell of the harness or of `@mark1russell7/kind`.
51
+ */
52
+ export declare const limitsOf: (cell: {
53
+ readonly prediction: object;
54
+ }) => readonly Limit[];
@@ -0,0 +1,159 @@
1
+ // src/layers.ts
2
+ /**
3
+ * A layer is a rung of the laboratory (`docs/S7.md`). E1 is containers on one kernel, and E2 is a
4
+ * cluster of containers on one kernel. A lab with `Topology.fabric` writes E3: routers in containers.
5
+ * A lab in a guest of QEMU writes E4 (`substrateHere`). The other layers do not have a runner at this
6
+ * time.
7
+ */
8
+ const LAYERS = [
9
+ "E0",
10
+ "E1",
11
+ "E2",
12
+ "E3",
13
+ "E4",
14
+ "E5",
15
+ "E6"
16
+ ];
17
+ /**
18
+ * A limit is a resource that the load of a cell fills, with no fault. The five limits are the accept
19
+ * queue, the port range, the conntrack table, the memory of a cgroup and the egress queue of an
20
+ * interface. The name of a limit is the key of its law in `Prediction`.
21
+ */
22
+ const LIMITS = [
23
+ "queue",
24
+ "ports",
25
+ "conntrack",
26
+ "memory",
27
+ "egress"
28
+ ];
29
+ /** These are the facts of each layer. The texts come from the table of the layers in `docs/S7.md`. */
30
+ const LAYER_FACTS = {
31
+ E0: {
32
+ name: "Code on a false clock",
33
+ proves: "The logic of a state machine and each order of its events",
34
+ cannot: ["Any real time"],
35
+ tools: ["algebra", "the service conformance kit"],
36
+ state: "today",
37
+ faults: [],
38
+ limits: []
39
+ },
40
+ E1: {
41
+ name: "Processes and containers on one kernel",
42
+ proves: "Linux TCP timers, stock servers and their clients, proxies, conntrack",
43
+ cannot: [
44
+ "A second kernel",
45
+ "A separate clock",
46
+ "A reboot",
47
+ "A loss of power"
48
+ ],
49
+ tools: ["The harness"],
50
+ state: "today",
51
+ faults: [
52
+ "blackhole",
53
+ "freeze-process",
54
+ "rst",
55
+ "stall",
56
+ "fin",
57
+ "unreachable",
58
+ "simplex",
59
+ "mtu-blackhole",
60
+ "netem",
61
+ "fin-ack",
62
+ "middlebox-forget",
63
+ "proxy-idle",
64
+ "toxic",
65
+ "server-close",
66
+ "partition",
67
+ "planned-failover",
68
+ "app-stall",
69
+ "step-down",
70
+ "drain",
71
+ "hop-event"
72
+ ],
73
+ limits: LIMITS
74
+ },
75
+ E2: {
76
+ name: "A cluster of containers on one kernel",
77
+ proves: "The control plane, Service rules, CNI and the lifecycle of a pod",
78
+ cannot: ["A kernel for each node", "A loss of a node with no signal"],
79
+ tools: ["kind", "k3d"],
80
+ state: "today",
81
+ faults: [
82
+ "pod-deletion",
83
+ "rolling-update",
84
+ "node-drain",
85
+ "scale-in",
86
+ "crash",
87
+ "liveness-restart",
88
+ "freeze-process",
89
+ "rst",
90
+ "blackhole",
91
+ "peer-gone-without-close",
92
+ "app-stall",
93
+ "rollout",
94
+ "cpu-throttle",
95
+ "authorization-policy",
96
+ "idle",
97
+ "ztunnel-restart",
98
+ "certificate-expiry",
99
+ "cannot-serve",
100
+ "zone-loss",
101
+ "latency",
102
+ "dns-blackhole"
103
+ ],
104
+ limits: []
105
+ },
106
+ E3: {
107
+ name: "A routed fabric of containers on one kernel",
108
+ proves: "Routing protocol timers, equal-cost paths, a change of route, sites with real delay",
109
+ cannot: ["The kernel or the forwarding hardware of a router"],
110
+ tools: ["containerlab with FRR"],
111
+ state: "new",
112
+ faults: [
113
+ "blackhole",
114
+ "stall",
115
+ "silence"
116
+ ],
117
+ limits: []
118
+ },
119
+ E4: {
120
+ name: "Virtual machines, each with its own kernel",
121
+ proves: "A chosen kernel and HZ, a clock for each node, a loss of power, a disk, a reboot",
122
+ cannot: ["A physical NIC", "Real zones"],
123
+ tools: ["QEMU", "k3s in a VM"],
124
+ state: "new",
125
+ faults: [],
126
+ limits: []
127
+ },
128
+ E5: {
129
+ name: "Images of vendor routers in virtual machines",
130
+ proves: "The defaults and the state machines of a vendor's control plane",
131
+ cannot: ["The forwarding chip of the router"],
132
+ tools: ["vrnetlab"],
133
+ state: "later",
134
+ faults: [],
135
+ limits: []
136
+ },
137
+ E6: {
138
+ name: "Real hardware and clouds",
139
+ proves: "A physical NIC, firmware, managed load balancers, real zones",
140
+ cannot: [],
141
+ tools: ["HW-1"],
142
+ state: "waiting",
143
+ faults: [],
144
+ limits: []
145
+ }
146
+ };
147
+ /** This function gives the layer of a lab of the harness from its topology: E3 with a fabric, E1 without one. */
148
+ const layerOf = (topology) => topology?.fabric === void 0 ? "E1" : "E3";
149
+ /**
150
+ * This function gives the limits that the prediction of a cell names, in the order of `LIMITS`. It reads
151
+ * a cell of the harness or of `@mark1russell7/kind`.
152
+ */
153
+ const limitsOf = (cell) => {
154
+ const laws = new Map(Object.entries(cell.prediction));
155
+ return LIMITS.filter((limit) => laws.get(limit) !== void 0);
156
+ };
157
+ export { LAYERS, LAYER_FACTS, LIMITS, layerOf, limitsOf };
158
+
159
+ //# sourceMappingURL=layers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layers.js","names":[],"sources":["../src/layers.ts"],"sourcesContent":["import type { Fault, Topology } from \"./cell.ts\";\n\n// This module imports no `node:` module, thus a page in a browser can read the layers (`@mark1russell7/harness/layers`).\n\n/**\n * A layer is a rung of the laboratory (`docs/S7.md`). E1 is containers on one kernel, and E2 is a\n * cluster of containers on one kernel. A lab with `Topology.fabric` writes E3: routers in containers.\n * A lab in a guest of QEMU writes E4 (`substrateHere`). The other layers do not have a runner at this\n * time.\n */\nexport const LAYERS = [\"E0\", \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\"] as const;\nexport type Layer = (typeof LAYERS)[number];\n\n/** A layer state is the column \"State\" of the table of the layers in `docs/S7.md`, by its first word. */\nexport type LayerState = \"today\" | \"new\" | \"later\" | \"waiting\";\n\n/**\n * A limit is a resource that the load of a cell fills, with no fault. The five limits are the accept\n * queue, the port range, the conntrack table, the memory of a cgroup and the egress queue of an\n * interface. The name of a limit is the key of its law in `Prediction`.\n */\nexport const LIMITS = [\"queue\", \"ports\", \"conntrack\", \"memory\", \"egress\"] as const;\nexport type Limit = (typeof LIMITS)[number];\n\n/**\n * The layer facts are one row of the table of the layers in `docs/S7.md`, and what the cells of the\n * harness apply on the layer. A test holds each text equal to the table. A test of the cells holds\n * `faults` and `limits` equal to the cells of each layer.\n */\nexport interface LayerFacts {\n /** This text is the column \"What it is\". */\n readonly name: string;\n /** This text is the column \"What it proves\". */\n readonly proves: string;\n /** These texts are the column \"What it cannot prove\", one for each thing. The list is empty for \"Nothing that this plan covers\". */\n readonly cannot: readonly string[];\n /** These names are the column \"Tools\". */\n readonly tools: readonly string[];\n readonly state: LayerState;\n /**\n * These names are the faults that the cells of the layer inject, each one time. A name is in the\n * vocabulary of the lab of the layer. The cells of E1 and E3 name a `Fault` of the harness. The cells of\n * E2 are in `@mark1russell7/kind`, and they name the kind of their trigger (`TriggerKind`). The two\n * vocabularies share the names of the faults that they share, for example `blackhole` and `rst`.\n */\n readonly faults: readonly string[];\n /** These limits are the resources that the load of the cells of the layer fills, in the order of `LIMITS`. */\n readonly limits: readonly Limit[];\n}\n\n/** These are the faults of a cell of one kernel: each fault of the harness except the silence of a fabric. */\nconst ONE_KERNEL: readonly Fault[] = [\n \"blackhole\",\n \"freeze-process\",\n \"rst\",\n \"stall\",\n \"fin\",\n \"unreachable\",\n \"simplex\",\n \"mtu-blackhole\",\n \"netem\",\n \"fin-ack\",\n \"middlebox-forget\",\n \"proxy-idle\",\n \"toxic\",\n \"server-close\",\n \"partition\",\n \"planned-failover\",\n \"app-stall\",\n \"step-down\",\n \"drain\",\n \"hop-event\",\n];\n\n/** These are the faults of a cell of kind: each kind of a trigger of `@mark1russell7/kind`, in the order of `TriggerKind`. */\nconst ON_KIND: readonly string[] = [\n \"pod-deletion\",\n \"rolling-update\",\n \"node-drain\",\n \"scale-in\",\n \"crash\",\n \"liveness-restart\",\n \"freeze-process\",\n \"rst\",\n \"blackhole\",\n \"peer-gone-without-close\",\n \"app-stall\",\n \"rollout\",\n \"cpu-throttle\",\n \"authorization-policy\",\n \"idle\",\n \"ztunnel-restart\",\n \"certificate-expiry\",\n \"cannot-serve\",\n \"zone-loss\",\n \"latency\",\n \"dns-blackhole\",\n];\n\n/** These are the facts of each layer. The texts come from the table of the layers in `docs/S7.md`. */\nexport const LAYER_FACTS: Readonly<Record<Layer, LayerFacts>> = {\n E0: {\n name: \"Code on a false clock\",\n proves: \"The logic of a state machine and each order of its events\",\n cannot: [\"Any real time\"],\n tools: [\"algebra\", \"the service conformance kit\"],\n state: \"today\",\n faults: [],\n limits: [],\n },\n E1: {\n name: \"Processes and containers on one kernel\",\n proves: \"Linux TCP timers, stock servers and their clients, proxies, conntrack\",\n cannot: [\"A second kernel\", \"A separate clock\", \"A reboot\", \"A loss of power\"],\n tools: [\"The harness\"],\n state: \"today\",\n faults: ONE_KERNEL,\n limits: LIMITS,\n },\n E2: {\n name: \"A cluster of containers on one kernel\",\n proves: \"The control plane, Service rules, CNI and the lifecycle of a pod\",\n cannot: [\"A kernel for each node\", \"A loss of a node with no signal\"],\n tools: [\"kind\", \"k3d\"],\n state: \"today\",\n faults: ON_KIND,\n limits: [],\n },\n E3: {\n name: \"A routed fabric of containers on one kernel\",\n proves: \"Routing protocol timers, equal-cost paths, a change of route, sites with real delay\",\n cannot: [\"The kernel or the forwarding hardware of a router\"],\n tools: [\"containerlab with FRR\"],\n state: \"new\",\n faults: [\"blackhole\", \"stall\", \"silence\"] satisfies readonly Fault[],\n limits: [],\n },\n E4: {\n name: \"Virtual machines, each with its own kernel\",\n proves: \"A chosen kernel and HZ, a clock for each node, a loss of power, a disk, a reboot\",\n cannot: [\"A physical NIC\", \"Real zones\"],\n tools: [\"QEMU\", \"k3s in a VM\"],\n state: \"new\",\n faults: [],\n limits: [],\n },\n E5: {\n name: \"Images of vendor routers in virtual machines\",\n proves: \"The defaults and the state machines of a vendor's control plane\",\n cannot: [\"The forwarding chip of the router\"],\n tools: [\"vrnetlab\"],\n state: \"later\",\n faults: [],\n limits: [],\n },\n E6: {\n name: \"Real hardware and clouds\",\n proves: \"A physical NIC, firmware, managed load balancers, real zones\",\n cannot: [],\n tools: [\"HW-1\"],\n state: \"waiting\",\n faults: [],\n limits: [],\n },\n};\n\n/** This function gives the layer of a lab of the harness from its topology: E3 with a fabric, E1 without one. */\nexport const layerOf = (topology: Topology | undefined): Layer => (topology?.fabric === undefined ? \"E1\" : \"E3\");\n\n/**\n * This function gives the limits that the prediction of a cell names, in the order of `LIMITS`. It reads\n * a cell of the harness or of `@mark1russell7/kind`.\n */\nexport const limitsOf = (cell: { readonly prediction: object }): readonly Limit[] => {\n const laws = new Map(Object.entries(cell.prediction));\n return LIMITS.filter((limit) => laws.get(limit) !== undefined);\n};\n"],"mappings":";;;;;;;AAUA,MAAa,SAAS;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;;;;;;AAW/D,MAAa,SAAS;CAAC;CAAS;CAAS;CAAa;CAAU;AAAQ;;AA+ExE,MAAa,cAAmD;CAC9D,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ,CAAC,eAAe;EACxB,OAAO,CAAC,WAAW,6BAA6B;EAChD,OAAO;EACP,QAAQ,CAAC;EACT,QAAQ,CAAC;CACX;CACA,IAAI;EACF,MAAM;EACN,QAAQ;EACR,QAAQ;GAAC;GAAmB;GAAoB;GAAY;EAAiB;EAC7E,OAAO,CAAC,aAAa;EACrB,OAAO;EACP,QAAQ;GAhEV;GACA;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://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/harness",
4
- "version": "0.16.9",
4
+ "version": "0.16.10",
5
5
  "description": "Network labs in Docker, declared as data. A cell builds a topology of networks, routers and proxies around a stock target. It injects a fault at layer 3 or 4 from a NET_ADMIN sidecar, measures the records of the kernel and judges a prediction. The faults are black holes, resets, ICMP unreachable, one-way and MTU drops, tc netem, the toxics of Toxiproxy and frozen processes. Its disk tier cuts the power of a program on LazyFS: the disk loses each write after the last fsync. Its memory tier sets the limits of the cgroup of a client, and judges its throttle above memory.high and the choice of the OOM killer. Its egress tier puts a netem or tbf qdisc on the interface of a client, and judges the departure of each datagram from the stamps of the kernel. Its replicated groups are Redis with Sentinels, MongoDB replica sets, PostgreSQL standbys, Kafka, RabbitMQ and BGP fabrics with BFD. A lab can also operate in a QEMU guest. Its first use is connection timers: keep-alive, TCP retransmission, heartbeats and reconnects.",
6
6
  "keywords": [
7
7
  "fault-injection",
@@ -48,6 +48,10 @@
48
48
  "types": "./build/schema.d.ts",
49
49
  "default": "./build/schema.js"
50
50
  },
51
+ "./layers": {
52
+ "types": "./build/layers.d.ts",
53
+ "default": "./build/layers.js"
54
+ },
51
55
  "./package.json": "./package.json"
52
56
  },
53
57
  "files": [