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:
- Install or update to the latest version of the Google Cloud CLI .
- 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
-
In the Google Cloud console, go to the Cloud Routerpage.
-
On the Cloud Routerpage, click the BGP Route Policiestab.
-
To view the BGP route policy terms for a BGP route policy, click the BGP route policy name.
gcloud
Use the gcloud compute routers list-route-policies
command
:
gcloud 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/v1/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="
}
]
}

