return trp_link_characteristics
+ # TODO: Review if we should adapt this method with SOL006 /nsd/vnfd/int-virtual-link-desc/df/qos fields.
def _produce_vld_desc(self):
"""
Creates the expected vlds from the nsd. Includes constraints if part of nsd.
Overrides constraints with any syntactically correct instantiation parameters
:return:
"""
+
+ all_vld_member_vnf_index_refs = {}
+ # TODO: Change for multiple DF support
+ ns_df = self._nsd.get('df', [{}])[0]
+ for vnf_profile in ns_df.get('vnf-profile', []):
+ for vlc in vnf_profile.get('virtual-link-connectivity', []):
+ vld_id = vlc.get('virtual-link-profile-id')
+ vld_member_vnf_index_ref = vnf_profile.get('id')
+ if vld_id in all_vld_member_vnf_index_refs:
+ all_vld_member_vnf_index_refs[vld_id].append(vld_member_vnf_index_ref)
+ else:
+ all_vld_member_vnf_index_refs[vld_id] = [vld_member_vnf_index_ref]
+
vld_desc = []
- for vld in self._nsd['vld']:
- if vld.get('mgmt-network', False) is False:
- vld_desc_entry = {}
- cp_refs = [ep_ref['member-vnf-index-ref'] for ep_ref in vld['vnfd-connection-point-ref']]
- if len(cp_refs) == 2:
- vld_desc_entry['cp_refs'] = cp_refs
- if 'link-constraint' in vld.keys():
- for constraint in vld['link-constraint']:
- if constraint['constraint-type'] == 'LATENCY':
- vld_desc_entry['latency'] = constraint['value']
- elif constraint['constraint-type'] == 'JITTER':
- vld_desc_entry['jitter'] = constraint['value']
- vld_desc.append(vld_desc_entry)
+ for vld in self._nsd.get('virtual-link-desc', ()):
+ if vld.get('mgmt-network', False) is True:
+ continue
+ vld_desc_entry = {}
+ cp_refs = all_vld_member_vnf_index_refs[vld.get('id')]
+ if len(cp_refs) == 2:
+ vld_desc_entry['cp_refs'] = cp_refs
+ # TODO: Change for multiple DF support
+ vld_df = vld.get('df', [{}])[0]
+ for constraint in vld_df.get('qos', {}):
+ if constraint == 'latency':
+ vld_desc_entry['latency'] = vld_df['qos'][constraint]
+ elif constraint == 'packet-delay-variation':
+ vld_desc_entry['jitter'] = vld_df['qos'][constraint]
+ vld_desc.append(vld_desc_entry)
# create candidates from instantiate params
if self._order_constraints is not None:
candidate_vld_desc = []
# use id to find the endpoints in the nsd
for entry in self._order_constraints.get('vld-constraints'):
- for vld in self._nsd['vld']:
- if entry['id'] == vld['id']:
+ for vld in self._nsd.get('virtual-link-desc', ()):
+ if entry['id'] == vld.get('id'):
vld_desc_instantiate_entry = {}
- cp_refs = [ep_ref['member-vnf-index-ref'] for ep_ref in vld['vnfd-connection-point-ref']]
+ cp_refs = all_vld_member_vnf_index_refs[vld.get('id')]
vld_desc_instantiate_entry['cp_refs'] = cp_refs
# add whatever constraints that are provided to the vld_desc_entry
# misspelled 'link-constraints' => empty dict
vld_desc_instantiate_entry['latency'] = value
elif constraint == 'jitter':
vld_desc_instantiate_entry['jitter'] = value
- if set(['latency', 'jitter']).intersection(vld_desc_instantiate_entry.keys()):
+ if {'latency', 'jitter'}.intersection(vld_desc_instantiate_entry.keys()):
candidate_vld_desc.append(vld_desc_instantiate_entry)
# merge with nsd originated, FIXME log any deviations?
for vld_d in vld_desc:
for the vim_accounts that are applicable, collect the vnf_price
"""
ns_desc = []
- for vnfd in self._nsd['constituent-vnfd']:
- vnf_info = {'vnf_id': vnfd['member-vnf-index']}
+ # TODO: Change for multiple DF support
+ ns_df = self._nsd.get('df', [{}])[0]
+ for vnf_profile in ns_df.get('vnf-profile', []):
+ vnf_info = {'vnf_id': vnf_profile['id']}
# prices
- prices_for_vnfd = self._vnf_prices[vnfd['vnfd-id-ref']]
+ prices_for_vnfd = self._vnf_prices[vnf_profile['vnfd-id']]
# the list of prices must be ordered according to the indexing of the vim_accounts
price_list = [_ for _ in range(len(self._vim_accounts_info))]
for k in prices_for_vnfd.keys():
# pinning to dc
if self._pinning is not None:
for pinned_vnf in self._pinning:
- if vnfd['member-vnf-index'] == pinned_vnf['member-vnf-index']:
+ if vnf_profile['id'] == pinned_vnf['member-vnf-index']:
vnf_info['vim_account'] = 'vim' + pinned_vnf['vimAccountId'].replace('-', '_')
ns_desc.append(vnf_info)