1 from dashboard_notification.notification import Notification
2 from dashboard_api.api import DashboardAPI
5 'dashboard_ip': '127.0.0.1',
6 'dashboard_url': 'http://127.0.0.1',
7 'api_token': 'f33ff43c85ecb13f5d0632c05dbb0a7d85a5a8d1',
9 'password': 'opnfvopnfv'
12 api = DashboardAPI(CONFIG['dashboard_url'], api_token=CONFIG['api_token'], verbose=True)
15 def booking_start(message):
16 content = message.content
17 booking = api.get_booking(id=content['booking_id'])
19 # do something here...
22 api.post_resource_status(resource_id=booking['resource_id'], type='info', title='pod setup',
26 def booking_end(message):
27 # do something here...
30 api.post_resource_status(resource_id=message.content['resource_id'], type='info',
31 title='booking end', content='details')
35 with Notification(CONFIG['dashboard_ip'], CONFIG['user'], CONFIG['password']) as notification:
36 notification.register(booking_start, 'Arm POD 2', 'booking_start')
37 notification.register(booking_end, 'Arm POD 2', 'booking_end')
38 notification.receive() # wait for notifications
41 if __name__ == "__main__":