#!/usr/bin/env python3
# @file testAll.py
#
# @brief
#
# @author Manuel Castilla
# @ingroup
# @date 29/04/2019
#
###########################################################################

import configparser


tests = ["testNIC","testWR","testDIO","testAdvDIO"]

#--------------------------------------------------#
#--------------------------------------------------#
# MAIN
#--------------------------------------------------#
#--------------------------------------------------#

def main(configuration):
    print("Executing all tests")
    for i in tests:
        test = __import__(i)
        test.main(configuration)
    print("Test All: completed")


if __name__ == '__main__':
    try:
        configuration = {}
        nameConfig = "configuration.cfg"

        config = configparser.ConfigParser()
        config.readfp(open(nameConfig))

        configuration["hostName1"] = config.get('config',"hostName1")
        configuration["userName1"] = config.get('config',"userName1")
        configuration["password1"] = config.get('config',"password1")
        configuration["busIdSpec1"] = config.get('config',"busIdSpec1")
        configuration["ipWR1"] = config.get('config',"ipWR1")
        configuration["interfaceName1"] = config.get('config',"interfaceName1")
        configuration["hostName2"] = config.get('config',"hostName2")
        configuration["userName2"] = config.get('config',"userName2")
        configuration["password2"] = config.get('config',"password2")
        configuration["busIdSpec2"] = config.get('config',"busIdSpec2")
        configuration["ipWR2"] = config.get('config',"ipWR2")
        configuration["interfaceName2"] = config.get('config',"interfaceName2")

        main(configuration)
    except configparser.Error as e:
        print("Error load configuration:",e.message)