Remove implicit dependency on iso8601
iso8601.iso8601.UTC has been equivalent to datetime.timezone.utc in Python 3. Because python 2 is no longer supported, we can directly use the built-in implementation. Change-Id: Ic3b07a6b39769e72cf966eac9e7fa0f9eeadf48e
This commit is contained in:
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
import iso8601
|
||||
import os
|
||||
import shutil
|
||||
from tacker import objects
|
||||
@ -112,9 +111,9 @@ def get_lcm_op_occs_data():
|
||||
'operation_state': 'PROCESSING',
|
||||
'state_entered_time':
|
||||
datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'start_time': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'operation': 'MODIFY_INFO',
|
||||
'is_automatic_invocation': 0,
|
||||
'is_cancel_pending': 0,
|
||||
@ -163,7 +162,7 @@ def fake_vnf_package_vnfd_model_dict(**updates):
|
||||
'deleted_at': None,
|
||||
'updated_at': None,
|
||||
'created_at': datetime.datetime(2020, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'vnf_product_name': 'Sample VNF',
|
||||
'vnf_provider': 'test vnf provider',
|
||||
'vnf_software_version': '1.0',
|
||||
@ -187,7 +186,7 @@ def return_vnf_package_vnfd():
|
||||
def _model_non_instantiated_vnf_instance(**updates):
|
||||
vnf_instance = {
|
||||
'created_at': datetime.datetime(2020, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'deleted': False,
|
||||
'deleted_at': None,
|
||||
'id': uuidsentinel.vnf_instance_id,
|
||||
|
@ -16,7 +16,6 @@
|
||||
import base64
|
||||
import datetime
|
||||
import fixtures
|
||||
import iso8601
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@ -73,7 +72,7 @@ class FakeVnfLcmDriver(mock.Mock):
|
||||
def modify_vnf(self, context, vnf_lcm_opoccs, body_data,
|
||||
vnfd_pkg_data, vnfd_id):
|
||||
return datetime.datetime(
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
|
||||
|
||||
class FakeVNFMPlugin(mock.Mock):
|
||||
@ -184,7 +183,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
'id': uuidsentinel.id,
|
||||
'state_entered_time': datetime.datetime(
|
||||
1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'operationParams': 'operationParams',
|
||||
'tenant_id': uuidsentinel.tenant_id
|
||||
}
|
||||
@ -2701,9 +2700,9 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
vnf_info = fakes._get_vnf()
|
||||
vnf_lcm_op_occ = objects.VnfLcmOpOcc(
|
||||
state_entered_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
start_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_instance_id=uuidsentinel.vnf_instance_id,
|
||||
operation='SCALE',
|
||||
operation_state='ACTIVE',
|
||||
@ -2712,7 +2711,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
error_point=0,
|
||||
id=test_constants.UUID,
|
||||
created_at=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC))
|
||||
tzinfo=datetime.timezone.utc))
|
||||
vnf_info['vnf_lcm_op_occ'] = vnf_lcm_op_occ
|
||||
vnf_instance = fakes.return_vnf_instance(
|
||||
fields.VnfInstanceState.INSTANTIATED,
|
||||
@ -2766,9 +2765,9 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
vnf_info = fakes._get_vnf()
|
||||
vnf_lcm_op_occ = objects.VnfLcmOpOcc(
|
||||
state_entered_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
start_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_instance_id=uuidsentinel.vnf_instance_id,
|
||||
operation='SCALE',
|
||||
operation_state='ACTIVE',
|
||||
@ -2777,7 +2776,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
error_point=0,
|
||||
id=test_constants.UUID,
|
||||
created_at=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC))
|
||||
tzinfo=datetime.timezone.utc))
|
||||
vnf_info['vnf_lcm_op_occ'] = vnf_lcm_op_occ
|
||||
vnf_instance = fakes.return_vnf_instance(
|
||||
fields.VnfInstanceState.INSTANTIATED,
|
||||
@ -2886,9 +2885,9 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
vnf_lcm_op_occ = objects.VnfLcmOpOcc(
|
||||
context=self.context,
|
||||
state_entered_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
start_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_instance_id=vnf_instance.id,
|
||||
operation='SCALE',
|
||||
operation_state='ACTIVE',
|
||||
@ -2899,7 +2898,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
id='00e1314d-2a82-40bd-b318-cc881243842d',
|
||||
tenant_id='01db9967-ba45-4f1d-962d-7cbb825448f1',
|
||||
created_at=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC))
|
||||
tzinfo=datetime.timezone.utc))
|
||||
vnf_lcm_op_occ.create()
|
||||
vnf_info['vnf_lcm_op_occ'] = vnf_lcm_op_occ
|
||||
vnf_instance = fakes.return_vnf_instance(
|
||||
@ -3028,9 +3027,9 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
vnf_lcm_op_occ = objects.VnfLcmOpOcc(
|
||||
context=self.context,
|
||||
state_entered_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
start_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_instance_id=vnf_instance.id,
|
||||
operation='SCALE',
|
||||
operation_state='ACTIVE',
|
||||
@ -3041,7 +3040,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
tenant_id='7cd42301-a3a5-47ad-a7bd-87b02540503b',
|
||||
id='00e1314d-2a82-40bd-b318-cc881243843d',
|
||||
created_at=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC))
|
||||
tzinfo=datetime.timezone.utc))
|
||||
vnf_lcm_op_occ.create()
|
||||
vnf_info['vnf_lcm_op_occ'] = vnf_lcm_op_occ
|
||||
vnf_instance = fakes.return_vnf_instance(
|
||||
@ -3126,9 +3125,9 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
vnf_lcm_op_occ = objects.VnfLcmOpOcc(
|
||||
context=self.context,
|
||||
state_entered_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
start_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_instance_id=vnf_instance.id,
|
||||
operation='SCALE',
|
||||
operation_state='ACTIVE',
|
||||
@ -3138,7 +3137,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
id='00e1314d-2a82-40bd-b318-cc881243843d',
|
||||
tenant_id='00e1314d-2a82-40bd-b318-cc881243843r',
|
||||
created_at=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC))
|
||||
tzinfo=datetime.timezone.utc))
|
||||
vnf_lcm_op_occ.create()
|
||||
vnf_info['vnf_lcm_op_occ'] = vnf_lcm_op_occ
|
||||
vnf_instance = fakes.return_vnf_instance(
|
||||
@ -3639,7 +3638,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
mock_add, mock_get_by_id):
|
||||
mock_create.return_value = "OK"
|
||||
mock_update.return_value = datetime.datetime(
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
mock_add.return_value = "OK"
|
||||
mock_save.return_value = "OK"
|
||||
vnf_package_vnfd = self._create_and_upload_vnf_package()
|
||||
@ -3667,7 +3666,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
mock_add, mock_get_by_id):
|
||||
mock_create.return_value = "OK"
|
||||
mock_update.return_value = datetime.datetime(
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
mock_add.return_value = "OK"
|
||||
mock_save.return_value = "OK"
|
||||
vnf_package_vnfd = self._create_and_upload_vnf_package()
|
||||
@ -3695,7 +3694,7 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
|
||||
mock_add, mock_get_by_id):
|
||||
mock_create.return_value = "OK"
|
||||
mock_update.return_value = datetime.datetime(
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
mock_add.return_value = "OK"
|
||||
mock_save.return_value = "OK"
|
||||
vnf_package_vnfd = self._create_and_upload_vnf_package()
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import copy
|
||||
import datetime
|
||||
import iso8601
|
||||
import sys
|
||||
|
||||
from oslo_utils import timeutils
|
||||
@ -869,8 +868,8 @@ class TestDbMigrationToV2(SqlTestCase):
|
||||
self.ext_virtual_link_info.resource_handle.resource_id}]}
|
||||
vnf_lcm_op_occs_data_1.update({
|
||||
"operation_state": "COMPLETED",
|
||||
"start_time":
|
||||
datetime.datetime(1900, 1, 1, 1, 1, 2, tzinfo=iso8601.UTC),
|
||||
"start_time": datetime.datetime(
|
||||
1900, 1, 1, 1, 1, 2, tzinfo=datetime.timezone.utc),
|
||||
"operation": "CHANGE_EXT_CONN",
|
||||
"operation_params": str(operation_params)})
|
||||
vnf_lcm_op_occs_1 = objects.vnf_lcm_op_occs.VnfLcmOpOcc(
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import copy
|
||||
import datetime
|
||||
import iso8601
|
||||
|
||||
from tacker.db.db_sqlalchemy import models
|
||||
from tacker.tests import constants
|
||||
@ -29,7 +28,7 @@ vnf_package_data = {'algorithm': None, 'hash': None,
|
||||
'usage_state': 'NOT_IN_USE',
|
||||
'user_data': {'abc': 'xyz'},
|
||||
'created_at': datetime.datetime(
|
||||
2019, 8, 8, 0, 0, 0, tzinfo=iso8601.UTC),
|
||||
2019, 8, 8, 0, 0, 0, tzinfo=datetime.timezone.utc),
|
||||
'deleted': False,
|
||||
'size': 0,
|
||||
"downloading": 0
|
||||
@ -122,9 +121,9 @@ lcm_op_occs_data = {
|
||||
"tenant_id": uuidsentinel.tenant_id,
|
||||
'operation_state': 'PROCESSING',
|
||||
'state_entered_time': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'start_time': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'operation': 'MODIFY_INFO',
|
||||
'is_automatic_invocation': 0,
|
||||
'is_cancel_pending': 0,
|
||||
@ -169,7 +168,8 @@ vnf_deployment_flavour = {'flavour_id': 'simple',
|
||||
'default_level': 'instantiation_level_1'
|
||||
},
|
||||
'created_at': datetime.datetime(
|
||||
2019, 8, 8, 0, 0, 0, tzinfo=iso8601.UTC),
|
||||
2019, 8, 8, 0, 0, 0,
|
||||
tzinfo=datetime.timezone.utc),
|
||||
}
|
||||
|
||||
vnf_artifacts = {
|
||||
@ -177,7 +177,8 @@ vnf_artifacts = {
|
||||
'_metadata': {},
|
||||
'algorithm': 'sha-256',
|
||||
'hash': 'd0e7828293355a07c2dccaaa765c80b507e60e6167067c950dc2e6b0da0dbd8b',
|
||||
'created_at': datetime.datetime(2020, 6, 29, 0, 0, 0, tzinfo=iso8601.UTC),
|
||||
'created_at': datetime.datetime(
|
||||
2020, 6, 29, 0, 0, 0, tzinfo=datetime.timezone.utc),
|
||||
}
|
||||
|
||||
|
||||
@ -254,9 +255,9 @@ def get_lcm_op_occs_data(id, vnf_instance_id):
|
||||
"tenant_id": uuidsentinel.tenant_id,
|
||||
'operation_state': 'PROCESSING',
|
||||
'state_entered_time': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'start_time': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'vnf_instance_id': vnf_instance_id,
|
||||
'operation': 'MODIFY_INFO',
|
||||
'is_automatic_invocation': 0,
|
||||
@ -270,7 +271,7 @@ def fake_vnf_instance_model_dict(**updates):
|
||||
'deleted_at': None,
|
||||
'updated_at': None,
|
||||
'created_at': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'vnf_product_name': 'Sample VNF',
|
||||
'vnf_instance_name': 'Sample VNF',
|
||||
'vnf_instance_description': None,
|
||||
|
@ -16,7 +16,6 @@
|
||||
from copy import deepcopy
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
import iso8601
|
||||
import json
|
||||
import os
|
||||
import webob
|
||||
@ -94,7 +93,7 @@ def fake_vnf_package_vnfd_model_dict(**updates):
|
||||
'deleted_at': None,
|
||||
'updated_at': None,
|
||||
'created_at': datetime.datetime(2020, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'vnf_product_name': 'Sample VNF',
|
||||
'vnf_provider': 'test vnf provider',
|
||||
'vnf_software_version': '1.0',
|
||||
@ -131,7 +130,7 @@ def scale_request_make(type, number_of_steps):
|
||||
def _model_non_instantiated_vnf_instance(**updates):
|
||||
vnf_instance = {
|
||||
'created_at': datetime.datetime(2020, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'deleted': False,
|
||||
'deleted_at': None,
|
||||
'id': uuidsentinel.vnf_instance_id,
|
||||
@ -340,7 +339,7 @@ def fake_vnf_package(**updates):
|
||||
'deleted_at': None,
|
||||
'updated_at': None,
|
||||
'created_at': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'hash': None,
|
||||
'location_glance_store': None,
|
||||
'onboarding_state': 'CREATED',
|
||||
@ -394,7 +393,7 @@ def fake_vnf_package_software_image(**updates):
|
||||
'flavour_uuid': constants.UUID,
|
||||
'software_image_id': constants.UUID,
|
||||
'created_at': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC)
|
||||
tzinfo=datetime.timezone.utc)
|
||||
}
|
||||
|
||||
if updates:
|
||||
@ -1535,7 +1534,8 @@ def get_dummy_grant_response():
|
||||
|
||||
def return_vnf_resource():
|
||||
version_obj = objects.VnfResource(
|
||||
created_at=datetime.datetime(1900, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC),
|
||||
created_at=datetime.datetime(
|
||||
1900, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc),
|
||||
deleted=False,
|
||||
deleted_at=None,
|
||||
id=uuidsentinel.vnf_resource_id,
|
||||
@ -1558,7 +1558,7 @@ def vnf_scale():
|
||||
|
||||
|
||||
def vnflcm_scale_in_cnf():
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=dt,
|
||||
start_time=dt,
|
||||
@ -1573,7 +1573,7 @@ def vnflcm_scale_in_cnf():
|
||||
|
||||
|
||||
def vnflcm_scale_out_cnf():
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=dt,
|
||||
start_time=dt,
|
||||
@ -1588,7 +1588,7 @@ def vnflcm_scale_out_cnf():
|
||||
|
||||
|
||||
def vnflcm_rollback(error_point=7):
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=dt,
|
||||
start_time=dt,
|
||||
@ -1603,7 +1603,7 @@ def vnflcm_rollback(error_point=7):
|
||||
|
||||
|
||||
def vnflcm_rollback_insta(error_point=7):
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=dt,
|
||||
start_time=dt,
|
||||
@ -1619,7 +1619,7 @@ def vnflcm_rollback_insta(error_point=7):
|
||||
|
||||
def vnflcm_cancel_insta(error_point=7):
|
||||
default_datetime = datetime.datetime(
|
||||
2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
ext_link_port_info = objects.ExtLinkPortInfo(
|
||||
resource_handle=objects.ResourceHandle(
|
||||
resource_id="109f5049-b51e-409a-9a99-d740ba5f3acb",
|
||||
@ -1651,7 +1651,7 @@ def vnflcm_cancel_insta(error_point=7):
|
||||
|
||||
def vnflcm_fail_insta(error_point=7):
|
||||
default_datetime = datetime.datetime(
|
||||
2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
ext_link_port_info = objects.ExtLinkPortInfo(
|
||||
resource_handle=objects.ResourceHandle(
|
||||
resource_id="109f5049-b51e-409a-9a99-d740ba5f3acb",
|
||||
@ -1715,9 +1715,9 @@ def vnflcm_fail_check_added_params(error_point=7):
|
||||
vnfd_version="fake_vnfd_version")
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
start_time=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_instance_id=constants.UUID,
|
||||
operation='INSTANTIATE',
|
||||
operation_state='FAILED_TEMP',
|
||||
@ -1727,13 +1727,13 @@ def vnflcm_fail_check_added_params(error_point=7):
|
||||
id=constants.UUID,
|
||||
grant_id=constants.UUID,
|
||||
created_at=datetime.datetime(2000, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
changed_ext_connectivity=[changed_ext_connectivity_values],
|
||||
changed_info=changed_info_values)
|
||||
|
||||
|
||||
def vnflcm_rollback_active():
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=dt,
|
||||
start_time=dt,
|
||||
@ -1748,7 +1748,7 @@ def vnflcm_rollback_active():
|
||||
|
||||
|
||||
def vnflcm_rollback_ope():
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=dt,
|
||||
start_time=dt,
|
||||
@ -1763,7 +1763,7 @@ def vnflcm_rollback_ope():
|
||||
|
||||
|
||||
def vnflcm_rollback_scale_in():
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=dt,
|
||||
start_time=dt,
|
||||
@ -2115,9 +2115,9 @@ VNFLCMOPOCC_RESPONSE = {
|
||||
'f26f181d-7891-4720-b022-b074ec1733ef/fail'}},
|
||||
'operationState': 'COMPLETED',
|
||||
'stateEnteredTime': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'startTime': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'vnfInstanceId': 'f26f181d-7891-4720-b022-b074ec1733ef',
|
||||
'grantId': 'f26f181d-7891-4720-b022-b074ec1733ef',
|
||||
'operation': 'MODIFY_INFO',
|
||||
@ -2331,7 +2331,7 @@ def fake_vnf_lcm_op_occs():
|
||||
chg_ext_conn, context) for chg_ext_conn in
|
||||
changed_ext_connectivity]
|
||||
|
||||
dt = datetime.datetime(1900, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
dt = datetime.datetime(1900, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
vnf_lcm_op_occs = {
|
||||
'id': constants.UUID,
|
||||
'operation_state': 'COMPLETED',
|
||||
@ -2365,7 +2365,7 @@ def return_vnf_lcm_opoccs_obj(**updates):
|
||||
|
||||
def vnflcm_op_occs_retry_data(error_point=7, operation='INSTANTIATE',
|
||||
operation_state='FAILED_TEMP'):
|
||||
now = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=iso8601.UTC)
|
||||
now = datetime.datetime(2000, 1, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)
|
||||
return objects.VnfLcmOpOcc(
|
||||
state_entered_time=now,
|
||||
start_time=now,
|
||||
|
@ -13,11 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import ddt
|
||||
import iso8601
|
||||
from oslo_utils import uuidutils
|
||||
import yaml
|
||||
|
||||
@ -111,7 +110,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
name='fake_template',
|
||||
description='fake_template_description',
|
||||
template_source='onboarded',
|
||||
deleted_at=datetime.min)
|
||||
deleted_at=datetime.datetime.min)
|
||||
session.add(vnf_template)
|
||||
session.commit()
|
||||
return vnf_template
|
||||
@ -123,7 +122,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
|
||||
name='tmpl-koeak4tqgoqo8cr4-dummy_inline_vnf',
|
||||
description='inline_fake_template_description',
|
||||
deleted_at=datetime.min,
|
||||
deleted_at=datetime.datetime.min,
|
||||
template_source='inline')
|
||||
session.add(vnf_template)
|
||||
session.commit()
|
||||
@ -141,7 +140,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
vim_id='6261579e-d6f3-49ad-8bc3-a9cb974778ff',
|
||||
placement_attr={'region': 'RegionOne'},
|
||||
status=status,
|
||||
deleted_at=datetime.min)
|
||||
deleted_at=datetime.datetime.min)
|
||||
session.add(vnf_db)
|
||||
session.commit()
|
||||
return vnf_db
|
||||
@ -158,7 +157,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
vim_id='6261579e-d6f3-49ad-8bc3-a9cb974778ff',
|
||||
placement_attr={'region': 'RegionOne'},
|
||||
status=status,
|
||||
deleted_at=datetime.min)
|
||||
deleted_at=datetime.datetime.min)
|
||||
session.add(vnf_db)
|
||||
session.commit()
|
||||
return vnf_db
|
||||
@ -200,7 +199,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
name='fake_vim',
|
||||
description='fake_vim_description',
|
||||
type='test_vim',
|
||||
deleted_at=datetime.min,
|
||||
deleted_at=datetime.datetime.min,
|
||||
placement_attr={'regions': ['RegionOne']})
|
||||
vim_auth_db = nfvo_db.VimAuth(
|
||||
vim_id='6261579e-d6f3-49ad-8bc3-a9cb974778ff',
|
||||
@ -225,7 +224,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
scope='ZONE',
|
||||
server_group_name='my_compute_placement_policy',
|
||||
resource=res_str,
|
||||
deleted_at=datetime.min)
|
||||
deleted_at=datetime.datetime.min)
|
||||
vnf_inst = models.VnfInstance(
|
||||
id='7ddc38c3-a116-48b0-bfc1-68d7f306f467',
|
||||
vnf_provider=' ',
|
||||
@ -235,9 +234,9 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
vnfd_id='8d86480e-d4e6-4ee0-ba4d-08217118d6cb',
|
||||
instantiation_state=' ',
|
||||
tenant_id='9b3f0518-bf6b-4982-af32-d282ce577c8f',
|
||||
created_at=datetime(
|
||||
created_at=datetime.datetime(
|
||||
2020, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_pkg_id=uuidutils.generate_uuid())
|
||||
self.context.session.add(vnf_inst)
|
||||
self.context.session.commit()
|
||||
@ -260,7 +259,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
scope='ZONE',
|
||||
server_group_name='my_compute_placement_policy',
|
||||
resource=res_str,
|
||||
deleted_at=datetime.min)
|
||||
deleted_at=datetime.datetime.min)
|
||||
res_str2 = '[{"id_type": "GRANT", "resource_id": ' + \
|
||||
'"4cef1b7e-8e5f-430e-b32e-a7585a61d61c"}]'
|
||||
placemnt2 = models.PlacementConstraint(
|
||||
@ -270,7 +269,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
scope='ZONE',
|
||||
server_group_name='my_compute_placement_policy',
|
||||
resource=res_str2,
|
||||
deleted_at=datetime.min)
|
||||
deleted_at=datetime.datetime.min)
|
||||
vnf_inst = models.VnfInstance(
|
||||
id='7ddc38c3-a116-48b0-bfc1-68d7f306f467',
|
||||
vnf_provider=' ',
|
||||
@ -280,9 +279,9 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
vnfd_id='8d86480e-d4e6-4ee0-ba4d-08217118d6cb',
|
||||
instantiation_state=' ',
|
||||
tenant_id='9b3f0518-bf6b-4982-af32-d282ce577c8f',
|
||||
created_at=datetime(
|
||||
created_at=datetime.datetime(
|
||||
2020, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_pkg_id=uuidutils.generate_uuid())
|
||||
self.context.session.add(vnf_inst)
|
||||
self.context.session.commit()
|
||||
@ -320,7 +319,7 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
scope='ZONE',
|
||||
server_group_name='my_compute_placement_policy',
|
||||
resource=res_str,
|
||||
deleted_at=datetime.min)
|
||||
deleted_at=datetime.datetime.min)
|
||||
vnf_inst = models.VnfInstance(
|
||||
id='7ddc38c3-a116-48b0-bfc1-68d7f306f467',
|
||||
vnf_provider=' ',
|
||||
@ -330,9 +329,9 @@ class TestVNFMPlugin(db_base.SqlTestCase):
|
||||
vnfd_id='8d86480e-d4e6-4ee0-ba4d-08217118d6cb',
|
||||
instantiation_state=' ',
|
||||
tenant_id='9b3f0518-bf6b-4982-af32-d282ce577c8f',
|
||||
created_at=datetime(
|
||||
created_at=datetime.datetime(
|
||||
2020, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
vnf_pkg_id=uuidutils.generate_uuid())
|
||||
self.context.session.add(vnf_inst)
|
||||
self.context.session.commit()
|
||||
|
@ -17,7 +17,6 @@
|
||||
from copy import deepcopy
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
import iso8601
|
||||
import os
|
||||
from oslo_utils import uuidutils
|
||||
import shutil
|
||||
@ -67,7 +66,7 @@ VNFPACKAGE_RESPONSE = {
|
||||
'hash': 'fake software image hash'},
|
||||
'containerFormat': 'bare',
|
||||
'createdAt': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
'diskFormat': 'qcow2',
|
||||
'id': 'fake_software_image_id',
|
||||
'imagePath': 'fake image path',
|
||||
@ -124,7 +123,7 @@ def _fake_software_image(updates=None):
|
||||
'algorithm': 'fake-algorithm',
|
||||
'metadata': {'key3': 'value3', 'key4': 'value4'},
|
||||
'created_at': datetime.datetime(1900, 1, 1, 1, 1, 1,
|
||||
tzinfo=iso8601.UTC),
|
||||
tzinfo=datetime.timezone.utc),
|
||||
}
|
||||
if updates:
|
||||
software_image.update(updates)
|
||||
|
Reference in New Issue
Block a user