def _notify_cfg_agent_port_update(resource, event, trigger, **kwargs):
    """Called when router port/interface is enabled/disabled"""
    original_port = kwargs.get('original_port')
    updated_port = kwargs.get('port')
    if (updated_port is not None and original_port is not None and (
       updated_port.get('admin_state_up')) != (
           original_port.get('admin_state_up'))):
        new_port_data = {'port': {}}
        new_port_data['port']['admin_state_up'] = (
            updated_port.get('admin_state_up'))
        original_device_owner = original_port.get('device_owner', '')
        if original_device_owner.startswith('network'):
            router_id = original_port.get('device_id')
            context = kwargs.get('context')
            l3plugin = bc.get_plugin(L3_ROUTER_NAT)
            if l3plugin and router_id:
                l3plugin._notify_port_update_routers(context, router_id,
                                                     original_port,
                                                     new_port_data,
                                                     'update_port_status_cfg')
def _notify_cfg_agent_port_update ( resource , event , trigger , ** kwargs ) : original_port = kwargs . get ( 'original_port' ) updated_port = kwargs . get ( 'port' ) if ( updated_port is not None and original_port is not None and ( updated_port . get ( 'admin_state_up' ) ) != ( original_port . get ( 'admin_state_up' ) ) ) : new_port_data = { 'port' : { } } new_port_data [ 'port' ] [ 'admin_state_up' ] = ( updated_port . get ( 'admin_state_up' ) ) original_device_owner = original_port . get ( 'device_owner' , '' ) if original_device_owner . startswith ( 'network' ) : router_id = original_port . get ( 'device_id' ) context = kwargs . get ( 'context' ) l3plugin = bc . get_plugin ( L3_ROUTER_NAT ) if l3plugin and router_id : l3plugin . _notify_port_update_routers ( context , router_id , original_port , new_port_data , 'update_port_status_cfg' )
Called when router port/interface is enabled/disabled