Route management

CSN

  • API Reference
    • API function release records
    • Appendix
    • Bandwidth Package Related
      • Bandwidth package price inquiry
      • Bandwidth upgrade-downgrade for the bandwidth package
      • Bind a bandwidth package to a Cloud Smart Network
      • Create bandwidth package
      • Delete bandwidth package
      • Query bandwidth package list
      • Query the specified bandwidth package details
      • Unbind a bandwidth package from a Cloud Smart Network
      • Update bandwidth package
    • Cloud Smart Network Related
      • Create a Cloud Smart Network
      • Delete a Cloud Smart Network
      • Network instances loaded by the Cloud Smart Network
      • Network instances unloaded by the Cloud Smart Network
      • Query Cloud Smart Network details
      • Query Cloud Smart Network instance list
      • Query the list of Cloud Smart Network
      • Update a Cloud Smart Network
    • Common Headers and Error Responses
    • General Description
    • Ingress Management Related Interfaces
      • Add a routing entry
      • Create affiliation
      • Create learning relationship
      • Delete a learning relationship
      • Delete a routing entry
      • Delete an association relationship
      • Query association relationships
      • Query learning relationships
      • Query route table list
      • Query routing entries
    • Interface Overview
    • Region Bandwidth Related Interfaces
      • Create cross-region bandwidth
      • Delete cross-region bandwidth
      • Query cross-region bandwidth
      • Query the cross-region bandwidth of the specified Cloud Smart Network
      • Update cross-region bandwidth
    • Service domain
    • TGW Related Interfaces
      • Query routing entries of a TGW
      • Query TGW list
      • Update TGW information
  • FAQs
    • Consultation
  • Function Release Records
  • Operation guide
    • Cross-Account Authorization Management
      • Cancel Authorized Network Instance
      • Create Authorized Network Instance
      • Delete Authorized Network Instance
      • View Authorized Network Instance
    • Cross-Region Bandwidth Package Management
    • CSN Instance
      • Create CSN Instance
      • Delete CSN Instance
      • Modify CSN Instance
    • Identity and access management
    • Monitor and Operations
      • CSN Instance Diagnosis
    • Network instance
      • Add Cross-Account Network Instance
      • Add Local Account Network Instance
      • Adjust Network Instance Bandwidth
      • Uninstall Network Instance
    • Region Bandwidth Management
      • Adjust Region Bandwidth
      • Create cross-region bandwidth
      • Delete cross-region bandwidth
    • Route management
      • Association Relationship
        • Create affiliation
        • Delete affiliation
      • Custom route tables
        • Create custom route table
        • Delete custom route table
        • View Custom Route Table
      • Learning Relationship
        • Add Custom Route Entry
        • Create learning relationship
        • Delete Custom Route Entry
        • Delete learning relationship
        • Publish and Revoke Network Instance Route
        • View Route Entry
    • Tag Management
  • Product Description
    • Application scenarios
    • Introduction
    • Usage restrictions
  • Product pricing
  • SDK
    • GO-SDK
      • Bandwidth package
      • CSN Instance
      • Exception handling
      • Initialization
      • Install
      • Overview
      • Region Bandwidth
      • Route management
      • TGW
    • Java-SDK
      • CSN
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Version history
    • Python-SDK
      • Bandwidth package
      • CSN Instance
      • Initialization
      • Region Bandwidth
      • Route management
      • TGW
  • Service Level Agreement (SLA)
    • Cloud Smart Network Service Level Agreement SLA
  • Typical Practices
    • CSN supports VPC custom route tables for secure traffic access
    • Multi-IDC Disaster Recovery via Cloud Smart Network
    • Multi-IDC Interconnection via Cloud Smart Network
    • Private Network VPC Interconnection with Edge Network
All documents
menu
No results found, please re-enter

