Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

API Documentation

viglesiasce edited this page Mar 5, 2012 · 1 revision

class Eucaops(eutester.Eutester)

     |  Method resolution order:
     |      Eucaops
     |      eutester.Eutester
     |      __builtin__.object
     |  
     |  Methods defined here:
     |  
     |  __init__(self, config_file=None, hostname=None, password=None, keypath=None, credpath=None, aws_access_key_id=None, aws_secret_access_key=None, account='eucalyptus', user='admin', boto_debug=0)
     |  
     |  add_group(self, group_name=None, fail_if_exists=False)
     |      Add a security group to the system with name group_name, if it exists dont create it
     |      group_name      Name of the security group to create
     |      fail_if_exists  IF set, will fail if group already exists, otherwise will return the existing group
     |      returns boto group object upon success or None for failure
     |  
     |  add_keypair(self, key_name=None)
     |      Add a keypair with name key_name unless it already exists
     |      key_name      The name of the keypair to add and download.
     |  
     |  allocate_address(self)
     |      Allocate an address for the current user
     |  
     |  associate_address(self, instance, address)
     |      Associate an address with an instance
     |  
     |  attach_volume(self, instance, volume, device_path)
     |      Attach a volume to an instance
     |      instance    instance object to attach volume to
     |      volume      volume object to attach
     |      device_path device name to request on guest
     |  
     |  authorize_group(self, group, port=22, protocol='tcp', cidr_ip='0.0.0.0/0')
     |      Authorize the group with group_name, 
     |      group_name      Name of the group to authorize, default="default"
     |      port            Port to open, default=22
     |      protocol        Protocol to authorize, default=tcp
     |      cidr_ip         CIDR subnet to authorize, default="0.0.0.0/0" everything
     |  
     |  authorize_group_by_name(self, group_name='default', port=22, protocol='tcp', cidr_ip='0.0.0.0/0')
     |      Authorize the group with group_name, 
     |      group_name      Name of the group to authorize, default="default"
     |      port            Port to open, default=22
     |      protocol        Protocol to authorize, default=tcp
     |      cidr_ip         CIDR subnet to authorize, default="0.0.0.0/0" everything
     |  
     |  check_device(self, device_path)
     |      Used with instance connections. Checks if a device at a certain path exists
     |  
     |  check_group(self, group_name)
     |      Check if a group with group_name exists in the system
     |      group_name      Group name to check for existence
     |  
     |  cleanup_artifacts(self)
     |  
     |  create_bucket(self, bucket_name)
     |      Create a bucket.  If the bucket already exists and you have
     |      access to it, no error will be returned by AWS.
     |      Note that bucket names are global to S3
     |      so you need to choose a unique name.
     |  
     |  create_snapshot(self, volume_id, description='', waitOnProgress=0, poll_interval=10, timeout=0)
     |      Create a new EBS snapshot from an existing volume then wait for it to go to the created state. By default will poll for poll_count.
     |      If waitOnProgress is specified than will wait on "waitOnProgress" # of periods w/o progress before failing
     |      An overall timeout can be given for both methods, by default the timeout is not used.    
     |      volume_id        (mandatory string) Volume id of the volume to create snapshot from
     |      description      (optional string) string used to describe the snapshot
     |      waitOnProgress   (optional integer) # of poll intervals to wait while 0 progress is made before exiting, overrides "poll_count" when used
     |      poll_interval    (optional integer) time to sleep between polling snapshot status
     |      timeout          (optional integer) over all time to wait before exiting as failure
     |      returns snapshot
     |  
     |  create_volume(self, azone, size=1, snapshot=None)
     |      Create a new EBS volume then wait for it to go to available state, size or snapshot is mandatory
     |      azone        Availability zone to create the volume in
     |      size         Size of the volume to be created
     |      snapshot     Snapshot to create the volume from
     |  
     |  delete_all_volumes(self)
     |      Deletes all volumes on the cloud
     |  
     |  delete_bucket(self, bucket)
     |      Delete a bucket.
     |      bucket_name  The name of the Walrus Bucket
     |  
     |  delete_group(self, group)
     |      Delete the group object passed in and check that it no longer shows up
     |      group      Group object to delete and check
     |  
     |  delete_keypair(self, keypair)
     |      Delete the keypair object passed in and check that it no longer shows up
     |      keypair      Keypair object to delete and check
     |  
     |  delete_object(self, object)
     |  
     |  delete_snapshot(self, snapshot)
     |      Delete the snapshot object
     |  
     |  delete_volume(self, volume)
     |      Delete the EBS volume then check that it no longer exists
     |      volume        Volume object to delete
     |  
     |  detach_volume(self, volume)
     |      Detach a volume
     |      volume   volume to detach
     |  
     |  disassociate_address_from_instance(self, instance)
     |      Disassociate address from instance and ensure that it no longer holds the IP
     |      instance     An instance that has an IP allocated
     |  
     |  get_available_vms(self, type=None, zone=None)
     |      Get available VMs of a certain type or return a dictionary with all types and their available vms
     |      type        VM type to get available vms
     |  
     |  get_bucket_by_name(self, bucket_name)
     |      Lookup a bucket by name, if it does not exist return false
     |  
     |  get_current_resources(self, verbose=False)
     |      Return a dictionary with all known resources the system has. Optional pass the verbose=True flag to print this info to the logs
     |      Included resources are: addresses, images, instances, key_pairs, security_groups, snapshots, volumes, zones
     |  
     |  get_emi(self, emi='emi-', root_device_type=None, root_device_name=None, location=None, state='available', arch=None, owner_id=None)
     |      Get an emi with name emi, or just grab any emi in the system. Additional 'optional' match criteria can be defined.
     |      emi              (mandatory) Partial ID of the emi to return, defaults to the 'emi-" prefix to grab any
     |      root_device_type (optional string)  example: 'instance-store' or 'ebs'
     |      root_device_name (optional string)  example: '/dev/sdb' 
     |      location         (optional string)  partial on location match example: 'centos'
     |      state            (optional string)  example: 'available'
     |      arch             (optional string)  example: 'x86_64'
     |      owner_id         (optional string) owners numeric id
     |  
     |  get_master(self, component='clc')
     |      Find the master of any type of component and return its IP, by default returns the master CLC
     |      component        Component to find the master, possible values ["clc", "sc", "cc", "ws"]
     |  
     |  get_metadata(self, element_path)
     |      Return the lines of metadata from the element path provided
     |  
     |  get_objects_by_prefix(self, bucket_name, prefix)
     |      Get keys in the specified bucket that match the prefix if no prefix is passed all objects are returned
     |      as a result set.
     |      If only 1 key matches it will be returned as a Key object.
     |  
     |  get_volume(self, volume_id='vol-', status=None, attached_instance=None, attached_dev=None, snapid=None, zone=None, minsize=1, maxsize=None)
     |      Return first volume that matches the criteria. Criteria options to be matched:
     |      volume_id         (optional string) string present within volume id
     |      status            (optional string) examples: 'in-use', 'creating', 'available'
     |      attached_instance (optional string) instance id example 'i-1234abcd'
     |      attached_dev      (optional string) example '/dev/sdf'
     |      snapid            (optional string) snapshot volume was created from example 'snap-1234abcd'
     |      zone              (optional string) zone of volume example 'PARTI00'
     |      minsize           (optional integer) minimum size of volume to be matched
     |      maxsize           (optional integer) maximum size of volume to be matched
     |  
     |  modify_property(self, property, value)
     |      Modify a eucalyptus property through the command line euca-modify-property tool
     |      property        Property to modify
     |      value           Value to set it too
     |  
     |  ping(self, address, poll_count=10)
     |      Ping an IP and poll_count times (Default = 10)
     |      address      Hostname to ping
     |      poll_count   The amount of times to try to ping the hostname iwth 2 second gaps in between
     |  
     |  register_image(self, snap_id, rdn=None, description=None, image_location=None, windows=False, bdmdev=None, name=None, ramdisk=None, kernel=None)
     |      Register an image snapshot
     |      snap_id        (optional string) snapshot id
     |      name           (optional string) name of image to be registered
     |      description    (optional string) description of image to be registered
     |      bdm            (optional block_device_mapping) block-device-mapping object for image
     |      rdn            (optional string) root-device-name for image
     |      kernel         (optional string) kernal (note for windows this name should be "windows"
     |      image_location (optional string) path to s3 stored manifest
     |  
     |  register_snapshot(self, snapshot, rdn='/dev/sda1', description='bfebs', windows=False, bdmdev=None, name=None, ramdisk=None, kernel=None, dot=True)
     |      Convience function for passing a snapshot instead of its id
     |  
     |  register_snapshot_by_id(self, snap_id, rdn='/dev/sda1', description='bfebs', windows=False, bdmdev=None, name=None, ramdisk=None, kernel=None, dot=True)
     |      Register an image snapshot
     |      snap_id        (mandatory string) snapshot id
     |      name           (mandatory string) name of image to be registered
     |      description    (optional string) description of image to be registered
     |      bdmdev         (optional string) block-device-mapping device for image
     |      rdn            (optional string) root-device-name for image
     |      dot            (optional boolean) Delete On Terminate boolean
     |      windows        (optional boolean) Is windows image boolean
     |      kernel         (optional string) kernal (note for windows this name should be "windows"
     |  
     |  release_address(self, ip=None)
     |      Release all addresses or a particular IP
     |      ip        IP to release
     |  
     |  run_instance(self, image=None, keypair=None, group='default', type=None, zone=None, min=1, max=1)
     |      Run instance/s and wait for them to go to the running state
     |      image      Image object to use, default is pick the first emi found in the system
     |      keypair    Keypair name to use for the instances, defaults to none
     |      group      Security group name to apply to this set of instnaces, defaults to none
     |      type       VM type to use for these instances, defaults to m1.small
     |      zone       Availability zone to run these instances
     |      min        Minimum instnaces to launch, default 1
     |      max        Maxiumum instances to launch, default 1
     |  
     |  terminate_instances(self, reservation=None)
     |      Terminate instances in the system
     |      reservation        Reservation object to terminate all instances in, default is to terminate all instances
     |  
     |  upload_object_file(self, bucket_name, key_name, path_to_file)
     |      Write the contents of a local file to walrus
     |      bucket_name   The name of the walrus Bucket.
     |      key_name      The name of the object containing the data in walrus.
     |      path_to_file  Fully qualified path to local file.
     |  
     |  wait_for_instance(self, instance, state='running')
     |      Wait for the instance to enter the state
     |      instance      Boto instance object to check the state on
     |      state        state that we are looking for
     |  
     |  wait_for_reservation(self, reservation, state='running')
     |      Wait for the an entire reservation to enter the state
     |      reservation  Boto reservation object to check the state on
     |      state        state that we are looking for
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from eutester.Eutester:
     |  
     |  __del__(self)
     |  
     |  __str__(self)
     |  
     |  clear_fail_count(self)
     |  
     |  clear_fail_log(self)
     |  
     |  create_ssh(self, hostname, password=None, keypath=None, username='root')
     |      Returns a paramiko SSHClient object for the hostname provided, either keypath or password must be provided
     |  
     |  diff(self, list1, list2)
     |      Return the diff of the two lists
     |  
     |  do_exit(self)
     |      Prints a short sumary of the test including the failure messages and time to execute. Exits 0 if no failures were encountered or 1 if there were
     |  
     |  fail(self, message)
     |  
     |  found(self, command, regex, local=False)
     |      Returns a Boolean of whether the result of the command contains the regex
     |  
     |  get_access_key(self)
     |      Parse the eucarc for the EC2_ACCESS_KEY
     |  
     |  get_account_id(self)
     |      Parse the eucarc for the EC2_ACCOUNT_NUMBER
     |  
     |  get_clc_ip(self)
     |      Parse the eucarc for the EC2_URL
     |  
     |  get_component_ip(self, component)
     |      Parse the machine list and a bm_machine object for a machine that matches the component passed in
     |  
     |  get_component_machines(self, component)
     |      Parse the machine list and a list of bm_machine objects that match the component passed in
     |  
     |  get_credentials(self, account='eucalyptus', user='admin')
     |      Login to the CLC and download credentials programatically for the user and account passed in
     |      Defaults to admin@eucalyptus
     |  
     |  get_exectuion_time(self)
     |      Returns the total execution time since the instantiation of the Eutester object
     |  
     |  get_hypervisor(self)
     |      Requires that a config file was passed.
     |      Returns the supported hypervisor that should be used absed on the config file passed into the system
     |      For RHEL 6 and UBUNTU: kvm
     |      For CentOS 5: xen
     |      For VMware: vmware
     |  
     |  get_secret_key(self)
     |      Parse the eucarc for the EC2_SECRET_KEY
     |  
     |  get_walrus_ip(self)
     |      Parse the eucarc for the S3_URL
     |  
     |  grep(self, string, list)
     |      Remove the strings from the list that do not match the regex string
     |  
     |  handle_timeout(self, signum, frame)
     |  
     |  local(self, cmd)
     |      Run a command locally on the tester
     |  
     |  parse_eucarc(self, field)
     |  
     |  poll_euca_logs(self)
     |  
     |  read_config(self, filepath)
     |      Parses the config file at filepath returns a dictionary with the config
     |      Config file
     |      ----------
     |      The configuration file for (2) private cloud mode has the following structure:
     |      
     |          clc.mydomain.com CENTOS 5.7 64 REPO [CC00 CLC SC00 WS]    
     |          nc1.mydomain.com VMWARE ESX-4.0 64 REPO [NC00]
     |      
     |      Columns
     |      ------ 
     |          IP or hostname of machine   
     |          Distro installed on machine - Options are RHEL, CENTOS, UBUNTU additionally VMWARE can be used for NCs 
     |          Distro version on machine  - RHEL (5.x, 6.x), CentOS (5.x), UBUNTU (LUCID)
     |          Distro base architecture  - 32 or 64
     |          System built from packages (REPO) or source (BZR), packages assumes path to eucalyptus is /, bzr assumes path to eucalyptus is /opt/eucalyptus
     |          List of components installed on this machine encapsulated in brackets []
     |      
     |      These components can be:
     |      
     |          CLC - Cloud Controller   
     |          WS - Walrus   
     |          SC00 - Storage controller for cluster 00   
     |          CC00 - Cluster controller for cluster 00    
     |          NC00 - A node controller in cluster 00
     |  
     |  save_euca_logs(self)
     |      Save log buffers to a file
     |  
     |  sleep(self, seconds=1)
     |      Convinience function for time.sleep()
     |  
     |  start_euca_logs(self)
     |      Start thread to poll logs
     |  
     |  stop_euca_logs(self)
     |      Terminate thread that is polling logs
     |  
     |  swap_component_hostname(self, hostname)
     |  
     |  sys(self, cmd, verbose=1, timeout=-2)
     |      By default will run a command on the CLC machine, the connection used can be changed by passing a different hostname into the constructor
     |      For example:
     |      instance = Eutester( hostname=instance.ip_address, keypath="my_key.pem")
     |      instance.sys("mount") # check mount points on instance and return the output as a list
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from eutester.Eutester:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
Clone this wiki locally