summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/vnfs/vnf_query/query_vnf.py47
-rw-r--r--lcm/lcm/pub/database/models.py33
2 files changed, 24 insertions, 56 deletions
diff --git a/lcm/lcm/nf/vnfs/vnf_query/query_vnf.py b/lcm/lcm/nf/vnfs/vnf_query/query_vnf.py
index 3ef1a8d7..df625454 100644
--- a/lcm/lcm/nf/vnfs/vnf_query/query_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_query/query_vnf.py
@@ -14,7 +14,7 @@
import logging
from lcm.pub.database.models import NfInstModel, StorageInstModel, VLInstModel, NetworkInstModel, VNFCInstModel, \
- VmInstModel, VimModel, VimUserModel
+ VmInstModel
from lcm.pub.exceptions import NFLCMException
logger = logging.getLogger(__name__)
@@ -93,28 +93,29 @@ class QueryVnf:
vnfc_arr.append(vnfc_dic)
logger.info('Get the VimInstModel of list.')
vms = VmInstModel.objects.filter(instid=vnf.nfinstid)
- vim_arr = []
- # The 'vimInfoId' and 'vimId' each value are same
+ vm_arr = []
for vm in vms:
- vims = VimModel.objects.filter(vimid=vm.vimid)
- for vim in vims:
- vim_users = VimUserModel.objects.filter(vimid=vim.vimid)
- vim_dic = {
- "vimInfoId": vim.vimid,
- "vimId": vim.vimid,
- "interfaceInfo": {
- "vimType": vim.type,
- "apiVersion": vim.version,
- "protocolType": (vim.apiurl.split(':')[0] if vim.apiurl and vim.apiurl.index(':') else 'http')
- },
- "accessInfo": {
- "tenant": (vim_users[0].defaulttenant if vim_users and vim_users[0].defaulttenant else ''),
- "username": (vim_users[0].username if vim_users and vim_users[0].username else ''),
- "password": (vim_users[0].password if vim_users and vim_users[0].password else '')
- },
- "interfaceEndpoint": vim.apiurl
- }
- vim_arr.append(vim_dic)
+ vm_dic = {
+ "vmid": vm.vmid,
+ "vimid": vm.vimid,
+ "tenant": vm.tenant,
+ "resouceid": vm.resouceid,
+ "vmname": vm.vmname,
+ "nic_array": vm.nic_array,
+ "metadata": vm.metadata,
+ "volume_array": vm.volume_array,
+ "server_group": vm.server_group,
+ "availability_zone": vm.availability_zone,
+ "flavor_id": vm.flavor_id,
+ "security_groups": vm.security_groups,
+ "operationalstate": vm.operationalstate,
+ "insttype": vm.insttype,
+ "is_predefined": vm.is_predefined,
+ "create_time": vm.create_time,
+ "instid": vm.instid,
+ "nodeId": vm.nodeId
+ }
+ vm_arr.append(vm_dic)
resp_data = {
"vnfInstanceId": vnf.nfinstid,
@@ -136,7 +137,7 @@ class QueryVnf:
"extVirtualLink": [],
"monitoringParameters": {},
# "localizationLanguage": vnf.localizationLanguage,
- "vimInfo": vim_arr,
+ "vimInfo": vm_arr,
"vnfcResourceInfo": vnfc_arr,
"virtualLinkResourceInfo": vl_arr,
"virtualStorageResourceInfo": arr
diff --git a/lcm/lcm/pub/database/models.py b/lcm/lcm/pub/database/models.py
index 9f7773bb..0108e836 100644
--- a/lcm/lcm/pub/database/models.py
+++ b/lcm/lcm/pub/database/models.py
@@ -279,36 +279,3 @@ class CPInstModel(models.Model):
relatedvl = models.CharField(db_column='RELATEDVL', max_length=255, blank=True, null=True)
relatedcp = models.CharField(db_column='RELATEDCP', max_length=255, blank=True, null=True)
relatedport = models.CharField(db_column='RELATEDPORT', max_length=255, blank=True, null=True)
-
-class VimModel(models.Model):
- vimid = models.IntegerField(db_column='CMSERVERID', primary_key=True)
- name = models.CharField(db_column='NAME', max_length=255, blank=True, null=True)
- type = models.CharField(db_column='CMSTYPE', max_length=255, blank=True, null=True)
- imageurl = models.CharField(db_column='IMAGEURL', max_length=1024, blank=True, null=True)
- apiurl = models.CharField(db_column='APIURL', max_length=1024, blank=True, null=True)
- version = models.CharField(db_column='VER', max_length=1024, blank=True, null=True)
- supportnotification = models.IntegerField(db_column='SUPPORTNOTIFICATION', default=0)
- longitude = models.CharField(db_column='LONGITUDE', max_length=1024, blank=True, null=True)
- latitude = models.CharField(db_column='LATITUDE', max_length=1024, blank=True, null=True)
- grantexclude = models.CharField(db_column='GRANTEXCLUDE', max_length=1, default='0', blank=True, null=True)
- slalevel = models.IntegerField(db_column='SLALEVEL', default=0)
-
- class Meta:
- db_table = 'CMSSERVER'
-
- def __unicode__(self):
- return '%s' % self.name
-
-
-class VimUserModel(models.Model):
- class Meta:
- db_table = 'CMSSERVER_USER'
-
- uuid = models.CharField(db_column='UUID', primary_key=True, max_length=255)
- vimid = models.IntegerField(db_column='CMSERVERID')
- username = models.CharField(db_column='USERNAME', max_length=255)
- password = models.CharField(db_column='PWD', max_length=255, blank=True)
- defaulttenant = models.CharField(db_column='TENANT', max_length=255, blank=True)
-
- def __unicode__(self):
- return '%s' % self.username \ No newline at end of file