- test_nsd["vld"][0]["vim-network-name"] = tmp
- del test_nsd["vld"][0]["ip-profile-ref"]
- with self.subTest(i=6, t='Check Input Validation: vld[vnfd-connection-point-ref][vnfd-id-ref]'):
- tmp = test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["vnfd-id-ref"]
- test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["vnfd-id-ref"] = "wrong-vnfd-id-ref"
- try:
- with self.assertRaises(EngineException, msg="Accepted VLD with wrong vnfd-connection-point-ref") as e:
- self.topic.upload_content(fake_session, did, test_nsd, {}, {"Content-Type": []})
- self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code")
- self.assertIn(norm("Error at vld[id='{}']:vnfd-connection-point-ref[vnfd-id-ref='{}']"
- " does not match constituent-vnfd[member-vnf-index='{}']:vnfd-id-ref '{}'"
- .format(test_nsd["vld"][0]["id"],
- test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["vnfd-id-ref"],
- test_nsd["constituent-vnfd"][0]["member-vnf-index"],
- test_nsd["constituent-vnfd"][0]["vnfd-id-ref"])),
- norm(str(e.exception)), "Wrong exception text")
- finally:
- test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["vnfd-id-ref"] = tmp
- with self.subTest(i=7, t='Check Input Validation: vld[vnfd-connection-point-ref][member-vnf-index-ref]'):
- tmp = test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["member-vnf-index-ref"]
- test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["member-vnf-index-ref"] = "wrong-member-vnf-index-ref"
- try:
- with self.assertRaises(EngineException, msg="Accepted VLD with wrong vnfd-connection-point-ref") as e:
- self.topic.upload_content(fake_session, did, test_nsd, {}, {"Content-Type": []})
- self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code")
- self.assertIn(norm("Error at vld[id='{}']:vnfd-connection-point-ref[member-vnf-index-ref='{}']"
- " does not match any constituent-vnfd:member-vnf-index"
- .format(test_nsd["vld"][0]["id"],
- test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["member-vnf-index-ref"])),
- norm(str(e.exception)), "Wrong exception text")
- finally:
- test_nsd["vld"][0]["vnfd-connection-point-ref"][0]["member-vnf-index-ref"] = tmp
- with self.subTest(i=8, t='Check Input Validation: vnffgd[classifier][rsp-id-ref]'):
- test_nsd["vnffgd"] = [{"id": "fake-vnffgd-id",
- "rsp": [{"id": "fake-rsp-id"}],
- "classifier": [{"id": "fake-vnffgd-classifier-id", "rsp-id-ref": "wrong-rsp-id"}]}]
- try:
- with self.assertRaises(EngineException, msg="Accepted VNF FGD with wrong classifier rsp-id-ref") as e:
- self.topic.upload_content(fake_session, did, test_nsd, {}, {"Content-Type": []})
- self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code")
- self.assertIn(norm("Error at vnffgd[id='{}']:classifier[id='{}']:rsp-id-ref '{}'"
- " does not match any rsp:id"
- .format(test_nsd["vnffgd"][0]["id"],
- test_nsd["vnffgd"][0]["classifier"][0]["id"],
- test_nsd["vnffgd"][0]["classifier"][0]["rsp-id-ref"])),
- norm(str(e.exception)), "Wrong exception text")
- finally:
- test_nsd["vnffgd"][0]["classifier"][0]["rsp-id-ref"] = "fake-rsp-id"
- with self.subTest(i=9, t='Check Descriptor Dependencies: constituent-vnfd[vnfd-id-ref]'):