Exemple #1
0
        format='%(asctime)s %(levelname)s %(message)s',
        datefmt='%m/%d/%Y %H:%M:%S'
)

if conf_warn != "":
    logging.warning(conf_warn)
    # exit(1)


def get_switch_config():
    for section in config.sections():
        if section.find("switch_") != -1:
            switch_conf = {}
            for item in ["switch_type", "ip", "name", "stack_member", "user", "pass"]:
                switch_conf[item] = config.get(section, item)
            return switch_conf


if __name__ == "__main__":
    print "Test"
    dict_sw = get_switch_config()
    sw = Switch(
            stype=dict_sw['switch_type'],
            sm=dict_sw['stack_member'],
            ip=dict_sw['ip'],
            host=dict_sw['name'],
            user=dict_sw['user'],
            passwd=dict_sw['pass']
    )
    sw.info()