#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
gi.require_version('CF', '1.0')
gi.require_version('RwDts', '1.0')
gi.require_version('RwMain', '1.0')
gi.require_version('CF', '1.0')
gi.require_version('RwDts', '1.0')
gi.require_version('RwMain', '1.0')
gi.require_version('RwTypes', '1.0')
gi.require_version('RwCal', '1.0')
gi.require_version('RwTypes', '1.0')
gi.require_version('RwCal', '1.0')
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-0'))
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-0'))
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-1'))
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 8192
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-1'))
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 8192
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-0'))
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-0'))
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-1'))
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 8192
msg.image_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, 'image-1'))
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 8192
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 4096
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 4096
msg.provider_network.physical_network = 'PHYSNET1'
msg.provider_network.overlay_type = 'VLAN'
msg.provider_network.segmentation_id = 17
resource_requests['network']['mynet-0'] = msg
####### mynet-1
msg.provider_network.physical_network = 'PHYSNET1'
msg.provider_network.overlay_type = 'VLAN'
msg.provider_network.segmentation_id = 17
resource_requests['network']['mynet-0'] = msg
####### mynet-1
msg.provider_network.physical_network = 'PHYSNET1'
msg.provider_network.overlay_type = 'VLAN'
msg.provider_network.segmentation_id = 18
msg.provider_network.physical_network = 'PHYSNET1'
msg.provider_network.overlay_type = 'VLAN'
msg.provider_network.segmentation_id = 18
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 4096
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 2
msg.vm_flavor.memory_mb = 4096
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
msg.image_id = openstack_info['image_id']
msg.vm_flavor.vcpu_count = 4
msg.vm_flavor.memory_mb = 8192
#msg.provider_network.overlay_type = 'VXLAN'
#msg.provider_network.segmentation_id = 71
resource_requests['network']['mynet-0'] = msg
####### mynet-1
#msg.provider_network.overlay_type = 'VXLAN'
#msg.provider_network.segmentation_id = 71
resource_requests['network']['mynet-0'] = msg
####### mynet-1
#msg.provider_network.overlay_type = 'VXLAN'
#msg.provider_network.segmentation_id = 73
resource_requests['network']['mynet-1'] = msg
#msg.provider_network.overlay_type = 'VXLAN'
#msg.provider_network.segmentation_id = 73
resource_requests['network']['mynet-1'] = msg
if account_type == 'mock':
account.name = 'mock_account'
account.account_type = "mock"
if account_type == 'mock':
account.name = 'mock_account'
account.account_type = "mock"
acct = get_cal_account(acct_type)
cloud_account.from_dict(acct.as_dict())
cloud_account.name = acct.name
return cloud_account
def get_compute_pool_msg(self, name, pool_type, cloud_type):
acct = get_cal_account(acct_type)
cloud_account.from_dict(acct.as_dict())
cloud_account.name = acct.name
return cloud_account
def get_compute_pool_msg(self, name, pool_type, cloud_type):
return pool_config
def get_network_pool_msg(self, name, pool_type, cloud_type):
return pool_config
def get_network_pool_msg(self, name, pool_type, cloud_type):
def get_network_reserve_msg(self, name, cloud_type, xpath):
event_id = str(uuid.uuid4())
def get_network_reserve_msg(self, name, cloud_type, xpath):
event_id = str(uuid.uuid4())
msg.event_id = event_id
msg.request_info.name = name
attributes = ['physical_network', 'name', 'overlay_type', 'segmentation_id']
msg.event_id = event_id
msg.request_info.name = name
attributes = ['physical_network', 'name', 'overlay_type', 'segmentation_id']
setattr(msg.request_info.provider_network, attr,
getattr(resource_requests[cloud_type]['network'][name].provider_network ,attr))
setattr(msg.request_info.provider_network, attr,
getattr(resource_requests[cloud_type]['network'][name].provider_network ,attr))
def get_compute_reserve_msg(self, name, cloud_type, xpath, vlinks):
event_id = str(uuid.uuid4())
def get_compute_reserve_msg(self, name, cloud_type, xpath, vlinks):
event_id = str(uuid.uuid4())
msg.event_id = event_id
msg.request_info.name = name
msg.request_info.image_id = resource_requests[cloud_type]['compute'][name].image_id
msg.event_id = event_id
msg.request_info.name = name
msg.request_info.image_id = resource_requests[cloud_type]['compute'][name].image_id
c1.virtual_link_id = link
self.log.info("Sending message :%s", msg)
c1.virtual_link_id = link
self.log.info("Sending message :%s", msg)
msg = self.get_cloud_account_msg(acct_type)
self.log.info("Configuring cloud-account: %s",msg)
yield from dts.query_create(account_xpath,
msg = self.get_cloud_account_msg(acct_type)
self.log.info("Configuring cloud-account: %s",msg)
yield from dts.query_create(account_xpath,
@asyncio.coroutine
def configure_compute_resource_pools(self, dts, resource_type, cloud_type):
@asyncio.coroutine
def configure_compute_resource_pools(self, dts, resource_type, cloud_type):
msg = self.get_compute_pool_msg("virtual-compute", resource_type, cloud_type)
self.log.info("Configuring compute-resource-pool: %s",msg)
yield from dts.query_create(pool_xpath,
msg = self.get_compute_pool_msg("virtual-compute", resource_type, cloud_type)
self.log.info("Configuring compute-resource-pool: %s",msg)
yield from dts.query_create(pool_xpath,
@asyncio.coroutine
def configure_network_resource_pools(self, dts, resource_type, cloud_type):
@asyncio.coroutine
def configure_network_resource_pools(self, dts, resource_type, cloud_type):
msg = self.get_network_pool_msg("virtual-network", resource_type, cloud_type)
self.log.info("Configuring network-resource-pool: %s",msg)
yield from dts.query_create(pool_xpath,
msg = self.get_network_pool_msg("virtual-network", resource_type, cloud_type)
self.log.info("Configuring network-resource-pool: %s",msg)
yield from dts.query_create(pool_xpath,
self.log.debug("Verifying test_create_resource_pools results")
res_iter = yield from dts.query_read(pool_records_xpath,)
for result in res_iter:
self.log.debug("Verifying test_create_resource_pools results")
res_iter = yield from dts.query_read(pool_records_xpath,)
for result in res_iter:
@asyncio.coroutine
def reserve_network_resources(self, name, dts, cloud_type):
@asyncio.coroutine
def reserve_network_resources(self, name, dts, cloud_type):
msg,xpath = self.get_network_reserve_msg(name, cloud_type, network_xpath)
self.log.debug("Sending create event to network-event xpath %s with msg: %s" % (xpath, msg))
yield from dts.query_create(xpath, 0, msg)
msg,xpath = self.get_network_reserve_msg(name, cloud_type, network_xpath)
self.log.debug("Sending create event to network-event xpath %s with msg: %s" % (xpath, msg))
yield from dts.query_create(xpath, 0, msg)
@asyncio.coroutine
def reserve_compute_resources(self, name, dts, cloud_type, vlinks = []):
@asyncio.coroutine
def reserve_compute_resources(self, name, dts, cloud_type, vlinks = []):
msg,xpath = self.get_compute_reserve_msg(name, cloud_type, compute_xpath, vlinks)
self.log.debug("Sending create event to compute-event xpath %s with msg: %s" % (xpath, msg))
yield from dts.query_create(xpath, 0, msg)
msg,xpath = self.get_compute_reserve_msg(name, cloud_type, compute_xpath, vlinks)
self.log.debug("Sending create event to compute-event xpath %s with msg: %s" % (xpath, msg))
yield from dts.query_create(xpath, 0, msg)