Merge branch 'master' of github.com:open-cloud/xos
diff --git a/xos/cord/models.py b/xos/cord/models.py
index 44ced17..483b76b 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -197,9 +197,6 @@
proxy = True
def allocate_bbs_account(self):
- # XXX fixme XXX
- return "bbs01@onlab.us"
-
vcpes = VCPETenant.get_tenant_objects().all()
bbs_accounts = [vcpe.bbs_account for vcpe in vcpes]
@@ -643,7 +640,9 @@
KIND = "vBNG"
default_attributes = {"routeable_subnet": "",
- "mapped_ip": ""}
+ "mapped_ip": "",
+ "mapped_mac": "",
+ "mapped_hostname": ""}
@property
def routeable_subnet(self):
@@ -660,3 +659,19 @@
@mapped_ip.setter
def mapped_ip(self, value):
self.set_attribute("mapped_ip", value)
+
+ @property
+ def mapped_mac(self):
+ return self.get_attribute("mapped_mac", self.default_attributes["mapped_mac"])
+
+ @mapped_mac.setter
+ def mapped_mac(self, value):
+ self.set_attribute("mapped_mac", value)
+
+ @property
+ def mapped_hostname(self):
+ return self.get_attribute("mapped_hostname", self.default_attributes["mapped_hostname"])
+
+ @mapped_hostname.setter
+ def mapped_hostname(self, value):
+ self.set_attribute("mapped_hostname", value)
diff --git a/xos/core/xoslib/methods/cordsubscriber.py b/xos/core/xoslib/methods/cordsubscriber.py
index 5992a2e..79a1442 100644
--- a/xos/core/xoslib/methods/cordsubscriber.py
+++ b/xos/core/xoslib/methods/cordsubscriber.py
@@ -367,7 +367,7 @@
mappings = []
for vbng in object_list:
if vbng.mapped_ip and vbng.routeable_subnet:
- mappings.append( {"private_ip": vbng.mapped_ip, "routeable_subnet": vbng.routeable_subnet} )
+ mappings.append( {"private_ip": vbng.mapped_ip, "routeable_subnet": vbng.routeable_subnet, "mac": vbng.mapped_mac, "hostname": vbng.mapped_hostname} )
return Response( {"vbng_mapping": mappings} )
diff --git a/xos/observers/vbng/steps/sync_vbngtenant.py b/xos/observers/vbng/steps/sync_vbngtenant.py
index b0dd345..9dec0de 100644
--- a/xos/observers/vbng/steps/sync_vbngtenant.py
+++ b/xos/observers/vbng/steps/sync_vbngtenant.py
@@ -40,7 +40,7 @@
logger.info("defer object %s due to %s" % (str(o), reason))
raise Exception("defer object %s due to %s" % (str(o), reason))
- def get_private_ip(self, o):
+ def get_private_interface(self, o):
vcpes = VCPETenant.get_tenant_objects().all()
vcpes = [x for x in vcpes if (x.vbng is not None) and (x.vbng.id == o.id)]
if not vcpes:
@@ -54,30 +54,31 @@
if not sliver:
raise Exception("No sliver associated with vBNG %s" % str(o.id))
- external_ns = None
- for ns in sliver.networkslivers.all():
- if (ns.ip) and ("WAN" in ns.network.template.name):
- external_ns = ns
+ if not vcpe.wan_ip:
+ self.defer_sync(o, "does not have a WAN IP yet")
- if not external_ns:
- self.defer_sync(o, "WAN network is not filled in yet")
- return
+ if not vcpe.wan_mac:
+ # this should never happen; WAN MAC is computed from WAN IP
+ self.defer_sync(o, "does not have a WAN MAC yet")
- return external_ns.ip
+ return (vcpe.wan_ip, vcpe.wan_mac, vcpe.sliver.node.name)
def sync_record(self, o):
logger.info("sync'ing VBNGTenant %s" % str(o))
if not o.routeable_subnet:
- private_ip = self.get_private_ip(o)
- logger.info("contacting vBNG service to request mapping for private ip %s" % private_ip)
+ (private_ip, private_mac, private_hostname) = self.get_private_interface(o)
+ logger.info("contacting vBNG service to request mapping for private ip %s mac %s host %s" % (private_ip, private_mac, private_hostname) )
- r = requests.post(VBNG_API + "%s" % private_ip, )
+ r = requests.post(VBNG_API + "%s" % (private_ip,) )
+ #r = requests.post(VBNG_API + "%s/%s/%s" % (private_ip, private_mac, private_hostname) )
if (r.status_code != 200):
raise Exception("Received error from bng service (%d)" % r.status_code)
logger.info("received public IP %s from private IP %s" % (r.text, private_ip))
o.routeable_subnet = r.text
o.mapped_ip = private_ip
+ c.mapped_mac = private_mac
+ c.mapped_hostname = private_hostname
o.save()
diff --git a/xos/observers/vcpe/steps/sync_vcpetenant.py b/xos/observers/vcpe/steps/sync_vcpetenant.py
index a29ba09..d2afed5 100644
--- a/xos/observers/vcpe/steps/sync_vcpetenant.py
+++ b/xos/observers/vcpe/steps/sync_vcpetenant.py
@@ -113,8 +113,13 @@
run_template_ssh(self.template_name, fields)
if o.url_filter_enable:
- bbs = BBS(o.bbs_account, "123")
- bbs.sync(o.url_filter_level, o.users)
+ if (str(o.service_specific_id) != "SYNCME"):
+ # XXX FIXME
+ # Also fix the spot in cord/models.py
+ logger.info("skipping sync of URL filter for SSID %s" % str(o.service_specific_id))
+ else:
+ bbs = BBS(o.bbs_account, "123")
+ bbs.sync(o.url_filter_level, o.users)
o.save()
diff --git a/xos/observers/vcpe/templates/start-vcpe.sh.j2 b/xos/observers/vcpe/templates/start-vcpe.sh.j2
index 07004a1..c199bb3 100755
--- a/xos/observers/vcpe/templates/start-vcpe.sh.j2
+++ b/xos/observers/vcpe/templates/start-vcpe.sh.j2
@@ -15,7 +15,7 @@
# Set up networking via pipework
docker exec vcpe ifconfig eth0 >> /dev/null || pipework eth4 -i eth0 vcpe {{ wan_ip }}/17@192.168.128.1 {{ wan_mac }}
docker exec vcpe ifconfig eth1 >> /dev/null || pipework eth3 -i eth1 vcpe 192.168.0.1/24 @{{ vlan_ids[0] }}
-docker exec vcpe ifconfig eth2 >> /dev/null || pipework eth0 -i eth2 vcpe {{ hpc_client_ip }}/16
+docker exec vcpe ifconfig eth2 >> /dev/null || pipework eth0 -i eth2 vcpe {{ hpc_client_ip }}/24
# Now can start up dnsmasq
docker exec vcpe service dnsmasq start