Pingping Lin | d28ab98 | 2016-08-29 18:42:52 +0000 | [diff] [blame^] | 1 | import os |
| 2 | import pdb |
| 3 | import sys |
| 4 | import tempfile |
| 5 | sys.path.append("/opt/tosca") |
| 6 | from translator.toscalib.tosca_template import ToscaTemplate |
| 7 | import pdb |
| 8 | |
| 9 | from services.mcord.models import VBBUComponent, MCORDService |
| 10 | |
| 11 | from xosresource import XOSResource |
| 12 | |
| 13 | class XOSVBBUComponent(XOSResource): |
| 14 | provides = "tosca.nodes.VBBUComponent" |
| 15 | xos_model = VBBUComponent |
| 16 | copyin_props = ["s1u_tag", "s1mme_tag", "rru_tag", "display_message"] |
| 17 | name_field = None |
| 18 | |
| 19 | def get_xos_args(self, throw_exception=True): |
| 20 | args = super(XOSVBBUComponent, self).get_xos_args() |
| 21 | |
| 22 | provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception) |
| 23 | if provider_name: |
| 24 | args["provider_service"] = self.get_xos_object(MCORDService, throw_exception=throw_exception, name=provider_name) |
| 25 | |
| 26 | return args |
| 27 | |
| 28 | def get_existing_objs(self): |
| 29 | args = self.get_xos_args(throw_exception=False) |
| 30 | provider_service = args.get("provider", None) |
| 31 | if provider_service: |
| 32 | return [ self.get_xos_object(provider_service=provider_service) ] |
| 33 | return [] |
| 34 | |
| 35 | def postprocess(self, obj): |
| 36 | pass |
| 37 | |
| 38 | def can_delete(self, obj): |
| 39 | return super(XOSVBBUComponent, self).can_delete(obj) |
| 40 | |