Minor fixes and clean-ups

* eliminate redundant __import__
* fix typo
* fix python3 issue
* FT: set total sizes to its real full size

Related-Bug: #1886213
Change-Id: I940fdc289701023a3f37abb01c3f37dd312f2f7f
This commit is contained in:
Koichiro Den 2020-10-29 12:47:34 +09:00
parent 1a98ddf42b
commit 180ff8ae4a
4 changed files with 6 additions and 8 deletions

View File

@ -25,7 +25,6 @@ def register_all():
# function in order for it to be registered by services that may # function in order for it to be registered by services that may
# need to receive it via RPC. # need to receive it via RPC.
__import__('tacker.objects.heal_vnf_request') __import__('tacker.objects.heal_vnf_request')
__import__('tacker.objects.vnfd')
__import__('tacker.objects.vnf_package') __import__('tacker.objects.vnf_package')
__import__('tacker.objects.vnf_package_vnfd') __import__('tacker.objects.vnf_package_vnfd')
__import__('tacker.objects.vnf_deployment_flavour') __import__('tacker.objects.vnf_deployment_flavour')
@ -44,5 +43,4 @@ def register_all():
__import__('tacker.objects.scale_vnf_request') __import__('tacker.objects.scale_vnf_request')
__import__('tacker.objects.grant') __import__('tacker.objects.grant')
__import__('tacker.objects.grant_request') __import__('tacker.objects.grant_request')
__import__('tacker.objects.vnfd')
__import__('tacker.objects.vnfd_attribute') __import__('tacker.objects.vnfd_attribute')

View File

@ -235,7 +235,7 @@ def _vnf_lcm_subscriptions_create(context, values, filter):
callbackUri = values.callback_uri callbackUri = values.callback_uri
if filter: if filter:
notification_type = filter.get('notificationTypes') notification_type = filter.get('notificationTypes')
operation_type = filter.get('operationTypese') operation_type = filter.get('operationTypes')
vnf_lcm_subscriptions_id = _vnf_lcm_subscriptions_id_get( vnf_lcm_subscriptions_id = _vnf_lcm_subscriptions_id_get(
context, context,

View File

@ -437,7 +437,7 @@ class VnfPackageTest(base.BaseTackerTest):
id=self.package_id1, base_path=self.base_url), id=self.package_id1, base_path=self.base_url),
"GET", body={}, headers={}) "GET", body={}, headers={})
self.assertEqual(200, response[0].status_code) self.assertEqual(200, response[0].status_code)
self.assertEqual('12804503', response[0].headers['Content-Length']) self.assertEqual('12804568', response[0].headers['Content-Length'])
def test_fetch_vnf_package_content_combined_download(self): def test_fetch_vnf_package_content_combined_download(self):
"""Combine two partial downloads using 'Range' requests for csar zip""" """Combine two partial downloads using 'Range' requests for csar zip"""
@ -458,7 +458,7 @@ class VnfPackageTest(base.BaseTackerTest):
zipf.writestr(file_path, data) zipf.writestr(file_path, data)
# Partial download 2 # Partial download 2
range_ = 'bytes=11-12804503' range_ = 'bytes=11-12804568'
headers = {'Range': range_} headers = {'Range': range_}
response_2 = self.http_client.do_request( response_2 = self.http_client.do_request(
'{base_path}/{id}/package_content'.format( '{base_path}/{id}/package_content'.format(
@ -471,7 +471,7 @@ class VnfPackageTest(base.BaseTackerTest):
size_2 = int(response_2[0].headers['Content-Length']) size_2 = int(response_2[0].headers['Content-Length'])
total_size = size_1 + size_2 total_size = size_1 + size_2
self.assertEqual(True, zipfile.is_zipfile(zip_file_path)) self.assertEqual(True, zipfile.is_zipfile(zip_file_path))
self.assertEqual(12804503, total_size) self.assertEqual(12804568, total_size)
zip_file_path.close() zip_file_path.close()
def test_fetch_vnf_package_artifacts(self): def test_fetch_vnf_package_artifacts(self):

View File

@ -307,7 +307,7 @@ def _process_query_metadata(metadata, policy, unique_id):
def _process_query_metadata_reservation(metadata, policy): def _process_query_metadata_reservation(metadata, policy):
query_metadata = dict() query_metadata = dict()
policy_actions = policy.entity_tpl['reservation'].keys() policy_actions = list(policy.entity_tpl['reservation'].keys())
policy_actions.remove('properties') policy_actions.remove('properties')
for action in policy_actions: for action in policy_actions:
query_template = [{ query_template = [{
@ -335,7 +335,7 @@ def _process_alarm_actions(vnf, policy):
def _process_alarm_actions_for_reservation(vnf, policy): def _process_alarm_actions_for_reservation(vnf, policy):
# process alarm url here # process alarm url here
alarm_actions = dict() alarm_actions = dict()
policy_actions = policy.entity_tpl['reservation'].keys() policy_actions = list(policy.entity_tpl['reservation'].keys())
policy_actions.remove('properties') policy_actions.remove('properties')
for action in policy_actions: for action in policy_actions:
alarm_url = vnf['attributes'].get(action) alarm_url = vnf['attributes'].get(action)