- # if args.vnf_ip and \
- # ('clearwater-aio' in args.directory):
- # # Execute config on charm
- # api._apply_config({'proxied_ip': args.vnf_ip})
- #
- # while not api._is_service_active():
- # time.sleep(10)
- #
- # print ("Service {} is in status {}".
- # format(args.service, api._get_service_status()))
- #
- # res = api._execute_action('create-update-user', {'number': '125252352525',
- # 'password': 'asfsaf'})
- #
- # print ("Action 'creat-update-user response: {}".format(res))
- #
- # status = res['status']
- # while status not in [ 'completed', 'failed' ]:
- # time.sleep(2)
- # status = api._get_action_status(res['action']['tag'])['status']
- #
- # print("Action status: {}".format(status))
- #
- # # This action will fail as the number is non-numeric
- # res = api._execute_action('delete-user', {'number': '125252352525asf'})
- #
- # print ("Action 'delete-user response: {}".format(res))
- #
- # status = res['status']
- # while status not in [ 'completed', 'failed' ]:
- # time.sleep(2)
- # status = api._get_action_status(res['action']['tag'])['status']
- #
- # print("Action status: {}".format(status))
+if __name__ == "__main__":
+ # Create a single event loop for running code asyncronously.
+ loop = asyncio.get_event_loop()
+
+ # An initial set of tasks to run
+ tasks = [
+ deploy_charm_and_wait(),
+ ]
+
+ # TODO: optionally run forever and use a Watcher to monitor what's happening
+ loop.run_until_complete(asyncio.wait(tasks))