def test():
    global vm
    pxe_uuid = test_lib.lib_get_pxe_by_name(os.environ.get('pxename')).uuid
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm=vm, port=6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name=chassis)
    test_stub.hack_ks(port=6230)
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    bare_operations.stop_pxe(pxe_uuid)
    if not test_stub.verify_chassis_status(chassis_uuid, "PxeBootFailed"):
        test_util.test_fail(
            'Chassis failed to get PxeBootFailed after the first provision')
    bare_operations.start_pxe(pxe_uuid)
    if test_lib.lib_get_pxe_by_name(os.environ.get('pxename')).status != "Running":
                    test_util.test_fail('Fail to start PXE')
    test_stub.delete_vbmc(vm=vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Create chassis Test Success')
def test():
    global vm
    pxe_uuid = test_lib.lib_get_pxe_by_name(os.environ.get('pxename')).uuid
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Stop PXE
    bare_operations.stop_pxe(pxe_uuid)
    if test_lib.lib_get_pxe_by_name(os.environ.get('pxename')).status != "Stopped":
        test_util.test_fail('Fail to stop PXE')
    # Start PXE
    bare_operations.start_pxe(pxe_uuid)
    if test_lib.lib_get_pxe_by_name(os.environ.get('pxename')).status != "Running":
        test_util.test_fail('Fail to start PXE')
    # Create Virtual BMC
    test_stub.create_vbmc(vm = vm, port = 6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name = chassis)
    test_stub.hack_ks(port = 6230)
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    hwinfo = test_stub.check_hwinfo(chassis_uuid)
    if not hwinfo:
        test_util.test_fail('Fail to get hardware info during the first provision')
    test_stub.delete_vbmc(vm = vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Start/Stop PXE Test Success')
def test():
    global vm
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm = vm, port = 6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name = chassis)
    # Update Chassis
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    ipmiaddress = os.environ.get('ipmiaddress')
    ipmiuser = os.environ.get('ipmiusername')
    ipmipasswd = os.environ.get('ipmipassword')
    test_stub.delete_vbmc(vm = vm)
    test_stub.create_vbmc(vm = vm, port = 6231)
    bare_operations.update_chassis(chassis_uuid=chassis_uuid, address=ipmiaddress, username=ipmiuser, password=ipmipasswd, port=6231)
    test_stub.hack_ks(port = 6231)
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    hwinfo = test_stub.check_hwinfo(chassis_uuid)
    if not hwinfo:
        test_util.test_fail('Fail to get hardware info during the first provision')
    new_port = test_lib.lib_get_chassis_by_name(chassis).ipmiPort
    if new_port != "6231":
        test_util.test_fail("Update Chassis's Port failed: port=%s" % new_port)
    test_stub.delete_vbmc(vm = vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Update Chassis Test Success')
def test():
    global vm
    pxe_uuid = test_lib.lib_get_pxe_by_name(os.environ.get('pxename')).uuid
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Stop PXE
    bare_operations.stop_pxe(pxe_uuid)
    if test_lib.lib_get_pxe_by_name(
            os.environ.get('pxename')).status != "Stopped":
        test_util.test_fail('Fail to stop PXE')
    # Start PXE
    bare_operations.start_pxe(pxe_uuid)
    if test_lib.lib_get_pxe_by_name(
            os.environ.get('pxename')).status != "Running":
        test_util.test_fail('Fail to start PXE')
    # Create Virtual BMC
    test_stub.create_vbmc(vm=vm, port=6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name=chassis)
    test_stub.hack_ks(port=6230)
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    hwinfo = test_stub.check_hwinfo(chassis_uuid)
    if not hwinfo:
        test_util.test_fail(
            'Fail to get hardware info during the first provision')
    test_stub.delete_vbmc(vm=vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Start/Stop PXE Test Success')
def test():
    global vm
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm=vm, port=6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name=chassis)
    test_stub.hack_ks(port=6230)
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    hwinfo = test_stub.check_hwinfo(chassis_uuid)
    if not hwinfo:
        test_util.test_fail(
            'Fail to get hardware info during the first provision')
    #Generate cfgItems
    cfgItems, pxe_mac = test_stub.generate_cfgItems(chassis_uuid=chassis_uuid,
                                                    nic_num=1,
                                                    nic_flag=True,
                                                    bond_num=2,
                                                    slave_num=1,
                                                    mode=4)
    host_cfg = test_stub.create_hostcfg(chassis_uuid=chassis_uuid,
                                        unattended=True,
                                        password="******",
                                        cfgItems=cfgItems)

    test_stub.hack_ks(port=6230, ks_file=str(pxe_mac.replace(':', '-')))
    # Second time Provision to install system
    bare_operations.provision_baremetal(chassis_uuid)
    if not test_stub.verify_chassis_status(chassis_uuid, "Rebooting"):
        test_util.test_fail(
            'Chassis failed to Rebooting after the second provision')
    if not test_stub.verify_chassis_status(chassis_uuid, "Provisioning"):
        test_util.test_fail(
            'Chassis failed to Provisioning after the second provision')
    if not test_stub.verify_chassis_status(chassis_uuid, "Provisioned"):
        test_util.test_fail(
            'Chassis failed to Provisioned after the second provision')
    vm.stop()
    vm.start()
    test_stub.delete_vbmc(vm=vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Create PXE Test Success')
def test():
    global vm1
    global vm2
    # Create VM
    vm1 = test_stub.create_vm()
    vm1.check()
    vm2 = test_stub.create_vm()
    vm2.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm=vm1, port=int(os.environ.get('ipmiport')))
    test_stub.create_vbmc(vm=vm2, port=int(os.environ.get('ipmiport2')))
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name=chassis)
    test_stub.hack_ks(port=os.environ.get('ipmiport'))
    chassis_uuid1 = test_lib.lib_get_chassis_by_name(chassis).uuid
    # Provision VM1
    bare_operations.provision_baremetal(chassis_uuid1)
    hwinfo1 = test_stub.check_hwinfo(chassis_uuid1)

    chassis_option = test_util.ChassisOption()
    chassis_option.set_name(os.environ.get('ipminame2'))
    chassis_option.set_ipmi_address(os.environ.get('ipmiaddress'))
    chassis_option.set_ipmi_username(os.environ.get('ipmiusername'))
    chassis_option.set_ipmi_password(os.environ.get('ipmipassword'))
    chassis_option.set_ipmi_port(os.environ.get('ipmiport2'))

    test_stub.create_chassis(chassis_name=chassis,
                             chassis_option=chassis_option)
    test_stub.hack_ks(port=os.environ.get('ipmiport2'))
    chassis_uuid2 = test_lib.lib_get_chassis_by_name(
        os.environ.get('ipminame2')).uuid

    bare_operations.provision_baremetal(chassis_uuid2)
    hwinfo2 = test_stub.check_hwinfo(chassis_uuid2)
    if not hwinfo1 or not hwinfo2:
        test_util.test_fail(
            'Fail to get hardware info during the first provision')
    test_stub.delete_vbmc(vm=vm1)
    test_stub.delete_vbmc(vm=vm2)
    #bare_operations.delete_chassis(chassis_uuid1)
    #bare_operations.delete_chassis(chassis_uuid2)
    vm1.destroy()
    vm2.destroy()
    test_util.test_pass('Create chassis Test Success')
def test():
    global vm1
    global vm2
    # Create VM
    vm1 = test_stub.create_vm()
    vm1.check()
    vm2 = test_stub.create_vm()
    vm2.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm = vm1, port = int(os.environ.get('ipmiport')))
    test_stub.create_vbmc(vm = vm2, port = int(os.environ.get('ipmiport2')))
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name = chassis)
    test_stub.hack_ks(port = os.environ.get('ipmiport'))
    chassis_uuid1 = test_lib.lib_get_chassis_by_name(chassis).uuid
    # Provision VM1
    bare_operations.provision_baremetal(chassis_uuid1)
    hwinfo1 = test_stub.check_hwinfo(chassis_uuid1)

    chassis_option = test_util.ChassisOption()
    chassis_option.set_name(os.environ.get('ipminame2'))
    chassis_option.set_ipmi_address(os.environ.get('ipmiaddress'))
    chassis_option.set_ipmi_username(os.environ.get('ipmiusername'))
    chassis_option.set_ipmi_password(os.environ.get('ipmipassword'))
    chassis_option.set_ipmi_port(os.environ.get('ipmiport2'))

    test_stub.create_chassis(chassis_name=chassis, chassis_option=chassis_option)
    test_stub.hack_ks(port = os.environ.get('ipmiport2'))
    chassis_uuid2 = test_lib.lib_get_chassis_by_name(os.environ.get('ipminame2')).uuid
    
    bare_operations.provision_baremetal(chassis_uuid2)
    hwinfo2 = test_stub.check_hwinfo(chassis_uuid2)
    if not hwinfo1 or not hwinfo2:
        test_util.test_fail('Fail to get hardware info during the first provision')
    test_stub.delete_vbmc(vm = vm1)
    test_stub.delete_vbmc(vm = vm2)
    #bare_operations.delete_chassis(chassis_uuid1)
    #bare_operations.delete_chassis(chassis_uuid2)
    vm1.destroy()
    vm2.destroy()
    test_util.test_pass('Create chassis Test Success')
