def test_set_bmc_type(self):
        bmc = model.CBMC()

        for node_type in [
                "quanta_d51", "quanta_t41", "dell_r630", "dell_c6320",
                "s2600kp", "s2600tp", "s2600wtt"
        ]:
            bmc.set_type(node_type)
            bmc.init()
            cmd = bmc.get_commandline()
            assert "/usr/local/etc/infrasim/{0}/{0}.emu".format(node_type) \
                   in cmd
Beispiel #2
0
    def test_set_fake_bmc_lan_interface(self):
        bmc_info = {"interface": "fake_lan"}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            print e.value
            assert False
Beispiel #3
0
    def test_set_bmc_type(self):
        bmc = model.CBMC()

        for node_type in [
                "quanta_d51", "quanta_t41", "dell_r630", "dell_c6320",
                "s2600kp", "s2600tp", "s2600wtt"
        ]:
            bmc.set_type(node_type)
            bmc.set_workspace(self.__class__.WORKSPACE)
            bmc.init()
            cmd = bmc.get_commandline()
            assert "{0}.emu".format(node_type) \
                   in cmd
    def test_set_kill_wait_not_int(self):
        bmc_info = {"kill_wait": "a!"}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "kill_wait is expected to be integer," in str(e)
Beispiel #5
0
    def test_set_kill_wait_negative(self):
        bmc_info = {"kill_wait": -1}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "kill_wait is expected to be >= 0," in str(e)
Beispiel #6
0
    def test_set_historyfru_not_int(self):
        bmc_info = {"historyfru": "a!"}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "History FRU is expected to be integer," in str(e)
    def test_set_historyfru_negative(self):
        bmc_info = {"historyfru": -1}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "History FRU is expected to be >= 0," in str(e)
Beispiel #8
0
    def test_set_port_iol_negative(self):
        bmc_info = {"ipmi_over_lan_port": -1}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "Port for IOL(IPMI over LAN) is expected to be >= 0," \
                   in str(e)
    def test_set_port_iol_not_int(self):
        bmc_info = {"ipmi_over_lan_port": "a!"}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "Port for IOL(IPMI over LAN) is expected to be integer," \
                   in str(e)
Beispiel #10
0
    def test_set_another_emu_file(self):
        fn = "/tmp/test_emu"
        os.system("touch {}".format(fn))

        bmc_info = {"emu_file": fn}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        assert "-f {}".format(fn) in bmc.get_commandline()
        os.system("rm -rf {}".format(fn))
Beispiel #11
0
    def test_set_startnow_false(self):
        bmc_info = {"startnow": False}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        with open(bmc.get_config_file(), 'r') as fp:
            if "startnow false" in fp.read():
                assert True
            else:
                assert False
    def test_set_port_iol(self):
        bmc_info = {"ipmi_over_lan_port": 624}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        with open(bmc.get_config_file(), 'r') as fp:
            if "addr :: 624" in fp.read():
                assert True
            else:
                assert False
    def test_set_another_config_file(self):
        fn = "/etc/infrasim/test_conf"
        os.system("touch {}".format(fn))

        bmc_info = {"config_file": fn}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        assert "-c {}".format(fn) in bmc.get_commandline()
        os.system("rm -rf {}".format(fn))
    def test_set_kill_wait(self):
        bmc_info = {"kill_wait": 0}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        with open(bmc.get_config_file(), 'r') as fp:
            if "kill_wait 0" in fp.read():
                assert True
            else:
                assert False
    def test_set_bmc_lan_interface(self):
        bmc_info = {"interface": "lo"}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        with open(bmc.get_config_file(), 'r') as fp:
            for line in fp.readlines():
                if "lan_config_program" in line and "lo" in line:
                    assert True
                    return
            assert False
    def test_set_invalid_config_file(self):
        fn = "/etc/infrasim/conf_test"
        os.system("rm -rf {}".format(fn))

        bmc_info = {"config_file": fn}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.set_config_file(fn)

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "Target config file doesn't exist:" in str(e)
Beispiel #17
0
    def test_set_invalid_emu_file(self):
        fn = "/tmp/emu_test"
        os.system("rm -rf {}".format(fn))

        bmc_info = {"emu_file": fn}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()

        try:
            bmc.precheck()
        except ArgsNotCorrect, e:
            assert "Target emulation file doesn't exist:" in str(e)
Beispiel #18
0
    def test_set_ipmi_listen_range(self):
        bmc_info = {"interface": "lo"}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        with open(bmc.get_config_file(), 'r') as fp:
            for line in fp.readlines():
                if "addr 127.0.0.1 623" in line:
                    assert True
                    return
            assert False
Beispiel #19
0
    def test_set_historyfru(self):
        bmc_info = {"historyfru": 11}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("dell_r730")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.enable_sol(True)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        with open(bmc.get_config_file(), 'r') as fp:
            if "historyfru=11" in fp.read():
                assert True
            else:
                assert False
    def test_set_username_password(self):
        bmc_info = {"username": "******", "password": "******"}

        bmc = model.CBMC(bmc_info)
        bmc.set_type("quanta_d51")
        bmc.set_workspace(self.__class__.WORKSPACE)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()

        credential = "user 2 true  \"test_user\" \"test_password\" " \
                     "admin    10       none md2 md5 straight"
        with open(bmc.get_config_file(), 'r') as fp:
            if credential in fp.read():
                assert True
            else:
                assert False