Skip to content

Upload image and upgrade #1081

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Upload image and upgrade #1081

wants to merge 3 commits into from

Conversation

mattiaswal
Copy link
Contributor

@mattiaswal mattiaswal commented Jul 11, 2025

This add support for upgrading images with curl only, without FTP or
similiar. The image needs to be base64 encoded.

Example:

TEMP_JSON=/tmp/restconf.txt
echo -n '{"infix-system:input":{"image":"' > "$TEMP_JSON"
base64 -w 0 "image.pkg >> "$TEMP_JSON"
echo '"}}' >> "$TEMP_JSON"
    
curl -k \
      -X POST \
      -u "admin:admin" \
      -H "Content-Type: application/yang-data+json" \
      -H "Accept: application/yang-data+json" \
      -d @"$TEMP_JSON" \
      "https://192.168.30.1/restconf/operations/infix-system:install-bundle"

Description

This is WiP since it uses huge amout of memory. Will take a look at that first.

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

This add support for upgrading images with curl only, without FTP or
similiar. The image needs to be base64 encoded.

Example:

TEMP_JSON=/tmp/restconf.txt
echo -n '{"infix-system:input":{"image":"' > "$TEMP_JSON"
base64 -w 0 "$BUNDLE_FILE" >> "$TEMP_JSON"
echo '"}}' >> "$TEMP_JSON"

curl -k \
  -X POST \
  -u "admin:admin" \
  -H "Content-Type: application/yang-data+json" \
  -H "Accept: application/yang-data+json" \
  -d @"$TEMP_JSON" \
  "https://192.168.30.1/restconf/operations/infix-system:install-bundle"
@mattiaswal mattiaswal marked this pull request as draft July 11, 2025 14:34
@mattiaswal mattiaswal changed the title Upload image Upload image and upgrade Jul 11, 2025
Comment on lines +231 to +242
rpc install-upload-bundle {
nacm:default-deny-all;
description "Upgrade the system's software by installing from a supplied blob.";
input {
leaf image {
type binary;
mandatory true;
description "The image to install";
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated install-bundle RPC (above) looks great! But what is this, looks like an earlier attempt or test code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated install-bundle RPC (above) looks great! But what is this, looks like an earlier attempt or test code?

Yeah, this was for testing the concept.

@mattiaswal mattiaswal added the triage Pending investigation & classification (CCB) label Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Pending investigation & classification (CCB)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants