1 # ============LICENSE_START=======================================================
2 # Copyright (C) 2021 Orange
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # ============LICENSE_END=========================================================
21 from io import BytesIO
23 from onapsdk.cds import Blueprint
25 from config import Config, VariablesDict
27 logger = logging.getLogger()
28 logger.setLevel(logging.DEBUG)
32 mypath = os.path.dirname(os.path.realpath(__file__))
33 file_path = os.path.join(mypath, file)
35 with zipfile.ZipFile(file_path, 'r') as package:
36 cba_io = BytesIO(package.read("CBA.zip"))
38 blueprint = Blueprint(cba_io)
40 except FileNotFoundError:
41 logger.error("Error - File Not Found")
46 config = Config(env_dict=VariablesDict.env_variable)
47 for vnf in config.service_model["vnfs"]:
48 update_cba(vnf["vsp"]["vsp_file"])
51 if __name__ == "__main__":
52 sh = logging.StreamHandler()
53 sh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s')
54 sh.setFormatter(sh_formatter)