Skip to content

Creating an MCR VXC with the API

This topic steps through the API procedure to create an MCR VXC. The first example creates an AWS Hosted Connection in the US market - one of the more involved configurations. Templates for other CSPs appear later in the topic.

Creating a VXC Between an MCR and AWS with a Hosted Connection

This example creates an AWS Hosted Connection in the US market. The steps include how to:

  • get the MCR product ID
  • find the location ID for an available US market
  • validate and order the VXC
  • configure two static routes
  • configure BGP“Border Gateway Protocol.
    A standardized routing protocol designed to exchange route and reachability information among autonomous systems (AS) on the internet.
    connections – one connection with MEDMulti-Exit Discriminator.
    A BGP path attribute that can influence a BGP neighbor to take a preferred route when the advertising autonomous system (AS) is the same for candidate routes and there are multiple entry points for that AS.
    and BFDBidirectional Forwarding Detection.
    The BFD protocol detects any path failures between directly connected BGP neighbors, allowing for a faster BGP routing re-convergence time.
    details and one without

Before you begin, obtain a valid access token. For more information, see Creating an API Key.

To create the VXC, we need the productUid for the MCR.

To get the productUid for the MCR

  1. Get the product list.

    GET {baseUrl}/v2/products/
    
  2. From the returned product details, locate the productUid value for the MCR you want to connect.

    This example uses this value: fee85cc0-f06f-4ad7-bce7-36aef7dbe0d0

Next, find the location ID for the US market you want with support for AWS Hosted Connections.

To find the locationId in US market where AWS Hosted Connections are available

  1. Get the list for all interfaces Megaport has with Cloud Service Providers.

    GET {baseUrl}/v2/dropdowns/partner/megaports
    

    You can filter the results by connectType and vxcPermitted.

    GET {baseUrl}/v2/dropdowns/partner/megaports?connectType=AWSHC&vxcPermitted=true
    
  2. Click the magnifying glass and search through the response for a site matching your location criteria.

    For this example, select “US West (Oregon) (us-west-2) [DZ-RED]” with “locationId”: 57.

{
            "connectType": "AWSHC",
            "productUid": "f274bd09-1796-43af-8837-28fa4fa2a1ab",
            "vxcPermitted": true,
            "companyUid": "605cb850-dfb4-4a05-a171-8bf17757b3a2",
            "companyName": "AWS",
            "title": "US West (Oregon) (us-west-2) [DZ-RED]",
            "locationId": 57,
            "speed": 10000,
            "rank": 275,
            "lag_id": 5,
            "lag_primary": true,
            "aggregation_id": 106462
        },

Note

[DZ-RED] means Red diversity zone. Each AWS Hosted Connection site provides two diversity zones to provide redundancy: DZ-Red and DZ-Blue.

With the MCR ID and the AWS location ID, you can create a VXC.

To create the VXC

  1. Create a request with this URL:

    POST {baseUrl}/v3/networkdesign/buy
    

    Tip

    To test your request before you order, you can use: POST {baseUrl}/v3/networkdesign/validate

  2. Add these headers to the request:

    • Content-Type: application/json
    • Authorization: Bearer {your accessToken}
  3. Create the Body of the request with the configuration details.

    This example uses MCR product ID, the AWS location ID for the B-End, creates two static routes, and configures BGP connections – one connection with MEDs and BFD details and one without. The following sections provide details about the static routes and BGP connections.

