def create(self, cloudspaceId, **kwargs): data = { 'cloudspaceId': cloudspaceId, 'name': utils.random_string(), 'description': utils.random_string(), 'datadisks': [], 'userdata': '' } response = self._api.cloudapi.images.list() response.raise_for_status() image = random.choice([ x for x in response.json() if x["type"].startswith(('Window', 'Linux')) ]) data['imageId'] = image['id'] response.raise_for_status() response = self._api.cloudapi.sizes.list(cloudspaceId=cloudspaceId) response.raise_for_status() sizes = response.json() basic_sizes = [512, 1024, 4096, 8192, 16384, 2048] for _ in range(len(sizes)): size = random.choice(sizes) if size["memory"] in basic_sizes: break data['disksize'] = random.choice(size['disks']) data['sizeId'] = size['id'] data.update(**kwargs) return data, self._api.cloudbroker.machine.create(**data)
def create(self, cloudspaceId, **kwargs): data = { "cloudspaceId": cloudspaceId, "name": utils.random_string(), "description": utils.random_string(), "datadisks": [], "userdata": "", } response = self._api.cloudapi.images.list() response.raise_for_status() image = random.choice( [x for x in response.json() if x["type"].startswith(("Window", "Linux"))] ) data["imageId"] = image["id"] response.raise_for_status() response = self._api.cloudapi.sizes.list(cloudspaceId=cloudspaceId) response.raise_for_status() sizes = response.json() basic_sizes = [512, 1024, 4096, 8192, 16384, 2048] for _ in range(len(sizes)): size = random.choice(sizes) if size["memory"] in basic_sizes: break data["disksize"] = random.choice(size["disks"]) data["sizeId"] = size["id"] data.update(**kwargs) return data, self._api.cloudbroker.machine.create(**data)
def convertToTemplate(self, machineId, **kwargs): data = { 'machineId': machineId, 'templateName': utils.random_string(), 'reason': utils.random_string() } data.update(**kwargs) return data, self._api.cloudbroker.machine.convertToTemplate(**data)
def update(self, machineId, **kwargs): data = { 'machineId': machineId, 'name': utils.random_string(), 'description': utils.random_string(), } data.update(**kwargs) return data, self._api.cloudbroker.machine.update(**data)
def createGroup(self, **kwargs): data = { 'name': utils.random_string(), 'domain': utils.random_string(), 'description': utils.random_string(), } data.update(**kwargs) return data, self._api.system.usermanager.createGroup(**data)
def update(self, machineId, **kwargs): data = { "machineId": machineId, "name": utils.random_string(), "description": utils.random_string(), } data.update(**kwargs) return data, self._api.cloudapi.machines.update(**data)
def create(self, **kwargs): data = { "username": utils.random_string(), "emailaddress": "*****@*****.**" % utils.random_string(), "password": utils.random_string(), "groups": ["level1", "user", "level2", "level3", "admin"] } data.update(**kwargs) return data, self._api.cloudbroker.user.create(**data)
def editGroup(self, name, **kwargs): data = { "name": name, "domain": utils.random_string(), "description": utils.random_string(), "users": [], } data.update(**kwargs) return data, self._api.system.usermanager.editGroup(**data)
def editGroup(self, name, **kwargs): data = { 'name': name, 'domain': utils.random_string(), 'description': utils.random_string(), 'users': [] } data.update(**kwargs) return data, self._api.system.usermanager.editGroup(**data)
def editUser(self, username, **kwargs): data = { 'username': username, 'domain': utils.random_string(), 'password': utils.random_string(), 'emails': [utils.random_string() + '@test.com'], 'groups': ['admin'] } data.update(**kwargs) return data, self._api.system.usermanager.editUser(**data)
def send(self, sender_email, receiver_email, **kwargs): data = { "sender_email": sender_email, "receiver_email": receiver_email, "sender_name": utils.random_string(), "subject": utils.random_string(), "body": utils.random_string(), } data.update(**kwargs) return data, self._api.system.emailsender.send(**data)
def send(self, sender_email, receiver_email, **kwargs): data = { 'sender_email': sender_email, 'receiver_email': receiver_email, 'sender_name': utils.random_string(), 'subject': utils.random_string(), 'body': utils.random_string(), } data.update(**kwargs) return data, self._api.system.emailsender.send(**data)
def editUser(self, username, **kwargs): data = { "username": username, "domain": utils.random_string(), "password": utils.random_string(), "emails": [utils.random_string() + "@test.com"], "groups": ["admin"], } data.update(**kwargs) return data, self._api.system.usermanager.editUser(**data)
def create(self, **kwargs): data = { "username": utils.random_string(), "password": utils.random_string(), "groups": ["admin"], "emails": ["{}@test.com".format(utils.random_string())], "domain": utils.random_string(), "provider": utils.random_string(), } data.update(**kwargs) return data, self._api.system.usermanager.create(**data)
def create(self, **kwargs): data = { 'username': utils.random_string(), 'password': utils.random_string(), 'groups': ['admin'], 'emails': ['{}@test.com'.format(utils.random_string())], 'domain': utils.random_string(), 'provider': utils.random_string() } data.update(**kwargs) return data, self._api.system.usermanager.create(**data)
def addDisk(self, machineId, **kwargs): data = { 'machineId': machineId, 'diskName': utils.random_string(), 'description': utils.random_string(), 'size': random.randint(1, 1000), 'ssdSize': random.randint(1, 1000), 'type': random.choice(['D', 'B', 'T']), 'iops': random.randint(100, 5000) } data.update(**kwargs) return data, self._api.cloudapi.machines.addDisk(**data)
def addDisk(self, machineId, **kwargs): data = { "machineId": machineId, "diskName": utils.random_string(), "description": utils.random_string(), "size": random.randint(1, 1000), "ssdSize": random.randint(1, 1000), "type": random.choice(["D", "B", "T"]), "iops": random.randint(100, 5000), } data.update(**kwargs) return data, self._api.cloudapi.machines.addDisk(**data)
def create(self, accountId, gid, **kwargs): data = { "accountId": accountId, "gid": gid, "name": utils.random_string(), "description": utils.random_string(), "type": random.choice(["D", "B", "T"]), "size": random.randint(1, 1000), "ssdSize": random.randint(1, 1000), "iops": random.randint(100, 5000), } data.update(**kwargs) return data, self._api.cloudapi.disks.create(**data)
def create(self, accountId, gid, **kwargs): data = { 'accountId': accountId, 'gid': gid, 'name': utils.random_string(), 'description': utils.random_string(), 'type': random.choice(['D', 'B', 'T']), 'size': random.randint(1, 1000), 'ssdSize': random.randint(1, 1000), 'iops': random.randint(100, 5000) } data.update(**kwargs) return data, self._api.cloudapi.disks.create(** data)
def importOVF(self, link, username, passwd, path, cloudspaceId, sizeId, **kwargs): name = kwargs.get('name', utils.random_string()) description = kwargs.get('description', utils.random_string()) return self._api.cloudapi.machines.importOVF(link=link, username=username, passwd=passwd, path=path, cloudspaceId=cloudspaceId, name=name, description=description, sizeId=sizeId, **kwargs)
def snapshot(self, machineId, **kwargs): data = { "machineId": machineId, "snapshotname": utils.random_string(), "reason": utils.random_string } data.update(**kwargs) return data, self._api.cloudbroker.machine.snapshot(**data)
def clone(self, machineId, **kwargs): data = { 'machineId': machineId, 'cloneName': utils.random_string(), 'reason': utils.random_string } data.update(**kwargs) return data, self._api.cloudbroker.machine.clone(**data)
def create(self, access, **kwargs): data = { "name": utils.random_string(), "access": access, "maxMemoryCapacity": -1, "maxVDiskCapacity": -1, "maxCPUCapacity": -1, "maxNetworkPeerTransfer": -1, "maxNumPublicIP": -1, } data.update(**kwargs) return data, self._api.cloudapi.accounts.create(**data)
def update(self, accountId, **kwargs): data = { 'accountId': accountId, 'name': utils.random_string(), 'maxMemoryCapacity': -1, 'maxVDiskCapacity': -1, 'maxCPUCapacity': -1, 'maxNetworkPeerTransfer': -1, 'maxNumPublicIP': -1 } data.update(**kwargs) return data, self._api.cloudbroker.account.update(**data)
def create(self, access, **kwargs): data = { 'name': utils.random_string(), 'access': access, 'maxMemoryCapacity': -1, 'maxVDiskCapacity': -1, 'maxCPUCapacity': -1, 'maxNetworkPeerTransfer': -1, 'maxNumPublicIP': -1, } data.update(** kwargs) return data, self._api.cloudapi.accounts.create(** data)
def update(self, accountId, **kwargs): data = { "accountId": accountId, "name": utils.random_string(), "maxMemoryCapacity": -1, "maxVDiskCapacity": -1, "maxCPUCapacity": -1, "maxNetworkPeerTransfer": -1, "maxNumPublicIP": -1, } data.update(**kwargs) return data, self._api.cloudbroker.account.update(**data)
def create(self, cloudspaceId, **kwargs): data = { 'cloudspaceId': cloudspaceId, 'name': utils.random_string(), 'description': utils.random_string(), 'datadisks': [], 'userdata': '' } response = self._api.cloudbroker.machine.cloudapi.images.list() response.raise_for_status() image = random.choice( [x for x in response.json() if x.startswith(('Window', 'Linux'))]) data['imageId'] = image['id'] sizes = api_client.cloudapi.sizes.list(cloudspaceId=cloudspaceId) basic_sizes = [512, 1024, 4096, 8192, 16384, 2048] size = [size for size in sizes if size['memory'] in basic_sizes][0] data['disksize'] = random.choice(size['disks']) data['sizeId'] = size['id'] data.update(**kwargs) return data, self._api.cloudbroker.machine.create(**data)
def update(self, cloudspaceId, **kwargs): data = { 'cloudspaceId': cloudspaceId, 'name': utils.random_string(), 'maxMemoryCapacity': -1, 'maxVDiskCapacity': -1, 'maxCPUCapacity': -1, 'maxNetworkPeerTransfer': -1, 'maxNumPublicIP': -1, 'allowedVMSizes': [], } data.update(**kwargs) return data, self._api.cloudbroker.cloudspace.update(**data)
def update(self, cloudspaceId, **kwargs): data = { "cloudspaceId": cloudspaceId, "name": utils.random_string(), "maxMemoryCapacity": -1, "maxVDiskCapacity": -1, "maxCPUCapacity": -1, "maxNetworkPeerTransfer": -1, "maxNumPublicIP": -1, "allowedVMSizes": [], } data.update(**kwargs) return data, self._api.cloudapi.cloudspaces.update(**data)
def create(self, accountId, location, access, **kwargs): data = { 'accountId': accountId, 'location': location, 'access': access, 'name': utils.random_string(), 'maxMemoryCapacity': -1, 'maxVDiskCapacity': -1, 'maxCPUCapacity': -1, 'maxNetworkPeerTransfer': -1, 'maxNumPublicIP': -1, 'allowedVMSizes': [], 'privatenetwork': '' } data.update(**kwargs) return data, self._api.cloudbroker.cloudspace.create(**data)