blob: cbea98843f9ee8a969d42f3e27b4f94100d15183 [file] [log] [blame]
Pingping Linf3e24a92016-09-19 21:35:16 +00001import os
2import pdb
3import sys
4import tempfile
5sys.path.append("/opt/tosca")
6from translator.toscalib.tosca_template import ToscaTemplate
7import pdb
8
9from services.vpgwc.models import VPGWCComponent, MCORDService
10
11from xosresource import XOSResource
12
13class 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