Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rest.packages.provider): add deploy/v2 Rest API #4868

Merged

Conversation

mattdibi
Copy link
Contributor

@mattdibi mattdibi commented Sep 26, 2023

This PR adds the deploy/v2 RestAPI endpoint to the Kura codebase. The endpoint was already available in the ansible bundle but it is now being promoted to core.

In its current form it is a 1:1 matching with the old implementation, but I will contribute additional functionalities in the next PRs.

Roadmap:

Changelog:

  • Added org.eclipse.kura.rest.packages.provider containing the implementation code
  • Added org.eclipse.kura.rest.packages.provider.test containing both unit and integration tests

Differences with the existing implementation: differently from the ansible bundle implementation I had to:

  • Complete re-write of the integration tests
  • Refactored unit tests to adhere to Gerkhin style
  • Change package names

Tests

I ran the following tests on a Nvidia Jetson Nano running the latest buid with this PR

export ADDRESS=<addr>
export USERNAME=<user>
export PASSWORD=<pass>

then used curl to run the requests.

Get installed packages

curl -k -u $USERNAME:$PASSWORD https://$ADDRESS/services/deploy/v2/
[]%

after installing the Wire Script Filter

curl -k -u $USERNAME:$PASSWORD https://$ADDRESS/services/deploy/v2/
[{"name":"org.eclipse.kura.wire.script.filter","version":"1.3.0"}]%

Uninstall a package

curl -X DELETE -k -u $USERNAME:$PASSWORD https://$ADDRESS/services/deploy/v2/org.eclipse.kura.wire.script.filter
"REQUEST_RECEIVED"%

The package is correctly uninstalled

Install package from URL

curl -X POST -k -u $USERNAME:$PASSWORD -H 'Content-Type: application/json' -d '{ "url": "https://download.eclipse.org/kura/releases/5.3.0/org.eclipse.kura.wire.script.filter-1.3.0.dp" }' https://$ADDRESS/services/deploy/v2/_install

The package is correctly installed (after updating the HTTPS certificate)


RestAPI Documentation

Get installed packages

  • Method: GET
  • API PATH: /deploy/v2/
Description

Provides the list of all the deployment packages installed and tracked by the framework.

Responses
  • 200 OK status
[{ "name": "packageName", "version": "packageVersion"}]

Install package from URL

  • Method: POST
  • API PATH: /deploy/v2/_install
Description

Installs the deployment package specified in the InstallRequest. If the request was already issued for the same InstallRequest, it returns the status of the installation process.

Responses
  • 200 OK status
"REQUEST_RECEIVED"

Uninstall a package

  • Method: DELETE
  • API PATH: /deploy/v2/{name}
Description

Uninstalls the deployment package identified by the specified name. If the request was already issued, it reports the status of the uninstallation operation.

Responses
  • 200 OK status
"REQUEST_RECEIVED"

@mattdibi mattdibi marked this pull request as ready for review September 27, 2023 09:25
@mattdibi mattdibi changed the title feat(rest.packages): add deploy/v2 RestAPI feat(rest.packages.provider): add deploy/v2 Rest API Sep 27, 2023
@mattdibi mattdibi force-pushed the feat/deploy_packages_rest_api branch from fd6188a to d674d88 Compare October 10, 2023 07:25
@pierantoniomerlino pierantoniomerlino merged commit a9e4c78 into eclipse-kura:develop Oct 10, 2023
2 checks passed
@mattdibi mattdibi deleted the feat/deploy_packages_rest_api branch October 10, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants