def _cmp_by_router_id(local_asn, path1, path2):
    def get_asn(path_source):
        if path_source is None:
            return local_asn
        else:
            return path_source.remote_as

    def get_router_id(path_source, local_bgp_id):
        if path_source is None:
            return local_bgp_id
        else:
            return path_source.protocol.recv_open_msg.bgp_identifier

    path_source1 = path1.source
    path_source2 = path2.source

    # If both paths are from NC we have same router Id, hence cannot compare.
    if path_source1 is None and path_source2 is None:
        return None

    asn1 = get_asn(path_source1)
    asn2 = get_asn(path_source2)

    is_ebgp1 = asn1 != local_asn
    is_ebgp2 = asn2 != local_asn
    # If both paths are from eBGP peers, then according to RFC we need
    # not tie break using router id.
    if (is_ebgp1 and is_ebgp2):
        return None

    if ((is_ebgp1 is True and is_ebgp2 is False) or
            (is_ebgp1 is False and is_ebgp2 is True)):
        raise ValueError('This method does not support comparing ebgp with'
                         ' ibgp path')

    # At least one path is not coming from NC, so we get local bgp id.
    if path_source1 is not None:
        local_bgp_id = path_source1.protocol.sent_open_msg.bgp_identifier
    else:
        local_bgp_id = path_source2.protocol.sent_open_msg.bgp_identifier

    # Get router ids.
    router_id1 = get_router_id(path_source1, local_bgp_id)
    router_id2 = get_router_id(path_source2, local_bgp_id)

    # If both router ids are same/equal we cannot decide.
    # This case is possible since router ids are arbitrary.
    if router_id1 == router_id2:
        return None

    # Select the path with lowest router Id.
    from ryu.services.protocols.bgp.utils.bgp import from_inet_ptoi
    if (from_inet_ptoi(router_id1) < from_inet_ptoi(router_id2)):
        return path1
    else:
        return path2
Return the offspring of Laplace crossover on the candidates.
dataset/ETHPy150Open osrg/ryu/ryu/services/protocols/bgp/processor.py/_cmp_by_router_id--crossover with--dataset/ETHPy150Open aarongarrett/inspyred/inspyred/ec/variators/crossovers.py/laplace_crossover