示例#1
0
    def test_saas_server_create(self):
        """Test if we can create a VM using an live endpoint object and shut it down"""

        # This cli command would make a server similar to below
        # dcm-create-server --machineimage 29710 --datacenter 1273 \
        #     --name igable-terminateme --productid t1.micro --budgetid 1512 --description longstring

        self.server = Server(endpoint=self.endpoint)
        self.server.set_from_file("../../secret-test-data/ubuntu-trusty-14.04-amd64-server-20150629.json")

        # override the server name loaded from the json
        self.server.name = "mixcoatl-qa-%s" % str(uuid.uuid4())[:8]
        self.job_id = self.server.launch()

        Job.wait_for(self.job_id, endpoint=self.endpoint)
        self.job = Job(job_id=str(self.job_id), endpoint=self.endpoint)

        self.running_server = Server(self.job.message, endpoint=self.endpoint)
        self.running_server.wait_for(status="RUNNING")

        assert self.server.provider_product_id == self.running_server.provider_product_id
        assert self.server.machine_image["machine_image_id"] == self.running_server.machine_image["machine_image_id"]
        assert self.server.data_center == self.running_server.data_center
        assert self.server.description == self.running_server.description
        assert self.server.name == self.running_server.name
        assert self.server.budget == self.running_server.budget
示例#2
0
    def test_saas_server_create(self):
        """Test if we can create a VM using an live endpoint object and shut it down"""

        # This cli command would make a server similar to below
        # dcm-create-server --machineimage 29710 --datacenter 1273 \
        #     --name igable-terminateme --productid t1.micro --budgetid 1512 --description longstring

        self.server = Server(endpoint=self.endpoint)
        self.server.set_from_file(
            "../../secret-test-data/ubuntu-trusty-14.04-amd64-server-20150629.json"
        )

        # override the server name loaded from the json
        self.server.name = "mixcoatl-qa-%s" % str(uuid.uuid4())[:8]
        self.job_id = self.server.launch()

        Job.wait_for(self.job_id, endpoint=self.endpoint)
        self.job = Job(job_id=str(self.job_id), endpoint=self.endpoint)

        self.running_server = Server(self.job.message, endpoint=self.endpoint)
        self.running_server.wait_for(status='RUNNING')

        assert self.server.provider_product_id == self.running_server.provider_product_id
        assert self.server.machine_image[
            'machine_image_id'] == self.running_server.machine_image[
                'machine_image_id']
        assert self.server.data_center == self.running_server.data_center
        assert self.server.description == self.running_server.description
        assert self.server.name == self.running_server.name
        assert self.server.budget == self.running_server.budget
示例#3
0
class TestServerLive:
    def setup(self):
        # load an endpoint that this file must be hosted outside of git
        # because it contains credentials
        self.endpoint = Endpoint.multiple_from_file(
            "../../secret-test-data/endpoints.json")['saas']

    def test_saas_server_create(self):
        """Test if we can create a VM using an live endpoint object and shut it down"""

        # This cli command would make a server similar to below
        # dcm-create-server --machineimage 29710 --datacenter 1273 \
        #     --name igable-terminateme --productid t1.micro --budgetid 1512 --description longstring

        self.server = Server(endpoint=self.endpoint)
        self.server.set_from_file(
            "../../secret-test-data/ubuntu-trusty-14.04-amd64-server-20150629.json"
        )

        # override the server name loaded from the json
        self.server.name = "mixcoatl-qa-%s" % str(uuid.uuid4())[:8]
        self.job_id = self.server.launch()

        Job.wait_for(self.job_id, endpoint=self.endpoint)
        self.job = Job(job_id=str(self.job_id), endpoint=self.endpoint)

        self.running_server = Server(self.job.message, endpoint=self.endpoint)
        self.running_server.wait_for(status='RUNNING')

        assert self.server.provider_product_id == self.running_server.provider_product_id
        assert self.server.machine_image[
            'machine_image_id'] == self.running_server.machine_image[
                'machine_image_id']
        assert self.server.data_center == self.running_server.data_center
        assert self.server.description == self.running_server.description
        assert self.server.name == self.running_server.name
        assert self.server.budget == self.running_server.budget

    def teardown(self):
        if hasattr(self, 'running_server'):
            if self.running_server:
                try:
                    assert self.running_server.destroy(
                        reason="Mixcoatl QA test finished")
                except AssertionError:
                    raise AssertionError(
                        "Failed to destroy server id: %s with name: %s" %
                        (self.running_server.server_id,
                         self.running_server.name))
