summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbiancunkang <bian.cunkang@zte.com.cn>2018-08-16 09:01:28 +0800
committerbiancunkang <bian.cunkang@zte.com.cn>2018-08-16 09:01:28 +0800
commit1e4ba0f074a64476adee70866fcf8f5dd7bfdc80 (patch)
tree2175b55ce8dbba60db90e4a0eb66c87fbd337e3c
parenta1da922e202270ee42e7216aa351f8e4d6729c38 (diff)
Add a test in Grand
Change-Id: I17020da4555a77fe59914ab1573a6d5ee7fd86bc Issue-ID: VFC-1015 Signed-off-by: biancunkang <bian.cunkang@zte.com.cn>
-rw-r--r--lcm/v2/tests.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/lcm/v2/tests.py b/lcm/v2/tests.py
index 996852f1..d665a1e4 100644
--- a/lcm/v2/tests.py
+++ b/lcm/v2/tests.py
@@ -110,6 +110,63 @@ class VnfGrantViewTest(unittest.TestCase):
}
self.assertEqual(expect_resp_data, resp_data)
+ def test_grant_vnf_when_vnfinst_not_exist(self):
+ data = {
+ "vnfInstanceId": "1",
+ "vnfLcmOpOccId": "2",
+ "vnfdId": "3",
+ "flavourId": "4",
+ "operation": "INSTANTIATE",
+ "isAutomaticInvocation": True,
+ "instantiationLevelId": "5",
+ "addResources": [
+ {
+ "id": "1",
+ "type": "COMPUTE",
+ "vduId": "2",
+ "resourceTemplateId": "3",
+ }
+ ],
+ "placementConstraints": [
+ {
+ "affinityOrAntiAffinity": "AFFINITY",
+ "scope": "NFVI_POP",
+ "resource": [
+ {
+ "idType": "RES_MGMT",
+ "resourceId": "1",
+ "vimConnectionId": "2",
+ "resourceProviderId": "3"
+ }
+ ]
+ }
+ ],
+ "vimConstraints": [
+ {
+ "sameResourceGroup": True,
+ "resource": [
+ {
+ "idType": "RES_MGMT",
+ "resourceId": "1",
+ "vimConnectionId": "2",
+ "resourceProviderId": "3"
+ }
+ ]
+ }
+ ],
+ "additionalParams": {},
+ "_links": {
+ "vnfLcmOpOcc": {
+ "href": "1"
+ },
+ "vnfInstance": {
+ "href": "2"
+ }
+ }
+ }
+ response = self.client.post("/api/nslcm/v2/grants", data=data, format='json')
+ self.failUnlessEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code)
+
def test_get_notify_vnf_normal(self):
response = self.client.get("/api/nslcm/v2/ns/1/vnfs/1/Notify")
self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code, response.content)