I have two dict and I want to merge ip list but i could not solve I wanna result like this
result = {"src":
{
"1":
{
{"Communication": {"False":["1.1.10.13"]}},
{"management": {"True": ["1.1.10.5", "1.1.10.7"]}}
},
"2":
{
{"Communication": {"False": ["1.1.10.5", "1.1.10.7"]}},
{"management": {"True": ["1.1.10.13"]}}
}
},
"dst":
{
"1":
{
{"mfg": {"True":["1.1.151.12"]}}
}
"2":
{
{"Communication": {"False":["1.1.151.12"]}}
}
}
thanks for your time
src = [{'zone': 'Communication', 'ip': '1.1.10.13', 'fw': 1, 'l3': 'False'}, {'zone': 'Communication', 'ip': '1.1.10.5', 'fw': 2, 'l3': 'False'}, {'zone': 'Communication', 'ip': '1.1.10.7', 'fw': 2, 'l3': 'False'}, {'zone': 'management', 'ip': '1.1.10.5', 'fw': 1, 'l3': 'True'}, {'zone': 'management', 'ip': '1.1.10.7', 'fw': 1, 'l3': 'True'}, {'zone': 'management', 'ip': '1.1.10.13', 'fw': 2, 'l3': 'True'}]
dst = [{'zone': 'Communication', 'ip': '10.17.151.12', 'fw': 2, 'l3': 'False'}, {'zone': 'mfg', 'ip': '10.17.151.12', 'fw': 1, 'l3': 'True'}]
Aucun commentaire:
Enregistrer un commentaire