diff --git a/CHANGELOG.md b/CHANGELOG.md index 16391cf..d234861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,25 +11,14 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline -## [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) @@ -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 \ No newline at end of file +* 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 + diff --git a/documentation/domains/diffo_example_nbn.livemd b/documentation/domains/diffo_example_nbn.livemd index df77a32..73b3dbe 100644 --- a/documentation/domains/diffo_example_nbn.livemd +++ b/documentation/domains/diffo_example_nbn.livemd @@ -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"} ], @@ -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. @@ -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 @@ -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}] @@ -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 ``` diff --git a/lib/access/resources/cable.ex b/lib/access/resources/cable.ex index 66058d7..73ed34b 100644 --- a/lib/access/resources/cable.ex +++ b/lib/access/resources/cable.ex @@ -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 @@ -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 diff --git a/lib/access/resources/card.ex b/lib/access/resources/card.ex index 5cfffb4..ba5e762 100644 --- a/lib/access/resources/card.ex +++ b/lib/access/resources/card.ex @@ -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 @@ -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 diff --git a/lib/access/resources/path.ex b/lib/access/resources/path.ex index 5418148..d99700a 100644 --- a/lib/access/resources/path.ex +++ b/lib/access/resources/path.ex @@ -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 @@ -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 diff --git a/lib/access/resources/shelf.ex b/lib/access/resources/shelf.ex index f325342..42c2c40 100644 --- a/lib/access/resources/shelf.ex +++ b/lib/access/resources/shelf.ex @@ -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 @@ -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 diff --git a/lib/access/services/dsl_access.ex b/lib/access/services/dsl_access.ex index fc6a594..e4e0dc3 100644 --- a/lib/access/services/dsl_access.ex +++ b/lib/access/services/dsl_access.ex @@ -12,7 +12,6 @@ defmodule DiffoExample.Access.DslAccess do alias Diffo.Provider.BaseInstance alias Diffo.Provider.Instance.Characteristic alias Diffo.Provider.Instance.Place - alias Diffo.Provider.Instance.ActionHelper alias DiffoExample.Access @@ -25,25 +24,33 @@ defmodule DiffoExample.Access.DslAccess do plural_name :DslAccesses end - specification do - id "da9b207a-26c3-451d-8abd-0640c6349979" - name "dslAccess" - description "A DSL Access Network Service connecting a subscriber premises to an NNI" - category "Network Service" - end + structure do + specification do + id "da9b207a-26c3-451d-8abd-0640c6349979" + name "dslAccess" + description "A DSL Access Network Service connecting a subscriber premises to an NNI" + category "Network Service" + end - features do - feature :dynamic_line_management do - is_enabled? true - characteristic :constraints, DiffoExample.Access.Constraints + features do + feature :dynamic_line_management do + is_enabled? true + characteristic :constraints, DiffoExample.Access.Constraints + end + end + + characteristics do + characteristic :dslam, DiffoExample.Access.Dslam + characteristic :aggregate_interface, DiffoExample.Access.AggregateInterface + characteristic :circuit, DiffoExample.Access.Circuit + characteristic :line, DiffoExample.Access.Line end end - characteristics do - characteristic :dslam, DiffoExample.Access.Dslam - characteristic :aggregate_interface, DiffoExample.Access.AggregateInterface - characteristic :circuit, DiffoExample.Access.Circuit - characteristic :line, DiffoExample.Access.Line + behaviour do + actions do + create :qualify + end end state_machine do @@ -59,15 +66,6 @@ defmodule DiffoExample.Access.DslAccess do accept [:id, :name, :type, :which] argument :places, {:array, :struct} argument :parties, {:array, :struct} - argument :specified_by, :uuid, public?: false - argument :characteristics, {:array, :uuid}, public?: false - argument :features, {:array, :uuid}, public?: false - - 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_dsl_by_id) - end) change load [:href] upsert? false diff --git a/lib/diffo_example/application.ex b/lib/diffo_example/application.ex index 0de7553..630a686 100644 --- a/lib/diffo_example/application.ex +++ b/lib/diffo_example/application.ex @@ -10,12 +10,14 @@ defmodule DiffoExample.Application do @impl true def start(_type, _args) do children = - [ - {Task, &DiffoExample.Nbn.Initializer.init/0} - ] ++ - if Mix.env() == :test, - do: [], - else: [{Plug.Cowboy, scheme: :http, plug: DiffoExample.Nbn.Router, options: [port: 4000]}] + if Mix.env() == :test do + [] + else + [ + {Task, &DiffoExample.Nbn.Initializer.init/0}, + {Plug.Cowboy, scheme: :http, plug: DiffoExample.Nbn.Router, options: [port: 4000]} + ] + end Supervisor.start_link(children, strategy: :one_for_one, name: DiffoExample.Supervisor) end diff --git a/lib/nbn/initializer.ex b/lib/nbn/initializer.ex index 13b80e5..87e92e5 100644 --- a/lib/nbn/initializer.ex +++ b/lib/nbn/initializer.ex @@ -7,47 +7,35 @@ defmodule DiffoExample.Nbn.Initializer do Diffo - TMF Service and Resource Management with a difference Initializes the NBN domain on application startup: - - upserts all resource specifications into the catalog - seeds RSP records in historical EPID sequence """ - alias Diffo.Provider.Instance.Specification alias DiffoExample.Nbn @rsps [ - %{name: "Wedge-tail Telecom", short_name: :wedgetail, epid: "0001"}, - %{name: "Quokka Connect", short_name: :quokka, epid: "0002"}, - %{name: "Ibis Telecom", short_name: :ibis, epid: "0003"}, - %{name: "Taipan Group", short_name: :taipan, epid: "0004"}, - %{name: "Echidna Networks", short_name: :echidna, epid: "0005"}, - %{name: "Dugong Digital", short_name: :dugong, epid: "0006"}, - %{name: "Lyrebird", short_name: :lyrebird, epid: "0007"} + %{name: "Wedge-tail Telecom", short_name: :wedgetail, id: "0001"}, + %{name: "Quokka Connect", short_name: :quokka, id: "0002"}, + %{name: "Ibis Telecom", short_name: :ibis, id: "0003"}, + %{name: "Taipan Group", short_name: :taipan, id: "0004"}, + %{name: "Echidna Networks", short_name: :echidna, id: "0005"}, + %{name: "Dugong Digital", short_name: :dugong, id: "0006"}, + #%{name: "Lyrebird", short_name: :lyrebird, id: "0007"} ] def init do - Nbn - |> Ash.Domain.Info.resources() - |> Enum.each(fn module -> - try do - Specification.upsert_specification(module) - rescue - _ -> :ok - end - end) - seed_rsps() end defp seed_rsps do Enum.each(@rsps, fn attrs -> try do - case Nbn.get_rsp_by_epid(attrs.epid) do + case Nbn.get_rsp_by_epid(attrs.id) do {:ok, nil} -> seed_rsp(attrs) {:ok, _} -> :ok {:error, _} -> seed_rsp(attrs) end rescue - e -> require Logger; Logger.error("Exception seeding RSP #{attrs.epid}: #{inspect(e)}") + e -> require Logger; Logger.error("Exception seeding RSP #{attrs.id}: #{inspect(e)}") end end) end diff --git a/lib/nbn/nbn.ex b/lib/nbn/nbn.ex index 43d4bfa..f377ff0 100644 --- a/lib/nbn/nbn.ex +++ b/lib/nbn/nbn.ex @@ -163,10 +163,10 @@ defmodule DiffoExample.Nbn do end resource Rsp do - define :list_rsps, action: :list - define :get_rsp_by_epid, action: :read, get_by: :epid + define :list_rsps, action: :inventory + define :get_rsp_by_epid, action: :read, get_by: :id define :get_rsp_by_short_name, action: :read, get_by: :short_name - define :create_rsp, action: :create + define :create_rsp, action: :build define :activate_rsp, action: :activate define :suspend_rsp, action: :suspend define :deactivate_rsp, action: :deactivate diff --git a/lib/nbn/resources/avc.ex b/lib/nbn/resources/avc.ex index 5f49871..294a951 100644 --- a/lib/nbn/resources/avc.ex +++ b/lib/nbn/resources/avc.ex @@ -15,7 +15,6 @@ defmodule DiffoExample.Nbn.Avc do alias Diffo.Provider.BaseInstance alias Diffo.Provider.Instance.Relationship alias Diffo.Provider.Instance.Characteristic - alias Diffo.Provider.Instance.ActionHelper alias DiffoExample.Nbn @@ -34,21 +33,29 @@ defmodule DiffoExample.Nbn.Avc do plural_name :Avcs end - specification do - id "b2c3d4e5-6f7a-4b8c-9d0e-1f2a3b4c5d6e" - name "avc" - type :resourceSpecification - description "An AVC Resource Instance dedicated to an NBN Ethernet circuit" - category "Network Resource" + structure do + specification do + id "b2c3d4e5-6f7a-4b8c-9d0e-1f2a3b4c5d6e" + name "avc" + type :resourceSpecification + description "An AVC Resource Instance dedicated to an NBN Ethernet circuit" + category "Network Resource" + end + + characteristics do + characteristic :avc, DiffoExample.Nbn.AvcValue + characteristic :cvc, DiffoExample.Nbn.CvcValue + end end - characteristics do - characteristic :avc, DiffoExample.Nbn.AvcValue - characteristic :cvc, DiffoExample.Nbn.CvcValue + behaviour do + actions do + create :build + end end attributes do - attribute :rsp_id, :uuid do + attribute :rsp_id, :string do description "the owning RSP's id — nil for Perentie-managed infrastructure" allow_nil? true public? true @@ -59,25 +66,13 @@ defmodule DiffoExample.Nbn.Avc do create :build do description "creates a new AVC resource instance" accept [:id, :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(:name, &DiffoExample.Nbn.Avc.identifier/0) - 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, Nbn, :get_avc_by_id) - end) - change DiffoExample.Nbn.Changes.SetRspId - change load [:href] upsert? false end diff --git a/lib/nbn/resources/cvc.ex b/lib/nbn/resources/cvc.ex index e6b8215..30f64de 100644 --- a/lib/nbn/resources/cvc.ex +++ b/lib/nbn/resources/cvc.ex @@ -15,7 +15,6 @@ defmodule DiffoExample.Nbn.Cvc 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 @@ -36,23 +35,29 @@ defmodule DiffoExample.Nbn.Cvc do plural_name :Cvcs end - specification do - id "d4e5f6a7-8b9c-4d0e-bf1a-3b4c5d6e7f8a" - name "cvc" - type :resourceSpecification - - description "A Connectivity Virtual Circuit Resource Instance that aggregates AVCs and terminates at an NNI Group" + structure do + specification do + id "d4e5f6a7-8b9c-4d0e-bf1a-3b4c5d6e7f8a" + name "cvc" + type :resourceSpecification + description "A Connectivity Virtual Circuit Resource Instance that aggregates AVCs and terminates at an NNI Group" + category "Network Resource" + end - category "Network Resource" + characteristics do + characteristic :cvc, DiffoExample.Nbn.CvcValue + characteristic :cvlans, Diffo.Provider.AssignableValue + end end - characteristics do - characteristic :cvc, DiffoExample.Nbn.CvcValue - characteristic :cvlans, Diffo.Provider.AssignableValue + behaviour do + actions do + create :build + end end attributes do - attribute :rsp_id, :uuid do + attribute :rsp_id, :string do description "the owning RSP's id — nil for Perentie-managed infrastructure" allow_nil? true public? true @@ -63,25 +68,13 @@ defmodule DiffoExample.Nbn.Cvc do create :build do description "creates a new CVC resource instance" accept [:id, :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(:name, &DiffoExample.Nbn.Cvc.identifier/0) - 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, Nbn, :get_cvc_by_id) - end) - change DiffoExample.Nbn.Changes.SetRspId - change load [:href] upsert? false end diff --git a/lib/nbn/resources/nbn_ethernet.ex b/lib/nbn/resources/nbn_ethernet.ex index d5c2ec2..1d15ba4 100644 --- a/lib/nbn/resources/nbn_ethernet.ex +++ b/lib/nbn/resources/nbn_ethernet.ex @@ -14,7 +14,6 @@ defmodule DiffoExample.Nbn.NbnEthernet do alias Diffo.Provider.BaseInstance alias Diffo.Provider.Instance.Relationship alias Diffo.Provider.Instance.Characteristic - alias Diffo.Provider.Instance.ActionHelper alias DiffoExample.Nbn alias DiffoExample.Nbn.Util @@ -35,24 +34,28 @@ defmodule DiffoExample.Nbn.NbnEthernet do plural_name :NbnEthernets end - specification do - id "f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c" - name "nbnEthernet" - type :resourceSpecification - description "An NBN Ethernet access comprising a dedicated UNI and AVC" - category "Network Resource" + structure do + specification do + id "f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c" + name "nbnEthernet" + type :resourceSpecification + description "An NBN Ethernet access comprising a dedicated UNI and AVC" + category "Network Resource" + end + + characteristics do + characteristic :pri, DiffoExample.Nbn.PriValue + end end - characteristics do - characteristic :pri, DiffoExample.Nbn.PriValue - # values do - # value :uniid, DiffoExample.Nbn.Uni, :owns, :name - # value :avcid, DiffoExample.Nbn.Avc, :owns, :name - # end + behaviour do + actions do + create :build + end end attributes do - attribute :rsp_id, :uuid do + attribute :rsp_id, :string do description "the owning RSP's id — nil for Perentie-managed infrastructure" allow_nil? true public? true @@ -63,25 +66,13 @@ defmodule DiffoExample.Nbn.NbnEthernet do create :build do description "creates a new NBN Ethernet access resource instance" accept [:id, :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(:name, &DiffoExample.Nbn.NbnEthernet.identifier/0) - 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, Nbn, :get_nbn_ethernet_by_id) - end) - change DiffoExample.Nbn.Changes.SetRspId - change load [:href] upsert? false end diff --git a/lib/nbn/resources/nni.ex b/lib/nbn/resources/nni.ex index a3682ea..0e69896 100644 --- a/lib/nbn/resources/nni.ex +++ b/lib/nbn/resources/nni.ex @@ -16,7 +16,6 @@ defmodule DiffoExample.Nbn.Nni do alias Diffo.Provider.BaseInstance alias Diffo.Provider.Instance.Relationship alias Diffo.Provider.Instance.Characteristic - alias Diffo.Provider.Instance.ActionHelper alias DiffoExample.Nbn @@ -35,20 +34,28 @@ defmodule DiffoExample.Nbn.Nni do plural_name :Nnis end - specification do - id "f6a7b8c9-0d1e-4f2a-9b3c-5d6e7f8a9b0c" - name "nni" - type :resourceSpecification - description "An NNI Resource Instance that is part of an NNI Group" - category "Network Resource" + structure do + specification do + id "f6a7b8c9-0d1e-4f2a-9b3c-5d6e7f8a9b0c" + name "nni" + type :resourceSpecification + description "An NNI Resource Instance that is part of an NNI Group" + category "Network Resource" + end + + characteristics do + characteristic :nni, DiffoExample.Nbn.NniValue + end end - characteristics do - characteristic :nni, DiffoExample.Nbn.NniValue + behaviour do + actions do + create :build + end end attributes do - attribute :rsp_id, :uuid do + attribute :rsp_id, :string do description "the owning RSP's id — nil for Perentie-managed infrastructure" allow_nil? true public? true @@ -59,25 +66,13 @@ defmodule DiffoExample.Nbn.Nni do create :build do description "creates a new NNI resource instance" accept [:id, :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 set_attribute(:name, &DiffoExample.Nbn.Nni.identifier/0) - - change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end) - - change after_action(fn changeset, result, _context -> - ActionHelper.build_after(changeset, result, Nbn, :get_nni_by_id) - end) - change DiffoExample.Nbn.Changes.SetRspId - change load [:href] upsert? false end @@ -103,10 +98,10 @@ defmodule DiffoExample.Nbn.Nni do do: {:ok, result} end) end + end - def identifier() do - DiffoExample.Nbn.Util.identifier("NNI") - end + def identifier() do + DiffoExample.Nbn.Util.identifier("NNI") end use DiffoExample.Nbn.RspOwnership diff --git a/lib/nbn/resources/nni_group.ex b/lib/nbn/resources/nni_group.ex index 7f60ac1..451e8ca 100644 --- a/lib/nbn/resources/nni_group.ex +++ b/lib/nbn/resources/nni_group.ex @@ -16,7 +16,6 @@ defmodule DiffoExample.Nbn.NniGroup 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 @@ -37,21 +36,29 @@ defmodule DiffoExample.Nbn.NniGroup do plural_name :NniGroups end - specification do - id "e5f6a7b8-9c0d-4e1f-8a2b-4c5d6e7f8a9b" - name "nniGroup" - type :resourceSpecification - description "An NNI Group Resource Instance comprising multiple NNI resources" - category "Network Resource" + structure do + specification do + id "e5f6a7b8-9c0d-4e1f-8a2b-4c5d6e7f8a9b" + name "nniGroup" + type :resourceSpecification + description "An NNI Group Resource Instance comprising multiple NNI resources" + category "Network Resource" + end + + characteristics do + characteristic :nni_group, DiffoExample.Nbn.NniGroupValue + characteristic :svlans, Diffo.Provider.AssignableValue + end end - characteristics do - characteristic :nni_group, DiffoExample.Nbn.NniGroupValue - characteristic :svlans, Diffo.Provider.AssignableValue + behaviour do + actions do + create :build + end end attributes do - attribute :rsp_id, :uuid do + attribute :rsp_id, :string do description "the owning RSP's id — nil for Perentie-managed infrastructure" allow_nil? true public? true @@ -62,23 +69,12 @@ defmodule DiffoExample.Nbn.NniGroup do create :build do description "creates a new NNI Group resource instance" accept [:id, :name, :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, Nbn, :get_nni_group_by_id) - end) - change DiffoExample.Nbn.Changes.SetRspId - change load [:href] upsert? false end diff --git a/lib/nbn/resources/ntd.ex b/lib/nbn/resources/ntd.ex index a7a4da6..7a5a445 100644 --- a/lib/nbn/resources/ntd.ex +++ b/lib/nbn/resources/ntd.ex @@ -15,7 +15,6 @@ defmodule DiffoExample.Nbn.Ntd 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 @@ -36,40 +35,37 @@ defmodule DiffoExample.Nbn.Ntd do plural_name :Ntds end - specification do - id "c3d4e5f6-7a8b-4c9d-ae0f-2a3b4c5d6e7f" - name "ntd" - type :resourceSpecification - description "An NTD Resource Instance related to a UNI" - category "Network Resource" + structure do + specification do + id "c3d4e5f6-7a8b-4c9d-ae0f-2a3b4c5d6e7f" + name "ntd" + type :resourceSpecification + description "An NTD Resource Instance related to a UNI" + category "Network Resource" + end + + characteristics do + characteristic :ntd, DiffoExample.Nbn.NtdValue + characteristic :ports, Diffo.Provider.AssignableValue + end end - characteristics do - characteristic :ntd, DiffoExample.Nbn.NtdValue - characteristic :ports, Diffo.Provider.AssignableValue + behaviour do + actions do + create :build + end end actions do create :build do description "creates a new NTD resource instance" accept [:id, :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 set_attribute(:name, &DiffoExample.Nbn.Ntd.identifier/0) - - change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end) - - change after_action(fn changeset, result, _context -> - ActionHelper.build_after(changeset, result, Nbn, :get_ntd_by_id) - end) - change load [:href] upsert? false end diff --git a/lib/nbn/resources/rsp.ex b/lib/nbn/resources/rsp.ex index 1f4fd66..c00c6a8 100644 --- a/lib/nbn/resources/rsp.ex +++ b/lib/nbn/resources/rsp.ex @@ -11,29 +11,31 @@ defmodule DiffoExample.Nbn.Rsp do An RSP is a licensed provider operating within the Perentie ecosystem. Each RSP is assigned an EPID (four-digit regulator-assigned identifier) and a short_name atom used as their actor identity for authorisation. + + RSP is a Party of kind :organization. The EPID is used as the Party id (Neo4j key). """ alias DiffoExample.Nbn use Ash.Resource, domain: Nbn, - data_layer: AshNeo4j.DataLayer, authorizers: [Ash.Policy.Authorizer], - extensions: [AshStateMachine, AshJason.Resource, AshJsonApi.Resource] - - neo4j do - label :Rsp - end + extensions: [AshStateMachine, AshJsonApi.Resource], + fragments: [Diffo.Provider.BaseParty] + + # BaseParty provides: + # data_layer: AshNeo4j.DataLayer + # extensions: AshJason.Resource, AshOutstanding.Resource, Diffo.Provider.Party.Extension + # Neo4j label :Party (RSP nodes are Party nodes) + # attributes: id (string/key), name, type, referred_type, created_at, updated_at + # relationships: party_refs + # actions: :read (primary), :destroy, :create (accept [:id,:name,:type,:referred_type]), + # :update (name), :list (unsorted), :find_by_name json_api do type "rsp" end - jason do - pick [:id, :name, :short_name, :epid, :state] - compact true - end - state_machine do initial_states [:inactive] default_initial_state :inactive @@ -47,59 +49,41 @@ defmodule DiffoExample.Nbn.Rsp do end attributes do - attribute :id, :uuid do - primary_key? true - allow_nil? false - public? true - default &Ash.UUID.generate/0 - source :uuid - end - - attribute :name, :string do - description "the RSP's registered trading name" - allow_nil? false - public? true - end - attribute :short_name, :atom do description "atom identifier used as the actor for authorisation" allow_nil? false public? true end - attribute :epid, :string do - description "four-digit regulator-assigned provider identifier, in historical sequence" - allow_nil? false - public? true - constraints [match: ~r/^\d{4}$/] - end - attribute :state, :atom do allow_nil? false default :inactive public? true constraints [one_of: [:active, :suspended, :inactive]] end + end - create_timestamp :created_at - update_timestamp :updated_at + instances do + role :owner, DiffoExample.Nbn.Avc + # pending resolution of /diffo-dev/diffo#101 + #role :owner, DiffoExample.Nbn.Cvc + #role :owner, DiffoExample.Nbn.Nni + #role :owner, DiffoExample.Nbn.NniGroup + #role :owner, DiffoExample.Nbn.NbnEthernet end actions do - defaults [:destroy] - - read :read do - primary? true - end - - read :list do - prepare build(sort: [epid: :asc]) + create :build do + accept [:name, :short_name, :id] + upsert? true + change set_attribute(:type, :Organization) + validate match(:id, ~r/^\d{4}$/) do + message "must be a four-digit EPID" + end end - create :create do - accept [:name, :short_name, :epid] - upsert? true - upsert_identity :unique_epid + read :inventory do + prepare build(sort: [id: :asc]) end update :activate do @@ -119,7 +103,6 @@ defmodule DiffoExample.Nbn.Rsp do end identities do - identity :unique_epid, [:epid] identity :unique_name, [:name] identity :unique_short_name, [:short_name] end diff --git a/lib/nbn/resources/uni.ex b/lib/nbn/resources/uni.ex index 5ddf015..afaefa6 100644 --- a/lib/nbn/resources/uni.ex +++ b/lib/nbn/resources/uni.ex @@ -16,7 +16,6 @@ defmodule DiffoExample.Nbn.Uni do alias Diffo.Provider.BaseInstance alias Diffo.Provider.Instance.Relationship alias Diffo.Provider.Instance.Characteristic - alias Diffo.Provider.Instance.ActionHelper alias DiffoExample.Nbn alias DiffoExample.Nbn.Util @@ -36,39 +35,36 @@ defmodule DiffoExample.Nbn.Uni do plural_name :Unis end - specification do - id "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d" - name "uni" - type :resourceSpecification - description "A UNI Resource Instance related to an NTD and an NBN Ethernet access" - category "Network Resource" + structure do + specification do + id "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d" + name "uni" + type :resourceSpecification + description "A UNI Resource Instance related to an NTD and an NBN Ethernet access" + category "Network Resource" + end + + characteristics do + characteristic :uni, DiffoExample.Nbn.UniValue + end end - characteristics do - characteristic :uni, DiffoExample.Nbn.UniValue + behaviour do + actions do + create :build + end end actions do create :build do description "creates a new UNI resource instance" accept [:id, :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 set_attribute(:name, &DiffoExample.Nbn.Uni.identifier/0) - - change before_action(fn changeset, _context -> ActionHelper.build_before(changeset) end) - - change after_action(fn changeset, result, _context -> - ActionHelper.build_after(changeset, result, Nbn, :get_uni_by_id) - end) - change load [:href] upsert? false end diff --git a/mix.exs b/mix.exs index 31c6573..d0aedc6 100644 --- a/mix.exs +++ b/mix.exs @@ -6,7 +6,7 @@ defmodule DiffoExample.MixProject do @moduledoc false use Mix.Project - @version "0.2.0" + @version "0.2.1" @name "DiffoExample" @description "Examples for Diffo TMF Service and Resource Manager" @github_url "https://github.com/diffo-dev/diffo-example" @@ -45,7 +45,7 @@ defmodule DiffoExample.MixProject do nil -> default_version "local" -> [path: "../diffo"] "main" -> [git: "https://github.com/diffo-dev/diffo.git"] - "0.2.0" -> [git: "https://github.com/diffo-dev/diffo.git", tag: "v0.2.0"] + "dev" -> [git: "https://github.com/diffo-dev/diffo.git", branch: "dev"] version -> "~> #{version}" end end @@ -86,7 +86,7 @@ defmodule DiffoExample.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:diffo, diffo_version("~> 0.2.0")}, + {:diffo, diffo_version("~> 0.2.1")}, {:ash_json_api, "~> 1.6"}, {:plug_cowboy, "~> 2.7"}, {:req, "~> 0.5", only: [:dev, :test]}, diff --git a/mix.lock b/mix.lock index 136c6c6..11e5594 100644 --- a/mix.lock +++ b/mix.lock @@ -1,11 +1,11 @@ %{ - "ash": {:hex, :ash, "3.24.3", "f7280a43c5e64f769a450f3dd59ace6dcd73edcdd0de7599815b1b31f59292fb", [:mix], [{:crux, ">= 0.1.2 and < 1.0.0-0", [hex: :crux, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 1.0", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.6.0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.3", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 1.0", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c1022f8c549632137cbc8956f07bb4981405297f5abe7a752b4dffac175c3381"}, + "ash": {:hex, :ash, "3.24.7", "6e2f32011e7c8f0809dae36712ccfb2efaf3c669cbda7443685436e80acdebf7", [:mix], [{:crux, ">= 0.1.2 and < 1.0.0-0", [hex: :crux, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 1.0", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.6.0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.3", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 1.0", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c9fb4d21c3c8bb85636338d448afdc283dd98a433d869e4b2210ac57ade00624"}, "ash_jason": {:hex, :ash_jason, "3.1.0", "84a88dfe5e25a20d55cf2d2664885cd086fa45871e8777aedc3ad96a282e2a6f", [:mix], [{:ash, ">= 3.6.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:spark, ">= 2.1.21 and < 3.0.0", [hex: :spark, repo: "hexpm", optional: false]}], "hexpm", "71e6bbc421fb2cf7079f8804814145cca458116c839fc798f9606b806e07eb2b"}, "ash_json_api": {:hex, :ash_json_api, "1.6.5", "ff925107ebdced10407a6045dc3ff9e8335fe3485ce042f899817a2b47f49b5f", [:mix], [{:ash, ">= 3.19.1 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:igniter, ">= 0.3.58 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:json_xema, "~> 0.4", [hex: :json_xema, repo: "hexpm", optional: false]}, {:open_api_spex, "~> 3.16", [hex: :open_api_spex, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:plug, "~> 1.11", [hex: :plug, repo: "hexpm", optional: false]}, {:spark, ">= 2.2.10", [hex: :spark, repo: "hexpm", optional: false]}], "hexpm", "ab2f413d977a560843bbf7a7f6bc486b74e944ef51d9adf93c355a4bf984b0df"}, - "ash_neo4j": {:hex, :ash_neo4j, "0.3.1", "52b81e870d020815ffb2699f3fa207e10e909418e80c8aec4c64ed668418299a", [:mix], [{:ash, ">= 3.24.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:bolty, ">= 0.0.10", [hex: :bolty, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "5da556d93e03fda97e1bb626941114b7011a64173b1c10deb12cf66523e82001"}, + "ash_neo4j": {:hex, :ash_neo4j, "0.4.1", "b33d7a5c9f333ffc8b1684fb6e07c4c502b0429ee5bb785fb09fb8d775636587", [:mix], [{:ash, ">= 3.24.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:bolty, ">= 0.0.12", [hex: :bolty, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "76a297eb6d5d23e5d9710b70161ad9810ac50e0efbf761d781981ee19f37af2a"}, "ash_outstanding": {:hex, :ash_outstanding, "0.2.4", "c72b91f1b8e4859fb033eddf66d0ba36cfd8af0c2a9748c7ef9e6ccfdb5d093d", [:mix], [{:ash, ">= 3.6.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:outstanding, "~> 0.2.4", [hex: :outstanding, repo: "hexpm", optional: false]}], "hexpm", "64ba8f582ce69c9050352c75f0895db186c7a56f35039dab34c8e1ab7516f9ce"}, "ash_state_machine": {:hex, :ash_state_machine, "0.2.13", "e1c368ebf01ef73477739ee76d53e513d073b141ec11e7bf7f91d8f2d8fc9569", [:mix], [{:ash, ">= 3.4.66 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}], "hexpm", "aa21c92a8950850df69b5205bf41efc1e502f5ab839425ba08561f0421c9f226"}, - "bolty": {:hex, :bolty, "0.0.10", "ec88948d30cfc213cdb1168f86d96cdcadd80f16e4f29701966e69dfbac43ded", [:mix], [{:db_connection, "~> 2.7.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 6.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm", "2ce63d6c23301d1c9a61fd29ef06ebb7d2e775d4fd4144e86c2717aa43f409c9"}, + "bolty": {:hex, :bolty, "0.0.12", "5311de46c29c71000c51cfb23fc181359daa49cedb9c8c4ba1e245f3e54079ae", [:mix], [{:db_connection, "~> 2.7.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 6.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm", "0760661dd2f0ba9f2901448c1be00fc1ed228780644ba21a2400d0662595ee10"}, "conv_case": {:hex, :conv_case, "0.2.3", "c1455c27d3c1ffcdd5f17f1e91f40b8a0bc0a337805a6e8302f441af17118ed8", [:mix], [], "hexpm", "88f29a3d97d1742f9865f7e394ed3da011abb7c5e8cc104e676fdef6270d4b4a"}, "cowboy": {:hex, :cowboy, "2.14.2", "4008be1df6ade45e4f2a4e9e2d22b36d0b5aba4e20b0a0d7049e28d124e34847", [:make, :rebar3], [{:cowlib, ">= 2.16.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, ">= 1.8.0 and < 3.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "569081da046e7b41b5df36aa359be71a0c8874e5b9cff6f747073fc57baf1ab9"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, @@ -13,9 +13,9 @@ "crux": {:hex, :crux, "0.1.2", "4441c9e3a34f1e340954ce96b9ad5a2de13ceb4f97b3f910211227bb92e2ca90", [:mix], [{:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:stream_data, "~> 1.0", [hex: :stream_data, repo: "hexpm", optional: true]}], "hexpm", "563ea3748ebfba9cc078e6d198a1d6a06015a8fae503f0b721363139f0ddb350"}, "db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dcf08f31b2701f857dfc787fbad78223d61a32204f217f15e881dd93e4bdd3ff"}, "decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"}, - "diffo": {:hex, :diffo, "0.2.0", "ac07bb5ea92d765601fba3e61e8a5dac5c3c7f18b3a55bcf3019a574fda03d65", [:mix], [{:ash, ">= 3.24.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:ash_jason, "~> 3.0", [hex: :ash_jason, repo: "hexpm", optional: false]}, {:ash_neo4j, "~> 0.3.1", [hex: :ash_neo4j, repo: "hexpm", optional: false]}, {:ash_outstanding, "~> 0.2.3", [hex: :ash_outstanding, repo: "hexpm", optional: false]}, {:ash_state_machine, "~> 0.2.12", [hex: :ash_state_machine, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:uuid, "~> 1.1", [hex: :uuid, repo: "hexpm", optional: false]}], "hexpm", "2a140d9e427e30b06b29a04eeafec8b98d7acfeaffdbfa06cf6c152998302503"}, + "diffo": {:hex, :diffo, "0.2.1", "c661fd8f648375a2df5ba551138662f5ad279237d9d55c732401f06f3d94ed02", [:mix], [{:ash, ">= 3.24.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:ash_jason, "~> 3.0", [hex: :ash_jason, repo: "hexpm", optional: false]}, {:ash_neo4j, "~> 0.4.1", [hex: :ash_neo4j, repo: "hexpm", optional: false]}, {:ash_outstanding, "~> 0.2.3", [hex: :ash_outstanding, repo: "hexpm", optional: false]}, {:ash_state_machine, "~> 0.2.12", [hex: :ash_state_machine, repo: "hexpm", optional: false]}, {:bolty, ">= 0.0.12", [hex: :bolty, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:uuid, "~> 1.1", [hex: :uuid, repo: "hexpm", optional: false]}], "hexpm", "def7037e4c3bc2c824472c45d20c12a5fd47e2509ac448900423aab36dfc8462"}, "earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"}, - "ecto": {:hex, :ecto, "3.13.5", "9d4a69700183f33bf97208294768e561f5c7f1ecf417e0fa1006e4a91713a834", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "df9efebf70cf94142739ba357499661ef5dbb559ef902b68ea1f3c1fabce36de"}, + "ecto": {:hex, :ecto, "3.13.6", "352135b474f91d1ab99a1b502171d207e9db60421c9e3d0ecab4c7ab96b24d14", [:mix], [{:decimal, "~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8afa059bc16cd2c94739ec0a11e3e5df69d828125119109bef35f20a21a76af2"}, "elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"}, "ets": {:hex, :ets, "0.9.0", "79c6a6c205436780486f72d84230c6cba2f8a9920456750ddd1e47389107d5fd", [:mix], [], "hexpm", "2861fdfb04bcaeff370f1a5904eec864f0a56dcfebe5921ea9aadf2a481c822b"}, "ex_doc": {:hex, :ex_doc, "0.40.1", "67542e4b6dde74811cfd580e2c0149b78010fd13001fda7cfeb2b2c2ffb1344d", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "bcef0e2d360d93ac19f01a85d58f91752d930c0a30e2681145feea6bd3516e00"}, @@ -24,7 +24,7 @@ "hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"}, "igniter": {:hex, :igniter, "0.7.9", "8c573440b8127fd80be8220fb197e7422317a81072054fcc0b336029f035a416", [:mix], [{:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:owl, "~> 0.11", [hex: :owl, repo: "hexpm", optional: false]}, {:phx_new, "~> 1.7", [hex: :phx_new, repo: "hexpm", optional: true]}, {:req, "~> 0.5", [hex: :req, repo: "hexpm", optional: false]}, {:rewrite, ">= 1.1.1 and < 2.0.0-0", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "123513d09f3af149db851aad8492b5b49f861d2c466a72031b2a0cbd9f45526f"}, "iterex": {:hex, :iterex, "0.1.2", "58f9b9b9a22a55cbfc7b5234a9c9c63eaac26d276b3db80936c0e1c60355a5a6", [:mix], [], "hexpm", "2e103b8bcc81757a9af121f6dc0df312c9a17220f302b1193ef720460d03029d"}, - "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "jason": {:hex, :jason, "1.4.5", "2e3a008590b0b8d7388c20293e9dcc9cf3e5d642fd2a114e4cbbb52e595d940a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b0c823996102bcd0239b3c2444eb00409b72f6a140c1950bc8b457d836b30684"}, "json_xema": {:hex, :json_xema, "0.6.5", "060459c9c9152650edb4427b1acbc61fa43a23bcea0301d200cafa76e0880f37", [:mix], [{:conv_case, "~> 0.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:xema, "~> 0.16", [hex: :xema, repo: "hexpm", optional: false]}], "hexpm", "b8ffdbc2f67aa8b91b44e1ba0ab77eb5c0b0142116f8fbb804977fb939d470ef"}, "libgraph": {:hex, :libgraph, "0.16.0", "3936f3eca6ef826e08880230f806bfea13193e49bf153f93edcf0239d4fd1d07", [:mix], [], "hexpm", "41ca92240e8a4138c30a7e06466acc709b0cbb795c643e9e17174a178982d6bf"}, "makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"}, @@ -37,12 +37,12 @@ "nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"}, "outstanding": {:hex, :outstanding, "0.2.5", "2f40416eb9617748cb1f8ae4c8ed94515d731f9c4fcee4f902355d30bc0792cc", [:mix], [], "hexpm", "bb47a210f0d2804ea6b8477fa6f4d15e8c58c18acee79d8e06c9296e6dd004cd"}, "owl": {:hex, :owl, "0.13.0", "26010e066d5992774268f3163506972ddac0a7e77bfe57fa42a250f24d6b876e", [:mix], [{:ucwidth, "~> 0.2", [hex: :ucwidth, repo: "hexpm", optional: true]}], "hexpm", "59bf9d11ce37a4db98f57cb68fbfd61593bf419ec4ed302852b6683d3d2f7475"}, - "phoenix": {:hex, :phoenix, "1.8.5", "919db335247e6d4891764dc3063415b0d2457641c5f9b3751b5df03d8e20bbcf", [:mix], [{:bandit, "~> 1.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "83b2bb125127e02e9f475c8e3e92736325b5b01b0b9b05407bcb4083b7a32485"}, + "phoenix": {:hex, :phoenix, "1.8.7", "d8d755b4ff4b449f610223dd706b4ae64155cb720d3dc09c706c079ecea189e4", [:mix], [{:bandit, "~> 1.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "47352f72d6ab31009ef77516b1b3a14745be97b54061fd458031b9d8294869d5"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.2.0", "ff3a5616e1bed6804de7773b92cbccfc0b0f473faf1f63d7daf1206c7aeaaa6f", [:mix], [], "hexpm", "adc313a5bf7136039f63cfd9668fde73bba0765e0614cba80c06ac9460ff3e96"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, "picosat_elixir": {:hex, :picosat_elixir, "0.2.3", "bf326d0f179fbb3b706bb2c15fbc367dacfa2517157d090fdfc32edae004c597", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f76c9db2dec9d2561ffaa9be35f65403d53e984e8cd99c832383b7ab78c16c66"}, "plug": {:hex, :plug, "1.19.1", "09bac17ae7a001a68ae393658aa23c7e38782be5c5c00c80be82901262c394c0", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "560a0017a8f6d5d30146916862aaf9300b7280063651dd7e532b8be168511e62"}, - "plug_cowboy": {:hex, :plug_cowboy, "2.8.0", "07789e9c03539ee51bb14a07839cc95aa96999fd8846ebfd28c97f0b50c7b612", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9cbfaaf17463334ca31aed38ea7e08a68ee37cabc077b1e9be6d2fb68e0171d0"}, + "plug_cowboy": {:hex, :plug_cowboy, "2.8.1", "5aa391a5e8d1ac3192e36a3bcaff12b5fd6ef6c7e29b53a38e63a860783e77d0", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "4c200288673d5bc86a0ab7dc6a2a069176a74e5d573ef62740a1c517458a5f26"}, "plug_crypto": {:hex, :plug_crypto, "2.1.1", "19bda8184399cb24afa10be734f84a16ea0a2bc65054e23a62bb10f06bc89491", [:mix], [], "hexpm", "6470bce6ffe41c8bd497612ffde1a7e4af67f36a15eea5f921af71cf3e11247c"}, "ranch": {:hex, :ranch, "2.2.0", "25528f82bc8d7c6152c57666ca99ec716510fe0925cb188172f41ce93117b1b0", [:make, :rebar3], [], "hexpm", "fa0b99a1780c80218a4197a59ea8d3bdae32fbff7e88527d7d8a4787eff4f8e7"}, "reactor": {:hex, :reactor, "1.0.1", "ca3b5cf3c04ec8441e67ea2625d0294939822060b1bfd00ffdaaf75b7682d991", [:mix], [{:igniter, "~> 0.4", [hex: :igniter, repo: "hexpm", optional: true]}, {:iterex, "~> 0.1", [hex: :iterex, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:libgraph, "~> 0.16", [hex: :libgraph, repo: "hexpm", optional: false]}, {:spark, ">= 2.3.3 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.2", [hex: :splode, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.2", [hex: :telemetry, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.11", [hex: :yaml_elixir, repo: "hexpm", optional: false]}, {:ymlr, "~> 5.0", [hex: :ymlr, repo: "hexpm", optional: false]}], "hexpm", "3497db2b204c9a3cabdaf1b26d2405df1dfbb138ce0ce50e616e9db19fec0043"}, @@ -50,7 +50,7 @@ "rewrite": {:hex, :rewrite, "1.3.0", "67448ba7975690b35ba7e7f35717efcce317dbd5963cb0577aa7325c1923121a", [:mix], [{:glob_ex, "~> 0.1", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.0", [hex: :sourceror, repo: "hexpm", optional: false]}, {:text_diff, "~> 0.1", [hex: :text_diff, repo: "hexpm", optional: false]}], "hexpm", "d111ac7ff3a58a802ef4f193bbd1831e00a9c57b33276e5068e8390a212714a5"}, "simple_sat": {:hex, :simple_sat, "0.1.4", "39baf72cdca14f93c0b6ce2b6418b72bbb67da98fa9ca4384e2f79bbc299899d", [:mix], [], "hexpm", "3569b68e346a5fd7154b8d14173ff8bcc829f2eb7b088c30c3f42a383443930b"}, "sourceror": {:hex, :sourceror, "1.12.0", "da354c5f35aad3cc1132f5d5b0d8437d865e2661c263260480bab51b5eedb437", [:mix], [], "hexpm", "755703683bd014ebcd5de9acc24b68fb874a660a568d1d63f8f98cd8a6ef9cd0"}, - "spark": {:hex, :spark, "2.6.1", "b0100216d3883c6a281cb2434af45afbd808695aadb034923cbaf7d8a2ba46ab", [:mix], [{:igniter, ">= 0.3.64 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:sourceror, "~> 1.2", [hex: :sourceror, repo: "hexpm", optional: true]}], "hexpm", "77bbefa5263bb6b70e1195bc0fc662ddb8ef5937a356a77ae072e56983ad13f0"}, + "spark": {:hex, :spark, "2.7.0", "e685b33c038f12851993880bb7e3b326117612eb746fe15828678c152f8321c6", [:mix], [{:igniter, ">= 0.3.64 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:sourceror, "~> 1.2", [hex: :sourceror, repo: "hexpm", optional: true]}], "hexpm", "e2f675fbda32375b01d9ee7c652671531027fd043bf4a91bafdb2ab716aa1122"}, "spitfire": {:hex, :spitfire, "0.3.11", "79dfcb033762470de472c1c26ea2b4e3aca74700c685dbffd9a13466272c323d", [:mix], [], "hexpm", "eb6e2dadf63214e8bfe65ca9788cef2b03b01027365d78d3c0e3d9ebd3d5b7b4"}, "splode": {:hex, :splode, "0.3.1", "9843c54f84f71b7833fec3f0be06c3cfb5be6b35960ee195ea4fad84b1c25030", [:mix], [], "hexpm", "8f2309b6ec2ecbb01435656429ed1d9ed04ba28797a3280c3b0d1217018ecfbd"}, "stream_data": {:hex, :stream_data, "1.3.0", "bde37905530aff386dea1ddd86ecbf00e6642dc074ceffc10b7d4e41dfd6aac9", [:mix], [], "hexpm", "3cc552e286e817dca43c98044c706eec9318083a1480c52ae2688b08e2936e3c"}, diff --git a/test/access/cable_test.exs b/test/access/cable_test.exs index 7de3e57..56b637c 100644 --- a/test/access/cable_test.exs +++ b/test/access/cable_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExample.Access.CableTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true alias Diffo.Provider.Specification alias Diffo.Provider.Characteristic alias Diffo.Provider.Assignment @@ -13,14 +13,9 @@ defmodule DiffoExample.Access.CableTest do alias DiffoExample.Access.IntegerUnit alias DiffoExample.Test.Characteristics - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end describe "build cable" do @@ -63,7 +58,7 @@ defmodule DiffoExample.Access.CableTest do encoding = Jason.encode!(cable) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":1,\"free\":1,\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"description\":\"A Cable Resource Instance\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":1,\"free\":1,\"algorithm\":\"lowest\"}}]}) end test "define cable" do @@ -79,7 +74,7 @@ defmodule DiffoExample.Access.CableTest do encoding = Jason.encode!(cable) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":60,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"description\":\"A Cable Resource Instance\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":60,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) end test "auto assign pair to service" do @@ -104,7 +99,7 @@ defmodule DiffoExample.Access.CableTest do encoding = Jason.encode!(cable) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":1}]}],\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":59,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"description\":\"A Cable Resource Instance\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":1}]}],\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":59,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) end test "auto assign two pairs to same service" do @@ -134,7 +129,7 @@ defmodule DiffoExample.Access.CableTest do encoding = Jason.encode!(cable) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":1}]},{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":2}]}],\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":58,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"description\":\"A Cable Resource Instance\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":1}]},{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":2}]}],\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":58,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) end test "specific assignment rejects duplicate request" do @@ -164,7 +159,7 @@ defmodule DiffoExample.Access.CableTest do encoding = Jason.encode!(cable) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":5}]}],\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":59,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{cable.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{cable.id}",\"category\":\"Network Resource\",\"description\":\"A Cable Resource Instance\",\"resourceSpecification\":{\"id\":\"ce0a567a-6abb-4862-9e33-851fd79fa595\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ce0a567a-6abb-4862-9e33-851fd79fa595\",\"name\":\"cable\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"pair\",\"value\":5}]}],\"resourceCharacteristic\":[{\"name\":\"cable\",\"value\":{\"pairs\":60,\"length\":{\"amount\":600,\"unit\":\"m\"},\"technology\":\"PIUT\"}},{\"name\":\"pairs\",\"value\":{\"first\":1,\"last\":60,\"free\":59,\"type\":\"copper\",\"algorithm\":\"lowest\"}}]}) end end end diff --git a/test/access/card_test.exs b/test/access/card_test.exs index 67d1942..534db52 100644 --- a/test/access/card_test.exs +++ b/test/access/card_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExample.Access.CardTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true alias Diffo.Provider.Specification alias Diffo.Provider.Characteristic alias Diffo.Provider.Assignment @@ -12,14 +12,9 @@ defmodule DiffoExample.Access.CardTest do alias DiffoExample.Access.Card alias DiffoExample.Test.Characteristics - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end describe "build card" do @@ -62,7 +57,7 @@ defmodule DiffoExample.Access.CardTest do encoding = Jason.encode!(card) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":1,\"free\":1,\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"description\":\"A Card Resource Instance\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":1,\"free\":1,\"algorithm\":\"lowest\"}}]}) end test "define card" do @@ -78,7 +73,7 @@ defmodule DiffoExample.Access.CardTest do encoding = Jason.encode!(card) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":48,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"description\":\"A Card Resource Instance\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":48,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) end test "auto assign port to service" do @@ -103,7 +98,7 @@ defmodule DiffoExample.Access.CardTest do encoding = Jason.encode!(card) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":1}]}],\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":47,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"description\":\"A Card Resource Instance\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":1}]}],\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":47,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) end test "auto assign two ports to same service" do @@ -133,7 +128,7 @@ defmodule DiffoExample.Access.CardTest do encoding = Jason.encode!(card) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":1}]},{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":2}]}],\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":46,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"description\":\"A Card Resource Instance\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":1}]},{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":2}]}],\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":46,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) end test "specific assignment rejects duplicate request" do @@ -163,7 +158,7 @@ defmodule DiffoExample.Access.CardTest do encoding = Jason.encode!(card) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":5}]}],\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":47,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) + ~s({\"id\":\"#{card.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{card.id}",\"category\":\"Network Resource\",\"description\":\"A Card Resource Instance\",\"resourceSpecification\":{\"id\":\"cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/cd29956f-6c68-44cc-bf54-705eb8d2f754\",\"name\":\"card\",\"version\":\"v1.0.0\"},\"serviceRelationship\":[{\"type\":\"assignedTo\",\"service\":{\"id\":\"#{assignee.id}\",\"href\":\"serviceInventoryManagement/v4/service/#{assignee.id}\"},\"serviceRelationshipCharacteristic\":[{\"name\":\"port\",\"value\":5}]}],\"resourceCharacteristic\":[{\"name\":\"card\",\"value\":{\"family\":\"ISAM\",\"model\":\"EBLT48\",\"technology\":\"adsl2Plus\"}},{\"name\":\"ports\",\"value\":{\"first\":1,\"last\":48,\"free\":47,\"type\":\"ADSL2+\",\"algorithm\":\"lowest\"}}]}) end end end diff --git a/test/access/characteristic_value_test.exs b/test/access/characteristic_value_test.exs index 5ac058e..177b7cd 100644 --- a/test/access/characteristic_value_test.exs +++ b/test/access/characteristic_value_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExample.Access.CharacteristicValueTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true alias DiffoExample.Access.AggregateInterface alias DiffoExample.Access.Circuit alias DiffoExample.Access.Dslam @@ -12,14 +12,9 @@ defmodule DiffoExample.Access.CharacteristicValueTest do alias DiffoExample.Access.BandwidthProfile alias Diffo.Type.Value - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end @dslam "QDONC0001" diff --git a/test/access/dsl_access_test.exs b/test/access/dsl_access_test.exs index 58818f7..13f14dd 100644 --- a/test/access/dsl_access_test.exs +++ b/test/access/dsl_access_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExample.Access.DslAccessTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true alias Diffo.Provider alias Diffo.Provider.Specification alias Diffo.Provider.Feature @@ -16,14 +16,9 @@ defmodule DiffoExample.Access.DslAccessTest do alias DiffoExample.Test.Parties alias DiffoExample.Test.Places - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end describe "service qualification" do @@ -106,7 +101,7 @@ defmodule DiffoExample.Access.DslAccessTest do encoding = Jason.encode!(dsl_access) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{dsl_access.id}",\"href\":\"serviceInventoryManagement/v4/service/#{dsl_access.id}\",\"category\":\"Network Service\",\"serviceSpecification\":{\"id\":\"da9b207a-26c3-451d-8abd-0640c6349979\",\"href\":\"serviceCatalogManagement/v4/serviceSpecification/da9b207a-26c3-451d-8abd-0640c6349979\",\"name\":\"dslAccess\",\"version\":\"v1.0.0\"},\"serviceDate\":\"now\",\"state\":\"initial\",\"feature\":[{\"name\":\"dynamic_line_management\",\"isEnabled\":true,\"featureCharacteristic\":[{\"name\":\"constraints\",\"value\":{}}]}],\"serviceCharacteristic\":[{\"name\":\"aggregate_interface\",\"value\":{\"physicalLayer\":\"GbE\",\"linkLayer\":\"QinQ\",\"svlanId\":0,\"VPI\":0}},{\"name\":\"circuit\",\"value\":{\"cvlan_id\":0,\"VCI\":0,\"encapsulation\":\"IPoE\"}},{\"name\":\"dslam\",\"value\":{\"family\":\"ISAM\",\"technology\":\"eth\"}},{\"name\":\"line\",\"value\":{\"standard\":\"ADSL2plus\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"IND000000897354\",\"name\":\"individualId\",\"role\":\"Customer\",\"@referredType\":\"Individual\",\"@type\":\"PartyRef\"},{\"id\":\"ORG000000123456\",\"name\":\"organizationId\",\"role\":\"Reseller\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{dsl_access.id}",\"href\":\"serviceInventoryManagement/v4/service/#{dsl_access.id}\",\"category\":\"Network Service\",\"description\":\"A DSL Access Network Service connecting a subscriber premises to an NNI\",\"serviceSpecification\":{\"id\":\"da9b207a-26c3-451d-8abd-0640c6349979\",\"href\":\"serviceCatalogManagement/v4/serviceSpecification/da9b207a-26c3-451d-8abd-0640c6349979\",\"name\":\"dslAccess\",\"version\":\"v1.0.0\"},\"serviceDate\":\"now\",\"state\":\"initial\",\"feature\":[{\"name\":\"dynamic_line_management\",\"isEnabled\":true,\"featureCharacteristic\":[{\"name\":\"constraints\",\"value\":{}}]}],\"serviceCharacteristic\":[{\"name\":\"aggregate_interface\",\"value\":{\"physicalLayer\":\"GbE\",\"linkLayer\":\"QinQ\",\"svlanId\":0,\"VPI\":0}},{\"name\":\"circuit\",\"value\":{\"cvlan_id\":0,\"VCI\":0,\"encapsulation\":\"IPoE\"}},{\"name\":\"dslam\",\"value\":{\"family\":\"ISAM\",\"technology\":\"eth\"}},{\"name\":\"line\",\"value\":{\"standard\":\"ADSL2plus\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"IND000000897354\",\"name\":\"individualId\",\"role\":\"Customer\",\"@referredType\":\"Individual\",\"@type\":\"PartyRef\"},{\"id\":\"ORG000000123456\",\"name\":\"organizationId\",\"role\":\"Reseller\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end test "advance service to feasibilityChecked" do @@ -134,7 +129,7 @@ defmodule DiffoExample.Access.DslAccessTest do encoding = Jason.encode!(dsl_access) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{dsl_access.id}",\"href\":\"serviceInventoryManagement/v4/service/#{dsl_access.id}\",\"category\":\"Network Service\",\"serviceSpecification\":{\"id\":\"da9b207a-26c3-451d-8abd-0640c6349979\",\"href\":\"serviceCatalogManagement/v4/serviceSpecification/da9b207a-26c3-451d-8abd-0640c6349979\",\"name\":\"dslAccess\",\"version\":\"v1.0.0\"},\"serviceDate\":\"now\",\"state\":\"feasibilityChecked\",\"operatingStatus\":\"feasible\",\"feature\":[{\"name\":\"dynamic_line_management\",\"isEnabled\":true,\"featureCharacteristic\":[{\"name\":\"constraints\",\"value\":{}}]}],\"serviceCharacteristic\":[{\"name\":\"aggregate_interface\",\"value\":{\"physicalLayer\":\"GbE\",\"linkLayer\":\"QinQ\",\"svlanId\":0,\"VPI\":0}},{\"name\":\"circuit\",\"value\":{\"cvlan_id\":0,\"VCI\":0,\"encapsulation\":\"IPoE\"}},{\"name\":\"dslam\",\"value\":{\"family\":\"ISAM\",\"technology\":\"eth\"}},{\"name\":\"line\",\"value\":{\"standard\":\"ADSL2plus\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"IND000000897354\",\"name\":\"individualId\",\"role\":\"Customer\",\"@referredType\":\"Individual\",\"@type\":\"PartyRef\"},{\"id\":\"ORG000000123456\",\"name\":\"organizationId\",\"role\":\"Reseller\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{dsl_access.id}",\"href\":\"serviceInventoryManagement/v4/service/#{dsl_access.id}\",\"category\":\"Network Service\",\"description\":\"A DSL Access Network Service connecting a subscriber premises to an NNI\",\"serviceSpecification\":{\"id\":\"da9b207a-26c3-451d-8abd-0640c6349979\",\"href\":\"serviceCatalogManagement/v4/serviceSpecification/da9b207a-26c3-451d-8abd-0640c6349979\",\"name\":\"dslAccess\",\"version\":\"v1.0.0\"},\"serviceDate\":\"now\",\"state\":\"feasibilityChecked\",\"operatingStatus\":\"feasible\",\"feature\":[{\"name\":\"dynamic_line_management\",\"isEnabled\":true,\"featureCharacteristic\":[{\"name\":\"constraints\",\"value\":{}}]}],\"serviceCharacteristic\":[{\"name\":\"aggregate_interface\",\"value\":{\"physicalLayer\":\"GbE\",\"linkLayer\":\"QinQ\",\"svlanId\":0,\"VPI\":0}},{\"name\":\"circuit\",\"value\":{\"cvlan_id\":0,\"VCI\":0,\"encapsulation\":\"IPoE\"}},{\"name\":\"dslam\",\"value\":{\"family\":\"ISAM\",\"technology\":\"eth\"}},{\"name\":\"line\",\"value\":{\"standard\":\"ADSL2plus\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"IND000000897354\",\"name\":\"individualId\",\"role\":\"Customer\",\"@referredType\":\"Individual\",\"@type\":\"PartyRef\"},{\"id\":\"ORG000000123456\",\"name\":\"organizationId\",\"role\":\"Reseller\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end end @@ -175,7 +170,7 @@ defmodule DiffoExample.Access.DslAccessTest do encoding = Jason.encode!(dsl_access) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{dsl_access.id}",\"href\":\"serviceInventoryManagement/v4/service/#{dsl_access.id}\",\"category\":\"Network Service\",\"serviceSpecification\":{\"id\":\"da9b207a-26c3-451d-8abd-0640c6349979\",\"href\":\"serviceCatalogManagement/v4/serviceSpecification/da9b207a-26c3-451d-8abd-0640c6349979\",\"name\":\"dslAccess\",\"version\":\"v1.0.0\"},\"serviceDate\":\"now\",\"state\":\"reserved\",\"operatingStatus\":\"feasible\",\"feature\":[{\"name\":\"dynamic_line_management\",\"isEnabled\":true,\"featureCharacteristic\":[{\"name\":\"constraints\",\"value\":{}}]}],\"serviceCharacteristic\":[{\"name\":\"aggregate_interface\",\"value\":{\"name\":\"eth0\",\"physicalLayer\":\"GbE\",\"linkLayer\":\"QinQ\",\"svlanId\":3108,\"VPI\":0}},{\"name\":\"circuit\",\"value\":{\"cvlan_id\":82,\"VCI\":0,\"encapsulation\":\"IPoE\"}},{\"name\":\"dslam\",\"value\":{\"name\":\"QDONC0001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"eth\"}},{\"name\":\"line\",\"value\":{\"port\":5,\"slot\":10,\"standard\":\"ADSL2plus\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"IND000000897354\",\"name\":\"individualId\",\"role\":\"Customer\",\"@referredType\":\"Individual\",\"@type\":\"PartyRef\"},{\"id\":\"ORG000000123456\",\"name\":\"organizationId\",\"role\":\"Reseller\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{dsl_access.id}",\"href\":\"serviceInventoryManagement/v4/service/#{dsl_access.id}\",\"category\":\"Network Service\",\"description\":\"A DSL Access Network Service connecting a subscriber premises to an NNI\",\"serviceSpecification\":{\"id\":\"da9b207a-26c3-451d-8abd-0640c6349979\",\"href\":\"serviceCatalogManagement/v4/serviceSpecification/da9b207a-26c3-451d-8abd-0640c6349979\",\"name\":\"dslAccess\",\"version\":\"v1.0.0\"},\"serviceDate\":\"now\",\"state\":\"reserved\",\"operatingStatus\":\"feasible\",\"feature\":[{\"name\":\"dynamic_line_management\",\"isEnabled\":true,\"featureCharacteristic\":[{\"name\":\"constraints\",\"value\":{}}]}],\"serviceCharacteristic\":[{\"name\":\"aggregate_interface\",\"value\":{\"name\":\"eth0\",\"physicalLayer\":\"GbE\",\"linkLayer\":\"QinQ\",\"svlanId\":3108,\"VPI\":0}},{\"name\":\"circuit\",\"value\":{\"cvlan_id\":82,\"VCI\":0,\"encapsulation\":\"IPoE\"}},{\"name\":\"dslam\",\"value\":{\"name\":\"QDONC0001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"eth\"}},{\"name\":\"line\",\"value\":{\"port\":5,\"slot\":10,\"standard\":\"ADSL2plus\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"IND000000897354\",\"name\":\"individualId\",\"role\":\"Customer\",\"@referredType\":\"Individual\",\"@type\":\"PartyRef\"},{\"id\":\"ORG000000123456\",\"name\":\"organizationId\",\"role\":\"Reseller\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end end @@ -185,7 +180,7 @@ defmodule DiffoExample.Access.DslAccessTest do id: "1657363", name: :addressId, href: "place/telco/1657363", - referredType: :GeographicAddress + referred_type: :GeographicAddress }) %Place{id: z_end.id, role: :CustomerSite} @@ -197,7 +192,7 @@ defmodule DiffoExample.Access.DslAccessTest do id: "DONC-0001", name: :esaId, href: "place/telco/DONC-0001", - referredType: :GeographicLocation + referred_type: :GeographicLocation }) %Place{id: esa.id, role: :ServingArea} @@ -208,14 +203,14 @@ defmodule DiffoExample.Access.DslAccessTest do Provider.create_party!(%{ id: "IND000000897354", name: :individualId, - referredType: :Individual + referred_type: :Individual }) org = Provider.create_party!(%{ id: "ORG000000123456", name: :organizationId, - referredType: :Organization + referred_type: :Organization }) [%Party{id: individual.id, role: :Customer}, %Party{id: org.id, role: :Reseller}] diff --git a/test/access/path_test.exs b/test/access/path_test.exs index 9ddde4e..a349341 100644 --- a/test/access/path_test.exs +++ b/test/access/path_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExample.Access.PathTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true alias Diffo.Provider alias Diffo.Provider.Specification alias Diffo.Provider.Characteristic @@ -17,14 +17,9 @@ defmodule DiffoExample.Access.PathTest do alias DiffoExample.Test.Parties alias DiffoExample.Test.Places - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end describe "build path" do @@ -74,7 +69,7 @@ defmodule DiffoExample.Access.PathTest do encoding = Jason.encode!(path) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{path.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{path.id}",\"category\":\"Network Resource\",\"name\":\"82 Rathmullen - DONC\",\"resourceSpecification\":{\"id\":\"1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"name\":\"path\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"path\",\"value\":{\"sections\":0}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC\",\"href\":\"place/telco/DONC\",\"name\":\"exchangeId\",\"role\":\"NetworkSite\",\"@referredType\":\"GeographicSite\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{path.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{path.id}",\"category\":\"Network Resource\",\"description\":\"A Path Resource Instance\",\"name\":\"82 Rathmullen - DONC\",\"resourceSpecification\":{\"id\":\"1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"name\":\"path\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"path\",\"value\":{\"sections\":0}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC\",\"href\":\"place/telco/DONC\",\"name\":\"exchangeId\",\"role\":\"NetworkSite\",\"@referredType\":\"GeographicSite\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end end @@ -94,7 +89,7 @@ defmodule DiffoExample.Access.PathTest do encoding = Jason.encode!(path) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{path.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{path.id}",\"category\":\"Network Resource\",\"name\":\"82 Rathmullen - DONC\",\"resourceSpecification\":{\"id\":\"1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"name\":\"path\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"path\",\"value\":{\"name\":\"82 Rathmullen - DONC\",\"sections\":0,\"technology\":\"copper\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC\",\"href\":\"place/telco/DONC\",\"name\":\"exchangeId\",\"role\":\"NetworkSite\",\"@referredType\":\"GeographicSite\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{path.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{path.id}",\"category\":\"Network Resource\",\"description\":\"A Path Resource Instance\",\"name\":\"82 Rathmullen - DONC\",\"resourceSpecification\":{\"id\":\"1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"name\":\"path\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"path\",\"value\":{\"name\":\"82 Rathmullen - DONC\",\"sections\":0,\"technology\":\"copper\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC\",\"href\":\"place/telco/DONC\",\"name\":\"exchangeId\",\"role\":\"NetworkSite\",\"@referredType\":\"GeographicSite\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end test "relate cables and dslam" do @@ -138,7 +133,7 @@ defmodule DiffoExample.Access.PathTest do # the reverse relationships are not encoded to json assert encoding == - ~s({\"id\":\"#{path.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{path.id}",\"category\":\"Network Resource\",\"name\":\"82 Rathmullen - DONC\",\"resourceSpecification\":{\"id\":\"1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"name\":\"path\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"path\",\"value\":{\"name\":\"82 Rathmullen - DONC\",\"sections\":0,\"technology\":\"copper\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC\",\"href\":\"place/telco/DONC\",\"name\":\"exchangeId\",\"role\":\"NetworkSite\",\"@referredType\":\"GeographicSite\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{path.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{path.id}",\"category\":\"Network Resource\",\"description\":\"A Path Resource Instance\",\"name\":\"82 Rathmullen - DONC\",\"resourceSpecification\":{\"id\":\"1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/1d507914-8f76-48cb-aa0e-3a8f92951ab0\",\"name\":\"path\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"path\",\"value\":{\"name\":\"82 Rathmullen - DONC\",\"sections\":0,\"technology\":\"copper\"}}],\"place\":[{\"id\":\"1657363\",\"href\":\"place/telco/1657363\",\"name\":\"addressId\",\"role\":\"CustomerSite\",\"@referredType\":\"GeographicAddress\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC\",\"href\":\"place/telco/DONC\",\"name\":\"exchangeId\",\"role\":\"NetworkSite\",\"@referredType\":\"GeographicSite\",\"@type\":\"PlaceRef\"},{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end defp create_customer_place do @@ -147,7 +142,7 @@ defmodule DiffoExample.Access.PathTest do id: "1657363", name: :addressId, href: "place/telco/1657363", - referredType: :GeographicAddress + referred_type: :GeographicAddress }) %Place{id: z_end.id, role: :CustomerSite} @@ -159,7 +154,7 @@ defmodule DiffoExample.Access.PathTest do id: "DONC-0001", name: :esaId, href: "place/telco/DONC-0001", - referredType: :GeographicLocation + referred_type: :GeographicLocation }) %Place{id: esa.id, role: :ServingArea} @@ -171,7 +166,7 @@ defmodule DiffoExample.Access.PathTest do id: "DONC", name: :exchangeId, href: "place/telco/DONC", - referredType: :GeographicSite + referred_type: :GeographicSite }) %Place{id: exchange.id, role: :NetworkSite} @@ -233,7 +228,7 @@ defmodule DiffoExample.Access.PathTest do Provider.create_party!(%{ id: "Access", name: :organizationId, - referredType: :Organization + referred_type: :Organization }) %Party{id: provider.id, role: :Provider} diff --git a/test/access/shelf_test.exs b/test/access/shelf_test.exs index 977d4f5..61de0d2 100644 --- a/test/access/shelf_test.exs +++ b/test/access/shelf_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExample.Access.ShelfTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true alias Diffo.Provider alias Diffo.Provider.Specification alias Diffo.Provider.Characteristic @@ -18,14 +18,9 @@ defmodule DiffoExample.Access.ShelfTest do alias DiffoExample.Test.Parties alias DiffoExample.Test.Places - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end describe "build shelf" do @@ -74,7 +69,7 @@ defmodule DiffoExample.Access.ShelfTest do encoding = Jason.encode!(shelf) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"name\":\"QDONC-0001\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":1,\"free\":1,\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"description\":\"A Shelf Resource Instance which contain cards\",\"name\":\"QDONC-0001\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":1,\"free\":1,\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end end @@ -93,7 +88,7 @@ defmodule DiffoExample.Access.ShelfTest do encoding = Jason.encode!(shelf) |> Diffo.Util.summarise_dates() assert encoding == - ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"name\":\"QDONC-0001\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{\"name\":\"QDONC-1001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"DSLAM\"}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":10,\"free\":10,\"type\":\"LineCard\",\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"description\":\"A Shelf Resource Instance which contain cards\",\"name\":\"QDONC-0001\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{\"name\":\"QDONC-1001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"DSLAM\"}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":10,\"free\":10,\"type\":\"LineCard\",\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end test "relate common cards" do @@ -119,7 +114,7 @@ defmodule DiffoExample.Access.ShelfTest do # resource relationships are sorted in the create order of the relationships assert encoding == - ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceRelationship\":[{\"type\":\"contains\",\"resource\":{\"id\":\"#{card0.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card0.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card1.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card1.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card2.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card2.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card3.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card3.id}\"}}],\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{\"name\":\"QDONC-1001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"DSLAM\"}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":10,\"free\":10,\"type\":\"LineCard\",\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"description\":\"A Shelf Resource Instance which contain cards\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceRelationship\":[{\"type\":\"contains\",\"resource\":{\"id\":\"#{card0.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card0.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card1.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card1.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card2.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card2.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card3.id}\",\"href\":\"resourceInventoryManagement/v4/resource/#{card3.id}\"}}],\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{\"name\":\"QDONC-1001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"DSLAM\"}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":10,\"free\":10,\"type\":\"LineCard\",\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end test "auto assign line cards" do @@ -148,7 +143,7 @@ defmodule DiffoExample.Access.ShelfTest do lc2 = line_card2.assignee_id assert encoding == - ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"name\":\"QDONC-0001\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceRelationship\":[{\"type\":\"assignedTo\",\"resource\":{\"id\":\"#{lc1}\",\"href\":\"resourceInventoryManagement/v4/resource/#{lc1}\"},\"resourceRelationshipCharacteristic\":[{\"name\":\"slot\",\"value\":1}]},{\"type\":\"assignedTo\",\"resource\":{\"id\":\"#{lc2}\",\"href\":\"resourceInventoryManagement/v4/resource/#{lc2}\"},\"resourceRelationshipCharacteristic\":[{\"name\":\"slot\",\"value\":2}]}],\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{\"name\":\"QDONC-1001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"DSLAM\"}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":10,\"free\":8,\"type\":\"LineCard\",\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) + ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/#{shelf.id}",\"category\":\"Network Resource\",\"description\":\"A Shelf Resource Instance which contain cards\",\"name\":\"QDONC-0001\",\"resourceSpecification\":{\"id\":\"ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"href\":\"resourceCatalogManagement/v4/resourceSpecification/ef016d85-9dbd-429c-84da-1df56cc7dda5\",\"name\":\"shelf\",\"version\":\"v1.0.0\"},\"resourceRelationship\":[{\"type\":\"assignedTo\",\"resource\":{\"id\":\"#{lc1}\",\"href\":\"resourceInventoryManagement/v4/resource/#{lc1}\"},\"resourceRelationshipCharacteristic\":[{\"name\":\"slot\",\"value\":1}]},{\"type\":\"assignedTo\",\"resource\":{\"id\":\"#{lc2}\",\"href\":\"resourceInventoryManagement/v4/resource/#{lc2}\"},\"resourceRelationshipCharacteristic\":[{\"name\":\"slot\",\"value\":2}]}],\"resourceCharacteristic\":[{\"name\":\"shelf\",\"value\":{\"name\":\"QDONC-1001\",\"family\":\"ISAM\",\"model\":\"ISAM7330\",\"technology\":\"DSLAM\"}},{\"name\":\"slots\",\"value\":{\"first\":1,\"last\":10,\"free\":8,\"type\":\"LineCard\",\"algorithm\":\"lowest\"}}],\"place\":[{\"id\":\"DONC-0001\",\"href\":\"place/telco/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end defp create_common_cards() do @@ -179,7 +174,7 @@ defmodule DiffoExample.Access.ShelfTest do id: "DONC-0001", name: :esaId, href: "place/telco/DONC-0001", - referredType: :GeographicLocation + referred_type: :GeographicLocation }) %Place{id: esa.id, role: :ServingArea} @@ -190,7 +185,7 @@ defmodule DiffoExample.Access.ShelfTest do Provider.create_party!(%{ id: "Access", name: :organizationId, - referredType: :Organization + referred_type: :Organization }) %Party{id: provider.id, role: :Provider} diff --git a/test/diffo_example_test.exs b/test/diffo_example_test.exs index 61a86e7..c7c6b83 100644 --- a/test/diffo_example_test.exs +++ b/test/diffo_example_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExampleTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true doctest DiffoExample.Access.Util doctest DiffoExample.Nbn.Util doctest DiffoExample.Nbn.Speeds diff --git a/test/nbn/nbn_ethernet_test.exs b/test/nbn/nbn_ethernet_test.exs index 86abbf8..fb6b8e8 100644 --- a/test/nbn/nbn_ethernet_test.exs +++ b/test/nbn/nbn_ethernet_test.exs @@ -4,7 +4,7 @@ defmodule DiffoExample.Nbn.NbnEthernetTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true alias Diffo.Provider.Specification alias Diffo.Provider.Characteristic alias DiffoExample.Nbn @@ -19,14 +19,9 @@ defmodule DiffoExample.Nbn.NbnEthernetTest do alias Diffo.Provider.Assignment alias Diffo.Provider.Instance.Relationship - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end describe "build nbn_ethernet" do @@ -69,7 +64,7 @@ defmodule DiffoExample.Nbn.NbnEthernetTest do encoding = Jason.encode!(access) |> Diffo.Util.summarise_dates() assert encoding == - ~s({"id":"#{access.id}","href":"resourceInventoryManagement/v4/resource/#{access.id}","category":"Network Resource",\"name\":\"#{access.name}","resourceSpecification":{"id":"f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","href":"resourceCatalogManagement/v4/resourceSpecification/f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","name":"nbnEthernet","version":"v1.0.0"},"resourceCharacteristic":[{"name":"pri","value":{}}]}) + ~s({"id":"#{access.id}","href":"resourceInventoryManagement/v4/resource/#{access.id}","category":"Network Resource","description":"An NBN Ethernet access comprising a dedicated UNI and AVC",\"name\":\"#{access.name}","resourceSpecification":{"id":"f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","href":"resourceCatalogManagement/v4/resourceSpecification/f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","name":"nbnEthernet","version":"v1.0.0"},"resourceCharacteristic":[{"name":"pri","value":{}}]}) end test "define nbn_ethernet access" do @@ -155,7 +150,7 @@ defmodule DiffoExample.Nbn.NbnEthernetTest do encoding = Jason.encode!(access) |> Diffo.Util.summarise_dates() assert encoding == - ~s({"id":"#{access.id}","href":"resourceInventoryManagement/v4/resource/#{access.id}","category":"Network Resource","name":"#{access.name}","resourceSpecification":{"id":"f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","href":"resourceCatalogManagement/v4/resourceSpecification/f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","name":"nbnEthernet","version":"v1.0.0"},"resourceRelationship":[{"alias":"avc","type":"owns","resource":{"id":"#{avc.id}","href":"resourceInventoryManagement/v4/resource/#{avc.id}"}},{"alias":"uni","type":"owns","resource":{"id\":"#{uni.id}","href":"resourceInventoryManagement/v4/resource/#{uni.id}"}}],"supportingResource":[{"id":"avc","href":"resourceInventoryManagement/v4/resource/#{avc.id}"},{"id\":"uni","href":"resourceInventoryManagement/v4/resource/#{uni.id}"}],"resourceCharacteristic":[{"name":"pri","value":{"AVCID":"#{avc.name}","UNIID":"#{uni.name}","technology":"FTTP","bandwidthProfile":"home_fast","speeds":[500,50]}}]}) + ~s({"id":"#{access.id}","href":"resourceInventoryManagement/v4/resource/#{access.id}","category":"Network Resource","description":"An NBN Ethernet access comprising a dedicated UNI and AVC","name":"#{access.name}","resourceSpecification":{"id":"f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","href":"resourceCatalogManagement/v4/resourceSpecification/f2a4c6e8-1b3d-4f5a-8c7e-9d0b2e4f6a8c","name":"nbnEthernet","version":"v1.0.0"},"resourceRelationship":[{"alias":"avc","type":"owns","resource":{"id":"#{avc.id}","href":"resourceInventoryManagement/v4/resource/#{avc.id}"}},{"alias":"uni","type":"owns","resource":{"id\":"#{uni.id}","href":"resourceInventoryManagement/v4/resource/#{uni.id}"}}],"supportingResource":[{"id":"avc","href":"resourceInventoryManagement/v4/resource/#{avc.id}"},{"id\":"uni","href":"resourceInventoryManagement/v4/resource/#{uni.id}"}],"resourceCharacteristic":[{"name":"pri","value":{"AVCID":"#{avc.name}","UNIID":"#{uni.name}","technology":"FTTP","bandwidthProfile":"home_fast","speeds":[500,50]}}]}) end end diff --git a/test/nbn/rsp_test.exs b/test/nbn/rsp_test.exs index e009225..20825d4 100644 --- a/test/nbn/rsp_test.exs +++ b/test/nbn/rsp_test.exs @@ -4,18 +4,13 @@ defmodule DiffoExample.Nbn.RspTest do @moduledoc false - use ExUnit.Case + use ExUnit.Case, async: true, async: true alias DiffoExample.Nbn alias DiffoExample.Nbn.Rsp - setup_all do - AshNeo4j.BoltyHelper.start() - end - setup do - on_exit(fn -> - AshNeo4j.Neo4jHelper.delete_all() - end) + AshNeo4j.Sandbox.checkout() + on_exit(&AshNeo4j.Sandbox.rollback/0) end defp create_rsp(attrs) do @@ -26,11 +21,11 @@ defmodule DiffoExample.Nbn.RspTest do describe "RSP resource" do test "create and activate an RSP" do - {:ok, rsp} = Nbn.create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, epid: "8001"}) + {:ok, rsp} = Nbn.create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, id: "8001"}) assert is_struct(rsp, Rsp) assert rsp.state == :inactive - assert rsp.epid == "8001" + assert rsp.id == "8001" assert rsp.short_name == :wedgetail {:ok, rsp} = Nbn.activate_rsp(rsp) @@ -38,7 +33,7 @@ defmodule DiffoExample.Nbn.RspTest do end test "RSP state machine: activate → suspend → deactivate" do - {:ok, rsp} = Nbn.create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, epid: "8001"}) + {:ok, rsp} = Nbn.create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, id: "8001"}) {:ok, rsp} = Nbn.activate_rsp(rsp) assert rsp.state == :active @@ -50,22 +45,22 @@ defmodule DiffoExample.Nbn.RspTest do assert rsp.state == :inactive end - test "epid must be exactly 4 digits" do - assert {:error, _} = Nbn.create_rsp(%{name: "Bad RSP", short_name: :bad, epid: "123"}) - assert {:error, _} = Nbn.create_rsp(%{name: "Bad RSP", short_name: :bad, epid: "12345"}) - assert {:error, _} = Nbn.create_rsp(%{name: "Bad RSP", short_name: :bad, epid: "abcd"}) + test "id must be a four-digit EPID" do + assert {:error, _} = Nbn.create_rsp(%{name: "Bad RSP", short_name: :bad, id: "123"}) + assert {:error, _} = Nbn.create_rsp(%{name: "Bad RSP", short_name: :bad, id: "12345"}) + assert {:error, _} = Nbn.create_rsp(%{name: "Bad RSP", short_name: :bad, id: "abcd"}) end test "get RSP by short_name" do - create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, epid: "8001"}) + create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, id: "8001"}) {:ok, rsp} = Nbn.get_rsp_by_short_name(:wedgetail) assert rsp.short_name == :wedgetail - assert rsp.epid == "8001" + assert rsp.id == "8001" end test "get RSP by epid" do - create_rsp(%{name: "Quokka Connect", short_name: :quokka, epid: "8002"}) + create_rsp(%{name: "Quokka Connect", short_name: :quokka, id: "8002"}) {:ok, rsp} = Nbn.get_rsp_by_epid("8002") assert rsp.short_name == :quokka @@ -74,8 +69,8 @@ defmodule DiffoExample.Nbn.RspTest do describe "RSP multi-tenancy" do setup do - wedgetail = create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, epid: "8001"}) - quokka = create_rsp(%{name: "Quokka Connect", short_name: :quokka, epid: "8002"}) + wedgetail = create_rsp(%{name: "Wedge-tail Telecom", short_name: :wedgetail, id: "8001"}) + quokka = create_rsp(%{name: "Quokka Connect", short_name: :quokka, id: "8002"}) %{wedgetail: wedgetail, quokka: quokka} end diff --git a/test/test_helper.exs b/test/test_helper.exs index 35444cb..7b3a5b5 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -3,7 +3,8 @@ # SPDX-License-Identifier: MIT Mix.Task.run("app.start") -ExUnit.start() level = Application.get_env(:logger, :console) |> Keyword.get(:level) Logger.put_application_level(:diffo, level) Logger.put_application_level(:ash_neo4j, :error) +AshNeo4j.Neo4jHelper.delete_all() +ExUnit.start()