Merge "FT of heal/chg_ext_conn v2 APIs"

This commit is contained in:
Zuul 2022-03-11 04:27:41 +00:00 committed by Gerrit Code Review
commit 30b6f74c64
10 changed files with 2340 additions and 82 deletions

View File

@ -126,6 +126,22 @@ class HeatClient(object):
[None], ["DELETE_IN_PROGRESS", "DELETE_COMPLETE"],
["DELETE_FAILED"])
def get_stack_resource(self, stack_name):
path = f"stacks/{stack_name}"
resp, body = self.client.do_request(path, "GET",
expected_status=[200, 404])
if resp.status_code == 404:
raise sol_ex.StackOperationFailed
return body
def get_resource_info(self, stack_name, stack_id, resource_name):
path = f"stacks/{stack_name}/{stack_id}/resources/{resource_name}"
resp, body = self.client.do_request(path, "GET",
expected_status=[200, 404])
if resp.status_code == 404:
return resp, None
return resp, body['resource']
def get_parameters(self, stack_name):
path = "stacks/{}".format(stack_name)
resp, body = self.client.do_request(path, "GET",

View File

@ -318,6 +318,16 @@ class BaseSolV2Test(base.BaseTestCase):
return self.tacker_client.do_request(
path, "PATCH", body=req_body, version="2.0.0")
def heal_vnf_instance(self, inst_id, req_body):
path = f"/vnflcm/v2/vnf_instances/{inst_id}/heal"
return self.tacker_client.do_request(
path, "POST", body=req_body, version="2.0.0")
def change_ext_conn(self, inst_id, req_body):
path = f"/vnflcm/v2/vnf_instances/{inst_id}/change_ext_conn"
return self.tacker_client.do_request(
path, "POST", body=req_body, version="2.0.0")
def terminate_vnf_instance(self, inst_id, req_body):
path = "/vnflcm/v2/vnf_instances/{}/terminate".format(inst_id)
return self.tacker_client.do_request(

View File

@ -531,7 +531,7 @@ def scalein_vnf_min():
}
def update_vnf_max(vnfd_id, vnfc_id_1, vnfc_id_2):
def update_vnf_max(vnfd_id, vnfc_ids):
# All attributes are set.
# NOTE: All of the following cardinality attributes are set.
# In addition, 0..N or 1..N attributes are set to 2 or more.
@ -568,14 +568,10 @@ def update_vnf_max(vnfd_id, vnfc_id_1, vnfc_id_2):
},
"vnfcInfoModifications": [
{
"id": vnfc_id_1,
"vnfcConfigurableProperties": {"dummy-key": "dummy-value"}
},
{
"id": vnfc_id_2,
"vnfcConfigurableProperties": {"dummy-key": "dummy-value"}
}
]
"id": id,
"vnfcConfigurableProperties": {
"dummy-key": "dummy-value"
}} for id in vnfc_ids]
}
@ -597,3 +593,239 @@ def update_vnf_min_with_parameter(vnfd_id):
return {
"vnfdId": vnfd_id
}
def heal_vnf_vnfc_max(vnfc_id):
# All attributes are set.
# NOTE: All of the following cardinality attributes are set.
# In addition, 0..N or 1..N attributes are set to 2 or more.
# - 0..1 (1)
# - 0..N (2 or more)
# - 1
# - 1..N (2 or more)
return {
"cause": "ManualHealing",
"vnfcInstanceId": [vnfc_id],
"additionalParams": {"dummy-key": "dummy-val"}
}
# The input parameter is_all is bool type, which accepts only True or False.
def heal_vnf_vnfc_max_with_parameter(vnfc_ids, is_all=None):
# All attributes are set.
# NOTE: All of the following cardinality attributes are set.
# In addition, 0..N or 1..N attributes are set to 2 or more.
# - 0..1 (1)
# - 0..N (2 or more)
# - 1
# - 1..N (2 or more)
if is_all is not None:
key = "all"
value = is_all
else:
key = "dummy-key"
value = "dummy-val"
return {
"cause": "ManualHealing",
"vnfcInstanceId": [vnfc_id for vnfc_id in vnfc_ids],
"additionalParams": {key: value}
}
# The input parameter is_all is bool type, which accepts only True or False.
def heal_vnf_all_max_with_parameter(is_all=None):
# All attributes are set.
# NOTE: All of the following cardinality attributes are set.
# In addition, 0..N or 1..N attributes are set to 2 or more.
# - 0..1 (1)
# - 0..N (2 or more)
# - 1
# - 1..N (2 or more)
if is_all is not None:
key = "all"
value = is_all
else:
key = "dummy-key"
value = "dummy-val"
return {
"cause": "ManualHealing",
"additionalParams": {key: value}
}
def heal_vnf_vnfc_min(vnfd_id):
# Omit except for required attributes
# NOTE: Only the following cardinality attributes are set.
# - 1
# - 1..N (1)
return {
"vnfcInstanceId": [vnfd_id]
}
def heal_vnf_all_min():
# Omit except for required attributes
# NOTE: Only the following cardinality attributes are set.
# - 1
# - 1..N (1)
return {}
def change_ext_conn_max(net_ids, subnets, auth_url):
# All attributes are set.
# NOTE: All of the following cardinality attributes are set.
# In addition, 0..N or 1..N attributes are set to 2 or more.
# - 0..1 (1)
# - 0..N (2 or more)
# - 1
# - 1..N (2 or more)
vim_id_1 = uuidutils.generate_uuid()
vim_id_2 = uuidutils.generate_uuid()
ext_vl_1 = {
"id": uuidutils.generate_uuid(),
"vimConnectionId": vim_id_1,
"resourceProviderId": uuidutils.generate_uuid(),
"resourceId": net_ids['ft-net1'],
"extCps": [
{
"cpdId": "VDU1_CP1",
"cpConfig": {
"VDU1_CP1": {
"cpProtocolData": [{
"layerProtocol": "IP_OVER_ETHERNET",
"ipOverEthernet": {
# "macAddress": omitted,
# "segmentationId": omitted,
"ipAddresses": [{
"type": "IPV4",
# "fixedAddresses": omitted,
"numDynamicAddresses": 1,
# "addressRange": omitted,
"subnetId": subnets['ft-ipv4-subnet1']}]
}
}]}
}
},
{
"cpdId": "VDU2_CP2",
"cpConfig": {
"VDU2_CP2": {
"cpProtocolData": [{
"layerProtocol": "IP_OVER_ETHERNET",
"ipOverEthernet": {
# "macAddress": omitted,
# "segmentationId": omitted,
"ipAddresses": [{
"type": "IPV4",
"fixedAddresses": [
"22.22.22.101"
],
# "numDynamicAddresses": omitted
# "addressRange": omitted,
"subnetId": subnets['ft-ipv4-subnet1']
}, {
"type": "IPV6",
# "fixedAddresses": omitted,
# "numDynamicAddresses": omitted,
"numDynamicAddresses": 1,
# "addressRange": omitted,
"subnetId": subnets['ft-ipv6-subnet1']
}]
}
}]
}}
}
]
}
vim_1 = {
"vimId": vim_id_1,
"vimType": "ETSINFV.OPENSTACK_KEYSTONE.V_3",
"interfaceInfo": {"endpoint": auth_url},
"accessInfo": {
"username": "nfv_user",
"region": "RegionOne",
"password": "devstack",
"project": "nfv",
"projectDomain": "Default",
"userDomain": "Default"
},
"extra": {"dummy-key": "dummy-val"}
}
vim_2 = {
"vimId": vim_id_2,
"vimType": "ETSINFV.OPENSTACK_KEYSTONE.V_3",
"interfaceInfo": {"endpoint": auth_url},
"accessInfo": {
"username": "dummy_user",
"region": "RegionOne",
"password": "dummy_password",
"project": "dummy_project",
"projectDomain": "Default",
"userDomain": "Default"
},
"extra": {"dummy-key": "dummy-val"}
}
return {
"extVirtualLinks": [
ext_vl_1
],
"vimConnectionInfo": {
"vim1": vim_1,
"vim2": vim_2
},
"additionalParams": {"dummy-key": "dummy-val"}
}
def change_ext_conn_min(net_ids, subnets):
# Omit except for required attributes
# NOTE: Only the following cardinality attributes are set.
# - 1
# - 1..N (1)
ext_vl_1 = {
"id": uuidutils.generate_uuid(),
"resourceId": net_ids['ft-net1'],
"extCps": [
{
"cpdId": "VDU2_CP2",
"cpConfig": {
"VDU2_CP2": {
"cpProtocolData": [{
"layerProtocol": "IP_OVER_ETHERNET",
"ipOverEthernet": {
# "macAddress": omitted,
# "segmentationId": omitted,
"ipAddresses": [{
"type": "IPV4",
"fixedAddresses": [
"22.22.22.100"
],
# "numDynamicAddresses": omitted
# "addressRange": omitted,
"subnetId": subnets['ft-ipv4-subnet1']
}, {
"type": "IPV6",
# "fixedAddresses": omitted,
# "numDynamicAddresses": omitted,
"numDynamicAddresses": 1,
# "addressRange": omitted,
"subnetId": subnets['ft-ipv6-subnet1']
}]
}
}]}
}
}
]
}
return {
"extVirtualLinks": [
ext_vl_1
]
}

