def get_network_pool_msg(self, name, pool_type, cloud_type): pool_config = rmgryang.ResourcePools() pool = pool_config.pools.add() pool.name = name pool.resource_type = "network" if pool_type == "static": pool.pool_type = 'static' acct = get_cal_account(cloud_type) rwcal = create_cal_plugin(acct, self.tinfo.get_rwlog_ctx()) rc, rsp = rwcal.get_virtual_link_list(acct) assert rc == RwStatus.SUCCESS if cloud_type == 'openstack_static': for vlink in rsp.virtual_link_info_list: if vlink.name in openstack_info['networks']: self.log.info("Adding the static network resource: %s to network pool", vlink.name) r = pool.resources.add() r.resource_id = vlink.virtual_link_id else: # 'mock', 'cloudsim', 'openstack_dynamic' etc for vlink in rsp.virtual_link_info_list: self.log.info("Adding the static network resource: %s to network pool", vlink.name) r = pool.resources.add() r.resource_id = vlink.virtual_link_id else: pool.pool_type = 'dynamic' pool.max_size = 4 return pool_config
def get_compute_pool_msg(self, name, pool_type, cloud_type): pool_config = rmgryang.ResourcePools() pool = pool_config.pools.add() pool.name = name pool.resource_type = "compute" if pool_type == "static": pool.pool_type = 'static' acct = get_cal_account(cloud_type) rwcal = create_cal_plugin(acct, self.tinfo.get_rwlog_ctx()) rc, rsp = rwcal.get_vdu_list(acct) assert rc == RwStatus.SUCCESS if cloud_type == 'openstack_static': for vdu in rsp.vdu_info_list: if vdu.name in openstack_info['vms']: self.log.info("Adding the static compute resource: %s to compute pool", vdu.name) r = pool.resources.add() r.resource_id = vdu.vdu_id else: # 'mock', 'cloudsim' 'openstack_dynamic' etc for vdu in rsp.vdu_info_list: self.log.info("Adding the static compute resource: %s to compute pool", vdu.name) r = pool.resources.add() r.resource_id = vdu.vdu_id else: pool.pool_type = 'dynamic' pool.max_size = 10 return pool_config