def create_vnffgd(self, context, vnffgd): template = vnffgd['vnffgd'] if 'vnffgd' not in template.get('template'): raise nfvo.VnffgdInvalidTemplate(template=template.get('template')) else: self.validate_tosca(template['template']['vnffgd']) temp = template['template']['vnffgd']['topology_template'] vnffg_name = list(temp['groups'].keys())[0] nfp_name = temp['groups'][vnffg_name]['members'][0] path = self._get_nfp_attribute(template['template'], nfp_name, 'path') prev_element = None known_forwarders = set() for element in path: if element.get('forwarder') in known_forwarders: if prev_element is not None and element.get('forwarder')\ != prev_element['forwarder']: raise nfvo.VnffgdDuplicateForwarderException( forwarder=element.get('forwarder')) elif prev_element is not None and element.get( 'capability') == prev_element['capability']: raise nfvo.VnffgdDuplicateCPException( cp=element.get('capability')) else: known_forwarders.add(element.get('forwarder')) prev_element = element return super(NfvoPlugin, self).create_vnffgd(context, vnffgd)
def create_vnffgd(self, context, vnffgd): template = vnffgd['vnffgd'] if 'template_source' in template: template_source = template.get('template_source') else: template_source = 'onboarded' vnffgd['vnffgd']['template_source'] = template_source if 'vnffgd' not in template.get('template'): raise nfvo.VnffgdInvalidTemplate(template=template.get('template')) else: self.validate_tosca(template['template']['vnffgd']) self.validate_vnffgd_path(template['template']) self.validate_vnffg_properties(template['template']) template_yaml = template['template']['vnffgd'] if not template.get('description'): template['description'] = template_yaml.get('description', '') if not template.get('name') and 'metadata' in template_yaml: template['name'] = template_yaml['metadata'].get( 'template_name', '') return super(NfvoPlugin, self).create_vnffgd(context, vnffgd)
def create_vnffgd(self, context, vnffgd): template = vnffgd['vnffgd'] if 'vnffgd' not in template.get('template'): raise nfvo.VnffgdInvalidTemplate(template=template.get('template')) else: self.validate_tosca(template['template']['vnffgd']) self.validate_vnffgd_path(template['template']) self.validate_vnffg_properties(template['template']) return super(NfvoPlugin, self).create_vnffgd(context, vnffgd)