Dedicated line
Dedicated line services
Overview
This document mainly introduces the use of the ET Python SDK. Prerequisites include prior understanding of dedicated line fundamentals, and dedicated line service. If you are not yet familiar with dedicated line, you can refer to Product Description and Guide.
Initialization
Retrieve Endpoint
Before configuring the endpoint for SDK usage, please refer to the developer guide section on ET Service Domain Name to understand endpoint-related concepts. Baidu AI Cloud currently supports multiple regions. Please refer toRegion Selection Guide.
Currently supported regions are: "North China-Beijing," "South China-Guangzhou," "East China-Suzhou," "Hong Kong," "Central Finance-Wuhan," and "North China-Baoding." Corresponding details:
| Access region | Endpoint | Protocol |
|---|---|---|
| BJ | bcc.bj.baidubce.com | HTTP and HTTPS |
| GZ | bcc.gz.baidubce.com | HTTP and HTTPS |
| SU | bcc.su.baidubce.com | HTTP and HTTPS |
| HKG | bcc.hkg.baidubce.com | HTTP and HTTPS |
| FWH | bcc.fwh.baidubce.com | HTTP and HTTPS |
| BD | bcc.bd.baidubce.com | HTTP and HTTPS |
Retrieve access key
To use ET, you will need a valid AK (Access Key ID) and SK (Secret Access Key) for signature authorization. AK and SK are unique identifiers assigned by the system to verify users and authorize signatures for ET.
Your AK/SK information can be obtained and understood through the following steps:
Register a Baidu AI Cloud account
Create a new ET client
When creating an et_client, first configure a BceClientConfiguration-type config instance using endpoint, AK and SK, and then use the config instance to configure the et_client. The specific configuration method is as follows:
1 HOST = b''
2 AK = b''
3 SK = b''
4 config = BceClientConfiguration(
5 credentials=BceCredentials(AK, SK), endpoint=HOST)
6 self.client = et_client.EtClient(config)
ET
Apply for physical dedicated line
Function declaration
1def create_et_dcphy(self, name, isp, intf_type, ap_type, ap_addr, user_name, user_phone,
2 user_email, user_idc, client_token=None, description=None, config=None):
Parameter description
Please refer to the OpenAPI documentation: Parameters for Applying for Physical Dedicated Line
Response Value
- Operation succeeded
1{
2 "id": "dcphy-gq65bz9ip712"
3}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_create_et.py
Query dedicated line list
Function declaration
1def list_et_dcphy(self, status=None, marker=None, max_keys=1000, config=None):
Parameter description
Please refer to the OpenAPI documentation Request Parameters for Querying Dedicated Line List
Response Value
- Operation succeeded
1{
2 "nextMarker": "dcphy-gq65bz9ip712",
3 "marker": "dcphy-gq65bz9ie712",
4 "maxKeys": 1,
5 "isTruncated": true,
6 "ets": [{
7 "id": "dcphy-jy1sbnx32ez0",
8 "name": "et_6",
9 "description": "Description",
10 "status": "established",
11 "expireTime": "2019-01-30T08:50:00Z",
12 "isp": "ISP_CTC",
13 "intfType": "10G",
14 "apType": "BAIDU",
15 "apAddr": "BB",
16 "userName": "Zhang San",
17 "userPhone": "133*****333",
18 "userEmail": "1***@123.com",
19 "userIdc": "Beijing|Municipal District|Dongcheng District|2321"
20 }]
21}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_list_et.py
Query dedicated line details
Function declaration
1def list_et_dcphy_detail(self, et_id, config=None):
Parameter description
Please refer to the OpenAPI documentation Request Parameters for Querying Dedicated Line Details
Response value
- Operation succeeded
1{
2 "id": "dcphy-gq65bz9ip712",
3 "name": "ZX051501-testET",
4 "description": "",
5 "status": "established",
6 "expireTime": 1,
7 "isp": "ISP_CUCC",
8 "intfType": "10G",
9 "apType": "SINGLE",
10 "apAddr": "WHGG",
11 "userName": "Zhang San",~~~~
12 "userPhone": "133*****333",
13 "userEmail": "1***@123.com",
14 "userIdc": "Beijing|Municipal Districts|Dongcheng District|Baidu Technology Park K2"
15}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_list_et_detail.py
Update physical dedicated line
Function declaration
1def update_et_dcphy(self, et_id, name=None, description=None, user_name=None,
2 user_phone=None, user_email=None, client_token=None, config=None):
Parameter description
Please refer to the OpenAPI documentation: Parameters for Updating Physical Dedicated Line
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_update_et.py
Create dedicated channel
Function declaration
1def create_et_channel(self, et_id, local_ip, name, remote_ip, route_type, vlan_id,
2 authorized_users=None, description=None, networks=None,
3 bgp_asn=None, bgp_key=None, enable_ipv6=None, local_ipv6=None,
4 remote_ipv6=None, ipv6_networks=None, client_token=None, config=None):
Parameter description
Please refer to the OpenAPI documentation: Parameters for Creating Dedicated Channel
Response Value
- Operation succeeded
1 {
2 "id": "dedicatedconn-zy9t7n91k0iq"
3 }
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_create_et_channel.py
Query dedicated channel
Function declaration
1def get_et_channel(self, et_id, client_token=None, config=None):
Parameter description
Please refer to the OpenAPI documentation: Parameters for Querying Dedicated Channel
Response Value
- Operation succeeded
1 {
2 "etChannels": [
3 {
4 "authorizedUsers": [
5 "8770xxxxxxxxxxxxxxxxxxxxxxxx4df8"
6 ],
7 "description": "",
8 "baiduAddress": "11.11.11.21/24",
9 "name": "channel_name",
10 "networks": [
11 "192.168.0.0/16"
12 ],
13 "customerAddress": "11.11.11.12/24",
14 "routeType": "static-route",
15 "vlanId": 56,
16 "id":"dedicatedconn-zy9t7n91k0iq",
17 "status":"building",
18 "enableIpv6": 1,
19 "baiduIpv6Address": "2400:da00:e003:0:1eb:200::/88",
20 "ipv6Networks": [
21 "2400:da00:e003:0:15f::/87"
22 ],
23 "customerIpv6Address": "2400:da00:e003:0:0:200::/88"
24 }
25 ]
26 }
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_get_et_channel.py
Resubmit the dedicated channel
Function declaration
1def recommit_et_channel(self, et_id, et_channel_id, local_ip, name, networks, remote_ip, route_type, vlan_id,
2 authorized_users=None, description=None, enable_ipv6=None, local_ipv6=None,
3 remote_ipv6=None, ipv6_networks=None, client_token=None, config=None):
Parameter description
Refer to the OpenAPI documentation: Parameters for Resubmitting Dedicated Channel
Response value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_recommit_et_channel.py
Update dedicated channel
Function declaration
1def update_et_channel(self, et_id, et_channel_id, name=None, description=None, client_token=None, config=None):
Parameter description
Please refer to the OpenAPI documentation: Parameters for Updating Dedicated Channel
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_update_et_channel.py
Delete dedicated channel
Function declaration
1def delete_et_channel(self, et_id, et_channel_id, client_token=None, config=None):
Parameter description
Please refer to the OpenAPI documentation: Parameters for Deleting Dedicated Channel
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: examples_delete_et_channel.py
Enable IPv6 function for the dedicated channel
Function declaration
1def enable_et_channel_ipv6(self, et_id, et_channel_id, local_ipv6, remote_ipv6,
2 ipv6_networks=None, client_token=None, config=None):
Parameter description
Refer to OpenAPI documentation: Parameters for Enabling IPv6 Function for Dedicated Channel
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to: examples_enable_et_channel_ipv6.py
Disable dedicated channel IPv6 function
Function declaration
1def disable_et_channel_ipv6(self, et_id, et_channel_id, client_token=None, config=None):
Parameter Meaning
Refer to OpenAPI documentation: Parameters for Disabling IPv6 for Dedicated Channel
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to: example_disable_et_channel_ipv6.py
Create routing rules of Dedicated channel
Function declaration
1def create_et_channel_route_rule(self, et_id, et_channel_id, dest_address, nexthop_type,
2 nexthop_id, description=None, ip_version=4,
3 client_token=None, config=None):
Parameter Meaning
Refer to OpenAPI documentation: Create Dedicated Channel Routing Rules
Response value
- Operation succeeded
1{
2 "routeRuleId":"dcrr-5afcf643-94e"
3}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: example_create_et_channel_route_rule.py
Query the routing rules of the dedicated channel
Function declaration
1def list_et_channel_route_rules(self, et_id, et_channel_id, marker=None,
2 max_Keys=None, dest_address=None, config=None):
Parameter Meaning
Refer to OpenAPI documentation: Query Dedicated Channel Routing Rule
Response Value
- Operation succeeded
1{
2 "nextMarker": "14eabc99-dce7-11ec-84d4-6c92bf29c398",
3 "maxKeys": 1,
4 "isTruncated": true,
5 "routeRules": [{
6 "routeRuleId": "dcrr-5afcf643-94e",
7 "ipVersion": 4,
8 "destAddress": "10.0.0.1/32",
9 "nexthopType": "etGateway"
10 "nexthopId": "dcgw-arc647h3014w",
11 "description": "route_1"
12 }]
13}
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, refer to example_list_et_channel_route_rules.py
Modify the dedicated channel routing rules
Function declaration
1def update_et_channel_route_rule(self, et_id, et_channel_id, et_channel_route_rule_id,
2 description, client_token=None, config=None):
Parameter Meaning
Refer to OpenAPI documentation: Parameters for Modifying Dedicated Channel Routing Rules
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: example_update_et_channel_route_rule.py
Delete routing rules of dedicated channel
Function declaration
1def delete_et_channel_route_rule(self, et_id, et_channel_id, et_channel_route_rule_id,
2 client_token=None, config=None):
Parameter Meaning
Refer to OpenAPI documentation: Parameters for Deleting Dedicated Channel Routing Rules
Response Value
- Operation succeeded
No response value
- Operation failed
For response exception list of operation failure, refer to the Exception List.
Example code
For specific code examples, please refer to: example_delete_et_channel_route_rule.py
