Skip to content

Commit 6332473

Browse files
committed
0.2.3 — adopt diffo 0.4.1 changes, BaseCharacteristic auto-actions, and TMF-correct service lifecycle
1 parent 2752685 commit 6332473

40 files changed

Lines changed: 73 additions & 505 deletions

lib/access/resources/cable.ex

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,21 @@ defmodule DiffoExample.Access.Cable do
7070
argument :characteristic_value_updates, {:array, :term}
7171

7272
change set_attribute(:resource_state, :operating)
73-
change DiffoExample.Changes.Define
73+
change Diffo.Provider.Changes.Define
7474
end
7575

7676
update :relate do
7777
description "relates the cable with other instances"
7878
argument :relationships, {:array, :struct}
7979

80-
change after_action(fn changeset, result, _context ->
81-
with {:ok, result} <- Relationship.relate_instance(result, changeset),
82-
{:ok, result} <- Access.get_cable_by_id(result.id),
83-
do: {:ok, result}
84-
end)
80+
change Diffo.Provider.Changes.Relate
8581
end
8682

8783
update :assign_pair do
8884
description "relates the cable with an instance by assigning a pair"
8985
argument :assignment, :struct, constraints: [instance_of: Assignment]
9086

91-
change {DiffoExample.Changes.Assign, pool: :pairs}
87+
change {Diffo.Provider.Changes.Assign, pool: :pairs}
9288
end
9389
end
9490
end

lib/access/resources/card.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@ defmodule DiffoExample.Access.Card do
7070
argument :characteristic_value_updates, {:array, :term}
7171

7272
change set_attribute(:resource_state, :operating)
73-
change DiffoExample.Changes.Define
73+
change Diffo.Provider.Changes.Define
7474
end
7575

7676
update :relate do
7777
description "relates the card with other instances"
7878
argument :relationships, {:array, :struct}
7979

80-
change DiffoExample.Changes.Relate
80+
change Diffo.Provider.Changes.Relate
8181
end
8282

8383
update :assign_port do
8484
description "relates the card with an instance by assigning a port"
8585
argument :assignment, :struct, constraints: [instance_of: Assignment]
8686

87-
change {DiffoExample.Changes.Assign, pool: :ports}
87+
change {Diffo.Provider.Changes.Assign, pool: :ports}
8888
end
8989
end
9090

lib/access/resources/characteristic_values/cable_characteristic.ex

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ defmodule DiffoExample.Access.CableCharacteristic do
1616
end
1717

1818
actions do
19-
create :create do
20-
accept [:name, :pairs, :length_amount, :length_unit, :loss_amount, :loss_unit, :technology]
21-
argument :instance_id, :uuid
22-
argument :feature_id, :uuid
23-
change manage_relationship(:instance_id, :instance, type: :append)
24-
change manage_relationship(:feature_id, :feature, type: :append)
25-
end
26-
2719
update :update do
2820
accept [:pairs, :technology, :length_amount, :length_unit, :loss_amount, :loss_unit]
2921
argument :length, :term, allow_nil?: true

lib/access/resources/characteristic_values/card_characteristic.ex

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@ defmodule DiffoExample.Access.CardCharacteristic do
1313
plural_name :card_characteristics
1414
end
1515

16-
actions do
17-
create :create do
18-
accept [:name, :family, :model, :technology]
19-
argument :instance_id, :uuid
20-
argument :feature_id, :uuid
21-
change manage_relationship(:instance_id, :instance, type: :append)
22-
change manage_relationship(:feature_id, :feature, type: :append)
23-
end
24-
25-
update :update do
26-
accept [:family, :model, :technology]
27-
end
28-
end
29-
3016
attributes do
3117
attribute :family, :atom, public?: true
3218
attribute :model, :string, public?: true

lib/access/resources/characteristic_values/path_characteristic.ex

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ defmodule DiffoExample.Access.PathCharacteristic do
1616
end
1717

