#NEWLINE# def _update_port_up( self , context ) : #NEWLINE# #INDENT# port = context . current #NEWLINE# agent_host = context . host #NEWLINE# session = db_api . get_session ( ) #NEWLINE# agent = l2pop_db . get_agent_by_host ( session , agent_host ) #NEWLINE# if ( not agent ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Unable to retrieve active L2 agent on host %s' ) , agent_host ) #NEWLINE# return #NEWLINE# #UNINDENT# network_id = port [ 'network_id' ] #NEWLINE# agent_active_ports = l2pop_db . get_agent_network_active_port_count ( session , agent_host , network_id ) #NEWLINE# agent_ip = l2pop_db . get_agent_ip ( agent ) #NEWLINE# segment = context . bottom_bound_segment #NEWLINE# if ( not self . _validate_segment ( segment , port [ 'id' ] , agent ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# other_fdb_entries = self . _get_fdb_entries_template ( segment , agent_ip , network_id ) #NEWLINE# other_fdb_ports = other_fdb_entries [ network_id ] [ 'ports' ] #NEWLINE# if ( ( agent_active_ports == 1 ) or ( l2pop_db . get_agent_uptime ( agent ) < cfg . CONF . l2pop . agent_boot_time ) ) : #NEWLINE# #INDENT# agent_fdb_entries = self . _create_agent_fdb ( session , agent , segment , network_id ) #NEWLINE# other_fdb_ports [ agent_ip ] . append ( const . FLOODING_ENTRY ) #NEWLINE# if agent_fdb_entries [ network_id ] [ 'ports' ] . keys ( ) : #NEWLINE# #INDENT# self . L2populationAgentNotify . add_fdb_entries ( self . rpc_ctx , agent_fdb_entries , agent_host ) #NEWLINE# #UNINDENT# #UNINDENT# if ( port [ 'device_owner' ] != const . DEVICE_OWNER_DVR_INTERFACE ) : #NEWLINE# #INDENT# other_fdb_ports [ agent_ip ] += self . _get_port_fdb_entries ( port ) #NEWLINE# #UNINDENT# self . L2populationAgentNotify . add_fdb_entries ( self . rpc_ctx , other_fdb_entries )