If VSG module does not exist, then do not try to list tenants
Change-Id: I043e76259422e7ebef06a257ce9e9637db108c9f
diff --git a/xos/vtnnetport.py b/xos/vtnnetport.py
index ba71199..0268733 100644
--- a/xos/vtnnetport.py
+++ b/xos/vtnnetport.py
@@ -131,12 +131,18 @@
return None
def get_vsg_tenants(self):
- from services.vsg.models import VSGTenant
- vsg_tenants=[]
- for tenant in VSGTenant.get_tenant_objects().all():
- if tenant.instance == self.xos_port.instance:
- vsg_tenants.append(tenant)
- return vsg_tenants
+ # If the VSG service isn't onboarded, then return an empty list.
+ try:
+ from services.vsg.models import VSGTenant
+ vsg_tenants=[]
+ for tenant in VSGTenant.get_tenant_objects().all():
+ if tenant.instance == self.xos_port.instance:
+ vsg_tenants.append(tenant)
+ return vsg_tenants
+ except ImportError:
+ # TODO: Set up logging for this library...
+ print "Failed to import VSG, returning no tenants"
+ return []
@property
def vlan_id(self):