+ @asyncio.coroutine
+ def process_vnf_config_parameter(self, nsr_obj):
+ nsd = nsr_obj.agent_nsr.nsd
+
+ # Process all capabilities in all the member VNFs
+ for vnfr in nsr_obj.vnfrs:
+ vnfd = vnfr['vnf_cfg']['agent_vnfr'].vnfd
+
+ try:
+ cparam = vnfd.config_parameter
+ except AttributeError as e:
+ self._log.debug("VNFR {} does not have VNF config parameter".
+ format(vnfr.name))
+ continue
+
+ srcs = []
+ try:
+ srcs = cparam.config_parameter_source
+ except AttributeError as e:
+ self._log.debug("VNFR {} has no source defined".
+ format(vnfr.name))
+
+ # Get the cm state dict for this vnfr
+ cm_state = nsr_obj.find_vnfr_cm_state(vnfr['id'])
+
+ cm_srcs = []
+ for src in srcs:
+ self._log.debug("VNFR {}: source {}".
+ format(vnfr['name'], src.as_dict()))
+
+ param_refs = []
+ for p in src.parameter:
+ param_refs.append({
+ 'config_primitive_ref': p.config_primitive_name_ref,
+ 'parameter_ref': p.config_primitive_parameter_ref
+ })
+
+ try:
+ val = src.value
+ self._log.debug("Got value {}".format(val))
+ if val:
+ cm_srcs.append({'name': src.name,
+ 'value': str(val),
+ 'parameter': param_refs})
+ continue
+ except AttributeError as e:
+ pass
+
+ try:
+ xpath = src.descriptor
+ # resolve xpath
+ if xpath:
+ val = yield from self.resolve_xpath(xpath, src.name, vnfd)
+ self._log.debug("Got xpath value: {}".format(val))
+ cm_srcs.append({'name': src.name,
+ 'value': str(val),
+ 'parameter': param_refs})
+ continue
+ except AttributeError as e:
+ pass
+
+ try:
+ attribute = src.attribute
+ # resolve attribute
+ if attribute:
+ val = yield from self.resolve_attribute(attribute,
+ src.name,
+ vnfd, vnfr)
+ self._log.debug("Got attribute value: {}".format(val))
+ cm_srcs.append({'name': src.name,
+ 'value': str(val),
+ 'parameter': param_refs})
+ continue
+ except AttributeError as e:
+ pass
+
+ try:
+ prim = src.primitive_ref
+ if prim:
+ raise NotImplementedError("{}: VNF config parameter {}"
+ "source support for config"
+ "primitive not yet supported".
+ format(vnfr.name, prim))
+ except AttributeError as e:
+ pass
+
+ self._log.debug("VNF config parameter sources: {}".format(cm_srcs))
+ cm_state['config_parameter']['config_parameter_source'] = cm_srcs
+
+ try:
+ reqs = cparam.config_parameter_request
+ except AttributeError as e:
+ self._log.debug("VNFR {} has no requests defined".
+ format(vnfr.name))
+ continue
+
+ cm_reqs = []
+ for req in reqs:
+ self._log.debug("VNFR{}: request {}".
+ format(vnfr['name'], req.as_dict()))
+ param_refs = []
+ for p in req.parameter:
+ param_refs.append({
+ 'config_primitive_ref': p.config_primitive_name_ref,
+ 'parameter_ref': p.config_primitive_parameter_ref
+ })
+ cm_reqs.append({'name': req.name,
+ 'parameter': param_refs})
+
+ self._log.debug("VNF requests: {}".format(cm_reqs))
+ cm_state['config_parameter']['config_parameter_request'] = cm_reqs
+
+ # Publish all config parameter for the VNFRs
+ # yield from nsr_obj.publish_cm_state()
+
+ cparam_map = []