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__)
24 class ResCreateThread(threading.Thread):
28 def __init__(self, req_data):
29 threading.Thread.__init__(self)
34 adaptor.create_vim_res(self.data, self.do_notify)
36 logger.error(traceback.format_exc())
37 logger.error(str(sys.exc_info()))
39 def do_notify(self, res_type, ret):
40 logger.debug('ret of [%s] is %s', res_type, ret)
42 class ResDeleteThread(threading.Thread):
46 def __init__(self, req_data):
47 threading.Thread.__init__(self)
52 adaptor.delete_vim_res(self.data, self.do_notify)
54 logger.error(traceback.format_exc())
55 logger.error(str(sys.exc_info()))
57 def do_notify(self, res_type, res_id):
58 logger.debug('Delete %s(%s)', res_type, res_id)