add Vendor model to select flavor/image at Tenant creation

Change-Id: Ifde87eaa83b0559c83afd7010068dd5465125e37
diff --git a/xos/tosca/resources/vsgwuvendor.py b/xos/tosca/resources/vsgwuvendor.py
new file mode 100644
index 0000000..4fffecf
--- /dev/null
+++ b/xos/tosca/resources/vsgwuvendor.py
@@ -0,0 +1,32 @@
+from xosresource import XOSResource
+from core.models import Tenant
+from services.vsgwu.models import VSGWUVendor
+
+class XOSVSGWUVendor(XOSResource):
+    provides = "tosca.nodes.VSGWUVendor"
+    xos_model = VSGWUVendor
+    name_field = None
+    copyin_props = ( "name",)
+
+    def get_xos_args(self, throw_exception=True):
+        args = super(XOSVSGWUVendor, self).get_xos_args()
+
+        tenant_name = self.get_requirement("tosca.relationships.VendorOfTenant", throw_exception=throw_exception)
+        if tenant_name:
+            args["provider_tenant"] = self.get_xos_object(Tenant, throw_exception=throw_exception, name=tenant_name)
+
+        return args
+
+    def get_existing_objs(self):
+        args = self.get_xos_args(throw_exception=False)
+        provider_tenant = args.get("provider", None)
+        if provider_tenant:
+            return [ self.get_xos_object(provider_tenant=provider_tenant) ]
+        return []
+
+    def postprocess(self, obj):
+        pass
+
+    def can_delete(self, obj):
+        return super(XOSVSGWUVendor, self).can_delete(obj)
+