View File

@ -51,16 +51,37 @@ print('#####################################################################\n'
'# Run post.py when you finish tests #\n'
'# - When you no longer need these openstack resources #\n'
'# after testing, run post.py and delete them. #\n'
'# vnfc ids should be changed in heal req files by show vnf manually.#\n'
'#####################################################################')
net_ids = utils.get_network_ids(['net0', 'net1', 'net_mgmt', 'ft-net0'])
subnet_ids = utils.get_subnet_ids(
['subnet0', 'subnet1', 'ft-ipv4-subnet0', 'ft-ipv6-subnet0'])
net_ids = utils.get_network_ids(['net0', 'net1', 'net_mgmt', 'ft-net0',
'ft-net1'])
subnet_ids = utils.get_subnet_ids(['subnet0', 'subnet1', 'ft-ipv4-subnet0',
'ft-ipv6-subnet0', 'ft-ipv4-subnet1', 'ft-ipv6-subnet1'])
port_ids = utils.get_port_ids(['VDU2_CP1-1', 'VDU2_CP1-2'])
instantiate_req = paramgen.instantiate_vnf_max(
net_ids, subnet_ids, port_ids, "http://localhost/identity/v3")
# fake vnfc id, should be get from show vnf
vnfc_ids = ['VDU1-9300a3cb-bd3b-45e4-9967-095040caf827',
'VDU2-39681281-e6e6-4179-8898-d9ec70f1642a']
heal_vnfc_req = paramgen.heal_vnf_vnfc_max(vnfc_ids[0])
heal_vnfc_with_omit_all_req = paramgen.heal_vnf_vnfc_max_with_parameter(
vnfc_ids)
heal_vnfc_with_all_false_req = paramgen.heal_vnf_vnfc_max_with_parameter(
vnfc_ids, False)
heal_vnfc_with_all_true_req = paramgen.heal_vnf_vnfc_max_with_parameter(
vnfc_ids, True)
heal_all_with_omit_all_req = paramgen.heal_vnf_all_max_with_parameter()
heal_all_with_all_true_req = paramgen.heal_vnf_all_max_with_parameter(True)
heal_all_with_all_false_req = paramgen.heal_vnf_all_max_with_parameter(False)
change_ext_conn_max_req = paramgen.change_ext_conn_max(net_ids, subnet_ids,
"http://localhost/identity/v3")
# Only this package have external connectivity.
# So min pattern also use this package.
change_ext_conn_min_req = paramgen.change_ext_conn_min(net_ids, subnet_ids)
with open("create_req", "w", encoding='utf-8') as f:
f.write(json.dumps(create_req, indent=2))
@ -75,3 +96,30 @@ with open("scalein_req", "w", encoding='utf-8') as f:
with open("instantiate_req", "w", encoding='utf-8') as f:
f.write(json.dumps(instantiate_req, indent=2))
with open("heal_vnfc_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_vnfc_req, indent=2))
with open("heal_vnfc_with_omit_all_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_vnfc_with_omit_all_req, indent=2))
with open("heal_vnfc_with_all_false_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_vnfc_with_all_false_req, indent=2))
with open("heal_vnfc_with_all_true_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_vnfc_with_all_true_req, indent=2))
with open("heal_all_with_omit_all_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_all_with_omit_all_req, indent=2))
with open("heal_all_with_all_true_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_all_with_all_true_req, indent=2))
with open("heal_all_with_all_false_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_all_with_all_false_req, indent=2))
with open("change_ext_conn_max_req", "w", encoding='utf-8') as f:
f.write(json.dumps(change_ext_conn_max_req, indent=2))
with open("change_ext_conn_min_req", "w", encoding='utf-8') as f:
f.write(json.dumps(change_ext_conn_min_req, indent=2))

View File

@ -15,6 +15,7 @@
from tacker.tests.functional.sol_v2 import utils
utils.delete_network('ft-net0')
utils.delete_network('ft-net1')
# NOTE: subnet is automatically deleted by network deletion
utils.delete_port('VDU2_CP1-1')
utils.delete_port('VDU2_CP1-2')

View File

@ -17,5 +17,8 @@ from tacker.tests.functional.sol_v2 import utils
utils.create_network('ft-net0')
utils.create_subnet('ft-ipv4-subnet0', 'ft-net0', '100.100.100.0/24', '4')
utils.create_subnet('ft-ipv6-subnet0', 'ft-net0', '1111:2222:3333::/64', '6')
utils.create_network('ft-net1')
utils.create_subnet('ft-ipv4-subnet1', 'ft-net1', '22.22.22.0/24', '4')
utils.create_subnet('ft-ipv6-subnet1', 'ft-net1', '1111:2222:4444::/64', '6')
utils.create_port('VDU2_CP1-1', 'net0')
utils.create_port('VDU2_CP1-2', 'net0')

View File

@ -38,6 +38,20 @@ instantiate_req = paramgen.instantiate_vnf_min()
scaleout_req = paramgen.scaleout_vnf_min()
scalein_req = paramgen.scalein_vnf_min()
update_seq = paramgen.update_vnf_min()
# fake vnfc id, should be get from show vnf
VNFC_ID = "VDU1-9300a3cb-bd3b-45e4-9967-095040caf827"
heal_req = paramgen.heal_vnf_vnfc_min(VNFC_ID)
heal_without_parameter_req = paramgen.heal_vnf_all_min()
net_ids = {}
net_ids['ft-net1'] = '51e62f5f-3711-4182-b844-0f23e0408e51'
subnet_ids = {}
subnet_ids['ft-ipv4-subnet1'] = '8bf9b119-68bd-4e01-b518-dd4cde71687c'
subnet_ids['ft-ipv6-subnet1'] = '2bbaeb35-4d75-4aae-ab59-10c22a04d06b'
change_ext_conn_req = paramgen.change_ext_conn_min(net_ids, subnet_ids)
print('#####################################################################\n'
'# vnfc id should be changed in heal req file by show vnf manually. #\n'
'#####################################################################')
with open("create_req", "w", encoding='utf-8') as f:
f.write(json.dumps(create_req, indent=2))
@ -56,3 +70,12 @@ with open("scalein_req", "w", encoding='utf-8') as f:
with open("update_seq", "w", encoding='utf-8') as f:
f.write(json.dumps(update_seq, indent=2))
with open("heal_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_req, indent=2))
with open("heal_without_parameter_req", "w", encoding='utf-8') as f:
f.write(json.dumps(heal_without_parameter_req, indent=2))
with open("change_ext_conn_req", "w", encoding='utf-8') as f:
f.write(json.dumps(change_ext_conn_req, indent=2))

View File

@ -32,11 +32,15 @@ utils.make_zip(".", tmp_dir, vnfd_id)
shutil.copy(os.path.join(tmp_dir, zip_file_name), ".")
shutil.rmtree(tmp_dir)
print('#####################################################################\n'
'# vnfc id should be changed in update req file by show vnf manually.#\n'
'#####################################################################')
update_min_req = paramgen.update_vnf_min_with_parameter(vnfd_id)
# fake vnfc id, shoule be get from show vnf
vnfc_id_1 = "VDU1-9300a3cb-bd3b-45e4-9967-095040caf827"
vnfc_id_2 = "VDU2-39681281-e6e6-4179-8898-d9ec70f1642a"
update_max_req = paramgen.update_vnf_max(vnfd_id, vnfc_id_1, vnfc_id_2)
# fake vnfc id, should be get from show vnf
vnfc_ids = ["VDU1-9300a3cb-bd3b-45e4-9967-095040caf827",
"VDU2-39681281-e6e6-4179-8898-d9ec70f1642a"]
update_max_req = paramgen.update_vnf_max(vnfd_id, vnfc_ids)
with open("update_min_req", "w", encoding='utf-8') as f:
f.write(json.dumps(update_min_req, indent=2))

File diff suppressed because it is too large Load Diff

View File

@ -899,3 +899,230 @@ class VnfLcmErrorHandlingTest(base_v2.BaseSolV2Test):
resp, body = self.delete_subscription(sub_id)
self.assertEqual(204, resp.status_code)
self.check_resp_headers_in_delete(resp)
def test_rollback_chgextconn(self):
"""Test rollback change_ext_conn operation
* About attributes:
All of the following cardinality attributes are set.
In addition, 0..N or 1..N attributes are set to 2 or more.
0..1 is set to 1.
- 0..1 (1)
- 0..N (2 or more)
- 1..N (2 or more)
* About LCM operations:
This test includes the following operations.
- 0. Pre-setting
- 1. Create subscription
- 2. Test notification
- 3. Create VNF instance
- 4. Instantiate VNF
- 5. Show VNF instance
- 6. Change external connectivity(will fail)
- 7. Rollback change_ext_conn operation
- 8. Show VNF LCM operation occurrence
- 9. List VNF LCM operation occurrence
- 10. Terminate VNF
- 11. Delete VNF instance
- 12. Delete subscription
"""
# 0. Pre-setting
# Create a new network for change external connectivity
ft_net1_name = 'ft-net1'
ft_net1_subs = {
'ft-ipv4-subnet1': {
'range': '22.22.22.0/24',
'ip_version': 4
},
'ft-ipv6-subnet1': {
'range': '1111:2222:4444::/64',
'ip_version': 6
}
}
ft_net1_id = self.create_network(ft_net1_name)
self.addCleanup(self.delete_network, ft_net1_id)
for sub_name, val in ft_net1_subs.items():
# subnet is automatically deleted with network deletion
self.create_subnet(
ft_net1_id, sub_name, val['range'], val['ip_version'])
net_ids = self.get_network_ids(['ft-net1'])
subnet_ids = self.get_subnet_ids(['ft-ipv4-subnet1',
'ft-ipv6-subnet1'])
# 1. Create subscription
callback_url = os.path.join(base_v2.MOCK_NOTIFY_CALLBACK_URL,
self._testMethodName)
callback_uri = ('http://localhost:'
f'{base_v2.FAKE_SERVER_MANAGER.SERVER_PORT}'
f'{callback_url}')
sub_req = paramgen.sub_create_min(callback_uri)
resp, body = self.create_subscription(sub_req)
self.assertEqual(201, resp.status_code)
self.check_resp_headers_in_create(resp)
sub_id = body['id']
# 2. Test notification
self.assert_notification_get(callback_url)
# check usageState of VNF Package
usage_state = self.get_vnf_package(self.vnf_pkg_3)['usageState']
self.assertEqual('NOT_IN_USE', usage_state)
# 3. Create VNF instance
# ETSI NFV SOL003 v3.3.1 5.5.2.2 VnfInstance
expected_inst_attrs = [
'id',
# 'vnfInstanceName', # omitted
# 'vnfInstanceDescription', # omitted
'vnfdId',
'vnfProvider',
'vnfProductName',
'vnfSoftwareVersion',
'vnfdVersion',
# 'vnfConfigurableProperties', # omitted
# 'vimConnectionInfo', # omitted
'instantiationState',
# 'instantiatedVnfInfo', # omitted
# 'metadata', # omitted
# 'extensions', # omitted
'_links'
]
create_req = paramgen.create_vnf_min(self.vnfd_id_3)
resp, body = self.create_vnf_instance(create_req)
self.assertEqual(201, resp.status_code)
self.check_resp_headers_in_create(resp)
self.check_resp_body(body, expected_inst_attrs)
inst_id = body['id']
# check usageState of VNF Package
usage_state = self.get_vnf_package(self.vnf_pkg_3)['usageState']
self.assertEqual('IN_USE', usage_state)
# check instantiationState of VNF
self.assertEqual(fields.VnfInstanceState.NOT_INSTANTIATED,
body['instantiationState'])
# 4. Instantiate VNF
instantiate_req = paramgen.instantiate_vnf_min()
resp, body = self.instantiate_vnf_instance(inst_id, instantiate_req)
self.assertEqual(202, resp.status_code)
self.check_resp_headers_in_operation_task(resp)
lcmocc_id = os.path.basename(resp.headers['Location'])
self.wait_lcmocc_complete(lcmocc_id)
# check usageState of VNF Package
usage_state = self.get_vnf_package(self.vnf_pkg_3)['usageState']
self.assertEqual('IN_USE', usage_state)
# 5. Show VNF instance
additional_inst_attrs = [
'vimConnectionInfo',
'instantiatedVnfInfo'
]
expected_inst_attrs.extend(additional_inst_attrs)
resp, body = self.show_vnf_instance(inst_id)
self.assertEqual(200, resp.status_code)
self.check_resp_headers_in_get(resp)
self.check_resp_body(body, expected_inst_attrs)
# check instantiationState of VNF
self.assertEqual(fields.VnfInstanceState.INSTANTIATED,
body['instantiationState'])
# check vnfState of VNF
self.assertEqual(fields.VnfOperationalStateType.STARTED,
body['instantiatedVnfInfo']['vnfState'])
# 6. Change external connectivity(will fail)
# NOTE: Create a file so that an error occurs in mgmtDriver
path = '/tmp/change_external_connectivity_start'
with open(path, 'w', encoding='utf-8') as f:
f.write('')
self.addCleanup(os.remove, path)
change_ext_conn_req = paramgen.change_ext_conn_min(net_ids, subnet_ids)
resp, body = self.change_ext_conn(inst_id, change_ext_conn_req)
self.assertEqual(202, resp.status_code)
self.check_resp_headers_in_operation_task(resp)
lcmocc_id = os.path.basename(resp.headers['Location'])
self.wait_lcmocc_failed_temp(lcmocc_id)
# 7. Rollback change_ext_conn operation
resp, body = self.rollback_lcmocc(lcmocc_id)
self.assertEqual(202, resp.status_code)
self.check_resp_headers_in_delete(resp)
self.wait_lcmocc_rolled_back(lcmocc_id)
# 8. Show VNF LCM operation occurrence
# ETSI NFV SOL003 v3.3.1 5.5.2.13 VnfLcmOpOcc
# NOTE: omitted values are not supported at that time
expected_attrs = [
'id',
'operationState',
'stateEnteredTime',
'startTime',
'vnfInstanceId',
# 'grantId', # omitted
'operation',
'isAutomaticInvocation',
# 'operationParams', # omitted
'isCancelPending',
# 'cancelMode', # omitted
# 'error', # omitted
# 'resourceChanges', # omitted
# 'changedInfo', # omitted
# 'changedExtConnectivity', # omitted
# 'modificationsTriggeredByVnfPkgChange', # omitted
# 'vnfSnapshotInfoId', # omitted
'_links'
]
resp, body = self.show_lcmocc(lcmocc_id)
self.assertEqual(200, resp.status_code)
self.check_resp_headers_in_get(resp)
self.check_resp_body(body, expected_attrs)
# 9. List VNF LCM operation occurrence
resp, body = self.list_lcmocc()
self.assertEqual(200, resp.status_code)
self.check_resp_headers_in_get(resp)
for lcmocc in body:
self.check_resp_body(lcmocc, expected_attrs)
# 10. Terminate VNF
terminate_req = paramgen.terminate_vnf_min()
resp, body = self.terminate_vnf_instance(inst_id, terminate_req)
self.assertEqual(202, resp.status_code)
self.check_resp_headers_in_operation_task(resp)
lcmocc_id = os.path.basename(resp.headers['Location'])
self.wait_lcmocc_complete(lcmocc_id)
# wait a bit because there is a bit time lag between lcmocc DB
# update and terminate completion.
time.sleep(10)
# check usageState of VNF Package
usage_state = self.get_vnf_package(self.vnf_pkg_3)['usageState']
self.assertEqual('IN_USE', usage_state)
# check instantiationState of VNF
resp, body = self.show_vnf_instance(inst_id)
self.assertEqual(200, resp.status_code)
self.assertEqual(fields.VnfInstanceState.NOT_INSTANTIATED,
body['instantiationState'])
# 11. Delete VNF instance
resp, body = self.delete_vnf_instance(inst_id)
self.assertEqual(204, resp.status_code)
self.check_resp_headers_in_delete(resp)
# check usageState of VNF Package
usage_state = self.get_vnf_package(self.vnf_pkg_3)['usageState']
self.assertEqual('NOT_IN_USE', usage_state)
# 12. Delete subscription
resp, body = self.delete_subscription(sub_id)
self.assertEqual(204, resp.status_code)
self.check_resp_headers_in_delete(resp)