self.users = {'1': "cirros", '2': "cirros"}
self.passwords = {'1': "cubswin:)", '2': "cubswin:)"}
+ def terminate(self, engine):
+ # Make a delete in one step, overriding the normal two step of TestDeploy that launched terminate and delete
+ if test_osm:
+ engine.test("Terminate and delete NS in one step", "DELETE", "/nslcm/v1/ns_instances_content/{}".
+ format(self.ns_id), headers_yaml, None, 202, None, "yaml")
+
+ engine .wait_until_delete("/nslcm/v1/ns_instances/{}".format(self.ns_id), timeout_deploy)
+ else:
+ engine.test("Delete NS with FORCE", "DELETE", "/nslcm/v1/ns_instances/{}?FORCE=True".format(self.ns_id),
+ headers_yaml, None, 204, None, 0)
+
+ # check all it is deleted
+ engine.test("Check NS is deleted", "GET", "/nslcm/v1/ns_instances/{}".format(self.ns_id), headers_yaml, None,
+ 404, None, "yaml")
+ r = engine.test("Check NSLCMOPs are deleted", "GET",
+ "/nslcm/v1/ns_lcm_op_occs?nsInstanceId={}".format(self.ns_id), headers_json, None,
+ 200, None, "json")
+ if not r:
+ return
+ nslcmops = r.json()
+ if not isinstance(nslcmops, list) or nslcmops:
+ raise TestException("NS {} deleted but with ns_lcm_op_occ active: {}".format(self.ns_id, nslcmops))
+
class TestDeployHackfest1(TestDeploy):
description = "Load and deploy Hackfest_1_vnfd example"
self.commands = {'1': ['ls -lrt', ], '2': ['ls -lrt', ]}
self.users = {'1': "ubuntu", '2': "ubuntu"}
self.passwords = {'1': "osm4u", '2': "osm4u"}
-
- def create_descriptors(self, engine):
- super().create_descriptors(engine)
# Modify VNFD to add scaling
- self.descriptor_edit = {
- "vnfd0": {
- 'vnf-configuration': {
- 'config-primitive': [{
- 'name': 'touch',
- 'parameter': [{
- 'name': 'filename',
- 'data-type': 'STRING',
- 'default-value': '/home/ubuntu/touched'
- }]
- }]
- },
- 'scaling-group-descriptor': [{
- 'name': 'scale_dataVM',
- 'scaling-policy': [{
- 'threshold-time': 0,
- 'name': 'auto_cpu_util_above_threshold',
- 'scaling-type': 'automatic',
- 'scaling-criteria': [{
- 'name': 'cpu_util_above_threshold',
- 'vnf-monitoring-param-ref': 'all_aaa_cpu_util',
- 'scale-out-relational-operation': 'GE',
- 'scale-in-threshold': 15,
- 'scale-out-threshold': 60,
- 'scale-in-relational-operation': 'LE'
- }],
- 'cooldown-time': 60
- }],
- 'max-instance-count': 10,
- 'scaling-config-action': [
- {'vnf-config-primitive-name-ref': 'touch',
- 'trigger': 'post-scale-out'},
- {'vnf-config-primitive-name-ref': 'touch',
- 'trigger': 'pre-scale-in'}
- ],
- 'vdu': [{
- 'vdu-id-ref': 'dataVM',
- 'count': 1
- }]
- }]
- }
- }
+ # self.descriptor_edit = {
+ # "vnfd0": {
+ # 'vnf-configuration': {
+ # 'config-primitive': [{
+ # 'name': 'touch',
+ # 'parameter': [{
+ # 'name': 'filename',
+ # 'data-type': 'STRING',
+ # 'default-value': '/home/ubuntu/touched'
+ # }]
+ # }]
+ # },
+ # 'scaling-group-descriptor': [{
+ # 'name': 'scale_dataVM',
+ # 'scaling-policy': [{
+ # 'threshold-time': 0,
+ # 'name': 'auto_cpu_util_above_threshold',
+ # 'scaling-type': 'automatic',
+ # 'scaling-criteria': [{
+ # 'name': 'cpu_util_above_threshold',
+ # 'vnf-monitoring-param-ref': 'all_aaa_cpu_util',
+ # 'scale-out-relational-operation': 'GE',
+ # 'scale-in-threshold': 15,
+ # 'scale-out-threshold': 60,
+ # 'scale-in-relational-operation': 'LE'
+ # }],
+ # 'cooldown-time': 60
+ # }],
+ # 'max-instance-count': 10,
+ # 'scaling-config-action': [
+ # {'vnf-config-primitive-name-ref': 'touch',
+ # 'trigger': 'post-scale-out'},
+ # {'vnf-config-primitive-name-ref': 'touch',
+ # 'trigger': 'pre-scale-in'}
+ # ],
+ # 'vdu': [{
+ # 'vdu-id-ref': 'dataVM',
+ # 'count': 1
+ # }]
+ # }]
+ # }
+ # }
class TestDeployHackfest3Charmed(TestDeploy):
def __init__(self):
super().__init__()
self.test_name = "HACKFEST3v3-"
- self.commands = {'1': ['ls -lrt /home/ubuntu/first-touch-1'], '2': ['ls -lrt /home/ubuntu/first-touch-1']}
+ self.commands = {'1': ['ls -lrt /home/ubuntu/first-touch-1'], '2': ['ls -lrt /home/ubuntu/first-touch-2']}
self.descriptor_edit = {
"vnfd0": yaml.load(
"""
parameter:
"$[0]":
value: "<touch-filename>" # default-value: /home/ubuntu/first-touch
- # config-primitive:
- # "$[0]":
- # parameter:
- # "$[0]":
- # default-value: "<touch-filename2>"
+ config-primitive:
+ "$[0]":
+ parameter:
+ "$[0]":
+ default-value: "<touch-filename2>"
""")
}
self.ns_params = {
"additionalParamsForVnf": [
{"member-vnf-index": "1", "additionalParams": {"touch-filename": "/home/ubuntu/first-touch-1",
- "touch-filename2": "/home/ubuntu/second-touch-2"}},
- {"member-vnf-index": "2", "additionalParams": {"touch-filename": "/home/ubuntu/first-touch-1",
+ "touch-filename2": "/home/ubuntu/second-touch-1"}},
+ {"member-vnf-index": "2", "additionalParams": {"touch-filename": "/home/ubuntu/first-touch-2",
"touch-filename2": "/home/ubuntu/second-touch-2"}},
]
}
nslcmop2_scale_out = engine.last_id
engine.wait_operation_ready("ns", nslcmop2_scale_out, timeout_deploy)
if manual_check:
- input('NS scale out done. Check that file /home/ubuntu/touched is present and new VM is created')
+ input('NS scale out done. Check that file /home/ubuntu/second-touch-1 is present and new VM is created')
if test_osm:
- commands = {'1': ['ls -lrt /home/ubuntu/touched', ]}
+ commands = {'1': ['ls -lrt /home/ubuntu/second-touch-1', ]}
self.test_ns(engine, test_osm, commands=commands)
# TODO check automatic connection to scaled VM
nslcmop2_scale_in = engine.last_id
engine.wait_operation_ready("ns", nslcmop2_scale_in, timeout_deploy)
if manual_check:
- input('NS scale in done. Check that file /home/ubuntu/touched is updated and new VM is deleted')
+ input('NS scale in done. Check that file /home/ubuntu/second-touch-1 is updated and new VM is deleted')
# TODO check automatic
queries = ["mgmt-interface.cp=mgmt", "vdu.0.interface.0.external-connection-point-ref=mgmt",
"vdu.0.interface.1.internal-connection-point-ref=internal",
- "internal-vld.0.internal-connection-point.0.id-ref=internal"]
+ "internal-vld.0.internal-connection-point.0.id-ref=internal",
+ # Detection of duplicated VLD names in VNF Descriptors
+ # URL: internal-vld=[
+ # {id: internal1, name: internal, type:ELAN,
+ # internal-connection-point: [{id-ref: mgmtVM-internal}, {id-ref: dataVM-internal}]},
+ # {id: internal2, name: internal, type:ELAN,
+ # internal-connection-point: [{id-ref: mgmtVM-internal}, {id-ref: dataVM-internal}]}
+ # ]
+ "internal-vld=%5B%7Bid%3A%20internal1%2C%20name%3A%20internal%2C%20type%3A%20ELAN%2C%20"
+ "internal-connection-point%3A%20%5B%7Bid-ref%3A%20mgmtVM-internal%7D%2C%20%7Bid-ref%3A%20"
+ "dataVM-internal%7D%5D%7D%2C%20%7Bid%3A%20internal2%2C%20name%3A%20internal%2C%20type%3A%20"
+ "ELAN%2C%20internal-connection-point%3A%20%5B%7Bid-ref%3A%20mgmtVM-internal%7D%2C%20%7B"
+ "id-ref%3A%20dataVM-internal%7D%5D%7D%5D"
+ ]
for query in queries:
engine.test("Upload invalid VNFD ", "PUT",
"/vnfpkgm/v1/vnf_packages/{}/package_content?{}".format(self.vnfd_id, query),