|
|
@ -62,24 +62,36 @@ def dict_to_set(sample_dict):
|
|
|
|
def filter_dict_having_none_value(want, have):
|
|
|
|
def filter_dict_having_none_value(want, have):
|
|
|
|
# Generate dict with have dict value which is None in want dict
|
|
|
|
# Generate dict with have dict value which is None in want dict
|
|
|
|
test_dict = dict()
|
|
|
|
test_dict = dict()
|
|
|
|
test_key_dict = dict()
|
|
|
|
|
|
|
|
name = want.get('name')
|
|
|
|
name = want.get('name')
|
|
|
|
if name:
|
|
|
|
if name:
|
|
|
|
test_dict['name'] = name
|
|
|
|
test_dict['name'] = name
|
|
|
|
diff_ip = False
|
|
|
|
diff_ip = False
|
|
|
|
want_ip = ''
|
|
|
|
|
|
|
|
for k, v in iteritems(want):
|
|
|
|
for k, v in iteritems(want):
|
|
|
|
if isinstance(v, dict):
|
|
|
|
if isinstance(v, dict):
|
|
|
|
for key, value in iteritems(v):
|
|
|
|
for key, value in iteritems(v):
|
|
|
|
|
|
|
|
test_key_dict = dict()
|
|
|
|
if value is None:
|
|
|
|
if value is None:
|
|
|
|
dict_val = have.get(k).get(key)
|
|
|
|
dict_val = have.get(k).get(key)
|
|
|
|
test_key_dict.update({key: dict_val})
|
|
|
|
test_key_dict.update({key: dict_val})
|
|
|
|
|
|
|
|
elif k == 'ipv6' and value.lower() != have.get(k)[0].get(key).lower():
|
|
|
|
|
|
|
|
# as multiple IPV6 address can be configured on same
|
|
|
|
|
|
|
|
# interface, for replace state in place update will
|
|
|
|
|
|
|
|
# actually create new entry, which isn't as expected
|
|
|
|
|
|
|
|
# for replace state, so in case of IPV6 address
|
|
|
|
|
|
|
|
# every time 1st delete the existing IPV6 config and
|
|
|
|
|
|
|
|
# then apply the new change
|
|
|
|
|
|
|
|
dict_val = have.get(k)[0].get(key)
|
|
|
|
|
|
|
|
test_key_dict.update({key: dict_val})
|
|
|
|
test_dict.update({k: test_key_dict})
|
|
|
|
test_dict.update({k: test_key_dict})
|
|
|
|
if isinstance(v, list):
|
|
|
|
if isinstance(v, list):
|
|
|
|
for key, value in iteritems(v[0]):
|
|
|
|
for key, value in iteritems(v[0]):
|
|
|
|
|
|
|
|
test_key_dict = dict()
|
|
|
|
if value is None:
|
|
|
|
if value is None:
|
|
|
|
dict_val = have.get(k).get(key)
|
|
|
|
dict_val = have.get(k).get(key)
|
|
|
|
test_key_dict.update({key: dict_val})
|
|
|
|
test_key_dict.update({key: dict_val})
|
|
|
|
|
|
|
|
elif k == 'ipv6' and value.lower() != have.get(k)[0].get(key).lower():
|
|
|
|
|
|
|
|
dict_val = have.get(k)[0].get(key)
|
|
|
|
|
|
|
|
test_key_dict.update({key: dict_val})
|
|
|
|
test_dict.update({k: test_key_dict})
|
|
|
|
test_dict.update({k: test_key_dict})
|
|
|
|
# below conditions checks are added to check if
|
|
|
|
# below conditions checks are added to check if
|
|
|
|
# secondary IP is configured, if yes then delete
|
|
|
|
# secondary IP is configured, if yes then delete
|
|
|
|