else:
table = PrettyTable(['nsd name', 'id'])
for nsd in resp:
- name = nsd.get('name','-')
+ name = nsd.get('id','-')
if long:
onb_state = nsd['_admin'].get('onboardingState','-')
op_state = nsd['_admin'].get('operationalState','-')
else:
table = PrettyTable(['nfpkg name', 'repository'])
for vnfd in resp:
- name = vnfd.get('product-name', '-')
+ name = vnfd.get('id', vnfd.get('name','-'))
repository = vnfd.get('repository')
if long:
- vendor = vnfd.get('provider')
+ vendor = vnfd.get('provider', vnfd.get('vendor'))
version = vnfd.get('version')
description = vnfd.get('description')
latest = vnfd.get('latest')
fullclassname = ctx.obj.__module__ + "." + ctx.obj.__class__.__name__
if fullclassname == 'osmclient.sol005.client.Client':
if long:
- table = PrettyTable(['nfpkg name', 'id', 'vendor', 'version', 'onboarding state', 'operational state',
+ table = PrettyTable(['nfpkg name', 'id', 'desc type', 'vendor', 'version', 'onboarding state', 'operational state',
'usage state', 'date', 'last update'])
else:
- table = PrettyTable(['nfpkg name', 'id'])
+ table = PrettyTable(['nfpkg name', 'id', 'desc type'])
for vnfd in resp:
- name = vnfd['product-name'] if 'product-name' in vnfd else '-'
+ name = vnfd.get('id', vnfd.get('name','-'))
+ descriptor_type = 'sol005' if 'product-name' in vnfd else 'rel8'
if long:
onb_state = vnfd['_admin'].get('onboardingState','-')
op_state = vnfd['_admin'].get('operationalState','-')
- vendor = vnfd.get('provider')
+ vendor = vnfd.get('provider', vnfd.get('vendor'))
version = vnfd.get('version')
usage_state = vnfd['_admin'].get('usageState','-')
date = datetime.fromtimestamp(vnfd['_admin']['created']).strftime("%Y-%m-%dT%H:%M:%S")
last_update = datetime.fromtimestamp(vnfd['_admin']['modified']).strftime("%Y-%m-%dT%H:%M:%S")
- table.add_row([name, vnfd['_id'], vendor, version, onb_state, op_state, usage_state, date, last_update])
+ table.add_row([name, vnfd['_id'], descriptor_type, vendor, version, onb_state, op_state, usage_state, date, last_update])
else:
- table.add_row([name, vnfd['_id']])
+ table.add_row([name, vnfd['_id'], descriptor_type])
else:
table = PrettyTable(['nfpkg name', 'id'])
for vnfd in resp:
- table.add_row([vnfd['product-name'], vnfd['id']])
+ table.add_row([vnfd['name'], vnfd['id']])
table.align = 'l'
print(table)
for vnfd in self.list():
if 'product-name' in vnfd and name == vnfd['product-name']:
return vnfd
+ elif 'name' in vnfd and name == vnfd['name']:
+ return vnfd
raise NotFound("vnfd {} not found".format(name))
def get_individual(self, name):
for vcd_number, vcd in enumerate(vcd_list):
if override_epa:
- virtual_memory = {
- "mempage-size": "LARGE",
- "numa-node-policy": {
- "node-cnt": 1,
- "mem-policy": "STRICT"
- }
+ virtual_memory = vcd["virtual-memory"]
+ virtual_memory["mempage-size"] = "LARGE"
+ virtual_memory["numa-enabled"] = True
+ virtual_memory["numa-node-policy"] = {
+ "node-cnt": 1,
+ "mem-policy": "STRICT"
}
- virtual_cpu = {
- "pinning": {
- "policy": "static",
- "thread-policy": "PREFER"
- }
+ virtual_cpu = vcd["virtual-cpu"]
+ virtual_cpu["pinning"] = {
+ "policy": "static",
+ "thread-policy": "PREFER"
}
- memory_override_string = "virtual-compute-desc.{}.virtual-cpu={};"\
+ cpu_override_string = "virtual-compute-desc.{}.virtual-cpu={};"\
.format(vcd_number, quote(yaml.safe_dump(virtual_cpu)))
- cpu_override_string = "virtual-compute-desc.{}.virtual-memory={};"\
+ memory_override_string = "virtual-compute-desc.{}.virtual-memory={};"\
.format(vcd_number, quote(yaml.safe_dump(virtual_memory)))
special_override_string = "{}{}{}".format(special_override_string,
cpu_override_string, memory_override_string)
- headers['Query-String-Format'] = 'yaml'
+ headers['Query-String-Format'] = 'yaml'
if override_nonepa:
- virtual_memory = {
- "mempage-size": "",
- "numa-node-policy": {}
- }
- virtual_cpu = {
- "pinning": {}
- }
+ virtual_memory = vcd["virtual-memory"]
+ virtual_memory["mempage-size"] = ""
+ virtual_memory["numa-enabled"] = ""
+ virtual_memory["numa-node-policy"] = {}
+ virtual_cpu = vcd["virtual-cpu"]
+ virtual_cpu["pinning"] = {}
- memory_override_string = "virtual-compute-desc.{}.virtual-cpu={};"\
+ cpu_override_string = "virtual-compute-desc.{}.virtual-cpu={};"\
.format(vcd_number, quote(yaml.safe_dump(virtual_cpu)))
- cpu_override_string = "virtual-compute-desc.{}.virtual-memory={};"\
+ memory_override_string = "virtual-compute-desc.{}.virtual-memory={};"\
.format(vcd_number, quote(yaml.safe_dump(virtual_memory)))
special_override_string = "{}{}{}".format(special_override_string,
cpu_override_string, memory_override_string)