def handle_volume_update(self, graph_db, body):
     """
     Handle the volume update events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     timestamp = time.time()
     uuid = body['payload']['volume_id']
     cinder_db = self.get_cinder_connection()
     volume = OpenstackResource(uuid)
     stack_uuid = volume.get_stack(graph_db)
     heat_db = None
     if stack_uuid:
         heat_db = self.get_heat_connection(self.config)
         keystone_db = self.get_keystone_db(self.config)
     OpenstackResource(uuid).remove_resource(graph_db)
     virtual_resources.add_cinder_volumes(cinder_db,
                                          graph_db,
                                          self.pop,
                                          timestamp,
                                          uuid=uuid)
     controller_hostname = config_section_map(
         'Openstack', self.config)['controller_hostname']
     if heat_db:
         virtual_resources.add_heat_stacks(heat_db,
                                           keystone_db,
                                           graph_db,
                                           self.pop,
                                           timestamp,
                                           controller_hostname,
                                           uuid=stack_uuid)
 def handle_network_delete(self, graph_db, body):
     """
     Handle the networks delete events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     uuid = body['payload']['network_id']
     OpenstackResource(uuid).remove_resource(graph_db)
 def handle_floatingip_delete(self, graph_db, body):
     """
     Handle the floatingIPs delete events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     uuid = body['payload']['floatingip_id']
     OpenstackResource(uuid).remove_resource(graph_db)
 def handle_stack_delete(self, graph_db, body):
     """
     Handle the stack delete events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     uuid = body['payload']['stack_identity'].rsplit('/', 1)[1]
     OpenstackResource(uuid).remove_resource(graph_db)
 def handle_volume_update(self, graph_db, body):
     """
     Handle the volume update events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     timestamp = time.time()
     uuid = body['payload']['volume_id']
     cinder_db = self.get_cinder_connection()
     volume = OpenstackResource(uuid)
     stack_uuid = volume.get_stack(graph_db)
     heat_db = None
     if stack_uuid:
         heat_db = self.get_heat_connection(self.config)
         keystone_db = self.get_keystone_db(self.config)
     OpenstackResource(uuid).remove_resource(graph_db)
     virtual_resources.add_cinder_volumes(cinder_db, graph_db, self.pop, timestamp, uuid=uuid)
     controller_hostname = config_section_map('Openstack', self.config)['controller_hostname']
     if heat_db:
         virtual_resources.add_heat_stacks(heat_db, keystone_db, graph_db, self.pop,
                                           timestamp, controller_hostname, uuid=stack_uuid)
 def handle_instance_delete(self, graph_db, body):
     """
     Handle the instances delete events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     timestamp = time.time()
     uuid = body["payload"]['instance_id']
     OpenstackResource(uuid).remove_resource(graph_db)
     nova_db = self.get_nova_connection()
     if 'host' in body["payload"] and body["payload"]['host']:
         virtual_resources.add_nova_hypervisors(nova_db, graph_db, self.pop,
                                                timestamp, hostname=body["payload"]['host'])
 def handle_snapshot_update(self, graph_db, body):
     """
     Handle the snapshot update events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     timestamp = time.time()
     uuid = body['payload']['snapshot_id']
     cinder_db = self.get_cinder_connection()
     OpenstackResource(uuid).remove_resource(graph_db)
     virtual_resources.add_cinder_snapshots(cinder_db,
                                            graph_db,
                                            self.pop,
                                            timestamp,
                                            uuid=uuid)
 def handle_router_delete(self, graph_db, body):
     """
     Handle the routers delete events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     uuid = body['payload']['router_id']
     router = OpenstackResource(uuid)
     router.remove_neighbours(graph_db, neighbour_type='port')
     router.remove_resource(graph_db)
 def update_router(self, graph_db, neutron_db, uuid, timestamp):
     """
     Update Neutron Routers
     :param graph_db: Instance of Graph DB
     :param neutron_db: Instance of NeutronDB
     :param uuid: UUID of the router to be updated
     :param timestamp: timestamp in epoch
     """
     if uuid:
         router = OpenstackResource(uuid)
         router.remove_neighbours(graph_db, neighbour_type='port')
         router.remove_resource(graph_db)
         virtual_resources.add_neutron_routers(neutron_db, graph_db, self.pop, timestamp, uuid=uuid)
 def handle_stack_update(self, graph_db, body):
     """
     Handle the stack update events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     timestamp = time.time()
     uuid = body['payload']['stack_identity'].rsplit('/', 1)[1]
     heat_db = self.get_heat_connection()
     keystone_db = self.get_keystone_db(self.config)
     controller_hostname = config_section_map(
         'Openstack', self.config)['controller_hostname']
     OpenstackResource(uuid).remove_resource(graph_db)
     virtual_resources.add_heat_stacks(heat_db,
                                       keystone_db,
                                       graph_db,
                                       self.pop,
                                       timestamp,
                                       controller_hostname,
                                       uuid=uuid)