Skip to content

Commit d6e8603

Browse files
Merge pull request #31 from diffo-dev/dev
dev
2 parents 3273a61 + 9dd33cc commit d6e8603

30 files changed

Lines changed: 387 additions & 486 deletions

CHANGELOG.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,14 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
1111

1212
<!-- changelog -->
1313

14-
## [v0.0.1](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.1) (2025-10-20)
15-
16-
### Features:
17-
* initial version
18-
19-
## [v0.0.2](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.2) (2025-12-01)
14+
## [v0.2.1](https://github.com/diffo-dev/diffo/compare/v0.2.0..v0.2.1) (2026-05-07)
2015

2116
### Maintenance:
22-
* updated to diffo 0.1.3
17+
* updated to diffo 0.2.1
2318

24-
## [v0.0.3](https://github.com/diffo-dev/diffo/compare/v0.0.2..v0.0.3) (2026-03-13)
25-
26-
### Maintenance:
27-
* updated to diffo 0.1.4, using ash_neo4j 0.2.13 using fork bolty 0.0.7 rather than boltx 0.0.6
28-
29-
## [v0.0.4](https://github.com/diffo-dev/diffo/compare/v0.0.3..v0.0.4) (2026-03-19)
30-
31-
### Fixes:
32-
* fixed relationship enrichment inconsistent across neo4j versions
19+
### Features:
20+
* using transactions and test sandbox
21+
* using improved provider DSL
3322

3423
## [v0.2.0](https://github.com/diffo-dev/diffo/compare/v0.0.4..v0.2.0) (2026-04-26)
3524

@@ -43,4 +32,25 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
4332
* RSP multi-tenancy: SetRspId change, OwnedByActor and NoActor policy checks, RspOwnership macro shared across RSP-owned resources
4433
* NTD and UNI modelled as NBN-owned infrastructure — readable by any RSP, mutable only by internal calls
4534
* Interactive NBN livebook with Kino RSP selector and actor-scoped provisioning flow
46-
* NBN domain documentation including Perentie ecosystem narrative
35+
* NBN domain documentation including Perentie ecosystem narrative
36+
37+
## [v0.0.4](https://github.com/diffo-dev/diffo/compare/v0.0.3..v0.0.4) (2026-03-19)
38+
39+
### Fixes:
40+
* fixed relationship enrichment inconsistent across neo4j versions
41+
42+
## [v0.0.3](https://github.com/diffo-dev/diffo/compare/v0.0.2..v0.0.3) (2026-03-13)
43+
44+
### Maintenance:
45+
* updated to diffo 0.1.4, using ash_neo4j 0.2.13 using fork bolty 0.0.7 rather than boltx 0.0.6
46+
47+
## [v0.0.2](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.2) (2025-12-01)
48+
49+
### Maintenance:
50+
* updated to diffo 0.1.3
51+
52+
## [v0.0.1](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.1) (2025-10-20)
53+
54+
### Features:
55+
* initial version
56+

documentation/domains/diffo_example_nbn.livemd

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ SPDX-License-Identifier: MIT
99
```elixir
1010
Mix.install(
1111
[
12-
{:diffo_example, "~> 0.2.0"},
12+
{:diffo_example, "~> 0.2.1"},
13+
{:diffo, "~> 0.4.1"},
1314
{:kino, "~> 0.14"},
1415
{:req, "~> 0.5"}
1516
],
@@ -117,7 +118,9 @@ Speeds.speeds(:home_fast, :FixedWireless)
117118

118119
## Multi-tenancy
119120

120-
Each RSP operates in isolation — they can only see and manage the resources they own. This multi-tenancy is enforced at the Ash policy layer: every NBN resource is stamped with the owning RSP's id at creation, and subsequent reads, updates, and destroys are scoped to the record owner.
121+
Each RSP operates in isolation — they can only see and manage the resources they own. This multi-tenancy is enforced at the Ash policy layer: every NBN resource is stamped with the owning RSP's EPID at creation, and subsequent reads, updates, and destroys are scoped to the record owner.
122+
123+
RSP is modelled as a Party (using the `Diffo.Provider.BaseParty` fragment), with its EPID as the Party id. This means the `rsp_id` stamped on owned resources is a human-readable four-digit identifier rather than a UUID.
121124

122125
Select the RSP you want to operate as for the rest of this livebook. All resources you build will be owned by that RSP and isolated from resources owned by others.
123126

@@ -127,7 +130,7 @@ alias DiffoExample.Nbn.Rsp
127130
import Jason, only: [encode: 2]
128131
DiffoExample.Nbn.Initializer.init()
129132
rsps = Nbn.list_rsps!()
130-
Kino.DataTable.new(rsps, keys: [:epid, :name, :short_name, :state])
133+
Kino.DataTable.new(rsps, keys: [:id, :name, :short_name, :state])
131134
```
132135

