使用 API 呼叫來升級南北向服務虛擬機器。
必要條件
程序
- 使用以下 API 來擷取南北向服務部署的裝載。
GET https://<nsx-manager>/api/v1/serviceinsertion/services/<ns_service_id>
{ "functionalities": [ "NG_FW" ], "implementations": [ "NORTH_SOUTH" ], "attachment_point": [ "TIER1_LR", "TIER0_LR" ], "transports": [ "L2_BRIDGE" ], "on_failure_policy": "BLOCK", "service_deployment_spec": { "deployment_template": [ { "name": "NS_DepTemp", "attributes": [ { "key": "LicenseKey", "display_name": "License", "attribute_type": "STRING", "read_only": false } ] } ], "deployment_specs": [ { "name": "NS_DepSpec", "ovf_url": "http://<server-FQDN/IP>/ovfs/nsxt/NorthSouth/v1/PA-VM-NST-8.1.3-c15.ovf", "min_host_version": "6.5", "host_type": "ESXI", "service_form_factor": "MEDIUM", "svm_version": "1.0" } ], "nic_metadata_list": [ { "interface_label": "eth", "interface_index": 2, "interface_type": "DATA2" }, { "interface_label": "eth", "interface_index": 0, "interface_type": "MANAGEMENT", "user_configurable": true }, { "interface_label": "eth", "interface_index": 1, "interface_type": "DATA1" }, { "interface_label": "eth", "interface_index": 4, "interface_type": "HA2" }, { "interface_label": "eth", "interface_index": 3, "interface_type": "HA1" } ] }, "vendor_id": "ABC_Service", "resource_type": "ServiceDefinition", "id": "9ea92ea7-a6b0-4640-9c28-5b364713e8c0", "display_name": "NS Service_automation", "description": "This service is inserted at T0 & T1 router and it provides advanced security", "_create_user": "admin", "_create_time": 1614099580424, "_last_modified_user": "admin", "_last_modified_time": 1614099580424, "_system_owned": false, "_protection": "NOT_PROTECTED", "_revision": 0 }
- 更新服務部署規格。在這項呼叫中,將以 NS_Deployment_Specfication_11 和 NS_Deployment_Specfication_12 來更新部署規格。
PUT https://<nsx-manager>/api/v1/serviceinsertion/services/<ns_service_id>
{ "functionalities": [ "NG_FW" ], "implementations": [ "NORTH_SOUTH" ], "attachment_point": [ "TIER1_LR", "TIER0_LR" ], "transports": [ "L2_BRIDGE" ], "on_failure_policy": "BLOCK", "service_deployment_spec": { "deployment_template": [ { "name": "NS_DepTemp", "attributes": [ { "key": "LicenseKey", "display_name": "License", "attribute_type": "STRING", "read_only": false } ] } ], "deployment_specs": [ { "name": "NS_Deployment_Specfication_11", "ovf_url": "http://<server-FQDN/IP>/ovfs/nsxt/NorthSouth/v1/PA-VM-NST-8.1.3-c15.ovf", "host_type": "ESXI" }, { "name": "NS_Deployment_Specfication_12", "ovf_url": "http://<server-FQDN/IP>/ovfs/nsxt/NorthSouth/v1/PA-VM-NST-8.1.3-c15.ovf", "host_type": "ESXI" } ], "nic_metadata_list": [ { "interface_label": "eth", "interface_index": 2, "interface_type": "DATA2" }, { "interface_label": "eth", "interface_index": 0, "interface_type": "MANAGEMENT", "user_configurable": true }, { "interface_label": "eth", "interface_index": 1, "interface_type": "DATA1" }, { "interface_label": "eth", "interface_index": 4, "interface_type": "HA2" }, { "interface_label": "eth", "interface_index": 3, "interface_type": "HA1" } ] }, "vendor_id": "ABC_Service", "resource_type": "ServiceDefinition", "id": "9ea92ea7-a6b0-4640-9c28-5b364713e8c0", "display_name": "NS Service_automation", "description": "This service is inserted at T0 & T1 router and it provides advanced security", "_create_user": "admin", "_create_time": 1614099580424, "_last_modified_user": "admin", "_last_modified_time": 1614099580424, "_system_owned": false, "_protection": "NOT_PROTECTED", "_revision": 0 }
- 將第 0 層服務執行個體部署規格名稱更新為 NS_Deployment_Specfication_12。若要更新規格,請使用 GET 呼叫 (前述步驟) 所傳回的回應,並在以下 PATCH 呼叫中提供相同的內容,其中 deployment_spec_name 為 NS_Deployment_Specfication_12。NSX 會升級第 0 層服務虛擬機器。
PATCH https://<nsx-manager>/policy/api/v1/infra/tier-0s/<tier0_LR_id>/locale-services/<tier0_localeservice_id>/service-instances/<tier0_serviceinstance_id>
{ "context_id": "b75193d1-137c-45c2-83b3-8f9d7795ddca", "compute_id": "b75193d1-137c-45c2-83b3-8f9d7795ddca:domain-c16", "storage_id": "datastore-13", "primary_interface_network": "/infra/tier-1s/TIER-1-LR-1/segments/SI_SEGMENT", "primary_interface_mgmt_ip": "10.161.154.2", "secondary_interface_network": "/infra/tier-1s/TIER-1-LR-1/segments/SI_SEGMENT", "secondary_interface_mgmt_ip": "10.161.154.3", "deployment_spec_name": "NS_Deployment_Specfication_12", "failure_policy": "BLOCK", "deployment_template_name": "NS_DepTemp", "attributes": [ { "key": "LicenseKey", "display_name": "License", "value": "adklfjakldfjlkajfkl", "attribute_type": "STRING", "read_only": false } ], "resource_type": "PolicyServiceInstance", "id": "PAN-1", "display_name": "PAN-1", "path": "/infra/tier-0s/Tier0-LR-1/locale-services/tier0localservices/service-instances/PAN-1", "relative_path": "PAN-1", "parent_path": "/infra/tier-0s/Tier0-LR-1/locale-services/tier0localservices", "unique_id": "5500a8e4-255b-4131-9da2-9a9a2be21b32", "marked_for_delete": false, "overridden": false, "partner_service_name": "NS Service_automation", "deployment_mode": "ACTIVE_STANDBY", "transport_type": "L2_BRIDGE", "_create_user": "admin", "_create_time": 1614099590522, "_last_modified_user": "admin", "_last_modified_time": 1614099590527, "_system_owned": false, "_protection": "NOT_PROTECTED", "_revision": 0 }
- 將第 1 層邏輯路由器 1 的服務執行個體部署規格更新為 NS_Deployment_Specfication_12。為此,您可以使用 GET 呼叫所返回的回應,並在 PATCH 呼叫中提供相同的內容,其中 deployment_spec_name 為 NS_Deployment_Specfication_12。NSX 會升級第 1 層閘道服務虛擬機器。
PATCH https://<nsx-manager>/policy/api/v1/infra/tier-1s/<tier1_LR_id>/locale-services/<tier1_LR1_localeservice_id>/service-instances/<tier1_LR1_serviceinstance_id>
{ "context_id": "b75193d1-137c-45c2-83b3-8f9d7795ddca", "compute_id": "b75193d1-137c-45c2-83b3-8f9d7795ddca:domain-c16", "storage_id": "datastore-13", "primary_interface_network": "/infra/tier-1s/TIER-1-LR-1/segments/SI_SEGMENT", "primary_interface_mgmt_ip": "10.161.154.4", "secondary_interface_network": "/infra/tier-1s/TIER-1-LR-1/segments/SI_SEGMENT", "secondary_interface_mgmt_ip": "10.161.154.5", "deployment_spec_name": "NS_Deployment_Specfication_12", "failure_policy": "BLOCK", "deployment_template_name": "NS_DepTemp", "attributes": [ { "key": "LicenseKey", "display_name": "License", "value": "adklfjakldfjlkajfkl", "attribute_type": "STRING", "read_only": false } ], "resource_type": "PolicyServiceInstance", "id": "PAN-1-tier-1", "display_name": "PAN-1-tier-1", "path": "/infra/tier-1s/TIER-1-LR-1/locale-services/1-policyconnectivity-1284/service-instances/PAN-1-tier-1", "relative_path": "PAN-1-tier-1", "parent_path": "/infra/tier-1s/TIER-1-LR-1/locale-services/1-policyconnectivity-1284", "unique_id": "4bd48611-3257-4895-8295-c49fdfa644b3", "marked_for_delete": false, "overridden": false, "partner_service_name": "NS Service_automation", "deployment_mode": "ACTIVE_STANDBY", "transport_type": "L2_BRIDGE", "_create_user": "admin", "_create_time": 1614099595487, "_last_modified_user": "admin", "_last_modified_time": 1614099595489, "_system_owned": false, "_protection": "NOT_PROTECTED", "_revision": 0 }
- 將第 1 層邏輯路由器 2 的服務執行個體部署規格更新為 NS_Deployment_Specfication_12。若要更新部署規格,請使用 GET 呼叫 (前述步驟) 所傳回的回應,並將相同的內容貼到以下 PATCH 呼叫中,其中 deployment_spec_name 為 NS_Deployment_Specfication_12。NSX 會升級第 1 層邏輯路由器 2 服務虛擬機器。
PATCH https://<nsx-manager>/policy/api/v1/infra/tier-1s/<tier1_LR2_id>/locale-services/<tier1_LR2_localeservice_id>/service-instances/<tier1_LR2_serviceinstance_id>
{ "context_id": "b75193d1-137c-45c2-83b3-8f9d7795ddca", "compute_id": "b75193d1-137c-45c2-83b3-8f9d7795ddca:domain-c16", "storage_id": "datastore-13", "primary_interface_network": "/infra/tier-1s/TIER-1-LR-1/segments/SI_SEGMENT", "primary_interface_mgmt_ip": "10.161.154.6", "secondary_interface_network": "/infra/tier-1s/TIER-1-LR-1/segments/SI_SEGMENT", "secondary_interface_mgmt_ip": "10.161.154.7", "deployment_spec_name": "NS_Deployment_Specfication_12", "failure_policy": "BLOCK", "deployment_template_name": "NS_DepTemp", "attributes": [ { "key": "LicenseKey", "display_name": "License", "value": "adklfjakldfjlkajfkl", "attribute_type": "STRING", "read_only": false } ], "resource_type": "PolicyServiceInstance", "id": "PAN-2-tier-1", "display_name": "PAN-2-tier-1", "path": "/infra/tier-1s/TIER-1-LR-2/locale-services/2-policyconnectivity-1359/service-instances/PAN-2-tier-1", "relative_path": "PAN-2-tier-1", "parent_path": "/infra/tier-1s/TIER-1-LR-2/locale-services/2-policyconnectivity-1359", "unique_id": "eb9e61e7-edc3-4c29-93cc-d3c4eeb4a6c7", "marked_for_delete": false, "overridden": false, "partner_service_name": "NS Service_automation", "deployment_mode": "ACTIVE_STANDBY", "transport_type": "L2_BRIDGE", "_create_user": "admin", "_create_time": 1614099599703, "_last_modified_user": "admin", "_last_modified_time": 1614099599705, "_system_owned": false, "_protection": "NOT_PROTECTED", "_revision": 0 }