self.assertEqual(db_args[1]["_admin"]["projects_read"], [test_pid], "Wrong read-only project list")
self.assertEqual(db_args[1]["_admin"]["projects_write"], [test_pid], "Wrong read-write project list")
tmp1 = test_vnfd["vdu"][0]["cloud-init-file"]
- tmp2 = test_vnfd["vnf-configuration"][0]["juju"]
+ tmp2 = test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"]
del test_vnfd["vdu"][0]["cloud-init-file"]
- del test_vnfd["vnf-configuration"][0]["juju"]
+ del test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"]
try:
self.db.get_one.side_effect = [{"_id": did, "_admin": deepcopy(db_vnfd_content["_admin"])}, None]
self.topic.upload_content(fake_session, did, test_vnfd, {}, {"Content-Type": []})
compare_desc(self, test_vnfd, db_args[2], "VNFD")
finally:
test_vnfd["vdu"][0]["cloud-init-file"] = tmp1
- test_vnfd["vnf-configuration"][0]["juju"] = tmp2
+ test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"] = tmp2
self.db.get_one.side_effect = lambda table, filter, fail_on_empty=None, fail_on_more=None: \
{"_id": did, "_admin": deepcopy(db_vnfd_content["_admin"])}
with self.subTest(i=2, t='Check Pyangbind Validation: additional properties'):
self.assertIn(norm("{} defined in vnf[id={}]:vdu[id={}] but not present in package"
.format("cloud-init", test_vnfd["id"], test_vnfd["vdu"][0]["id"])),
norm(str(e.exception)), "Wrong exception text")
- with self.subTest(i=5, t='Check Input Validation: vnf-configuration[juju]'):
+ with self.subTest(i=5, t='Check Input Validation: day1-2 configuration[juju]'):
del test_vnfd["vdu"][0]["cloud-init-file"]
with self.assertRaises(EngineException, msg="Accepted non-existent charm in VNF configuration") as e:
self.topic.upload_content(fake_session, did, test_vnfd, {}, {"Content-Type": []})
self.assertEqual(e.exception.http_code, HTTPStatus.BAD_REQUEST, "Wrong HTTP status code")
self.assertIn(norm("{} defined in vnf[id={}] but not present in package".format("charm", test_vnfd["id"])),
norm(str(e.exception)), "Wrong exception text")
- del test_vnfd["vnf-configuration"][0]["juju"]
+ del test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"]
with self.subTest(i=6, t='Check Input Validation: mgmt-cp'):
tmp = test_vnfd["mgmt-cp"]
del test_vnfd["mgmt-cp"]
vdu['monitoring-parameter'] = tmp
with self.subTest(i=13, t='Check Input Validation: scaling-aspect vnf-configuration'):
df = test_vnfd['df'][0]
- tmp = test_vnfd.pop('vnf-configuration')
+ tmp = test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"].pop()
try:
with self.assertRaises(EngineException, msg="Accepted non-existent Scaling Group VDU ID Reference") \
as e:
self.topic.upload_content(fake_session, did, test_vnfd, {}, {"Content-Type": []})
self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code")
- self.assertIn(norm("'vnf-configuration' not defined in the descriptor but it is referenced "
+ self.assertIn(norm("'day1-2 configuration' not defined in the descriptor but it is referenced "
"by df[id='{}']:scaling-aspect[id='{}']:scaling-config-action"
.format(df["id"], df['scaling-aspect'][0]["id"])),
norm(str(e.exception)), "Wrong exception text")
finally:
- test_vnfd["vnf-configuration"] = tmp
+ test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"].append(tmp)
with self.subTest(i=14, t='Check Input Validation: scaling-config-action'):
df = test_vnfd['df'][0]
- tmp = test_vnfd['vnf-configuration'][0]['config-primitive']
- test_vnfd['vnf-configuration'][0]['config-primitive'] = [{'name': 'wrong-primitive'}]
+ tmp = test_vnfd["df"][0].get(
+ "lcm-operations-configuration"
+ ).get(
+ "operate-vnf-op-config"
+ )["day1-2"][0]['config-primitive']
+ test_vnfd["df"][0].get(
+ "lcm-operations-configuration"
+ ).get(
+ "operate-vnf-op-config"
+ )["day1-2"][0]['config-primitive'] = [{'name': 'wrong-primitive'}]
try:
with self.assertRaises(EngineException,
msg="Accepted non-existent Scaling Group VDU ID Reference") as e:
self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code")
self.assertIn(norm("df[id='{}']:scaling-aspect[id='{}']:scaling-config-action:vnf-"
"config-primitive-name-ref='{}' does not match any "
- "vnf-configuration:config-primitive:name"
+ "day1-2 configuration:config-primitive:name"
.format(df["id"], df['scaling-aspect'][0]["id"],
sa['scaling-config-action'][0]['vnf-config-primitive-name-ref'])),
norm(str(e.exception)), "Wrong exception text")
finally:
- test_vnfd['vnf-configuration'][0]['config-primitive'] = tmp
+ test_vnfd["df"][0].get(
+ "lcm-operations-configuration"
+ ).get(
+ "operate-vnf-op-config"
+ )["day1-2"][0]['config-primitive'] = tmp
with self.subTest(i=15, t='Check Input Validation: everything right'):
test_vnfd["id"] = "fake-vnfd-id"
+ test_vnfd["df"][0].get(
+ "lcm-operations-configuration"
+ ).get(
+ "operate-vnf-op-config"
+ )["day1-2"][0]["id"] = "fake-vnfd-id"
self.db.get_one.side_effect = [{"_id": did, "_admin": deepcopy(db_vnfd_content["_admin"])}, None]
rc = self.topic.upload_content(fake_session, did, test_vnfd, {}, {"Content-Type": []})
self.assertTrue(rc, "Input Validation: Unexpected failure")
with self.subTest(i=1, t='Normal Edition'):
now = time()
self.db.get_one.side_effect = [deepcopy(vnfd_content), None]
- data = {"id": "new-vnfd-id", "product-name": "new-vnfd-name"}
+ data = {
+ "product-name": "new-vnfd-name"
+ }
self.topic.edit(fake_session, did, data)
db_args = self.db.replace.call_args[0]
msg_args = self.msg.write.call_args[0]
"Wrong read-only project list")
self.assertEqual(db_args[2]["_admin"]["projects_write"], vnfd_content["_admin"]["projects_write"],
"Wrong read-write project list")
- self.assertEqual(db_args[2]["id"], data["id"], "Wrong VNFD ID")
self.assertEqual(db_args[2]["product-name"], data["product-name"], "Wrong VNFD Name")
with self.subTest(i=2, t='Conflict on Edit'):
- data = {"id": "fake-vnfd-id", "product-name": "new-vnfd-name"}
+ data = {"id": "hackfest3charmed-vnf", "product-name": "new-vnfd-name"}
self.db.get_one.side_effect = [deepcopy(vnfd_content), {"_id": str(uuid4()), "id": data["id"]}]
with self.assertRaises(EngineException, msg="Accepted existing VNFD ID") as e:
self.topic.edit(fake_session, did, data)
indata = deepcopy(db_vnfd_content)
df = indata['df'][0]
affected_sa = df['scaling-aspect'][0]
- indata.pop('vnf-configuration')
+ indata["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"].pop()
with self.assertRaises(EngineException) as e:
self.topic.validate_scaling_group_descriptor(indata)
self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code")
- self.assertIn(norm("'vnf-configuration' not defined in the descriptor but it is referenced "
+ self.assertIn(norm("'day1-2 configuration' not defined in the descriptor but it is referenced "
"by df[id='{}']:scaling-aspect[id='{}']:scaling-config-action"
.format(df["id"], affected_sa["id"])),
norm(str(e.exception)), "Wrong exception text")
df = indata['df'][0]
affected_sa = df['scaling-aspect'][0]
affected_sca_primitive = affected_sa['scaling-config-action'][0]['vnf-config-primitive-name-ref']
- indata['vnf-configuration'][0]['config-primitive'] = []
+ df["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]['config-primitive'] = []
with self.assertRaises(EngineException) as e:
self.topic.validate_scaling_group_descriptor(indata)
self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code")
self.assertIn(norm("df[id='{}']:scaling-aspect[id='{}']:scaling-config-action:vnf-"
"config-primitive-name-ref='{}' does not match any "
- "vnf-configuration:config-primitive:name"
+ "day1-2 configuration:config-primitive:name"
.format(df["id"], affected_sa["id"], affected_sca_primitive)),
norm(str(e.exception)), "Wrong exception text")