def __init__(self, extra_args= None): self.setuptestcase() self.setup_parser() if extra_args: for arg in extra_args: self.parser.add_argument(arg) self.get_args() # Setup basic eutester object if self.args.region: self.tester = EC2ops( credpath=self.args.credpath, region=self.args.region) else: self.tester = Eucaops(config_file=self.args.config, password=self.args.password, credpath=self.args.credpath) self.tester.poll_count = 120 ### Add and authorize a group for the instance self.group = self.tester.add_group(group_name="group-" + str(time.time())) self.tester.authorize_group_by_name(group_name=self.group.name ) self.tester.authorize_group_by_name(group_name=self.group.name, port=-1, protocol="icmp" ) ### Generate a keypair for the instance self.keypair = self.tester.add_keypair( "keypair-" + str(time.time())) self.keypath = '%s/%s.pem' % (os.curdir, self.keypair.name) self.image = self.args.emi if not self.image: self.image = self.tester.get_emi(root_device_type="instance-store") self.address = None self.volume = None self.snapshot = None self.private_addressing = False zones = self.tester.ec2.get_all_zones() self.zone = random.choice(zones).name self.reservation = None
def __init__(self, extra_args=None): self.setuptestcase() self.setup_parser() self.parser.add_argument("--region", default=None) if extra_args: for arg in extra_args: self.parser.add_argument(arg) self.get_args() # Setup basic eutester object if self.args.region: self.tester = EC2ops(credpath=self.args.credpath, region=self.args.region) else: self.tester = Eucaops(credpath=self.args.credpath, config_file=self.args.config, password=self.args.password) self.tester.poll_count = 120 self.security_groups = [] ### Generate a keypair for the instance self.keypair = self.tester.add_keypair("keypair-" + str(time.time())) self.keypath = '%s/%s.pem' % (os.curdir, self.keypair.name) self.image = self.args.emi if not self.image: self.image = self.tester.get_emi(root_device_type="instance-store") self.address = None self.volume = None self.snapshot = None self.private_addressing = False zones = self.tester.ec2.get_all_zones() self.zone = random.choice(zones).name self.reservation = None
def __init__(self, extra_args=None): self.setuptestcase() self.setup_parser() self.parser.add_argument('-c', '--command', help='Command to monitor') self.parser.add_argument('-n', '--namespace', help='Namespace to put data under') self.parser.add_argument('-m', '--metric-name', help='Metric name to put data under') self.parser.add_argument('-u', '--unit', default=None, help="Unit that the value be returned with") self.parser.add_argument( '-i', '--interval', default=10, type=int, help='Time between exectutions of the monitoring task') if extra_args: for arg in extra_args: self.parser.add_argument(arg) self.get_args() # Setup basic eutester object if self.args.region: self.tester = EC2ops(credpath=self.args.credpath, region=self.args.region) else: self.tester = Eucaops(credpath=self.args.credpath, config_file=self.args.config, password=self.args.password)
def __init__( self, name="InstanceBasics", credpath=None, region=None, config_file=None, password=None, emi=None, zone=None, user_data=None, instance_user=None, **kwargs): """ EC2 API tests focused on instance store instances :param credpath: Path to directory containing eucarc file :param region: EC2 Region to run testcase in :param config_file: Configuration file path :param password: SSH password for bare metal machines if config is passed and keys arent synced :param emi: Image id to use for test :param zone: Availability Zone to run test in :param user_data: User Data to pass to instance :param instance_user: User to login to instance as :param kwargs: Additional arguments """ super(InstanceBasics, self).__init__(name=name) if region: self.tester = EC2ops(credpath=credpath, region=region) else: self.tester = Eucaops(config_file=config_file, password=password, credpath=credpath) self.instance_timeout = 480 ### Add and authorize a group for the instance self.group = self.tester.add_group(group_name="group-" + str(time.time())) self.tester.authorize_group_by_name(group_name=self.group.name) self.tester.authorize_group_by_name(group_name=self.group.name, port=-1, protocol="icmp" ) ### Generate a keypair for the instance self.keypair = self.tester.add_keypair( "keypair-" + str(time.time())) self.keypath = '%s/%s.pem' % (os.curdir, self.keypair.name) if emi: self.image = emi else: self.image = self.tester.get_emi(root_device_type="instance-store",not_location="loadbalancer") self.address = None self.volume = None self.private_addressing = False if not zone: zones = self.tester.ec2.get_all_zones() self.zone = random.choice(zones).name else: self.zone = zone self.reservation = None self.reservation_lock = threading.Lock() self.run_instance_params = {'image': self.image, 'user_data': user_data, 'username': instance_user, 'keypair': self.keypair.name, 'group': self.group.name,'zone': self.zone, 'timeout': self.instance_timeout} self.managed_network = True ### If I have access to the underlying infrastructure I can look ### at the network mode and only run certain tests where it makes sense if hasattr(self.tester,"service_manager"): cc = self.tester.get_component_machines("cc")[0] network_mode = cc.sys("cat " + self.tester.eucapath + "/etc/eucalyptus/eucalyptus.conf | grep MODE")[0] if re.search("(SYSTEM|STATIC)", network_mode): self.managed_network = False
def __init__(self, extra_args= None, **kwargs): self.setuptestcase() self.setup_parser() if extra_args: for arg in extra_args: self.parser.add_argument(arg) self.get_args() for kwarg in kwargs: self.args[kwarg] = kwarg[kwarg] # Setup basic eutester object if self.args.region: self.tester = EC2ops( credpath=self.args.credpath, region=self.args.region) else: self.tester = Eucaops( credpath=self.args.credpath, config_file=self.args.config,password=self.args.password) self.tester.poll_count = 120
def __init__(self): extra_args = ['--size', '--repo-url', '--packages', '--user-data'] self.setuptestcase() self.setup_parser() if extra_args: for arg in extra_args: self.parser.add_argument(arg) self.get_args() # Setup basic eutester object if self.args.region: self.tester = EC2ops(credpath=self.args.credpath, region=self.args.region) else: self.tester = Eucaops(config_file=self.args.config, password=self.args.password, credpath=self.args.credpath) self.tester.poll_count = 120 ### Add and authorize a group for the instance self.group = self.tester.add_group(group_name="group-" + str(time.time())) self.tester.authorize_group_by_name(group_name=self.group.name) self.tester.authorize_group_by_name(group_name=self.group.name, port=-1, protocol="icmp") ### Generate a keypair for the instance self.keypair = self.tester.add_keypair("keypair-" + str(time.time())) self.keypath = '%s/%s.pem' % (os.curdir, self.keypair.name) if not self.args.emi: raise Exception( "Must pass base image id to use as parameter --emi") self.image = self.tester.get_emi(self.args.emi) self.address = None self.volume = None self.private_addressing = False zones = self.tester.ec2.get_all_zones() self.zone = random.choice(zones).name self.reservation = None