1818
actions do
19-
create :create do
20-
accept [
21-
:name,
22-
:device_name,
23-
:sections,
24-
:length_amount,
25-
:length_unit,
26-
:loss_amount,
27-
:loss_unit,
28-
:technology
29-
]
30-
31-
argument :instance_id, :uuid
32-
argument :feature_id, :uuid
33-
change manage_relationship(:instance_id, :instance, type: :append)
34-
change manage_relationship(:feature_id, :feature, type: :append)
35-
end
36-
3719
update :update do
3820
accept [
3921
:device_name,

lib/access/resources/characteristic_values/shelf_characteristic.ex

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@ defmodule DiffoExample.Access.ShelfCharacteristic do
1313
plural_name :shelf_characteristics
1414
end
1515

16-
actions do
17-
create :create do
18-
accept [:name, :device_name, :family, :model, :technology]
19-
argument :instance_id, :uuid
20-
argument :feature_id, :uuid
21-
change manage_relationship(:instance_id, :instance, type: :append)
22-
change manage_relationship(:feature_id, :feature, type: :append)
23-
end
24-
25-
update :update do
26-
accept [:device_name, :family, :model, :technology]
27-
end
28-
end
29-
3016
attributes do
3117
attribute :device_name, :string, public?: true
3218
attribute :family, :atom, public?: true

lib/access/resources/path.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ defmodule DiffoExample.Access.Path do
6464
description "defines the path"
6565
argument :characteristic_value_updates, {:array, :term}
6666

67-
change DiffoExample.Changes.Define
67+
change Diffo.Provider.Changes.Define
6868
end
6969

7070
update :relate do
7171
description "relates the path with other instances"
7272
argument :relationships, {:array, :struct}
7373

74-
change DiffoExample.Changes.Relate
74+
change Diffo.Provider.Changes.Relate
7575
end
7676
end
7777

lib/access/resources/shelf.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@ defmodule DiffoExample.Access.Shelf do
7070
argument :characteristic_value_updates, {:array, :term}
7171

7272
change set_attribute(:resource_state, :operating)
73-
change DiffoExample.Changes.Define
73+
change Diffo.Provider.Changes.Define
7474
end
7575

7676
update :relate do
7777
description "relates the shelf with cards"
7878
argument :relationships, {:array, :struct}
7979

80-
change DiffoExample.Changes.Relate
80+
change Diffo.Provider.Changes.Relate
8181
end
8282

8383
update :assign_slot do
8484
description "relates the shelf with an instance by assigning a slot"
8585
argument :assignment, :struct, constraints: [instance_of: Assignment]
8686

87-
change {DiffoExample.Changes.Assign, pool: :slots}
87+
change {Diffo.Provider.Changes.Assign, pool: :slots}
8888
end
8989
end
9090

lib/access/services/characteristic_values/aggregate_characteristic.ex

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,6 @@ defmodule DiffoExample.Access.AggregateCharacteristic do
1313
plural_name :aggregate_characteristics
1414
end
1515

16-
actions do
17-
create :create do
18-
accept [
19-
:name,
20-
:interface_name,
21-
:physical_interface,
22-
:physical_layer,
23-
:link_layer,
24-
:svlan_id,
25-
:vpi
26-
]
27-
28-
argument :instance_id, :uuid
29-
argument :feature_id, :uuid
30-
change manage_relationship(:instance_id, :instance, type: :append)
31-
change manage_relationship(:feature_id, :feature, type: :append)
32-
end
33-
34-
update :update do
35-
accept [:interface_name, :physical_interface, :physical_layer, :link_layer, :svlan_id, :vpi]
36-
end
37-
end
38-
3916
attributes do
4017
attribute :interface_name, :string, public?: true
4118
attribute :physical_interface, :string, public?: true

lib/access/services/characteristic_values/circuit_characteristic.ex

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ defmodule DiffoExample.Access.CircuitCharacteristic do
1616
end
1717

1818
actions do
19-
create :create do
20-
accept [
21-
:name,
22-
:circuit_id,
23-
:cvlan_id,
24-
:vci,
25-
:encapsulation,
26-
:bp_downstream,
27-
:bp_upstream,
28-
:bp_units
29-
]
30-
31-
argument :instance_id, :uuid
32-
argument :feature_id, :uuid
33-
change manage_relationship(:instance_id, :instance, type: :append)
34-
change manage_relationship(:feature_id, :feature, type: :append)
35-
end
36-
3719
update :update do
3820
accept [:circuit_id, :cvlan_id, :vci, :encapsulation]
3921
argument :bandwidth_profile, :term, allow_nil?: true

0 commit comments

Comments
 (0)