#!/usr/bin/env python3
# @file testAll.py
#
# @brief Execute all tests
#
# @author Manuel Castilla
# @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('pc1',"hostName")
        configuration["userName1"] = config.get('pc1',"userName")
        configuration["password1"] = config.get('pc1',"password")
        configuration["busIdSpec1"] = config.get('pc1',"busIdSpec")
        configuration["ipWR1"] = config.get('pc1',"ipWR")
        configuration["interfaceName1"] = config.get('pc1',"interfaceName")
        configuration["hostName2"] = config.get('pc2',"hostName")
        configuration["userName2"] = config.get('pc2',"userName")
        configuration["password2"] = config.get('pc2',"password")
        configuration["busIdSpec2"] = config.get('pc2',"busIdSpec")
        configuration["ipWR2"] = config.get('pc2',"ipWR")
        configuration["interfaceName2"] = config.get('pc2',"interfaceName")

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