1 # Copyright 2016 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.
16 from lcm.pub.database.models import FPInstModel
18 logger = logging.getLogger(__name__)
21 def sfc_inst_failed_handle(fp_inst_id, error_msg):
22 logger.error('create sfc failed, detail message: %s' % error_msg)
23 FPInstModel.objects.filter(fpid=fp_inst_id).update(status="disabled").get()
26 def ignorcase_get(args, key):
32 if oldkey.upper() == key.upper():
44 def get_fp_id(fpindex, ns_model):
45 index = int(int(float(fpindex)) - 1)
46 return ns_model['fps'][index].get("fp_id")
49 def update_fp_status(fp_inst_id, status_info):
50 FPInstModel.objects.filter(fpinstid=fp_inst_id).update(status=status_info)
53 def get_fp_model_by_fp_inst_id(ns_model_data, fp_inst_id):
54 fp_databas_info = FPInstModel.objects.filter(fpinstid=fp_inst_id).get()
55 fps_model = ns_model_data["fps"]
56 for fp_model in fps_model:
57 if fp_model["fp_id"] == fp_databas_info.fpid: