Skip to content

Commit

Permalink
feat(containers): init container capability
Browse files Browse the repository at this point in the history
adds the capability `container_management` if a device supports all the
required interfaces.

Signed-off-by: Francesco Noacco <[email protected]>
  • Loading branch information
noaccOS committed Oct 22, 2024
1 parent 841ac23 commit 73cc371
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
67 changes: 67 additions & 0 deletions backend/lib/edgehog/capabilities.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,73 @@ defmodule Edgehog.Capabilities do
minor: 1
}
],
container_management: [
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.AvailableContainers",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.AvailableDeployments",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.AvailableImages",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.AvailableNetworks",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.AvailableVolumes",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.CreateContainerRequest",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.CreateDeploymentRequest",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.CreateImageRequest",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.CreateNetworkRequest",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.CreateVolumeRequest",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.DeploymentCommand",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.DeploymentEvent",
major: 0,
minor: 1
},
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.apps.DeploymentUpdate",
major: 0,
minor: 1
}
],
hardware_info: [
%Astarte.InterfaceID{
name: "io.edgehog.devicemanager.HardwareInfo",
Expand Down
1 change: 1 addition & 0 deletions backend/lib/edgehog/devices/device/types/capability.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ defmodule Edgehog.Devices.Device.Types.Capability do
battery_status: "The device provides information about its battery status.",
cellular_connection: "The device provides information about its cellular connection.",
commands: "The device supports commands, for example the rebooting command.",
contoainer_management: "The device supports running applications using containers.",
geolocation: "The device can be geolocated.",
hardware_info: "The device provides information about its hardware.",
led_behaviors: "The device can be asked to blink its LED in a specific pattern.",
Expand Down
37 changes: 36 additions & 1 deletion backend/test/edgehog/capabilities_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,49 @@ defmodule Edgehog.CapabilitiesTest do
"io.edgehog.devicemanager.SystemInfo" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.SystemStatus" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.config.Telemetry" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.WiFiScanResults" => %InterfaceVersion{major: 0, minor: 1}
"io.edgehog.devicemanager.WiFiScanResults" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.apps.AvailableContainers" => %InterfaceVersion{
major: 0,
minor: 1
},
"io.edgehog.devicemanager.apps.AvailableDeployments" => %InterfaceVersion{
major: 0,
minor: 1
},
"io.edgehog.devicemanager.apps.AvailableImages" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.apps.DeploymentEvent" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.apps.CreateContainerRequest" => %InterfaceVersion{
major: 0,
minor: 1
},
"io.edgehog.devicemanager.apps.CreateDeploymentRequest" => %InterfaceVersion{
major: 0,
minor: 1
},
"io.edgehog.devicemanager.apps.CreateImageRequest" => %InterfaceVersion{
major: 0,
minor: 1
},
"io.edgehog.devicemanager.apps.DeploymentCommand" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.apps.DeploymentUpdate" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.apps.AvailableNetworks" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.apps.AvailableVolumes" => %InterfaceVersion{major: 0, minor: 1},
"io.edgehog.devicemanager.apps.CreateNetworkRequest" => %InterfaceVersion{
major: 0,
minor: 1
},
"io.edgehog.devicemanager.apps.CreateVolumeRequest" => %InterfaceVersion{
major: 0,
minor: 1
}
}

expected_capabilities = [
:base_image,
:battery_status,
:cellular_connection,
:commands,
:container_management,
:geolocation,
:hardware_info,
:led_behaviors,
Expand Down

0 comments on commit 73cc371

Please sign in to comment.