[
  {
    "productUid": "fee85cc0-f06f-4ad7-bce7-36aef7dbe0d0",
    "associatedVxcs": [
      {
        "rateLimit": 100,
        "productName": "awshc",
        "term": 12,
        "shutdown": false,
        "aEnd": {
          "locationId": 320,
          "vlan": 0,
          "partnerConfig": {
            "connectType": "VROUTER",
            "interfaces": [
              {
                "ipAddresses": [
                  "10.191.0.25/29"
                ],
                "bfd": {
                  "txInterval": 300,
                  "rxInterval": 300,
                  "multiplier": 3
                },
                "bgpConnections": [
                  {
                    "peerAsn": 62512,
                    "localIpAddress": "10.191.0.25",
                    "peerIpAddress": "10.191.0.26",
                    "password": "cnn6eaeaETSjvjvjvjv",
                    "shutdown": false,
                    "description": "BGP with MED and BFD enabled",
                    "medIn": 100,
                    "medOut": 100,
                    "bfdEnabled": true
                  },
                  {
                    "peerAsn": 62511,
                    "localIpAddress": "10.191.0.27",
                    "peerIpAddress": "10.191.0.28",
                    "password": "cnn23049asdkfj",
                    "shutdown": false,
                    "description": "BGP without MED or BFD",
                    "medIn": null,
                    "medOut": null,
                    "bfdEnabled": false
                  }
                ],
                "ipRoutes": [
                  {
                    "prefix": "10.0.0.0/24",
                    "nextHop": "10.191.0.26",
                    "description": "test static route 1"
                  },
                  {
                    "prefix": "10.0.1.9/24",
                    "nextHop": "10.191.0.27",
                    "description": "test static route 2"
                  }
                ],
                "natIpAddresses": []
              }
            ]
          }
        },
        "bEnd": {
          "locationId": 57,
          "ownerUid": "605cb850-dfb4-4a05-a171-8bf17757b3a2",
          "productUid": "d5518ee1-e915-4e3d-a4e1-a2c7e04f2fdd",
          "vlan": 0,
          "partnerConfig": {
            "name": "awshc",
            "ownerAccount": "684021030471",
            "connectType": "AWSHC"
          }
        },
        "productType": "VXC",
        "connectType": "AWSHC"
      }
    ]
  }
]

Static routes

You can create multiple static routes per interface by adding an ipRoutes array to the interfaces array of the A-End partner configuration object:

"ipRoutes": [
  {
    "prefix": "10.0.0.0/24",
    "nextHop": "10.191.0.26",
    "description": "test static route 1"
  },
  {
    "prefix": "10.0.1.9/24",
    "nextHop": "10.191.0.27",
    "description": "test static route 2"
 }
],
An empty ipRoutes array indicates there are no static routes.

Attribute Description Required Valid Input
prefix IP prefix (V4 & V6) to route to nextHop Yes IP prefix v4/v6 - If no mask is presented address is treated as a host address (/32)
nextHop Next Hop address Yes IP Address v4/v6 - Must be in the same subnet as the interface but not the interface IP
description Optional description of the static route No String - Max length 100 characters

BGP connections

You can create multiple BGP connections per interface by adding a bgpConnections array to the interfaces array of the A-End partner configuration object:

"bgpConnections": [
  {
    "peerAsn": 62512,
    "localIpAddress": "10.191.0.25",
    "peerIpAddress": "10.191.0.26",
    "password": "cnn6eaeaETSjvjvjvjv",
    "shutdown": false,
    "description": "BGP with MED and BFD enabled",
    "medIn": 100,
    "medOut": 100,
    "bfdEnabled": true
  },
  {
    "peerAsn": 62511,
    "localIpAddress": "10.191.0.27",
    "peerIpAddress": "10.191.0.28",
    "password": "cnn23049asdkfj",
    "shutdown": false,
    "description": "BGP without MED or BFD",
    "asPathPrependCount": "3",
    "bfdEnabled": false
  }
],
Attribute Description Required Valid Input
peerAsn The ASN of the remote BGP peer. Yes Valid ASN - Integers between 1 - 4294967294
localAsn Local ASN can override the ASN of the MCR for this BGP peer. In most cases it should be left default. No Valid ASN - Integers between 1 - 4294967294

localAsn cannot be set if peerAsn == mcrAsn

