def _cb_dcnm_msg(self, method, body):
        """Callback function to process DCNM network creation/update/deletion
        message received by AMQP.

        It also communicates with DCNM to extract info for CPNR record
        insertion/deletion.

        :param pika.channel.Channel ch: The channel instance.
        :param pika.Spec.Basic.Deliver method: The basic deliver method
                                               which includes routing key.
        :param pika.Spec.BasicProperties properties: properties
        :param str body: The message body.
        """
        LOG.debug('Routing_key: %(key)s, body: %(body)s.',
                  {'key': method.routing_key, 'body': body})
        partition_keyword = 'auto-config.organization.partition'
        network_keyword = partition_keyword + '.network'

        network_create_key = network_keyword + '.create'
        network_update_key = network_keyword + '.update'
        msg = jsonutils.loads(body)
        LOG.debug('_cb_dcnm_msg: RX message: %s', msg)

        if not msg:
            LOG.debug("error, return")
            return

        url = msg['link']
        url_fields = url.split('/')
        pre_project_name = url_fields[4]
        pre_partition_name = url_fields[6]
        pre_seg_id = url_fields[9]
        data = {"project_name": pre_project_name,
                "partition_name": pre_partition_name,
                "segmentation_id": pre_seg_id}
        if network_create_key in method.routing_key or (
                network_update_key in method.routing_key):
            pri = self._create_pri
            event_type = 'dcnm.network.create'
        else:
            pri = self._delete_pri
            event_type = 'dcnm.network.delete'

        if self._pq is not None:
            payload = (event_type, data)
            self._pq.put((pri, time.ctime, payload))
def _cb_dcnm_msg ( self , method , body ) : LOG . debug ( 'Routing_key: %(key)s, body: %(body)s.' , { 'key' : method . routing_key , 'body' : body } ) partition_keyword = 'auto-config.organization.partition' network_keyword = partition_keyword + '.network' network_create_key = network_keyword + '.create' network_update_key = network_keyword + '.update' msg = jsonutils . loads ( body ) LOG . debug ( '_cb_dcnm_msg: RX message: %s' , msg ) if not msg : LOG . debug ( "error, return" ) return url = msg [ 'link' ] url_fields = url . split ( '/' ) pre_project_name = url_fields [ 4 ] pre_partition_name = url_fields [ 6 ] pre_seg_id = url_fields [ 9 ] data = { "project_name" : pre_project_name , "partition_name" : pre_partition_name , "segmentation_id" : pre_seg_id } if network_create_key in method . routing_key or ( network_update_key in method . routing_key ) : pri = self . _create_pri event_type = 'dcnm.network.create' else : pri = self . _delete_pri event_type = 'dcnm.network.delete' if self . _pq is not None : payload = ( event_type , data ) self . _pq . put ( ( pri , time . ctime , payload ) )
Callback function to process DCNM network creation/update/deletion
        message received by AMQP.

        It also communicates with DCNM to extract info for CPNR record
        insertion/deletion.

        :param pika.channel.Channel ch: The channel instance.
        :param pika.Spec.Basic.Deliver method: The basic deliver method
                                               which includes routing key.
        :param pika.Spec.BasicProperties properties: properties
        :param str body: The message body.