def _check_lb_service_on_router_interface(self, resource, event, trigger, payload=None):
    router_id = payload.resource_id
    subnet_id = payload.metadata.get('subnet_id')
    if ((not router_id) or (not subnet_id)):
        return
    nsx_router_id = nsx_db.get_nsx_router_id(payload.context.session, router_id)
    if (not nsx_router_id):
        return
    if self._get_lb_ports(payload.context.elevated(), [subnet_id]):
        msg = _('Cannot delete a router interface as it used by a loadbalancer')
        raise n_exc.BadRequest(resource='lbaas-lb', msg=msg)
def _check_lb_service_on_router_interface(self, resource, event, trigger, payload=None):
    router_id = payload.resource_id
    subnet_id = payload.metadata.get('subnet_id')
    if ((not router_id) or (not subnet_id)):
        return
    nsx_router_id = nsx_db.get_nsx_router_id(payload.context.session, router_id)
    if (not nsx_router_id):
        return
    if self._get_lb_ports(payload.context.elevated(), [subnet_id]):
        msg = _('Cannot delete a router interface as it used by a loadbalancer')
        raise n_exc.BadRequest(resource='lbaas-lb', msg=msg)