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 1de27e4144)
This commit is contained in:
Hironori Shiina
2018-07-17 17:38:26 +09:00
parent 6c3c54fd1d
commit cecf662d0e
3 changed files with 14 additions and 6 deletions

View File

@@ -91,7 +91,8 @@ class ELCMVIOMClient(object):
def set_profile(self, adapter_config): def set_profile(self, adapter_config):
_adapter_config = dict(adapter_config) _adapter_config = dict(adapter_config)
_adapter_config.update({'@Processing': 'execute'}) _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) resp = elcm.elcm_profile_set(self.irmc_info, req)
self._wait_session(resp['Session']['Id']) self._wait_session(resp['Session']['Id'])
@@ -147,7 +148,8 @@ class VIOMTable(VIOMElement):
VIOMAttribute('boot_mode', 'BootMode'), VIOMAttribute('boot_mode', 'BootMode'),
VIOMAttribute('init_boot', 'InitBoot'), VIOMAttribute('init_boot', 'InitBoot'),
VIOMAttribute('processing', '@Processing'), VIOMAttribute('processing', '@Processing'),
VIOMAttribute('mode', 'Mode') VIOMAttribute('mode', 'Mode'),
VIOMAttribute('version', '@Version', '1.00'),
] ]
def __init__(self, **kwargs): def __init__(self, **kwargs):

View File

@@ -51,6 +51,7 @@ class VIOMConfigurationTestCase(testtools.TestCase):
}, },
'InitBoot': reboot, 'InitBoot': reboot,
'Mode': 'delete', 'Mode': 'delete',
'@Version': '1.00',
} }
mock_set.assert_called_once_with(expected_json) mock_set.assert_called_once_with(expected_json)
@@ -75,7 +76,8 @@ class VIOMConfigurationTestCase(testtools.TestCase):
}, },
'Slots': { 'Slots': {
'Slot': [slot_json] 'Slot': [slot_json]
} },
'@Version': '1.00',
} }
@staticmethod @staticmethod
@@ -86,7 +88,8 @@ class VIOMConfigurationTestCase(testtools.TestCase):
}, },
'Slots': { 'Slots': {
'Slot': [slot_json] 'Slot': [slot_json]
} },
'@Version': '1.00',
} }
@staticmethod @staticmethod

View File

@@ -183,7 +183,8 @@ class ELCMVIOMClientTestCase(testtools.TestCase):
{'AdapterConfigIrmc': {'AdapterConfigIrmc':
{'ViomManage': {'Manage': True}, {'ViomManage': {'Manage': True},
'InitBoot': True, 'InitBoot': True,
'@Processing': 'execute'}}}) '@Processing': 'execute'},
'@Version': '1.01'}})
@mock.patch.object(elcm, 'elcm_profile_create') @mock.patch.object(elcm, 'elcm_profile_create')
@mock.patch.object(viom_elcm.ELCMVIOMClient, '_wait_session', @mock.patch.object(viom_elcm.ELCMVIOMClient, '_wait_session',
@@ -521,12 +522,13 @@ class VIOMTableTestCase(testtools.TestCase):
VIOMTableTestCase._sample_slot_json() VIOMTableTestCase._sample_slot_json()
] ]
}, },
'@Version': '1.00',
} }
self.assertEqual(expected_json, root.get_json()) self.assertEqual(expected_json, root.get_json())
def test_root_empty(self): def test_root_empty(self):
root = viom_elcm.VIOMTable() root = viom_elcm.VIOMTable()
self.assertEqual({}, root.get_json()) self.assertEqual({'@Version': '1.00'}, root.get_json())
def test_root_detail(self): def test_root_detail(self):
root = viom_elcm.VIOMTable( root = viom_elcm.VIOMTable(
@@ -555,6 +557,7 @@ class VIOMTableTestCase(testtools.TestCase):
VIOMTableTestCase._sample_slot_json() VIOMTableTestCase._sample_slot_json()
] ]
}, },
'@Version': '1.00',
} }
self.assertEqual(expected_json, root.get_json()) self.assertEqual(expected_json, root.get_json())