Pingping Lin | f3e24a9 | 2016-09-19 21:35:16 +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.vpgwc.models import VPGWCComponent, MCORDService |
| 10 | |
| 11 | from xosresource import XOSResource |
| 12 | |
| 13 | class XOSVPGWCComponent(XOSResource): |
| 14 | provides = "tosca.nodes.VPGWCComponent" |
| 15 | xos_model = VPGWCComponent |
| 16 | copyin_props = ["s5s8_pgw_tag", "display_message"] |
| 17 | name_field = None |
| 18 | |
| 19 | def get_xos_args(self, throw_exception=True): |
| 20 | args = super(XOSVPGWCComponent, 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(XOSVPGWCComponent, self).can_delete(obj) |
| 40 | |