1 # Copyright 2017 ZTE Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
20 from lcm.pub.vimapi import adaptor
22 logger = logging.getLogger(__name__)
25 class ResCreateThread(threading.Thread):
29 def __init__(self, req_data):
30 threading.Thread.__init__(self)
35 adaptor.create_vim_res(self.data, self.do_notify)
37 logger.error(traceback.format_exc())
38 logger.error(str(sys.exc_info()))
40 def do_notify(self, res_type, ret):
41 logger.debug('ret of [%s] is %s', res_type, ret)
44 class ResDeleteThread(threading.Thread):
48 def __init__(self, req_data):
49 threading.Thread.__init__(self)
54 adaptor.delete_vim_res(self.data, self.do_notify)
56 logger.error(traceback.format_exc())
57 logger.error(str(sys.exc_info()))
59 def do_notify(self, res_type, res_id):
60 logger.debug('Delete %s(%s)', res_type, res_id)