示例#4
0
class TestServerLive:
    def setup(self):
        # load an endpoint that this file must be hosted outside of git
        # because it contains credentials
        self.endpoint = Endpoint.multiple_from_file("../../secret-test-data/endpoints.json")["saas"]

    def test_saas_server_create(self):
        """Test if we can create a VM using an live endpoint object and shut it down"""

        # This cli command would make a server similar to below
        # dcm-create-server --machineimage 29710 --datacenter 1273 \
        #     --name igable-terminateme --productid t1.micro --budgetid 1512 --description longstring

        self.server = Server(endpoint=self.endpoint)
        self.server.set_from_file("../../secret-test-data/ubuntu-trusty-14.04-amd64-server-20150629.json")

        # override the server name loaded from the json
        self.server.name = "mixcoatl-qa-%s" % str(uuid.uuid4())[:8]
        self.job_id = self.server.launch()

        Job.wait_for(self.job_id, endpoint=self.endpoint)
        self.job = Job(job_id=str(self.job_id), endpoint=self.endpoint)

        self.running_server = Server(self.job.message, endpoint=self.endpoint)
        self.running_server.wait_for(status="RUNNING")

        assert self.server.provider_product_id == self.running_server.provider_product_id
        assert self.server.machine_image["machine_image_id"] == self.running_server.machine_image["machine_image_id"]
        assert self.server.data_center == self.running_server.data_center
        assert self.server.description == self.running_server.description
        assert self.server.name == self.running_server.name
        assert self.server.budget == self.running_server.budget

    def teardown(self):
        if hasattr(self, "running_server"):
            if self.running_server:
                try:
                    assert self.running_server.destroy(reason="Mixcoatl QA test finished")
                except AssertionError:
                    raise AssertionError(
                        "Failed to destroy server id: %s with name: %s"
                        % (self.running_server.server_id, self.running_server.name)
                    )
示例#5
0
    metadata.bind = engine
    conn = engine.connect()

    poc = Table('poc', metadata, autoload=True)
    s = poc.select().where(poc.c.active == 'Y' and poc.c.trial_start is not None and poc.c.client_name == 'Aeris')
    rs = s.execute()

    for row in rs.fetchall():
      mixcoatl_settings.set_endpoint('http://'+row['server_host']+':15000/api/enstratus/2013-12-07')
      mixcoatl_settings.set_api_version('2013-12-07')
      mixcoatl_settings.set_access_key(row['api_key'])
      mixcoatl_settings.set_secret_key(row['secret_key'])

      for account in Account.all():
        params = {'activeOnly':'false', 'accountId':account.account_id}
        servers = sorted(Server.all(params=params), key=attrgetter('start_date'))
        running = 0
        launches_count = 0
        launches = dict()
        msg = ""

        for server in servers:
          datekey = datetime.strptime(server.start_date, '%Y-%m-%dT%H:%M:%S.%f+0000').strftime("%Y-%m-%d")
          trial_start_formatted = datetime.strptime(str(row['trial_start']), '%Y-%m-%d 00:00:00').strftime("%Y-%m-%d")

          if datekey > trial_start_formatted:
            launches_count += 1

            if datekey in launches:
              launches[datekey] += 1
            else:
示例#6
0
if cmd_args.noimaging is False:
	if sub[0]['subscribedMachineImage']:
		print "# Image:\t\t[OK]"
	else:
		print "# Image:\t\t[UNSUPPORTED]"
else:
	print "# Image:\t\t[SKIPPING]"

print "###"

if sub[0]['subscribedServer']:
	for ts in range(0, total_servers):
		server_name = "test-server-"+name_generator()
		print "Launching server : %s" % (server_name)
		new_server = Server()
		new_server.provider_product_id = server_product_id
		new_server.machine_image = int(machine_image_id)
		new_server.data_center = int(data_center_id)
		new_server.description = server_name
		new_server.name = server_name
		new_server.budget = int(billing_code_id)

		if network_id is not None and network_id != '0':
			new_server.vlan = int(network_id)

		if vol_type is not None and vol_type == '1':
			new_server.volumeConfiguration = vol_type

		if cm_account_id is not None:
			new_server.cmAccount = int(cm_account_id)