CORD-1008 add create_attr function to orm
Change-Id: If285142c8bf5a1364c1572d9c3a1ff2526b5167a
diff --git a/xos/xos_client/xosapi/convenience/vrouterapp.py b/xos/xos_client/xosapi/convenience/vrouterapp.py
index fe647cd..7a670a3 100644
--- a/xos/xos_client/xosapi/convenience/vrouterapp.py
+++ b/xos/xos_client/xosapi/convenience/vrouterapp.py
@@ -5,7 +5,7 @@
@property
def interfaces(self):
app_interfaces = []
- devices = self.stub.VRouterDevice.objects.filter(vrouter_service_id=self.id)
+ devices = self.stub.VRouterDevice.objects.filter(vrouter_service_id=self.vrouter_service.id)
for device in devices:
ports = self.stub.VRouterPort.objects.filter(vrouter_device_id=device.id)
for port in ports:
diff --git a/xos/xos_client/xosapi/orm.py b/xos/xos_client/xosapi/orm.py
index 4f76a59..8ce0b5c 100644
--- a/xos/xos_client/xosapi/orm.py
+++ b/xos/xos_client/xosapi/orm.py
@@ -44,6 +44,14 @@
reverse_fkmap=self.gen_reverse_fkmap()
super(ORMWrapper, self).__setattr__("_reverse_fkmap", reverse_fkmap)
+ def create_attr(self, name, value=None):
+ """ setattr(self, ...) will fail for attributes that don't exist in the
+ wrapped grpc class. This is by design. However, if someone really
+ does want to attach a new attribute to this class, then they can
+ call create_attr()
+ """
+ super(ORMWrapper, self).__setattr__(name, value)
+
def gen_fkmap(self):
fkmap = {}