def main(config_file):
if not (os.path.exists(config_file) and os.path.isfile(config_file)):<EOL><INDENT>msg = "<STR_LIT>".format(config_file)<EOL>raise ValueError(msg)<EOL><DEDENT>print("<STR_LIT>".format(config_file))<EOL>driver = napalm.get_network_driver("<STR_LIT>")<EOL>device = driver(<EOL>hostname="<STR_LIT:127.0.0.1>",<EOL>username="<STR_LIT>",<EOL>password="<STR_LIT>",<EOL>optional_args={"<STR_LIT:port>": <NUM_LIT>},<EOL>)<EOL>print("<STR_LIT>")<EOL>device.open()<EOL>print("<STR_LIT>")<EOL>device.load_replace_candidate(filename=config_file)<EOL>print("<STR_LIT>")<EOL>print(device.compare_config())<EOL>try:<EOL><INDENT>choice = raw_input("<STR_LIT>")<EOL><DEDENT>except NameError:<EOL><INDENT>choice = input("<STR_LIT>")<EOL><DEDENT>if choice == "<STR_LIT:y>":<EOL><INDENT>print("<STR_LIT>")<EOL>device.commit_config()<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>")<EOL>device.discard_config()<EOL><DEDENT>device.close()<EOL>print("<STR_LIT>")<EOL>
Load a config for the device.