def update_system_tag(tag_uuid, tag, session_uuid = None):
    action = api_actions.UpdateSystemTagAction()
    action.uuid = tag_uuid
    action.tag = tag
    test_util.action_logger('Update Tag [uuid:] %s to %s' % (tag_uuid, tag))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def reconnect_sftp_backup_storage(sftpbs_uuid, session_uuid=None, timeout=120000):
    action = api_actions.ReconnectSftpBackupStorageAction()
    action.uuid = sftpbs_uuid
    action.timeout = timeout
    test_util.action_logger('Reconnect SFTP Backup Storage [uuid:] %s' % sftpbs_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def delete_host(host_uuid, session_uuid=None):
    action = api_actions.DeleteHostAction()
    action.uuid = host_uuid
    action.timeout = 120000
    test_util.action_logger('Delete Host [uuid:] %s' % host_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def expunge_image(image_uuid, backup_storage_uuid_list=None, session_uuid=None):
    action = api_actions.ExpungeImageAction()
    action.imageUuid = image_uuid
    action.backupStorageUuids = backup_storage_uuid_list
    test_util.action_logger('Expunge [image:] %s' % image_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
def reconnect_host(host_uuid, session_uuid=None, timeout=120000):
    action = api_actions.ReconnectHostAction()
    action.uuid = host_uuid
    action.timeout = timeout
    test_util.action_logger('Reconnect Host [uuid:] %s' % host_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def delete_scheduler(uuid, session_uuid = None):
    action = api_actions.DeleteSchedulerAction()
    action.uuid = uuid
    test_util.action_logger('Delete [Scheduler:] %s' % uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid) 
    test_util.test_logger('[Scheduler:] %s is deleted.' % uuid)
    return evt
def delete_tag(tag_uuid, session_uuid=None):
    action = api_actions.DeleteTagAction()
    action.uuid = tag_uuid
    action.timeout = 30000
    test_util.action_logger('Delete Tag [uuid:] %s' % tag_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
def get_vm_console_protocol(uuid, session_uuid=None):
    action = api_actions.GetVmConsoleAddressAction()
    action.timeout = 30000
    action.uuid = uuid
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.action_logger('Get VM Console protocol:  %s ' % evt.protocol)
    return evt
def delete_security_group(sg_uuid, session_uuid=None):
    action = api_actions.DeleteSecurityGroupAction()
    action.uuid = sg_uuid
    action.timeout = 12000
    test_util.action_logger('Delete [Security Group:] %s' % sg_uuid)
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    return evt
def delete_zone(zone_uuid, session_uuid=None):
    action = api_actions.DeleteZoneAction()
    action.uuid = zone_uuid
    action.timeout = 600000
    test_util.action_logger('Delete Zone [uuid:] %s' % zone_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def get_trash_on_backup_storage(backup_storage_uuid, session_uuid=None):
    action = api_actions.GetTrashOnBackupStorageAction()
    action.uuid = backup_storage_uuid
    action.timeout = 6000000
    test_util.action_logger('Get Trash On Backup Storage [uuid:] %s' % backup_storage_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.storageTrashSpecs
def get_ip_capacity_by_l3s(l3_network_list, session_uuid = None):
    action = api_actions.GetIpAddressCapacityAction()
    action.l3NetworkUuids = l3_network_list
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.action_logger('Get L3s: [%s] IP Capacity' % \
            l3_network_list)
    return evt
def detach_l3(nic_uuid, session_uuid = None):
    action = api_actions.DetachL3NetworkFromVmAction()
    action.vmNicUuid = nic_uuid
    test_util.action_logger('[Detach L3 Network Nic]: %s' % nic_uuid)
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.test_logger('[L3 Network Nic]: %s has been detached'% nic_uuid)
    return evt.inventory
def attach_port_forwarding(pf_rule_uuid, vm_nic_uuid, session_uuid=None):
    action = api_actions.AttachPortForwardingRuleAction()
    action.ruleUuid = pf_rule_uuid
    action.vmNicUuid = vm_nic_uuid
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.action_logger("Port Forwarding Rule [uuid:] %s is attached to %s" % (pf_rule_uuid, vm_nic_uuid))
    return evt.inventory
def migrate_volume(volume_uuid, host_uuid, session_uuid = None):
    action = api_actions.LocalStorageMigrateVolumeAction()
    action.destHostUuid = host_uuid
    action.volumeUuid = volume_uuid
    test_util.action_logger('Migrate Local Storage Volume: %s to Host: %s' \
            % (volume_uuid, host_uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
def delete_disk_offering(disk_offering_uuid, session_uuid = None):
    action = api_actions.DeleteDiskOfferingAction()
    action.uuid = disk_offering_uuid
    test_util.action_logger('Delete Disk Offering [uuid:] %s' \
            % disk_offering_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
def delete_volume(volume_uuid, session_uuid=None):
    action = api_actions.DeleteDataVolumeAction()
    action.uuid = volume_uuid
    action.timeout = 120000
    evt = account_operations.execute_action_with_session(action, session_uuid)
    test_util.action_logger('Delete Volume [uuid:] %s' % volume_uuid)
    return evt
def delete_eip(eip_uuid, session_uuid=None):
    action = api_actions.DeleteEipAction()
    action.uuid = eip_uuid
    action.timeout = 12000
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.action_logger("[EIP:] %s is deleted" % eip_uuid)
    return evt
def create_port_forwarding(pf_rule_creation_option):
    action = api_actions.CreatePortForwardingRuleAction()
    action.name = pf_rule_creation_option.get_name()
    if not action.name:
        action.name = 'test_port_forwarding_rule'

    action.timeout = pf_rule_creation_option.get_timeout()
    if not action.timeout:
        action.timeout = 12000

    action.description = pf_rule_creation_option.get_description()
    session_uuid = pf_rule_creation_option.get_session_uuid()

    action.vipPortStart, action.vipPortEnd = pf_rule_creation_option.get_vip_ports()
    action.privatePortStart, action.privatePortEnd = pf_rule_creation_option.get_private_ports()
    if not action.privatePortStart:
        action.privatePortStart = action.vipPortStart
        action.privatePortEnd = action.vipPortEnd

    action.vipUuid = pf_rule_creation_option.get_vip_uuid()
    action.vmNicUuid = pf_rule_creation_option.get_vm_nic_uuid()
    action.allowedCidr = pf_rule_creation_option.get_allowedCidr()
    action.protocolType = pf_rule_creation_option.get_protocol()
    test_util.action_logger("Create Port Forwarding Rule: [vipUuid:] %s [vm nic:] %s [vip start:] %s [vip end:] %s [pri start:] %s [pri end:] %s [allowedCidr:] %s" % (action.vipUuid, action.vmNicUuid, action.vipPortStart, action.vipPortEnd, action.privatePortStart, action.privatePortEnd, action.allowedCidr))
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    return evt.inventory
def delete_snapshot(snapshot_uuid, session_uuid=None):
    action = api_actions.DeleteVolumeSnapshotAction()
    action.uuid = snapshot_uuid
    action.timeout = 60000
    test_util.action_logger('Delete [Snapshot:] %s ' % snapshot_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
def batch_delete_snapshot(snapshot_uuid_list, session_uuid=None):
    action = api_actions.BatchDeleteVolumeSnapshotAction()
    action.uuids = snapshot_uuid_list
    action.timeout = 300000
    test_util.action_logger('Batch Delete [Snapshots:] %s ' % snapshot_uuid_list)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
def add_root_volume_template(image_creation_option):
    '''
    Add root volume template
    '''
    action = api_actions.AddImageAction()
    action.name = image_creation_option.get_name()
    action.guest_os_type = image_creation_option.get_guest_os_type()
    action.mediaType = 'RootVolumeTemplate'
    if image_creation_option.get_mediaType() and \
            action.mediaType != image_creation_option.get_mediaType():
        test_util.test_warn('image type %s was not %s' % \
                (image_creation_option.get_mediaType(), action.mediaType))

    action.backupStorageUuids = \
            image_creation_option.get_backup_storage_uuid_list()
    action.bits = image_creation_option.get_bits()
    action.description = image_creation_option.get_description()
    action.format = image_creation_option.get_format()
    if image_creation_option.get_system_tags() != None:
        action.systemTags = image_creation_option.get_system_tags().split(',')
    action.url = image_creation_option.get_url()
    action.timeout = image_creation_option.get_timeout()
    test_util.action_logger('Add Root Volume Template from url: %s in [backup Storage:] %s' % (action.url, action.backupStorageUuids))
    evt = account_operations.execute_action_with_session(action, \
            image_creation_option.get_session_uuid())
    return evt.inventory
def create_root_volume_template(image_creation_option):
    '''
    Create Root Volume Template from a root volume
    '''
    action = api_actions.CreateRootVolumeTemplateFromRootVolumeAction()
    action.rootVolumeUuid = image_creation_option.get_root_volume_uuid()
    action.backupStorageUuids = image_creation_option.get_backup_storage_uuid_list()

    name = image_creation_option.get_name()
    if not name:
        action.name = 'test_template_image'
    else:
        action.name = name

    action.guestOsType = image_creation_option.get_guest_os_type()
    action.system = image_creation_option.get_system()
    action.platform = image_creation_option.get_platform()

    description = image_creation_option.get_description()
    if not description:
        action.description = "test create template from volume"
    else:
        action.description = description

    test_util.action_logger('Create Image Template from [root Volume:] %s in [backup Storage:] %s' % (action.rootVolumeUuid, action.backupStorageUuids))
    evt = account_operations.execute_action_with_session(action, image_creation_option.get_session_uuid())
    return evt.inventory
def add_zone_resource(deploy_config, zone_name):
    session_uuid = acc_ops.login_as_admin()
    try:
        test_util.test_dsc('-------add zone operation-------')
        dep_ops.add_zone(deploy_config, session_uuid, zone_name = zone_name)
        test_util.test_dsc('-------add l2 operation-------')
        dep_ops.add_l2_network(deploy_config, session_uuid, \
                zone_name = zone_name)
        test_util.test_dsc('-------add primary stroage operation-------')
        dep_ops.add_primary_storage(deploy_config, session_uuid, \
                zone_name = zone_name)
        test_util.test_dsc('-------add cluster operation-------')
        dep_ops.add_cluster(deploy_config, session_uuid, \
                zone_name = zone_name)
        test_util.test_dsc('-------add host operation-------')
        dep_ops.add_host(deploy_config, session_uuid, \
                zone_name = zone_name)
        test_util.test_dsc('-------add l3 operation-------')
        dep_ops.add_l3_network(deploy_config, session_uuid, \
                zone_name = zone_name)
        test_util.test_dsc('-------add virtual router offering operation-------')
        dep_ops.add_virtual_router(deploy_config, session_uuid, \
                zone_name = zone_name)
        zone = res_ops.get_resource(res_ops.ZONE, session_uuid, \
                name = zone_name)[0]
    except Exception as e:
        test_util.test_logger('[Error] zstack deployment meets exception when adding zone resource .')
        traceback.print_exc(file=sys.stdout)
        raise e
    finally:
        acc_ops.logout(session_uuid)

    test_util.action_logger('Complete add zone resources for [uuid:] %s' \
            % zone.uuid)
def create_template_from_snapshot(image_creation_option, session_uuid=None):
    action = api_actions.CreateRootVolumeTemplateFromVolumeSnapshotAction()
    action.snapshotUuid = image_creation_option.get_root_volume_uuid()
    action.backupStorageUuids = image_creation_option.get_backup_storage_uuid_list()

    action.guestOsType = image_creation_option.get_guest_os_type()
    action.system = image_creation_option.get_system()
    action.platform = image_creation_option.get_platform()

    name = image_creation_option.get_name()
    if not name:
        action.name = 'test_template_image_by_snapshot'
    else:
        action.name = name

    description = image_creation_option.get_description()
    if not description:
        action.description = "test create template from snapshot: %s" % \
                action.snapshotUuid
    else:
        action.description = description

    test_util.action_logger('Create Image Template from [snapshot:] %s in [backup Storage:] %s' % (action.snapshotUuid, action.backupStorageUuids))
    evt = account_operations.execute_action_with_session(action, image_creation_option.get_session_uuid())
    return evt.inventory
def use_snapshot(snapshot_uuid, session_uuid=None):
    action = api_actions.RevertVolumeFromSnapshotAction()
    action.uuid = snapshot_uuid
    action.timeout = 12000
    test_util.action_logger('Revert Volume by [Snapshot:] %s ' % snapshot_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
def delete_vcenter(vcenter_uuid, timeout=240000, session_uuid=None):
    action = api_actions.DeleteVCenterAction()
    action.uuid = vcenter_uuid
    action.timeout = timeout
    test_util.action_logger('Delete VCenter [uuid:] %s' % vcenter_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def change_image_state(uuid, state, session_uuid):
    action = api_actions.ChangeImageStateAction()
    action.uuid = uuid
    action.stateEvent = state
    test_util.action_logger('Change [image %s] state' % (uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory   
def detach_volume(volume_uuid, session_uuid=None):
    action = api_actions.DetachDataVolumeFromVmAction()
    action.uuid = volume_uuid
    action.timeout = 120000
    test_util.action_logger('Detach Volume [uuid:] %s' % volume_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def update_image_platform(uuid, platform, session_uuid=None):
    action = api_actions.UpdateImageAction()
    action.uuid = uuid
    action.platform = platform
    test_util.action_logger('Update [image %s] platform' % (uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory   
Beispiel #31
0
def reset_user_password(uuid, password, session_uuid = None):
    action = api_actions.ResetUserPasswordAction()
    action.uuid = uuid
    action.password = password
    test_util.action_logger('Reset [User:] %s [password:] %s' % \
            (uuid, password))
    evt = execute_action_with_session(action, session_uuid) 
    test_util.test_logger('[User:] %s password is reset.' % evt.inventory.uuid)
    return evt.inventory
Beispiel #32
0
def update_quota(identity_uuid,name,value,session_uuid=None):
   action = api_actions.UpdateQuotaAction()
   action.identityUuid = identity_uuid
   action.name = name
   action.value = value
   action.timeout = 240000
   evt = execute_action_with_session(action,session_uuid)
   test_util.action_logger('Update resource [name:] %s value to %s of account [identityUuid] %s ' % (name,value,identity_uuid))
   return evt.inventory	
def attach_port_forwarding(pf_rule_uuid, vm_nic_uuid, session_uuid=None):
    action = api_actions.AttachPortForwardingRuleAction()
    action.ruleUuid = pf_rule_uuid
    action.vmNicUuid = vm_nic_uuid
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.action_logger(
        "Port Forwarding Rule [uuid:] %s is attached to %s" %
        (pf_rule_uuid, vm_nic_uuid))
    return evt.inventory
def detach_security_group_from_l3(sg_uuid, l3_uuid, session_uuid=None):
    action = api_actions.DetachSecurityGroupFromL3NetworkAction()
    action.l3NetworkUuid = l3_uuid
    action.securityGroupUuid = sg_uuid
    action.timeout = 12000
    test_util.action_logger('Detach [Security Group:] %s from [l3:] %s' %
                            (sg_uuid, l3_uuid))
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    return evt
Beispiel #35
0
def attach_backup_stroage(backup_stroage_uuid, zone_uuid, session_uuid=None):
    action = api_actions.AttachBackupStorageToZoneAction()
    action.zoneUuid = zone_uuid
    action.primaryStorageUuid = backup_stroage_uuid
    action.timeout = 30000
    test_util.action_logger('Attach Backup Storage [uuid:] %s to Zone [uuid:] %s' % \
            (backup_stroage_uuid, zone_uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #36
0
def set_vm_console_password(uuid, console_password, session_uuid=None):
    action = api_actions.SetVmConsolePasswordAction()
    action.timeout = 30000
    action.uuid = uuid
    action.consolePassword = console_password
    evt = account_operations.execute_action_with_session(action, session_uuid)
    test_util.action_logger('Set VM [uuid:] %s Console Password [%s]' % \
            (uuid, console_password))
    return evt
def attach_eip(eip_uuid, nic_uuid, session_uuid=None):
    action = api_actions.AttachEipAction()
    action.eipUuid = eip_uuid
    action.vmNicUuid = nic_uuid
    action.timeout = 12000
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.action_logger("[EIP:] %s is attached to [nic:] %s" %
                            (eip_uuid, nic_uuid))
    return evt.inventory
Beispiel #38
0
def update_license(node_uuid, file_license, session_uuid=None):
    action = api_actions.UpdateLicenseAction()
    action.managementNodeUuid = node_uuid
    action.license = file_license
    test_util.action_logger('update license from UI')
    result = account_operations.execute_action_with_session(action, \
            session_uuid)

    return result
Beispiel #39
0
def migrate_vm(vm_uuid, host_uuid, session_uuid=None):
    action = api_actions.MigrateVmAction()
    action.vmInstanceUuid = vm_uuid
    action.hostUuid = host_uuid
    action.timeout = 240000
    test_util.action_logger('Migrate VM [uuid:] %s to Host [uuid:] %s' %
                            (vm_uuid, host_uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #40
0
def attach_primary_storage(primary_storage_uuid, cluster_uuid, session_uuid=None):
    action = api_actions.AttachPrimaryStorageToClusterAction()
    action.clusterUuid = cluster_uuid
    action.primaryStorageUuid = primary_storage_uuid
    action.timeout = 30000
    test_util.action_logger('Attach Primary Storage [uuid:] %s to Cluster [uuid:] %s' % \
            (primary_storage_uuid, cluster_uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def test():
    global vm
    global trigger
    global media
    global trigger_action

    vm = test_stub.create_vm()
    vm.check()
    vm_ip = vm.get_vm().vmNics[0].ip
    vm_uuid = vm.get_vm().uuid
    vm_username = os.environ.get('Vm_Username')
    vm_password = os.environ.get('Vm_Password')
    vm_port = os.environ.get('Vm_Sshport')

    test_item = "vm.network.io"
    resource_type = "VmInstanceVO"
    vm_monitor_item = test_stub.get_monitor_item(resource_type)
    if test_item not in vm_monitor_item:
        test_util.test_fail('%s is not available for monitor' % test_item)

    duration = 300
    expression = "vm.network.io{direction=\"tx\"} > 1300"
    monitor_trigger = mon_ops.create_monitor_trigger(vm_uuid, duration, expression)

    send_email = test_stub.create_email_media()
    media = send_email.uuid
    trigger_action_name = "trigger_"+ ''.join(map(lambda xx:(hex(ord(xx))[2:]),os.urandom(8)))
    trigger = monitor_trigger.uuid
    receive_email = os.environ.get('receive_email')
    monitor_trigger_action = mon_ops.create_email_monitor_trigger_action(trigger_action_name, send_email.uuid, trigger.split(), receive_email)
    trigger_action = monitor_trigger_action.uuid

    ssh_cmd = test_stub.ssh_cmd_line(vm_ip, vm_username, vm_password, vm_port)
    hosts = res_ops.get_resource(res_ops.HOST)
    host = hosts[0]

    test_stub.yum_install_stress_tool(ssh_cmd)
    t = threading.Thread(target=test_stub.run_network_tx,args=(ssh_cmd,host.managementIp,))
    t.start()
    time.sleep(380)
    test_stub.kill(ssh_cmd)

    status_problem, status_ok = test_stub.query_trigger_in_loop(trigger,80)
    test_util.action_logger('Trigger old status: %s triggered. Trigger new status: %s recovered' % (status_problem, status_ok ))
    if status_problem != 1 or status_ok != 1:
        test_util.test_fail('%s Monitor Test failed, expected Problem or OK status not triggered' % test_item)

    mail_list = test_stub.receive_email()
    keywords = "fired"
    mail_flag = test_stub.check_email(mail_list, keywords, trigger, vm_uuid)
    if mail_flag == 0:
        test_util.test_fail('Failed to Get Target: %s for: %s Trigger Mail' % (vm_uuid, test_item))

    mon_ops.delete_monitor_trigger_action(trigger_action)
    mon_ops.delete_monitor_trigger(trigger)
    mon_ops.delete_email_media(media)
    vm.destroy()
Beispiel #42
0
def change_primary_storage_state(primary_storage_uuid, state, session_uuid=None):
    action = api_actions.ChangePrimaryStorageStateAction()
    action.uuid = primary_storage_uuid
    action.stateEvent = state
    action.timeout = 300000
    test_util.action_logger('Change Primary Storage [uuid:] %s to [state:] %s' \
            % (primary_storage_uuid, state))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #43
0
def resize_data_volume(volume_uuid, size, session_uuid=None):
    action = api_actions.ResizeDataVolumeAction()
    action.uuid = volume_uuid
    action.size = size
    action.timeout = 240000
    test_util.action_logger('Resize Data Volume [uuid:] %s to %s' %
                            (volume_uuid, size))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #44
0
def calculate_account_spending(account_uuid, session_uuid = None):
    action = api_actions.CalculateAccountSpendingAction()
    action.accountUuid = account_uuid
    test_util.action_logger('Calculate account spending, uuid: %s' \
            % (account_uuid))
    result = account_operations.execute_action_with_session(action, \
            session_uuid)

    return result
def add_nic_to_security_group(sg_uuid, vm_nic_list, session_uuid=None):
    action = api_actions.AddVmNicToSecurityGroupAction()
    action.securityGroupUuid = sg_uuid
    action.vmNicUuids = vm_nic_list
    action.timeout = 120000
    test_util.action_logger('Add [Nics:] %s to [Security Group:] %s' \
            % (vm_nic_list, sg_uuid))
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    return evt
def expunge_image(image_uuid,
                  backup_storage_uuid_list=None,
                  session_uuid=None):
    action = api_actions.ExpungeImageAction()
    action.imageUuid = image_uuid
    action.backupStorageUuids = backup_storage_uuid_list
    test_util.action_logger('Expunge [image:] %s' % image_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
Beispiel #47
0
def attach_volume(volume_uuid, vm_uuid, session_uuid=None):
    action = api_actions.AttachDataVolumeToVmAction()
    action.vmInstanceUuid = vm_uuid
    action.volumeUuid = volume_uuid
    action.timeout = 240000
    test_util.action_logger('Attach Data Volume [uuid:] %s to [vm:] %s' %
                            (volume_uuid, vm_uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def remove_nic_from_security_group(sg_uuid, nic_uuid_list, session_uuid=None):
    action = api_actions.DeleteVmNicFromSecurityGroupAction()
    action.securityGroupUuid = sg_uuid
    action.vmNicUuids = nic_uuid_list
    action.timeout = 12000
    test_util.action_logger('Delete [Nics:] %s From [Security Group:] %s' \
            % (nic_uuid_list, sg_uuid))
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    return evt
Beispiel #49
0
def update_vm_nic_mac(vmNic_uuid, mac, session_uuid=None):
    action = api_actions.UpdateVmNicMacAction()
    action.vmNicUuid = vmNic_uuid
    action.mac = mac
    action.timeout = 240000
    test_util.action_logger('Update VM [uuid:] %s mac[address:] %s' %
                            (vmNic_uuid, mac))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #50
0
def create_zone(zone_option, session_uuid=None):
    action = api_actions.CreateZoneAction()
    action.timeout = 30000
    action.name = zone_option.get_name()
    action.description = zone_option.get_description()
    evt = account_operations.execute_action_with_session(action, session_uuid)
    test_util.action_logger('Add Zone [uuid:] %s [name:] %s' % \
            (evt.uuid, action.name))
    return evt.inventory
Beispiel #51
0
def change_vm_static_ip(vm_uuid, l3NetworkUuid, ip, session_uuid=None):
    action = api_actions.SetVmStaticIpAction()
    action.vmInstanceUuid = vm_uuid
    action.l3NetworkUuid = l3NetworkUuid
    action.ip = ip
    test_util.action_logger('Change VM static IP to %s [uuid:] %s' %
                            (ip, vm_uuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #52
0
def revoke_resources(account_uuid_list,resource_uuid_list,session_uuid = None):
		action = api_actions.RevokeResourceSharingAction()
		action.accountUuids = account_uuid_list
		action.resourceUuids = resource_uuid_list

		evt = execute_action_with_session(action, session_uuid)
		test_util.action_logger('Revoke [Resources]: %s from [Accounts]: %s' % \
			   (resource_uuid_list, account_uuid_list))
		return evt
Beispiel #53
0
def delete_vm_static_ip(vm_uuid, l3NetworkUuid, session_uuid=None):
    action = api_actions.DeleteVmStaticIpAction()
    action.vmInstanceUuid = vm_uuid
    action.l3NetworkUuid = l3NetworkUuid
    test_util.action_logger(
        'Delete VM[uuid:] %s l3Network[uuid:] %s static IP ' %
        (vm_uuid, l3NetworkUuid))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #54
0
def change_cluster_state(cluster_uuid, state, session_uuid=None):
    action = api_actions.ChangeClusterStateAction()
    action.uuid = cluster_uuid
    action.stateEvent = state
    action.timeout = 300000
    test_util.action_logger('Change Cluster [uuid:] %s to [state:] %s' %
                            (cluster_uuid, state))
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def request_baremetal_console_access(baremetal_instance_uuid,
                                     session_uuid=None):
    action = api_actions.RequestBaremetalConsoleAccessAction()
    action.baremetalInstanceUuid = baremetal_instance_uuid
    action.timeout = 30000
    test_util.action_logger(
        'Request Baremetal Instance Console Access [uuid:] %s' % uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
Beispiel #56
0
def create_user(name, password, session_uuid = None):
    action = api_actions.CreateUserAction()
    action.name = name
    action.password = password
    test_util.action_logger('Create [User:] %s with [password:] %s' % \
            (name, password))
    evt = execute_action_with_session(action, session_uuid) 
    test_util.test_logger('[User:] %s is created.' % evt.inventory.uuid)
    return evt.inventory
def start_baremetal_instance(uuid, pxe_boot=None, session_uuid=None):
    action = api_actions.StartBaremetalInstanceAction()
    action.uuid = uuid
    action.timeout = 30000
    if pxe_boot:
        action.pxeBoot = pxe_boot
    test_util.action_logger('Start Baremetal Instance [uuid:] %s' % uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def update_vm(vm_uuid, cpu, memory, session_uuid=None):
    action = api_actions.UpdateVmInstanceAction()
    action.uuid = vm_uuid
    action.cpuNum = cpu
    action.memorySize = memory
    action.timeout = 240000
    test_util.action_logger('Update VM [uuid:] %s' % vm_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
def get_power_status(chassis_uuid, session_uuid=None):
    '''The function is dropped'''
    action = api_actions.PowerStatusBaremetalHostAction()
    action.chassisUuid = chassis_uuid
    action.timeout = 30000
    test_util.action_logger('Get Power Status of Chassis [uuid:] %s' %
                            chassis_uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt
def stop_baremetal_instance(uuid, stop_type=None, session_uuid=None):
    action = api_actions.StopBaremetalInstanceAction()
    action.uuid = uuid
    action.timeout = 30000
    if stop_type:
        action.type = stop_type
    test_util.action_logger('Stop Baremetal Instance [uuid:] %s' % uuid)
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory