move the address properties into the vcpe object
diff --git a/xos/cord/models.py b/xos/cord/models.py
index a24917a..6c0a812 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -378,6 +378,22 @@
addresses["nat"] = ns.ip
return addresses
+ @property
+ def nat_ip(self):
+ return self.addresses.get("nat",None)
+
+ @property
+ def lan_ip(self):
+ return self.addresses.get("lan",None)
+
+ @property
+ def wan_ip(self):
+ return self.addresses.get("wan",None)
+
+ @property
+ def private_ip(self):
+ return self.addresses.get("private",None)
+
def pick_node(self):
nodes = list(Node.objects.all())
# TODO: logic to filter nodes by which nodes are up, and which
diff --git a/xos/core/xoslib/objects/cordsubscriber.py b/xos/core/xoslib/objects/cordsubscriber.py
index 38142d4..e6f0e10 100644
--- a/xos/core/xoslib/objects/cordsubscriber.py
+++ b/xos/core/xoslib/objects/cordsubscriber.py
@@ -40,6 +40,10 @@
("routeable_subnet", "vcpe.vbng.routeable_subnet"),
("vcpe_id", "vcpe.id"),
("vbng_id", "vcpe.vbng.id"),
+ ("nat_ip", "vcpe.nat_ip"),
+ ("lan_ip", "vcpe.lan_ip"),
+ ("private_ip", "vcpe.private_ip"),
+ ("wan_ip", "vcpe.wan_ip"),
)
def __getattr__(self, key):
@@ -56,30 +60,6 @@
raise AttributeError("getattr: %r object has no attribute %r" %
(self.__class__, key))
- @property
- def nat_ip(self):
- if not self.vcpe:
- return None
- return self.vcpe.addresses.get("nat",None)
-
- @property
- def lan_ip(self):
- if not self.vcpe:
- return None
- return self.vcpe.addresses.get("lan",None)
-
- @property
- def wan_ip(self):
- if not self.vcpe:
- return None
- return self.vcpe.addresses.get("wan",None)
-
- @property
- def private_ip(self):
- if not self.vcpe:
- return None
- return self.vcpe.addresses.get("private",None)
-
def __setattr__(self, key, value):
for (member_name, passthrough_name) in self.passthroughs:
if key==member_name: