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