vtn source network should only be private networks, vtn destination networks should only be access networks
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 2b450e0..135dce9 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -168,12 +168,35 @@
# print "add instance", s
+ def get_vtn_src_nets(self):
+ nets=[]
+ for slice in self.slices.all():
+ for ns in slice.networkslices.all():
+ if not ns.network:
+ continue
+ if ns.network.template.access in ["direct", "indirect"]:
+ # skip access networks; we want to use the private network
+ continue
+ if ns.network.name in ["wan_network", "lan_network"]:
+ # we don't want to attach to the vCPE's lan or wan network
+ # we only want to attach to its private network
+ # TODO: fix hard-coding of network name
+ continue
+ for cn in ns.network.controllernetworks.all():
+ if cn.net_id:
+ net = {"name": ns.network.name, "net_id": cn.net_id}
+ nets.append(net)
+ return nets
+
def get_vtn_nets(self):
nets=[]
for slice in self.slices.all():
for ns in slice.networkslices.all():
if not ns.network:
continue
+ if ns.network.template.access not in ["direct", "indirect"]:
+ # skip anything that's not an access network
+ continue
for cn in ns.network.controllernetworks.all():
if cn.net_id:
net = {"name": ns.network.name, "net_id": cn.net_id}
@@ -195,11 +218,11 @@
def get_vtn_dependencies_names(self):
return [x["name"]+"_"+x["net_id"] for x in self.get_vtn_dependencies_nets()]
- def get_vtn_ids(self):
- return [x["net_id"] for x in self.get_vtn_nets()]
+ def get_vtn_src_ids(self):
+ return [x["net_id"] for x in self.get_vtn_src_nets()]
- def get_vtn_names(self):
- return [x["name"]+"_"+x["net_id"] for x in self.get_vtn_nets()]
+ def get_vtn_src_names(self):
+ return [x["name"]+"_"+x["net_id"] for x in self.get_vtn_src_nets()]
class ServiceAttribute(PlCoreBase):