Enbo Wang | 818f76a | 2020-03-04 00:42:31 +0800 | [diff] [blame^] | 1 | #!/usr/bin/python3 |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # ONAP - SO |
| 4 | # ================================================================================ |
| 5 | # Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. |
| 6 | # ================================================================================ |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # ============LICENSE_END========================================================= |
Enbo Wang | 6ab8b62 | 2019-04-23 13:42:21 +0000 | [diff] [blame] | 19 | |
Enbo Wang | 818f76a | 2020-03-04 00:42:31 +0800 | [diff] [blame^] | 20 | import sys |
Enbo Wang | 6ab8b62 | 2019-04-23 13:42:21 +0000 | [diff] [blame] | 21 | import argparse |
| 22 | import json |
Enbo Wang | 6ab8b62 | 2019-04-23 13:42:21 +0000 | [diff] [blame] | 23 | |
| 24 | import conf |
| 25 | import ems_util |
Enbo Wang | 818f76a | 2020-03-04 00:42:31 +0800 | [diff] [blame^] | 26 | import sw_fallback |
Enbo Wang | 6ab8b62 | 2019-04-23 13:42:21 +0000 | [diff] [blame] | 27 | |
| 28 | |
| 29 | def main(): |
| 30 | parser = argparse.ArgumentParser() |
| 31 | |
| 32 | parser.add_argument("--filter", help="To describe properties of the NEs to be selected", required=True) |
| 33 | |
| 34 | args = parser.parse_args() |
| 35 | |
| 36 | ne_info_list = ems_util.get_ne_info_list_from_db(args.filter) |
| 37 | |
Enbo Wang | 818f76a | 2020-03-04 00:42:31 +0800 | [diff] [blame^] | 38 | ret_value = sw_fallback.fallback(ne_info_list) |
| 39 | print(json.dumps(ret_value)) |
Enbo Wang | 6ab8b62 | 2019-04-23 13:42:21 +0000 | [diff] [blame] | 40 | |
| 41 | if ret_value["result"] == conf.RESULT_SUCCESS: |
| 42 | sys.exit(conf.RET_CODE_SUCCESS) |
| 43 | else: |
| 44 | sys.exit(conf.RET_CODE_FAILURE) |
| 45 | |
| 46 | |
| 47 | if __name__ == '__main__': |
| 48 | main() |