133136
```elixir
@@ -167,7 +170,10 @@ Define the NNI Group with an SVLAN assignment and relate the NNI:
167170

168171
```elixir
169172
nni_group = Nbn.define_nni_group!(nni_group, %{
170-
characteristic_value_updates: [nni_group: [svlan: 100]]
173+
characteristic_value_updates: [
174+
nni_group: [name: "SYD-POI-01", location: "Sydney Olympic Park"],
175+
svlans: [first: 1, last: 4000, free: 4000, assignable_type: "svlan"]
176+
]
171177
}, actor: actor)
172178
nni_group = Nbn.relate_nni_group!(nni_group, %{
173179
relationships: [%Diffo.Provider.Instance.Relationship{id: nni.id, alias: :nni, type: :isAssigned}]
@@ -197,7 +203,10 @@ Build an NTD — the device installed at the customer premises:
197203
alias DiffoExample.Nbn.{Ntd, Uni, Avc, NbnEthernet}
198204
ntd = Nbn.build_ntd!(%{})
199205
ntd = Nbn.define_ntd!(ntd, %{
200-
characteristic_value_updates: [ntd: [technology: :FTTP, ports: [1, 2, 3, 4]]]
206+
characteristic_value_updates: [
207+
ntd: [technology: :FTTP],
208+
ports: [first: 1, last: 4, free: 4, assignable_type: "port"]
209+
]
201210
})
202211
ntd |> Jason.encode!(pretty: true) |> IO.puts
203212
```

lib/access/resources/cable.ex

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Cable do
1212
alias Diffo.Provider.BaseInstance
1313
alias Diffo.Provider.Instance.Relationship
1414
alias Diffo.Provider.Instance.Characteristic
15-
alias Diffo.Provider.Instance.ActionHelper
1615
alias Diffo.Provider.Assigner
1716
alias Diffo.Provider.Assignment
1817

@@ -27,38 +26,36 @@ defmodule DiffoExample.Access.Cable do
2726
plural_name :Cables
2827
end
2928

30-
specification do
31-
id "ce0a567a-6abb-4862-9e33-851fd79fa595"
32-
name "cable"
33-
type :resourceSpecification
34-
description "A Cable Resource Instance"
35-
category "Network Resource"
29+
structure do
30+
specification do
31+
id "ce0a567a-6abb-4862-9e33-851fd79fa595"
32+
name "cable"
33+
type :resourceSpecification
34+
description "A Cable Resource Instance"
35+
category "Network Resource"
36+
end
37+
38+
characteristics do
39+
characteristic :cable, DiffoExample.Access.CableValue
40+
characteristic :pairs, Diffo.Provider.AssignableValue
41+
end
3642
end
3743

38-
characteristics do
39-
characteristic :cable, DiffoExample.Access.CableValue
40-
characteristic :pairs, Diffo.Provider.AssignableValue
44+
behaviour do
45+
actions do
46+
create :build
47+
end
4148
end
4249

4350
actions do
4451
create :build do
4552
description "creates a new Cable resource instance for build"
4653
accept [:id, :name, :type, :which]
47-
argument :specified_by, :uuid, public?: false
4854
argument :relationships, {:array, :struct}
49-
argument :features, {:array, :uuid}, public?: false
50-
argument :characteristics, {:array, :uuid}, public?: false
5155
argument :places, {:array, :struct}
5256
argument :parties, {:array, :struct}
5357

5458
change set_attribute(:type, :resource)
55-
56-
change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)
57-
58-
change after_action(fn changeset, result, _context ->
59-
ActionHelper.build_after(changeset, result, Access, :get_cable_by_id)
60-
end)
61-
6259
change load [:href]
6360
upsert? false
6461
end

lib/access/resources/card.ex

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Card do
1212
alias Diffo.Provider.BaseInstance
1313
alias Diffo.Provider.Instance.Relationship
1414
alias Diffo.Provider.Instance.Characteristic
15-
alias Diffo.Provider.Instance.ActionHelper
1615
alias Diffo.Provider.Assigner
1716
alias Diffo.Provider.Assignment
1817

@@ -27,38 +26,36 @@ defmodule DiffoExample.Access.Card do
2726
plural_name :Cards
2827
end
2928

30-
specification do
31-
id "cd29956f-6c68-44cc-bf54-705eb8d2f754"
32-
name "card"
33-
type :resourceSpecification
34-
description "A Card Resource Instance"
35-
category "Network Resource"
29+
structure do
30+
specification do
31+
id "cd29956f-6c68-44cc-bf54-705eb8d2f754"
32+
name "card"
33+
type :resourceSpecification
34+
description "A Card Resource Instance"
35+
category "Network Resource"
36+
end
37+
38+
characteristics do
39+
characteristic :card, DiffoExample.Access.CardValue
40+
characteristic :ports, Diffo.Provider.AssignableValue
41+
end
3642
end
3743

38-
characteristics do
39-
characteristic :card, DiffoExample.Access.CardValue
40-
characteristic :ports, Diffo.Provider.AssignableValue
44+
behaviour do
45+
actions do
46+
create :build
47+
end
4148
end
4249

4350
actions do
4451
create :build do
4552
description "creates a new Card resource instance for build"
4653
accept [:id, :name, :type, :which]
47-
argument :specified_by, :uuid, public?: false
4854
argument :relationships, {:array, :struct}
49-
argument :features, {:array, :uuid}, public?: false
50-
argument :characteristics, {:array, :uuid}, public?: false
5155
argument :places, {:array, :struct}
5256
argument :parties, {:array, :struct}
5357

5458
change set_attribute(:type, :resource)
55-
56-
change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)
57-
58-
change after_action(fn changeset, result, _context ->
59-
ActionHelper.build_after(changeset, result, Access, :get_card_by_id)
60-
end)
61-
6259
change load [:href]
6360
upsert? false
6461
end

lib/access/resources/path.ex

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Path do
1212
alias Diffo.Provider.BaseInstance
1313
alias Diffo.Provider.Instance.Relationship
1414
alias Diffo.Provider.Instance.Characteristic
15-
alias Diffo.Provider.Instance.ActionHelper
1615

1716
alias DiffoExample.Access
1817

@@ -25,37 +24,35 @@ defmodule DiffoExample.Access.Path do
2524
plural_name :Paths
2625
end
2726

28-
specification do
29-
id "1d507914-8f76-48cb-aa0e-3a8f92951ab0"
30-
name "path"
31-
type :resourceSpecification
32-
description "A Path Resource Instance"
33-
category "Network Resource"
27+
structure do
28+
specification do
29+
id "1d507914-8f76-48cb-aa0e-3a8f92951ab0"
30+
name "path"
31+
type :resourceSpecification
32+
description "A Path Resource Instance"
33+
category "Network Resource"
34+
end
35+
36+
characteristics do
37+
characteristic :path, DiffoExample.Access.PathValue
38+
end
3439
end
3540

36-
characteristics do
37-
characteristic :path, DiffoExample.Access.PathValue
41+
behaviour do
42+
actions do
43+
create :build
44+
end
3845
end
3946

4047
actions do
4148
create :build do
4249
description "creates a new Path resource instance for build"
4350
accept [:id, :name, :type, :which]
44-
argument :specified_by, :uuid, public?: false
4551
argument :relationships, {:array, :struct}
46-
argument :features, {:array, :uuid}, public?: false
47-
argument :characteristics, {:array, :uuid}, public?: false
4852
argument :places, {:array, :struct}
4953
argument :parties, {:array, :struct}
5054

5155
change set_attribute(:type, :resource)
52-
53-
change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)
54-
55-
change after_action(fn changeset, result, _context ->
56-
ActionHelper.build_after(changeset, result, Access, :get_path_by_id)
57-
end)
58-
5956
change load [:href]
6057
upsert? false
6158
end

lib/access/resources/shelf.ex

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Shelf do
1212
alias Diffo.Provider.BaseInstance
1313
alias Diffo.Provider.Instance.Relationship
1414
alias Diffo.Provider.Instance.Characteristic
15-
alias Diffo.Provider.Instance.ActionHelper
1615
alias Diffo.Provider.Assigner
1716
alias Diffo.Provider.Assignment
1817

@@ -27,38 +26,36 @@ defmodule DiffoExample.Access.Shelf do
2726
plural_name :Shelves
2827
end
2928

30-
specification do
31-
id "ef016d85-9dbd-429c-84da-1df56cc7dda5"
32-
name "shelf"
33-
type :resourceSpecification
34-
description "A Shelf Resource Instance which contain cards"
35-
category "Network Resource"
29+
structure do
30+
specification do
31+
id "ef016d85-9dbd-429c-84da-1df56cc7dda5"
32+
name "shelf"
33+
type :resourceSpecification
34+
description "A Shelf Resource Instance which contain cards"
35+
category "Network Resource"
36+
end
37+
38+
characteristics do
39+
characteristic :shelf, DiffoExample.Access.ShelfValue
40+
characteristic :slots, Diffo.Provider.AssignableValue
41+
end
3642
end
3743

38-
characteristics do
39-
characteristic :shelf, DiffoExample.Access.ShelfValue
40-
characteristic :slots, Diffo.Provider.AssignableValue
44+
behaviour do
45+
actions do
46+
create :build
47+
end
4148
end
4249

4350
actions do
4451
create :build do
4552
description "creates a new Shelf resource instance for build"
4653
accept [:id, :name, :type, :which]
47-
argument :specified_by, :uuid, public?: false
4854
argument :relationships, {:array, :struct}
49-
argument :features, {:array, :uuid}, public?: false
50-
argument :characteristics, {:array, :uuid}, public?: false
5155
argument :places, {:array, :struct}
5256
argument :parties, {:array, :struct}
5357

5458
change set_attribute(:type, :resource)
55-
56-
change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)
57-
58-
change after_action(fn changeset, result, _context ->
59-
ActionHelper.build_after(changeset, result, Access, :get_shelf_by_id)
60-
end)
61-
6259
change load [:href]
6360
upsert? false
6461
end

0 commit comments

Comments
 (0)