Exemplo n.º 1
0
def prepare_machine_config(machine_file):
    tree_init = XmlDomTreeInit()
    dom = tree_init.parse_file(machine_file)
    machine_dom = dom.getElementsByTagName("netmachineconfig")[0]

    data = {"info":{}, "netdevices": {}, "netconfig": {}}

    machine_parse = NetMachineConfigParse()
    machine_parse.disable_events()
    machine_parse.set_recipe(data)
    machine_parse.set_machine(0, data)
    machine_parse.parse(machine_dom)

    return data
Exemplo n.º 2
0
def prepare_machine_config(machine_file):
    tree_init = XmlDomTreeInit()
    dom = tree_init.parse_file(machine_file)
    machine_dom = dom.getElementsByTagName("netmachineconfig")[0]

    data = {"info": {}, "netdevices": {}, "netconfig": {}}

    machine_parse = NetMachineConfigParse()
    machine_parse.disable_events()
    machine_parse.set_recipe(data)
    machine_parse.set_machine(0, data)
    machine_parse.parse(machine_dom)

    return data
Exemplo n.º 3
0
def prepare_netconfig(machine_file, config_file):
    tree_init = XmlDomTreeInit()
    data = prepare_machine_config(machine_file)

    dom = tree_init.parse_file(config_file)
    config_dom = dom.getElementsByTagName("netconfig")[0]

    config_parse = NetConfigParse()
    config_parse.disable_events()
    config_parse.set_recipe(data)
    config_parse.set_machine(0, data)
    config_parse.parse(config_dom)

    netconfig = NetConfig()
    for key, entry in data["netconfig"].iteritems():
        netconfig.add_interface_config(key, entry)

    return netconfig
Exemplo n.º 4
0
def prepare_netconfig(machine_file, config_file):
    tree_init = XmlDomTreeInit()
    data = prepare_machine_config(machine_file)

    dom = tree_init.parse_file(config_file)
    config_dom = dom.getElementsByTagName("netconfig")[0]

    config_parse = NetConfigParse()
    config_parse.disable_events()
    config_parse.set_recipe(data)
    config_parse.set_machine(0, data)
    config_parse.parse(config_dom)

    netconfig = NetConfig()
    for key, entry in data["netconfig"].iteritems():
        netconfig.add_interface_config(key, entry)

    return netconfig