Merge "Replace deprecated datetime.utcnow()"

This commit is contained in:
Zuul 2024-10-15 15:49:04 +00:00 committed by Gerrit Code Review
commit 5d4a790478
13 changed files with 139 additions and 143 deletions

View File

@ -34,7 +34,7 @@ oslo.rootwrap>=5.8.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.service>=2.5.0 # Apache-2.0 oslo.service>=2.5.0 # Apache-2.0
oslo.upgradecheck>=1.3.0 # Apache-2.0 oslo.upgradecheck>=1.3.0 # Apache-2.0
oslo.utils>=4.8.0 # Apache-2.0 oslo.utils>=7.0.0 # Apache-2.0
oslo.versionedobjects>=1.33.3 # Apache-2.0 oslo.versionedobjects>=1.33.3 # Apache-2.0
openstacksdk>=0.44.0 # Apache-2.0 openstacksdk>=0.44.0 # Apache-2.0
python-barbicanclient>=4.5.2 # Apache-2.0 python-barbicanclient>=4.5.2 # Apache-2.0

View File

@ -1402,7 +1402,7 @@ class VnfLcmController(wsgi.Controller):
if vnf_info['before_error_point'] == fields.ErrorPoint.INITIAL: if vnf_info['before_error_point'] == fields.ErrorPoint.INITIAL:
vnf_lcm_op_occs_id = uuidutils.generate_uuid() vnf_lcm_op_occs_id = uuidutils.generate_uuid()
timestamp = datetime.datetime.utcnow() timestamp = timeutils.utcnow()
operation_params = { operation_params = {
'type': scale_vnf_request.type, 'type': scale_vnf_request.type,
'aspect_id': scale_vnf_request.aspect_id, 'aspect_id': scale_vnf_request.aspect_id,
@ -1760,7 +1760,7 @@ class VnfLcmController(wsgi.Controller):
vnf_lcm_op_occs.operation_state = "FAILED" vnf_lcm_op_occs.operation_state = "FAILED"
vnf_lcm_op_occs.state_entered_time = \ vnf_lcm_op_occs.state_entered_time = \
datetime.datetime.utcnow().isoformat() timeutils.utcnow().isoformat()
vnf_lcm_op_occs.updated_at = vnf_lcm_op_occs.state_entered_time vnf_lcm_op_occs.updated_at = vnf_lcm_op_occs.state_entered_time
error_details = objects.ProblemDetails( error_details = objects.ProblemDetails(

View File

@ -267,7 +267,7 @@ def grant_error_common(function):
try: try:
vnf_lcm_op_occs = objects.VnfLcmOpOcc.get_by_id( vnf_lcm_op_occs = objects.VnfLcmOpOcc.get_by_id(
context, vnf_lcm_op_occ_id) context, vnf_lcm_op_occ_id)
timestamp = datetime.datetime.utcnow() timestamp = timeutils.utcnow()
vnf_lcm_op_occs.operation_state = 'ROLLED_BACK' vnf_lcm_op_occs.operation_state = 'ROLLED_BACK'
vnf_lcm_op_occs.state_entered_time = timestamp vnf_lcm_op_occs.state_entered_time = timestamp
vnf_lcm_op_occs.save() vnf_lcm_op_occs.save()
@ -927,7 +927,7 @@ class Conductor(manager.Manager, v2_hook.ConductorV2Hook):
csar zip files and vnf packages files from the extracted path. csar zip files and vnf packages files from the extracted path.
""" """
time_duration = datetime.datetime.utcnow() - datetime.timedelta( time_duration = timeutils.utcnow() - datetime.timedelta(
seconds=CONF.vnf_package_delete_interval) seconds=CONF.vnf_package_delete_interval)
filters = {'field': 'deleted_at', 'model': 'VnfPackage', filters = {'field': 'deleted_at', 'model': 'VnfPackage',
'value': time_duration, 'value': time_duration,
@ -1893,8 +1893,7 @@ class Conductor(manager.Manager, v2_hook.ConductorV2Hook):
notification['links']['subscription']['href'] = \ notification['links']['subscription']['href'] = \
CONF.vnf_lcm.endpoint_url + \ CONF.vnf_lcm.endpoint_url + \
"/vnflcm/v1/subscriptions/" + line.id "/vnflcm/v1/subscriptions/" + line.id
notification['timeStamp'] = datetime.datetime.utcnow( notification['timeStamp'] = timeutils.utcnow().isoformat()
).isoformat()
try: try:
self.__set_auth_subscription(line) self.__set_auth_subscription(line)

View File

@ -16,12 +16,12 @@
"""Context: context for security/db session.""" """Context: context for security/db session."""
import copy import copy
import datetime
from castellan.common.credentials import keystone_password from castellan.common.credentials import keystone_password
from oslo_config import cfg from oslo_config import cfg
from oslo_context import context as oslo_context from oslo_context import context as oslo_context
from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import enginefacade
from oslo_utils import timeutils
from tacker.common import exceptions from tacker.common import exceptions
from tacker.common.ext_oauth2_auth import ExtOAuth2Auth from tacker.common.ext_oauth2_auth import ExtOAuth2Auth
@ -53,7 +53,7 @@ class ContextBase(oslo_context.RequestContext):
self.user_name = user_name self.user_name = user_name
if not timestamp: if not timestamp:
timestamp = datetime.datetime.utcnow() timestamp = timeutils.utcnow()
self.timestamp = timestamp self.timestamp = timestamp
# self.is_advsvc = is_advsvc # self.is_advsvc = is_advsvc
# if self.is_advsvc is None: # if self.is_advsvc is None:

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from datetime import datetime
from oslo_log import log as logging from oslo_log import log as logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import timeutils from oslo_utils import timeutils
@ -67,7 +65,7 @@ def _vnf_lcm_op_occ_update(context, values):
update = {'operation_state': values.operation_state, update = {'operation_state': values.operation_state,
'state_entered_time': values.state_entered_time, 'state_entered_time': values.state_entered_time,
'error_point': values.error_point, 'error_point': values.error_point,
'updated_at': datetime.utcnow()} 'updated_at': timeutils.utcnow()}
LOG.debug('values %s', values) LOG.debug('values %s', values)
if 'resource_changes' in values: if 'resource_changes' in values:
if values.resource_changes: if values.resource_changes:

View File

@ -13,9 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from datetime import datetime
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tacker.sol_refactored.common import exceptions as sol_ex from tacker.sol_refactored.common import exceptions as sol_ex
@ -61,7 +60,7 @@ def make_alarm_notif_data(subsc, alarm, endpoint):
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
notificationType="AlarmClearedNotification", notificationType="AlarmClearedNotification",
subscriptionId=subsc.id, subscriptionId=subsc.id,
timeStamp=datetime.utcnow(), timeStamp=timeutils.utcnow(),
alarmId=alarm.id, alarmId=alarm.id,
alarmClearedTime=alarm.alarmClearedTime, alarmClearedTime=alarm.alarmClearedTime,
_links=objects.AlarmClearedNotificationV1_Links( _links=objects.AlarmClearedNotificationV1_Links(
@ -76,7 +75,7 @@ def make_alarm_notif_data(subsc, alarm, endpoint):
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
notificationType="AlarmNotification", notificationType="AlarmNotification",
subscriptionId=subsc.id, subscriptionId=subsc.id,
timeStamp=datetime.utcnow(), timeStamp=timeutils.utcnow(),
alarm=alarm, alarm=alarm,
_links=objects.AlarmNotificationV1_Links( _links=objects.AlarmNotificationV1_Links(
subscription=objects.NotificationLink( subscription=objects.NotificationLink(

View File

@ -14,9 +14,8 @@
# under the License. # under the License.
from datetime import datetime
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tacker.sol_refactored.common import exceptions as sol_ex from tacker.sol_refactored.common import exceptions as sol_ex
@ -71,7 +70,7 @@ def make_lcmocc_notif_data(subsc, lcmocc, endpoint):
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
notificationType="VnfLcmOperationOccurrenceNotification", notificationType="VnfLcmOperationOccurrenceNotification",
subscriptionId=subsc.id, subscriptionId=subsc.id,
timeStamp=datetime.utcnow(), timeStamp=timeutils.utcnow(),
operationState=lcmocc.operationState, operationState=lcmocc.operationState,
vnfInstanceId=lcmocc.vnfInstanceId, vnfInstanceId=lcmocc.vnfInstanceId,
operation=lcmocc.operation, operation=lcmocc.operation,
@ -609,13 +608,13 @@ def check_lcmocc_in_progress(context, inst_id):
def update_lcmocc_status(lcmocc, op_state): def update_lcmocc_status(lcmocc, op_state):
lcmocc.operationState = op_state lcmocc.operationState = op_state
lcmocc.stateEnteredTime = datetime.utcnow() lcmocc.stateEnteredTime = timeutils.utcnow()
def new_lcmocc(inst_id, operation, req_body, def new_lcmocc(inst_id, operation, req_body,
op_state=fields.LcmOperationStateType.STARTING, op_state=fields.LcmOperationStateType.STARTING,
auto_invocation=False): auto_invocation=False):
now = datetime.utcnow() now = timeutils.utcnow()
lcmocc = objects.VnfLcmOpOccV2( lcmocc = objects.VnfLcmOpOccV2(
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,

View File

@ -18,7 +18,9 @@ import datetime
import iso8601 import iso8601
import sys import sys
from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tacker.common import exceptions from tacker.common import exceptions
from tacker import context from tacker import context
from tacker.db.db_sqlalchemy import api from tacker.db.db_sqlalchemy import api
@ -893,8 +895,8 @@ class TestDbMigrationToV2(SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,
stateEnteredTime=datetime.datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields_v2.LcmOperationType.INSTANTIATE, operation=fields_v2.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -906,8 +908,8 @@ class TestDbMigrationToV2(SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,
stateEnteredTime=datetime.datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields_v2.LcmOperationType.INSTANTIATE, operation=fields_v2.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,

View File

@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from datetime import datetime
from unittest import mock from unittest import mock
import ddt import ddt
from kubernetes import client from kubernetes import client
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tooz.drivers import file from tooz.drivers import file
@ -66,8 +66,8 @@ class TestConductorV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -99,8 +99,8 @@ class TestConductorV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_VNFPKG, operation=fields.LcmOperationType.CHANGE_VNFPKG,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -555,8 +555,8 @@ class TestConductorV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy import copy
from datetime import datetime
import os import os
import pickle import pickle
import subprocess import subprocess
from unittest import mock from unittest import mock
from kubernetes import client from kubernetes import client
from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tacker import context from tacker import context
@ -851,8 +851,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -943,8 +943,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1038,8 +1038,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1328,8 +1328,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.PROCESSING, operationState=fields.LcmOperationStateType.PROCESSING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
operation=fields.LcmOperationType.MODIFY_INFO, operation=fields.LcmOperationType.MODIFY_INFO,
isAutomaticInvocation=False, isAutomaticInvocation=False,
isCancelPending=False, isCancelPending=False,
@ -1458,8 +1458,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.PROCESSING, operationState=fields.LcmOperationStateType.PROCESSING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
operation=fields.LcmOperationType.MODIFY_INFO, operation=fields.LcmOperationType.MODIFY_INFO,
isAutomaticInvocation=False, isAutomaticInvocation=False,
isCancelPending=False, isCancelPending=False,
@ -1534,8 +1534,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_EXT_CONN, operation=fields.LcmOperationType.CHANGE_EXT_CONN,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1634,8 +1634,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.HEAL, operation=fields.LcmOperationType.HEAL,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1939,8 +1939,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.PROCESSING, operationState=fields.LcmOperationStateType.PROCESSING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_VNFPKG, operation=fields.LcmOperationType.CHANGE_VNFPKG,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2024,8 +2024,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2089,8 +2089,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2170,8 +2170,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_VNFPKG, operation=fields.LcmOperationType.CHANGE_VNFPKG,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2201,8 +2201,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_VNFPKG, operation=fields.LcmOperationType.CHANGE_VNFPKG,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2234,8 +2234,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2274,8 +2274,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2302,8 +2302,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2328,8 +2328,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.MODIFY_INFO, operation=fields.LcmOperationType.MODIFY_INFO,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2364,8 +2364,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2379,8 +2379,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2398,8 +2398,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2532,8 +2532,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2572,8 +2572,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2610,8 +2610,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2646,8 +2646,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2675,8 +2675,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2703,8 +2703,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2738,8 +2738,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2766,8 +2766,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2805,8 +2805,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2838,8 +2838,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2867,8 +2867,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2937,8 +2937,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2964,8 +2964,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3004,8 +3004,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3021,8 +3021,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3051,8 +3051,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.SCALE, operation=fields.LcmOperationType.SCALE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3090,8 +3090,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.HEAL, operation=fields.LcmOperationType.HEAL,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3117,8 +3117,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.HEAL, operation=fields.LcmOperationType.HEAL,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3157,8 +3157,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_EXT_CONN, operation=fields.LcmOperationType.CHANGE_EXT_CONN,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3187,8 +3187,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_EXT_CONN, operation=fields.LcmOperationType.CHANGE_EXT_CONN,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3271,8 +3271,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_VNFPKG, operation=fields.LcmOperationType.CHANGE_VNFPKG,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3368,8 +3368,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_EXT_CONN, operation=fields.LcmOperationType.CHANGE_EXT_CONN,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -3426,8 +3426,8 @@ class TestVnfLcmDriverV2(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.STARTING, operationState=fields.LcmOperationStateType.STARTING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_VNFPKG, operation=fields.LcmOperationType.CHANGE_VNFPKG,
isAutomaticInvocation=False, isAutomaticInvocation=False,

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy import copy
from datetime import datetime
import ddt import ddt
from http import client as http_client from http import client as http_client
import requests import requests
from unittest import mock from unittest import mock
from oslo_policy import policy as oslo_policy from oslo_policy import policy as oslo_policy
from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tacker.common.exceptions import PolicyNotAuthorized from tacker.common.exceptions import PolicyNotAuthorized
@ -830,8 +830,8 @@ class TestVnflcmV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1447,8 +1447,8 @@ class TestVnflcmV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.FAILED_TEMP, operationState=fields.LcmOperationStateType.FAILED_TEMP,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId='inst-1', vnfInstanceId='inst-1',
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1471,8 +1471,8 @@ class TestVnflcmV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.FAILED_TEMP, operationState=fields.LcmOperationStateType.FAILED_TEMP,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId='inst-1', vnfInstanceId='inst-1',
operation=fields.LcmOperationType.HEAL, operation=fields.LcmOperationType.HEAL,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1512,8 +1512,8 @@ class TestVnflcmV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.FAILED_TEMP, operationState=fields.LcmOperationStateType.FAILED_TEMP,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId='inst-1', vnfInstanceId='inst-1',
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -1536,8 +1536,8 @@ class TestVnflcmV2(db_base.SqlTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.FAILED_TEMP, operationState=fields.LcmOperationStateType.FAILED_TEMP,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId='inst-1', vnfInstanceId='inst-1',
operation=fields.LcmOperationType.HEAL, operation=fields.LcmOperationType.HEAL,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -2064,8 +2064,8 @@ class TestVnflcmV2EnhancedPolicy(TestVnflcmV2):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=op_state, operationState=op_state,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,

View File

@ -12,10 +12,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from datetime import datetime
import os import os
from unittest import mock from unittest import mock
from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from tacker import context from tacker import context
@ -696,8 +696,8 @@ class TestLocalNfvo(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.PROCESSING, operationState=fields.LcmOperationStateType.PROCESSING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.TERMINATE, operation=fields.LcmOperationType.TERMINATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -724,8 +724,8 @@ class TestLocalNfvo(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.PROCESSING, operationState=fields.LcmOperationStateType.PROCESSING,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.CHANGE_VNFPKG, operation=fields.LcmOperationType.CHANGE_VNFPKG,
isAutomaticInvocation=False, isAutomaticInvocation=False,
@ -759,8 +759,8 @@ class TestLocalNfvo(base.BaseTestCase):
# required fields # required fields
id=uuidutils.generate_uuid(), id=uuidutils.generate_uuid(),
operationState=fields.LcmOperationStateType.ROLLED_BACK, operationState=fields.LcmOperationStateType.ROLLED_BACK,
stateEnteredTime=datetime.utcnow(), stateEnteredTime=timeutils.utcnow(),
startTime=datetime.utcnow(), startTime=timeutils.utcnow(),
vnfInstanceId=inst.id, vnfInstanceId=inst.id,
operation=fields.LcmOperationType.INSTANTIATE, operation=fields.LcmOperationType.INSTANTIATE,
isAutomaticInvocation=False, isAutomaticInvocation=False,

View File

@ -15,7 +15,6 @@
import ast import ast
import copy import copy
from datetime import datetime
import functools import functools
import hashlib import hashlib
import inspect import inspect
@ -106,7 +105,7 @@ def revert_to_error_scale(function):
detail=str(ex)) detail=str(ex))
try: try:
timestamp = datetime.utcnow() timestamp = timeutils.utcnow()
vnf_lcm_op_occ = vnf_info['vnf_lcm_op_occ'] vnf_lcm_op_occ = vnf_info['vnf_lcm_op_occ']
vnf_lcm_op_occ.operation_state = 'FAILED_TEMP' vnf_lcm_op_occ.operation_state = 'FAILED_TEMP'
vnf_lcm_op_occ.state_entered_time = timestamp vnf_lcm_op_occ.state_entered_time = timestamp
@ -241,7 +240,7 @@ def revert_to_error_rollback(function):
detail=str(ex)) detail=str(ex))
try: try:
timestamp = datetime.utcnow() timestamp = timeutils.utcnow()
vnf_lcm_op_occ = vnf_info['vnf_lcm_op_occ'] vnf_lcm_op_occ = vnf_info['vnf_lcm_op_occ']
vnf_lcm_op_occ.operation_state = 'FAILED_TEMP' vnf_lcm_op_occ.operation_state = 'FAILED_TEMP'
vnf_lcm_op_occ.state_entered_time = timestamp vnf_lcm_op_occ.state_entered_time = timestamp
@ -1342,7 +1341,7 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
def scale_vnf(self, context, vnf_info, vnf_instance, scale_vnf_request): def scale_vnf(self, context, vnf_info, vnf_instance, scale_vnf_request):
LOG.info("Request received for scale vnf '%s'", vnf_instance.id) LOG.info("Request received for scale vnf '%s'", vnf_instance.id)
timestamp = datetime.utcnow() timestamp = timeutils.utcnow()
vnf_lcm_op_occ = vnf_info['vnf_lcm_op_occ'] vnf_lcm_op_occ = vnf_info['vnf_lcm_op_occ']
vnf_lcm_op_occ.operation_state = 'PROCESSING' vnf_lcm_op_occ.operation_state = 'PROCESSING'
@ -1810,7 +1809,7 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
vnf_lcm_op_occs.error_point = EP.VNF_CONFIG_START vnf_lcm_op_occs.error_point = EP.VNF_CONFIG_START
timestamp = datetime.utcnow() timestamp = timeutils.utcnow()
vnf_lcm_op_occs.operation_state = 'ROLLED_BACK' vnf_lcm_op_occs.operation_state = 'ROLLED_BACK'
vnf_lcm_op_occs.state_entered_time = timestamp vnf_lcm_op_occs.state_entered_time = timestamp
vnf_lcm_op_occs.resource_changes = resource_changes vnf_lcm_op_occs.resource_changes = resource_changes
@ -1844,7 +1843,7 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
vnf_info['after_scale_level'] = scale.scale_level vnf_info['after_scale_level'] = scale.scale_level
break break
timestamp = datetime.utcnow() timestamp = timeutils.utcnow()
vnf_lcm_op_occs.operation_state = 'ROLLING_BACK' vnf_lcm_op_occs.operation_state = 'ROLLING_BACK'
vnf_lcm_op_occs.state_entered_time = timestamp vnf_lcm_op_occs.state_entered_time = timestamp