From cecf662d0edde0db7470f25185b4a936f123e267 Mon Sep 17 00:00:00 2001 From: Hironori Shiina Date: Tue, 17 Jul 2018 17:38:26 +0900 Subject: [PATCH] Set profile version for VIOM configuration eLCM API got requiring a profile version after an update. This patch adds the profile version for avoiding this incompatibility. Change-Id: I0165648a35645abc934243417a0890e89d96212a (cherry picked from commit 1de27e4144372c5c1d8b962b95d9152ae9cef8b0) --- scciclient/irmc/viom/elcm.py | 6 ++++-- scciclient/tests/irmc/viom/test_client.py | 7 +++++-- scciclient/tests/irmc/viom/test_elcm.py | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/scciclient/irmc/viom/elcm.py b/scciclient/irmc/viom/elcm.py index f3e7b64..be79574 100644 --- a/scciclient/irmc/viom/elcm.py +++ b/scciclient/irmc/viom/elcm.py @@ -91,7 +91,8 @@ class ELCMVIOMClient(object): def set_profile(self, adapter_config): _adapter_config = dict(adapter_config) _adapter_config.update({'@Processing': 'execute'}) - req = {'Server': {'AdapterConfigIrmc': _adapter_config}} + req = {'Server': {'AdapterConfigIrmc': _adapter_config, + '@Version': '1.01'}} resp = elcm.elcm_profile_set(self.irmc_info, req) self._wait_session(resp['Session']['Id']) @@ -147,7 +148,8 @@ class VIOMTable(VIOMElement): VIOMAttribute('boot_mode', 'BootMode'), VIOMAttribute('init_boot', 'InitBoot'), VIOMAttribute('processing', '@Processing'), - VIOMAttribute('mode', 'Mode') + VIOMAttribute('mode', 'Mode'), + VIOMAttribute('version', '@Version', '1.00'), ] def __init__(self, **kwargs): diff --git a/scciclient/tests/irmc/viom/test_client.py b/scciclient/tests/irmc/viom/test_client.py index cab815e..fb2c9a0 100644 --- a/scciclient/tests/irmc/viom/test_client.py +++ b/scciclient/tests/irmc/viom/test_client.py @@ -51,6 +51,7 @@ class VIOMConfigurationTestCase(testtools.TestCase): }, 'InitBoot': reboot, 'Mode': 'delete', + '@Version': '1.00', } mock_set.assert_called_once_with(expected_json) @@ -75,7 +76,8 @@ class VIOMConfigurationTestCase(testtools.TestCase): }, 'Slots': { 'Slot': [slot_json] - } + }, + '@Version': '1.00', } @staticmethod @@ -86,7 +88,8 @@ class VIOMConfigurationTestCase(testtools.TestCase): }, 'Slots': { 'Slot': [slot_json] - } + }, + '@Version': '1.00', } @staticmethod diff --git a/scciclient/tests/irmc/viom/test_elcm.py b/scciclient/tests/irmc/viom/test_elcm.py index 88b80a2..60de89b 100644 --- a/scciclient/tests/irmc/viom/test_elcm.py +++ b/scciclient/tests/irmc/viom/test_elcm.py @@ -183,7 +183,8 @@ class ELCMVIOMClientTestCase(testtools.TestCase): {'AdapterConfigIrmc': {'ViomManage': {'Manage': True}, 'InitBoot': True, - '@Processing': 'execute'}}}) + '@Processing': 'execute'}, + '@Version': '1.01'}}) @mock.patch.object(elcm, 'elcm_profile_create') @mock.patch.object(viom_elcm.ELCMVIOMClient, '_wait_session', @@ -521,12 +522,13 @@ class VIOMTableTestCase(testtools.TestCase): VIOMTableTestCase._sample_slot_json() ] }, + '@Version': '1.00', } self.assertEqual(expected_json, root.get_json()) def test_root_empty(self): root = viom_elcm.VIOMTable() - self.assertEqual({}, root.get_json()) + self.assertEqual({'@Version': '1.00'}, root.get_json()) def test_root_detail(self): root = viom_elcm.VIOMTable( @@ -555,6 +557,7 @@ class VIOMTableTestCase(testtools.TestCase): VIOMTableTestCase._sample_slot_json() ] }, + '@Version': '1.00', } self.assertEqual(expected_json, root.get_json())