Add vnflcm admin db management 73/86473/2 1.3.0
authorfujinhua <fu.jinhua@zte.com.cn>
Sun, 28 Apr 2019 09:24:19 +0000 (17:24 +0800)
committerfujinhua <fu.jinhua@zte.com.cn>
Sun, 28 Apr 2019 09:30:47 +0000 (17:30 +0800)
Change-Id: I5c56702f61a48605d05a21be9a44a4c8bf58dc50
Issue-ID: VFC-1306
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
lcm/lcm/pub/database/admin.py [new file with mode: 0644]
lcm/lcm/settings.py
lcm/lcm/urls.py

diff --git a/lcm/lcm/pub/database/admin.py b/lcm/lcm/pub/database/admin.py
new file mode 100644 (file)
index 0000000..c306d99
--- /dev/null
@@ -0,0 +1,263 @@
+# 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 NfInstModel
+from lcm.pub.database.models import NfvoRegInfoModel
+from lcm.pub.database.models import StorageInstModel
+from lcm.pub.database.models import VmInstModel
+from lcm.pub.database.models import VNFCInstModel
+from lcm.pub.database.models import FlavourInstModel
+from lcm.pub.database.models import NetworkInstModel
+from lcm.pub.database.models import SubNetworkInstModel
+from lcm.pub.database.models import VLInstModel
+from lcm.pub.database.models import PortInstModel
+from lcm.pub.database.models import CPInstModel
+from lcm.pub.database.models import SubscriptionModel
+from lcm.pub.database.models import VNFLcmOpOccModel
+
+
+@admin.register(NfInstModel)
+class NfInstModelAdmin(admin.ModelAdmin):
+    list_display_links = ('nfinstid', 'nf_name')
+    fields = [
+        "nfinstid",
+        "nf_name",
+        "vnfminstid",
+        "package_id",
+        "status",
+        "flavour_id",
+        "location",
+        "version",
+        "vendor",
+        "netype",
+        "vnfd_model",
+        "input_params",
+        "create_time",
+        "lastuptime",
+        "nf_desc",
+        "vnfdid",
+        "vnfSoftwareVersion",
+        "vnfConfigurableProperties",
+        "localizationLanguage",
+        "operationState",
+        "resInfo",
+        "vimInfo"
+    ]
+
+    list_display = [
+        "nfinstid",
+        "nf_name",
+        "vnfminstid",
+        "package_id",
+        "status",
+        "flavour_id",
+        "location",
+        "version",
+        "vendor",
+        "netype",
+        "vnfd_model",
+        "input_params",
+        "create_time",
+        "lastuptime",
+        "nf_desc",
+        "vnfdid",
+        "vnfSoftwareVersion",
+        "vnfConfigurableProperties",
+        "localizationLanguage",
+        "operationState",
+        "resInfo",
+        "vimInfo"
+    ]
+
+    search_fields = (
+        "nfinstid",
+        "nf_name",
+        "vnfminstid",
+        "package_id"
+    )
+
+
+@admin.register(NfvoRegInfoModel)
+class NfvoRegInfoModelAdmin(admin.ModelAdmin):
+    list_display_links = ('nfvoid', 'vnfminstid')
+    fields = [
+        "nfvoid",
+        "vnfminstid",
+        "apiurl",
+        "nfvouser",
+        "nfvopassword",
+        "authtype",
+        "clientcert",
+        "servercert",
+        "regtime"
+    ]
+
+    list_display = (
+        "nfvoid",
+        "vnfminstid",
+        "apiurl",
+        "nfvouser",
+        "nfvopassword",
+        "authtype",
+        "clientcert",
+        "servercert",
+        "regtime"
+    )
+
+    search_fields = (
+        "nfvoid",
+        "vnfminstid"
+    )
+
+
+@admin.register(StorageInstModel)
+class StorageInstModelAdmin(admin.ModelAdmin):
+    list_display_links = ('storageid', 'vimid')
+    fields = [
+        "storageid",
+        "vimid",
+        "resourceid",
+        "insttype",
+        "instid",
+        "name",
+        "storagetype",
+        "size",
+        "tenant",
+        "is_predefined",
+        "create_time",
+        "nodeId"
+    ]
+
+    list_display = (
+        "storageid",
+        "vimid",
+        "resourceid",
+        "insttype",
+        "instid",
+        "name",
+        "storagetype",
+        "size",
+        "tenant",
+        "is_predefined",
+        "create_time",
+        "nodeId"
+    )
+
+    search_fields = (
+        "storageid",
+        "vimid",
+        "resourceid",
+        "instid"
+    )
+
+
+@admin.register(VmInstModel)
+class VmInstModelAdmin(admin.ModelAdmin):
+    list_display_links = ('vmid', 'vimid')
+    fields = [
+        "vmid",
+        "vimid",
+        "tenant",
+        "resourceid",
+        "vmname",
+        "nic_array",
+        "metadata",
+        "volume_array",
+        "server_group",
+        "availability_zone",
+        "flavor_id",
+        "security_groups",
+        "operationalstate",
+        "insttype",
+        "is_predefined",
+        "create_time",
+        "instid",
+        "nodeId"
+    ]
+
+    list_display = [
+        "vmid",
+        "vimid",
+        "tenant",
+        "resourceid",
+        "vmname",
+        "nic_array",
+        "metadata",
+        "volume_array",
+        "server_group",
+        "availability_zone",
+        "flavor_id",
+        "security_groups",
+        "operationalstate",
+        "insttype",
+        "is_predefined",
+        "create_time",
+        "instid",
+        "nodeId"
+    ]
+
+    search_fields = (
+        "vmid",
+        "vimid",
+        "tenant",
+        "resourceid",
+        "vmname"
+    )
+
+
+@admin.register(VNFLcmOpOccModel)
+class VNFLcmOpOccModelAdmin(admin.ModelAdmin):
+    list_display_links = ('id', 'operation_state')
+    fields = [
+        "id",
+        "operation_state",
+        "state_entered_time",
+        "start_time",
+        "vnf_instance_id",
+        "operation",
+        "error",
+        "sub_operation",
+        "operation_params",
+        "links"
+    ]
+
+    list_display = [
+        "id",
+        "operation_state",
+        "state_entered_time",
+        "start_time",
+        "vnf_instance_id",
+        "operation",
+        "error",
+        "sub_operation",
+        "operation_params",
+        "links"
+    ]
+
+    search_fields = (
+        "id",
+        "vnf_instance_id"
+    )
+
+
+admin.site.register(VNFCInstModel)
+admin.site.register(FlavourInstModel)
+admin.site.register(NetworkInstModel)
+admin.site.register(SubNetworkInstModel)
+admin.site.register(VLInstModel)
+admin.site.register(PortInstModel)
+admin.site.register(CPInstModel)
+admin.site.register(SubscriptionModel)
index 58473a2..4c235c3 100644 (file)
@@ -46,6 +46,7 @@ INSTALLED_APPS = [
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'django.contrib.admin',
     'rest_framework',
     'lcm.pub.database',
     'lcm.samples',
index ea213ad..438c943 100644 (file)
 # limitations under the License.
 
 from django.conf.urls import include, url
+from django.contrib import admin
+
 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/vnflcm/v1/admin', admin.site.urls),
     url(r'^', include('lcm.samples.urls')),
     url(r'^', include('lcm.nf.urls')),
     # url(r'^', include('lcm.v2.urls')),