localAsn cannot match peerAsn if peerAsn != mcrAsn
localIpAddress The IPv4 or IPv6 address on this interface to use for communication with the BGP peer. Yes Valid IP address v4/v6. Must be an IP address of the interface
peerIpAddress The IP address of the BGP peer. Yes Valid IP address v4/v6
password A shared key used to authenticate the BGP peer, up to 32 characters. No 0-32 characters
shutdown By default, BGP connections are enabled and will actively attempt to connect to the peer. Select shutdown to temporarily disable the BGP session without removing it. This can be useful for troubleshooting or testing failover scenarios. No true/false - Defaults to false
description Optional description of the BGP connection No 0-100 characters
medIn The MED will be applied to all routes received on this BGP connection. Leave blank to use the value received from the BGP peer. The route with the lowest value will be preferred. No Supports values between 0 and 4,294,967,295
medOut The MED will be applied to all routes transmitted on this BGP connection. The neighboring autonomous system might prefer the lowest value at their discretion. No Supports values between 0 and 4,294,967,295
asPathPrependCount asPathPrependCount is an integer representing the number of times that the local AS number will be prepended on outgoing BGP announcements to the peer. No Acceptable values are in the range 1-10
bfdEnabled Bidirectional Forwarding Detection allows for rapid fault detection on this BGP connection. When connectivity is disrupted the BGP session is torn down without waiting for the BGP hold timer to expire. BFD might improve fail over time when multiple routes are available. No true/false -
Defaults to false
Optional

Bidirectional Forwarding Detection (BFD)

The bfd configuration object applies to all BGP connections on the interface that have bfdEnabled = true. If any BGP connection has bfdEnabled, then the bfd object is required, otherwise it is optional.

Note

These settings will be used for all BGP connections on the VXC where BFD is enabled.

One bfd object is added to each interface.

"bfd": {
  "txInterval": 300,
  "rxInterval": 300,
  "multiplier": 3
},
Attribute Description Required Valid Input
txInterval The minimum time between sending BFD packets to the neighbor. The supported range is 300ms to 9000ms. Yes 300-9000
rxInterval The minimum time between BFD packets that a neighbor sends. The supported range is 300ms to 9000ms. Yes 300-9000
multiplier The BGP session will be torn down if this many consecutive BFD packets are not received from the neighbor. Yes 3-50

Autoconfiguration with AWS, Azure, and Google

For Azure, AWS Hosted VIF, and Google, Megaport can set up the IP addressing and BGP details on both the MCR and the CSP side ensuring a working BGP setup. This also minimizes the amount of switching between the CSP and Megaport portals.

While the Portal handles the autoconfiguration by default, you can also use the API to trigger the BGP autoconfiguration. The functionality is triggered when the interfaces key in partnerConfig does not exist or is null.

To configure BGP peering for CSPs

  1. Create a request with this URL:

    POST {baseUrl}/v3/networkdesign/buy
    
  2. Add these headers to the request:

    • Content-Type: application/json
    • Authorization: Bearer {your accessToken}
  3. Create the Body of the request with the configuration details.

    Different templates are available here for the most popular CSPs.

AWS Hosted VIF

{
"productUid": "{{mcrid}}",
"associatedVxcs": [
 {
   "productName": "Test AWS VIF VXC",
   "rateLimit": 100,
   "term": 12,
   "aEnd": {
     "vlan": 0
   },
   "bEnd": {
     "productUid": "{{awsPortUid}}",
     "partnerConfig": {
       "connectType": "AWS",
       "type": "private",
       "ownerAccount": "{{yourAWSAccountNumber}}"
     }
   }
 }
]
}

Google Cloud

{
   "productUid": "{{mcrid}}",
   "associatedVxcs": [
    {
     "productName": "Test Google VXC",
     "rateLimit": 100,
     "term": 12,
     "aEnd": {
       "vlan": 0
     },
     "bEnd": {
       "productUid": "{{googlePortUid}}",
       "partnerConfig": {
         "connectType": "GOOGLE",
         "pairingKey": "{{googlekey}}"
       }
     },
     "productType": "VXC"
    }
   ]
}

Microsoft Azure

For Azure configuration details, see Creating a VXC between an MCR and Microsoft Azure with the API.


Last update: 2024-04-15