aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-04-29 10:54:46 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-04-29 11:20:25 +0800
commit669ef8d8b4f9b9170d0710bc92ac621fe27fcb81 (patch)
tree7b1df83606ea5e3f4efbd2ec4975d6e026c4fd4b
parent42abd8c99e0c0bcda1ca9d66a467b70c55ce3f6d (diff)
Add nslcm admin db management1.3.0
Change-Id: Ia94c41f32019cdad2b1e15dd49c6f0660a8defd0 Issue-ID: VFC-1306 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/pub/database/admin.py340
-rw-r--r--lcm/settings.py1
-rw-r--r--lcm/urls.py2
3 files changed, 343 insertions, 0 deletions
diff --git a/lcm/pub/database/admin.py b/lcm/pub/database/admin.py
new file mode 100644
index 00000000..90dad5db
--- /dev/null
+++ b/lcm/pub/database/admin.py
@@ -0,0 +1,340 @@
+# Copyright 2019 ZTE Corporation.
+#
+# 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 lcm.pub.database.models import NSDModel
+from lcm.pub.database.models import NSInstModel
+from lcm.pub.database.models import NfPackageModel
+from lcm.pub.database.models import VnfPackageFileModel
+from lcm.pub.database.models import FPInstModel
+from lcm.pub.database.models import VNFFGInstModel
+from lcm.pub.database.models import NfInstModel
+from lcm.pub.database.models import VmInstModel
+from lcm.pub.database.models import VNFCInstModel
+from lcm.pub.database.models import CPInstModel
+from lcm.pub.database.models import VLInstModel
+from lcm.pub.database.models import PortInstModel
+from lcm.pub.database.models import JobModel
+from lcm.pub.database.models import JobStatusModel
+from lcm.pub.database.models import DefPkgMappingModel
+from lcm.pub.database.models import InputParamMappingModel
+from lcm.pub.database.models import ServiceBaseInfoModel
+from lcm.pub.database.models import WFPlanModel
+from lcm.pub.database.models import OOFDataModel
+from lcm.pub.database.models import SubscriptionModel
+from lcm.pub.database.models import NSLcmOpOccModel
+from lcm.pub.database.models import PNFInstModel
+
+
+@admin.register(NSDModel)
+class NSDModelAdmin(admin.ModelAdmin):
+ list_display_links = ('id', 'name')
+ fields = [
+ "id",
+ "nsd_id",
+ "name",
+ "vendor",
+ "description",
+ "version",
+ "nsd_model",
+ "nsd_path"
+ ]
+
+ list_display = [
+ "id",
+ "nsd_id",
+ "name",
+ "vendor",
+ "description",
+ "version",
+ "nsd_model",
+ "nsd_path"
+ ]
+
+ search_fields = (
+ "id",
+ "nsd_id",
+ "name"
+ )
+
+
+@admin.register(NSInstModel)
+class NSInstModelAdmin(admin.ModelAdmin):
+ list_display_links = ('id', 'name')
+ fields = [
+ "id",
+ "name",
+ "nspackage_id",
+ "nsd_id",
+ "nsd_invariant_id",
+ "description",
+ "sdncontroller_id",
+ "flavour_id",
+ "ns_level",
+ "status",
+ "nsd_model",
+ "input_params",
+ "scale_params",
+ "create_time",
+ "lastuptime",
+ "global_customer_id",
+ "service_type"
+ ]
+
+ list_display = [
+ "id",
+ "name",
+ "nspackage_id",
+ "nsd_id",
+ "nsd_invariant_id",
+ "description",
+ "sdncontroller_id",
+ "flavour_id",
+ "ns_level",
+ "status",
+ "nsd_model",
+ "input_params",
+ "scale_params",
+ "create_time",
+ "lastuptime",
+ "global_customer_id",
+ "service_type"
+ ]
+
+ search_fields = (
+ "id",
+ "name",
+ "nsd_id"
+ )
+
+
+@admin.register(NfInstModel)
+class NfInstModelAdmin(admin.ModelAdmin):
+ list_display_links = ('nfinstid', 'nf_name')
+ fields = [
+ "nfinstid",
+ "mnfinstid",
+ "nf_name",
+ "template_id",
+ "vnf_id",
+ "package_id",
+ "vnfm_inst_id",
+ "ns_inst_id",
+ "status",
+ "flavour_id",
+ "vnf_level",
+ "location",
+ "max_vm",
+ "max_cpu",
+ "max_ram",
+ "max_hd",
+ "max_shd",
+ "max_net",
+ "version",
+ "vendor",
+ "vnfd_model",
+ "input_params",
+ "scale_params",
+ "create_time",
+ "lastuptime",
+ "extension"
+ ]
+
+ list_display = [
+ "nfinstid",
+ "mnfinstid",
+ "nf_name",
+ "template_id",
+ "vnf_id",
+ "package_id",
+ "vnfm_inst_id",
+ "ns_inst_id",
+ "status",
+ "flavour_id",
+ "vnf_level",
+ "location",
+ "max_vm",
+ "max_cpu",
+ "max_ram",
+ "max_hd",
+ "max_shd",
+ "max_net",
+ "version",
+ "vendor",
+ "vnfd_model",
+ "input_params",
+ "scale_params",
+ "create_time",
+ "lastuptime",
+ "extension"
+ ]
+
+ search_fields = (
+ "nfinstid",
+ "nf_name",
+ "ns_inst_id"
+ )
+
+
+@admin.register(VmInstModel)
+class VmInstModelAdmin(admin.ModelAdmin):
+ list_display_links = ('vmid', 'resouceid')
+ fields = [
+ "vmid",
+ "vimid",
+ "resouceid",
+ "insttype",
+ "instid",
+ "vmname",
+ "operationalstate",
+ "zoneid",
+ "tenant",
+ "hostid",
+ "detailinfo"
+ ]
+
+ list_display = [
+ "vmid",
+ "vimid",
+ "resouceid",
+ "insttype",
+ "instid",
+ "vmname",
+ "operationalstate",
+ "zoneid",
+ "tenant",
+ "hostid",
+ "detailinfo"
+ ]
+
+ search_fields = (
+ "vmid",
+ "vimid",
+ "resouceid"
+ )
+
+
+@admin.register(VNFCInstModel)
+class VNFCInstModelAdmin(admin.ModelAdmin):
+ list_display_links = ('vnfcinstanceid', 'vduid')
+ fields = [
+ "vnfcinstanceid",
+ "vduid",
+ "nfinstid",
+ "vmid",
+ "status"
+ ]
+
+ list_display = [
+ "vnfcinstanceid",
+ "vduid",
+ "nfinstid",
+ "vmid",
+ "status"
+ ]
+
+ search_fields = (
+ "vnfcinstanceid",
+ "vduid",
+ "nfinstid"
+ )
+
+
+@admin.register(VLInstModel)
+class VLInstModelAdmin(admin.ModelAdmin):
+ list_display_links = ('vlinstanceid', 'vldid')
+ fields = [
+ "vlinstanceid",
+ "vldid",
+ "vlinstancename",
+ "ownertype",
+ "ownerid",
+ "relatednetworkid",
+ "relatedsubnetworkid",
+ "vltype",
+ "vimid",
+ "tenant",
+ "status",
+ ]
+
+ list_display = [
+ "vlinstanceid",
+ "vldid",
+ "vlinstancename",
+ "ownertype",
+ "ownerid",
+ "relatednetworkid",
+ "relatedsubnetworkid",
+ "vltype",
+ "vimid",
+ "tenant",
+ "status",
+ ]
+
+ search_fields = (
+ "vlinstanceid",
+ "vldid",
+ "vlinstancename"
+ )
+
+
+@admin.register(OOFDataModel)
+class OOFDataModelAdmin(admin.ModelAdmin):
+ list_display_links = ('request_id', 'transaction_id')
+ fields = [
+ "request_id",
+ "transaction_id",
+ "request_status",
+ "request_module_name",
+ "service_resource_id",
+ "vim_id",
+ "cloud_owner",
+ "cloud_region_id",
+ "vdu_info"
+ ]
+
+ list_display = [
+ "request_id",
+ "transaction_id",
+ "request_status",
+ "request_module_name",
+ "service_resource_id",
+ "vim_id",
+ "cloud_owner",
+ "cloud_region_id",
+ "vdu_info"
+ ]
+
+ search_fields = (
+ "request_id",
+ "transaction_id"
+ )
+
+
+admin.site.register(NfPackageModel)
+admin.site.register(VnfPackageFileModel)
+admin.site.register(FPInstModel)
+admin.site.register(CPInstModel)
+admin.site.register(VNFFGInstModel)
+admin.site.register(PortInstModel)
+admin.site.register(JobModel)
+admin.site.register(JobStatusModel)
+admin.site.register(DefPkgMappingModel)
+admin.site.register(InputParamMappingModel)
+admin.site.register(ServiceBaseInfoModel)
+admin.site.register(WFPlanModel)
+admin.site.register(SubscriptionModel)
+admin.site.register(NSLcmOpOccModel)
+admin.site.register(PNFInstModel)
diff --git a/lcm/settings.py b/lcm/settings.py
index 71e609b4..b5a5e15a 100644
--- a/lcm/settings.py
+++ b/lcm/settings.py
@@ -47,6 +47,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'django.contrib.admin',
'rest_framework',
'lcm.pub.database',
'lcm.swagger',
diff --git a/lcm/urls.py b/lcm/urls.py
index 4f2c5e70..67268ea7 100644
--- a/lcm/urls.py
+++ b/lcm/urls.py
@@ -13,12 +13,14 @@
# limitations under the License.
from django.conf.urls import include, url
+from django.contrib import admin
from lcm.pub.config.config import DEPLOY_WORKFLOW_WHEN_START
from lcm.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
urlpatterns = [
+ url(r'^api/nslcm/v1/admin', admin.site.urls),
url(r'^', include('lcm.samples.urls')),
url(r'^', include('lcm.ns_vnfs.urls')),
url(r'^', include('lcm.ns_pnfs.urls')),