#NEWLINE# def _update_arp_entry( self , ip , mac , subnet_id , operation ) : #NEWLINE# #INDENT# 'Add or delete arp entry into router namespace for the subnet.' #NEWLINE# port = self . _get_internal_port ( subnet_id ) #NEWLINE# if ( not port ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# interface_name = self . get_internal_device_name ( port [ 'id' ] ) #NEWLINE# device = ip_lib . IPDevice ( interface_name , namespace = self . ns_name ) #NEWLINE# if device . exists ( ) : #NEWLINE# #INDENT# if ( operation == 'add' ) : #NEWLINE# #INDENT# device . neigh . add ( ip , mac ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( operation == 'delete' ) : #NEWLINE# #INDENT# device . neigh . delete ( ip , mac ) #NEWLINE# #UNINDENT# #UNINDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( operation == 'add' ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Device %s does not exist so ARP entry cannot be updated, will cache information to be applied later when the device exists' ) , device ) #NEWLINE# self . _cache_arp_entry ( ip , mac , subnet_id , operation ) #NEWLINE# #UNINDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# with excutils . save_and_reraise_exception ( ) : #NEWLINE# #INDENT# LOG . exception ( _LE ( 'DVR: Failed updating arp entry' ) )