List BGP route policies

This page describes how to list Border Gateway Protocol (BGP) route policies on Cloud Router, which can help you troubleshoot your BGP route policies.

Before you begin

gcloud

If you want to use the command-line examples in this guide, do the following:

  1. Install or update to the latest version of the Google Cloud CLI.
  2. Set a default region and zone.

API

If you want to use the API examples in this guide, set up API access.

List BGP route policies

Console

  1. In the Google Cloud console, go to the Cloud Router page.

    Go to Cloud Router

  2. On the Cloud Router page, click the BGP sessions tab.

  3. On the BGP sessions tab, click the name of the BGP session that you want to list BGP route policies for. The BGP session details page is displayed. On the BGP session details page, BGP route policies are listed in the BGP route policies section.

  4. To view the BGP route policy terms for a BGP route policy, click the BGP route policy name.

gcloud

Use the gcloud beta compute routers list-route-policies command:

gcloud beta compute routers list-route-policies ROUTER_NAME \
    --region=REGION

Replace the following:

  • ROUTER_NAME: the name of your Cloud Router

  • REGION: the region in which your Cloud Router is located

The output is similar to the following:

NAME: test-policy-1
TYPE: ROUTE_POLICY_TYPE_EXPORT

NAME: test-policy-2
TYPE: ROUTE_POLICY_TYPE_IMPORT

API

Use the routers.listRoutePolicies method:

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME/listRoutePolicies

Replace the following:

  • PROJECT_ID: the project that contains your Cloud Router

  • REGION: the region in which your Cloud Router is located

  • ROUTER_NAME: the name of your Cloud Router

The output is similar to the following:

{
  "kind": "compute#routersListRoutePolicies",
  "result": [
    {
      "name": "ROUTER_NAME",
      "type": "ROUTE_POLICY_TYPE_IMPORT",
      "terms": [
        {
          "priority": 1,
          "match": {
            "expression": "destination != \"192.168.10.0/24\" && communities.matchesEvery([\"65000:1\", \"65000:2\"])"
          },
          "actions": [
            {
              "expression": "med.set(12345)"
            }
          ]
        },
        {
          "priority": 2,
          "match": {
            "expression": "destination != \"192.168.10.0/24\""
          },
          "actions": [
            {
              "expression": "med.set(12345)"
            }
          ]
        }
      ],
      "fingerprint": "ulgdg-dGCms="
    }
  ]
}