add vcpe_synced field to cordsubscriber object
diff --git a/xos/cord/models.py b/xos/cord/models.py
index e593097..cab7909 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -522,6 +522,14 @@
def hpc_client_ip(self):
return self.addresses.get("hpc_client",None)
+ @property
+ def is_synced(self):
+ return (self.enacted is not None) and (self.enacted >= self.updated)
+
+ @is_synced.setter
+ def is_synced(self, value):
+ pass
+
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/methods/cordsubscriber.py b/xos/core/xoslib/methods/cordsubscriber.py
index 2db688f..ee6a431 100644
--- a/xos/core/xoslib/methods/cordsubscriber.py
+++ b/xos/core/xoslib/methods/cordsubscriber.py
@@ -51,6 +51,8 @@
wan_mac = ReadOnlyField()
+ vcpe_synced = serializers.BooleanField()
+
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
class Meta:
@@ -62,6 +64,7 @@
'url_filter_enable', 'url_filter_rules', 'url_filter_level',
'bbs_account',
'ssh_command',
+ 'vcpe_synced',
'cdn_enable', 'vbng_id', 'routeable_subnet', 'nat_ip', 'lan_ip', 'wan_ip', 'private_ip', 'wan_mac')
@@ -314,7 +317,7 @@
def setup_demo_vcpe(self, voltTenant):
# nuke the users and start over
voltTenant.vcpe.users = []
- voltTenant.vcpe.create_user(name="Mom's PC", mac="010203030506", level="PG_13")
+ voltTenant.vcpe.create_user(name="Mom's PC", mac="010203040506", level="PG_13")
voltTenant.vcpe.create_user(name="Dad's PC", mac="90E2Ba82F975", level="PG_13")
voltTenant.vcpe.create_user(name="Jack's iPhone", mac="A85B780F2651", level="PG_13")
voltTenant.vcpe.create_user(name="Jill's iPad", mac="010203040509", level="PG_13")
diff --git a/xos/core/xoslib/objects/cordsubscriber.py b/xos/core/xoslib/objects/cordsubscriber.py
index 4719a13..1a376ad 100644
--- a/xos/core/xoslib/objects/cordsubscriber.py
+++ b/xos/core/xoslib/objects/cordsubscriber.py
@@ -50,6 +50,7 @@
("private_ip", "vcpe.private_ip"),
("wan_ip", "vcpe.wan_ip"),
("wan_mac", "vcpe.wan_mac"),
+ ("vcpe_synced", "vcpe.is_synced"),
)
def __getattr__(self, key):