Pingping Lin | 99ed559 | 2016-09-01 01:41:34 +0000 | [diff] [blame] | 1 | from services.vbbu.models import VBBUComponent, MCORDService |
Pingping Lin | d28ab98 | 2016-08-29 18:42:52 +0000 | [diff] [blame] | 2 | from xosresource import XOSResource |
| 3 | |
| 4 | class XOSVBBUComponent(XOSResource): |
| 5 | provides = "tosca.nodes.VBBUComponent" |
| 6 | xos_model = VBBUComponent |
| 7 | copyin_props = ["s1u_tag", "s1mme_tag", "rru_tag", "display_message"] |
| 8 | name_field = None |
| 9 | |
| 10 | def get_xos_args(self, throw_exception=True): |
| 11 | args = super(XOSVBBUComponent, self).get_xos_args() |
| 12 | |
| 13 | provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception) |
| 14 | if provider_name: |
| 15 | args["provider_service"] = self.get_xos_object(MCORDService, throw_exception=throw_exception, name=provider_name) |
| 16 | |
| 17 | return args |
| 18 | |
| 19 | def get_existing_objs(self): |
| 20 | args = self.get_xos_args(throw_exception=False) |
| 21 | provider_service = args.get("provider", None) |
| 22 | if provider_service: |
| 23 | return [ self.get_xos_object(provider_service=provider_service) ] |
| 24 | return [] |
| 25 | |
| 26 | def postprocess(self, obj): |
| 27 | pass |
| 28 | |
| 29 | def can_delete(self, obj): |
| 30 | return super(XOSVBBUComponent, self).can_delete(obj) |
| 31 | |