CSN

  • API Reference
    • API function release records
    • Appendix
    • Bandwidth Package Related
      • Bandwidth package price inquiry
      • Bandwidth upgrade-downgrade for the bandwidth package
      • Bind a bandwidth package to a Cloud Smart Network
      • Create bandwidth package
      • Delete bandwidth package
      • Query bandwidth package list
      • Query the specified bandwidth package details
      • Unbind a bandwidth package from a Cloud Smart Network
      • Update bandwidth package
    • Cloud Smart Network Related
      • Create a Cloud Smart Network
      • Delete a Cloud Smart Network
      • Network instances loaded by the Cloud Smart Network
      • Network instances unloaded by the Cloud Smart Network
      • Query Cloud Smart Network details
      • Query Cloud Smart Network instance list
      • Query the list of Cloud Smart Network
      • Update a Cloud Smart Network
    • Common Headers and Error Responses
    • General Description
    • Ingress Management Related Interfaces
      • Add a routing entry
      • Create affiliation
      • Create learning relationship
      • Delete a learning relationship
      • Delete a routing entry
      • Delete an association relationship
      • Query association relationships
      • Query learning relationships
      • Query route table list
      • Query routing entries
    • Interface Overview
    • Region Bandwidth Related Interfaces
      • Create cross-region bandwidth
      • Delete cross-region bandwidth
      • Query cross-region bandwidth
      • Query the cross-region bandwidth of the specified Cloud Smart Network
      • Update cross-region bandwidth
    • Service domain
    • TGW Related Interfaces
      • Query routing entries of a TGW
      • Query TGW list
      • Update TGW information
  • FAQs
    • Consultation
  • Function Release Records
  • Operation guide
    • Cross-Account Authorization Management
      • Cancel Authorized Network Instance
      • Create Authorized Network Instance
      • Delete Authorized Network Instance
      • View Authorized Network Instance
    • Cross-Region Bandwidth Package Management
    • CSN Instance
      • Create CSN Instance
      • Delete CSN Instance
      • Modify CSN Instance
    • Identity and access management
    • Monitor and Operations
      • CSN Instance Diagnosis
    • Network instance
      • Add Cross-Account Network Instance
      • Add Local Account Network Instance
      • Adjust Network Instance Bandwidth
      • Uninstall Network Instance
    • Region Bandwidth Management
      • Adjust Region Bandwidth
      • Create cross-region bandwidth
      • Delete cross-region bandwidth
    • Route management
      • Association Relationship
        • Create affiliation
        • Delete affiliation
      • Custom route tables
        • Create custom route table
        • Delete custom route table
        • View Custom Route Table
      • Learning Relationship
        • Add Custom Route Entry
        • Create learning relationship
        • Delete Custom Route Entry
        • Delete learning relationship
        • Publish and Revoke Network Instance Route
        • View Route Entry
    • Tag Management
  • Product Description
    • Application scenarios
    • Introduction
    • Usage restrictions
  • Product pricing
  • SDK
    • GO-SDK
      • Bandwidth package
      • CSN Instance
      • Exception handling
      • Initialization
      • Install
      • Overview
      • Region Bandwidth
      • Route management
      • TGW
    • Java-SDK
      • CSN
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Version history
    • Python-SDK
      • Bandwidth package
      • CSN Instance
      • Initialization
      • Region Bandwidth
      • Route management
      • TGW
  • Service Level Agreement (SLA)
    • Cloud Smart Network Service Level Agreement SLA
  • Typical Practices
    • CSN supports VPC custom route tables for secure traffic access
    • Multi-IDC Disaster Recovery via Cloud Smart Network
    • Multi-IDC Interconnection via Cloud Smart Network
    • Private Network VPC Interconnection with Edge Network
  • Document center
  • arrow
  • CSN
  • arrow
  • SDK
  • arrow
  • GO-SDK
  • arrow
  • Route management
Table of contents on this page
  • Add a routing entry
  • Query routing entries
  • Delete a routing entry
  • Function declaration
  • Parameter meaning
  • Response value
  • Code example
  • Create learning relationship
  • Delete a learning relationship
  • Query learning relationships
  • Create affiliation
  • Delete an association relationship
  • Query association relationships
  • Query route table list

Route management

Updated at:2025-11-11

Add a routing entry

Function declaration

Go
1func (c *Client) CreateRouteRule(csnRtId string, body *CreateRouteRuleRequest,
2	clientToken string) error

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/Nl14d16n5

Usage example

Go
1args := &csn.CreateRouteRuleRequest{
2    AttachId:    "tgwAttach-rvu8tkaubphb78eg",
3    DestAddress: "0.0.0.0/0",
4    RouteType:   "custom",
5}
6 err := client.CreateRouteRule(csnRtId, args, clientToken) // Create a routing rule

Response value
Operation succeeded:

JSON
1{}

Operation failed:
Throw an exception. For the exception list, refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, please refer to: example_create_route_rule.go

Query routing entries

Function declaration

Go
1func (c *Client) ListRouteRule(csnRtId string, listRouteRuleArgs *ListRouteRuleArgs)

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/sl14d3at6

Usage example

Go
1csnRtId := "xxxxx" //ID of the Cloud Smart Network route table
2args := &csn.ListRouteRuleArgs{}
3response, err := client.ListRouteRule(csnRtId, args)

Response value
Operation succeeded:

JSON
1{
2    "nextMarker":"csnrr-IyWRn123",
3    "marker":"csnrr-IyWRnII7",
4    "maxKeys":1,
5    "isTruncated":true,
6    "csnRtRules":[
7          {
8                "ruleId":"cnrr-1db26d78-1781",
9                "routeType":"propagated",
10                "csnId":"csn-m3dwj6tfysnmxmcy",
11                "csnRtId":"csnRt-w3x16fk8nr5kpxkx",
12                "description":null,
13                "fromAttachId":"tgwAttach-wg3z1z5baq3ry1a6",
14                "status":"conflicted",
15                "sourceAddress":null,
16                "destAddress":"192.168.0.0/20",
17                "nextHopId":"vpc-fh43ygs8yp0d",
18 "nextHopName": "Default Virtual Private Cloud",
19                "nextHopRegion":"su",
20                "nextHopType":"vpc",
21                "asPath":"",
22                "community":"",
23                "blackHole":false
24           }
25    ]
26}

