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:
		@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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())
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user