Merge "CORD-2467: Start filebeat in synchronizer containers"
diff --git a/xos/admin.py b/xos/admin.py
deleted file mode 100644
index 6ab7524..0000000
--- a/xos/admin.py
+++ /dev/null
@@ -1,171 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from django.contrib import admin
-
-from services.volt.models import *
-from django import forms
-from django.utils.safestring import mark_safe
-from django.contrib.auth.admin import UserAdmin
-from django.contrib.admin.widgets import FilteredSelectMultiple
-from django.contrib.auth.forms import ReadOnlyPasswordHashField
-from django.contrib.auth.signals import user_logged_in
-from django.utils import timezone
-from django.contrib.contenttypes import generic
-from suit.widgets import LinkedSelect
-from core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, SubscriberLinkInline, ProviderLinkInline, ProviderDependencyInline,SubscriberDependencyInline
-from core.middleware import get_request
-
-from functools import update_wrapper
-from django.contrib.admin.views.main import ChangeList
-from django.core.urlresolvers import reverse
-from django.contrib.admin.utils import quote
-
-#-----------------------------------------------------------------------------
-# vOLT
-#-----------------------------------------------------------------------------
-
-class VOLTServiceAdmin(ReadOnlyAwareAdmin):
- model = VOLTService
- verbose_name = "vOLT Service"
- verbose_name_plural = "vOLT Service"
- list_display = ("backend_status_icon", "name", "enabled")
- list_display_links = ('backend_status_icon', 'name', )
- fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description',"view_url","icon_url" ], 'classes':['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', )
- inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline,ProviderDependencyInline,SubscriberDependencyInline]
-
- extracontext_registered_admins = True
-
- user_readonly_fields = ["name", "enabled", "versionNumber", "description"]
-
- suit_form_tabs =(('general', 'vOLT Service Details'),
- ('administration', 'Administration'),
- #('tools', 'Tools'),
- ('slices','Slices'),
- ('serviceattrs','Additional Attributes'),
- ('servicetenants', 'Dependencies'),
- ('serviceprivileges','Privileges'),
- )
-
- suit_form_includes = (('voltadmin.html', 'top', 'administration'),
- ) #('hpctools.html', 'top', 'tools') )
-
-class VOLTTenantForm(forms.ModelForm):
- s_tag = forms.CharField()
- c_tag = forms.CharField()
- creator = forms.ModelChoiceField(queryset=User.objects.all())
-
- def __init__(self,*args,**kwargs):
- super (VOLTTenantForm,self ).__init__(*args,**kwargs)
- self.fields['owner'].queryset = VOLTService.objects.all()
- if self.instance:
- # fields for the attributes
- self.fields['c_tag'].initial = self.instance.c_tag
- self.fields['s_tag'].initial = self.instance.s_tag
- self.fields['creator'].initial = self.instance.creator
- if (not self.instance) or (not self.instance.pk):
- # default fields for an 'add' form
- self.fields['creator'].initial = get_request().user
- if VOLTService.objects.exists():
- self.fields["owner"].initial = VOLTService.objects.all()[0]
-
- def save(self, commit=True):
- self.instance.s_tag = self.cleaned_data.get("s_tag")
- self.instance.c_tag = self.cleaned_data.get("c_tag")
- self.instance.creator = self.cleaned_data.get("creator")
- return super(VOLTTenantForm, self).save(commit=commit)
-
- class Meta:
- model = VOLTTenant
- fields = '__all__'
-
-
-class VOLTTenantAdmin(ReadOnlyAwareAdmin):
- list_display = ('backend_status_icon', 'id', 'service_specific_id', 's_tag', 'c_tag', )
- list_display_links = ('backend_status_icon', 'id')
- fieldsets = [ (None, {'fields': ['backend_status_text', 'owner', 'service_specific_id', # 'service_specific_attribute',
- 's_tag', 'c_tag', 'creator'],
- 'classes':['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', 'service_specific_attribute')
- inlines = (ProviderLinkInline, SubscriberLinkInline)
- form = VOLTTenantForm
-
- suit_form_tabs = (('general','Details'), ('servicelinks','Links'),)
-
- def get_queryset(self, request):
- return VOLTTenant.select_by_user(request.user)
-
-class AccessDeviceInline(XOSTabularInline):
- model = AccessDevice
- fields = ['volt_device','uplink','vlan']
- readonly_fields = []
- extra = 0
-# max_num = 0
- suit_classes = 'suit-tab suit-tab-accessdevices'
-
-# @property
-# def selflink_reverse_path(self):
-# return "admin:cord_volttenant_change"
-
-class VOLTDeviceAdmin(ReadOnlyAwareAdmin):
- list_display = ('backend_status_icon', 'name', 'openflow_id', 'driver' )
- list_display_links = ('backend_status_icon', 'name', 'openflow_id')
- fieldsets = [ (None, {'fields': ['backend_status_text','name','volt_service','openflow_id','driver','access_agent'],
- 'classes':['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text',)
- inlines = [AccessDeviceInline]
-
- suit_form_tabs = (('general','Details'), ('accessdevices','Access Devices'))
-
-class AccessDeviceAdmin(ReadOnlyAwareAdmin):
- list_display = ('backend_status_icon', 'id', 'volt_device', 'uplink', 'vlan' )
- list_display_links = ('backend_status_icon', 'id')
- fieldsets = [ (None, {'fields': ['backend_status_text','volt_device','uplink','vlan'],
- 'classes':['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text',)
-
- suit_form_tabs = (('general','Details'),)
-
-class AgentPortMappingInline(XOSTabularInline):
- model = AgentPortMapping
- fields = ['access_agent', 'mac', 'port']
- readonly_fields = []
- extra = 0
-# max_num = 0
- suit_classes = 'suit-tab suit-tab-accessportmaps'
-
-# @property
-# def selflink_reverse_path(self):
-# return "admin:cord_volttenant_change"
-
-class AccessAgentAdmin(ReadOnlyAwareAdmin):
- list_display = ('backend_status_icon', 'name', 'mac' )
- list_display_links = ('backend_status_icon', 'name')
- fieldsets = [ (None, {'fields': ['backend_status_text','name','volt_service','mac'],
- 'classes':['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text',)
- inlines= [AgentPortMappingInline]
-
- suit_form_tabs = (('general','Details'), ('accessportmaps', 'Port Mappings'))
-
-admin.site.register(VOLTService, VOLTServiceAdmin)
-admin.site.register(VOLTTenant, VOLTTenantAdmin)
-admin.site.register(VOLTDevice, VOLTDeviceAdmin)
-admin.site.register(AccessDevice, AccessDeviceAdmin)
-admin.site.register(AccessAgent, AccessAgentAdmin)
-
-
diff --git a/xos/attic/header.py b/xos/attic/header.py
index 0bb8be2..4555c8c 100644
--- a/xos/attic/header.py
+++ b/xos/attic/header.py
@@ -25,8 +25,6 @@
from operator import itemgetter, attrgetter, methodcaller
from core.models import Tag
from core.models.service import LeastLoadedNodeScheduler
-from services.vrouter.models import VRouterService, VRouterTenant
-from services.rcord.models import CordSubscriberRoot
import traceback
from xos.exceptions import *
from xosconfig import Config
diff --git a/xos/header.py b/xos/header.py
deleted file mode 100644
index 0bb8be2..0000000
--- a/xos/header.py
+++ /dev/null
@@ -1,39 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from django.db import models
-from django.db.models import *
-from core.models import Service, XOSBase, Slice, Instance, ServiceInstance, ServiceInstanceLink, Node, Image, User, Flavor, NetworkParameter, NetworkParameterType, Port, AddressPool, User
-from core.models.xosbase import StrippedCharField
-import os
-from django.db import models, transaction
-from django.forms.models import model_to_dict
-from django.db.models import Q
-from operator import itemgetter, attrgetter, methodcaller
-from core.models import Tag
-from core.models.service import LeastLoadedNodeScheduler
-from services.vrouter.models import VRouterService, VRouterTenant
-from services.rcord.models import CordSubscriberRoot
-import traceback
-from xos.exceptions import *
-from xosconfig import Config
-
-class ConfigurationError(Exception):
- pass
-
-VOLT_KIND = "vOLT"
-
-CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
diff --git a/xos/header.py b/xos/header.py
new file mode 120000
index 0000000..721b5c0
--- /dev/null
+++ b/xos/header.py
@@ -0,0 +1 @@
+attic/header.py
\ No newline at end of file
diff --git a/xos/synchronizer/model_policies/test_model_policy_volttenant.py b/xos/synchronizer/model_policies/test_model_policy_volttenant.py
index d3a2b42..b3edf3f 100644
--- a/xos/synchronizer/model_policies/test_model_policy_volttenant.py
+++ b/xos/synchronizer/model_policies/test_model_policy_volttenant.py
@@ -27,6 +27,18 @@
xos_dir=os.path.join(test_path, "../../../../../../orchestration/xos/xos")
services_dir=os.path.join(xos_dir, "../../xos_services")
+# While transitioning from static to dynamic load, the path to find neighboring xproto files has changed. So check
+# both possible locations...
+def get_models_fn(service_name, xproto_name):
+ name = os.path.join(service_name, "xos", xproto_name)
+ if os.path.exists(os.path.join(services_dir, name)):
+ return name
+ else:
+ name = os.path.join(service_name, "xos", "synchronizer", "models", xproto_name)
+ if os.path.exists(os.path.join(services_dir, name)):
+ return name
+ raise Exception("Unable to find service=%s xproto=%s" % (service_name, xproto_name))
+
class TestModelPolicyVOLTTenant(unittest.TestCase):
def setUp(self):
global VOLTTenantPolicy, MockObjectList
@@ -41,7 +53,9 @@
Config.init(config, 'synchronizer-config-schema.yaml')
from synchronizers.new_base.mock_modelaccessor_build import build_mock_modelaccessor
- build_mock_modelaccessor(xos_dir, services_dir, ["olt-service/xos/volt.xproto", "vsg/xos/vsg.xproto", "../profiles/rcord/xos/rcord.xproto"])
+ build_mock_modelaccessor(xos_dir, services_dir, [get_models_fn("olt-service", "volt.xproto"),
+ get_models_fn("vsg", "vsg.xproto"),
+ get_models_fn("../profiles/rcord", "rcord.xproto")])
import synchronizers.new_base.modelaccessor
import model_policy_volttenant
diff --git a/xos/templates/voltadmin.html b/xos/templates/voltadmin.html
deleted file mode 100644
index b971d15..0000000
--- a/xos/templates/voltadmin.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-<!--
-Copyright 2017-present Open Networking Foundation
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-
-<div class = "row text-center">
- <div class="col-xs-12">
- <a href="/admin/volt/volttenant/">vOLT Tenants</a>
- </div><div class="col-xs-12">
- <a href="/admin/volt/voltdevice/">vOLT Devices</a>
- </div><div class="col-xs-12">
- <a href="/admin/volt/accessagent/">vOLT Access Agents</a>
- </div>
-</div>
-
diff --git a/xos/volt-onboard.yaml b/xos/volt-onboard.yaml
index 378f0ba..2bb8c77 100644
--- a/xos/volt-onboard.yaml
+++ b/xos/volt-onboard.yaml
@@ -30,9 +30,6 @@
# The following will concatenate with base_url automatically, if
# base_url is non-null.
xproto: ./
- admin: admin.py
- admin_template: templates/voltadmin.html
- #synchronizer: synchronizer/manifest
tosca_resource: tosca/resources/voltdevice.py, tosca/resources/voltservice.py, tosca/resources/CORDSubscriber.py, tosca/resources/CORDUser.py, tosca/resources/VOLTTenant.py, tosca/resources/accessagent.py, tosca/resources/accessdevice.py
private_key: file:///opt/xos/key_import/volt_rsa
public_key: file:///opt/xos/key_import/volt_rsa.pub