Skip to content
Merged

dev #31

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 27 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,14 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline

<!-- changelog -->

## [v0.0.1](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.1) (2025-10-20)

### Features:
* initial version

## [v0.0.2](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.2) (2025-12-01)
## [v0.2.1](https://github.com/diffo-dev/diffo/compare/v0.2.0..v0.2.1) (2026-05-07)

### Maintenance:
* updated to diffo 0.1.3
* updated to diffo 0.2.1

## [v0.0.3](https://github.com/diffo-dev/diffo/compare/v0.0.2..v0.0.3) (2026-03-13)

### Maintenance:
* updated to diffo 0.1.4, using ash_neo4j 0.2.13 using fork bolty 0.0.7 rather than boltx 0.0.6

## [v0.0.4](https://github.com/diffo-dev/diffo/compare/v0.0.3..v0.0.4) (2026-03-19)

### Fixes:
* fixed relationship enrichment inconsistent across neo4j versions
### Features:
* using transactions and test sandbox
* using improved provider DSL

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

Expand All @@ -43,4 +32,25 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
* RSP multi-tenancy: SetRspId change, OwnedByActor and NoActor policy checks, RspOwnership macro shared across RSP-owned resources
* NTD and UNI modelled as NBN-owned infrastructure — readable by any RSP, mutable only by internal calls
* Interactive NBN livebook with Kino RSP selector and actor-scoped provisioning flow
* NBN domain documentation including Perentie ecosystem narrative
* NBN domain documentation including Perentie ecosystem narrative

## [v0.0.4](https://github.com/diffo-dev/diffo/compare/v0.0.3..v0.0.4) (2026-03-19)

### Fixes:
* fixed relationship enrichment inconsistent across neo4j versions

## [v0.0.3](https://github.com/diffo-dev/diffo/compare/v0.0.2..v0.0.3) (2026-03-13)

### Maintenance:
* updated to diffo 0.1.4, using ash_neo4j 0.2.13 using fork bolty 0.0.7 rather than boltx 0.0.6

## [v0.0.2](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.2) (2025-12-01)

### Maintenance:
* updated to diffo 0.1.3

## [v0.0.1](https://github.com/diffo-dev/diffo/compare/v0.0.1..v0.0.1) (2025-10-20)

### Features:
* initial version

