mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
nso_verify handle leaf-list in 4.5 and identityref (#37393)
NSO verify did not handle leaf-list value verification in 4.5 and later due to changes made for configuration writing made. map prefix for identityref types in verification.
This commit is contained in:
parent
1fd9a616a4
commit
6308047dc9
4 changed files with 51 additions and 26 deletions
|
@ -116,7 +116,7 @@ class NsoVerify(object):
|
|||
violations = []
|
||||
|
||||
# build list of values from configured data
|
||||
value_builder = ValueBuilder(self._client)
|
||||
value_builder = ValueBuilder(self._client, 'verify')
|
||||
for key, value in self._data.items():
|
||||
value_builder.build('', key, value)
|
||||
|
||||
|
@ -146,11 +146,17 @@ class NsoVerify(object):
|
|||
n_value = normalize_value(
|
||||
expected_value.value, value, expected_value.path)
|
||||
if n_value != expected_value.value:
|
||||
violations.append({
|
||||
'path': expected_value.path,
|
||||
'expected-value': expected_value.value,
|
||||
'value': n_value
|
||||
})
|
||||
# if the value comparision fails, try mapping identityref
|
||||
value_type = value_builder.get_type(expected_value.path)
|
||||
if value_type is not None and 'identityref' in value_type:
|
||||
n_value, t_value = self.get_prefix_name(value)
|
||||
|
||||
if expected_value.value != n_value:
|
||||
violations.append({
|
||||
'path': expected_value.path,
|
||||
'expected-value': expected_value.value,
|
||||
'value': n_value
|
||||
})
|
||||
else:
|
||||
raise ModuleFailException(
|
||||
'value state {0} not supported at {1}'.format(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue