Before deploying Service Mesh, we need to create Compute & Network Profiles in both source & destination HCX environment. The order of Service Mesh deployment is as follows:
- Create Network Profiles in source & destination HCX.
- Create Compute Profiles in source & destination HCX.
- Trigger Service Mesh deployment from on-prem (source) site.
In this post I will demonstrate HCX Service Mesh operations via API.
Some of the most common operation associated with service mesh can be:
- Create profiles (Network & Compute) and deploy service mesh.
- Update Network & Compute profiles to include/remove additional features.
- Delete Network & Compute profiles.
- Update Service Mesh to include/remove additional services.
- Delete Service Mesh.
Let’s jump into lab and look at these operations in action.
Network Profile API
1: List Network Profiles: This API call list all the networks profiles that you have created to be used in service mesh.
|
1 2 3 4 5 |
Method:GET URL:https://{{hcx_host}}/hybridity/api/networks Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
[bg_collapse view=”button-green” color=”#4a4949″ icon=”arrow” expand_text=”Sample Response” collapse_text=”Show Less” ]
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
[ { "name":"OnPrem-IX-Mgmt", "objectId":"network-b17499eb-4110-452c-8ee1-ea868ce8e96d", "description":"", "state":"REALIZED", "l3TenantManaged":true, "allowTrunkInterfaces":false, "mtu":9000, "ipScopesConfig":[ { "source":"LOCAL" } ], "ipScopes":[ { "dnsSuffix":"manish.lab", "gateway":"172.16.10.1", "networkIpRanges":[ { "endAddress":"172.16.10.199", "startAddress":"172.16.10.150" } ], "prefixLength":24 } ], "backings":[ { "backingId":"dvportgroup-26", "backingName":"OnPrem-Mgmt", "type":"DistributedVirtualPortgroup", "vCenterInstanceUuid":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486" } ], "ownedBySystem":true }, { "name":"HCX-vMotion", "objectId":"network-51963dda-2ecc-468e-80b6-e3047011611d", "description":"", "state":"REALIZED", "l3TenantManaged":true, "allowTrunkInterfaces":false, "mtu":9000, "ipScopesConfig":[ { "source":"LOCAL" } ], "ipScopes":[ { "dnsSuffix":"manish.lab", "gateway":"172.16.20.1", "networkIpRanges":[ { "endAddress":"172.16.20.199", "startAddress":"172.16.20.150" } ], "prefixLength":24 } ], "backings":[ { "backingId":"dvportgroup-27", "backingName":"OnPrem-vMotion", "type":"DistributedVirtualPortgroup", "vCenterInstanceUuid":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486" } ], "ownedBySystem":true }, { "name":"HCX-OnPrem-Uplink", "objectId":"network-7be9d6fa-7c6e-46a9-ba61-cdf145cc2915", "description":"", "state":"REALIZED", "l3TenantManaged":true, "allowTrunkInterfaces":false, "mtu":9000, "ipScopesConfig":[ { "source":"LOCAL" } ], "ipScopes":[ { "dnsSuffix":"manish.lab", "gateway":"172.16.90.1", "networkIpRanges":[ { "endAddress":"172.16.90.199", "startAddress":"172.16.90.150" } ], "prefixLength":24 } ], "backings":[ { "backingId":"dvportgroup-29", "backingName":"OnPrem-External", "type":"DistributedVirtualPortgroup", "vCenterInstanceUuid":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486" } ], "ownedBySystem":true } ] |
[/bg_collapse]
Note: Here objectId is the id of the various networks participating in network profiles
2: List Specific Network profile: This API call lists a specific network profile.
|
1 2 3 4 5 |
Method:GET URL:https://{{hcx_host}}/hybridity/api/networks/<network-id> Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
3: Create Network Profile: For a freshly deployed HCX environment, you will first create network profiles
There are few parameters values that you need to obtain before creating network profile via API. These parameters are:
- “backingId”:”LS ID or dv port id>”
- “backingName”:”<LS or DV portgroup name>”
- “vCenterInstanceUuid”:”<uuid>”
These values can be obtained via vsphere API’s or UI.
|
1 2 3 4 5 |
Method:POST URL:https://{{hcx_host}}/admin/hybridity/api/networks Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
[bg_collapse view=”button-green” color=”#4a4949″ icon=”arrow” expand_text=”Payload” collapse_text=”Show Less” ]
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
{ "allowTrunkInterfaces":false, "backings":[ { "backingId":"dvportgroup-29", "backingName":"OnPrem-External", "type":"DistributedVirtualPortgroup", "vCenterInstanceUuid":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486" } ], "enterprise":"DEFAULT", "ipScopes":[ { "dnsSuffix":"manish.lab", "gateway":"172.16.90.1", "networkIpRanges":[ { "endAddress":"172.16.90.199", "startAddress":"172.16.90.150" } ], "prefixLength":24 } ], "l3TenantManaged":true, "name":"HCX-OnPrem-Uplink", "ownedBySystem":true, "mtu":9000 } |
[/bg_collapse]
4: Update Network profile: Using this API, you can modify following:
- Modify IP pool.
- Modify primary/secondary secondary DNS server.
- Modify Subnet Mask & MTU.
- Change backing DV portgroup.
|
1 2 3 4 5 6 7 |
Method:PUT URL:https://{{hcx_host}}/admin/hybridity/api/networks/<network-id> Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} Payload:{Modifiedjson} |
5: Delete Network Profile: Before executing this call, please ensure that network profile is not in used by any service mesh.
|
1 2 3 4 5 |
Method:DELETE URL:https://{{hcx_host}}/admin/hybridity/api/networks/<network-id> Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
Compute Profile API
1: List compute profiles: Below API call list all the compute profiles in a HCX environment.
|
1 2 3 4 5 |
Method:GET URL:https://{{hcx_host}}/hybridity/api/interconnect/computeProfiles Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
[bg_collapse view=”button-green” color=”#4a4949″ icon=”arrow” expand_text=”Sample Response” collapse_text=”Show Less” ]
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
{ "items":[ { "computeProfileId":"d11ef185-ab2b-46c5-ac87-243f8649b894", "name":"OnPrem-CP", "location":"20200930062904750-96c932c5-5c2e-48d3-8fd5-b305ba81f205", "locationName":"hcx-onprem.manish.lab", "state":"VALID", "compute":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "cmpType":"VC", "type":"datacenter", "id":"datacenter-3", "name":"OnPrem-DC02" } ], "services":[ { "name":"INTERCONNECT" }, { "name":"WANOPT" }, { "name":"VMOTION" }, { "name":"BULK_MIGRATION" }, { "name":"NETWORK_EXTENSION" }, { "name":"DISASTER_RECOVERY" } ], "deploymentContainer":{ "compute":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "type":"ResourcePool", "id":"resgroup-46", "name":"Mgmt-RP" } ], "storage":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "type":"Datastore", "id":"datastore-31", "name":"vsanDatastore" } ], "cpuReservation":0, "memoryReservation":0 }, "networks":[ { "id":"network-51963dda-2ecc-468e-80b6-e3047011611d", "name":"HCX-vMotion", "tags":[ "vmotion" ] }, { "id":"network-b17499eb-4110-452c-8ee1-ea868ce8e96d", "name":"OnPrem-IX-Mgmt", "tags":[ "management", "replication" ] }, { "id":"network-7be9d6fa-7c6e-46a9-ba61-cdf145cc2915", "name":"HCX-OnPrem-Uplink", "tags":[ "uplink" ] } ], "switches":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "id":"dvs-24", "type":"VmwareDistributedVirtualSwitch", "name":"OnPrem-VDS", "maxMtu":9000 } ], "storage":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "type":"Datastore", "id":"datastore-31", "name":"vsanDatastore" } ], "lastTaskDetails":{ "interconnectTaskId":"cf0b9162-b11b-4be4-a02d-968de5aeffb1", "type":"computeProfileCreate", "status":"SUCCESS" } } ] } |
[/bg_collapse]
2: Create Compute Profile
|
1 2 3 4 5 |
Method:POST URL:https://{{hcx_host}}/hybridity/api/interconnect/computeProfiles Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
[bg_collapse view=”button-green” color=”#4a4949″ icon=”arrow” expand_text=”Payload” collapse_text=”Show Less” ]
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
{ "name":"OnPrem-CP", "locationName":"hcx-onprem.manish.lab", "state":"VALID", "deploymentComputeClusterName":"Workload-CL01", "deploymentComputeClusterId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "compute":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "cmpType":"VC", "type":"datacenter", "id":"datacenter-3", "name":"OnPrem-DC02" } ], "services":[ { "name":"INTERCONNECT" }, { "name":"WANOPT" }, { "name":"VMOTION" }, { "name":"BULK_MIGRATION" }, { "name":"NETWORK_EXTENSION" }, { "name":"DISASTER_RECOVERY" } ], "deploymentContainer":{ "compute":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "type":"ResourcePool", "id":"resgroup-46", "name":"Mgmt-RP" } ], "storage":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "type":"Datastore", "id":"datastore-31", "name":"vsanDatastore" } ], "cpuReservation":0, "memoryReservation":0 }, "networks":[ { "id":"network-7be9d6fa-7c6e-46a9-ba61-cdf145cc2915", "name":"HCX-OnPrem-Uplink", "tags":[ "uplink" ] }, { "id":"network-51963dda-2ecc-468e-80b6-e3047011611d", "name":"HCX-vMotion", "tags":[ "vmotion" ] }, { "id":"network-b17499eb-4110-452c-8ee1-ea868ce8e96d", "name":"OnPrem-IX-Mgmt", "tags":[ "management", "replication" ] } ], "switches":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "id":"dvs-24", "type":"VmwareDistributedVirtualSwitch", "name":"OnPrem-VDS", "maxMtu":9000 } ], "storage":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "cmpName":"onprem-vc01.manish.lab", "type":"Datastore", "id":"datastore-31", "name":"vsanDatastore" } ] } |
[/bg_collapse]
3: Update Compute Profile
|
1 2 3 4 5 6 7 |
Method:PUT URL:https://{{hcx_host}}/hybridity/api/interconnect/computeProfiles/<compute-profile-id> Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} Payload:{modifiedjson} |
4: Delete Compute Profile
|
1 2 3 4 5 |
Method:DELETE URL:https://{{hcx_host}}/hybridity/api/interconnect/computeProfiles/<compute-profile-id> Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
Service Mesh API
1: List Service Mesh
|
1 2 3 4 5 |
Method:GET URL:https://{{hcx_host}}/hybridity/api/interconnect/serviceMesh Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
[bg_collapse view=”button-green” color=”#4a4949″ icon=”arrow” expand_text=”Sample Response” collapse_text=”Show Less” ]
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
{ "items":[ { "serviceMeshId":"servicemesh-abfd5028-fe2e-42ea-b8dc-162547de71a3", "name":"SM01", "updateAvailable":false, "switchPairCount":[ { "switches":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "id":"dvs-24", "type":"VmwareDistributedVirtualSwitch", "name":"OnPrem-VDS" }, { "cmpId":"555173d7-fe37-40d3-930e-3097b6b7a24d", "id":"/infra/sites/default/enforcement-points/default/transport-zones/c256f5c3-9453-4b1a-89e4-9ea7e04ab08c", "type":"OVERLAY_STANDARD", "name":"SDDC-Overlay-TZ" } ], "l2cApplianceCount":1 } ], "wanoptConfig":{ "uplinkMaxBandwidth":10000000 }, "services":[ { "name":"INTERCONNECT" }, { "name":"WANOPT" }, { "name":"VMOTION" }, { "name":"BULK_MIGRATION" }, { "name":"NETWORK_EXTENSION" }, { "name":"DISASTER_RECOVERY" } ], "computeProfiles":[ { "endpointId":"20200930063347546-22c9fc4a-d88b-4c03-9e26-79f29f7dec37", "endpointName":"hcx.cloud.local", "computeProfileId":"fd78c9b9-2300-4d2b-ab1c-c4192d37cb44", "computeProfileName":"Cloud-CP", "locationType":"nsp", "networks":[ { "id":"network-d2f1a140-0c92-40c5-9eda-5bd34d24e8e4", "name":"HCX-Cloud-EXT", "tags":[ "uplink" ] } ] }, { "endpointId":"20200930062904750-96c932c5-5c2e-48d3-8fd5-b305ba81f205", "endpointName":"hcx-onprem.manish.lab", "computeProfileId":"d11ef185-ab2b-46c5-ac87-243f8649b894", "computeProfileName":"OnPrem-CP", "locationType":"hcm", "networks":[ { "id":"network-7be9d6fa-7c6e-46a9-ba61-cdf145cc2915", "name":"HCX-OnPrem-Uplink", "tags":[ "uplink" ] } ] } ], "trafficEnggCfg":{ "isAppPathResiliencyEnabled":true, "isTcpFlowConditioningEnabled":true }, "state":"COMMITTED", "lastTaskDetails":{ "interconnectTaskId":"51c04206-a297-4c18-87e4-394d185ca1dd", "type":"createServiceMesh", "status":"RUNNING" }, "status":{ "timestamp":1601885731, "services":[ { "serviceName":"INTERCONNECT", "status":"up", "reason":[] }, { "serviceName":"VMOTION", "status":"up", "reason":[] }, { "serviceName":"DISASTER_RECOVERY", "status":"up", "reason":[] }, { "serviceName":"BULK_MIGRATION", "status":"up", "reason":[] }, { "serviceName":"WANOPT", "status":"up", "reason":[] }, { "serviceName":"NETWORK_EXTENSION", "status":"up", "reason":[] } ] } } ] } |
[/bg_collapse]
2: Create Service Mesh
|
1 2 3 4 5 |
Method:POST URL:https://{{hcx_host}}/hybridity/api/interconnect/serviceMesh Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
[bg_collapse view=”button-green” color=”#4a4949″ icon=”arrow” expand_text=”Payload” collapse_text=”Show Less” ]
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
{ "name":"SM01", "computeProfiles":[ { "endpointId":"20200930062904750-96c932c5-5c2e-48d3-8fd5-b305ba81f205", "endpointName":"hcx-onprem.manish.lab", "computeProfileId":"d11ef185-ab2b-46c5-ac87-243f8649b894", "computeProfileName":"OnPrem-CP", "networks":[ { "id":"network-7be9d6fa-7c6e-46a9-ba61-cdf145cc2915", "name":"HCX-OnPrem-Uplink", "tags":[ "uplink" ] } ] }, { "endpointId":"20200930063347546-22c9fc4a-d88b-4c03-9e26-79f29f7dec37", "endpointName":"hcx.cloud.local", "computeProfileId":"fd78c9b9-2300-4d2b-ab1c-c4192d37cb44", "computeProfileName":"Cloud-CP", "networks":[ { "id":"network-d2f1a140-0c92-40c5-9eda-5bd34d24e8e4", "name":"HCX-Cloud-EXT", "tags":[ "uplink" ] } ] } ], "services":[ { "name":"INTERCONNECT" }, { "name":"WANOPT" }, { "name":"VMOTION" }, { "name":"BULK_MIGRATION" }, { "name":"NETWORK_EXTENSION" }, { "name":"DISASTER_RECOVERY" } ], "wanoptConfig":{ "uplinkMaxBandwidth":10000000 }, "trafficEnggCfg":{ "isAppPathResiliencyEnabled":true, "isTcpFlowConditioningEnabled":true }, "switchPairCount":[ { "switches":[ { "cmpId":"a2f80ab4-6f80-4ac7-9e0f-4fb688b76486", "id":"dvs-24", "type":"VmwareDistributedVirtualSwitch", "name":"OnPrem-VDS" }, { "cmpId":"555173d7-fe37-40d3-930e-3097b6b7a24d", "id":"/infra/sites/default/enforcement-points/default/transport-zones/c256f5c3-9453-4b1a-89e4-9ea7e04ab08c", "type":"OVERLAY_STANDARD", "name":"SDDC-Overlay-TZ" } ], "l2cApplianceCount":1 } ] } |
[/bg_collapse]
Response Output: Create service mesh API returns servicemeshID in response which we can use in further operations.
|
1 2 3 4 5 6 |
{ "data":{ "interconnectTaskId":"51c04206-a297-4c18-87e4-394d185ca1dd", "serviceMeshId":"servicemesh-abfd5028-fe2e-42ea-b8dc-162547de71a3" } } |
3: Re-sync Service Mesh
|
1 2 3 4 5 |
Method:POST URL:https://{{hcx_host}}/hybridity/api/interconnect/serviceMesh/<ServiceMesh-ID>/resync Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
4: Update Service Mesh
|
1 2 3 4 5 6 7 |
Method:PUT URL:https://{{hcx_host}}/hybridity/api/interconnect/serviceMesh/<ServiceMesh-ID> Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} Payload:{Modifiedjson} |
5: Delete Service Mesh
|
1 2 3 4 5 |
Method:DELETE URL:https://{{hcx_host}}/hybridity/api/interconnect//serviceMesh/<ServiceMesh-ID> Headers:Accept:application/json,Content-Type:application/json,x-hm-authorization{{HCX-Token}} |
And that’s it for this post.
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing 🙂
