archsight 0.5.5 → 0.5.7
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.
- checksums.yaml +4 -4
- data/docs/archimate.md +4 -3
- data/docs/diagram.md +6 -2
- data/docs/icons.md +1 -0
- data/docs/index.md.erb +1 -0
- data/docs/modeling.md +71 -2
- data/lib/archsight/diagram/graph/attributes.rb +8 -6
- data/lib/archsight/diagram/graph/port.rb +3 -0
- data/lib/archsight/diagram/renderer/dataflow_renderer.rb +2 -1
- data/lib/archsight/diagram/renderer/edge_renderer.rb +4 -1
- data/lib/archsight/diagram/renderer/label_placer.rb +98 -22
- data/lib/archsight/diagram/renderer/node_renderer.rb +21 -7
- data/lib/archsight/diagram/resource_links.rb +18 -12
- data/lib/archsight/export/confluence/analysis_output.rb +12 -5
- data/lib/archsight/linter/structure.rb +17 -3
- data/lib/archsight/linter.rb +30 -4
- data/lib/archsight/pdf/embeds.rb +3 -2
- data/lib/archsight/pdf/typst/archsight.typ +4 -0
- data/lib/archsight/resources/base.rb +5 -0
- data/lib/archsight/resources/grouping.rb +80 -0
- data/lib/archsight/resources/technology_node.rb +17 -2
- data/lib/archsight/resources/technology_service.rb +6 -0
- data/lib/archsight/resources/technology_system_software.rb +5 -0
- data/lib/archsight/resources.rb +28 -0
- data/lib/archsight/summary/lens.rb +10 -0
- data/lib/archsight/template.rb +2 -2
- data/lib/archsight/version.rb +1 -1
- data/lib/archsight/web/application.rb +6 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2538e617e5c3ea62514b655e2ee12325ec43c534e68ee86e3c92126e69e33e93
|
|
4
|
+
data.tar.gz: 305cd2f0695a7f08119147853943adfabbacde94789614dc66aab447ca39a702
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc8c2c474235d33628fdb819ffc3f66dc91171b3bdabd06df91a07bb87336b3136da817aab5499c3920c65977c739293f807bdf2b0c4511ff7f31268bee48b80
|
|
7
|
+
data.tar.gz: 329910d151a0534977344dbec32f4d36532fbe56d001bdebd68c5552e187abc6b3e6f2a6afeeb9e9ad8316ce8b5e687da144dc2c78becb9426ed1176936bf6dd
|
data/docs/archimate.md
CHANGED
|
@@ -44,8 +44,8 @@ ArchiMate is an open and independent enterprise architecture modeling language d
|
|
|
44
44
|
| Relationship | Supported as |
|
|
45
45
|
|--------------|--------------|
|
|
46
46
|
| **Specialization** | `specializes` between technology elements of one kind (node, system software, service), see "Concept and Implementation" in the modeling guide |
|
|
47
|
-
| **Composition** | `composedOf` between nodes and between system software |
|
|
48
|
-
| **Aggregation** | `aggregates` between technology artifacts (an image contains packages), see "Deployment" in the modeling guide |
|
|
47
|
+
| **Composition** | `composedOf` between nodes and between system software; from a `Grouping` to resources of any kind |
|
|
48
|
+
| **Aggregation** | `aggregates` between technology artifacts (an image contains packages), see "Deployment" in the modeling guide; from a `Grouping` to resources of any kind |
|
|
49
49
|
| **Assignment** | `assignedTo` from a node or system software to the technology artifacts deployed on it |
|
|
50
50
|
|
|
51
51
|
### Relationship Connectors
|
|
@@ -198,7 +198,8 @@ call-offs, SLAs and amendments, `stipulates` the requirements and constraints it
|
|
|
198
198
|
| **Grouping** | Aggregates or composes concepts that belong together based on some common characteristic. |
|
|
199
199
|
| **Location** | A conceptual or physical place or position where concepts are located (structure elements) or performed (behavior elements). |
|
|
200
200
|
|
|
201
|
-
**Supported in archsight:** Location (`Location`)
|
|
201
|
+
**Supported in archsight:** Location (`Location`) and Grouping (`Grouping`) are modelled and shown under Other. A
|
|
202
|
+
grouping aggregates or composes resources of every kind, groupings included, see "Grouping" in the modeling guide.
|
|
202
203
|
|
|
203
204
|
## ArchiMate Layers
|
|
204
205
|
|
data/docs/diagram.md
CHANGED
|
@@ -149,8 +149,8 @@ hint for near misses), never silently ignored.
|
|
|
149
149
|
|---|---|---|
|
|
150
150
|
| `label` | everything | any text (see *Label text*) |
|
|
151
151
|
| `tint` | nodes, containers, edges | `gray`, `blue`, `indigo`, `purple`, `pink`, `red`, `orange`, `yellow`, `green`, `teal`, `cyan`, `brown` |
|
|
152
|
-
| `link` | nodes, containers | `http(s)://…`, `mailto:…` or a relative URL |
|
|
153
|
-
| `resource` | nodes, containers | a resource name (`Archsight:Web`) or `Kind/Name` (`ApplicationService/Archsight:Web`); see *Linking to resources* |
|
|
152
|
+
| `link` | nodes, containers, ports | `http(s)://…`, `mailto:…` or a relative URL |
|
|
153
|
+
| `resource` | nodes, containers, ports | a resource name (`Archsight:Web`) or `Kind/Name` (`ApplicationService/Archsight:Web`); see *Linking to resources* |
|
|
154
154
|
| `extend` | nodes, containers | `true`, `false`; containers also `height`, and `width` on a direct child of a `layer` |
|
|
155
155
|
| `width` | `text` | characters per line (positive integer); wraps the label |
|
|
156
156
|
| `anchor` | containers; leaves with `no-extend` | `top`, `bottom`, `left`, `right`, `center` |
|
|
@@ -244,6 +244,10 @@ mgr.sock -> logger
|
|
|
244
244
|
`bottom`, `left` or `right`, `at` is `left`, `center`, `right` (`top`,
|
|
245
245
|
`center`, `bottom` on a left/right side) or a percentage of the side
|
|
246
246
|
(`25%`), and `badge` names a badge (see below).
|
|
247
|
+
- `link` and `resource` make the tab and its label a link, like on a node
|
|
248
|
+
(`port "api" { label "https"; resource "ApplicationInterface/Web:API" }`);
|
|
249
|
+
an unresolved `resource` draws the tab dashed with a tooltip, and
|
|
250
|
+
`archsight lint` reports it as `leaf.port`.
|
|
247
251
|
- Without `side`, the port goes on the side facing what its edges connect
|
|
248
252
|
it to (`top` without edges). Without `at`, it slides along its side to
|
|
249
253
|
line up with what its edges connect it to (the mean of their centers),
|
data/docs/icons.md
CHANGED
|
@@ -40,6 +40,7 @@ Current icon assignments for each resource type:
|
|
|
40
40
|
| TechnologyDevice | `server` | <i class="iconoir-server"></i> |
|
|
41
41
|
| TechnologyFacility | `building` | <i class="iconoir-building"></i> |
|
|
42
42
|
| Location | `map-pin` | <i class="iconoir-map-pin"></i> |
|
|
43
|
+
| Grouping | `square-dashed` | <i class="iconoir-square-dashed"></i> |
|
|
43
44
|
| TechnologyNode | `server-connection` | <i class="iconoir-server-connection"></i> |
|
|
44
45
|
| StrategyCapability | `strategy` | <i class="iconoir-strategy"></i> |
|
|
45
46
|
| TechnologyArtifact | `puzzle` | <i class="iconoir-puzzle"></i> |
|
data/docs/index.md.erb
CHANGED
|
@@ -93,6 +93,7 @@ Resources representing technology infrastructure and artifacts.
|
|
|
93
93
|
### Other
|
|
94
94
|
|
|
95
95
|
- [ComplianceEvidence](/doc/resources/compliance_evidence) - Evidence for compliance requirements
|
|
96
|
+
- [Grouping](/doc/resources/grouping) - Domains, scopes and families of resources of any kind
|
|
96
97
|
- [Location](/doc/resources/location) - Countries, metros, regions and other places
|
|
97
98
|
- [View](/doc/resources/view) - Saved queries and custom views
|
|
98
99
|
|
data/docs/modeling.md
CHANGED
|
@@ -225,6 +225,8 @@ TechnologySystemSoftware, TechnologyService, TechnologyArtifact). The same princ
|
|
|
225
225
|
(`connects`), never on the device, because a network is `realizedBy` its switches and the reverse arrow would
|
|
226
226
|
close a cycle. A machine that reaches no network (air-gapped) has neither relation. Who uses it is the team or role
|
|
227
227
|
(`servedBy`), not a person; groups of machines are tags and the end of support is `lifecycle/endOfLifeAt`.
|
|
228
|
+
15. A virtual machine (`infrastructure/type: vm`) is `servedBy` the TechnologyService that hands out the VMs, which is
|
|
229
|
+
`suppliedBy` the hypervisor, which is `realizedBy` its hosts; see [Virtualization](#virtualization).
|
|
228
230
|
|
|
229
231
|
**Checked by `archsight lint`**
|
|
230
232
|
|
|
@@ -240,6 +242,7 @@ As above, these are **warnings** in the "Modeling warnings" section and never fa
|
|
|
240
242
|
| `TechnologyDevice 'Device:Switch01' is connectedTo itself` | 12 |
|
|
241
243
|
| `TechnologyDevice 'Device:Router01' is a router that realizes no TechnologyCommunicationNetwork` | 11 |
|
|
242
244
|
| `TechnologyDevice 'Device:a:server-3' is servedBy 'Kernel:Team', not by the team of its equipment ('Compute:Team')` | 13 |
|
|
245
|
+
| `TechnologyNode 'Node:Web:VMs' is a vm served by no technology service supplied by system software (its virtualization platform)` | 15 |
|
|
243
246
|
|
|
244
247
|
Nested facilities need no location of their own (the outermost facility has it), and TechnologyEquipment that is part of other
|
|
245
248
|
TechnologyEquipment, or composed of placed parts, needs no facility of its own. The same holds for a device inside a
|
|
@@ -736,6 +739,40 @@ favour of the relation, which the graph, views and analyses see; it still loads,
|
|
|
736
739
|
as a deprecation without failing. See
|
|
737
740
|
`examples/archsight/technology/payments-platform.yaml`.
|
|
738
741
|
|
|
742
|
+
### Virtualization
|
|
743
|
+
|
|
744
|
+
A virtual machine runs on a virtualization platform, reached through the service that hands out the VMs. Every step is
|
|
745
|
+
written on the upper element and points down, like every relation:
|
|
746
|
+
|
|
747
|
+
```
|
|
748
|
+
TechnologyNode (infrastructure/type: vm) the guests
|
|
749
|
+
↓ servedBy
|
|
750
|
+
TechnologyService "virtual machines"
|
|
751
|
+
↓ suppliedBy
|
|
752
|
+
TechnologySystemSoftware the hypervisor
|
|
753
|
+
↓ realizedBy
|
|
754
|
+
TechnologyNode (infrastructure/type: bare-metal) the hosts
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
| From | Verb | To |
|
|
758
|
+
|------|------|----|
|
|
759
|
+
| `TechnologyNode` (vm) | `servedBy` | `TechnologyService` (the service that provides the VM) |
|
|
760
|
+
| `TechnologyService` | `suppliedBy` | `TechnologySystemSoftware` (the hypervisor) |
|
|
761
|
+
| `TechnologySystemSoftware` | `realizedBy` | `TechnologyNode` (the hosts) |
|
|
762
|
+
|
|
763
|
+
- The service page lists the guests as incoming `servedBy`, the hosts' page the hypervisor as incoming `realizedBy`.
|
|
764
|
+
"What is affected if the hosts go away" is the impact analysis of the host node (incoming, depth 3).
|
|
765
|
+
- Not `composedOf`: the hosts' cluster consists of its hosts, not of the VMs that run on it. Not `realizedBy` between
|
|
766
|
+
the VM node and the host node either: realization goes across kinds (see [Concept and Implementation](#concept-and-implementation)).
|
|
767
|
+
- A VM virtualized on one machine (an isolated session of a hardened workstation) is `realizedBy` that
|
|
768
|
+
`TechnologyDevice` instead.
|
|
769
|
+
- Nested virtualization is the same chain again: the inner hypervisor is `realizedBy` the outer VM node.
|
|
770
|
+
|
|
771
|
+
`archsight lint` warns about a vm node that is neither `servedBy` a service with a `suppliedBy` nor `realizedBy` a
|
|
772
|
+
device. A chain that leads back to the VM is an error: through the chain alone (a hypervisor realized by its own
|
|
773
|
+
guest) it is a relation cycle, and mixed with `composedOf` or `aggregates` (a host cluster composed of a VM that runs
|
|
774
|
+
on it) it is a "cycle of virtualization and composition relations". See `examples/archsight/technology/platforms.yaml`.
|
|
775
|
+
|
|
739
776
|
### Concept and Implementation
|
|
740
777
|
|
|
741
778
|
One technology *concept* often has several *implementations*: a "regional cluster" is implemented by a hypervisor
|
|
@@ -936,9 +973,10 @@ How to model it:
|
|
|
936
973
|
- **Vulnerability scan.** One `MotivationAssessment` of type `vulnerability` per finding, `assesses` every node it was
|
|
937
974
|
found on, `influences` the loss events and risks it makes possible. Business impact follows from the model: the node
|
|
938
975
|
serves services, services serve processes.
|
|
939
|
-
- **
|
|
976
|
+
- **Risk domains.** Set `risk/domain` (and `risk/category`: hazard,
|
|
940
977
|
financial, operational, strategic, compliance, security) on events, assessments, drivers, requirements, controls and
|
|
941
|
-
assets, and query or build a `View` per domain to see its threats, risks, measures and assets together.
|
|
978
|
+
assets, and query or build a `View` per domain to see its threats, risks, measures and assets together. A `Grouping`
|
|
979
|
+
is only worth it when the domain itself has an owner, a description or members that share no annotation.
|
|
942
980
|
- **Policies.** The text of a policy is a `Page`; the structured statement (owner, validity, status, framework) is a
|
|
943
981
|
`MotivationPrinciple` that links to the page with `[[Page]]`.
|
|
944
982
|
- **Initial and residual risk.** Record both on the assessment (`risk/initial-*`, `risk/residual-*`) and the decision
|
|
@@ -975,6 +1013,37 @@ A ComplianceEvidence answers "how is the requirement met" in structured markdown
|
|
|
975
1013
|
`evidence/verification`, `evidence/gaps` and `evidence/sources`. Because they are separate annotations they can be
|
|
976
1014
|
queried, for example `ComplianceEvidence: evidence/gaps =~ "needs review"`.
|
|
977
1015
|
|
|
1016
|
+
### Grouping
|
|
1017
|
+
|
|
1018
|
+
A `Grouping` gathers resources that belong together by a criterion that is not a place: a domain, the scope of a
|
|
1019
|
+
programme or review, a product family that spans layers. It holds resources of every kind, other groupings included, so
|
|
1020
|
+
groups nest. The members are listed on the grouping only, one key per kind under one of two verbs:
|
|
1021
|
+
|
|
1022
|
+
| Verb | Means | Example |
|
|
1023
|
+
|------|-------|---------|
|
|
1024
|
+
| `aggregates` | the member belongs to the group and stands on its own; it can be in several groups | a shared service in two domains |
|
|
1025
|
+
| `composedOf` | the member is a part of this whole and of no other | the components that exist only for the domain |
|
|
1026
|
+
|
|
1027
|
+
```yaml
|
|
1028
|
+
kind: Grouping
|
|
1029
|
+
metadata:
|
|
1030
|
+
name: Domain:Payments
|
|
1031
|
+
spec:
|
|
1032
|
+
aggregates:
|
|
1033
|
+
strategyCapabilities: [Payment Processing]
|
|
1034
|
+
groupings: [Domain:Payments:Refunds]
|
|
1035
|
+
composedOf:
|
|
1036
|
+
applicationComponents: [Payments:API, CardVault:API]
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
A member's page lists its groups under Relations, and the MCP `summary` names them ("Groups" or "Part of"). Queries
|
|
1040
|
+
follow membership like any relation: `ApplicationComponent: <- Grouping` (in some group), `Grouping: -> "Payments:API"`.
|
|
1041
|
+
A grouping that contains itself through other groupings is a cycle that `archsight lint` reports.
|
|
1042
|
+
|
|
1043
|
+
Use a grouping when the set is a thing of its own (it has an owner, a description, a page). Resources that only share an
|
|
1044
|
+
attribute (a team, a tag, a risk domain) are found by a query or a `View`; a place is a `Location`; the wiki menu is a
|
|
1045
|
+
`PageMenu`.
|
|
1046
|
+
|
|
978
1047
|
### Derived References
|
|
979
1048
|
|
|
980
1049
|
Text and diagrams already say which resources they are about, so archsight turns that into relations instead of asking you
|
|
@@ -34,7 +34,7 @@ module Archsight
|
|
|
34
34
|
CONTAINER = (NODE + %w[gap padding ranks columns anchor]).freeze
|
|
35
35
|
EDGE = %w[label style relation tint line].freeze
|
|
36
36
|
DATAFLOW = %w[label color].freeze
|
|
37
|
-
PORT = %w[label side at badge].freeze
|
|
37
|
+
PORT = %w[label side at badge link resource].freeze
|
|
38
38
|
BADGE_DEFINITION = %w[label tint].freeze
|
|
39
39
|
LINE_DEFINITION = %w[label].freeze
|
|
40
40
|
|
|
@@ -102,6 +102,8 @@ module Archsight
|
|
|
102
102
|
when "label" then check_label!(value, where, ast_port.line)
|
|
103
103
|
when "side" then check_value!(key, value, PORT_SIDES, where, ast_port.line)
|
|
104
104
|
when "at" then check_port_at!(value, ast_port.attrs["side"], where, ast_port.line)
|
|
105
|
+
when "link" then check_link!(value, where, ast_port.line)
|
|
106
|
+
when "resource" then check_resource!(value, ast_port.attrs, where, ast_port.line)
|
|
105
107
|
end
|
|
106
108
|
end
|
|
107
109
|
end
|
|
@@ -181,7 +183,7 @@ module Archsight
|
|
|
181
183
|
when "gap", "padding" then check_format!(key, value, GAP_FORMAT, "a pixel count (40), a percentage (150%) or a signed one (+20%, -50%)", where, line)
|
|
182
184
|
when "width" then check_format!(key, value, WIDTH_FORMAT, "a positive number of characters per line", where, line)
|
|
183
185
|
when "link" then check_link!(value, where, line)
|
|
184
|
-
when "resource" then check_resource!(value, block, where, line)
|
|
186
|
+
when "resource" then check_resource!(value, block.attrs, where, line)
|
|
185
187
|
end
|
|
186
188
|
end
|
|
187
189
|
|
|
@@ -223,11 +225,11 @@ module Archsight
|
|
|
223
225
|
end
|
|
224
226
|
|
|
225
227
|
# Resolved against the resource database when rendering (see
|
|
226
|
-
# `ResourceLinks`), which turns it into the node's `link`, so it
|
|
227
|
-
# can't share
|
|
228
|
-
def check_resource!(value,
|
|
228
|
+
# `ResourceLinks`), which turns it into the node's/port's `link`, so it
|
|
229
|
+
# can't share one with an explicit one.
|
|
230
|
+
def check_resource!(value, attrs, where, line)
|
|
229
231
|
check_format!("resource", value, RESOURCE_FORMAT, "a resource name (Archsight:Web) or Kind/Name (ApplicationService/Archsight:Web)", where, line)
|
|
230
|
-
return unless
|
|
232
|
+
return unless attrs.key?("link")
|
|
231
233
|
|
|
232
234
|
raise GraphError, "#{where} (line #{line}) has both `link` and `resource`; a resource reference already provides the link"
|
|
233
235
|
end
|
|
@@ -10,6 +10,9 @@ module Archsight
|
|
|
10
10
|
def side = attrs["side"]
|
|
11
11
|
def at = attrs["at"]
|
|
12
12
|
def badge = attrs["badge"]
|
|
13
|
+
def link = attrs["link"]
|
|
14
|
+
# Why its `resource` reference couldn't be resolved (see `ResourceLinks`), like `Node#broken_link`.
|
|
15
|
+
def broken_link = attrs["broken"]
|
|
13
16
|
|
|
14
17
|
# `node.port`, as an edge names it
|
|
15
18
|
def ref = "#{node.id}.#{id}"
|
|
@@ -46,7 +46,8 @@ module Archsight
|
|
|
46
46
|
css_class: "asd-dataflow-line", id: @ids.part(df, "line"))
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
pt = @label_placer.place_label_along(points, df.label, font_size: @theme.edge_label_font_size
|
|
49
|
+
pt = @label_placer.place_label_along(points, df.label, font_size: @theme.edge_label_font_size,
|
|
50
|
+
arrow_end: MarkerDefs::DATAFLOW_MARKER_SIZE.to_f)
|
|
50
51
|
return unless pt
|
|
51
52
|
|
|
52
53
|
body.raw(@text_renderer.halo_text(pt[0], pt[1] - 6, df.label, font_size: @theme.edge_label_font_size,
|
|
@@ -33,7 +33,10 @@ module Archsight
|
|
|
33
33
|
@path_renderer.draw_hit_path(body, points, curve: curve, id: @ids.part(edge, "hit"))
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
arrow = MarkerDefs::MARKER_SIZE * EDGE_STROKE_WIDTH
|
|
37
|
+
pt = @label_placer.place_label_along(points, edge.label, font_size: @theme.edge_label_font_size,
|
|
38
|
+
arrow_start: edge.direction == :bidirectional ? arrow : 0.0,
|
|
39
|
+
arrow_end: edge.direction == :undirected ? 0.0 : arrow)
|
|
37
40
|
return unless pt
|
|
38
41
|
|
|
39
42
|
body.raw(@text_renderer.halo_text(pt[0], pt[1] - 6, edge.label, font_size: @theme.edge_label_font_size,
|
|
@@ -28,10 +28,23 @@ module Archsight
|
|
|
28
28
|
# or beside some other line.
|
|
29
29
|
LABEL_FRACTION_CANDIDATES = [0.35, 0.65, 0.5, 0.25, 0.75, 0.15, 0.85].freeze
|
|
30
30
|
|
|
31
|
-
# Below this total path length, biasing toward source/target
|
|
32
|
-
# landing the label on (or past) the node it's leaving/entering,
|
|
33
|
-
# only the
|
|
31
|
+
# Below this total path length, biasing far toward source/target
|
|
32
|
+
# risks landing the label on (or past) the node it's leaving/entering,
|
|
33
|
+
# so the midpoint comes first and only the moderate shifts follow --
|
|
34
|
+
# needed when the midpoint crowds an arrowhead (a short line's label
|
|
35
|
+
# box, which sits above its anchor, reaches the tip of an upward arrow).
|
|
34
36
|
MIN_LENGTH_FOR_LABEL_BIAS = 80.0
|
|
37
|
+
SHORT_LABEL_FRACTION_CANDIDATES = [0.5, 0.35, 0.65, 0.25, 0.75].freeze
|
|
38
|
+
|
|
39
|
+
# A label on its own line's arrowhead hides where the arrow points:
|
|
40
|
+
# as costly as covering a node. The arrowhead's box is grown by
|
|
41
|
+
# `ARROWHEAD_CLEARANCE` so the text's halo doesn't eat into the tip either.
|
|
42
|
+
ARROWHEAD_PENALTY = 1.0
|
|
43
|
+
ARROWHEAD_CLEARANCE = 2.0
|
|
44
|
+
# When no fixed position is clear, spots every `ARROWHEAD_SEARCH_STEP`
|
|
45
|
+
# px behind each arrowhead are tried, up to `ARROWHEAD_SEARCH_RANGE` px.
|
|
46
|
+
ARROWHEAD_SEARCH_STEP = 2.0
|
|
47
|
+
ARROWHEAD_SEARCH_RANGE = 120.0
|
|
35
48
|
|
|
36
49
|
# Same flat char-width heuristic style as `Layout::EDGE_LABEL_CHAR_WIDTH`,
|
|
37
50
|
# used here for a cheap label bounding-box estimate rather than real
|
|
@@ -127,29 +140,24 @@ module Archsight
|
|
|
127
140
|
# position along `points` with no overlaps, falling back to whichever
|
|
128
141
|
# candidate overlaps the least -- a label is always placed somewhere,
|
|
129
142
|
# never skipped, matching the previous fixed-midpoint behavior.
|
|
130
|
-
|
|
143
|
+
# `arrow_start`/`arrow_end` are the lengths of the arrowheads drawn at
|
|
144
|
+
# the line's ends (0 for none), which the label keeps clear of.
|
|
145
|
+
def place_label_along(points, label, font_size: 11, arrow_start: 0.0, arrow_end: 0.0)
|
|
131
146
|
return unless label
|
|
132
147
|
|
|
133
148
|
total = Geometry.path_length(points)
|
|
134
|
-
fractions = total < MIN_LENGTH_FOR_LABEL_BIAS ?
|
|
149
|
+
fractions = total < MIN_LENGTH_FOR_LABEL_BIAS ? SHORT_LABEL_FRACTION_CANDIDATES : LABEL_FRACTION_CANDIDATES
|
|
150
|
+
arrowheads = [arrowhead_rect(points[1], points[0], arrow_start), arrowhead_rect(points[-2], points[-1], arrow_end)].compact
|
|
135
151
|
|
|
136
|
-
candidates = fractions.map
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
candidates.each_with_index do |(pt, box), i|
|
|
146
|
-
score = (native_scores ? native_scores[i] : label_overlap_score(box)) + border_score(box) + path_scores[i] +
|
|
147
|
-
bend_score(box, points)
|
|
148
|
-
if score < best_score
|
|
149
|
-
best = pt
|
|
150
|
-
best_score = score
|
|
151
|
-
end
|
|
152
|
-
break if score.zero?
|
|
152
|
+
candidates = fractions.map { |f| candidate(Geometry.point_along(points, f), label, font_size) }
|
|
153
|
+
best, best_score = best_candidate(candidates, points, arrowheads)
|
|
154
|
+
if best_score.positive? && arrowheads.any?
|
|
155
|
+
# Every fixed position crowds something: try the spots right
|
|
156
|
+
# behind each arrowhead too (a short line has its room there).
|
|
157
|
+
ends = [(0.0 if arrow_start.positive?), (1.0 if arrow_end.positive?)].compact
|
|
158
|
+
clear = behind_arrowheads(points, total, ends, label, font_size)
|
|
159
|
+
extra, extra_score = best_candidate(clear, points, arrowheads) unless clear.empty?
|
|
160
|
+
best = extra if extra && extra_score < best_score
|
|
153
161
|
end
|
|
154
162
|
|
|
155
163
|
placed = LabelPlacer.label_bbox(best[0], best[1] - 6, label, font_size)
|
|
@@ -187,6 +195,74 @@ module Archsight
|
|
|
187
195
|
touched * CONTAINER_BORDER_PENALTY
|
|
188
196
|
end
|
|
189
197
|
|
|
198
|
+
# A candidate anchor `pt` with the box its label would take there.
|
|
199
|
+
def candidate(pt, label, font_size)
|
|
200
|
+
[pt, LabelPlacer.label_bbox(pt[0], pt[1] - 6, label, font_size)]
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# The first (in order) of `candidates` that overlaps nothing, or the
|
|
204
|
+
# one that overlaps least, with its score.
|
|
205
|
+
def best_candidate(candidates, points, arrowheads)
|
|
206
|
+
boxes = candidates.map(&:last)
|
|
207
|
+
native_scores = native_overlap_scores(boxes)
|
|
208
|
+
path_scores = path_scores(boxes, points)
|
|
209
|
+
|
|
210
|
+
best = nil
|
|
211
|
+
best_score = Float::INFINITY
|
|
212
|
+
candidates.each_with_index do |(pt, box), i|
|
|
213
|
+
score = (native_scores ? native_scores[i] : label_overlap_score(box)) + border_score(box) + path_scores[i] +
|
|
214
|
+
bend_score(box, points) + arrowhead_score(box, arrowheads)
|
|
215
|
+
if score < best_score
|
|
216
|
+
best = pt
|
|
217
|
+
best_score = score
|
|
218
|
+
end
|
|
219
|
+
break if score.zero?
|
|
220
|
+
end
|
|
221
|
+
[best, best_score]
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Spots stepping back from each end with an arrowhead (`ends`: 0.0
|
|
225
|
+
# start, 1.0 end), nearest first, up to `ARROWHEAD_SEARCH_RANGE` --
|
|
226
|
+
# scored like any candidate, so the first one clear of the arrowhead,
|
|
227
|
+
# the nodes and the other labels wins.
|
|
228
|
+
def behind_arrowheads(points, total, ends, label, font_size)
|
|
229
|
+
return [] unless total.positive?
|
|
230
|
+
|
|
231
|
+
range = [total, ARROWHEAD_SEARCH_RANGE].min
|
|
232
|
+
(0..(range / ARROWHEAD_SEARCH_STEP).floor).flat_map do |step|
|
|
233
|
+
ends.map do |end_fraction|
|
|
234
|
+
f = (end_fraction - (step * ARROWHEAD_SEARCH_STEP / total)).abs
|
|
235
|
+
candidate(Geometry.point_along(points, f), label, font_size)
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# The box around an arrowhead of `length` whose tip is `tip`, pointing
|
|
241
|
+
# away from `from` (the neighbouring point of the line), or nil for none.
|
|
242
|
+
def arrowhead_rect(from, tip, length)
|
|
243
|
+
return nil unless length.positive? && from && tip
|
|
244
|
+
|
|
245
|
+
dx = tip[0] - from[0]
|
|
246
|
+
dy = tip[1] - from[1]
|
|
247
|
+
norm = Math.hypot(dx, dy)
|
|
248
|
+
return nil if norm.zero?
|
|
249
|
+
|
|
250
|
+
ux = dx / norm
|
|
251
|
+
uy = dy / norm
|
|
252
|
+
base_x = tip[0] - (ux * length)
|
|
253
|
+
base_y = tip[1] - (uy * length)
|
|
254
|
+
half = length / 2.0
|
|
255
|
+
xs = [tip[0], base_x + (uy * half), base_x - (uy * half)]
|
|
256
|
+
ys = [tip[1], base_y - (ux * half), base_y + (ux * half)]
|
|
257
|
+
c = ARROWHEAD_CLEARANCE
|
|
258
|
+
{ left: xs.min - c, right: xs.max + c, top: ys.min - c, bottom: ys.max + c }
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# See `ARROWHEAD_PENALTY`.
|
|
262
|
+
def arrowhead_score(box, arrowheads)
|
|
263
|
+
arrowheads.count { |head| LabelPlacer.rects_intersect?(box, head) } * ARROWHEAD_PENALTY
|
|
264
|
+
end
|
|
265
|
+
|
|
190
266
|
# See `OWN_BEND_PENALTY`.
|
|
191
267
|
def bend_score(box, points)
|
|
192
268
|
return 0 if points.length < 3
|
|
@@ -122,16 +122,30 @@ module Archsight
|
|
|
122
122
|
next unless tab
|
|
123
123
|
|
|
124
124
|
name = "port-#{port.id.gsub(/[^A-Za-z0-9_-]/, "_")}"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
if port.broken_link
|
|
126
|
+
body.element("g", class: BROKEN_LINK_CLASS) do
|
|
127
|
+
body.raw(Markup.tag("title", escape(port.broken_link)))
|
|
128
|
+
render_port(body, node, port, tab, name, stroke_class)
|
|
129
|
+
end
|
|
130
|
+
else
|
|
131
|
+
render_port(body, node, port, tab, name, stroke_class)
|
|
132
|
+
end
|
|
132
133
|
end
|
|
133
134
|
end
|
|
134
135
|
|
|
136
|
+
# The tab, its label and badge; a `link` (or resolved `resource`) wraps the tab and the label.
|
|
137
|
+
def render_port(body, node, port, tab, name, stroke_class)
|
|
138
|
+
rect = Markup.new
|
|
139
|
+
rect.element("rect", id: @ids.part(node, name), x: fmt(tab.left), y: fmt(tab.top), width: fmt(tab.width), height: fmt(tab.height),
|
|
140
|
+
rx: 4, class: ["asd-port", stroke_class], "data-asd-port": port.id)
|
|
141
|
+
body.raw(@text_renderer.wrap_link(rect.to_s, port.link))
|
|
142
|
+
room = port.badge ? Layout::PortMetrics::BADGE_ROOM : 0.0
|
|
143
|
+
body.raw(@text_renderer.label_text(tab.x - (room / 2.0), tab.y, port.label, font_size: @port_metrics.font_size, link: port.link,
|
|
144
|
+
attrs: { id: @ids.part(node, "#{name}-label"), "data-asd-owner": @ids.id(node), "data-asd-line": port.line },
|
|
145
|
+
extra_class: "asd-port-text asd-run-code"))
|
|
146
|
+
badge_dot(body, tab.right - Layout::PortMetrics::PADDING_X - 1.0, tab.y, port.badge, id: @ids.part(node, "#{name}-badge")) if port.badge
|
|
147
|
+
end
|
|
148
|
+
|
|
135
149
|
def badge_dot(body, cx, cy, badge, id:)
|
|
136
150
|
definition = @graph&.badge_definition(badge)
|
|
137
151
|
tint = definition ? definition.tint : "gray"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Archsight
|
|
4
4
|
module Diagram
|
|
5
|
-
# Turns `resource "Archsight:Web"` node attributes into links, using a
|
|
5
|
+
# Turns `resource "Archsight:Web"` node and port attributes into links, using a
|
|
6
6
|
# resolver the caller supplies -- the diagram renderer itself knows
|
|
7
7
|
# nothing about the resource database.
|
|
8
8
|
#
|
|
@@ -22,19 +22,25 @@ module Archsight
|
|
|
22
22
|
return unless resolver
|
|
23
23
|
|
|
24
24
|
graph.nodes_by_id.each_value do |node|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
resolve(node.attrs, node.id, node.line, resolver, unresolved)
|
|
26
|
+
node.ports.each { |port| resolve(port.attrs, port.ref, port.line, resolver, unresolved) }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# `attrs` of a node or a port; `id` is how `unresolved` names it (`leaf.port` for a port).
|
|
31
|
+
def resolve(attrs, id, line, resolver, unresolved)
|
|
32
|
+
reference = attrs["resource"]
|
|
33
|
+
return unless reference
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
outcome = resolver.call(reference)
|
|
36
|
+
return if outcome.nil?
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
+
if outcome.is_a?(String)
|
|
39
|
+
attrs["link"] = outcome
|
|
40
|
+
else
|
|
41
|
+
reason = REASONS.fetch(outcome) { raise ArgumentError, "resolver returned #{outcome.inspect} for #{reference.inspect}" }
|
|
42
|
+
attrs["broken"] = "Resource #{reference} #{reason}"
|
|
43
|
+
unresolved&.push({ node: id, reference: reference, reason: reason, line: line })
|
|
38
44
|
end
|
|
39
45
|
end
|
|
40
46
|
end
|
|
@@ -25,15 +25,22 @@ module Archsight
|
|
|
25
25
|
|
|
26
26
|
# @return [String] block XML
|
|
27
27
|
def xml(name, result)
|
|
28
|
-
out =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
out = +""
|
|
29
|
+
if result.success?
|
|
30
|
+
result.sections.each { |section| out << section_xml(section).to_s }
|
|
31
|
+
else
|
|
32
|
+
out << %(<p><em>The analysis failed: #{h(result.error)}</em></p>\n)
|
|
33
|
+
end
|
|
34
|
+
out << source_note(name)
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
private
|
|
36
38
|
|
|
39
|
+
# Where the content comes from, not a part of it: small, gray, at the right below the result
|
|
40
|
+
def source_note(name)
|
|
41
|
+
%(<p style="text-align: right;"><small><span style="color: rgb(151,160,175);">#{h(name)} (result at the export)</span></small></p>\n)
|
|
42
|
+
end
|
|
43
|
+
|
|
37
44
|
def section_xml(section)
|
|
38
45
|
case section[:type]
|
|
39
46
|
when :heading then heading(section)
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Archsight
|
|
4
4
|
class Linter
|
|
5
|
-
# Structural checks over the declared relations, the rules of "Choosing the Kind"
|
|
6
|
-
# Infrastructure" in the modeling guide. All findings are warnings: they point at modeling
|
|
7
|
-
# have legitimate exceptions (internal services, capabilities that no product carries yet).
|
|
5
|
+
# Structural checks over the declared relations, the rules of "Choosing the Kind", "Choosing the Kind:
|
|
6
|
+
# Infrastructure" and "Virtualization" in the modeling guide. All findings are warnings: they point at modeling
|
|
7
|
+
# decisions to review and have legitimate exceptions (internal services, capabilities that no product carries yet).
|
|
8
8
|
class Structure
|
|
9
9
|
# Network types that run over another network and need one that serves them
|
|
10
10
|
OVERLAY_TYPES = %w[overlay vpn].freeze
|
|
@@ -28,6 +28,7 @@ module Archsight
|
|
|
28
28
|
generated_component_in_several_repositories,
|
|
29
29
|
link_not_between_two_facilities,
|
|
30
30
|
overlay_without_underlay,
|
|
31
|
+
vm_without_platform,
|
|
31
32
|
facility_without_location,
|
|
32
33
|
equipment_without_facility,
|
|
33
34
|
device_without_facility,
|
|
@@ -164,6 +165,19 @@ module Archsight
|
|
|
164
165
|
end
|
|
165
166
|
end
|
|
166
167
|
|
|
168
|
+
# A virtual machine runs on a platform: it is servedBy a TechnologyService that is suppliedBy the hypervisor, or,
|
|
169
|
+
# virtualized on one machine (an isolated session of a workstation), realizedBy that TechnologyDevice. Fixed
|
|
170
|
+
# hops, no traversal.
|
|
171
|
+
def vm_without_platform
|
|
172
|
+
instances("TechnologyNode").filter_map do |node|
|
|
173
|
+
next unless node.annotations["infrastructure/type"] == "vm"
|
|
174
|
+
next if targets(node, :realizedBy, :technologyDevices).any?
|
|
175
|
+
next if targets(node, :servedBy, :technologyServices).any? { |service| targets(service, :suppliedBy, :technologyComponents).any? }
|
|
176
|
+
|
|
177
|
+
warning(node, "is a vm served by no technology service supplied by system software (its virtualization platform)")
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
167
181
|
# Only the outermost facility needs a location; nested halls inherit it from their campus
|
|
168
182
|
def facility_without_location
|
|
169
183
|
nested = owners_by_target("TechnologyFacility", :composedOf, :technologyFacilities)
|
data/lib/archsight/linter.rb
CHANGED
|
@@ -22,6 +22,17 @@ module Archsight
|
|
|
22
22
|
# general check above so that a cycle is reported once.
|
|
23
23
|
HIERARCHY_VERBS = %i[specializes composedOf aggregates refinedBy].freeze
|
|
24
24
|
|
|
25
|
+
# Where a virtual machine runs (see "Virtualization" in the modeling guide): the node is served by a service,
|
|
26
|
+
# the service is supplied by the hypervisor, the hypervisor is realized by its hosts. Together with the
|
|
27
|
+
# structure verbs below these may not lead back to where they started, a cycle neither check above sees
|
|
28
|
+
# because each leaves out the other's verbs: a platform would then consist of its own guest.
|
|
29
|
+
VIRTUALIZATION_CHAIN = {
|
|
30
|
+
"TechnologyNode" => %i[servedBy technologyServices],
|
|
31
|
+
"TechnologyService" => %i[suppliedBy technologyComponents],
|
|
32
|
+
"TechnologySystemSoftware" => %i[realizedBy technologyComponents]
|
|
33
|
+
}.freeze
|
|
34
|
+
VIRTUALIZATION_STRUCTURE_VERBS = %i[composedOf aggregates].freeze
|
|
35
|
+
|
|
25
36
|
def initialize(database)
|
|
26
37
|
@database = database
|
|
27
38
|
@errors = []
|
|
@@ -40,6 +51,7 @@ module Archsight
|
|
|
40
51
|
end
|
|
41
52
|
validate_relation_cycles
|
|
42
53
|
validate_hierarchy_cycles
|
|
54
|
+
validate_virtualization_cycles
|
|
43
55
|
validate_unique_annotations
|
|
44
56
|
|
|
45
57
|
@errors
|
|
@@ -200,24 +212,38 @@ module Archsight
|
|
|
200
212
|
end
|
|
201
213
|
end
|
|
202
214
|
|
|
215
|
+
# The virtualization chain mixed with composition/aggregation must not lead back to where it started. Only
|
|
216
|
+
# cycles that use both a chain and a structure relation are reported here; the others are reported above.
|
|
217
|
+
def validate_virtualization_cycles
|
|
218
|
+
graph = relation_graph do |verb, key, instance|
|
|
219
|
+
VIRTUALIZATION_STRUCTURE_VERBS.include?(verb) || VIRTUALIZATION_CHAIN[instance.klass] == [verb, key]
|
|
220
|
+
end
|
|
221
|
+
report_cycles(graph, only: ->(cycle) { cycle.map { |step| VIRTUALIZATION_STRUCTURE_VERBS.include?(step[:verb]) }.uniq.length == 2 }) do |start, path|
|
|
222
|
+
"#{start.path_ref}: #{start.klass} '#{start.name}' is part of a cycle of virtualization and composition relations, " \
|
|
223
|
+
"a platform would contain what runs on it (#{path})"
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
203
227
|
# Adds one error per group of instances that reach each other; the block builds the message from the first
|
|
204
|
-
# instance of the group and the path of one concrete cycle
|
|
205
|
-
def report_cycles(graph)
|
|
228
|
+
# instance of the group and the path of one concrete cycle; `only` skips groups whose cycle it rejects
|
|
229
|
+
def report_cycles(graph, only: nil)
|
|
206
230
|
strongly_connected_groups(graph).each do |group|
|
|
207
231
|
cycle = cycle_through(group.first, group, graph)
|
|
232
|
+
next if only && !only.call(cycle)
|
|
233
|
+
|
|
208
234
|
start = group.first
|
|
209
235
|
path = ([start.name] + cycle.map { |step| step[:to].name }).zip(cycle.map { |step| step[:verb] }).flat_map { |name, verb| [name, verb && "-#{verb}->"] }.compact
|
|
210
236
|
@errors << yield(start, path.join(" "))
|
|
211
237
|
end
|
|
212
238
|
end
|
|
213
239
|
|
|
214
|
-
# { instance => [{ verb:, to: }] } over the declared relations
|
|
240
|
+
# { instance => [{ verb:, to: }] } over the declared relations the block accepts (verb, key, instance)
|
|
215
241
|
def relation_graph
|
|
216
242
|
graph = {}
|
|
217
243
|
@database.instances.each_value do |instances_hash|
|
|
218
244
|
instances_hash.each_value do |instance|
|
|
219
245
|
graph[instance] = instance.class.declared_relations.flat_map do |verb, key, _kind|
|
|
220
|
-
next [] unless yield(verb)
|
|
246
|
+
next [] unless yield(verb, key, instance)
|
|
221
247
|
|
|
222
248
|
instance.relations(verb, key).map { |target| { verb: verb, to: target } }
|
|
223
249
|
end
|
data/lib/archsight/pdf/embeds.rb
CHANGED
|
@@ -111,10 +111,11 @@ module Archsight
|
|
|
111
111
|
@analyses += 1
|
|
112
112
|
result = self.class.result(@database, instance)
|
|
113
113
|
renderer = Archsight::Analysis::TypstRenderer.new([result], full: true)
|
|
114
|
-
parts = [
|
|
114
|
+
parts = []
|
|
115
115
|
parts << renderer.error(result) if result.failed?
|
|
116
116
|
parts.concat(result.sections.filter_map { |section| analysis_section(renderer, section) })
|
|
117
|
-
|
|
117
|
+
# the name is where the content comes from, not a part of it: a small gray note below
|
|
118
|
+
parts.join("\n\n") + "\n#source-note(theme: theme)[#{Typst.str(instance.name)}]"
|
|
118
119
|
end
|
|
119
120
|
|
|
120
121
|
def analysis_section(renderer, section)
|
|
@@ -133,6 +133,10 @@
|
|
|
133
133
|
if intro != none { block(above: 8pt, below: 6pt, text(size: 9pt, fill: theme.muted, intro)) }
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// Where embedded content comes from (e.g. the analysis name below its result): small, gray, at the right, close to the
|
|
137
|
+
// content it belongs to
|
|
138
|
+
#let source-note(theme: none, body) = block(above: 3pt, width: 100%, align(right, text(size: 7pt, fill: theme.muted.lighten(20%), body)))
|
|
139
|
+
|
|
136
140
|
// A cover page without header and footer: a band with the logo at its bottom left, kind, title and a short rule, the
|
|
137
141
|
// document meta at the bottom left of the page. The pages after it are numbered from 1.
|
|
138
142
|
#let cover-page(theme: none, title: "", kind: none, doc-id: none, version: none, date: none, owner: none, classification: none) = {
|
|
@@ -25,6 +25,11 @@ module Archsight
|
|
|
25
25
|
@declared_relations || []
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
# The relations the template of the kind (`archsight template`, the example of its docs page) shows
|
|
29
|
+
def self.template_relations
|
|
30
|
+
declared_relations
|
|
31
|
+
end
|
|
32
|
+
|
|
28
33
|
# Every relation a resource of this kind can have: the declared ones and the derived ones (`mentions`,
|
|
29
34
|
# `depicts`, see Archsight::References). Everything that follows relations (queries, graphs, impact analysis)
|
|
30
35
|
# uses this; what lets a user write or choose relations uses declared_relations.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Grouping gathers resources of any kind that belong together by some criterion
|
|
4
|
+
class Archsight::Resources::Grouping < Archsight::Resources::Base
|
|
5
|
+
include_annotations :git, :architecture
|
|
6
|
+
|
|
7
|
+
description <<~MD
|
|
8
|
+
Gathers resources of any kind, other groupings included, that belong together by some criterion.
|
|
9
|
+
|
|
10
|
+
## ArchiMate Definition
|
|
11
|
+
|
|
12
|
+
**Layer:** Other (ArchiMate: composite element)
|
|
13
|
+
**Aspect:** Composite
|
|
14
|
+
|
|
15
|
+
The grouping element aggregates or composes concepts that belong together based on some common
|
|
16
|
+
characteristic. Unlike a location, the criterion is not a place: a domain, a programme, a product family,
|
|
17
|
+
a migration scope, the subject of a review.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Use Grouping to represent:
|
|
22
|
+
|
|
23
|
+
- Domains and sub-domains (Payments, Identity)
|
|
24
|
+
- The scope of a programme, a review or an audit
|
|
25
|
+
- A product family that spans business, application and technology resources
|
|
26
|
+
|
|
27
|
+
## Members
|
|
28
|
+
|
|
29
|
+
A grouping lists its members in `spec`, one key per kind, under one of two verbs:
|
|
30
|
+
|
|
31
|
+
- `aggregates`: the member belongs to the group but also stands on its own; it can be in several groups
|
|
32
|
+
- `composedOf`: the member is a part of this whole and of no other
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
spec:
|
|
36
|
+
aggregates:
|
|
37
|
+
applicationComponents: [Payment Gateway]
|
|
38
|
+
businessProcesses: [Refund Handling]
|
|
39
|
+
groupings: [Card Payments]
|
|
40
|
+
composedOf:
|
|
41
|
+
dataObjects: [Payment]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
A grouping can contain groupings, so groups nest; a grouping that contains itself (directly or through
|
|
45
|
+
others) is reported by `archsight lint`. Members do not name their groups: a member's page lists the groups
|
|
46
|
+
it is in.
|
|
47
|
+
|
|
48
|
+
## Not this kind
|
|
49
|
+
|
|
50
|
+
- A place is a `Location`
|
|
51
|
+
- The menu of the wiki is a `PageMenu`
|
|
52
|
+
- Resources that only share an attribute (a team, a tag, a risk domain) need no grouping: a query or a view
|
|
53
|
+
finds them
|
|
54
|
+
MD
|
|
55
|
+
|
|
56
|
+
icon "square-dashed"
|
|
57
|
+
layer "other"
|
|
58
|
+
|
|
59
|
+
# The verbs a grouping holds its members with
|
|
60
|
+
MEMBER_VERBS = %i[aggregates composedOf].freeze
|
|
61
|
+
|
|
62
|
+
# The relations shown in the template of the kind; the declared ones cover every kind
|
|
63
|
+
TEMPLATE_KINDS = %w[ApplicationComponent BusinessProcess Grouping].freeze
|
|
64
|
+
|
|
65
|
+
class << self
|
|
66
|
+
# Declares MEMBER_VERBS towards every kind, this one included. Called once all kinds are loaded (see
|
|
67
|
+
# lib/archsight/resources.rb), since a class body only sees the kinds loaded before it.
|
|
68
|
+
def declare_members!
|
|
69
|
+
@declared_relations = []
|
|
70
|
+
@relations = nil
|
|
71
|
+
MEMBER_VERBS.each do |verb|
|
|
72
|
+
Archsight::Resources.each { |kind| relation verb, Archsight::Resources.relation_key(kind).to_sym, kind }
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def template_relations
|
|
77
|
+
declared_relations.select { |_, _, kind| TEMPLATE_KINDS.include?(kind) }
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# TechnologyNode represents physical infrastructure (VMs, servers, Kubernetes nodes)
|
|
3
|
+
# TechnologyNode represents physical and virtual infrastructure (VMs, servers, Kubernetes nodes)
|
|
4
4
|
class Archsight::Resources::TechnologyNode < Archsight::Resources::Base
|
|
5
5
|
include_annotations :git, :architecture, :asset, :risk, :capacity
|
|
6
6
|
|
|
7
7
|
description <<~MD
|
|
8
|
-
Represents physical infrastructure hosting application components.
|
|
8
|
+
Represents physical or virtual infrastructure hosting application components.
|
|
9
9
|
|
|
10
10
|
## ArchiMate Definition
|
|
11
11
|
|
|
@@ -54,6 +54,21 @@ class Archsight::Resources::TechnologyNode < Archsight::Resources::Base
|
|
|
54
54
|
A logical node (a host role, "the hypervisors of the platform") is `realizedBy` the `TechnologyDevice`s, the
|
|
55
55
|
physical machines, that make it up.
|
|
56
56
|
|
|
57
|
+
## Virtualization
|
|
58
|
+
|
|
59
|
+
A virtual machine (`infrastructure/type: vm`) runs on a virtualization platform, reached through the service that
|
|
60
|
+
hands out the VMs. Every step is written on the upper element and points down:
|
|
61
|
+
|
|
62
|
+
- the VM node is `servedBy` the `TechnologyService` that provides it ("virtual machines")
|
|
63
|
+
- the service is `suppliedBy` the hypervisor, a `TechnologySystemSoftware`
|
|
64
|
+
- the hypervisor is `realizedBy` the host nodes (`infrastructure/type: bare-metal`) it runs on
|
|
65
|
+
|
|
66
|
+
The service page lists its guests as incoming "servedBy"; impact analysis on the hosts (incoming, depth 3) reaches
|
|
67
|
+
them. A VM virtualized on one machine (an isolated session of a workstation) is `realizedBy` that
|
|
68
|
+
`TechnologyDevice` instead. Do not use `composedOf` for this: the hosts' cluster consists of its hosts, not of
|
|
69
|
+
the VMs that run on it. `archsight lint` warns about a vm with neither, and reports as an error a platform that
|
|
70
|
+
contains (`composedOf`, `aggregates`) a VM that runs on it. See "Virtualization" in the modeling guide.
|
|
71
|
+
|
|
57
72
|
## Spare hosts
|
|
58
73
|
|
|
59
74
|
A host role or pool keeps hosts in reserve (n+1). The reserve is a count, not a machine: any host can take the
|
|
@@ -50,6 +50,12 @@ class Archsight::Resources::TechnologyService < Archsight::Resources::Base
|
|
|
50
50
|
"servedBy" from ApplicationComponent on its page. An ApplicationService that is `servedBy` the service uses it as a
|
|
51
51
|
whole; list a cluster there only when the service's own components run in it.
|
|
52
52
|
|
|
53
|
+
## Virtualization
|
|
54
|
+
|
|
55
|
+
A service that hands out virtual machines is `suppliedBy` the hypervisor (`TechnologySystemSoftware`). The VM nodes
|
|
56
|
+
(`infrastructure/type: vm`) are `servedBy` it and listed as incoming "servedBy" from TechnologyNode on its page.
|
|
57
|
+
See `TechnologyNode`.
|
|
58
|
+
|
|
53
59
|
## Teams
|
|
54
60
|
|
|
55
61
|
A service is `maintainedBy` the team (`BusinessActor`) that builds and changes it and `operatedBy` the team
|
|
@@ -43,6 +43,11 @@ class Archsight::Resources::TechnologySystemSoftware < Archsight::Resources::Bas
|
|
|
43
43
|
System software `assignedTo` the artifacts it executes (ArchiMate assignment), written on the system software.
|
|
44
44
|
The artifact's page shows it as incoming "deployed on".
|
|
45
45
|
|
|
46
|
+
## Virtualization
|
|
47
|
+
|
|
48
|
+
A hypervisor is `realizedBy` the host nodes it runs on and supplies the `TechnologyService` that hands out the
|
|
49
|
+
virtual machines (the service is `suppliedBy` it). See `TechnologyNode`.
|
|
50
|
+
|
|
46
51
|
## Concept and implementation
|
|
47
52
|
|
|
48
53
|
System software can `specialize` other system software (ArchiMate specialization): the general one is the
|
data/lib/archsight/resources.rb
CHANGED
|
@@ -43,6 +43,31 @@ module Archsight
|
|
|
43
43
|
# The derived relations of every class, next to the ones it declares: [verb, key, kind]
|
|
44
44
|
DERIVED_RELATIONS = DERIVED_VERBS.map { |verb| [verb, DERIVED_KEY, "Resource"] }.freeze
|
|
45
45
|
|
|
46
|
+
# Relation keys that do not follow the rule of #relation_key (lowerCamel kind name, made plural): the keys the
|
|
47
|
+
# model has used for these kinds from the start
|
|
48
|
+
IRREGULAR_RELATION_KEYS = {
|
|
49
|
+
"Analysis" => "analyses",
|
|
50
|
+
"MotivationGoal" => "goals",
|
|
51
|
+
"MotivationOutcome" => "outcomes",
|
|
52
|
+
"Page" => "pages",
|
|
53
|
+
"PageMenu" => "menus",
|
|
54
|
+
"TechnologyEquipment" => "technologyEquipment",
|
|
55
|
+
"TechnologySystemSoftware" => "technologySystemSoftware"
|
|
56
|
+
}.freeze
|
|
57
|
+
|
|
58
|
+
# The key under `spec.<verb>` that holds resources of a kind (ApplicationComponent -> applicationComponents),
|
|
59
|
+
# for relations that are declared for many kinds at once (see Grouping)
|
|
60
|
+
def self.relation_key(kind_name)
|
|
61
|
+
name = kind_name.to_s
|
|
62
|
+
IRREGULAR_RELATION_KEYS.fetch(name) do
|
|
63
|
+
key = name[0].downcase + name[1..]
|
|
64
|
+
if key.end_with?("y") && !key.end_with?("ay", "ey", "oy", "uy") then "#{key.chop}ies"
|
|
65
|
+
elsif key.end_with?("s", "x", "ch", "sh") then "#{key}es"
|
|
66
|
+
else "#{key}s"
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
46
71
|
# The current name of a kind, whichever of its names is given
|
|
47
72
|
def self.canonical(klass_name)
|
|
48
73
|
name = klass_name.to_s
|
|
@@ -90,3 +115,6 @@ module Archsight::Annotations; end
|
|
|
90
115
|
Dir[File.join(__dir__, "annotations", "*.rb")].each { |file| require_relative file }
|
|
91
116
|
require_relative "resources/base"
|
|
92
117
|
Dir[File.join(__dir__, "resources", "*.rb")].each { |file| require_relative file }
|
|
118
|
+
|
|
119
|
+
# A Grouping holds resources of every kind, so its relations can only be declared once all kinds are known
|
|
120
|
+
Archsight::Resources::Grouping.declare_members!
|
|
@@ -40,6 +40,7 @@ module Archsight
|
|
|
40
40
|
in assesses, influences: Assessed and influenced by
|
|
41
41
|
out evidencedBy: Evidence
|
|
42
42
|
out ownedBy: Owners
|
|
43
|
+
in aggregates, composedOf: Groups
|
|
43
44
|
in mentions, depicts: Documented in
|
|
44
45
|
LENS
|
|
45
46
|
"strategy" => <<~LENS,
|
|
@@ -47,6 +48,7 @@ module Archsight
|
|
|
47
48
|
out servedBy: Served by
|
|
48
49
|
in hasConcern: Stakeholders
|
|
49
50
|
in realizes: Realized by
|
|
51
|
+
in aggregates, composedOf: Groups
|
|
50
52
|
in mentions, depicts: Documented in
|
|
51
53
|
LENS
|
|
52
54
|
"implementation" => <<~LENS,
|
|
@@ -59,6 +61,7 @@ module Archsight
|
|
|
59
61
|
out realizes: Realizes
|
|
60
62
|
in realizes: Realized by
|
|
61
63
|
out performedBy, ownedBy: People
|
|
64
|
+
in aggregates, composedOf: Groups
|
|
62
65
|
in mentions, depicts: Documented in
|
|
63
66
|
LENS
|
|
64
67
|
"business" => <<~LENS,
|
|
@@ -88,6 +91,7 @@ module Archsight
|
|
|
88
91
|
out evidencedBy: Evidence
|
|
89
92
|
in servedBy: Served
|
|
90
93
|
in exposes: Exposed by
|
|
94
|
+
in aggregates, composedOf: Groups
|
|
91
95
|
in mentions, depicts: Documented in
|
|
92
96
|
LENS
|
|
93
97
|
"technology" => <<~LENS,
|
|
@@ -111,6 +115,12 @@ module Archsight
|
|
|
111
115
|
|
|
112
116
|
# Kinds whose layer lens is too coarse; looked up before the lens of the layer
|
|
113
117
|
KIND_DEFAULTS = {
|
|
118
|
+
"Grouping" => <<~LENS,
|
|
119
|
+
out aggregates: Members
|
|
120
|
+
out composedOf: Composed of
|
|
121
|
+
in aggregates, composedOf: Part of
|
|
122
|
+
in mentions, depicts: Documented in
|
|
123
|
+
LENS
|
|
114
124
|
"BusinessActor" => <<~LENS,
|
|
115
125
|
in performedBy, executedBy: Performs
|
|
116
126
|
in ownedBy: Owns
|
data/lib/archsight/template.rb
CHANGED
|
@@ -35,10 +35,10 @@ module Archsight
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def add_relations(yaml, klass)
|
|
38
|
-
return if klass.
|
|
38
|
+
return if klass.template_relations.empty?
|
|
39
39
|
|
|
40
40
|
yaml["spec"] = {} if yaml["spec"].nil?
|
|
41
|
-
klass.
|
|
41
|
+
klass.template_relations.each do |verb, relation_kind, _relation_klass|
|
|
42
42
|
relation_verb = verb.to_s.delete_prefix(":")
|
|
43
43
|
yaml["spec"][relation_verb] ||= {}
|
|
44
44
|
yaml["spec"][relation_verb][relation_kind.to_s] = []
|
data/lib/archsight/version.rb
CHANGED
|
@@ -293,6 +293,12 @@ class Archsight::Web::Application < Sinatra::Base
|
|
|
293
293
|
serve_vue
|
|
294
294
|
end
|
|
295
295
|
|
|
296
|
+
# GET /error - the SPA's error page only lives inside the app (its error comes along in the URL
|
|
297
|
+
# from a failed reload and is stale on a fresh load), so a direct request goes home.
|
|
298
|
+
get "/error" do
|
|
299
|
+
redirect "/"
|
|
300
|
+
end
|
|
301
|
+
|
|
296
302
|
get "/dot" do
|
|
297
303
|
content_type "text/plain"
|
|
298
304
|
create_graph_all(db)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: archsight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vincent Landgraf
|
|
@@ -476,6 +476,7 @@ files:
|
|
|
476
476
|
- lib/archsight/resources/compliance_evidence.rb
|
|
477
477
|
- lib/archsight/resources/config.rb
|
|
478
478
|
- lib/archsight/resources/data_object.rb
|
|
479
|
+
- lib/archsight/resources/grouping.rb
|
|
479
480
|
- lib/archsight/resources/implementation_deliverable.rb
|
|
480
481
|
- lib/archsight/resources/implementation_event.rb
|
|
481
482
|
- lib/archsight/resources/implementation_gap.rb
|