diff options
author | 2020-02-12 10:19:49 +0000 | |
---|---|---|
committer | 2020-02-12 10:19:49 +0000 | |
commit | 296f6a9817c28d9453fe697ae3dae6af37610eec (patch) | |
tree | 8162891083c08fe6a7bfadd28b6bbc845246102f /components/pm-subscription-handler/pmsh_service/pmsh_service.py | |
parent | bd620f2f55d10fc256efeae8429947ce29337afb (diff) | |
parent | 8b3fc62050a344fe9a9c8909e4c672cb9aa3281d (diff) |
Merge "Adding DB Init and setup"
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/pmsh_service.py')
-rwxr-xr-x | components/pm-subscription-handler/pmsh_service/pmsh_service.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/pmsh_service.py b/components/pm-subscription-handler/pmsh_service/pmsh_service.py index d8a593fb..99689d01 100755 --- a/components/pm-subscription-handler/pmsh_service/pmsh_service.py +++ b/components/pm-subscription-handler/pmsh_service/pmsh_service.py @@ -15,17 +15,34 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END===================================================== +import sys import time +import mod.aai_client as aai_client import mod.pmsh_logging as logger +from mod import db, create_prod_app +from mod.config_handler import ConfigHandler +from mod.subscription import Subscription def main(): - logger.create_loggers() + + try: + app = create_prod_app() + app.app_context().push() + db.create_all(app=app) + + config_handler = ConfigHandler() + cbs_data = config_handler.get_config() + subscription, xnfs = aai_client.get_pmsh_subscription_data(cbs_data) + subscription.add_network_functions_to_subscription(xnfs) + except Exception as e: + logger.debug(f'Failed to Init PMSH: {e}') + sys.exit(e) while True: - time.sleep(30) - logger.debug("He's not the messiah, he's a very naughty boy!") + logger.debug(Subscription.get_all_nfs_subscription_relations()) + time.sleep(5) if __name__ == '__main__': |