def handle_port_update(self, graph_db, body):
     """
     Handle the ports update events
     :param graph_db: Instance of Graph DB
     :param body: event body
     """
     timestamp = time.time()
     uuid = body['payload']['port']['id']
     neutron_db = self.get_neutron_connection()
     virtual_resources.add_ports(neutron_db, graph_db, self.pop, timestamp, uuid=uuid, update=True)
    def handle_port_create(self, graph_db, body):
        """
        Handle the ports create events
        :param graph_db: Instance of Graph DB
        :param body: event body
        """

        timestamp = time.time()
        uuid = body['payload']['port']['id']
        neutron_db = self.get_neutron_connection()
        port_node = virtual_resources.add_ports(neutron_db, graph_db, self.pop, timestamp, uuid=uuid)
        if port_node and 'network_id' in port_node.properties['attributes']:
            port_node_attributes = json.loads(port_node.properties['attributes'])
            virtual_resources.add_networks(neutron_db,
                                           graph_db,
                                           self.pop,
                                           timestamp,
                                           uuid=port_node_attributes['network_id'],
                                           update=True)