使用 API 在 Port 与 Microsoft Azure 之间创建 VXC
本文介绍使用 API 从 Port 到 Microsoft Azure ExpressRoute 创建 VXC 的流程,包括如何查询 Azure 端口位置并订购 VXC。
Port 到 Azure 的部署包括以下任务:
-
在 Azure 控制台中设置 ExpressRoute 电路
部署完成后,您将获得一个服务密钥。该服务密钥与 Azure 中分配的端口关联。验证服务密钥时,响应会显示 Azure 中分配的主用和备用端口。您可以将该服务密钥使用两次——第一次连接到主用端口,第二次创建到备用端口的另一条连接。
有关更多信息,请参阅 Microsoft 帮助主题 Tutorial: Create and modify an ExpressRoute circuit。 -
使用该服务密钥,从 Megaport Portal 创建并部署您的 VXC
此步骤使用 API——其余步骤在 Azure 环境中、位于 Megaport 之外完成。
-
在将 VXC 部署到您的电路后,在 Azure 门户中配置 Peering
Peering 信息在主用和备用电路之间共享,分配给对等体的内部 VLAN 也会共享。
有关更多信息,请参阅 Microsoft 帮助主题 Create and modify peering for an ExpressRoute circuit。 -
配置客户驻地设备 (CPE)
开始之前,请获取一个有效的访问令牌。有关详细信息,请参阅 创建 API 密钥。
验证服务密钥
使用 API 验证 Azure 服务密钥时,响应包含关联端口和对等体的 ExpressRoute 详细信息。您需要这些端口详细信息来创建 VXC。
在 Postman 集合中验证服务密钥
-
在 Postman 中,展开左侧导航中的 Cloud Connectivity > Port > Azure (云连接 > Port > Azure),然后选择 GET Look Up Azure Service Key (GET 查找 Azure 服务密钥)。
-
将服务密钥添加到端点。
-
单击 Send (发送) 以向 API 服务器发出 GET 请求。
GET {baseUrl}/v2/secure/azure/{service_key}
以下是针对新密钥的示例响应(未配置 VXC):
{
"message": "Successful lookup",
"terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
"data": {
"managed": false,
"connectType": "AZURE",
"resource_type": "csp_connection",
"bandwidth": 200,
"service_key": "3e2480b2-b4d5-424b-976a-7b0de65a1b62",
"vlan": 3289,
"megaports": [
{
"portSpeed": 10000,
"name": "Washington DC Primary",
"state": "VA",
"description": "Azure ExpressRoute at Equinix DC2/6",
"productUid": "a7ae8a35-433e-44aa-87cb-a1b7995ab008",
"nServiceId": 32832,
"companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
"country": "USA",
"vxc": null,
"port": 14570,
"companyName": "Azure ExpressRoute",
"locationId": 67,
"productId": 14570,
"type": "primary",
"companyId": 1475
},
{
"portSpeed": 10000,
"name": "Washington DC Secondary",
"state": "VA",
"description": "Azure ExpressRoute at Equinix DC2/6",
"productUid": "07ab0ee6-7f77-41ac-bbe6-335e3ee6d182",
"nServiceId": 36431,
"companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
"country": "USA",
"vxc": null,
"port": 16108,
"companyName": "Azure ExpressRoute",
"locationId": 67,
"productId": 16108,
"type": "secondary",
"companyId": 1475
}
],
"peers": []
}
}
megaports:vxc 的值对于两个端口都是 null,表示它们可用于新的 VXC。
关于每个响应字段的详细信息,请参阅Azure 服务密钥响应字段。
创建并部署 VXC
使用服务密钥中的详细信息,创建一个到主端口的 VXC 和一个到次端口的 VXC。
创建 VXC
-
选择 POST Create VXC to Azure (v3)。
提示
若要在下单前测试您的请求并查看定价详情,可以使用: POST {baseUrl}/v3/networkdesign/validate
-
使用端口的
productUid、VXC 的名称、主 Azure 端口的productUid以及服务密钥,更新请求的 Body。最大速率(rateLimit)在服务密钥响应中的带宽值中定义。本例中为 200。 -
点击发送以提交请求。
POST {baseUrl}/v3/networkdesign/buy
[
{
"productUid": "1544f278-ec03-11e5-9ce9-5e5517507c66", //port UID of your Megaport (A-End)
"associatedVxcs": [
{
"productName": "Primary Azure VXC",
"rateLimit": 200,
"term":12,
"shutdown": false,
"promoCode": "promox3mnthfree2",
"aEnd": {
"vlan": 102
},
"bEnd": {
"productUid": "a7ae8a35-433e-44aa-87cb-a1b7995ab008", //retrieved port UID from the Azure service key lookup
"partnerConfig" : {
"connectType": "AZURE",
"serviceKey": "3e2480b2-b4d5-424b-976a-7b0de65a1b62" //service key from lookup response
}
}
}
]
}
]
当您已将主用和备用 VXC 配置到 Azure 端口后,再次查询服务密钥即可显示与 Azure 端口关联的 VXC。VXC 由编号(megaports:vxc)标识。
{
"message": "Successful lookup",
"terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
"data": {
"managed": false,
"connectType": "AZURE",
"resource_type": "csp_connection",
"bandwidth": 200,
"service_key": "3e2480b2-b4d5-424b-976a-7b0de65a1b62",
"vlan": 3289,
"megaports": [
{
"portSpeed": 10000,
"name": "Washington DC Primary",
"state": "VA",
"description": "Azure ExpressRoute at Equinix DC2/6",
"productUid": "a7ae8a35-433e-44aa-87cb-a1b7995ab008",
"nServiceId": 32832,
"companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
"country": "USA",
"vxc": 60621,
"port": 14570,
"companyName": "Azure ExpressRoute",
"locationId": 67,
"productId": 14570,
"type": "primary",
"companyId": 1475
},
{
"portSpeed": 10000,
"name": "Washington DC Secondary",
"state": "VA",
"description": "Azure ExpressRoute at Equinix DC2/6",
"productUid": "07ab0ee6-7f77-41ac-bbe6-335e3ee6d182",
"nServiceId": 36431,
"companyUid": "c40de5ed-4707-4471-a78c-69436de2c505",
"country": "USA",
"vxc": 60622,
"port": 16108,
"companyName": "Azure ExpressRoute",
"locationId": 67,
"productId": 16108,
"type": "secondary",
"companyId": 1475
}
],
"peers": []
}
}
要完成配置,请在 Azure 门户中配置 Peering,并配置您的 CPE 设备。