vbng-related fields
diff --git a/xos/core/xoslib/methods/cordsubscriber.py b/xos/core/xoslib/methods/cordsubscriber.py
index 1470323..3414fb8 100644
--- a/xos/core/xoslib/methods/cordsubscriber.py
+++ b/xos/core/xoslib/methods/cordsubscriber.py
@@ -19,9 +19,11 @@
class CordSubscriberIdSerializer(serializers.ModelSerializer, PlusSerializerMixin):
id = ReadOnlyField()
+ vlan_id = ReadOnlyField()
vcpe_id = ReadOnlyField()
sliver = ReadOnlyField()
image = ReadOnlyField()
+ vbng_id = ReadOnlyField()
firewall_enable = serializers.BooleanField()
firewall_rules = serializers.CharField()
url_filter_enable = serializers.BooleanField()
@@ -29,14 +31,15 @@
cdn_enable = serializers.BooleanField()
sliver_name = ReadOnlyField()
image_name = ReadOnlyField()
+ routeable_subnet = serializers.CharField()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
class Meta:
model = CordSubscriber
fields = ('humanReadableName', 'id',
- 'service_specific_id',
- 'vcpe_id', 'sliver', 'sliver_name', 'image', 'image_name', 'firewall_enable', 'firewall_rules', 'url_filter_enable', 'url_filter_rules', 'cdn_enable')
+ 'vlan_id',
+ 'vcpe_id', 'sliver', 'sliver_name', 'image', 'image_name', 'firewall_enable', 'firewall_rules', 'url_filter_enable', 'url_filter_rules', 'cdn_enable', 'vbng_id', 'routeable_subnet',)
def getHumanReadableName(self, obj):
diff --git a/xos/core/xoslib/objects/cordsubscriber.py b/xos/core/xoslib/objects/cordsubscriber.py
index 654d8a3..b0c5c48 100644
--- a/xos/core/xoslib/objects/cordsubscriber.py
+++ b/xos/core/xoslib/objects/cordsubscriber.py
@@ -25,17 +25,6 @@
def __init__(self, *args, **kwargs):
super(VOLTTenant, self).__init__(*args, **kwargs)
- @property
- def vcpe_id(self):
- if self.vcpe:
- return self.vcpe.id
- else:
- return None
-
- @vcpe_id.setter
- def vcpe_id(self, value):
- pass
-
passthroughs = ( ("firewall_enable", "vcpe.firewall_enable"),
("firewall_rules", "vcpe.firewall_rules"),
("url_filter_enable", "vcpe.url_filter_enable"),
@@ -44,7 +33,11 @@
("image", "vcpe.image.id"),
("image_name", "vcpe.image.name"),
("sliver", "vcpe.sliver.id"),
- ("sliver_name", "vcpe.sliver.name") )
+ ("sliver_name", "vcpe.sliver.name"),
+ ("routeable_subnet", "vcpe.vbng.routeable_subnet"),
+ ("vcpe_id", "vcpe.id"),
+ ("vbng_id", "vcpe.vbng.id"),
+ ("vlan_id", "service_specific_id") )
def __getattr__(self, key):
for (member_name, passthrough_name) in self.passthroughs:
@@ -69,10 +62,24 @@
obj = getattr(obj, part)
if not obj:
return
+ print "XXX", obj, parts[-1], value
setattr(obj, parts[-1], value)
super(CordSubscriber, self).__setattr__(key, value)
+ def save(self, *args, **kwargs):
+ super(CordSubscriber, self).save(*args, **kwargs)
+
+ # in case the vcpe or vbng fields were altered
+ # TODO: dirty detection?
+ if (self.vcpe):
+ print "save vcpe"
+ self.vcpe.save()
+ if (self.vcpe.vbng):
+ print "save vbng", self.vcpe.vbng
+ print "attr", self.vcpe.vbng.service_specific_attribute
+ self.vcpe.vbng.save()
+
diff --git a/xos/core/xoslib/static/js/xoslib/xos-backbone.js b/xos/core/xoslib/static/js/xoslib/xos-backbone.js
index a8061ed..1087667 100644
--- a/xos/core/xoslib/static/js/xoslib/xos-backbone.js
+++ b/xos/core/xoslib/static/js/xoslib/xos-backbone.js
@@ -396,8 +396,6 @@
modelAttrs.defaults = get_defaults(modelName);
}
- console.log(collectionAttrs);
-
// if ((typeof xosdefaults !== "undefined") && xosdefaults[modelName]) {
// modelAttrs["defaults"] = xosdefaults[modelName];
// }
@@ -731,8 +729,10 @@
define_model(this, {urlRoot: CORDSUBSCRIBER_API,
modelName: "cordSubscriber",
- listFields: ["id"],
- detailFields: ["id", "service_specific_id", "vcpe_id", "image_name", "sliver_name", "firewall_enable", "firewall_rules", "url_filter_enable", "url_filter_rules", "cdn_enable"],
+ listFields: ["id", "vlan_id", "routeable_subnet"],
+ detailFields: ["id", "service_specific_id", "vcpe_id", "image_name", "sliver_name",
+ "firewall_enable", "firewall_rules", "url_filter_enable", "url_filter_rules", "cdn_enable",
+ "vbng_id", "routeable_subnet"],
inputType: {"firewall_enable": "checkbox",
"url_filter_enable": "checkbox",
"cdn_enable": "checkbox"},
diff --git a/xos/core/xoslib/templates/xosCordSubscriber.html b/xos/core/xoslib/templates/xosCordSubscriber.html
index ff95922..fe33d69 100644
--- a/xos/core/xoslib/templates/xosCordSubscriber.html
+++ b/xos/core/xoslib/templates/xosCordSubscriber.html
@@ -6,7 +6,7 @@
<h3>vOLT</h3>
<table class="xos-detail-table">
<tr><td class="xos-label-cell xos-cord-label">Id:</td><td><%= model.attributes.id %></td></tr>
- <tr><td class="xos-label-cell xos-cord-label">VLAN Id:</td><td><%= model.attributes.service_specific_id %></td></tr>
+ <tr><td class="xos-label-cell xos-cord-label">VLAN Id:</td><td><%= model.attributes.vlan_id %></td></tr>
</table>
</div>
@@ -31,8 +31,8 @@
<div class="box">
<h3>vBNG</h3>
<table class="xos-detail-table">
- <tr><td class="xos-label-cell xos-cord-label">Id:</td><td></td></tr>
- <tr><td class="xos-label-cell xos-cord-label">Routeable Subnet:</td><td></td></tr>
+ <tr><td class="xos-label-cell xos-cord-label">Id:</td><td><%= model.attributes.vbng_id %></td></tr>
+ <tr><td class="xos-label-cell xos-cord-label">Routeable Subnet:</td><td><%= model.attributes.routeable_subnet %></td></tr>
</table>
</div>