sk2 / autonetkit

AutoNetkit: an automated network configuration engine
BSD 3-Clause "New" or "Revised" License
129 stars 49 forks source link

Fix issue with multi-edge graphs in Json import #257

Closed sk2 closed 10 years ago

sk2 commented 10 years ago

Problem was in setting the defaults as only a single graph

    for (src, dst) in graph.edges():
        for (key, val) in edge_defaults.items():
            if key not in graph[src][dst]:
                graph[src][dst][key] = val

now sets on the data dict:

    for src, dst, data in graph.edges(data=True):
        for key, val in edge_defaults.items():
            if key not in data:
                data[key] = val

which works for both cases