Operation failed:
Throw an exception. For the exception list, refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, please refer to: example_list_route_rule.go

Delete a routing entry

Function declaration

Go
1func (c *Client) DeleteRouteRule(csnRtId string, csnRtRuleId string, clientToken string) error

Parameter meaning

Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/Ll14d5a1d

Response value

Operation succeeded:

Go
1{}

Operation failed: Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example

For specific code examples, please refer to: example_delete_routerule.go

Create learning relationship

Function declaration

Go
1func (c *Client) CreatePropagation(csnRtId string, body *CreatePropagationRequest,
2	clientToken string) error

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/Dl14cf0h1

Usage example

Go
1clientToken := util.NewUUID() //Idempotency token: an ASCII string with a length not exceeding 64 characters. For details, see ClientToken Idempotency
2desc := "desc"
3args := &csn.CreatePropagationRequest{
4    AttachId:    "tgwAttach-uff0gvjkis95f6xg",
5    Description: &desc,
6}
7 err := client.CreatePropagation(csnRtId, args, clientToken) // Create a learning relationship

Response value
Operation succeeded:

JSON
1{
2}

Operation failed:
Throw an exception. For the exception list, refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, please refer to: example_create_propagation.go

Delete a learning relationship

Function declaration

Go
1func (c *Client) DeletePropagation(csnRtId string, attachId string, clientToken string) error

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/gl14cfnmj

Usage example

Go
1csnRtId := "xxxx"             //ID of the Cloud Smart Network route table
2 attachId := "tgwAttach-xxxx"  //Identity ID of the network instance in Cloud Smart Network
3 clientToken := util.NewUUID() //Idempotency token: an ASCII string with a length not exceeding 64 characters. For details, see ClientToken Idempotency
4 err := client.DeletePropagation(csnRtId, attachId, clientToken) // Delete a learning relationship

Response value
Operation succeeded:

JSON
1{
2}

Operation failed:
Throw an exception. For the exception list, refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, please refer to: example_delete_propagation.go

Query learning relationships

Function declaration

Go
1func (c *Client) ListPropagation(csnRtId string) (*ListPropagationResponse, error)

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/8l14cgbsf
Usage example

Go
1csnRtId := "xxxxx" //ID of the Cloud Smart Network route table
2response, err := client.ListPropagation(csnRtId)

Response value
Operation succeeded:

JSON
1{
2    "propagations":[
3        {
4            "attachId":"tgwAttach-kfdccn8a6pip0qd1",
5            "description":"default",
6            "instanceName":"test-03",
7            "instanceRegion":"bj",
8            "instanceId":"vpc-v3ku2mhsyxvn",
9            "instanceType":"vpc",
10            "status":"enable"
11        }
12    ]
13}

Operation failed:
Throw an exception. For the exception list, refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym
Code example
For specific code examples, please refer to: example_list_propagation.go

Create affiliation

Function declaration

Go
1func (c *Client) CreateAssociation(csnRtId string, body *CreateAssociationRequest, clientToken string) error

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/il13gbcn8

Response value
Operation succeeded:

JSON
1{}

Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, refer to: example_create_association.go

Delete an association relationship

Function declaration

Go
1func (c *Client) DeleteAssociation(csnRtId string, attachId string, clientToken string) error

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/kl13gcb4h

Response value
Operation succeeded:

JSON
1{}

Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, please refer to: example_delete_association.go

Query association relationships

Function declaration

Go
1func (c *Client) ListAssociation(csnRtId string) (*ListAssociationResponse, error)

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/zl13gcrny

Response value
Operation succeeded:

JSON
1{
2    "associations":[
3        {
4            "attachId":"tgwAttach-kfdccn8a6pip0qd1",
5            "description":"desc",
6            "instanceId":"vpc-v3ku2mhsyxvn",
7            "instanceName":"test-03",
8            "instanceRegion":"bj",
9            "instanceType":"vpc",
10            "status":"active"
11        }
12    ]  
13}

Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, please refer to: example_list_association.go

Query route table list

Function declaration

Go
1func ListRouteTable(cli bce.Client, csnId string, listRouteTableArgs *ListRouteTableArgs) (
2	*ListRouteTableResponse, error)

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/CSN/s/hl13gm7x2

Response value
Operation succeeded:

JSON
1{
2    "marker":null,
3    "isTruncated":true,
4    "nextMarker":"csnBp-iuc756n5kkda",
5    "maxKeys":1,
6    "csnRts":[
7         {
8            "csnRtId":"csn-rt-uezhhw306g5be3gb",
9            "name":"csnRtName",
10            "description":"desc",
11            "type":"default"
12        }
13    ]  
14}

Operation failed:
Return error. For the error code list, please refer to: https://cloud.baidu.com/doc/CSN/s/Tl56j65ym

Code example
For specific code examples, please refer to: example_list_route_table.go

Previous
Region Bandwidth
Next
TGW