diff --git a/.formatter.exs b/.formatter.exs index 5d748fa..f710659 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + # Used by "mix format" locals_without_parens = [ id: 1, diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea7..1ed04de 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,3 +1,9 @@ + + --- name: Bug report about: Create a report to help us improve diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7..180face 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,3 +1,9 @@ + + --- name: Feature request about: Suggest an idea for this project diff --git a/.github/workflows/reuse.yaml b/.github/workflows/reuse.yaml new file mode 100644 index 0000000..03eb3b6 --- /dev/null +++ b/.github/workflows/reuse.yaml @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + +name: REUSE Compliance Check + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: REUSE Compliance Check + uses: fsfe/reuse-action@v6 \ No newline at end of file diff --git a/.gitignore.license b/.gitignore.license new file mode 100644 index 0000000..40c9cb0 --- /dev/null +++ b/.gitignore.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 diffo contributors + +SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/.iex.exs b/.iex.exs index 0639bc5..e0a8779 100644 --- a/.iex.exs +++ b/.iex.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + IEx.configure( inspect: [ custom_options: [sort_maps: true] diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..bf44d4a --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +erlang 28.1 +elixir 1.18.4-otp-28 diff --git a/.tool-versions.license b/.tool-versions.license new file mode 100644 index 0000000..40c9cb0 --- /dev/null +++ b/.tool-versions.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 diffo contributors + +SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 5f395d2..4a9df11 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 diffo contributors +// +// SPDX-License-Identifier: MIT { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. diff --git a/CHANGELOG.md b/CHANGELOG.md index b459b0d..ee859e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ + + # Change Log All notable changes to this project will be documented in this file. @@ -19,4 +25,8 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline * customise instance via specification * improve relationships to avoid circular loads +## [v0.1.1](https://github.com/diffo-dev/diffo/compare/v0.1.1...v0.1.2) (2025-10-20) + +### Features +* REUSE compliant \ No newline at end of file diff --git a/LICENSE.md b/LICENSES/MIT.md similarity index 89% rename from LICENSE.md rename to LICENSES/MIT.md index f51aea3..75229b8 100644 --- a/LICENSE.md +++ b/LICENSES/MIT.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Matthew Graham Beanland +Copyright (c) 2025 Matthew Graham Beanland and [contributors](https://github.com/diffo-dev/diffo/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 48a0163..e433263 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,16 @@ + + # Diffo +[![Module Version](https://img.shields.io/hexpm/v/diffo)](https://hex.pm/packages/diffo) +[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen)](https://hexdocs.pm/diffo/) +[![License](https://img.shields.io/hexpm/l/diffo)](https://github.com/diffo-dev/diffo/blob/master/LICENSES/MIT.md) +[![REUSE status](https://api.reuse.software/badge/github.com/diffo-dev/diffo)](https://api.reuse.software/info/github.com/diffo-dev/diffo) + Diffo is a Telecommunications Management Forum (TMF) Service and Resource Manager, built for autonomous networks. It is implemented using the [Ash Framework](https://www.ash-hq.org) leveraging core and community extensions including some created and maintained by [diffo-dev](https://github.com/diffo-dev/). As such it is highly customizable using Spark DSL and as necessary Elixir. @@ -28,7 +39,7 @@ by adding `diffo` to your list of dependencies in `mix.exs`: ```elixir def deps do [ - {:diffo, "~> 0.1.1"} + {:diffo, "~> 0.1.2"} ] end ``` diff --git a/VERSION b/VERSION deleted file mode 100644 index 6da28dd..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.1 \ No newline at end of file diff --git a/config/config.exs b/config/config.exs index a3425ae..0122845 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + import Config config :spark, diff --git a/config/dev.exs b/config/dev.exs index 634bffe..6e022e3 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + import Config config :boltx, Bolt, diff --git a/config/prod.exs b/config/prod.exs index becde76..4eaf659 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1 +1,5 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + import Config diff --git a/config/runtime.exs b/config/runtime.exs index 3fd4866..3d490de 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + import Config if config_env() == :prod do diff --git a/config/test.exs b/config/test.exs index ef988ad..c297265 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + import Config config :logger, level: :warning diff --git a/diffo.livemd b/diffo.livemd index 5cfaf4b..aecc286 100644 --- a/diffo.livemd +++ b/diffo.livemd @@ -1,9 +1,15 @@ + + # Diffo TMF Service and Resource Manager ```elixir Mix.install( [ - {:diffo, "~> 0.1.1"} + {:diffo, "~> 0.1.2"} ], consolidate_protocols: false ) diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md deleted file mode 100644 index e82d554..0000000 --- a/lib/CHANGELOG.md +++ /dev/null @@ -1,12 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](Https://conventionalcommits.org) for commit guidelines. - - - -## [v0.1.0](https://github.com/diffo-dev/diffo/compare/v0.1.0...v0.1.0) (2025-08-10) - -### Features: -* initial version using Neo4j DataLayer - diff --git a/lib/diffo.ex b/lib/diffo.ex index 69c755a..7fc29c1 100644 --- a/lib/diffo.ex +++ b/lib/diffo.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 ash_neo4j contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/access/access.ex b/lib/diffo/access/access.ex index 9b80fda..6b67b67 100644 --- a/lib/diffo/access/access.ex +++ b/lib/diffo/access/access.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/access/assigner/assignable_value.ex b/lib/diffo/access/assigner/assignable_value.ex index aea603a..9120594 100644 --- a/lib/diffo/access/assigner/assignable_value.ex +++ b/lib/diffo/access/assigner/assignable_value.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.AssignableValue do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.AssignableValue do jason do pick [:first, :last, :free, :type, :algorithm] - compact true + compact(true) end typed_struct do diff --git a/lib/diffo/access/assigner/assigner.ex b/lib/diffo/access/assigner/assigner.ex index 1531595..447b293 100644 --- a/lib/diffo/access/assigner/assigner.ex +++ b/lib/diffo/access/assigner/assigner.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Assigner do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/access/assigner/assignment.ex b/lib/diffo/access/assigner/assignment.ex index 9327dc3..6ff6859 100644 --- a/lib/diffo/access/assigner/assignment.ex +++ b/lib/diffo/access/assigner/assignment.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Assignment do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.Assignment do jason do pick [:id, :assignee_id, :operation] - compact true + compact(true) end typed_struct do diff --git a/lib/diffo/access/resources/cable.ex b/lib/diffo/access/resources/cable.ex index 32db1a5..4c42582 100644 --- a/lib/diffo/access/resources/cable.ex +++ b/lib/diffo/access/resources/cable.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Cable do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/access/resources/card.ex b/lib/diffo/access/resources/card.ex index e79b561..2e24924 100644 --- a/lib/diffo/access/resources/card.ex +++ b/lib/diffo/access/resources/card.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Card do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/access/resources/characteristic_values/cable_value.ex b/lib/diffo/access/resources/characteristic_values/cable_value.ex index 03249b7..cdcaf97 100644 --- a/lib/diffo/access/resources/characteristic_values/cable_value.ex +++ b/lib/diffo/access/resources/characteristic_values/cable_value.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.CableValue do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.CableValue do jason do pick [:name, :pairs, :length, :loss, :technology] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/resources/characteristic_values/card_value.ex b/lib/diffo/access/resources/characteristic_values/card_value.ex index 8a1ee27..dce1677 100644 --- a/lib/diffo/access/resources/characteristic_values/card_value.ex +++ b/lib/diffo/access/resources/characteristic_values/card_value.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.CardValue do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,14 +12,13 @@ defmodule Diffo.Access.CardValue do jason do pick [:name, :family, :model, :technology] - compact true + compact(true) end outstanding do expect [:name] end - typed_struct do field :name, :string, description: "the card name" diff --git a/lib/diffo/access/resources/characteristic_values/float_unit.ex b/lib/diffo/access/resources/characteristic_values/float_unit.ex index 90e99ee..57c9600 100644 --- a/lib/diffo/access/resources/characteristic_values/float_unit.ex +++ b/lib/diffo/access/resources/characteristic_values/float_unit.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.FloatUnit do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.FloatUnit do jason do pick [:amount, :unit] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/resources/characteristic_values/integer_unit.ex b/lib/diffo/access/resources/characteristic_values/integer_unit.ex index 5bf743b..764edaa 100644 --- a/lib/diffo/access/resources/characteristic_values/integer_unit.ex +++ b/lib/diffo/access/resources/characteristic_values/integer_unit.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.IntegerUnit do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.IntegerUnit do jason do pick [:amount, :unit] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/resources/characteristic_values/path_value.ex b/lib/diffo/access/resources/characteristic_values/path_value.ex index ea89317..aa935ea 100644 --- a/lib/diffo/access/resources/characteristic_values/path_value.ex +++ b/lib/diffo/access/resources/characteristic_values/path_value.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.PathValue do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.PathValue do jason do pick [:name, :sections, :length, :loss, :technology] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/resources/characteristic_values/shelf_value.ex b/lib/diffo/access/resources/characteristic_values/shelf_value.ex index 0ead01f..7c44dc2 100644 --- a/lib/diffo/access/resources/characteristic_values/shelf_value.ex +++ b/lib/diffo/access/resources/characteristic_values/shelf_value.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.ShelfValue do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.ShelfValue do jason do pick [:name, :family, :model, :technology] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/resources/path.ex b/lib/diffo/access/resources/path.ex index 2a57ee5..bbf1262 100644 --- a/lib/diffo/access/resources/path.ex +++ b/lib/diffo/access/resources/path.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Path do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/access/resources/shelf.ex b/lib/diffo/access/resources/shelf.ex index 6f8e59a..eb08bbd 100644 --- a/lib/diffo/access/resources/shelf.ex +++ b/lib/diffo/access/resources/shelf.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Shelf do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/access/services/characteristic_values/aggregate_interface.ex b/lib/diffo/access/services/characteristic_values/aggregate_interface.ex index 2fd76f0..383ee18 100644 --- a/lib/diffo/access/services/characteristic_values/aggregate_interface.ex +++ b/lib/diffo/access/services/characteristic_values/aggregate_interface.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.AggregateInterface do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,14 +12,13 @@ defmodule Diffo.Access.AggregateInterface do jason do pick [:name, :physical_interface, :physical_layer, :link_layer, :svlan_id, :vpi] - compact true + compact(true) end outstanding do expect [:name] end - typed_struct do field :name, :string, description: "the name of the aggregate interface" diff --git a/lib/diffo/access/services/characteristic_values/bandwidth_profile.ex b/lib/diffo/access/services/characteristic_values/bandwidth_profile.ex index 9ae189e..a7a5ac9 100644 --- a/lib/diffo/access/services/characteristic_values/bandwidth_profile.ex +++ b/lib/diffo/access/services/characteristic_values/bandwidth_profile.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.BandwidthProfile do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.BandwidthProfile do jason do pick [:downstream, :upstream, :units] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/services/characteristic_values/circuit.ex b/lib/diffo/access/services/characteristic_values/circuit.ex index 4b8ee31..e3b33eb 100644 --- a/lib/diffo/access/services/characteristic_values/circuit.ex +++ b/lib/diffo/access/services/characteristic_values/circuit.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Circuit do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -10,7 +14,7 @@ defmodule Diffo.Access.Circuit do jason do pick [:circuit_id, :cvlan_id, :vci, :encapsulation, :bandwidth_profile] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/services/characteristic_values/constraints.ex b/lib/diffo/access/services/characteristic_values/constraints.ex index edee05d..f2baef6 100644 --- a/lib/diffo/access/services/characteristic_values/constraints.ex +++ b/lib/diffo/access/services/characteristic_values/constraints.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Constraints do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.Constraints do jason do pick [:max_latency, :min_profile] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/services/characteristic_values/dslam.ex b/lib/diffo/access/services/characteristic_values/dslam.ex index b3a9891..051d8e4 100644 --- a/lib/diffo/access/services/characteristic_values/dslam.ex +++ b/lib/diffo/access/services/characteristic_values/dslam.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Dslam do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.Dslam do jason do pick [:name, :family, :model, :technology] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/services/characteristic_values/line.ex b/lib/diffo/access/services/characteristic_values/line.ex index 6fc815d..5095654 100644 --- a/lib/diffo/access/services/characteristic_values/line.ex +++ b/lib/diffo/access/services/characteristic_values/line.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.Line do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -8,7 +12,7 @@ defmodule Diffo.Access.Line do jason do pick [:port, :slot, :standard, :profile] - compact true + compact(true) end outstanding do diff --git a/lib/diffo/access/services/dsl_access.ex b/lib/diffo/access/services/dsl_access.ex index 5d680a0..98cb2cc 100644 --- a/lib/diffo/access/services/dsl_access.ex +++ b/lib/diffo/access/services/dsl_access.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.DslAccess do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/application.ex b/lib/diffo/application.ex index 23c5123..a49a67f 100644 --- a/lib/diffo/application.ex +++ b/lib/diffo/application.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Application do @moduledoc false diff --git a/lib/diffo/changes/detail_relationship.ex b/lib/diffo/changes/detail_relationship.ex index 9043a8d..137ec97 100644 --- a/lib/diffo/changes/detail_relationship.ex +++ b/lib/diffo/changes/detail_relationship.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Changes.DetailRelationship do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -10,13 +14,17 @@ defmodule Diffo.Changes.DetailRelationship do def change(changeset, _opts, _context) do target_id = Ash.Changeset.get_argument_or_attribute(changeset, :target_id) + case Diffo.Provider.get_instance_by_id(target_id) do {:ok, target} -> - Ash.Changeset.force_change_attributes(changeset, target_href: Map.get(target, :href), target_type: Map.get(target, :type)) + Ash.Changeset.force_change_attributes(changeset, + target_href: Map.get(target, :href), + target_type: Map.get(target, :type) + ) + {:error, _error} -> changeset end - end # this can be used as follows, where it will set the target_href and target_type from that target instance diff --git a/lib/diffo/helpers/util.ex b/lib/diffo/helpers/util.ex index 0aa071c..5618bc5 100644 --- a/lib/diffo/helpers/util.ex +++ b/lib/diffo/helpers/util.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Util do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/helpers/uuid.ex b/lib/diffo/helpers/uuid.ex index 18aa352..1dbe288 100644 --- a/lib/diffo/helpers/uuid.ex +++ b/lib/diffo/helpers/uuid.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Uuid do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider-mermaid-class-diagram.mmd b/lib/diffo/provider-mermaid-class-diagram.mmd deleted file mode 100644 index 4c1a1b3..0000000 --- a/lib/diffo/provider-mermaid-class-diagram.mmd +++ /dev/null @@ -1,253 +0,0 @@ -classDiagram - class Specification { - UUID id - String name - String description - String category - Instance[] instances - destroy() - read() - create(UUID id, Atom type, String name, Integer major_version, ...) - list() - find_by_name(CiString query) - find_by_category(CiString query) - get_latest(CiString query) - describe(String description) - categorise(String category) - next_minor() - next_patch() - } - class Instance { - UUID id - Atom which - Boolean expected_id_from_twin - Atom type - String name - Atom service_operating_status - UUID specification_id - Atom service_state - ExternalIdentifier[] external_identifiers - Specification specification - ProcessStatus[] process_statuses - Feature[] features - Characteristic[] characteristics - EntityRef[] entities - PlaceRef[] places - PartyRef[] parties - destroy() - read() - create(UUID specified_by, UUID id, String name, Atom type, ...) - list() - find_by_name(CiString query) - find_by_specification_id(String query) - name(String name) - specify(UUID specification_id) - cancel() - feasibilityCheck() - reserve() - deactivate() - activate() - suspend() - terminate() - status(Atom service_operating_status) - } - class Relationship { - Atom alias - Atom type - UUID source_id - UUID target_id - Instance source - Instance target - Characteristic[] characteristic - destroy() - read() - create(UUID source_id, UUID target_id, Atom type, Atom alias) - list() - list_service_relationships_from(UUID instance_id) - list_resource_relationships_from(UUID instance_id) - update(Atom alias, Atom type) - } - class Characteristic { - Atom name - Term value - Atom type - UUID feature_id - UUID instance_id - UUID relationship_id - Feature feature - Instance instance - Relationship relationship - destroy() - read() - create(UUID feature_id, UUID instance_id, UUID relationship_id, Atom name, ...) - find_by_name(CiString query) - list() - list_characteristics_by_related_id(UUID related_id, Atom type) - update(Term value) - } - class Feature { - Atom name - Boolean isEnabled - UUID instance_id - Instance instance - Characteristic[] featureCharacteristic - destroy() - read() - create(UUID instance_id, Atom name, Boolean isEnabled) - find_by_name(CiString query) - list() - list_features_by_related_id(UUID related_id) - update(Boolean isEnabled) - } - class Place { - String id - String href - String name - Atom type - Atom referredType - PlaceRef[] place_refs - destroy() - read() - create(String id, String href, String name, Atom type, ...) - find_by_name(CiString query) - list() - update(String href, String name, Atom type, Atom referredType) - } - class PlaceRef { - Atom role - UUID instance_id - String place_id - Instance instance - Place place - destroy() - read() - create(UUID instance_id, Atom role, String place_id) - list() - list_place_refs_by_instance_id(UUID instance_id) - list_place_refs_by_place_id(String place_id) - find_by_place_id(CiString query) - update(Atom role) - } - class Party { - String id - String href - String name - Atom type - Atom referredType - PartyRef[] party_refs - ExternalIdentifier[] external_identifiers - destroy() - read() - create(String id, String href, String name, Atom type, ...) - find_by_name(CiString query) - list() - update(String href, String name, Atom type, Atom referredType) - } - class PartyRef { - Atom role - UUID instance_id - String party_id - Instance instance - Party party - destroy() - read() - create(UUID instance_id, Atom role, String party_id) - list() - list_party_refs_by_instance_id(UUID instance_id) - list_party_refs_by_party_id(String party_id) - find_by_party_id(CiString query) - update(Atom role) - } - class ExternalIdentifier { - String type - String external_id - UUID instance_id - String owner_id - Instance instance - Party owner - destroy() - read() - create(String type, String external_id, String owner_id, UUID instance_id) - find_by_external_id(CiString query) - list() - list_external_identifiers_by_instance_id(UUID instance_id) - list_external_identifiers_by_owner_id(String owner_id) - update(String type, String external_id, String owner_id, UUID instance_id) - } - class ProcessStatus { - String code - Atom severity - String message - Term parameterized_message - UUID instance_id - Instance instance - destroy() - read() - create(UUID instance_id, String code, Atom severity, String message, ...) - list() - list_process_statuses_by_instance_id(UUID instance_id) - update(String code, Atom severity, String message, Term parameterized_message) - } - class Note { - String text - String note_id - UUID instance_id - String author_id - Instance instance - Party author - destroy() - read() - create(UUID instance_id, String text, String note_id, String author_id) - find_by_note_id(CiString query) - list() - list_notes_by_instance_id(UUID instance_id) - list_notes_by_author_id(String author_id) - update(UUID instance_id, String text, String note_id, String author_id) - } - class Entity { - String id - String href - String name - Atom type - Atom referredType - EntityRef[] entity_refs - destroy() - read() - create(String id, String href, String name, Atom type, ...) - find_by_name(CiString query) - list() - update(String href, String name, Atom type, Atom referredType) - } - class EntityRef { - Atom role - UUID instance_id - String entity_id - Instance instance - Entity entity - destroy() - read() - create(UUID instance_id, Atom role, String entity_id) - list() - list_entity_refs_by_instance_id(UUID instance_id) - list_entity_refs_by_entity_id(String entity_id) - find_by_entity_id(CiString query) - update(Atom role) - } - - Characteristic -- Feature - Characteristic -- Instance - Characteristic -- Relationship - Entity -- EntityRef - EntityRef -- Instance - ExternalIdentifier -- Instance - ExternalIdentifier -- Party - Feature -- Instance - Instance -- Note - Instance -- PartyRef - Instance -- PlaceRef - Instance -- ProcessStatus - Instance -- Relationship - Instance -- Specification - Note -- Party - Party -- PartyRef - Place -- PlaceRef diff --git a/lib/diffo/provider-mermaid-class-diagram.png b/lib/diffo/provider-mermaid-class-diagram.png deleted file mode 100644 index b73ceeb..0000000 Binary files a/lib/diffo/provider-mermaid-class-diagram.png and /dev/null differ diff --git a/lib/diffo/provider.ex b/lib/diffo/provider.ex index 9d27945..88c148a 100644 --- a/lib/diffo/provider.ex +++ b/lib/diffo/provider.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/base_instance.ex b/lib/diffo/provider/components/base_instance.ex index 04936ad..af3473d 100644 --- a/lib/diffo/provider/components/base_instance.ex +++ b/lib/diffo/provider/components/base_instance.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.BaseInstance do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -54,7 +58,7 @@ defmodule Diffo.Provider.BaseInstance do :type ] - compact true + compact(true) customize fn result, record -> result diff --git a/lib/diffo/provider/components/characteristic.ex b/lib/diffo/provider/components/characteristic.ex index 557ac3d..121b8d6 100644 --- a/lib/diffo/provider/components/characteristic.ex +++ b/lib/diffo/provider/components/characteristic.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Characteristic do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/entity.ex b/lib/diffo/provider/components/entity.ex index be1c421..a64e1e2 100644 --- a/lib/diffo/provider/components/entity.ex +++ b/lib/diffo/provider/components/entity.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Entity do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -25,7 +29,7 @@ defmodule Diffo.Provider.Entity do jason do pick [:id, :href, :name, :referredType, :type] - compact true + compact(true) rename referredType: "@referredType", type: "@type" end diff --git a/lib/diffo/provider/components/entity_ref.ex b/lib/diffo/provider/components/entity_ref.ex index 4d39a2c..2236526 100644 --- a/lib/diffo/provider/components/entity_ref.ex +++ b/lib/diffo/provider/components/entity_ref.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.EntityRef do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/external_identifier.ex b/lib/diffo/provider/components/external_identifier.ex index 2609db8..1d222b2 100644 --- a/lib/diffo/provider/components/external_identifier.ex +++ b/lib/diffo/provider/components/external_identifier.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.ExternalIdentifier do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/feature.ex b/lib/diffo/provider/components/feature.ex index 4c8bd2b..ef20f18 100644 --- a/lib/diffo/provider/components/feature.ex +++ b/lib/diffo/provider/components/feature.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Feature do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance-mermaid-flowchart.mmd b/lib/diffo/provider/components/instance-mermaid-flowchart.mmd deleted file mode 100644 index 3af3446..0000000 --- a/lib/diffo/provider/components/instance-mermaid-flowchart.mmd +++ /dev/null @@ -1,19 +0,0 @@ -stateDiagram-v2 -initial --> cancelled: cancel -initial --> feasibilityChecked: feasibilityCheck -feasibilityChecked --> cancelled: cancel -feasibilityChecked --> reserved: reserve -reserved --> cancelled: cancel -reserved --> inactive: deactivate -inactive --> active: activate -active --> inactive: deactivate -active --> suspended: suspend -suspended --> active: activate -suspended --> terminated: terminate -terminated --> active: activate -active --> terminated: terminate -inactive --> terminated: terminate -reserved --> active: activate -feasibilityChecked --> active: activate -initial --> reserved: reserve -initial --> active: activate \ No newline at end of file diff --git a/lib/diffo/provider/components/instance.ex b/lib/diffo/provider/components/instance.ex index 596e6e5..a9d28ad 100644 --- a/lib/diffo/provider/components/instance.ex +++ b/lib/diffo/provider/components/instance.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance/extension.ex b/lib/diffo/provider/components/instance/extension.ex index e9871f0..7879295 100644 --- a/lib/diffo/provider/components/instance/extension.ex +++ b/lib/diffo/provider/components/instance/extension.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Extension do @moduledoc """ DSL Extension customising an Instance diff --git a/lib/diffo/provider/components/instance/extension/characteristic.ex b/lib/diffo/provider/components/instance/extension/characteristic.ex index 5dced4e..47f01e0 100644 --- a/lib/diffo/provider/components/instance/extension/characteristic.ex +++ b/lib/diffo/provider/components/instance/extension/characteristic.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Characteristic do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance/extension/feature.ex b/lib/diffo/provider/components/instance/extension/feature.ex index 07af5bd..04b5e15 100644 --- a/lib/diffo/provider/components/instance/extension/feature.ex +++ b/lib/diffo/provider/components/instance/extension/feature.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Feature do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance/extension/info.ex b/lib/diffo/provider/components/instance/extension/info.ex index aa1597a..938a782 100644 --- a/lib/diffo/provider/components/instance/extension/info.ex +++ b/lib/diffo/provider/components/instance/extension/info.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Extension.Info do use Spark.InfoGenerator, extension: Diffo.Provider.Instance.Extension, diff --git a/lib/diffo/provider/components/instance/extension/party.ex b/lib/diffo/provider/components/instance/extension/party.ex index ec6a860..ee63035 100644 --- a/lib/diffo/provider/components/instance/extension/party.ex +++ b/lib/diffo/provider/components/instance/extension/party.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Party do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance/extension/place.ex b/lib/diffo/provider/components/instance/extension/place.ex index 8ce5805..feebb6d 100644 --- a/lib/diffo/provider/components/instance/extension/place.ex +++ b/lib/diffo/provider/components/instance/extension/place.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Place do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance/extension/relationship.ex b/lib/diffo/provider/components/instance/extension/relationship.ex index cce60e8..18e2b95 100644 --- a/lib/diffo/provider/components/instance/extension/relationship.ex +++ b/lib/diffo/provider/components/instance/extension/relationship.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Relationship do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance/extension/specification.ex b/lib/diffo/provider/components/instance/extension/specification.ex index 325b6f1..0abec37 100644 --- a/lib/diffo/provider/components/instance/extension/specification.ex +++ b/lib/diffo/provider/components/instance/extension/specification.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Specification do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/instance/util.ex b/lib/diffo/provider/components/instance/util.ex index f7867be..c5162a8 100644 --- a/lib/diffo/provider/components/instance/util.ex +++ b/lib/diffo/provider/components/instance/util.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Instance.Util do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/note.ex b/lib/diffo/provider/components/note.ex index 89facef..be1e95b 100644 --- a/lib/diffo/provider/components/note.ex +++ b/lib/diffo/provider/components/note.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Note do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/party.ex b/lib/diffo/provider/components/party.ex index 98a92c0..36028c3 100644 --- a/lib/diffo/provider/components/party.ex +++ b/lib/diffo/provider/components/party.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Party do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -31,7 +35,7 @@ defmodule Diffo.Provider.Party do jason do pick [:id, :href, :name, :referredType, :type] - compact true + compact(true) rename referredType: "@referredType", type: "@type" end diff --git a/lib/diffo/provider/components/party_ref.ex b/lib/diffo/provider/components/party_ref.ex index 7611444..987a30f 100644 --- a/lib/diffo/provider/components/party_ref.ex +++ b/lib/diffo/provider/components/party_ref.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.PartyRef do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/place.ex b/lib/diffo/provider/components/place.ex index e9534be..dadbbec 100644 --- a/lib/diffo/provider/components/place.ex +++ b/lib/diffo/provider/components/place.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Place do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -25,7 +29,7 @@ defmodule Diffo.Provider.Place do jason do pick [:id, :href, :name, :referredType, :type] - compact true + compact(true) rename referredType: "@referredType", type: "@type" end diff --git a/lib/diffo/provider/components/place_ref.ex b/lib/diffo/provider/components/place_ref.ex index 59faa17..3de1c26 100644 --- a/lib/diffo/provider/components/place_ref.ex +++ b/lib/diffo/provider/components/place_ref.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.PlaceRef do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/process_status.ex b/lib/diffo/provider/components/process_status.ex index b406761..2918267 100644 --- a/lib/diffo/provider/components/process_status.ex +++ b/lib/diffo/provider/components/process_status.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.ProcessStatus do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/components/relationship.ex b/lib/diffo/provider/components/relationship.ex index 8a3250d..83b22d5 100644 --- a/lib/diffo/provider/components/relationship.ex +++ b/lib/diffo/provider/components/relationship.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Relationship do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -28,9 +32,14 @@ defmodule Diffo.Provider.Relationship do customize fn result, record -> target_type = Map.get(record, :target_type) - reference = %Diffo.Provider.Reference{id: record.target_id, href: Map.get(record, :target_href)} - list_name = Diffo.Provider.Relationship.derive_relationship_characteristic_list_name(target_type) + reference = %Diffo.Provider.Reference{ + id: record.target_id, + href: Map.get(record, :target_href) + } + + list_name = + Diffo.Provider.Relationship.derive_relationship_characteristic_list_name(target_type) result |> Diffo.Util.set(target_type, reference) @@ -183,7 +192,7 @@ defmodule Diffo.Provider.Relationship do prepare build( load: [:characteristics], sort: [alias: :asc, type: :asc, inserted_at: :asc] - ) + ) end @doc """ diff --git a/lib/diffo/provider/components/specification.ex b/lib/diffo/provider/components/specification.ex index c09c5ae..18a7adf 100644 --- a/lib/diffo/provider/components/specification.ex +++ b/lib/diffo/provider/components/specification.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Specification do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/instance-mermaid-flowchart.mmd b/lib/diffo/provider/instance-mermaid-flowchart.mmd deleted file mode 100644 index 3af3446..0000000 --- a/lib/diffo/provider/instance-mermaid-flowchart.mmd +++ /dev/null @@ -1,19 +0,0 @@ -stateDiagram-v2 -initial --> cancelled: cancel -initial --> feasibilityChecked: feasibilityCheck -feasibilityChecked --> cancelled: cancel -feasibilityChecked --> reserved: reserve -reserved --> cancelled: cancel -reserved --> inactive: deactivate -inactive --> active: activate -active --> inactive: deactivate -active --> suspended: suspend -suspended --> active: activate -suspended --> terminated: terminate -terminated --> active: activate -active --> terminated: terminate -inactive --> terminated: terminate -reserved --> active: activate -feasibilityChecked --> active: activate -initial --> reserved: reserve -initial --> active: activate \ No newline at end of file diff --git a/lib/diffo/provider/outstanding.ex b/lib/diffo/provider/outstanding.ex index b6d4b9d..c89730d 100644 --- a/lib/diffo/provider/outstanding.ex +++ b/lib/diffo/provider/outstanding.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Outstanding do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/provider/reference.ex b/lib/diffo/provider/reference.ex index 4e96343..0a3c730 100644 --- a/lib/diffo/provider/reference.ex +++ b/lib/diffo/provider/reference.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Reference do @moduledoc """ Diffo - TMF Service and Resource Management with a difference @@ -38,6 +42,7 @@ defmodule Diffo.Provider.Reference do case reference.href do nil -> Jason.encode!(%{id: reference.id}) + _ -> Jason.OrderedObject.new(id: reference.id, href: reference.href) |> Jason.encode!() diff --git a/lib/diffo/provider/service.ex b/lib/diffo/provider/service.ex index a60a468..d03aba8 100644 --- a/lib/diffo/provider/service.ex +++ b/lib/diffo/provider/service.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.Service do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/repo.ex b/lib/diffo/repo.ex index bbf5587..2370f9e 100644 --- a/lib/diffo/repo.ex +++ b/lib/diffo/repo.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Repo do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/validations/href_ends_with_id.ex b/lib/diffo/validations/href_ends_with_id.ex index bb5e4fc..e8a397e 100644 --- a/lib/diffo/validations/href_ends_with_id.ex +++ b/lib/diffo/validations/href_ends_with_id.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Validations.HrefEndsWithId do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/validations/is_related_different.ex b/lib/diffo/validations/is_related_different.ex index 0b6f4a0..e64b10a 100644 --- a/lib/diffo/validations/is_related_different.ex +++ b/lib/diffo/validations/is_related_different.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Validations.IsRelatedDifferent do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/diffo/validations/is_uuid4_or_nil.ex b/lib/diffo/validations/is_uuid4_or_nil.ex index 100ace7..5c594f9 100644 --- a/lib/diffo/validations/is_uuid4_or_nil.ex +++ b/lib/diffo/validations/is_uuid4_or_nil.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Validations.IsUuid4OrNil do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/lib/mix/tasks/diagram.ex b/lib/mix/tasks/diagram.ex index 5d31f07..050e1a7 100644 --- a/lib/mix/tasks/diagram.ex +++ b/lib/mix/tasks/diagram.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Mix.Tasks.Diagram do @moduledoc "The diagram mix task: `mix help diagram`" use Mix.Task diff --git a/logos/diffo.jpg.license b/logos/diffo.jpg.license new file mode 100644 index 0000000..40c9cb0 --- /dev/null +++ b/logos/diffo.jpg.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 diffo contributors + +SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/mix.exs b/mix.exs index 6e423a9..2d375ec 100644 --- a/mix.exs +++ b/mix.exs @@ -1,9 +1,12 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT defmodule Diffo.MixProject do @moduledoc false use Mix.Project - @version "0.1.1" + @version "0.1.2" @name "Diffo" @description "TMF Service and Resource Manager with a difference" @github_url "https://github.com/diffo-dev/diffo" @@ -61,7 +64,7 @@ defmodule Diffo.MixProject do logo: "logos/diffo.jpg", extras: [ "README.md": [title: "Guide"], - "LICENSE.md": [title: "License"] + "LICENSES/MIT.md": [title: "License"] ] ] end diff --git a/mix.lock.license b/mix.lock.license new file mode 100644 index 0000000..40c9cb0 --- /dev/null +++ b/mix.lock.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 diffo contributors + +SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/test/access/cable_test.exs b/test/access/cable_test.exs index 06a09c8..7e2ff2b 100644 --- a/test/access/cable_test.exs +++ b/test/access/cable_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.CableTest do @moduledoc false use ExUnit.Case diff --git a/test/access/card_test.exs b/test/access/card_test.exs index 3e8c9a1..5f6e4e1 100644 --- a/test/access/card_test.exs +++ b/test/access/card_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.CardTest do @moduledoc false use ExUnit.Case diff --git a/test/access/characteristic_value_test.exs b/test/access/characteristic_value_test.exs index 34ed889..304bd28 100644 --- a/test/access/characteristic_value_test.exs +++ b/test/access/characteristic_value_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.CharacteristicValueTest do @moduledoc false use ExUnit.Case diff --git a/test/access/dsl_access_test.exs b/test/access/dsl_access_test.exs index 79cf679..fc329df 100644 --- a/test/access/dsl_access_test.exs +++ b/test/access/dsl_access_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.DslAccessTest do @moduledoc false use ExUnit.Case diff --git a/test/access/path_test.exs b/test/access/path_test.exs index 0458375..0b885ba 100644 --- a/test/access/path_test.exs +++ b/test/access/path_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.PathTest do @moduledoc false use ExUnit.Case diff --git a/test/access/shelf_test.exs b/test/access/shelf_test.exs index 81bc5d2..c84c3e6 100644 --- a/test/access/shelf_test.exs +++ b/test/access/shelf_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Access.ShelfTest do @moduledoc false use ExUnit.Case @@ -111,7 +115,7 @@ defmodule Diffo.Access.ShelfTest do [card0, card1, card2, card3] = cards - #resource relationships are sorted in the create order of the relationships + # resource relationships are sorted in the create order of the relationships assert encoding == ~s({\"id\":\"#{shelf.id}",\"href\":\"resourceInventoryManagement/v4/resource/shelf/#{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/card/#{card0.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card1.id}\",\"href\":\"resourceInventoryManagement/v4/resource/card/#{card1.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card2.id}\",\"href\":\"resourceInventoryManagement/v4/resource/card/#{card2.id}\"}},{\"type\":\"contains\",\"resource\":{\"id\":\"#{card3.id}\",\"href\":\"resourceInventoryManagement/v4/resource/card/#{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/telstra/DONC-0001\",\"name\":\"esaId\",\"role\":\"ServingArea\",\"@referredType\":\"GeographicLocation\",\"@type\":\"PlaceRef\"}],\"relatedParty\":[{\"id\":\"Access\",\"name\":\"organizationId\",\"role\":\"Provider\",\"@referredType\":\"Organization\",\"@type\":\"PartyRef\"}]}) end diff --git a/test/diffo_test.exs b/test/diffo_test.exs index ae70181..4bd2e52 100644 --- a/test/diffo_test.exs +++ b/test/diffo_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule DiffoTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/characteristic_test.exs b/test/provider/characteristic_test.exs index 1833af2..5c15345 100644 --- a/test/provider/characteristic_test.exs +++ b/test/provider/characteristic_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.CharacteristicTest do @moduledoc false use ExUnit.Case @@ -81,7 +85,6 @@ defmodule Diffo.Provider.CharacteristicTest do assert characteristic.value == "port13" end - test "create forward and reverse characteristic with same name on same relationship - success" do specification = Diffo.Provider.create_specification!(%{name: "evc"}) diff --git a/test/provider/entity_ref_test.exs b/test/provider/entity_ref_test.exs index 6ecd68a..aadab82 100644 --- a/test/provider/entity_ref_test.exs +++ b/test/provider/entity_ref_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.EntityRefTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/entity_test.exs b/test/provider/entity_test.exs index 71d610c..e1e4639 100644 --- a/test/provider/entity_test.exs +++ b/test/provider/entity_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.EntityTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/external_identifier_test.exs b/test/provider/external_identifier_test.exs index 1d59055..f6f6d0d 100644 --- a/test/provider/external_identifier_test.exs +++ b/test/provider/external_identifier_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.ExternalIdentifierTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/feature_test.exs b/test/provider/feature_test.exs index 1af479f..6806e64 100644 --- a/test/provider/feature_test.exs +++ b/test/provider/feature_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.FeatureTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/instance_test.exs b/test/provider/instance_test.exs index 71944df..ec4777b 100644 --- a/test/provider/instance_test.exs +++ b/test/provider/instance_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.InstanceTest do @moduledoc false use ExUnit.Case @@ -585,12 +589,12 @@ defmodule Diffo.Provider.InstanceTest do characteristics: [forward_relationship_characteristic.id] }) - _reverse_relationship = + _reverse_relationship = Diffo.Provider.create_relationship!(%{ type: :providedTo, source_id: child_instance.id, target_id: parent_instance.id - }) + }) place = Diffo.Provider.create_place!(%{ @@ -797,7 +801,7 @@ defmodule Diffo.Provider.InstanceTest do characteristics: [forward_relationship_characteristic.id] }) - _reverse_relationship = + _reverse_relationship = Diffo.Provider.create_relationship!(%{ type: :providedTo, source_id: child_instance.id, @@ -1025,7 +1029,7 @@ defmodule Diffo.Provider.InstanceTest do child_instance = Diffo.Provider.create_instance!(%{specified_by: child_specification.id, type: :resource}) - _reverse_relationship = + _reverse_relationship = Diffo.Provider.create_relationship!(%{ type: :assignedTo, source_id: child_instance.id, @@ -1358,7 +1362,7 @@ defmodule Diffo.Provider.InstanceTest do child_instance = Diffo.Provider.create_instance!(%{specified_by: child_specification.id, type: :resource}) - reverse_relationship = + reverse_relationship = Diffo.Provider.create_relationship!(%{ type: :assignedTo, source_id: child_instance.id, diff --git a/test/provider/note_test.exs b/test/provider/note_test.exs index 7bfc1a7..0b9560c 100644 --- a/test/provider/note_test.exs +++ b/test/provider/note_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.NoteTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/party_ref_test.exs b/test/provider/party_ref_test.exs index fa430a5..fd21bf0 100644 --- a/test/provider/party_ref_test.exs +++ b/test/provider/party_ref_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.PartyRefTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/party_test.exs b/test/provider/party_test.exs index 0051322..03c38e2 100644 --- a/test/provider/party_test.exs +++ b/test/provider/party_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.PartyTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/place_ref_test.exs b/test/provider/place_ref_test.exs index 1e5d794..c2fbeec 100644 --- a/test/provider/place_ref_test.exs +++ b/test/provider/place_ref_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.PlaceRefTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/place_test.exs b/test/provider/place_test.exs index b189391..46f1018 100644 --- a/test/provider/place_test.exs +++ b/test/provider/place_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.PlaceTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/process_status_test.exs b/test/provider/process_status_test.exs index c331b61..9fc7bbc 100644 --- a/test/provider/process_status_test.exs +++ b/test/provider/process_status_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.ProcessStatus.ProcessStatus do @moduledoc false use ExUnit.Case diff --git a/test/provider/reference_test.exs b/test/provider/reference_test.exs index d306824..2e7d24d 100644 --- a/test/provider/reference_test.exs +++ b/test/provider/reference_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.ReferenceTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/relationship_test.exs b/test/provider/relationship_test.exs index bfe3448..b4de649 100644 --- a/test/provider/relationship_test.exs +++ b/test/provider/relationship_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.RelationshipTest do @moduledoc false use ExUnit.Case diff --git a/test/provider/specification_test.exs b/test/provider/specification_test.exs index 5f21460..e826397 100644 --- a/test/provider/specification_test.exs +++ b/test/provider/specification_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Provider.SpecificationTest do @moduledoc false use ExUnit.Case diff --git a/test/support/characteristics.ex b/test/support/characteristics.ex index c9f16b9..54c43e5 100644 --- a/test/support/characteristics.ex +++ b/test/support/characteristics.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Test.Characteristics do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/test/support/parties.ex b/test/support/parties.ex index 6d8cc6d..37f0b71 100644 --- a/test/support/parties.ex +++ b/test/support/parties.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Test.Parties do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/test/support/places.ex b/test/support/places.ex index f0e8683..6cc29cf 100644 --- a/test/support/places.ex +++ b/test/support/places.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + defmodule Diffo.Test.Places do @moduledoc """ Diffo - TMF Service and Resource Management with a difference diff --git a/test/test_helper.exs b/test/test_helper.exs index 7755b8b..5d462db 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 diffo contributors +# +# SPDX-License-Identifier: MIT + Mix.Task.run("app.start") ExUnit.start() level = Application.get_env(:logger, :console) |> Keyword.get(:level)