Skip to content

Bgp status pre check

A module that returns the partners available in GSO.

get_bgp_status_pre_check(peer_address)

Retrieve the latest BGP status pre-check result for a given peer.

Source code in gso/services/bgp_status_pre_check.py
def get_bgp_status_pre_check(peer_address: str) -> dict[str, Any]:
    """Retrieve the latest BGP status pre-check result for a given peer."""
    cols = list(BgpStatusPreCheckTable.__table__.columns)
    col_names = [c.name for c in cols]

    row = (
        db.session.query(*cols)
        .filter(BgpStatusPreCheckTable.peer_address == peer_address)
        .order_by(BgpStatusPreCheckTable.created_at.desc())
        .first()
    )

    if row is None:
        return {}

    return dict(zip(col_names, row, strict=False))