+++ /dev/null
-# Copyright 2017 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.
-
-import os
-
-from django.test import TestCase
-from rest_framework import status
-from rest_framework.test import APIClient
-
-
-class TestPnfDescriptor(TestCase):
- def setUp(self):
- self.client = APIClient()
-
- def tearDown(self):
- pass
-
- def test_pnfd_create_normal(self):
- reqest_data = {
- 'userDefinedData': {
- 'key1': 'value1',
- 'key2': 'value2',
- 'key3': 'value3',
- }
- }
- expected_reponse_data = {
- 'pnfdOnboardingState': 'CREATED',
- 'pnfdUsageState': 'NOT_IN_USE',
- 'userDefinedData': {
- 'key1': 'value1',
- 'key2': 'value2',
- 'key3': 'value3',
- },
- '_links': None
- }
- response = self.client.post(
- '/api/nsd/v1/pnf_descriptors',
- data=reqest_data,
- format='json'
- )
- response.data.pop('id')
- self.assertEqual(response.status_code, status.HTTP_201_CREATED)
- self.assertEqual(expected_reponse_data, response.data)
-
- def test_pnfd_content_upload_normal(self):
- with open('pnfd_content.txt', 'wb') as fp:
- fp.write('test')
-
- with open('pnfd_content.txt', 'rb') as fp:
- resp = self.client.put(
- "/api/nsd/v1/pnf_descriptors/22/pnfd_content",
- {'file': fp},
- )
- self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)
- self.assertEqual({}, resp.data)
-
- os.remove('pnfd_content.txt')
-
- def test_pnfd_content_upload_failure(self):
- pass
db_table = 'CATALOG_VNFPACKAGE'
+class PnfPackageModel(models.Model):
+ # uuid = models.CharField(db_column='UUID', primary_key=True, max_length=255)
+ pnfPackageId = models.CharField(db_column='PNFPACKAGEID', primary_key=True, max_length=50) # onboardedPnfPkgInfoId
+ pnfPackageUri = models.CharField(db_column='PNFPACKAGEURI', max_length=300, null=True, blank=True) # downloadUri
+ SdcCSARUri = models.CharField(db_column='SDCCSARURI', max_length=300, null=True, blank=True) # SdcCSARUri
+ checksum = models.CharField(db_column='CHECKSUM', max_length=50, null=True, blank=True) # checksum
+ onboardingState = models.CharField(db_column='ONBOARDINGSTATE', max_length=20, blank=True, null=True)
+ usageState = models.CharField(db_column='USAGESTATE', max_length=20, blank=True, null=True) # usageState
+ deletionPending = models.CharField(db_column='DELETIONPENDING', max_length=20, blank=True, null=True) # deletionPending
+ pnfdId = models.CharField(db_column='PNFDID', max_length=50, blank=True, null=True) # pnfdId
+ pnfVendor = models.CharField(db_column='VENDOR', max_length=50, blank=True, null=True) # pnfProvider
+ pnfdProductName = models.CharField(db_column='PNFDPRODUCTNAME', max_length=50, blank=True, null=True) # pnfProductName
+ pnfdVersion = models.CharField(db_column='PNFDVERSION', max_length=20, blank=True, null=True) # pnfdVersion
+ pnfSoftwareVersion = models.CharField(db_column='PNFSOFTWAREVERSION', max_length=20, blank=True, null=True) # pnfSoftwareVersion
+ userDefinedData = models.TextField(db_column='USERDEFINEDDATA', max_length=1024, blank=True, null=True) # userDefinedData
+ localFilePath = models.CharField(db_column='LOCALFILEPATH', max_length=300, null=True, blank=True)
+ pnfdModel = models.TextField(db_column='PNFDMODEL', max_length=65535, blank=True, null=True) # pnfd
+
+ class Meta:
+ db_table = 'CATALOG_PNFPACKAGE'
+
+
class SoftwareImageModel(models.Model):
imageid = models.CharField(db_column='IMAGEID', primary_key=True, max_length=50)
containerFormat = models.CharField(db_column='CONTAINERFORMAT', max_length=20)