blob: ee60d0c956377e3f9807524da54cf3c8b6fca55f [file] [log] [blame]
Pingping Lind28ab982016-08-29 18:42:52 +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.mcord.models import VBBUComponent, MCORDService
10
11from xosresource import XOSResource
12
13class 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