#NEWLINE# def _cb_dcnm_msg( self , method , body ) : #NEWLINE# #INDENT# 'Callback function to process DCNM network creation/update/deletion\n        message received by AMQP.\n\n        It also communicates with DCNM to extract info for CPNR record\n        insertion/deletion.\n\n        :param pika.channel.Channel ch: The channel instance.\n        :param pika.Spec.Basic.Deliver method: The basic deliver method\n                                               which includes routing key.\n        :param pika.Spec.BasicProperties properties: properties\n        :param str body: The message body.\n        ' #NEWLINE# LOG . debug ( 'Routing_key: %(key)s, body: %(body)s.' , { #NEWLINE# #INDENT# 'key' : method . routing_key , #NEWLINE# 'body' : body , #NEWLINE# #UNINDENT# } ) #NEWLINE# partition_keyword = 'auto-config.organization.partition' #NEWLINE# network_keyword = ( partition_keyword + '.network' ) #NEWLINE# network_create_key = ( network_keyword + '.create' ) #NEWLINE# network_update_key = ( network_keyword + '.update' ) #NEWLINE# msg = jsonutils . loads ( body ) #NEWLINE# LOG . debug ( '_cb_dcnm_msg: RX message: %s' , msg ) #NEWLINE# if ( not msg ) : #NEWLINE# #INDENT# LOG . debug ( 'error, return' ) #NEWLINE# return #NEWLINE# #UNINDENT# url = msg [ 'link' ] #NEWLINE# url_fields = url . split ( '/' ) #NEWLINE# pre_project_name = url_fields [ 4 ] #NEWLINE# pre_partition_name = url_fields [ 6 ] #NEWLINE# pre_seg_id = url_fields [ 9 ] #NEWLINE# data = { #NEWLINE# #INDENT# 'project_name' : pre_project_name , #NEWLINE# 'partition_name' : pre_partition_name , #NEWLINE# 'segmentation_id' : pre_seg_id , #NEWLINE# #UNINDENT# } #NEWLINE# if ( ( network_create_key in method . routing_key ) or ( network_update_key in method . routing_key ) ) : #NEWLINE# #INDENT# pri = self . _create_pri #NEWLINE# event_type = 'dcnm.network.create' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pri = self . _delete_pri #NEWLINE# event_type = 'dcnm.network.delete' #NEWLINE# #UNINDENT# if ( self . _pq is not None ) : #NEWLINE# #INDENT# payload = ( event_type , data ) #NEWLINE# self . _pq . put ( ( pri , time . ctime , payload ) )