add wan_container_netbits, wan_container_gateway_mac, wan_container_gateway_ip
diff --git a/xos/configurations/vtn/cord-vtn-vsg.yaml b/xos/configurations/vtn/cord-vtn-vsg.yaml
index bb7cf10..f08a1b9 100644
--- a/xos/configurations/vtn/cord-vtn-vsg.yaml
+++ b/xos/configurations/vtn/cord-vtn-vsg.yaml
@@ -36,6 +36,7 @@
private_key_fn: /opt/xos/synchronizers/vcpe/vcpe_private_key
wan_container_gateway_ip: 10.123.0.1
wan_container_gateway_mac: 00:8c:fa:5b:09:d8
+ wan_container_netbits: 24
artifacts:
pubkey: /opt/xos/synchronizers/vcpe/vcpe_public_key
diff --git a/xos/services/cord/admin.py b/xos/services/cord/admin.py
index 71cae5f..40e0f29 100644
--- a/xos/services/cord/admin.py
+++ b/xos/services/cord/admin.py
@@ -104,6 +104,9 @@
bbs_server = forms.CharField(required=False)
backend_network_label = forms.CharField(required=False)
bbs_slice = forms.ModelChoiceField(queryset=Slice.objects.all(), required=False)
+ wan_container_gateway_ip = forms.CharField(required=False)
+ wan_container_gateway_mac = forms.CharField(required=False)
+ wan_container_netbits = forms.CharField(required=False)
def __init__(self,*args,**kwargs):
super (VSGServiceForm,self ).__init__(*args,**kwargs)
@@ -113,6 +116,9 @@
self.fields['bbs_server'].initial = self.instance.bbs_server
self.fields['backend_network_label'].initial = self.instance.backend_network_label
self.fields['bbs_slice'].initial = self.instance.bbs_slice
+ self.fields['wan_container_gateway_ip'].initial = self.instance.wan_container_gateway_ip
+ self.fields['wan_container_gateway_mac'].initial = self.instance.wan_container_gateway_mac
+ self.fields['wan_container_netbits'].initial = self.instance.wan_container_netbits
def save(self, commit=True):
self.instance.bbs_api_hostname = self.cleaned_data.get("bbs_api_hostname")
@@ -120,6 +126,9 @@
self.instance.bbs_server = self.cleaned_data.get("bbs_server")
self.instance.backend_network_label = self.cleaned_data.get("backend_network_label")
self.instance.bbs_slice = self.cleaned_data.get("bbs_slice")
+ self.instance.wan_container_gateway_ip = self.cleaned_data.get("wan_container_gateway_ip")
+ self.instance.wan_container_gateway_mac = self.cleaned_data.get("wan_container_gateway_mac")
+ self.instance.wan_container_netbits = self.cleaned_data.get("wan_container_netbits")
return super(VSGServiceForm, self).save(commit=commit)
class Meta:
@@ -133,7 +142,7 @@
list_display_links = ('backend_status_icon', 'name', )
fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description', "view_url", "icon_url", "service_specific_attribute",],
'classes':['suit-tab suit-tab-general']}),
- ("backend config", {'fields': [ "backend_network_label", "bbs_api_hostname", "bbs_api_port", "bbs_server", "bbs_slice"],
+ ("backend config", {'fields': [ "backend_network_label", "bbs_api_hostname", "bbs_api_port", "bbs_server", "bbs_slice", "wan_container_gateway_ip", "wan_container_gateway_mac", "wan_container_netbits"],
'classes':['suit-tab suit-tab-backend']}) ]
readonly_fields = ('backend_status_text', "service_specific_attribute")
inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline]
@@ -164,6 +173,7 @@
instance = forms.ModelChoiceField(queryset=Instance.objects.all(),required=False)
last_ansible_hash = forms.CharField(required=False)
wan_container_ip = forms.CharField(required=False)
+ wan_container_mac = forms.CharField(required=False)
def __init__(self,*args,**kwargs):
super (VSGTenantForm,self ).__init__(*args,**kwargs)
@@ -176,6 +186,7 @@
self.fields['instance'].initial = self.instance.instance
self.fields['last_ansible_hash'].initial = self.instance.last_ansible_hash
self.fields['wan_container_ip'].initial = self.instance.wan_container_ip
+ self.fields['wan_container_mac'].initial = self.instance.wan_container_mac
if (not self.instance) or (not self.instance.pk):
# default fields for an 'add' form
self.fields['kind'].initial = VCPE_KIND
@@ -196,9 +207,9 @@
list_display = ('backend_status_icon', 'id', 'subscriber_tenant' )
list_display_links = ('backend_status_icon', 'id')
fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'subscriber_tenant', 'service_specific_id', # 'service_specific_attribute',
- 'wan_container_ip', 'bbs_account', 'creator', 'instance', 'last_ansible_hash'],
+ 'wan_container_ip', 'wan_container_mac', 'bbs_account', 'creator', 'instance', 'last_ansible_hash'],
'classes':['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', 'service_specific_attribute', 'bbs_account')
+ readonly_fields = ('backend_status_text', 'service_specific_attribute', 'bbs_account', 'wan_container_ip', 'wan_container_mac')
form = VSGTenantForm
suit_form_tabs = (('general','Details'),)
diff --git a/xos/services/cord/models.py b/xos/services/cord/models.py
index 2f29d81..fe978c9 100644
--- a/xos/services/cord/models.py
+++ b/xos/services/cord/models.py
@@ -399,7 +399,10 @@
simple_attributes = ( ("bbs_api_hostname", None),
("bbs_api_port", None),
("bbs_server", None),
- ("backend_network_label", "hpc_client"), )
+ ("backend_network_label", "hpc_client"),
+ ("wan_container_gateway_ip", ""),
+ ("wan_container_gateway_mac", ""),
+ ("wan_container_netbits", "24") )
def __init__(self, *args, **kwargs):
super(VSGService, self).__init__(*args, **kwargs)
@@ -727,6 +730,10 @@
if not self.volt:
raise XOSConfigurationError("This vCPE container has no volt")
+ if self.instance:
+ # We're good.
+ return
+
instance = self.find_or_make_instance_for_s_tag(self.volt.s_tag)
self.instance = instance
super(TenantWithContainer, self).save()
@@ -766,6 +773,7 @@
raise Exception("AddressPool 'public_addresses' has run out of addresses.")
self.wan_container_ip = addr
+ super(TenantWithContainer, self).save()
def cleanup_wan_container_ip(self):
if CORD_USE_VTN and self.wan_container_ip:
diff --git a/xos/synchronizers/vcpe/steps/sync_vcpetenant.py b/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
index bbb3ad5..27b47d4 100644
--- a/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
+++ b/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
@@ -25,6 +25,8 @@
PARENTAL_MECHANISM="dnsmasq"
ENABLE_QUICK_UPDATE=False
+CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
+
class SyncVSGTenant(SyncInstanceUsingAnsible):
provides=[VSGTenant]
observes=VSGTenant
@@ -145,6 +147,9 @@
"bbs_addrs": bbs_addrs,
"full_setup": full_setup,
"isolation": o.instance.isolation,
+ "wan_container_gateway_mac": vcpe_service.wan_container_gateway_mac,
+ "wan_container_gateway_ip": vcpe_service.wan_container_gateway_ip,
+ "wan_container_netbits": vcpe_service.wan_container_netbits,
"safe_browsing_macs": safe_macs}
# add in the sync_attributes that come from the SubscriberRoot object
@@ -227,7 +232,10 @@
if o.instance.isolation in ["container", "container_vm"]:
super(SyncVSGTenant, self).run_playbook(o, fields, "sync_vcpetenant_new.yaml")
else:
- super(SyncVSGTenant, self).run_playbook(o, fields)
+ if CORD_USE_VTN:
+ super(SyncVSGTenant, self).run_playbook(o, fields, template_name="sync_vcpetenant_vtn.yaml")
+ else:
+ super(SyncVSGTenant, self).run_playbook(o, fields)
o.last_ansible_hash = ansible_hash
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 7242d00..80c0d91 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -224,6 +224,9 @@
wan_container_gateway_mac:
type: string
required: false
+ wan_container_netbits:
+ type: string
+ required: false
tosca.nodes.VBNGService:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 79252e9..2f404dc 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -326,6 +326,9 @@
wan_container_gateway_mac:
type: string
required: false
+ wan_container_netbits:
+ type: string
+ required: false
tosca.nodes.VBNGService:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/resources/vcpeservice.py b/xos/tosca/resources/vcpeservice.py
index 8780f8f..1794010 100644
--- a/xos/tosca/resources/vcpeservice.py
+++ b/xos/tosca/resources/vcpeservice.py
@@ -12,5 +12,5 @@
class XOSVsgService(XOSService):
provides = "tosca.nodes.VSGService"
xos_model = VSGService
- copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "private_key_fn", "versionNumber", "backend_network_label", "wan_container_gateway_ip", "wan_container_gateway_mac"]
+ copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "private_key_fn", "versionNumber", "backend_network_label", "wan_container_gateway_ip", "wan_container_gateway_mac", "wan_container_netbits"]