+ def test_update_remove_vnf(self):
+ vnfr_id = self.db.get_list("vnfrs")[0]["_id"]
+ session = {}
+ self.db.set_one(
+ "nsrs",
+ {"_id": self.nsr_id},
+ {"_admin.nsState": "INSTANTIATED"},
+ )
+ indata = {
+ "lcmOperationType": "update",
+ "updateType": "REMOVE_VNF",
+ "nsInstanceId": self.nsr_id,
+ "removeVnfInstanceId": vnfr_id
+ }
+
+ session = {
+ "force": False,
+ "admin": False,
+ "public": False,
+ "project_id": [self.nsr_project],
+ "method": "write",
+ }
+ rollback = []
+ headers = {}
+
+ nslcmop_id, _ = self.nslcmop_topic.new(
+ rollback, session, indata, kwargs=None, headers=headers
+ )
+
+ self.assertEqual(
+ self.db.create.call_count,
+ 1,
+ "database create not called, or called more than once",
+ )
+ _call = self.db.create.call_args_list[0]
+ self.assertEqual(
+ _call[0][0], "nslcmops", "nslcmops entry must be created at database"
+ )
+ created_nslcmop = _call[0][1]
+ self.assertEqual(
+ self.nsr_id,
+ created_nslcmop["nsInstanceId"],
+ "mismatch between nsId '_id' in created nslcmop and database nsr",
+ )
+ self.assertTrue(
+ created_nslcmop["lcmOperationType"] == "update",
+ "Database record must contain 'lcmOperationType=update'",
+ )
+ self.assertTrue(
+ created_nslcmop["operationParams"]["updateType"] == "REMOVE_VNF",
+ "Database record must contain 'updateType=REMOVE_VNF'",
+ )
+