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

add optional passing of fw version #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ If you want to leave the firmware image, manifest and campaign to your account a
New manifest-tool 2.0.0 supports two different versions of manifest schemas. Update test's manifest creation defaults to 'v1' manifest version, but you can set the version e.g to 'v3' by the `--manifest_version=v3` startup argument.
Supported versions at the moment are 'v1' and 'v3'.

If you need to pass in an explicit firmware version, verses using a time-stamp-generated value, use the `--fw_version` option.
JanneKiiskila marked this conversation as resolved.
Show resolved Hide resolved

### Results output

Expand Down
4 changes: 3 additions & 1 deletion pelion_test_lib/fixtures/cloud_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def update_device(cloud, client, request):
binary_path = request.config.getoption('update_bin', None)
manifest_tool_path = request.config.getoption('manifest_tool')
manifest_version = request.config.getoption('manifest_version', 'v1')
fw_version = request.config.getoption('fw_version', None)
no_cleanup = request.config.getoption('no_cleanup', False)
delta_manifest = request.config.getoption('delta_manifest', None)
local_bin = request.config.getoption('local_binary', None)
Expand Down Expand Up @@ -144,7 +145,8 @@ def update_device(cloud, client, request):
firmware_url=fw_image['datafile'],
update_image_path=binary_path,
delta_manifest=delta_manifest,
manifest_version=manifest_version)
manifest_version=manifest_version,
fw_version=fw_version)
assert manifest_file is not None, 'Manifest file was not created'

manifest = cloud.update.upload_firmware_manifest(manifest_file, expected_status_code=201).json()
Expand Down
8 changes: 6 additions & 2 deletions pelion_test_lib/tools/manifest_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def init(working_path, vendor_domain=None, model_name=None):


def create_manifest(path, firmware_url, update_image_path, output='output.manifest', delta_manifest=None,
manifest_version='v1'):
manifest_version='v1', fw_version=None):
"""
Create a manifest file
:param path: Manifest-tool path
Expand All @@ -80,7 +80,11 @@ def create_manifest(path, firmware_url, update_image_path, output='output.manife
if os.path.isfile(output):
os.remove(output)
if manifest_version == 'v1':
cmd = [MANIFEST_DEV_TOOL, 'create-v1', '-u', firmware_url, '-o', output]
if fw_version is None:
cmd = [MANIFEST_DEV_TOOL, 'create-v1', '-u', firmware_url, '-o', output]
else:
cmd = [MANIFEST_DEV_TOOL, 'create-v1', '-u', firmware_url, '-o', output, '--fw-version', fw_version]

Comment on lines +83 to +87

Choose a reason for hiding this comment

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

Suggested change
if fw_version is None:
cmd = [MANIFEST_DEV_TOOL, 'create-v1', '-u', firmware_url, '-o', output]
else:
cmd = [MANIFEST_DEV_TOOL, 'create-v1', '-u', firmware_url, '-o', output, '--fw-version', fw_version]
cmd = [MANIFEST_DEV_TOOL, 'create-v1', '-u', firmware_url, '-o', output]

Better to add it below Line 92 to include v3 too:

if fw_version:
    cmd += [ '--fw-version', fw_version ]

elif manifest_version == 'v3':
cmd = [MANIFEST_DEV_TOOL, 'create', '-u', firmware_url, '-o', output, '--sign-image']
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def pytest_addoption(parser):
parser.addoption('--local_binary', action='store', help='local linux client binary path')
parser.addoption('--use_one_apikey', action='store_true', default=False, help='do not create temp api key')
parser.addoption('--manifest_version', action='store', default='v1', help='manifest template version')

parser.addoption('--fw_version', action='store', default=None, help='firmware version')

def pytest_report_teststatus(report):
"""
Expand Down