19 changes: 14 additions & 5 deletions documentation/domains/diffo_example_nbn.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ SPDX-License-Identifier: MIT
```elixir
Mix.install(
[
{:diffo_example, "~> 0.2.0"},
{:diffo_example, "~> 0.2.1"},
{:diffo, "~> 0.4.1"},
{:kino, "~> 0.14"},
{:req, "~> 0.5"}
],
Expand Down Expand Up @@ -117,7 +118,9 @@ Speeds.speeds(:home_fast, :FixedWireless)

## Multi-tenancy

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.
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.

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.

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.

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

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

```elixir
nni_group = Nbn.define_nni_group!(nni_group, %{
characteristic_value_updates: [nni_group: [svlan: 100]]
characteristic_value_updates: [
nni_group: [name: "SYD-POI-01", location: "Sydney Olympic Park"],
svlans: [first: 1, last: 4000, free: 4000, assignable_type: "svlan"]
]
}, actor: actor)
nni_group = Nbn.relate_nni_group!(nni_group, %{
relationships: [%Diffo.Provider.Instance.Relationship{id: nni.id, alias: :nni, type: :isAssigned}]
Expand Down Expand Up @@ -197,7 +203,10 @@ Build an NTD — the device installed at the customer premises:
alias DiffoExample.Nbn.{Ntd, Uni, Avc, NbnEthernet}
ntd = Nbn.build_ntd!(%{})
ntd = Nbn.define_ntd!(ntd, %{
characteristic_value_updates: [ntd: [technology: :FTTP, ports: [1, 2, 3, 4]]]
characteristic_value_updates: [
ntd: [technology: :FTTP],
ports: [first: 1, last: 4, free: 4, assignable_type: "port"]
]
})
ntd |> Jason.encode!(pretty: true) |> IO.puts
```
Expand Down
37 changes: 17 additions & 20 deletions lib/access/resources/cable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Cable do
alias Diffo.Provider.BaseInstance
alias Diffo.Provider.Instance.Relationship
alias Diffo.Provider.Instance.Characteristic
alias Diffo.Provider.Instance.ActionHelper
alias Diffo.Provider.Assigner
alias Diffo.Provider.Assignment

Expand All @@ -27,38 +26,36 @@ defmodule DiffoExample.Access.Cable do
plural_name :Cables
end

specification do
id "ce0a567a-6abb-4862-9e33-851fd79fa595"
name "cable"
type :resourceSpecification
description "A Cable Resource Instance"
category "Network Resource"
structure do
specification do
id "ce0a567a-6abb-4862-9e33-851fd79fa595"
name "cable"
type :resourceSpecification
description "A Cable Resource Instance"
category "Network Resource"
end

characteristics do
characteristic :cable, DiffoExample.Access.CableValue
characteristic :pairs, Diffo.Provider.AssignableValue
end
end

characteristics do
characteristic :cable, DiffoExample.Access.CableValue
characteristic :pairs, Diffo.Provider.AssignableValue
behaviour do
actions do
create :build
end
end

actions do
create :build do
description "creates a new Cable resource instance for build"
accept [:id, :name, :type, :which]
argument :specified_by, :uuid, public?: false
argument :relationships, {:array, :struct}
argument :features, {:array, :uuid}, public?: false
argument :characteristics, {:array, :uuid}, public?: false
argument :places, {:array, :struct}
argument :parties, {:array, :struct}

change set_attribute(:type, :resource)

change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)

change after_action(fn changeset, result, _context ->
ActionHelper.build_after(changeset, result, Access, :get_cable_by_id)
end)

change load [:href]
upsert? false
end
Expand Down
37 changes: 17 additions & 20 deletions lib/access/resources/card.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Card do
alias Diffo.Provider.BaseInstance
alias Diffo.Provider.Instance.Relationship
alias Diffo.Provider.Instance.Characteristic
alias Diffo.Provider.Instance.ActionHelper
alias Diffo.Provider.Assigner
alias Diffo.Provider.Assignment

Expand All @@ -27,38 +26,36 @@ defmodule DiffoExample.Access.Card do
plural_name :Cards
end

specification do
id "cd29956f-6c68-44cc-bf54-705eb8d2f754"
name "card"
type :resourceSpecification
description "A Card Resource Instance"
category "Network Resource"
structure do
specification do
id "cd29956f-6c68-44cc-bf54-705eb8d2f754"
name "card"
type :resourceSpecification
description "A Card Resource Instance"
category "Network Resource"
end

characteristics do
characteristic :card, DiffoExample.Access.CardValue
characteristic :ports, Diffo.Provider.AssignableValue
end
end

characteristics do
characteristic :card, DiffoExample.Access.CardValue
characteristic :ports, Diffo.Provider.AssignableValue
behaviour do
actions do
create :build
end
end

actions do
create :build do
description "creates a new Card resource instance for build"
accept [:id, :name, :type, :which]
argument :specified_by, :uuid, public?: false
argument :relationships, {:array, :struct}
argument :features, {:array, :uuid}, public?: false
argument :characteristics, {:array, :uuid}, public?: false
argument :places, {:array, :struct}
argument :parties, {:array, :struct}

change set_attribute(:type, :resource)

change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)

change after_action(fn changeset, result, _context ->
ActionHelper.build_after(changeset, result, Access, :get_card_by_id)
end)

change load [:href]
upsert? false
end
Expand Down
35 changes: 16 additions & 19 deletions lib/access/resources/path.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Path do
alias Diffo.Provider.BaseInstance
alias Diffo.Provider.Instance.Relationship
alias Diffo.Provider.Instance.Characteristic
alias Diffo.Provider.Instance.ActionHelper

alias DiffoExample.Access

Expand All @@ -25,37 +24,35 @@ defmodule DiffoExample.Access.Path do
plural_name :Paths
end

specification do
id "1d507914-8f76-48cb-aa0e-3a8f92951ab0"
name "path"
type :resourceSpecification
description "A Path Resource Instance"
category "Network Resource"
structure do
specification do
id "1d507914-8f76-48cb-aa0e-3a8f92951ab0"
name "path"
type :resourceSpecification
description "A Path Resource Instance"
category "Network Resource"
end

characteristics do
characteristic :path, DiffoExample.Access.PathValue
end
end

characteristics do
characteristic :path, DiffoExample.Access.PathValue
behaviour do
actions do
create :build
end
end

actions do
create :build do
description "creates a new Path resource instance for build"
accept [:id, :name, :type, :which]
argument :specified_by, :uuid, public?: false
argument :relationships, {:array, :struct}
argument :features, {:array, :uuid}, public?: false
argument :characteristics, {:array, :uuid}, public?: false
argument :places, {:array, :struct}
argument :parties, {:array, :struct}

change set_attribute(:type, :resource)

change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)

change after_action(fn changeset, result, _context ->
ActionHelper.build_after(changeset, result, Access, :get_path_by_id)
end)

change load [:href]
upsert? false
end
Expand Down
37 changes: 17 additions & 20 deletions lib/access/resources/shelf.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ defmodule DiffoExample.Access.Shelf do
alias Diffo.Provider.BaseInstance
alias Diffo.Provider.Instance.Relationship
alias Diffo.Provider.Instance.Characteristic
alias Diffo.Provider.Instance.ActionHelper
alias Diffo.Provider.Assigner
alias Diffo.Provider.Assignment

Expand All @@ -27,38 +26,36 @@ defmodule DiffoExample.Access.Shelf do
plural_name :Shelves
end

specification do
id "ef016d85-9dbd-429c-84da-1df56cc7dda5"
name "shelf"
type :resourceSpecification
description "A Shelf Resource Instance which contain cards"
category "Network Resource"
structure do
specification do
id "ef016d85-9dbd-429c-84da-1df56cc7dda5"
name "shelf"
type :resourceSpecification
description "A Shelf Resource Instance which contain cards"
category "Network Resource"
end

characteristics do
characteristic :shelf, DiffoExample.Access.ShelfValue
characteristic :slots, Diffo.Provider.AssignableValue
end
end

characteristics do
characteristic :shelf, DiffoExample.Access.ShelfValue
characteristic :slots, Diffo.Provider.AssignableValue
behaviour do
actions do
create :build
end
end

actions do
create :build do
description "creates a new Shelf resource instance for build"
accept [:id, :name, :type, :which]
argument :specified_by, :uuid, public?: false
argument :relationships, {:array, :struct}
argument :features, {:array, :uuid}, public?: false
argument :characteristics, {:array, :uuid}, public?: false
argument :places, {:array, :struct}
argument :parties, {:array, :struct}

change set_attribute(:type, :resource)

change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end)

change after_action(fn changeset, result, _context ->
ActionHelper.build_after(changeset, result, Access, :get_shelf_by_id)
end)

change load [:href]
upsert? false
end
Expand Down
Loading
Loading