This topic describes how to use the Alibaba Cloud SDK for Python to interconnect a VBR and a VPC that are located in the same region and are under the same account.
Prerequisites
Background information
Note the following when you create router interfaces:
- Only one pair of interconnected router interfaces can be created between two routers.
- A maximum of five router interfaces can be created for each VRouter.
- If a router interface with an overdue payment is under your account, you cannot create router interfaces.
- Route entries in the same route table cannot have the same destination CIDR blocks.
- The VBR must operate as the connection initiator and be in the Activated state.
The example used in this topic includes the following steps:
- Create a VBR.
- Create the initiator router interface.
- Create the acceptor router interface.
- Modify the initiator router interface.
- Modify the acceptor router interface.
- Query the initiator router interface.
- Query the acceptor router interface.
- Query the ID of the route table in the VBR.
- Connect the initiator router interface to the acceptor router interface.
- Create a route entry whose next hop is the initiator router interface.
- Create a route entry whose next hop is the acceptor router interface.
- Delete the route entry whose next hop is the acceptor router interface.
- Delete the route entry whose next hop is the initiator router interface.
- Deactivate the initiator router interface.
- Deactivate the acceptor router interface.
- Delete the initiator router interface.
- Delete the acceptor router interface.
- Delete the VBR.
Procedure
Result
The system output is displayed as follows:
---------------------------create_virtual_border_router---------------------------
{
"VbrId": "vbr-bp1vudncgk9jtxxxxxxxx",
"RequestId": "0C4FABDB-FF18-4E70-9E43-6DC03197F0EA"
}
---------------------------create_router_interface---------------------------
{
"RequestId": "11F14FA2-ECFA-4B27-A75D-7C6D5FECACDF",
"RouterInterfaceId": "ri-bp1vabte8nbdexxxxxxxx"
}
---------------------------create_router_interface---------------------------
{
"RequestId": "72FAB86D-470B-40E4-8476-F9223A911486",
"RouterInterfaceId": "ri-bp1mxkc61ly0nxxxxxxxx"
}
---------------------------modify_router_interface_attribute---------------------------
{
"RequestId": "93D5FFF7-6C05-41B1-92F0-AC8F1809BC98"
}
---------------------------modify_router_interface_attribute---------------------------
{
"RequestId": "1C461452-42BD-4649-B318-2214222B4FCA"
}
---------------------------describe_router_interface---------------------------
{
"TotalCount": 1,
"RouterInterfaceSet": {
"RouterInterfaceType": [
{
"BusinessStatus": "Normal",
"CreationTime": "2019-04-30T02:54:22Z",
"AccessPointId": "ap-cn-hangzhou-xx-x",
"Role": "InitiatingSide",
"OppositeRouterId": "vrt-bp141no9pds2bxxxxxxxx",
"Spec": "Large.2",
"Status": "Idle",
"EndTime": "2999-09-08T16:00:00Z",
"OppositeInterfaceSpec": "Negative",
"RouterInterfaceId": "ri-bp1vabte8nbdexxxxxxxx",
"RouterType": "VBR",
"OppositeBandwidth": 0,
"OppositeVpcInstanceId": "vpc-bp1v31by9jix2xxxxxxxx",
"HasReservationData": false,
"OppositeInterfaceBusinessStatus": "Normal",
"OppositeRouterType": "VRouter",
"OppositeRegionId": "cn-hangzhou",
"RouterId": "vbr-bp1vudncgk9jtxxxxxxxx",
"CrossBorder": false,
"OppositeInterfaceOwnerId": "",
"Bandwidth": 2048,
"OppositeInterfaceId": "ri-bp1mxkc61ly0nxxxxxxxx",
"ChargeType": "AfterPay"
}
]
},
"PageNumber": 1,
"RequestId": "3553DB38-A4A0-4453-976C-542E96B1B5A9",
"PageSize": 10
}
---------------------------describe_router_interface---------------------------
{
"TotalCount": 1,
"RouterInterfaceSet": {
"RouterInterfaceType": [
{
"Status": "Idle",
"OppositeRegionId": "cn-hangzhou",
"BusinessStatus": "Normal",
"OppositeRouterId": "vbr-bp1vudncgk9jtxxxxxxxx",
"VpcInstanceId": "vpc-bp1v31by9jix2xxxxxxxx",
"RouterInterfaceId": "ri-bp1mxkc61ly0nxxxxxxxx",
"CreationTime": "2019-04-30T02:54:24Z",
"RouterType": "VRouter",
"OppositeInterfaceOwnerId": "",
"RouterId": "vrt-bp141no9pds2bxxxxxxxx",
"Bandwidth": 0,
"OppositeInterfaceId": "ri-bp1vabte8nbdexxxxxxxx",
"EndTime": "2999-09-08T16:00:00Z",
"ChargeType": "AfterPay",
"OppositeAccessPointId": "ap-cn-hangzhou-xx-x",
"HasReservationData": false,
"CrossBorder": false,
"OppositeInterfaceBusinessStatus": "Normal",
"Spec": "Negative",
"OppositeRouterType": "VBR",
"Role": "AcceptingSide"
}
]
},
"PageNumber": 1,
"RequestId": "217D8D94-C508-4285-8101-7DE3B53A88A5",
"PageSize": 10
}
---------------------------describe_route_table---------------------------
{
"TotalCount": 1,
"PageNumber": 1,
"RequestId": "CA6BBE52-DF5E-496A-93CF-9857AF22D2AC",
"PageSize": 10,
"RouteTables": {
"RouteTable": [
{
"RouteTableId": "vtb-bp1s126yz0swpxxxxxxxx",
"RouteEntrys": {
"RouteEntry": []
},
"CreationTime": "2019-04-30T02:54:19Z",
"VSwitchIds": {
"VSwitchId": []
},
"ResourceGroupId": "",
"VRouterId": "vbr-bp1vudncgk9jtxxxxxxxx",
"RouteTableType": "System"
}
]
}
}
---------------------------connect_router_interface---------------------------
{
"RequestId": "93476D4E-6C08-44B8-83E4-5759E1A08F29"
}
---------------------------create_route_entry---------------------------
{
"RequestId": "66D4F46B-5E0F-4565-8740-845EC26EBE00"
}
---------------------------create_route_entry---------------------------
{
"RequestId": "E1F99FEF-2499-40A7-84ED-6F9D440D4FF8"
}
---------------------------delete_route_entry---------------------------
{
"RequestId": "8C983886-F058-4234-A6D7-ECDEE2C2D945"
}
---------------------------delete_route_entry---------------------------
{
"RequestId": "DDEC56B9-CDD4-4D0A-B460-040B85B97FE9"
}
---------------------------deactivate_router_interface---------------------------
{
"RequestId": "04069B7C-6A42-43F2-A086-50F802940045"
}
---------------------------deactivate_router_interface---------------------------
{
"RequestId": "B2EBF829-E1C0-43E5-9BAD-DFFCBFA301F7"
}
---------------------------delete_router_interface---------------------------
{
"RequestId": "20EEC4A6-E468-4F3C-A743-89193F7504E1"
}
---------------------------delete_router_interface---------------------------
{
"RequestId": "59DCE168-B9CC-43A3-A54F-0D8C194BABE0"
}
---------------------------delete_virtual_border_router---------------------------
{
"RequestId": "E1D71EEC-FE9F-4834-8780-19EBBD91A638"
}