pmcf 2.27.0 → 2.28.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/bin/pmcf-diagram +12 -15
- package/package.json +1 -1
- package/src/cluster.mjs +0 -1
- package/src/owner.mjs +5 -0
- package/types/owner.d.mts +1 -0
package/bin/pmcf-diagram
CHANGED
|
@@ -9,38 +9,27 @@ const location = await root.load(args[0]);
|
|
|
9
9
|
function q(str) {
|
|
10
10
|
return str.match(/^\w+$/) ? str : `"${str}"`;
|
|
11
11
|
}
|
|
12
|
-
function id(str) {
|
|
13
|
-
return q(str.replaceAll(/-/g, ""));
|
|
14
|
-
}
|
|
15
12
|
|
|
16
13
|
console.log("graph G {");
|
|
17
14
|
console.log(" node [shape=record];");
|
|
18
15
|
for await (const host of location.hosts()) {
|
|
19
16
|
console.log(
|
|
20
|
-
` ${
|
|
17
|
+
` ${q(host.name)} [label="${host.name}|{${[
|
|
21
18
|
...host.networkInterfaces.values()
|
|
22
19
|
]
|
|
23
20
|
.filter(ni => !ni.isTemplate && ni.kind !== "loopback")
|
|
24
|
-
.map(ni => `<${
|
|
21
|
+
.map(ni => `<${q(ni.name)}> ${ni.name}`)
|
|
25
22
|
.join("|")}}"];`
|
|
26
23
|
);
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
for await (const network of location.networks()) {
|
|
30
27
|
console.log(
|
|
31
|
-
` ${
|
|
28
|
+
` ${q(network.name)} [label="${network.name}\\n${[...network.subnets()]
|
|
32
29
|
.map(s => s.address)
|
|
33
30
|
.join(" ")}" shape=circle];`
|
|
34
31
|
);
|
|
35
32
|
|
|
36
|
-
if (network.bridge) {
|
|
37
|
-
for (const n of network.bridge) {
|
|
38
|
-
if (n !== network) {
|
|
39
|
-
console.log(` ${id(network.name)} -- ${id(n.name)};`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
33
|
for await (const na of network.networkAddresses(
|
|
45
34
|
na =>
|
|
46
35
|
na.networkInterface.network === network &&
|
|
@@ -48,11 +37,19 @@ for await (const network of location.networks()) {
|
|
|
48
37
|
na.networkInterface.kind !== "loopback"
|
|
49
38
|
)) {
|
|
50
39
|
console.log(
|
|
51
|
-
` ${
|
|
40
|
+
` ${q(network.name)} -- ${q(na.networkInterface.host.name)}:${q(
|
|
52
41
|
na.networkInterface.name
|
|
53
42
|
)}[label="${na.address}"];`
|
|
54
43
|
);
|
|
55
44
|
}
|
|
56
45
|
}
|
|
57
46
|
|
|
47
|
+
for await (const cluster of location.clusters()) {
|
|
48
|
+
console.log(` ${[...cluster.members].map(b => `${q(b.host.name)}:${b.name}`).join(" -- ")};`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (const bridge of location.bridges) {
|
|
52
|
+
console.log(` ${[...bridge].map(b => q(b.name)).join(" -- ")};`);
|
|
53
|
+
}
|
|
54
|
+
|
|
58
55
|
console.log("}");
|
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { Owner } from "./owner.mjs";
|
|
|
4
4
|
import { Host } from "./host.mjs";
|
|
5
5
|
import { addType } from "./types.mjs";
|
|
6
6
|
import { writeLines } from "./utils.mjs";
|
|
7
|
-
import { cidrAddresses } from "./network-support.mjs";
|
|
8
7
|
|
|
9
8
|
const ClusterTypeDefinition = {
|
|
10
9
|
name: "cluster",
|
package/src/owner.mjs
CHANGED
package/types/owner.d.mts
CHANGED
|
@@ -152,6 +152,7 @@ export class Owner extends Base {
|
|
|
152
152
|
subnetForAddress(address: any): any;
|
|
153
153
|
clusterNamed(name: any): any;
|
|
154
154
|
clusters(): any;
|
|
155
|
+
get bridges(): Set<any>;
|
|
155
156
|
addBridge(network: any, destinationNetworks: any): any;
|
|
156
157
|
_resolveBridges(): void;
|
|
157
158
|
get derivedPackaging(): Set<any>;
|