today the nic to mac address mapping is inside the configuration file, via the hw-id tag that is parsed before the configuration is loaded into the device..
This is a device specific mapping and i'm trying to change this so that the mapping is in its own config file in /config/persistant_interface_mapping (or some other name)
but, what format to use for the file...
a few examples..
>>> for k in i: ... print("{} {}".format(k,i[k])) ... eth2 00:00:00:00:00:02 eth1 00:00:00:00:00:01 eth0 00:00:00:00:00:00
>>> for k in i: ... print("{}={}".format(k,i[k])) ... eth2=00:00:00:00:00:02 eth1=00:00:00:00:00:01 eth0=00:00:00:00:00:00
>>> json.dumps(i) '{"eth2": "00:00:00:00:00:02", "eth1": "00:00:00:00:00:01", "eth0": "00:00:00:00:00:00"}'
>>> print(yaml.dump(i, default_flow_style=False)) eth0: 00:00:00:00:00:00 eth1: 00:00:00:00:00:01 eth2: 00:00:00:00:00:02
personally i prefer a format that is parseable line by line. So, if the user "screws up" the file in some way, only the lines the user screwed up is "lost".. all other interfaces are still going to parse in without issues. we could also have more control over what the parser does every step of the way.
using eg json, if the user misses a ' , " or : all entries in this file becomes invalid, the same is partly true with a simple yaml syntax, because the whole file would not parse on a syntax error.
I need some input on this before continuing this work, what other opinions on this are there? or is there a format i've missed completely?