summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog/packages/tests/test_nf.py17
-rw-r--r--catalog/pub/database/models.py1
2 files changed, 18 insertions, 0 deletions
diff --git a/catalog/packages/tests/test_nf.py b/catalog/packages/tests/test_nf.py
index d4a8b506..576c956c 100644
--- a/catalog/packages/tests/test_nf.py
+++ b/catalog/packages/tests/test_nf.py
@@ -418,3 +418,20 @@ class TestNfPackage(TestCase):
mock_urlopen.return_value = MockReq()
vnfPkgId = "222"
VnfpkgUploadThread(req_data, vnfPkgId).run()
+
+ def test_create_vnf_pkg(self):
+ req_data = {
+ "userDefinedData": {"a": "A"}
+ }
+ response = self.client.post("/api/vnfpkgm/v1/vnf_packages", data=req_data, format="json")
+ resp_data = json.loads(response.content)
+ expect_resp_data = {
+ "id": resp_data.get("id"),
+ "onboardingState": "CREATED",
+ "operationalState": "DISABLED",
+ "usageState": "NOT_IN_USE",
+ "userDefinedData": {"a": "A"},
+ "_links": None # TODO
+ }
+ self.assertEqual(expect_resp_data, resp_data)
+ self.assertEqual(response.status_code, status.HTTP_201_CREATED)
diff --git a/catalog/pub/database/models.py b/catalog/pub/database/models.py
index 858c48d6..3094b2b6 100644
--- a/catalog/pub/database/models.py
+++ b/catalog/pub/database/models.py
@@ -20,6 +20,7 @@ class NSPackageModel(models.Model):
nsPackageUri = models.CharField(db_column='NSPACKAGEURI', max_length=300, null=True, blank=True)
checksum = models.CharField(db_column='CHECKSUM', max_length=50, null=True, blank=True) # checksum
sdcCsarId = models.CharField(db_column='SDCCSARID', max_length=50, null=True, blank=True) # SdcCSARUri
+ onboardingState = models.CharField(db_column='ONBOARDINGSTATE', max_length=20, blank=True, null=True)
operationalState = models.CharField(db_column='OPERATIONALSTATE', max_length=20, blank=True, null=True) # operationalState
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