-
- def generate_tosca_type(self, tosca):
- self.log.debug(_("{0} Generate tosa types").
- format(self))
-
- for vdu in self.vdus:
- tosca = vdu.generate_tosca_type(tosca)
-
- # Add data_types
- if self.T_VNF_CONFIG not in tosca[self.DATA_TYPES]:
- tosca[self.DATA_TYPES][self.T_VNF_CONFIG] = {
- self.PROPERTIES:
- {self.CONFIG_TYPE:
- {self.TYPE: self.STRING},
- 'config_delay':
- {self.TYPE: self.INTEGER,
- self.DEFAULT: 0,
- self.REQUIRED: self.NO,
- self.CONSTRAINTS:
- [{'greater_or_equal': 0}]},
- 'config_priority':
- {self.TYPE: self.INTEGER,
- self.CONSTRAINTS:
- [{'greater_than': 0}]},
- self.CONFIG_DETAILS:
- {self.TYPE: self.MAP},
- self.CONFIG_TMPL:
- {self.TYPE: self.STRING,
- self.REQUIRED: self.NO},
- }
- }
-
- # Add capability types
- if self.CAPABILITY_TYPES not in tosca:
- tosca[self.CAPABILITY_TYPES] = {}
- if self.T_HTTP_EP not in tosca[self.CAPABILITY_TYPES]:
- tosca[self.CAPABILITY_TYPES][self.T_HTTP_EP] = {
- self.DERIVED_FROM: 'tosca.capabilities.Endpoint',
- self.PROPERTIES: {
- 'polling_interval':
- {self.TYPE: self.INTEGER},
- 'path':
- {self.TYPE: self.STRING},
- },
- }
-
- if self.T_MGMT_INTF not in tosca[self.CAPABILITY_TYPES]:
- tosca[self.CAPABILITY_TYPES][self.T_MGMT_INTF] = {
- self.DERIVED_FROM: 'tosca.capabilities.Endpoint',
- self.PROPERTIES: {
- self.DASHBOARD_PARAMS:
- {self.TYPE: self.MAP},
- self.VDU:
- {self.TYPE: self.STRING},
- },
- }
-
- if self.T_MON_PARAM not in tosca[self.CAPABILITY_TYPES]:
- tosca[self.CAPABILITY_TYPES][self.T_MON_PARAM] = {
- self.DERIVED_FROM: 'tosca.capabilities.nfv.Metric',
- self.PROPERTIES: {
- 'id':
- {self.TYPE: self.INTEGER},
- 'name':
- {self.TYPE: self.STRING},
- 'value_type':
- {self.TYPE: self.STRING,
- self.DEFAULT: 'INT'},
- 'group_tag':
- {self.TYPE: self.STRING,
- self.DEFAULT: 'Group1'},
- 'units':
- {self.TYPE: self.STRING},
- 'description':
- {self.TYPE: self.STRING},
- 'json_query_method':
- {self.TYPE: self.STRING,
- self.DEFAULT: 'NAMEKEY'},
- 'http_endpoint_ref':
- {self.TYPE: self.STRING},
- 'widget_type':
- {self.TYPE: self.STRING,
- self.DEFAULT: 'COUNTER'},
- }
+ def _generate_vnf_type(self, tosca):
+ name = self.name.split('_', 1)[0]
+ self.vnf_type = "{0}{1}{2}".format(self.vnf_prefix_type, name, 'VNF')
+ if self.NODE_TYPES not in tosca and self.vnf_type:
+ tosca[self.NODE_TYPES] = {}
+ tosca[self.NODE_TYPES][self.vnf_type] = {
+ self.DERIVED_FROM : self.T_VNF1