turn off nat_net when use_vtn is True
diff --git a/xos/model_policies/model_policy_Slice.py b/xos/model_policies/model_policy_Slice.py
index 308d8cb..dfdcb4f 100644
--- a/xos/model_policies/model_policy_Slice.py
+++ b/xos/model_policies/model_policy_Slice.py
@@ -1,3 +1,5 @@
+from xos.config import Config
+
def handle_delete(slice):
from core.models import Controller, ControllerSlice, SiteDeployment, Network, NetworkSlice,NetworkTemplate, Slice
from collections import defaultdict
@@ -15,6 +17,9 @@
from core.models import Controller, ControllerSlice, SiteDeployment, Network, NetworkSlice,NetworkTemplate, Slice
from collections import defaultdict
+ # only create nat_net if not using VTN
+ support_nat_net = not getattr(Config(), "networking_use_vtn", False)
+
print "MODEL POLICY: slice", slice
# slice = Slice.get(slice_id)
@@ -49,8 +54,8 @@
public_nets.append(network)
elif network.template.name == 'Private':
private_nets.append(network)
- if not public_nets:
- # ensure there is at least one public network, and default it to dedicated
+ if support_nat_net and (not public_nets):
+ # ensure there is at least one public network, and default it to dedicated
nat_net = Network(
name = slice.name+'-nat',
template = NetworkTemplate.objects.get(name='Public shared IPv4'),
@@ -78,7 +83,7 @@
public_net_slice = net_slice
elif net_slice.network in private_nets:
private_net_slice = net_slice
- if not public_net_slice:
+ if support_nat_net and (not public_net_slice):
public_net_slice = NetworkSlice(slice=slice, network=public_nets[0])
public_net_slice.save()
print "MODEL POLICY: slice", slice, "made public_net_slice"