def test():
    global vm
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm = vm, port = 6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name = chassis)
    test_stub.hack_ks(port = 6230)
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    hwinfo = test_stub.check_hwinfo(chassis_uuid)
    if not hwinfo:
        test_util.test_fail('Fail to get hardware info during the first provision')
    test_stub.delete_vbmc(vm = vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Create chassis Test Success')
Exemple #9
0
def test():
    global vm
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm=vm, port=6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name=chassis)
    test_stub.hack_ks(port=6230)
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    hwinfo = test_stub.check_hwinfo(chassis_uuid)
    if not hwinfo:
        test_util.test_fail(
            'Fail to get hardware info during the first provision')
    test_stub.delete_vbmc(vm=vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Create chassis Test Success')
def test():
    global vm
    # Create VM
    vm = test_stub.create_vm()
    vm.check()
    # Create Virtual BMC
    test_stub.create_vbmc(vm = vm, port = 6230)
    # Create Chassis
    chassis = os.environ.get('ipminame')
    test_stub.create_chassis(chassis_name = chassis)
    test_stub.hack_ks(port = 6230)
    chassis_uuid = test_lib.lib_get_chassis_by_name(chassis).uuid
    # First time Provision
    bare_operations.provision_baremetal(chassis_uuid)
    hwinfo = test_stub.check_hwinfo(chassis_uuid)
    if not hwinfo:
        test_util.test_fail('Fail to get hardware info during the first provision')
    #Generate cfgItems
    cfgItems, pxe_mac = test_stub.generate_cfgItems(chassis_uuid=chassis_uuid, nic_num=1, nic_flag=True, bond_num=2, slave_num=1, mode=4)
    host_cfg =  test_stub.create_hostcfg(chassis_uuid=chassis_uuid, unattended=True, password="******", cfgItems=cfgItems)
    
    test_stub.hack_ks(port = 6230, ks_file = str(pxe_mac.replace(':','-')))
    # Second time Provision to install system
    bare_operations.provision_baremetal(chassis_uuid)
    if not test_stub.verify_chassis_status(chassis_uuid, "Rebooting"):
        test_util.test_fail('Chassis failed to Rebooting after the second provision')
    if not test_stub.verify_chassis_status(chassis_uuid, "Provisioning"):
        test_util.test_fail('Chassis failed to Provisioning after the second provision')
    if not test_stub.verify_chassis_status(chassis_uuid, "Provisioned"):
        test_util.test_fail('Chassis failed to Provisioned after the second provision')
    vm.stop()
    vm.start()
    test_stub.delete_vbmc(vm = vm)
    bare_operations.delete_chassis(chassis_uuid)
    vm.destroy()
    test_util.test_pass('Create PXE Test Success')