Sie sind auf Seite 1von 374

NSX API Guide

NSX 6.0.4 for vSphere

This document supports the version of each product listed and


supports all subsequent versions until the document is replaced
by a new edition.

EN-001372-05

NSX API Guide

You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
docfeedback@vmware.com

Copyright 2012 - 2013 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and
intellectual property laws. VMware products are covered by one or more patents listed at
http://www.vmware.com/go/patents.
VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks
and names mentioned herein may be trademarks of their respective companies.

VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com

VMware, Inc.

Contents

AboutThisBook

19

1 OverviewofNSX 21
NSXCapabilities 22
LogicalSwitches 22
LogicalRouters 22
LogicalFirewall 22
LogicalVirtualPrivateNetworks(VPN)s 22
LogicalLoadBalancer 22
ServiceComposer 23
Extensibility 23
NSXComponents 23
NSXManager 23
NSXvSwitch 23
NSXController 23
NSXEdge 24
AnIntroductiontoRESTAPIforNSXUsers 24
HowRESTWorks 24
AbouttheRESTAPI 24
RESTfulWorkflowPatterns 25
ForMoreInformationAboutREST 25
UsingtheNSXRESTAPI 25
PortsRequiredforNSXRESTAPI 26

2 UserManagement 27
ConfiguringSSOonNSXManager 27
QuerySSODetails 28
QuerySSOConfigurationStatus 28
DeleteSSOConfiguration 28
UserManagement 28
GetInformationAboutaUser 28
EnableorDisableaUserAccount 29
RemoveRoleAssignment 29
RoleManagement 30
GetRoleforaUser 30
GetRoleforaNSXManagerUser 30
AddRoleandResourcesforaUser 31
ChangeUserRole 31
GetListofPossibleRoles 32
GetListofScopingObjects 32
DeleteUserRole 33

3 ManagingtheNSXManagerAppliance 35
UpgradingtheApplianceManager 35
UploadUpgradeBundle 35
QueryUpgradeInformation 35
BeginUpgrade 36
QueryUpgradeStatus 37

VMware, Inc.

vShield API Programming Guide

ConfiguringNSXManagerwithvCenterServer 37
ConfigurevCenterServerwithNSXManager 37
QueryConfigurationDetails 37
CertificateManagement 38
GenerateCSRCertificate 38
DownloadCSRCertificate 38
UploadCertificateChain 38
QueryCertificates 39
UploadKeystoreFile 39
ResourceManagement 39
QueryGlobalApplianceManagerInformation 39
QuerySummaryApplianceManagerInformation 40
QueryComponentInformation 40
RebootApplianceManager 41
QueryApplianceManagerCPU 41
QueryApplianceManagerUptime 42
QueryApplianceManagerMemory 42
QueryApplianceManagerStorage 42
WorkingwithNetworkSettings 42
QueryNetworkInformation 42
ConfigureDNSServers 43
DeleteDNSServers 43
WorkingwithTimeSettings 43
ConfigureTimeSettings 43
QueryTimeSettings 44
DeleteTimeSettings 44
WorkingwithLocaleSettings 44
ConfigureLocale 44
QueryLocale 44
WorkingwithSyslogServers 45
ConfigureSyslogServers 45
QuerySyslogServers 45
Retrievessyslogservers. 45
DeleteSyslogServers 45
Deletessyslogservers. 45
ComponentsManagement 46
QueryComponents 46
QuerySpecificComponent 46
QueryComponentDependencies 47
QuerySpecificComponentDependents 47
QueryComponentStatus 47
ToggleSpecificComponentStatus 48
WorkingwithBackupandRestore 48
ConfigureBackupSettings 48
ConfigureOnDemandBackup 49
QueryBackupSettings 49
DeleteBackupConfiguration 50
QueryAvailableBackups 50
RestoreData 50
WorkingwithTechSupportLogs 50
GenerateTechSupportLogs 50
DownloadTechSupportLogs 51
QueryingNSXManagerLogs 51
GetNSXManagerSystemEvents 51
GetNSXManagerAuditLogs 51

VMware, Inc.

Contents

WorkingwithSupportNotifications 51
QueryNotifications 51
DeleteallNotifications 52
AcknowledgeNotifications 52

4 GroupingObjects 53
WorkingwithSecurityGroups 53
CreateSecurityGroup 53
QuerySecurityGroups 55
QueryMembersforaScope 57
QuerySecurityGroupObjects 58
QuerySecurityGroupsthatcontainaVirtualMachine 58
ModifyaSecurityGroup 58
DeleteaSecurityGroup 58
WorkingwithTags 59
CreateSecurityTag 59
QuerySecurityTags 59
ApplyTagtoVirtualMachine 59
DetachTagfromVirtualMachine 60
DeleteTagfromVirtualMachine 60
WorkingwithIPsets 60
CreateanIPset 60
QueryIPsets 60
QueryDetailsofanIPset 61
ModifyanIPset 61
DeleteanIPset 61
WorkingwithMACsets 62
CreateaMACsetonaScope 62
ListMACsetsCreatedonaScope 62
GetDetailsofaMACset 62
ModifyanExistingMACset 62
DeleteaMACset 63
WorkingwithServices 63
ListServicesonaScope 63
AddServicetoaScope 63
GetDetailsofaService 64
ModifyServiceDetails 65
DeleteService 65
WorkingwithServiceGroups 66
AddServiceGroup 66
QueryServiceGroups 66
QueryDetailsofaServiceGroup 67
ModifyServiceGroupDetails 67
DeleteServiceGroupfromScope 68
WorkingwiththeMembersofaServiceGroup 68
QueryServiceGroupMembers 68
AddaMembertotheServiceGroup 69
DeleteaMemberfromtheServiceGroup 69
WorkingwithIPPools 69
AddanIPPool 69
QueryIPPoolDetails 70
ModifyanIPPool 70
AllocatingaNewIPAddress 71
AllocatingaSpecificIPAddress 71
QueryallIPPoolsonScope 72
QueryAllocatedIPAddresses 72
VMware, Inc.

vShield API Programming Guide

ReleaseanIPAddress 73
DeleteanIPPool 73
QueryingObjectIDs 73
QueryDatacenterMOID 73
QueryDatacenterID 73
QueryHostID 74
QueryPortgroupID 74

5 InstallingNSXComponents 75
InstallingLicenses 75
WorkingwithNetworkVirtualizationComponents 76
InstallNetworkVirtualizationComponents 76
UpgradeNetworkVirtualizationComponents 76
DeleteNetworkVirtualizationComponents 77
WorkingwithVXLANforLogicalSwitches 77
WorkingwithControllers 78
AddController 78
QueryControllers 78
QueryControllerAdditionorDeletionDetails 79
QueryControllerTechSupportLogs 79
DeleteController 79
QueryClusterInformation 79
ModifyClusterConfiguration 79
AddControllerSyslogExporter 80
QueryControllerSyslogExporter 80
DeleteControllerSyslogExporter 80
BackupControllerData 81
WorkingwithSegmentIDs 81
AddanewSegmentIDRange 81
QueryallSegmentIDRanges 81
QueryaSpecificSegmentIDRange 82
UpdateaSegmentIDRange 82
DeleteaSegmentIDRange 82
ConfigureVXLAN 83
InstallVXLAN 83
DeleteVXLAN 84
DeleteVXLANwithvdsContext 84
WorkingwithNetworkScopes 84
CreateaNetworkScope 84
EditaNetworkScope 84
UpdateAttributesonaNetworkScope 85
QueryexistingNetworkScopes 85
QueryaSpecificNetworkScope 86
DeleteaNetworkScope 86
ResetCommunication 86
QueryFeaturesonCluster 86
QueryStatusofSpecificResources 87
QueryStatusofChildResources 88
QueryStatusofResourcesbyCriterion 89
WorkingwithServices 90
InstallSecurityFabric 91
ServiceDependency 91
DeployingaServicewithaDependency 92
IdentifyServiceDependency 92
6

VMware, Inc.

Contents

UninstallServiceDependency 92
QueryInstalledServices 92
QueryDetailsaboutaService 93
QueryClusters 93
UpgradeService 94
QueryAgentsonHost 94
QueryAgentInformation 95
QueryAgentsforDeployment 96
WorkingwithConflictingAgencies 97
QueryConflicts 97
RestoreConflictingAgencies 97
DeleteConflictingAgencies 98
DeleteDeploymentUnits 98
UninstallingServices 98

6 WorkingwithLogicalSwitches 101
PreparingforLogicalSwitches 102
ConfiguringSwitches 102
PrepareSwitch 102
QueryConfiguredSwitches 102
QueryConfiguredSwitchesonDatacenter 103
QuerySpecificSwitch 103
DeleteSwitch 103
WorkingwithSegmentIDs 104
AddanewSegmentIDRange 104
QueryallSegmentIDRanges 104
QueryaSpecificSegmentIDRange 105
UpdateaSegmentIDRange 105
DeleteaSegmentIDRange 105
WorkingwithMulticastAddressRanges 105
AddanewMulticastAddressRange 105
QueryallMulticastAddressRanges 106
GetaSpecificMulticastAddressRange 106
UpdateaMulticastAddressRange 107
DeleteaMulticastAddressRange 107
WorkingwithNetworkScopes 107
CreateaNetworkScope 107
EditaNetworkScope 107
UpdateAttributesonaNetworkScope 108
QueryexistingNetworkScopes 108
QueryaSpecificNetworkScope 109
DeleteaNetworkScope 109
WorkingwithVirtualizedNetworks 109
CreateaVXLANVirtualWire 109
QueryallVXLANVirtualWiresonaNetworkScope 110
QueryallVXLANVirtualWiresonallNetworkScopes 110
QueryaSpecificVXLANVirtualWire 111
ModifyControlPlaneMode 111
DeleteaVXLANVirtualWire 112
ManagingtheVXLANVirtualWireUDPPort 112
GetUDPPort 112
UpdateUDPPort 112
QueryingAllocatedResources 112
TestingMulticastGroupConnectivity 113
TestMulticastGroupConnectivityinaNetworkScope 113
TestMulticastGroupConnectivityinaVXLANVirtualWire 113
VMware, Inc.

vShield API Programming Guide

PerformingPingTest

114

7 NSXEdgeLogicalRouterInstallationandManagement 115
InstallingaLogicalRouter 115
QueryaLogicalRouter 116
ModifyaRouter 118
DeletingaRouter 118
WorkingwithInterfaces 118
WorkingwithManagementInterfaces 118
ConfigureManagementInterfaces 118
QueryManagementInterfaces 119
WorkingwithallInterfaces 119
AddInterfaces 119
QueryInterfacesforaNSXEdgeRouter 120
DeleteInterfaces 121
DeleteallInterfaces 121
ManageanNSXEdgeRouterInterface 122
RetrieveInterfacewithSpecificIndex 122
ModifyanInterface 122
DeleteInterfaceConfiguration 122
ConfigureRoutes 123
QueryRoutes 125
DeleteRoutes 128
ManageGlobalRoutingConfiguration 128
SpecifyGlobalConfiguration 128
QueryGlobalRoute 128
ManageStaticRouting 129
ConfigureStaticRoutes 129
QueryStaticRoutes 129
DeleteStaticRoutes 130
ManageOSPFRoutesforNSXEdge 130
ConfigureOSPF 130
QueryOSPF 131
DeleteOSPF 132
ManageISISRoutesforNSXEdge 132
ConfigureISIS 132
QueryISIS 133
DeleteISIS 134
ManageBGPRoutesforNSXEdge 135
ConfigureBGP 135
QueryBGP 136
DeleteBGP 137
WorkingwithBridging 137
ConfigureaBridge 137
QueryBridgeConfiguration 138
QueryBGP 138
DeleteBridgeConfiguration 138

8 NSXEdgeServicesGatewayInstallation,Upgrade,andManagement 139
InstallingNSXEdgeServicesGateway 140
UpgradingvShieldEdge5.1.xor5.5toNSXEdge
QueryInstalledEdges 142
ModifyingNSXEdgeConfiguration 146

142

VMware, Inc.

Contents

DeletingNSXEdge 150
ConfiguringEdgeServicesinAsyncMode 150
QueryAsyncJobStatus 150
QueryallJobs 151
QueryactiveJobs 151
ConfiguringCertificates 151
WorkingwithCertificates 152
CreateCertificate 152
CreateCertificateorCertificateChainforCSR 152
QueryCertificates 152
DeleteCertificate 152
WorkingwithCertificateSigningRequests(CSRs) 153
CreateCSR 153
CreateSelfSignedCertificateforCSR 153
QueryCSRs 153
WorkingwithCertificateRevocationList(CRL) 154
CreateaCRL 154
QueryCRL 154
DeleteCRL 154
WorkingwithNSXEdgeFirewall 154
ConfigureFirewall 155
QueryFirewallConfiguration 156
AppendFirewallRules 158
AddaFirewallRuleAboveaSpecificRule 158
QuerySpecificRule 159
ModifyFirewallRule 159
DeleteaFirewallRule 160
DeleteFirewallConfiguration 160
ManageGlobalFirewallConfiguration 160
QueryGlobalFirewallConfiguration 160
ModifyGlobalConfiguration 161
ManageDefaultFirewallPolicy 161
QueryDefaultFirewallPolicy 161
ModifyDefaultFirewallPolicy 162
QueryFirewallStatistics 162
QueryFirewallStatisticsforRule 162
DisableFirewall 163
WorkingwithNAT 163
ConfigureNAT 163
QueryNATRulesforaEdgeEdge 164
DeleteallNATRules 165
AddaNATRuleaboveaSpecificRule 165
AppendNATRules 165
ModifyaNATRule 166
DeleteaNATRule 166
WorkingwithRouting 166
ConfigureRoutes 166
QueryRoutes 170
DeleteRoutes 170
ManageGlobalRoutingConfiguration 170
SpecifyGlobalConfiguration 170
QueryGlobalRoute 171
ManageStaticRouting 171
ConfigureStaticRoutes 171

VMware, Inc.

vShield API Programming Guide

QueryStaticRoutes 172
DeleteStaticRoutes 172
ManageOSPFRoutesforNSXEdge 173
ConfigureOSPF 173
QueryOSPF 174
DeleteOSPF 175
ManageISISRoutesforNSXEdge 175
ConfigureISIS 175
QueryISIS 176
DeleteISIS 177
ManageBGPRoutesforNSXEdge 177
ConfigureBGP 177
QueryBGP 178
DeleteBGP 179
WorkingwithLoadBalancer 180
ConfigureLoadBalancer 180
QueryLoadBalancerConfiguration 186
DeleteLoadBalancerConfiguration 186
ManageApplicationprofiles 187
AppendApplicationProfile 187
ModifyApplicationProfile 187
QueryApplicationProfile 187
QueryallApplicationProfiles 188
DeleteApplicationProfile 188
DeleteallApplicationProfiles 189
ManageApplicationRules 189
AppendApplicationRule 189
ModifyApplicationRule 189
QueryApplicationRule 189
QueryallApplicationRules 189
DeleteApplicationRule 190
DeleteallApplicationRules 190
ManageLoadBalancerMonitors 190
AppendMonitor 190
ModifyMonitor 190
QueryMonitor 191
QueryallMonitors 191
DeleteMonitor 192
DeleteallMonitors 192
ManageVirtualServers 192
AppendVirtualServer 192
QueryaVirtualServer 193
QueryallVirtualServers 193
DeleteaVirtualServer 194
DeleteallVirtualServer 194
ManageBackendPools 194
AppendBackendPool 194
ModifyaBackendPool 195
QueryBackendPoolDetails 195
QueryallBackendPools 196
DeleteaBackendPool 198
DeleteallBackendPools 198
QueryStatistics 198

10

VMware, Inc.

Contents

UpdateLoadBalancerAccelerationMode 200
UpdateLoadBalancerMemberCondition 200
WorkingwithDHCP 200
ConfigureDHCP 201
QueryDHCPConfiguration 202
DeleteDHCPConfiguration 202
RetrieveDHCPLeaseInformation 203
AppendIPPooltoDHCPConfiguration 203
AppendStaticBindingtoDHCPConfiguration 203
DeleteDHCPPool 204
DeleteDHCPStaticBinding 204
WorkingwithHighAvailability(HA) 204
RetrieveHighAvailabilityConfiguration 205
DeleteHighAvailabilityConfiguration 205
WorkingwithSyslog 205
ConfigureSyslog 205
QuerySyslog 205
DeleteSyslog 206
ManagingSSLVPN 206
EnableorDisableSSLVPN 206
QuerySSLVPNDetails 206
ManageServerSettings 206
ApplyServerSettings 206
QueryServerSettings 207
ConfigurePrivateNetworks 207
AddPrivateNetwork 207
ModifyPrivateNetwork 208
QuerySpecificPrivateNetwork 208
DeletePrivateNetwork 209
DeleteallPrivateNetworks 209
ApplyAllPrivateNetworks 209
ConfigureWebResource 209
AddPortalWebResource 209
ModifyPortalWebResource 210
QueryPortalWebResource 210
QueryallWebResources 210
DeletePortalWebResource 211
DeletesallWebResources 211
ApplyAllWebResources 211
ConfigureUsers 211
AddUser 211
ModifyUser 212
QueryUserDetails 212
DeleteUser 213
DeleteallUsers 213
ApplyallUsers 213
ConfigureIPPool 213
AddIPPool 214
ModifyIPPool 214
QueryIPPool 214
QueryallIPPools 215
DeleteIPPool 215
DeletesallIPPools 215
ApplyallIPPools 215
VMware, Inc.

11

vShield API Programming Guide

ConfigureNetworkExtensionClientParameters 216
ApplyClientConfiguration 216
GetClientConfiguration 216
ConfigureNetworkExtensionClientInstallationPackage
AddClientInstallationPackage 217
ModifyClientInstallationPackage 217
QueryClientInstallationPackage 218
QueryallClientInstallationPackages 218
DeleteClientInstallationPackage 219
DeleteallClientInstallationPackages 219
ApplyallInstallationPackages 219
ConfigurePortalLayouts 220
UploadPortalLogo 220
UploadPhatBanner 220
UploadClientConnectedIcon 220
UploadClientDisconnectedIcon 221
UploadClientDesktopIcon 221
UploadErrorConnectedIcon 221
ApplyLayoutConfiguration 221
QueryPortalLayout 221
ConfigureAuthenticationParameters 222
UploadRSAConfigFile 222
ApplyAuthenticationConfiguration 222
QueryAuthenticationConfiguration 223
ConfigureSSLVPNAdvancedConfiguration 224
Applyadvancedconfiguration 224
QueryAdvancedConfiguration 225
WorkingwithActiveClients 225
QueryActiveClients 225
DisconnectActiveClient 226
ManageLogonandLogoffscripts 226
UploadScript 226
ConfigureScriptParameters 226
ModifyScriptConfiguration 226
QueryScriptConfiguration 227
QueryAllScriptConfigurations 227
DeleteScriptConfiguration 227
DeleteAllScriptConfiguragtions 228
ApplyAllScriptConfigurations 228
ReconfigureSSLVPN 228
QuerySSLVPNConfiguration 231
DeleteSSLVPNConfiguration 234
QuerySSLVPNStatistics 234
WorkingwithL2VPN 235
ConfigureL2VPN 235
QueryL2VPN 237
QueryL2VPNStatistics 237
EnableL2VPN 238
DeleteL2VPN 238
WorkingwithIPSECVPN 238
RetrieveIPSecConfiguration 240
RetrieveIPSecStatistics 241
QueryTunnelTrafficStatistics 242
DeleteIPSecConfiguration 242
12

217

VMware, Inc.

Contents

ManaginganNSXEdge 243
ForceSyncEdge 243
RedeployEdge 243
UpdateDNSSettings 243
ModifyAESNISetting 243
ModifyEdgeApplianceCoreDumpSetting 244
ModifyFIPsSetting 244
ModifyLogSetting 244
QueryEdgeSummary 244
QueryEdgeStatus 246
QueryEdgeTechSupportLogs 248
ManageCLICredentialsandAccess 248
YoucanmodifytheCLIcredentialsandenableordisableSSHservicesforaEdgeEdge.
ModifyCLICredentials 248
ChangeCLIRemoteAccess 249
ManageAutoConfigurationSettings 249
ModifyAutoConfigurationSettings 249
QueryAutoConfigurationSettings 249
WorkingwithAppliances 249
QueryApplianceConfiguration 250
ModifyApplianceConfiguration 250
ChangeApplianceSize 251
ManageanAppliance 251
WorkingwithInterfaces 252
AddInterfaces 252
RetrieveInterfacesforaEdgeEdge 254
DeleteInterfaces 254
ManageaEdgeInterface 255
RetrieveInterfacewithSpecificIndex 255
ModifyanInterface 255
DeleteInterfaceConfiguration 256
QueryInterfaceStatistics 257
QueryStatisticsforallInterfaces 257
QueryStatisticsforUplinkInterfaces 257
QueryStatisticsforInternalInterfaces 258
QueryDashboardStatistics 258

248

9 DistributedFirewallManagement 261
ConfiguringDistributedFirewall 262
QueryFirewallConfiguration 263
ModifyFirewallConfiguration 263
DeleteFirewallConfiguration 265
WorkingwithFirewallSections 266
QueryFirewallSections 266
AddFirewallSection 267
ModifyFirewallSection 268
DeleteFirewallSection 270
WorkingwithFirewallRules 270
QueryFirewallRule 270
AddFirewallRule 271
ModifyFirewallRule 272
QueryStatus 273
QueryFirewallConfigurationStatus 273
QueryLayer3SectionStatus 274
QueryLayer2SectionStatus 275
VMware, Inc.

13

vShield API Programming Guide

SynchronizingandEnablingFirewall 276
ForceSyncHost 276
ForceSyncCluster 276
EnableorDisableAPIsforaCluster 277
ImportingandExportingFirewallConfigurations 277
SaveaConfiguration 277
QueryallSavedConfigurations 278
QueryaSavedConfiguration 278
ModifyaSavedConfiguration 279
DeleteaSavedConfiguration 280
ExportaSavedConfiguration 280
ImportaSavedConfiguration 280
FirewallMigrationSwitch 281
ConfiguringFailSafeModeforDistributedFirewall 282
ConfigureFailSafeModeforvShieldAppFirewall 282
QueryFailSafeModeConfigurationforvShieldAppFirewall 282
WorkingwithSpoofGuard 283
CreateSpoofGuardPolicy 283
ModifySpoofGuardPolicy 283
QuerySpoofGuardPolicy 284
QueryallSpoofGuardPolicies 284
DeleteSpoofGuardPolicy 285
GettingFlowStatisticDetails 285
GetFlowStatistics 285
GetFlowMetaData 287
QueryFlowSummary 288
QueryFlowTable 289
QueryFlowDetails 289
QueryPagedFlowDetails 290
QueryFlowDetailsApplication 290
QueryPagedFlowDetailsApplication 290
FlowExclusion 291
ExcludeFlows 291
QueryExcludedFlows 292
ExcludingVirtualMachinesfromFirewallProtection 293
AddaVirtualMachinetotheExclusionList 293
GetVirtualMachineExclusionList 293
DeleteaVirtualMachinefromExclusionList 294

10 ServiceComposerManagement 295
WorkingwithSecurityPolicies 296
CreatingaSecurityPolicy 296
DescriptionofTags 298
QueryingSecurityPolicies 299
EditaSecurityPolicy 302
DeleteaSecurityPolicy 302
ExportaSecurityPolicyConfiguration 303
ImportaSecurityPolicyConfiguration 303
QuerySecurityActionsforaSecurityPolicy 304
WorkingwithSecurityActions 304
QueryVirtualMachinesforaSecurityAction 304
QuerySecurityActionsApplicableonaSecurityGroup 304
QuerySecurityActionApplicableonAVirtualMachine 309
QuerySecurityPoliciesMappedtoaSecurityGroup 309
QueryServiceProviderData 309

14

VMware, Inc.

Contents

QuerySecurityGroupEffectiveMembership 310
QuerySecurityGroupstowhichaVMBelongs 310

11 DataSecurityConfiguration 311
DataSecurityUserRoles 311
DefiningaDataSecurityPolicy 312
QueryRegulations 312
EnableaRegulation 312
QueryClassificationValue 313
ConfigureaCustomizedRegexasaClassificationValue 313
ViewtheListofExcludableAreas 313
ExcludeAreasfromPolicyInspection 314
SpecifySecurityGroupstobeScanned 315
QuerySecurityGroupsBeingScanned 315
ConfigureFileFilters 316
SavingandPublishingPolicies 317
QuerySavedPolicy 317
QueryPublishedPolicy 318
PublishtheUpdatedPolicy 318
DataSecurityScanning 318
Start,Pause,Resume,orStopaScanOperation 319
QueryStatusforaScanOperation 319
QueryingScanResults 319
GetListofVirtualMachinesBeingScanned 319
GetNumberofVirtualMachinesBeingScanned 320
GetSummaryInformationabouttheLastFiveScans 320
GetInformationforVirtualMachinesScannedDuringPreviousScan 321
RetrieveInformationAboutPreviousScanResults 321
GetXMLRepresentationofPolicyUsedforPreviousScan 321
QueryingViolationDetails 323
GetListofViolationCounts 323
GetListofViolatingFiles 324
GetListofViolatingFilesinCSVFormat 325
GetViolationsinEntireInventory 325
325

12 ActivityMonitoring 327
DataCollection 327
EnableDataCollectiononaSingleVirtualMachine 328
DisableDataCollectiononaSingleVirtualMachine 328
OverrideDataCollection 328
TurnOnKillSwitch 328
TurnOffKillSwitch 329
QueryPerVirtualMachineDataCollection 329
QueryResources 330
Prerequisites 330
ViewOutboundActivity 330
ParameterValues 330
ViewInboundActivity 331
ParameterValues 331
ViewInteractionbetweenInventoryContainers 332
ParameterValues 332
ViewOutboundADGroupActivity 332
ParameterValues 332
QueryUserDetails 333
VMware, Inc.

15

vShield API Programming Guide

ViewOutboundActivity 333
ParameterValues 333
ViewInboundActivity 334
ParameterValues 334
ViewInteractionbetweenInventoryContainers 334
ParameterValues 335
ViewOutboundADGroupActivity 335
ParameterValues 335
ViewVirtualMachineActivityReport 336
ParameterValues 336
QueryDiscoveredUserDetails 337
WorkingwithDomains 338
RegisteraDomainwithNSXManager 338
ParameterValuesforRegister/UpdateDomain 339
QueryDomains 339
DeleteDomain 340
WorkingwithLDAPServers 340
WorkingwithEventLogServers 340
WorkingwithMappingLists 341
WorkingwithActivityMonitoringSyslogSupport 341

13 TaskFrameworkManagement 343
AboutTaskFramework 343
QueryJobInstancesforJobID 344
QueryLatestJobInstancesforJobID 345
BlockRESTThread 345
QueryJobInstancesbyCriterion 345

14 ObjectIDs 347
QueryDatacenterMOID 347
QueryDatacenterID 347
QueryHostID 347
QueryPortgroupID 348
QueryVMID 348

15 vShieldEndpointManagement 349
OverviewofSolutionRegistration 349
RegisteringaSolutionwithvShieldEndpointService 350
RegisteraVendor 350
RegisteraSolution 350
AltitudeofaSolution 350
IPAddressandPortforaSolution 350
ActivateaSolution 351
QueryingRegistrationStatusofvShieldEndpoint 351
GetVendorRegistration 351
GetSolutionRegistration 351
GetIPAddressofaSolution 352
GetActivationStatusofaSolution 352
QueryingActivatedSecurityVirtualMachinesforaSolution 352
QueryActivatedSecurityVirtualMachines 352
QueryActivationInformation 353
UnregisteringaSolutionwithvShieldEndpoint 353
UnregisteraVendor 353
UnregisteraSolution 353
16

VMware, Inc.

Contents

UnsetIPAddress 354
DeactivateaSolution 354
StatusCodesandErrorSchema
ReturnStatusCodes 354
ErrorSchema 355

354

16 DeprecatedAPIs 357
AppendixA:Schemas

359

FirewallSchemas 359
FirewallConfigurationSchema 359
FirewallSectionSchema 360
FirewallSectionsSchema 361
Deprecated:vShieldManagerGlobalConfigurationSchema 361
Deprecated:ESXHostPreparationandUninstallationSchema 366
Deprecated:vShieldAppSchemas 367
vShieldAppConfigurationSchema 367
vShieldAppFirewallSchema 367
vShieldAppSpoofGuardSchema 370
vShieldAppNamespaceSchema 372
ErrorMessageSchema 373

VMware, Inc.

17

vShield API Programming Guide

18

VMware, Inc.

About This Book

Thismanual,theNSXforvSphereAPIGuide,describeshowtoinstall,configure,monitor,andmaintainthe
VMwareNSXsystembyusingRESTAPIrequests..

Intended Audience
ThismanualisintendedforanyonewhowantstouseRESTAPItoprogrammaticallycontrolNSXina
VMwarevSphereenvironment.Theinformationinthismanualiswrittenforexperienceddeveloperswhoare
familiarwithvirtualmachinetechnology,virtualizeddatacenteroperations,andRESTAPIs.Thismanualalso
assumesfamiliaritywithvShield.

VMware Technical Publications Glossary


VMwareTechnicalPublicationsprovidesaglossaryoftermsthatmightbeunfamiliartoyou.Fordefinitions
oftermsastheyareusedinVMwaretechnicaldocumentationgotohttp://www.vmware.com/support/pubs.

Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour
feedbacktodocfeedback@vmware.com.

NSX Documentation
ThefollowingdocumentscomprisethevShielddocumentationset:

NSXforvSphereAdministrationGuide

NSXforvSphereInstallationandUpgrade

NSXAPIProgrammingGuide,thisguide

Technical Support and Education Resources


Thefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.Toaccessthecurrentversion
ofthisbookandotherbooks,gotohttp://www.vmware.com/support/pubs.

Online and Telephone Support


Touseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,and
registeryourproducts,gotohttp://www.vmware.com/support.
Customerswithappropriatesupportcontractsshouldusetelephonesupportforthefastestresponseon
priority1issues.Gotohttp://www.vmware.com/support/phone_support.

VMware, Inc.

19

vShield API Programming Guide

Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto
http://www.vmware.com/support/services.

VMware Professional Services


VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials
designedtobeusedasonthejobreferencetools.Coursesareavailableonsite,intheclassroom,andlive
online.Foronsitepilotprograms andimplementationbestpractices,VMwareConsultingServicesprovides
offeringsto helpyouassess,plan,build,andmanageyourvirtualenvironment.Toaccessinformationabout
educationclasses,certificationprograms,andconsultingservices,gotohttp://www.vmware.com/services.

20

VMware, Inc.

Overview of NSX

VMwareNSXisasoftwarenetworkingandsecurityvirtualizationplatformthatdeliverstheoperational
modelofavirtualmachineforthenetwork.VirtualnetworksreproducetheLayer2Layer7networkmodel
insoftware,allowingcomplexmultitiernetworktopologiestobecreatedandprovisionedprogrammatically
inseconds.NSXalsoprovidesanewmodelfornetworksecurity.Securityprofilesaredistributedtoand
enforcedbyvirtualportsandmovewithvirtualmachines.
NSXsupportsVMwaressoftwaredefineddatacenterstrategy.Byextendingthevirtualizationcapabilitiesof
abstraction,poolingandautomationacrossalldatacenterresourcesandservices,thesoftwaredefineddata
centerarchitecturesimplifiesandspeedstheprovisioningandmanagementofcompute,storageand
networkingresourcesthroughpolicydrivenautomation.Byvirtualizingthenetwork,NSXdeliversanew
operationalmodelfornetworkingthatbreaksthroughcurrentphysicalnetworkbarriersandenablesdata
centeroperatorstoachievebetterspeedandagilitywithreducedcosts.
NSXincludesalibraryoflogicalnetworkingserviceslogicalswitches,logicalrouters,logicalfirewalls,logical
loadbalancers,logicalVPN,anddistributedsecurity.Youcancreatecustomcombinationsoftheseservicesin
isolatedsoftwarebasedvirtualnetworksthatsupportexistingapplicationswithoutmodification,ordeliver
uniquerequirementsfornewapplicationworkloads.Virtualnetworksareprogrammaticallyprovisionedand
managedindependentofnetworkinghardware.Thisdecouplingfromhardwareintroducesagility,speed,and
operationalefficiencythatcantransformdatacenteroperations.
ExamplesofNSXusecasesinclude:

Datacenterautomation

Speedupnetworkprovisioning

Simplifyserviceinsertionvirtualandphysical

StreamlineDMZchanges

SelfServiceEnterpriseIT

Rapidapplicationdeploymentwithautomatednetworkandserviceprovisioningforprivateclouds
andtest/devenvironments

Isolateddev,test,andproductionenvironmentsonthesamephysicalinfrastructure

Multitenantclouds

Automatenetworkprovisioningfortenantswithcustomizationandcompleteisolation

Maximizehardwaresharingacrosstenants

NSX can be configured through the vSphere Web Client, a command line interface (CLI), and REST API.
Thischapterincludesthefollowingtopics:

NSXCapabilitiesonpage 22

NSXComponentsonpage 23

VMware, Inc.

21

vShield API Programming Guide

PortsRequiredforNSXRESTAPIonpage 26

AnIntroductiontoRESTAPIforNSXUsersonpage 24

NSX Capabilities
Logical Switches
Aclouddeploymentoravirtualdatacenterhasavarietyofapplicationsacrossmultipletenants.These
applicationsandtenantsrequireisolationfromeachotherforsecurity,faultisolation,andavoiding
overlappingIPaddressingissues.TheNSXlogicalswitchcreateslogicalbroadcastdomainsorsegmentsto
whichanapplicationortenantvirtualmachinecanbelogicallywired.Thisallowsforflexibilityandspeedof
deploymentwhilestillprovidingallthecharacteristicsofaphysicalnetworksbroadcastdomains(VLANs)
withoutphysicalLayer2sprawlorspanningtreeissues.Alogicalswitchisdistributedandcanspan
arbitrarilylargecomputeclusters.Thisallowsforvirtualmachinemobility(vMotion)withinthedatacenter
withoutlimitationsofthephysicalLayer2(VLAN)boundary.Thephysicalinfrastructuredoesnothaveto
dealwithMAC/FIBtablelimitssincethelogicalswitchcontainsthebroadcastdomaininsoftware.

Logical Routers
Dynamicroutingprovidesthenecessaryforwardinginformationbetweenlayer2broadcastdomains,thereby
allowingyoutodecreaselayer2broadcastdomainsandimprovenetworkefficiencyandscale.NSXextends
thisintelligencetowheretheworkloadsresidefordoingEastWestrouting.Thisallowsmoredirectvirtual
machinetovirtualmachinecommunicationwithoutthecostlyortimelyneedtoextendhops.Atthesame
time,NSXalsoprovidesNorthSouthconnectivity,therebyenablingtenantstoaccesspublicnetworks.

Logical Firewall
LogicalFirewallprovidessecuritymechanismsfordynamicvirtualdatacenters.TheDistributedFirewall
componentofLogicalFirewallallowsyoutosegmentvirtualdatacenterentitieslikevirtualmachinesbased
onVMnamesandattributes,useridentity,vCenterobjectslikedatacenters,andhostsaswellastraditional
networkingattributeslikeIPaddresses,VLANs,etc.TheEdgeFirewallcomponenthelpsyouachievekey
perimetersecurityneedssuchasbuildingDMZsbasedonIP/VLANconstructs,tenanttotenantisolationin
multitenantvirtualdatacenters,NetworkAddressTranslation(NAT),partner(extranet)VPNs,andUser
basedSSLVPNs.
TheFlowMonitoringfeaturedisplaysnetworkactivitybetweenvirtualmachinesattheapplicationprotocol
level.Youcanusethisinformationtoauditnetworktraffic,defineandrefinefirewallpolicies,andidentify
threatstoyournetwork.

Logical Virtual Private Networks (VPN)s


SSLVPNPlusallowsremoteuserstoaccessprivatecorporateapplications.IPSecVPNofferssitetosite
connectivitybetweenanNSXEdgeinstanceandremotesites.L2VPNallowsyoutoextendyourdatacenter
byallowingvirtualmachinestoretainnetworkconnectivityacrossgeographicalboundaries.

Logical Load Balancer


TheNSXEdgeloadbalancerenablesnetworktraffictofollowmultiplepathstoaspecificdestination.It
distributesincomingservicerequestsevenlyamongmultipleserversinsuchawaythattheloaddistribution
istransparenttousers.Loadbalancingthushelpsinachievingoptimalresourceutilization,maximizing
throughput,minimizingresponsetime,andavoidingoverload.NSXEdgeprovidesloadbalancingupto
Layer7.

22

VMware, Inc.

Chapter 1 Overview of NSX

Service Composer
ServiceComposerhelpsyouprovisionandassignnetworkandsecurityservicestoapplicationsinavirtual
infrastructure.Youmaptheseservicestoasecuritygroup,andtheservicesareappliedtothevirtualmachines
inthesecuritygroup.
DataSecurityprovidesvisibilityintosensitivedatastoredwithinyourorganizationsvirtualizedandcloud
environments.BasedontheviolationsreportedbyNSXDataSecurity,youcanensurethatsensitivedatais
adequatelyprotectedandassesscompliancewithregulationsaroundtheworld.

Extensibility
VMwarepartnerscanintegratetheirsolutionswiththeNSXplatform,whichenablescustomerstohavean
integratedexperienceacrossVMwareproductsandpartnersolutions.Datacenteroperatorscanprovision
complex,multitiervirtualnetworksinseconds,independentoftheunderlyingnetworktopologyor
components.

NSX Components
This section describes NSX components. NSX can be configured through the vSphere Web Client, a command line
interface (CLI), and REST API.

NSX Manager
TheNSXManageristhecentralizednetworkmanagementcomponentofNSX,andisinstalledasavirtual
applianceonanyESXhostinyourvCenterServerenvironment.Itprovidesanaggregatedsystemview.
OneNSXManagermapstoasinglevCenterServerenvironmentandmultipleNSXEdge,vShieldEndpoint,
andNSXDataSecurityinstances.

NSX vSwitch
NSXvSwitchisthesoftwarethatoperatesinserverhypervisorstoformasoftwareabstractionlayerbetween
serversandthephysicalnetwork.
Asthedemandsondatacenterscontinuetogrowandaccelerate,requirementsrelatedtospeedandaccessto
thedataitselfcontinuetogrowaswell.Inmostinfrastructures,virtualmachineaccessandmobilityusually
dependonphysicalnetworkinginfrastructureandthephysicalnetworkingenvironmentstheyresidein.This
canforcevirtualworkloadsintolessthanidealenvironmentsduetopotentiallayer2orlayerboundaries,such
asbeingtiedtospecificVLANs.
NSXvSwitchallowsyoutoplacethesevirtualworkloadsonanyavailableinfrastructureinthedatacenter
regardlessoftheunderlyingphysicalnetworkinfrastructure.Thisnotonlyallowsincreasedflexibilityand
mobility,butincreasedavailabilityandresilience.

NSX Controller
NSXcontrollerisanadvanceddistributedstatemanagementsystemthatcontrolsvirtualnetworksand
overlaytransporttunnels.
NSXcontrolleristhecentralcontrolpointforalllogicalswitcheswithinanetworkandmaintainsinformation
ofallvirtualmachines,hosts,logicalswitches,andVXLANs.Thecontrollersupportstwonewlogicalswitch
controlplanemodes,UnicastandHybrid.ThesemodesdecoupleNSXfromthephysicalnetwork.VXLANs
nolongerrequirethephysicalnetworktosupportmulticastinordertohandletheBroadcast,Unknown
unicast,andMulticast(BUM)trafficwithinalogicalswitch.TheunicastmodereplicatesalltheBUMtraffic
locallyonthehostandrequiresnophysicalnetworkconfiguration.Inthehybridmode,someoftheBUM
trafficreplicationisoffloadedtothefirsthopphysicalswitchtoachievebetterperformance.

VMware, Inc.

23

vShield API Programming Guide

NSX Edge
NSXEdgeprovidesnetworkedgesecurityandgatewayservicestoisolateavirtualizednetwork.Youcan
installanNSXEdgeeitherasalogical(distributed)routerorasaservicesgateway.
TheNSXEdgelogical(distributed)routerprovidesEastWestdistributedroutingwithtenantIPaddressspace
anddatapathisolation.Virtualmachinesorworkloadsthatresideonthesamehostondifferentsubnetscan
communicatewithoneanotherwithouthavingtotraverseatraditionalroutinginterface.
TheNSXEdgegatewayconnectsisolated,stubnetworkstoshared(uplink)networksbyprovidingcommon
gatewayservicessuchasDHCP,VPN,NAT,dynamicrouting,andLoadBalancing.Commondeploymentsof
NSXEdgeincludeintheDMZ,VPNExtranets,andmultitenantCloudenvironmentswheretheNSXEdge
createsvirtualboundariesforeachtenant.

An Introduction to REST API for NSX Users


REST,anacronymforREpresentationalStateTransfer,isatermthathasbeenwidelyemployedtodescribean
architecturalstylecharacteristicofprogramsthatrelyontheinherentpropertiesofhypermediatocreateand
modifythestateofanobjectthatisaccessibleataURL.

How REST Works


OnceaURLofsuchanobjectisknowntoaclient,theclientcanuseanHTTPGETrequesttodiscoverthe
propertiesoftheobject.ThesepropertiesaretypicallycommunicatedinastructureddocumentwithanHTTP
ContentTypeofXMLthatprovidesarepresentationofthestateoftheobject.InaRESTfulworkflow,
documents(representationsofobjectstate)arepassedbackandforth(transferred)betweenaclientanda
servicewiththeexplicitassumptionthatneitherpartyneedknowanythingaboutanentityotherthanwhatis
presentedinasinglerequestorresponse.TheURLsatwhichthesedocumentsareavailableareoftensticky,
inthattheypersistbeyondthelifetimeoftherequestorresponsethatincludesthem.Theothercontentofthe
documentsisnominallyvaliduntiltheexpirationdatenotedintheHTTPExpiresheader.
IMPORTANTAllNSXRESTrequestsrequireauthentication.ThedefaultNSXManagerlogincredentialsare
useradminpassworddefault.Unlessyouchangedthese,youcanusethefollowingbasicauthentication,where
YWRtaW46ZGVmYXVsdA==istheBase64encodingofthedefaultcredentialsadmin:default.
Authorization: Basic YWRtaW46ZGVmYXVsdA==

About the REST API


RESTAPIsuseHTTPrequests(oftensentbyscriptorhighlevellanguage)asawayofmakingidempotent
remoteprocedurecallsthatcreate,modify,ordeleteobjectsdefinedbytheAPI.ARESTAPIisdefinedbya
collectionofXMLdocumentsthatrepresenttheobjectsonwhichtheAPIoperates.TheHTTPoperations
themselvesaregenerictoallHTTPclients.TowriteaRESTfulclient,youshouldunderstandHTTPprotocol
andthesemanticsofstandardHTMLmarkup.ForNSXRESTAPI,youmustknowthreethings:

ThesetofobjectsthattheAPIsupports,andwhattheyrepresent.Forexample,whatarevDCandOrg?

HowtheAPIrepresentstheseobjects.Forinstance,whatistheXMLschemafortheNSXEdgefirewall
ruleset?Whatdotheindividualelementsandattributesrepresent?

Howtheclientreferstoanobjectonwhichitwantstooperate.Forexample,whatisamanagedobjectID?

Toanswerthesequestions,youlookatNSXAPIresourceschemas.TheseschemasdefineanumberofXML
types,manyofwhichareextendedbyothertypes.TheXMLelementsdefinedintheseschemas,alongwith
theirattributesandcompositionrules(minimumandmaximumnumberofelementsorattributes,orthe
prescribedhierarchywithwhichelementscanbenested)representthedatastructuresofNSXobjects.Aclient
canreadanobjectbymakinganHTTPGETrequesttotheobjectsresourceURL.Aclientcanwrite(create
ormodify)anobjectwithanHTTPPUTorPOSTrequestthatincludesaneworchangedXMLbodydocument
fortheobject.UsuallyaclientcandeleteanobjectwithanHTTPDELETErequest.

24

VMware, Inc.

Chapter 1 Overview of NSX

Thisdocumentpresentsexamplerequestsandresponses,andprovidesreferenceinformationontheXML
schemasthatdefinetherequestandresponsebodies.

RESTful Workflow Patterns


AllRESTfulworkflowsfallintoapatternthatincludesonlytwofundamentaloperations,whichyourepeatin
thisorderforaslongasnecessary.

MakeanHTTPrequest(GET,PUT,POST,orDELETE).Thetargetofthisrequestiseitherawellknown
URL(suchasNSXManager)oralinkobtainedfromtheresponsetoapreviousrequest.Forexample,a
GETrequesttoanOrgURLreturnslinkstovDCobjectscontainedbytheOrg.

Examinetheresponse,whichcanbeanXMLdocumentoranHTTPresponsecode.Iftheresponseisan
XMLdocument,itmaycontainlinksorotherinformationaboutthestateofanobject.Iftheresponseis
anHTTPresponsecode,itindicateswhethertherequestsucceededorfailed,andmaybeaccompanied
byaURLthatpointstoalocationfromwhichadditionalinformationcanberetrieved.

For More Information About REST


ForacomprehensivediscussionofRESTfrombothclientandserverperspectives,seeRESTfulWebServicesby
LeonardRichardsonandSamRuby,published2007byOReillyMedia.
TherearealsomanysourcesofinformationaboutRESTontheWeb,including:

http://www.infoq.com/articles/restintroduction

http://www.infoq.com/articles/subbuallamarajurest

http://www.stucharlton.com/blog/archives/000141.html

Using the NSX REST API


YouhaveseveralchoicesforprogrammingtheNSXRESTAPI:usingFirefox,Chrome,orcURL.TomakeXML
responsesmorelegible,youcancopyandpastethemintoanXMLfriendlyeditorsuchasxmlcopyeditoror
pspad.
To use the REST API in Firefox
1

LocatetheRESTClientMozillaaddon,andaddittoFirefox.

ClickTools>RESTClienttostarttheaddon.

ClickLoginandentertheNSXlogincredentials,whichthenappearencodedintheRequestHeader.

SelectamethodsuchasGET,POST,orPUT,andtypetheURLofaRESTAPI.Youmightbeaskedtoaccept
orignorethelackofSSLcertificate.ClickSend.
ResponseHeader,ResponseBody,andRenderedHTMLappearinthebottomwindow.

To use the REST API in Chrome


1

SearchtheWebtofindtheSimpleRESTClient,andaddittoChrome.

Clickitsglobelikeicontostartitinatab.

TheSimpleRESTClientprovidesnocertificatecheckinginterface,souseanotherChrometabtoaccept
orignorethelackofSSLcertificate.

TypetheURLofaRESTAPI,andselectamethodsuchasGET,POST,orPUT.

IntheHeadersfield,typethebasicauthorizationline,asintheImportantnoteabove.ClickSend.
Status,Headers,andDataappearintheResponsewindow.

VMware, Inc.

25

vShield API Programming Guide

To use the REST API in curl


1

Installcurlifnotalreadyinstalled.

InfrontoftheRESTURL,thekoptionavoidscertificatechecking,andtheuoptionspecifiescredentials.
curl -k -u admin:default https://<vsm-ip>/api/2.0/services/usermgmt/user/admin

Ports Required for NSX REST API


TheNSXManagerrequiresport443/TCPforRESTAPIrequests.

26

VMware, Inc.

User Management

Inmanyorganizations,networkingandsecurityoperationsarehandledbydifferentteamsormembers.Such
organizationsmayrequireawaytolimitcertainoperationstospecificusers.Thistopicdescribestheoptions
providedbyNSXtoconfiguresuchaccesscontrol.NSXalsosupportsSingleSignOn(SSO),whichenables
NSXtoauthenticateusersfromotheridentityservicessuchasActiveDirectory,NIS,andLDAP.
UsermanagementinthevSphereWebClientisseparatefromusermanagementintheCLIofanyNSX
component.
Thechapterincludesthefollowingtopics:

ConfiguringSSOonNSXManageronpage 27

UserManagementonpage 28

UserManagementonpage 28

RoleManagementonpage 30

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Configuring SSO on NSX Manager


Integratingthesinglesignon(SSO)servicewithNSXimprovesthesecurityofuserauthenticationforvCenter
usersandenablesNSXtoauthenticateusersfromotheridentityservicessuchasAD,NIS,andLDAP.
WithSSO,NSXsupportsSecurityAssertionMarkupLanguage(SAML)tokensfromatrustedsourceto
authenticateRESTAPIcalls.NSXManagercanalsoacquireauthenticationSAMLtokensforusewithother
VMwaresolutions.
Example 2-1. Configure SSO
Request:
POST https://<nsxmgr-ip>/api/2.0/services/ssoconfig

RequestBody:
<ssoconfig>
<ssoLookupServiceUrl></ssoLookupServiceUrl>
<ssoAdminUsername></ssoAdminUsername>
<ssoAdminUserpassword></ssoAdminUserpassword>
</ssoConfig>

VMware, Inc.

27

vShield API Programming Guide

Query SSO Details


Example 2-2. Get SSO details
Request:
GET https://<nsxmgr-ip>/api/2.0/services/ssoconfig

ResponseBody:
<ssoConfig>
<vsmSolutionName></vsmSolutionName>
<ssoLookupServiceUrl></ssoLookupServiceUrl>
<ssoAdminUsername></ssoAdminUsername>
</ssoConfig>

Query SSO Configuration Status


Example 2-3. Get SSO configuration status
Request:
GET https://<nsxmgr-ip>/api/2.0/services/ssoconfig/status

ResponseBody:
<boolean></boolean>

Delete SSO Configuration


Example 2-4. Delete SSO configuration
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/ssoconfig/

User Management
TheauthenticationandauthorizationAPIsincludemethodstomanageusersandroles.

Get Information About a User


Youcanretrieveinformationaboutauser.
Example 2-5. Get information about a user
Request:
GET https://<nsxmgr-ip>/api/2.0/services/usermgmt/user/<userId>

RequestBody:
<userInfo>
<objectId></objectId>
<type>
<typeName></typeName>
</type>
<name></name>
<revision></revision>
<objectTypeName></objectTypeName>
<userId></userId>
<fullname></fullname>

28

VMware, Inc.

Chapter 2 User Management

<email></email>
<isLocal></isLocal>
<isEnabled></isEnabled>
<isGroup></isGroup>
<hasGlobalObjectAccess></hasGlobalObjectAccess>
<accessControlEntry>
<role></role>
<resource>
<objectId></objectId>
<type>
<typeName></typeName>
</type>
<name></name>
<revision></revision>
<objectTypeName></objectTypeName>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
</resource>
...
</accessControlEntry>
</userInfo>

Userinformationincludesusername,fullname,emailaddress,whetherlocalornot,whetherenabled,
resourceobjects,roles,andscope.

Enable or Disable a User Account


Youcandisableorenableauseraccount,eitherlocaluserorvCenteruser.Whenauseraccountiscreated,the
accountisenabledbydefault.
Example 2-6. Enable or disable a user account
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/usermgmt/user/<userId>/enablestate/<value>

The<value>canbe0(zero)todisabletheaccount,or1(one)toenabletheaccount.
ThisAPIreturns204NoContentifsuccessful.

Remove Role Assignment


ThefirstAPIremovestheNSXroleassignmentforavCenteruser,withoutaffectingthevCenteraccount.The
secondAPIremovesavCenterusersroles.
Example 2-7. Remove role assignment
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/usermgmt/user/<userId>

Example 2-8. Delete a user role


Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/usermgmt/role/<userId>

BothAPIsreturn204NoContentifsuccessful.7

VMware, Inc.

29

vShield API Programming Guide

Role Management
Whenassigningorretrievingtheroleforauser,youcannotuseabackslash(\)intheusername(userID
parameter).InsteadofspecifyingDomain\user1astheusername,sayuser1@Domain.

Get Role for a User


Youcanretrieveinformationabouttheroleassignedtothisuser.
Example 2-9. Get user role
Request:
GET https://<nsxmgr-ip>/api/2.0/services/usermgmt/role/<userId>

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<accessControlEntry>
<role></role>
<resource>
<objectId></objectId>
<type>
<typeName></typeName>
</type>
<name></name>
<revision></revision>
<objectTypeName></objectTypeName>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
</resource>
<resource>...</resource>
...
...
</accessControlEntry>

Possiblerolesaresuper_user,vshield_admin,enterprise_admin,security_admin,andauditor.

Get Role for a NSX Manager User


YoucanretrieveinformationaboutuserswhohavebeenassignedaNSXManagerrole(localusersaswellas
vCenteruserswiththeNSXManagerrole).
Example 2-10. Get user role
Request:
GET https://<nsxmgr-ip>/api/2.0/services/usermgmt/users/vsm

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<userInfo>
<objectId></objectId>
<type>
<typeName></typeName>
</type><name></name>
<revision></revision>
<objectTypeName></objectTypeName>
<userId></userId>
<fullname></fullname>
<email></email>

30

VMware, Inc.

Chapter 2 User Management

<isLocal></isLocal>
<isEnabled></isEnabled>
<isGroup>false</isGroup>
<hasGlobalObjectAccess></hasGlobalObjectAccess>
<accessControlEntry>
<role></role>
<resource>
<objectId></objectId>
<type>
<typeName></typeName>
</type>
<name></name>
<revision></revision>
<objectTypeName></objectTypeName>
<scope>
<id>group-d1</id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
</resource>
</accessControlEntry>
</userInfo>
<userInfo>
...
</userInfo>
</users>

Possiblerolesaresuper_user,vshield_admin,enterprise_admin,security_admin,andauditor.

Add Role and Resources for a User


Youcanaddroleandaccessibleresourcesforthespecifieduser.ItaffectsonlyvCenterusers,notlocalusers.
Youcannotuseabackslash(\)intheusername(userIDparameter).InsteadofspecifyingDomain\user1asthe
username,sayuser1@Domain.
SetisGroup=truetoassignaroletoagroupandisGroup=falsetoassignaroletoauser.
Example 2-11. Update user role
RequestHeader:
POST https://<nsxmgr-ip>/api/2.0/usermgmt/role/userId??isGroup=true|false

RequestBody:
<accessControlEntry>
<role>new_role</role>
<resource>
<resourceId>resource-num</resourceId>
...
</resource>
</accessControlEntry>

ThisAPIreturns204NoContentifsuccessful.

Change User Role


Youcanupdatetheroleassignmentforagivenuser.TheAPIreturnsanoutputrepresentationspecifyinga
new<accessControlEntry>fortheuser.
Example 2-12. Change user role
RequestHeader:

VMware, Inc.

31

vShield API Programming Guide

PUT https://<nsxmgr-ip>/api/2.0/services/usermgmt/role/<userId>

RequestBody:
<accessControlEntry>
<role>new_role</role>
<resource>
<resourceId>resource-num</resourceId>
...
</resource>
</accessControlEntry>

Possiblerolesaresuper_user,vshield_admin,enterprise_admin,security_admin,andauditor.

Get List of Possible Roles


YoucanretrievethepossiblerolesinNSXManager.
Example 2-13. Get possible roles
Request:
GET https://<nsxmgr-ip>/api/2.0/services/usermgmt/roles

ResponseBody:
<list>
<string></string>
<string></string>
...
</list>

Get List of Scoping Objects


Youcanretrievealistofobjectsthatcanbeusedtodefineausersaccessscope.
Example 2-14. Get scoping objects
Request:
GET https://<nsxmgr-ip>/api/2.0/services/usermgmt/scopingobjects

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<scopingObjects>
<object>
<objectId></objectId>
<type>
<typeName></typeName>
</type>
<name></name>
<revision></revision>
<objectTypeName></objectTypeName>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
</object>
<object>
<objectId></objectId>
<type>
<typeName></typeName>
</type>
<name></name>

32

VMware, Inc.

Chapter 2 User Management

<revision></revision>
<objectTypeName></objectTypeName>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
</object>
...
...
</scopingObjects>

ThescopingobjectsareusuallymanagedobjectreferencesorvCenterServernamesofdatacentersandfolders.

Delete User Role


YoucandeletetheroleassignmentforthespecifiedvCenteruser.Oncethisroleisdeleted,theuserisremoved
fromNSXManager.
Youcannotdeletetheroleforalocaluser.
Example 2-15. Delete role
Request:
DELETE https://<nsxmgr-ip>/api/2.0/usermgmt/role/<user Id>

VMware, Inc.

33

vShield API Programming Guide

34

VMware, Inc.

Managing the NSX Manager


Appliance

Withtheappliancemanagementtool,youcanmanage:

Systemconfigurationslikenetworkconfiguration,syslog,timesettings,andcertificatemanagementetc.

ComponentsofappliancesuchasNSXManager,Postgres,SSHcomponent,Rabbitmqserviceetc.

Overallsupportrelatedfeaturessuchastechsupportlogs,backuprestore,status,andsummaryreports
ofappliancehealth.

Thechapterincludesthefollowingtopics:

UpgradingtheApplianceManageronpage 35

ConfiguringNSXManagerwithvCenterServeronpage 37

CertificateManagementonpage 38

ResourceManagementonpage 39

ComponentsManagementonpage 46

WorkingwithBackupandRestoreonpage 48

WorkingwithTechSupportLogsonpage 50

WorkingwithSupportNotificationsonpage 51

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Upgrading the Appliance Manager


YoucanupgradeNSXManagertoalaterversion.

Upload Upgrade Bundle


Example 3-1. Upload upgrade bundle
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/upgrade/uploadbundle/<component-id>

Query Upgrade Information


Aftertheupgradebundleisuploaded,youcanqueryupgradedetailssuchaspreupgradevalidationwarning
orerrormessagesalongwithpreupgradequestions.

VMware, Inc.

35

vShield API Programming Guide

Example 3-2. Query upgrade information


Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/upgrade/uploadbundle/<component-id>

ResponseBody:
<upgradeInformation>
<fromVersion></fromVersion>
<toVersion></toVersion>
<upgradeBundleDescription></upgradeBundleDescription>
<preUpgradeQuestionsAnswers>
<preUpgradeQuestionAnswer>
<questionId></questionId>
<question></question>
<questionAnserType></questionAnserType>
</preUpgradeQuestionAnswer>
....
<preUpgradeQuestionAnswer>
<questionId></questionId>
<question></question>
<questionAnserType></questionAnserType>
</preUpgradeQuestionAnswer>
</preUpgradeQuestionsAnswers>
<upgradeStepsDto>
<step>
<stepId></stepId>
<stepLabel></stepLabel>
<description></description>
</step>
...
<step>
<stepId></stepId>
<stepLabel></stepLabel>
<description></description>
</step>
</upgradeStepsDto>
<warningMessages></warningMessages>
</upgradeInformation>

Begin Upgrade
Startsupgradeprocess.
Example 3-3. Start upgrade
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/upgrade/start/<component-id>

ResponseBody:
<preUpgradeQuestionsAnswers>
<preUpgradeQuestionAnswer>
<questionId></questionId>
<question></question>
<questionAnserType></questionAnserType>
<answer></answer>
</preUpgradeQuestionAnswer>
...
</preUpgradeQuestionsAnswers>

36

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

Query Upgrade Status


Retrievesupgradestatus.
Example 3-4. Query upgrade status
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/status/<component-id>

ResponseBody:
<upgradeStatus>
<stepStatus>
<upgradeStep>
<stepId></stepId>
<stepLabel></stepLabel>
<description></description>
</upgradeStep>
<status></status>
</stepStatus>
<status></status>
<existingBundleFileName></existingBundleFileName>
</upgradeStatus>

Configuring NSX Manager with vCenter Server


YoucansynchronizeNSXManagerwithavCenterServer,whichenablestheNetworkingandSecuritytabin
thevCenterWebClienttodisplayyourVMwareInfrastructureinventory.

Configure vCenter Server with NSX Manager


Example 3-5. Synchronize NSX Manager with vCenter server
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/vcconfig

RequestBody:
<vcInfo>
<ipAddress></ipAddress>
<userName></userName>
<password></password>
<certificateThumbprint></certificateThumbprint>
<assignRoleToUser></assignRoleToUser>
<pluginDownloadServer></pluginDownloadServer>
<pluginDownloadPort></pluginDownloadPort>
</vcInfo>

Query Configuration Details


Example 3-6. Get vCenter Server configuration details on NSX Manager
Request:
GET https://<nsxmgr-ip>/api/2.0/services/vcconfig

ResponseBody:
<vcInfo>
<ipAddress></ipAddress>
<userName></userName>
<certificateThumbprint></certificateThumbprint>

VMware, Inc.

37

vShield API Programming Guide

<assignRoleToUser></assignRoleToUser>
<vcInventoryLastUpdateTime></vcInventoryLastUpdateTime>
</vcInfo>

Example 3-7. Get default vCenter Server connection status


Request:
GET https://<nsxmgr-ip>/api/2.0/services/vcconfig/status

ResponseBody:
<vcConfigStatus>
<connected></connected>
<lastInventorySyncTime></lastInventorySyncTime>
</vcConfigStatus>

Certificate Management
Generate CSR Certificate
GeneratesCSR.Responseheadercontainscreatedfilelocation.
Example 3-8. Generate CSR
Request:
PUT https://<nsxmgr-ip>/api/1.0/appliance-management/certificatemanager/csr/nsx

RequestBody:
<csr>
<algorithm></algorithm>
<keySize></keySize>
<subjectDto>
<commonName></commonName>
<organizationUnit></organizationUnit>
<organizationName></organizationName>
<localityName></localityName>
<stateName></stateName>
<countryCode></countryCode>
</subjectDto>
</csr>

Download CSR Certificate


DownloadsgeneratedCSRfromappliance.
Example 3-9. Download CSR
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/certificatemanager/csr/nsx

Upload Certificate Chain


InputiscertificatechainfilewhichisaPEMencodedchainofcertificatesreceivedfromtheCAaftersigning
aCSR.

38

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

Example 3-10. Upload certificate chain


Request:
PUT https://<nsxmgr-ip>/api/1.0/appliance-management/certificatemanager/uploadchain/nsx

Query Certificates
Retrievescertificates.
Example 3-11. Query certificates
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/certificatemanager/certificates/nsx

ResponseBody:
<x509Certificates>
<x509certificate>
<subjectCn></subjectCn>
<issuerCn></issuerCn>
<version></version>
<serialNumber></serialNumber>
<signatureAlgo></signatureAlgo>
<signature></signature>
<notBefore></notBefore>
<notAfter></notAfter>
<issuer></issuer>
<subject></subject>
<publicKeyAlgo></publicKeyAlgo>
<publicKeyLength></publicKeyLength>
<rsaPublicKeyModulus></rsaPublicKeyModulus>
<rsaPublicKeyExponent></rsaPublicKeyExponent>
<sha1Hash></sha1Hash>
<md5Hash></md5Hash>
<isCa></isCa>
<isValid></isValid>
</x509certificate>
....
</x509Certificates>

Upload Keystore File


InputisPKCS#12formattedNSXfilealongwithpassword.
Example 3-12. Upload file
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/certificatemanager/pkcs12keystore/nsx?password="123"

Resource Management
Query Global Appliance Manager Information
Retrievesglobalinformationcontainingversioninformationaswellascurrentloggedinuser.
Example 3-13. Query global information
Request:

VMware, Inc.

39

vShield API Programming Guide

GET https://<nsxmgr-ip>/api/1.0/appliance-management/global/info

ResponseBody
<globalInfo>
<currentLoggedInUser>Joe</currentLoggedInUser>
<versionInfo>
<majorVersion>6</majorVersion>
<minorVersion>0</minorVersion>
<patchVersion>0</patchVersion>
<buildNumber>1300000000</buildNumber>
</versionInfo>
</globalInfo>

Query Summary Appliance Manager Information


Retrievessystemsummaryinformationsuchasaddress,dnsname,version,CPU,memory,andstorage.
Example 3-14. Query summary
Request:
GET https://<nsx-ip>/api/1.0/appliance-management/summary/system

ResponseBody:
<systemSummary>
<ipv4Address></ipv4Address>
<dnsName></dnsName>
<applianceName></applianceName>
<versionInfo>
<majorVersion></majorVersion>
<minorVersion></minorVersion>
<patchVersion></patchVersion>
<buildNumber></buildNumber>
</versionInfo>
<uptime></uptime>
<cpuInfoDto>
<totalNoOfCPUs></totalNoOfCPUs>
<capacity></capacity>
<usedCapacity></usedCapacity>
<freeCapacity></freeCapacity>
<usedPercentage></usedPercentage>
</cpuInfoDto>
<memInfoDto>
<totalMemory></totalMemory>
<usedMemory></usedMemory>
<freeMemory></freeMemory>
<usedPercentage></usedPercentage>
</memInfoDto>
<storageInfoDto>
<totalStorage></totalStorage>
<usedStorage></usedStorage>
<freeStorage></freeStorage>
<usedPercentage></usedPercentage>
</storageInfoDto>
<currentSystemDate></currentSystemDate>
</systemSummary>

Query Component Information


Retrievessummaryofallavailablecomponentsavailableandtheirstatusinformation.

40

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

Example 3-15. Query global information


Request:
GET https://<nsx-ip>/api/1.0/appliance-management/summary/components

ResponseBody
<componentsSummary>
<componentsByGroup class="tree-map">
<entry>
<string></string>
<components>
<component>
<componentId></componentId>
<name></name>
<description></description>
<status></status>
<enabled></enabled>
<showTechSupportLogs></showTechSupportLogs>
<usedBy>
<string></string>
</usedBy>
<componentGroup></componentGroup>
</component>
<component>
...
</component>
</components>
</entry>
<entry>
...
</entry>
</componentsByGroup>
</componentsSummary>

Reboot Appliance Manager


Rebootstheappliancemanager.
Example 3-16. Reboot appliance
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/system/restart

Query Appliance Manager CPU


Example 3-17. Query CPU
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/cpuinfo

ResponseBody
<cpuInfo>
<totalNoOfCPUs></totalNoOfCPUs>
<capacity></capacity>
<usedCapacity></usedCapacity>
<freeCapacity></freeCapacity>
<usedPercentage></usedPercentage>
</cpuInfo>

VMware, Inc.

41

vShield API Programming Guide

Query Appliance Manager Uptime


Example 3-18. Query uptime
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/uptime

ResponseBody
<> days, <> hours, <> minutes

Query Appliance Manager Memory


Example 3-19. Query memory
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/meminfo

ResponseBody
<memInfo>
<totalMemory>11996 MB</totalMemory>
<usedMemory>6524 MB</usedMemory>
<freeMemory>5471 MB</freeMemory>
<usedPercentage>54</usedPercentage>
</memInfo>

Query Appliance Manager Storage


Example 3-20. Query storage
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/storageinfo

ResponseBody
<storageInfo>
<totalStorage></totalStorage>
<usedStorage></usedStorage>
<freeStorage></freeStorage>
<usedPercentage></usedPercentage>
</storageInfo>

Working with Network Settings


Query Network Information
Retrievesnetworkinformationsuchasconfiguredhostname,IPaddress,andDNSsettings.
Example 3-21. Query network details
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/network

ResponseBody
<network>
<hostName></hostName>
<domainName></domainName>

42

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

<networkIPv4AddressDto>
<ipv4Address></ipv4Address>
<ipv4NetMask></ipv4NetMask>
<ipv4Gateway></ipv4Gateway>
</networkIPv4AddressDto>
<networkIPv6AddressDto>
<ipv6Address></ipv6Address>
<ipv6PrefixLength></ipv6PrefixLength>
<ipv6Gateway></ipv6Gateway>
</networkIPv6AddressDto>
<dns>
<ipv4Address></ipv4Address>
<ipv6Address></ipv6Address>
<domainList></domainList>
</dns>
</network>

Configure DNS Servers


ConfiguresDNSservers.
Example 3-22. Configure DNS
Request:
PUT https://<nsxmgr-ip>/api/1.0/appliance-management/system/network/dns

RequestBody
<dns>
<ipv4Address></ipv4Address>
<ipv6Address></ipv6Address>
<domainList></domainList>
</dns>

Delete DNS Servers


DeletesDNSservers.
Example 3-23. Configure DNS
Request:
DELETE https://<nsxmgr-ip>/api/1.0/appliance-management/system/network/dns

Working with Time Settings


Configure Time Settings
YoucaneitherconfiguretimeorspecifytheNTPservertobeusedfortimesynchronization.
Example 3-24. Configure time
Request:
PUT https://<nsxmgr-ip>/api/1.0/appliance-management/system/timesettings

ResponseBody
<timeSettings>
<ntpServer>
<string></string>
</ntpServer>

VMware, Inc.

43

vShield API Programming Guide

<datetime></datetime>
<timezone></timezone>
</timeSettings>

Query Time Settings


RetrievestimesettingsliketimezoneorcurrentdateandtimewithNTPserver,ifconfigured.
Example 3-25. Query time settings
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/timesettings

ResponseBody
<timeSettings>
<ntpServer>
<string></string>
<string></string>
</ntpServer>
<datetime></datetime>
<timezone></timezone>
</timeSettings>

Delete Time Settings


DeletesNTPserver.
Example 3-26. Delete NTP
Request:
DELETE https://<nsxmgr-ip>/api/1.0/appliance-management/system/timesettings/ntp

Working with Locale Settings


Configure Locale
Configureslocale.
Example 3-27. Configure locale
Request:
PUT https://<nsxmgr-ip>/api/1.0/appliance-management/system/locale

RequestBody
<locale>
<language>en</language>
<country>US</country>
</locale>

Query Locale
Retrieveslocaleinformation.
Example 3-28. Query locale
Request:

44

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/locale

ResponseBody
<locale>
<language>en</language>
<country>US</country>
</locale>

Working with Syslog Servers


Ifyouspecifyasyslogserver,NSXManagersendsallauditlogsandsystemeventsfromNSXManagertothe
syslogserver.

Configure Syslog Servers


Configuressyslogservers.
Example 3-29. Configure syslog
Request:
PUT https://<nsxmgr-ip>/api/1.0/appliance-management/system/syslogserver

RequestBody
<syslogserver>
<syslogServer></syslogServer>
<port></port>
<protocol></protocol>
</syslogserver>

Query Syslog Servers


Retrievessyslogservers.
Example 3-30. Query syslog
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/system/syslogserver

ResponseBody
<syslogserver>
<syslogServer></syslogServer>
<port></port>
<protocol></protocol>
</syslogserver>

Delete Syslog Servers


Deletessyslogservers.
Example 3-31. Delete syslog
Request:
DELETE https://<nsxmgr-ip>/api/1.0/appliance-management/system/syslogserver

VMware, Inc.

45

vShield API Programming Guide

Components Management
Query Components
RetrievesallApplianceManagercomponents.
Example 3-32. Query components
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/components

ResponseBody
<components>
<component>
<componentId></componentId>
<name></name>
<description></description>
<status></status>
<enabled>true</enabled>
<showTechSupportLogs></showTechSupportLogs>
<usedBy>
<string></string>
</usedBy>
<componentGroup></componentGroup>
</component>
...
<component>
<componentId></componentId>
<name></name>
<description></description>
<status></status>
<enabled>true</enabled>
<showTechSupportLogs></showTechSupportLogs>
<usedBy>
<string></string>
</usedBy>
<componentGroup>
</componentGroup>
</component>
</components>

Query Specific Component


RetrievesdetailsforthespecifiedcomponentID.
Example 3-33. Query component
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/components/component/componentID

ResponseBody
<component>
<componentId></componentId>
<name></name>
<description> Manager</description>
<status></status>
<enabled></enabled>
<showTechSupportLogs></showTechSupportLogs>
<uses>
<string></string>
<string></string>
</uses>

46

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

<usedBy/>
<componentGroup></componentGroup>
<versionInfo>
<majorVersion></majorVersion>
<minorVersion></minorVersion>
<patchVersion></patchVersion>
<buildNumber></buildNumber>
</versionInfo>
</component>

Query Component Dependencies


RetrievesdependencydetailsforthespecifiedcomponentID.
Example 3-34. Query component dependencydetails
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/components/componentID/dependencies

ResponseBody
<list>
<string>VPOSTGRES</string>
<string>RABBITMQ</string>
</list>

Query Specific Component Dependents


Retrievesdependents forthespecifiedcomponentID.
Example 3-35. Query component dependents
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/components/componentID/dependents

ResponseBody
<list>
<string></string>
<string></string>
</list>

Query Component Status


RetrievescurrentstatusforthespecifiedcomponentID.
Example 3-36. Query component status
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/components/componentID/status

ResponseBody
<result>
<result class="status"></result>
<operationStatus></operationStatus>
</result>

VMware, Inc.

47

vShield API Programming Guide

Toggle Specific Component Status


Togglescomponentstatus.
Example 3-37. Toggle status
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/components/componentID/toggleStatus/command

Working with Backup and Restore


YoucanbackupandrestoreyourNSXManagerdata,whichcanincludesystemconfiguration,events,and
auditlogtables.Configurationtablesareincludedineverybackup.Backupsaresavedtoaremotelocation
thatmustbeaccessiblebytheNSXManager.
Forinformationonbackipngupcontrollerdata,seeBackupControllerDataonpage 81.

Configure Backup Settings


ConfiguresbackupontheApplianceManager.
Example 3-38. Configure backup
Request:
PUT https://<nsxmgr-ip>/api/1.0/appliance-management/backuprestore/backupsettings

RequestBody
<backupRestoreSettings>
<ftpSettings>
<transferProtocol></transferProtocol>
<hostNameIPAddress></hostNameIPAddress>
<port></port>
<userName></userName><password></password>
<backupDirectory></backupDirectory>
<filenamePrefix></filenamePrefix>
<passiveMode></passiveMode>
<useEPRT></useEPRT>
<useEPSV></useEPSV>
</ftpSettings>
<backupFrequency>
<frequency></frequency>
<dayOfWeek></dayOfWeek>
<hourOfDay></hourOfDay>
<minuteOfHour></minuteOfHour>
</backupFrequency>
<excludeTables>
<excludeTable></excludeTable>
<excludeTable></excludeTable>
</excludeTables>
</backupRestoreSettings>

where:

48

transferProtocol:FTP,SFTP

frequency:weekly,daily,hourly

dayOfWeek:SUNDAY,MONDAY,....,SATURDAY

HourofDay:[024[

Minuteofhour:[060[

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

ExcludeTables:AUDIT_LOG,SYSTEM_EVENTS,FLOW_RECORDS
ThetablesspecifiedintheexcludeTablesparameterarenotbackedup.

Ifyousetupscheduledbackups,theoutputis:
<scheduledBackupTaskDetails>
<nextExecutionTime></nextExecutionTime>
</scheduledBackupTaskDetails>

Youcanusethefollowingcommandsindividuallytoconfigureaspecificsetting:

ConfigureFTP:
PUThttps://<nsxmgrip>/1.0/appliancemanagement/backuprestore/backupsettings/ftpsettings

Specifytablesthatneednotbebackedup:
PUThttps://<nsxmgrip>/1.0/appliancemanagement/backuprestore/backupsettings/excludedata

Setbackupschedule:
PUThttps://<nsxmgrip>/1.0/appliancemanagement/backuprestore/backupsettings/schedule

Deletebackupschedule
DELETEhttps://<nsxmgrip>/1.0/appliancemanagement/backuprestore/backupsettings/schedule

Configure On-Demand Backup


YoucantakeabackupNSXdataatanygiventime.
Example 3-39. On-demand backup
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/backuprestore/backup

Query Backup Settings


Retrievesbackupsettings.
Example 3-40. Query backup
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/backuprestore/backupsettings

ResponseBody
<backupRestoreSettings>
<ftpSettings>
<transferProtocol></transferProtocol>
<hostNameIPAddress></hostNameIPAddress>
<port></port>
<userName></userName><password></password>
<backupDirectory></backupDirectory>
<filenamePrefix></filenamePrefix>
<passiveMode></passiveMode>
<useEPRT></useEPRT>
<useEPSV></useEPSV>
</ftpSettings>
<backupFrequency>
<frequency></frequency>
<dayOfWeek></dayOfWeek>
<hourOfDay></hourOfDay>
<minuteOfHour></minuteOfHour>
</backupFrequency>
<excludeTables>
<excludeTable></excludeTable>

VMware, Inc.

49

vShield API Programming Guide

<excludeTable></excludeTable>
</excludeTables>
</backupRestoreSettings>

Delete Backup Configuration


DeletesApplianceManagerbackupconfiguration.
Example 3-41. Delete backup settings
Request:
DELETE https://<nsxmgr-ip>/api/1.0/appliance-management/backuprestore/backupsettings

Query Available Backups


Retrieveslistofallbackupsavailableatconfiguredbackuplocation.
Example 3-42. Query backup
Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/backuprestore/backups

ResponseBody:
<list>
<backupFileProperties>
<fileName></fileName>
<fileSize></fileSize>
<creationTime></creationTime>
</backupFileProperties>
...
<backupFileProperties>
<fileName></fileName>
<fileSize></fileSize>
<creationTime></creationTime>
</backupFileProperties>
</list>

Restore Data
Restoresbackupfromspecifiedfile.
Example 3-43. Restore data
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/backuprestore/restore?restoreFile=filename

Working with Tech Support Logs


Generate Tech Support Logs
Generatestechsupportlogs.Responseheadercontainsthelocationofthecreatedtechsupportfile.
Example 3-44. Generate tech support log
Request:

50

VMware, Inc.

Chapter 3 Managing the NSX Manager Appliance

POST https://<nsxmgr-ip>/api/1.0/appliance-management/techsupportlogs/componentID

Download Tech Support Logs


Downloadstechsupportlogs.Responseheadercontainsthelocationofthecreatedtechsupportfile.
Example 3-45. Generate tech support log
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/techsupportlogs/filename

Querying NSX Manager Logs


YoucanretrieveNSXManagersystemeventandauditlogs.

Get NSX Manager System Events


YoucanretrieveNSXManagersystemevents.
Example 3-46. Get NSXManagersystemevents
Request:
GET https://<vsm-ip>/api/2.0/systemevent?startIndex=0\&pageSize=10

Where

start indexisanoptionalparameterwhichspecifiesthestartingpointforretrievingthelogs.Ifthis
parameterisnotspecified,logsareretrievedfromthebeginning.

page sizeisanoptionalparameterthatlimitsthemaximumnumberofentriesreturnedbytheAPI.The
defaultvalueforthisparameteris256andthevalidrangeis11024.

Get NSX Manager Audit Logs


YoucangetNSXManagerauditlogs.
Example 3-47. GetNSXManagerauditlogs
Request:
GET https://<nsxmgr-ip>/api/2.0/logging/auditlog?startIndex=0\&pageSize=10

Where

start indexisanoptionalparameterwhichspecifiesthestartingpointforretrievingthelogs.Ifthis
parameterisnotspecified,logsareretrievedfromthebeginning.

page sizeisanoptionalparameterthatlimitsthemaximumnumberofentriesreturnedbytheAPI.The
defaultvalueforthisparameteris256andthevalidrangeis11024.

Working with Support Notifications


Query Notifications
Retrievesallsystemgeneratednotifications.

VMware, Inc.

51

vShield API Programming Guide

Example 3-48. Query notifications


Request:
GET https://<nsxmgr-ip>/api/1.0/appliance-management/notifications

ResponseBody:
<notifications>
<notification>
<id></id>
<notification></notification>
<notificationStatus></notificationStatus>
</notification>
</notifications>

Delete all Notifications


Deletesallsystemgeneratednotificationsregardlessofwhethertheyhavebeenackowledged.
Example 3-49. Delete notifications
Request:
DELETE https://<nsxmgr-ip>/api/1.0/appliance-management/notifications

Acknowledge Notifications
Acknowledgesanotification.Thenotificationisthendeletedfromthesystem.
Example 3-50. Ackonwledge notification
Request:
POST https://<nsxmgr-ip>/api/1.0/appliance-management/notifications/NotificationId/acknowledge

52

VMware, Inc.

Grouping Objects

The Grouping feature enables you to create custom containers to which you can assign resources.
Thechapterincludesthefollowingtopics:

WorkingwithSecurityGroupsonpage 53

WorkingwithTagsonpage 59

WorkingwithIPsetsonpage 60

WorkingwithMACsetsonpage 62

WorkingwithServicesonpage 63

WorkingwithServiceGroupsonpage 66

WorkingwithIPPoolsonpage 69

QueryingObjectIDsonpage 73

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Working with Security Groups


AsecuritygroupisacollectionofassetsorgroupingobjectsfromyourvSphereinventory.

Create Security Group


Youcancreateanewsecuritygrouponaglobalscope.Inheritanceisnotallowed.
TheresponseofthecallhasLocationheaderpopulatedwiththeURIusingwhichthecreatedobjectcanbe
fetched.
Example 4-1. Create new security group
Request:
POST https://<nsxmgr-ip>/api/2.0/services/securitygroup//bulk/<scopeID>

RequestBody:
<securitygroup>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
VMware, Inc.

53

vShield API Programming Guide

<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle></clientHandle>
<extendedAttributes/>
<member>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle></clientHandle>
<extendedAttributes/>
</member>
<member>
...
</member>
<member>
...
</member>
<excludeMember>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle></clientHandle>
<extendedAttributes/>
</excludeMember>
<excludeMember>
...
</excludeMember>
<excludeMember>
...
</excludeMember>
<dynamicMemberDefinition>
<dynamicSet>
<operator></operator>
<dynamicCriteria>
<operator></operator>
<key></key>
<criteria></criteria>
<value></value>

54

VMware, Inc.

Chapter 4 Grouping Objects

</dynamicCriteria>
<dynamicCriteria>
....
</dynamicCriteria>
</dynamicSet>
<dynamicSet>
....
</dynamicSet>
</dynamicMemberDefinition>
</securitygroup>

wheredynamicMemberDefinitionincudesthefollowing:

dynamicSetrepresentsarulesetasrepresentedontheUI.Therecanbemultipledynamicsetsinside
dynamicmemberdefinition.

operator:specifieshowtocombinetheresultsoftwodynamicsets.Theoperatorpresentinthisdynamic
setisusedtocombinetheresultofthedynamicset(s)evalutedpreviouslywiththeresultofthisdynamic
set.
Thecombiningtakesplaceserially.ConsiderthreedynamicsetsDS1,DS2andDS3
ThepossiblevaluesforthisfieldareANDandOR.

dynamicCriteriadefinestheactualcriteriaforthemembership.TherecanbemultipledynamicCriteria
insideadynamicSet.
AllthedynamicCriteriainadynamicSetmusthavethesameoperator.

keyspecifiestheobjectandtheattributeonwhichtheconditionhastobeapplied.Eg:VM.name.The
keycanbeanyobjectattributethatissupportedbytheDynamicMemberAPI.

criteriaspecifiestheconditionthathastoappliedtothekeywithrespecttothevalue.Differentconditions
aredefinedfordifferentdatatypes.Forstringdatatype,theconditioncanbe=,!=,contains,doesnot
contain,etc.Fornumericaldatatypes,conditioncanbe=,!=,<,etc.

valueisastringtowhichkeyhastocomparedusingthecriteria.

Query Security Groups


Youcanretrieveallthesecuritygroupsthathavebeencreatedonaspecificscope.
Duetothedynamicnatureofsecuritygroups,changestothevirtualmachinelistingofsecuritygroupsor
changestotheservicesassociatedwithavirtualmachinearelikelytogetreflectedafewsecondsafterthe
securitygroupchange.Hence,thereshouldadelayofafewsecondsbetweenasecuritygroupmodification
andrunningaGETcallonit.
Example 4-2. Query all security groups on NSX Manager
Request:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/scope/<scopeID>

ResponseBody
<?xml version="1.0" encoding="UTF-8"?>
<list>
<securitygroup>
<objectId></objectId>
<objectTypeName></objectTypeName>
<nsxmgrUuid></nsxmgrUuid>
<revision></revision>
<type>
<typeName></typeName>

VMware, Inc.

55

vShield API Programming Guide

</type>
<name></name>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle></clientHandle>
<extendedAttributes/>
<member>
<objectId></objectId>
<objectTypeName></objectTypeName>
<nsxmgrUuid></nsxmgrUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle></clientHandle>
<extendedAttributes/>
</member>
<member>
...
</member>
<member>
...
</member>
<excludeMember>
<objectId></objectId>
<objectTypeName></objectTypeName>
<nsxmgrUuid></nsxmgrUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle></clientHandle>
<extendedAttributes/>
</excludeMember>
<excludeMember>
...
</excludeMember>
<excludeMember>
...
</excludeMember>
<dynamicMemberDefinition>
<dynamicSet>
<operator></operator>
<dynamicCriteria>
<operator></operator>
<key></key>
<criteria></criteria>

56

VMware, Inc.

Chapter 4 Grouping Objects

<value></value>
</dynamicCriteria>
<dynamicCriteria>
....
</dynamicCriteria>
</dynamicSet>
<dynamicSet>
....
</dynamicSet>
</dynamicMemberDefinition>
</securitygroup>
<securitygroup>
....
</securitygroup>
<securitygroup>
....
</securitygroup>
</list>

where<scopeID>istheNSXManagerID.
Thefollowingcommandretrievesdetailsforthespecifiedsecuritygroup:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/<securityGroupID>

ThefollowingcommadretrievesallinternalsecuritygroupsontheNSXManager.Internalsecuritygroupsare
usedinternallybythesystemandarenotcreatedormanagedbyendusers.Youshouldnotmodifythese.
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/internal/scope/<scopeID>

Query Members for a Scope


Youcanretrievealistofapplicablememberelementsthatcanbeaddedtosecuritygroupscreatedona
particularscope.Becausesecuritygroupallowsonlyspecifictypeofcontainerelementstobeadded,thislist
helpsyoudetermineallpossiblevalidelementsthatcanbeadded.
Example 4-3. Get members for a security group scope
Request:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/scope/<scopeID>/memberTypes

ResponseBody:
<list>
<basicinfo>
<objectId></objectId>
<objectTypeName></objectTypeName>
<nsxmgrUuid></nsxmgrUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle />
<extendedAttributes />

VMware, Inc.

57

vShield API Programming Guide

</basicinfo>
<basicinfo>
...
</basicinfo>
<basicinfo>
...
</basicinfo>
</list>

NotethatthisAPIcommandrequiresaslash(/)attheend.
Usethefollowingcommandtoretrievemembersofaspecifictypeunderascope:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/scope/<scopeID>/members/memberType

Query Security Group Objects


Retrieveslistofentities(IpNodes,MacNodes,VmNodes,orVnicNodes)thatbelongtoaspecificsecurity
group.
Example 4-4. Query security group members
Request:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/{securityGroupId}/translation/virtualmachines
GET https://<nsxmgr-ip>/api//2.0/services/securitygroup/{securityGroupId}/translation/ipaddresses
GET https://<nsxmgr-ip>/api//2.0/services/securitygroup/{securityGroupId}/translation/macaddresses
GET https://<nsxmgr-ip>/api//2.0/services/securitygroup/{securityGroupId}/translation/vnics

Query Security Groups that contain a Virtual Machine


Retrieveslistofsecuritygroupstowhichthespecifiedvirtualmachinebelongsto.
Example 4-5. Query Security Groups that contain a Virtual Machine
Request:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/lookup/virtualmachine/<virtualMachineId>

Modify a Security Group


Tomodifyasecuritygroup,youmustqueryitfirstandthenmodifytheoutput.Themodifiedoutputcanthen
bespecifiedastherequestbody.
Example 4-6. Modify a security group
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/securitygroup/bulk/<securitygroup-id>

RequestBody:
SeeExample 41.

Delete a Security Group


Youcandeleteanexistingsecuritygroup.

58

VMware, Inc.

Chapter 4 Grouping Objects

Example 4-7. Delete a security group


Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/securitygroup/<securitygroup-id>

Working with Tags


You can view security tags applied on a virtual machine or create a user defined security tag.

Create Security Tag


Createsanewsecuritytag.
Example 4-8. Create tag
Request:
POST https://<nsxmgr-ip>/api/2.0/services/securitytags/tag

RequestBody:
<securityTag>
<objectTypeName>SecurityTag</objectTypeName>
<type><typeName>SecurityTag</typeName></type>
<name>TAG_NAME</name>
<description>description of the tag</description>
<extendedAttributes/>
</securityTag>

Query Security Tags


Retrievessecuritytags.
Example 4-9. Query tag
Request:
GET https://<nsxmgr-ip>/api/2.0/services/securitytags/tag

ResponseBody:
<securityTags>
<securityTag>
<objectId>tag-id</objectId>
<objectTypeName>SecurityTag</objectTypeName>
<type><typeName>SecurityTag</typeName></type>
<name>TAG_NAME</name>
<description>description of the tag</description>
<extendedAttributes/>
</securityTag>
</securityTags>

Apply Tag to Virtual Machine


Appliessecuritytagtovirtualmachine.
Example 4-10. Apply tag
Request:

VMware, Inc.

59

vShield API Programming Guide

PUT https://<nsxmgr-ip>/api/2.0/services/securitytags/tag/{TagIdentifierString}/vm/{vmMoid}

Detach Tag from Virtual Machine


Detachessecuritytagfromvirtualmachine.
Example 4-11. Detach tag
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/securitytags/tag/{TagIdentifierString}/vm/{vmMoid}

Delete Tag from Virtual Machine


Deletestags.
Example 4-12. Delete tag
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/securitytags/tag/{TagIdentifierString}

Working with IPsets


YoucangroupasetofIPaddressesintoanIPSet.

Create an IPset
AllIPsetsarecreatedontheglobalscope.
Example 4-13. Create IPset
Request:
POST hnsxmgrttps://<nsxmgr-ip>/api/2.0/services/ipset/<scope-moref>

RequestBodyExample:
<ipset>
<objectId />
<type>
<typeName />
</type>
<description>
New Description
</description>
<name>TestIPSet2</name>
<revision>0</revision>
<objectTypeName />
<value>10.112.201.8-10.112.201.14</value>
</ipset>

where<scopemoref>isglobalroot0.
Intherequestbodyexample,arangeofIPaddressesonthe10.112netisspecified(201.8to201.14).

Query IPsets
YoucanretrievealltheIPsets.

60

VMware, Inc.

Chapter 4 Grouping Objects

Example 4-14. List IPsets on a scope


Request:
GET https://<nsxmgr-ip>/api/2.0/services/ipset/scope/<scope-moref>

where<scopemoref>isglobalroot0.

Query Details of an IPset


YoucanretrievedetailsaboutanIPset.
Example 4-15. Get details of an IPset
Request:
GET https://<nsxmgr-ip>/api/2.0/services/ipset/<ipset-id>

The<ipset-id>isasreturnedbylistingtheIPsetonascope.

Modify an IPset
YoucanmodifyanexistingIPsetandretrievedetailsaboutthemodifiedIPset.
Example 4-16. Modify an IPset
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/ipset/<ipset-id>

RequestBodyExample:
<ipset>
<objectId />
<type>
<typeName />
</type>
<description>
New Description
</description>
<name>TestIPSet2</name>
<revision>0</revision>
<objectTypeName />
<value>10.112.201.8-10.112.201.21</value>
</ipset>

The<ipset-id>isasreturnedbylistingtheIPsetonascope.Intherequestbodyexample,theIPaddressrange
isdoubled.

Delete an IPset
YoucandeleteanIPset.Thetrailingbooleanflagindicatesforcedorunforceddelete.Withforceddelete,the
objectisdeletedevenifusedinotherplacessuchasfirewallrules,causinginvalidreferrals.Forunforced
delete,theobjectisdeletedonlyifitisnotusedbyotherconfiguration;otherwisethedeletefails.
Example 4-17. Delete an IPset
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/ipset/<ipset-id>?force=<true|false>

VMware, Inc.

61

vShield API Programming Guide

Working with MACsets


Create a MACset on a Scope
YoucancreateaMACsetonthespecifiedscope.Onsuccess,theAPIreturnsastringidentifierforthenew
MACset.
Example 4-18. Create MACset on a scope
Request:
POST https://<nsxmgr-ip>/api/2.0/services/macset/scope/<scope-moref>

RequestBodyExample:
<macset>
<objectId />
<type>
<typeName />
</type>
<description>Some description</description>
<name>TestMACSet1</name>
<revision>0</revision>
<objectTypeName />
<value>22:33:44:55:66:77,00:11:22:33:44:55,aa:bb:cc:dd:ee:ff</value>
</macset>

where<scopemoref>isglobalroot0.Intherequestbodyexample,acommaseparatedlistofMACaddresses
isspecified.

List MACsets Created on a Scope


YoucanretrievealltheMACsetsthatwerecreatedonthespecifiedscope.
Example 4-19. List MACsets on a scope
Request:
GET https://<nsxmgr-ip>/api/2.0/services/macset/<scope-moref>

where<scopemoref>isglobalroot0.

Get Details of a MACset


YoucanretrievedetailsaboutaMACset.
Example 4-20. Get details of a MACset
Request:
GET https://<nsxmgr-ip>/api/2.0/services/macset/<macset-id>

The<MACset-id>isasreturnedbylistingtheMACsetonascope.

Modify an Existing MACset


YoucanmodifyanexistingMACsetandretrievedetailsaboutthemodifiedMACset.
Example 4-21. Modify details of a MACsets
Request:

62

VMware, Inc.

Chapter 4 Grouping Objects

PUT https://<nsxmgr-ip>/api/2.0/services/MACset/<MACset-id>

RequestBody:
<macset>
<objectId />
<type>
<typeName />
</type>
<description>Some description</description>
<name>TestMACSet1</name>
<revision>1</revision>
<objectTypeName />
<value>22:33:44:55:66:77,00:11:22:33:44:55</value>
</macset>

The<MACset-id>isasreturnedbylistingtheMACsetonascope.Intherequestbodyexample,oneMAC
addressfewerisspecified.

Delete a MACset
YoucandeleteaMACset.Thetrailingbooleanflagindicatesforcedorunforceddelete.Withforceddelete,the
objectisdeletedevenifusedinotherplacessuchasfirewallrules,causinginvalidreferrals.Forunforced
delete,theobjectisdeletedonlyifitisnotusedbyotherconfiguration;otherwisethedeletefails.
Example 4-22. Delete a MACset
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/macset/<macset-id>

Working with Services


List Services on a Scope
Youcanretrievealistofservicesthathavebeencreatedonthescopespecifiedbymanagedobjectreference
<moref>.
Example 4-23. List services on a given scope
Request:
GET https://<nsxmgr-ip>/api/2.0/services/application/scope/<moref>

Anonexistentscoperesultsina400BadRequesterror.

Add Service to a Scope


Youcancreateanewserviceonthespecifiedscope.
Example 4-24. Add a service to a scope
Request:
POST https://<nsxmgr-ip>/api/2.0/services/application/<moref>

RequestBody:
<application>
<objectId/>
<type>
<typeName/>

VMware, Inc.

63

vShield API Programming Guide

</type>
<description>Some description</description>
<name>TestApplication1</name>
<revision>0</revision>
<objectTypeName/>
<element>
<applicationProtocol>UDP</applicationProtocol>
<value>9,22-31,44</value>
</element>
</application>

ForapplicationProtocol,possiblevaluesare:

TCP

UDP

ORACLE_TNS

FTP

SUN_RPC_TCP

SUN_RPC_UDP

MS_RPC_TCP

MS_RPC_UDP

NBNS_BROADCAST

NBDG_BROADCAST

OnlyTCPandUDPsupportcommaseparatedportnumbersanddashseparatedportranges.Otherprotocols
supportasingleportnumberonly.
Onsuccess,thiscallreturnsastringidentifierforthenewlycreatedapplication,forinstanceApplication-1.The
locationheaderinthereplycontainstherelativepathofthecreatedApplicationandcanbeusedforfurther
GET,PUT,andDELETEcalls.

Get Details of a Service


Youcanretrievedetailsabouttheservicespecifiedby<applicationgroup-id>asreturnedbythecallshownin
Example 424.
Example 4-25. Retrieve details about a service
Request:
GET https://<nsxmgr-ip>/api/2.0/services/application/<application-id>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<application>
<objectId>
application-45
</objectId>
<type>
<typeName>
Application
</typeName>
</type>
<name>
TestApplication1
</name>
<revision>
1
</revision>
<objectTypeName>
Application
</objectTypeName>

64

VMware, Inc.

Chapter 4 Grouping Objects

<scope>
<id>
datacenter-2
</id>
<objectTypeName>
Datacenter
</objectTypeName>
<name>
AmolDC
</name>
</scope>
<inheritanceAllowed>
false
</inheritanceAllowed>
<element>
<applicationProtocol>
UDP
</applicationProtocol>
<value>
9,22-31,44
</value>
</element>
</application>

AnonexistentapplicationIDresultsina404NotFounderror.

Modify Service Details


Youcanmodifythename,description,applicationProtocol,orportvalueofaservice.
Example 4-26. Modify application
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/application/<application-id>

RequestBody:
<application>
<objectId>Application-1</objectId>
<type>
<typeName>Application</typeName>
</type>
<description>Some description</description>
<name>TestApplication</name>
<revision>2</revision>
<objectTypeName>Application</objectTypeName>
<element>
<applicationProtocol>TCP</applicationProtocol>
<value>10,29-30,45</value>
</element>
</application>

ThecallreturnsXMLdescribingthemodifiedservice.

Delete Service
Youcandeleteaservicebyspecifyingits<applicationgroup-id>.Theforce=flagindicatesifthedeleteshouldbe
forcedorunforced.Forforceddeletes,theobjectisdeletedirrespectiveofitsuseinotherplacessuchasfirewall
rules,whichinvalidatesotherconfigurationsreferringtothedeletedobject.Forunforceddeletes,theobjectis
deletedonlyifitisnotbeingusedbyanyotherconfiguration.Thedefaultisunforced(false).
Example 4-27. Delete service
Request:
VMware, Inc.

65

vShield API Programming Guide

DELETE https://<nsxmgr-ip>/api/2.0/services/application/<application-id>?force=<true|false>

Working with Service Groups


Add Service Group
Youcancreateanewservicegrouponthespecifiedscope.
Example 4-28. Add a service group to a scope
Request:
POST https://<nsxmgr-ip>/api/2.0/services/applicationgroup/<scope-moref>

RequestBody:
<applicationGroup>
<description>Some description</description>
<name>TestApplication1</name>
<revision>0</revision>
<inheritanceAllowed>false</inheritanceAllowed>
</applicationGroup>

Query Service Groups


Youcanretrievealistofservicegroupsthathavebeencreatedonthescopespecifiedbymanagedobject
reference<moref>.
Example 4-29. List service groups on a given scope
Request:
GET https://<nsxmgr-ip>/api/2.0/services/applicationgroup/<scope-moref>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<applicationGroup>
<objectId>applicationgroup-1</objectId>
<type>
<typeName>ApplicationGroup</typeName>
</type>
<name>testglobalAG</name>
<description></description>
<revision>2</revision>
<objectTypeName>ApplicationGroup</objectTypeName>
<scope>
<id>globalroot-0</id>
<objectTypeName>GlobalRoot</objectTypeName>
<name>Global</name>
</scope>
<extendedAttributes />
<inheritanceAllowed>false</inheritanceAllowed>
<member>
<objectId>application-37</objectId>
<type>
<typeName>Application</typeName>
</type>
<name>SMTP</name>
<revision>3</revision>
<objectTypeName>Application</objectTypeName>
<scope>
<id>globalroot-0</id>

66

VMware, Inc.

Chapter 4 Grouping Objects

<objectTypeName>GlobalRoot</objectTypeName>
<name>Global</name>
</scope>
<extendedAttributes />
</member>
</applicationGroup>
</list>

Anonexistentscoperesultsina400BadRequesterror.

Query Details of a Service Group


Youcanretrievedetailsabouttheservicegroup specifiedby<applicationgroup-id>asreturnedbythecallshown
inExample 424.
Example 4-30. Retrieve details about a service group
Request:
GET https://<nsxmgr-ip>/api/2.0/services/applicationgroup/<applicationgroup-id>

AnonexistentapplicationIDresultsina404NotFounderror.

Modify Service Group Details


Youcanmodifythename,description,applicationProtocol,orportvalueofaservicegroup.
Example 4-31. Modify service group
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/applicationgroup/<applicationgroup-id>

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<applicationGroup>
<objectId>applicationgroup-1</objectId>
<type>
<typeName>ApplicationGroup</typeName>
</type>
<name>testglobalAG-updated</name>
<description>Updated with description</description>
<revision>2</revision>
<objectTypeName>ApplicationGroup</objectTypeName>
<scope>
<id>globalroot-0</id>
<objectTypeName>GlobalRoot</objectTypeName>
<name>Global</name>
</scope>
<extendedAttributes />
<inheritanceAllowed>false</inheritanceAllowed>
<member>
<objectId>application-37</objectId>
<type>
<typeName>Application</typeName>
</type>
<name>SMTP</name>
<revision>3</revision>
<objectTypeName>Application</objectTypeName>
<scope>
<id>globalroot-0</id>
<objectTypeName>GlobalRoot</objectTypeName>
<name>Global</name>
</scope>

VMware, Inc.

67

vShield API Programming Guide

<extendedAttributes />
</member>
</applicationGroup>

ThecallreturnsXMLdescribingthemodifiedservice.

Delete Service Group from Scope


Youcandeleteaservicegroup byspecifyingits<applicationgroup-id>.Theforce=flagindicatesifthedelete
shouldbeforcedorunforced.Forforceddeletes,theobjectisdeletedirrespectiveofitsuseinotherplacessuch
asfirewallrules,whichinvalidatesotherconfigurationsreferringtothedeletedobject.Forunforceddeletes,
theobjectisdeletedonlyifitisnotbeingusedbyanyotherconfiguration.Thedefaultisunforced(false).
Example 4-32. Delete service group
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/applicationgroup/<applicationgroup-id>?force=<true|false>

Working with the Members of a Service Group


Query Service Group Members
Youcangetalistofmemberelementsthatcanbeaddedtotheservicegroupscreatedonaparticularscope.
Sinceservicegroupallowsonlyeitherservicesorotherservicegroupsasmemberstobeadded,thishelpsyou
getalistofallpossiblevalidelementsthatcanbeaddedtotheservice.
Example 4-33. Retrieve member elements
Request:
GET https://<nsxmgr-ip>/api/2.0/services/applicationgroup/scope/<scope-moref>/members

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<basicinfo>
<objectId>applicationgroup-3</objectId>
<type>
<typeName>ApplicationGroup</typeName>
</type>
<name>AGDC-1</name>
<description>AG created in DC</description>
<revision>1</revision>
<objectTypeName>ApplicationGroup</objectTypeName>
<scope>
<id>datacenter-2</id>
<objectTypeName>Datacenter</objectTypeName>
<name>Datacenter</name>
</scope>
<extendedAttributes />
</basicinfo>
<basicinfo>
<objectId>application-36</objectId>
<type>
<typeName>Application</typeName>
</type>
<name>ORACLE_TNS</name>
<revision>2</revision>
<objectTypeName>Application</objectTypeName>
<scope>
<id>globalroot-0</id>

68

VMware, Inc.

Chapter 4 Grouping Objects

<objectTypeName>GlobalRoot</objectTypeName>
<name>Global</name>
</scope>
<extendedAttributes />
</basicinfo>
<basicinfo>
<objectId>application-37</objectId>
<type>
<typeName>Application</typeName>
</type>
<name>SMTP</name>
<revision>3</revision>
<objectTypeName>Application</objectTypeName>
<scope>
<id>globalroot-0</id>
<objectTypeName>GlobalRoot</objectTypeName>
<name>Global</name>
</scope>
<extendedAttributes />
</basicinfo>
</list>

Add a Member to the Service Group


Youcanaddamembertotheservicegroup.
Example 4-34. Add member
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/applicationgroup/<applicationgroup-id>/members/
<member-moref>

Delete a Member from the Service Group


Youcandeleteamemberfromtheservicegroup.
Example 4-35. Delete member
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/applicationgroup/<applicationgroup-id>/members/
<member-moref>

Working with IP Pools


YoucancreateapoolofIPaddresses.

Add an IP Pool
Example 4-36. Add IP pool
Request:
POST https://<nsxmgr-ip>/api/2.0/services/ipam/pools/scope/<scopeId>

RequestBody:
<ipamAddressPool>
<name>rest-ip-pool-1</name>
<prefixLength>23</prefixLength>
<gateway>192.168.1.1</gateway>

VMware, Inc.

69

vShield API Programming Guide

<dnsSuffix>eng.vmware.com</dnsSuffix>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<ipRanges>
<ipRangeDto>
<startAddress>192.168.1.2</startAddress>
<endAddress>192.168.1.3</endAddress>
</ipRangeDto>
</ipRanges>
</ipamAddressPool>

wherescopidisglobalroot0.

Query IP Pool Details


RetrievesdetailsaboutthespecifiedIPpool.
Example 4-37. Query IP Pool
Request:
GET https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>

ResponseBody:
<ipamAddressPool>
<objectId>ipaddresspool-1</objectId>
<objectTypeName>IpAddressPool</objectTypeName>
<vsmUuid>4237BA90-C373-A71A-9827-1673BFA29498</vsmUuid>
<revision>1</revision>
<type>
<typeName>IpAddressPool</typeName>
</type>
<name>rest-ip-pool-1</name>
<extendedAttributes/>
<prefixLength>23</prefixLength>
<gateway>192.168.1.1</gateway>
<dnsSuffix>eng.vmware.com</dnsSuffix>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<ipRanges>
<ipRangeDto>
<id>iprange-1</id>
<startAddress>192.168.1.2</startAddress>
<endAddress>192.168.1.3</endAddress>
</ipRangeDto>
</ipRanges>
<totalAddressCount>2</totalAddressCount>
<usedAddressCount>0</usedAddressCount>
<usedPercentage>0</usedPercentage>
</ipamAddressPool>

Modify an IP Pool
TomodifyanIPpool,querytheIPpoolfirst.Thenmodifytheoutputandsenditbackastherequestbody.
Example 4-38. Query IP Pool
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>

ResponseBody:
<ipamAddressPool>

70

VMware, Inc.

Chapter 4 Grouping Objects

<objectId>ipaddresspool-1</objectId>
<objectTypeName>IpAddressPool</objectTypeName>
<vsmUuid>4237BA90-C373-A71A-9827-1673BFA29498</vsmUuid>
<revision>1</revision>
<type>
<typeName>IpAddressPool</typeName>
</type>
<name>rest-ip-pool-1</name>
<extendedAttributes/>
<prefixLength>23</prefixLength>
<gateway>192.168.1.1</gateway>
<dnsSuffix>eng.vmware.com</dnsSuffix>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<ipRanges>
<ipRangeDto>
<id>iprange-1</id>
<startAddress>192.168.1.2</startAddress>
<endAddress>192.168.1.3</endAddress>
</ipRangeDto>
</ipRanges>
</ipamAddressPool>

Allocating a New IP Address


AllocatesanewIPaddressfromthespecifiedpool.
Example 4-39. Allocate new address
Request:
POST https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>/ipaddresses

RequestBody:
<ipAddressRequest>
<allocationMode>ALLOCATE</allocationMode>
</ipAddressRequest>
Response Body:
<?xml version="1.0" encoding="UTF-8"?>
<allocatedIpAddress>
<id>allocatedipaddress-1</id>
<ipAddress>192.168.1.2</ipAddress>
<gateway>192.168.1.1</gateway>
<prefixLength>23</prefixLength>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<dnsSuffix>eng.vmware.com</dnsSuffix>
<allocationNote/>sample note</allocationNote>
</allocatedIpAddress>

Allocating a Specific IP Address


AllocatesaspecificIPaddressfromthespecifiedpool.
Example 4-40. Allocate new address
Request:
POST https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>/ipaddresses

RequestBody:
<ipAddressRequest>
<allocationMode>RESERVE</allocationMode>

VMware, Inc.

71

vShield API Programming Guide

<ipAddress>192.168.1.5</ipAddress>
</ipAddressRequest>

ResponseBody:
SeeExample 439.

Query all IP Pools on Scope


RetrievesallIPpoolsonthespecifiedscope.
Example 4-41. Query IP pools on scope
Request:
GET https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>/ipaddresses

ResponseBody:
<ipamAddressPools>
<ipamAddressPool>
<objectId>ipaddresspool-1</objectId>
<objectTypeName>IpAddressPool</objectTypeName>
<vsmUuid>4237BA90-C373-A71A-9827-1673BFA29498</vsmUuid>
<revision>1</revision>
<type>
<typeName>IpAddressPool</typeName>
</type>
<name>rest-ip-pool-1</name>
<extendedAttributes/>
<prefixLength>23</prefixLength>
<gateway>192.168.1.1</gateway>
<dnsSuffix>eng.vmware.com</dnsSuffix>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<ipPoolType>IPV4</ipPoolType>
<ipRanges>
<ipRangeDto>
<id>iprange-1</id>
<startAddress>192.168.1.2</startAddress>
<endAddress>192.168.1.3</endAddress>
</ipRangeDto>
</ipRanges>
<totalAddressCount>2</totalAddressCount>
<usedAddressCount>0</usedAddressCount>
<usedPercentage>0</usedPercentage>
<subnetId>subnet-1</subnetId>
</ipamAddressPool>
</ipamAddressPools>

Query Allocated IP Addresses


RetrievesallallocatedIPaddressesfromthespecifiedpool.
Example 4-42. Query allocated addresses
Request:
GET https://<nsxmgr-ip>/api/2.0/services/ipam/pools/scope/<scopeID>

ResponseBody:
<allocatedIpAddresses>
<allocatedIpAddress>
<id>allocatedipaddress-4</id>

72

VMware, Inc.

Chapter 4 Grouping Objects

<ipAddress>192.168.1.2</ipAddress>
<gateway>192.168.1.1</gateway>
<prefixLength>23</prefixLength>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<dnsSuffix>eng.vmware.com</dnsSuffix>
<allocationNote>sample note</allocationNote>
</allocatedIpAddress>
<allocatedIpAddress>
<id>allocatedipaddress-5</id>
<ipAddress>192.168.1.3</ipAddress>
<gateway>192.168.1.1</gateway>
<prefixLength>23</prefixLength>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<dnsSuffix>eng.vmware.com</dnsSuffix>
<allocationNote>sample note</allocationNote>
</allocatedIpAddress>
</allocatedIpAddresses>

Release an IP Address
Example 4-43. Release IP address
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>/ipaddresses/<allocated-ip-address>

Delete an IP Pool
Example 4-44. Delete IP Pool
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/ipam/pools/<pool-ID>

Querying Object IDs


ThissectiondescribeshowtoretrievetheIDsfortheobjectsinyourvirtualinventory.

Query Datacenter MOID


1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

Clickcontent.

ClickontherootFoldervalue.

ClickonthechildEntityvalue.
ThedatacenterMOIDisdisplayedontopofthewindow.

Query Datacenter ID
1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

VMware, Inc.

Clickcontent.

73

vShield API Programming Guide

ClickontherootFoldervalue.

ClickonthechildEntityvalue.
ThedatacentervalueisthedatacenterID.

Query Host ID
1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

Clickcontent.

ClickontherootFoldervalue.

ClickonthechildEntityvalue.

Clickonthedatacentervalue.
Thehost valueisthehostID.

Query Portgroup ID
1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

Clickcontent.

ClickontherootFoldervalue.

ClickonthechildEntityvalue.

Clickonthedatacentervalue.

Clickonthehost value.
ThenetworkpropertyvalueistheportgroupID.

74

VMware, Inc.

Installing NSX Components

AftertheinstallationofNSXManager,youcaninstallothercomponentsasrequired..
Thischapterincludesthefollowingtopics:

InstallingLicensesonpage 75

WorkingwithNetworkVirtualizationComponentsonpage 76

WorkingwithVXLANforLogicalSwitchesonpage 77

WorkingwithServicesonpage 90

WorkingwithConflictingAgenciesonpage 97

UninstallingServicesonpage 98

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Installing Licenses
You can install and assign an NSX for vSphere license after NSX Manager installation is complete by using the vSphere
Web Client.
BeforepurchasingandactivatinganNSXforvSpherelicense,youcaninstallandrunthesoftwarein
evaluationmode.Whenruninevaluationmode,intendedfordemonstrationandevaluationpurposes,NSX
componentsarecompletelyoperationalimmediatelyafterinstallation,donotrequireanylicensing
configuration,andprovidefullfunctionalityfor60daysfromthetimeyoufirstactivatethem.
1

LogintothevSphereWebClient.

ClickAdministration andthenclickLicenses.

ClicktheSolutions tab.

Fromthedropdownmenuatthetop,selectAssign a new license key.

Typethelicensekeyandanoptionallabelforthenewkey.

ClickDecode.
Decodethelicensekeytoverifythatitisinthecorrectformat,andthatithasenoughcapacitytolicense
theassets.

ClickOK.

What to do next
Obtain and install an NSX for vSphere license within the evaluation period.

VMware, Inc.

75

vShield API Programming Guide

Working with Network Virtualization Components


Asthedemandsondatacenterscontinuetogrowandaccelerate,requirementsrelatedtospeedandaccessto
thedataitselfcontinuetogrowaswell.Inmostinfrastructures,virtualmachineaccessandmobilityusually
dependonphysicalnetworkinginfrastructureandthephysicalnetworkingenvironmentstheyresidein.This
canforcevirtualworkloadsintolessthanidealenvironmentsduetopotentiallayer2orlayer3boundaries,
suchasbeingtiedtospecificVLANs.
Networkvirtualizationallowsyoutoplacethesevirtualworkloadsonanyavailableinfrastructureinthe
datacenterregardlessoftheunderlyingphysicalnetworkinfrastructure.Thisnotonlyallowsincreased
flexibilityandmobility,butincreasedavailabilityandresilience.
Featureconfigurationismanagedataclusterlevel.Clusterpreparationcanbebrokendownintothe
following:

Installvibandnonvibrelatedaction:Beforeanyperhostconfigavibmustbeinstalledonthehost.The
featurecanusethistimetoperformotherbootstrappingtaskswhichdonotdependonvibinstallation.
e.g.vxlancreatesthevmknicpgandsetsupsomeopaquedata.

Postvibinstall:Prepareeachhostforthefeature.Inthecaseofvxlan,createvmknics.

Install Network Virtualization Components


Youinstallthenetworkinfrastructurecomponentsinyourvirtualenvironmentonaperclusterlevelforeach
vCenterserver,whichdeploystherequiredsoftwareonallhostsinthecluster.Thissoftwareisalsoreferred
toasanNSXvSwitch.Whenanewhostisaddedtothiscluster,therequiredsoftwareisautomaticallyinstalled
onthenewlyaddedhost.Afterthenetworkinfrastructureisinstalledonacluster,LogicalFirewallisenabled
onthatcluster.
Example 5-1. Install network virtualization
Request
POST https://<nsxmgr-ip>/api/2.0/nwfabric/configure

RequestBody

<nwFabricFeatureConfig>
<resourceConfig>
<resourceId>{CLUSTER MOID}</resourceId>
</resourceConfig>
</nwFabricFeatureConfig>

Upgrade Network Virtualization Components


AfterNSXManagerisupgradedtoNSXManager,previouslypreparedclustersmusthavethe6.0network
virtualizationcomponentsinstalled.
Example 5-2. Upgrade network virtualization
Request
PUT https://<nsxmgr-ip>/api/2.0/nwfabric/configure

RequestBody
SeeExample 51.

76

VMware, Inc.

Chapter 5 Installing NSX Components

Delete Network Virtualization Components


Removepreviouslyinstalledvibs,tearsdownNSXmanagertoESXmessaging,andremoveanyothernetwork
fabricdependentfeatureslikelogicalwiresetc.Ifafeaturelikelogicalwireisbeingusedinyourenvironment,
thiscallfails.
Example 5-3. Delete network virtualization
Request
DELETE https://<nsxmgr-ip>/api/2.0/nwfabric/configure

Working with VXLAN for Logical Switches


Configuring logical switches is a multi-step process. You must follow these steps in order to complete logical switch
configuration. In lieu of multicast routing on the physical fabric, you can add NSX controllers in your environment. You
can later associate one of these traffic forwarding mechanisms with a transport zone.
Prerequisites

YoumusthavetheSuperAdministratororEnterpriseAdministratorrolepermissionstoconfigureand
managelogicalswitches.

Installnetworkvirtualizationcomponentsontheclustersthataretobepartofthelogicalswitch.See
InstallNetworkVirtualizationComponentsonpage 76.

Ensurethatyouhavethefollowingsoftwareversions.

VMwarevCenterServer5.5orlater

VMwareESX5.1orlateroneachserver

vSphereDistributedSwitch5.1orlater

PhysicalinfrastructureMTUmustbeatleast50bytesmorethantheMTUofthevirtualmachinevNIC.

SetManagedIPaddressforeachvCenterserverinthevCenterServerRuntimeSettings.Formore
information,seevCenterServerandHostManagement.

IfusingDHCPforIPassignmentforVMKNics,verifythatDHCPisavailableonVXLANtransport
VLANs.
IfusinganIPpoolforstaticIPassignment,selectingagatewayotherthanthedefaultgatewayoftheESX
managementnetworkleveragesadedicatedTCPstack(appliestoVMwareESXi5.5orlater).

ForLinkAggregationControlProtocol(LACP),itisrecommendedhatyouenable5tuplehash
distribution.

Youmustuseaconsistentdistributedvirtualswitchtype(vendoretc.)andversionacrossagivennetwork
scope.Inconsistentswitchtypescanleadtoundefinedbehaviorinyourlogicalswitch.
Thecontrolplanethatmanageslogicalnetworksandoverlaytransportcanbesetasoneofthefollowing:

VMware, Inc.

Multicast:MulticastIPaddressesonphysicalnetworkisusedforthecontrolplane.Thismodeis
recommendedonlywhenyouareupgradingfromolderVXLANdeployments.Requires
PIM/IGMPonphysicalnetwork.

Unicast :ThecontrolplaneishandledbyanNSXcontroller.Alltrafficreplicationishandled
locallybythehypervisor.NomulticastIPaddressesorspecialnetworkconfigurationis
required.

Hybrid :Theoptimizedunicastmode.Offloadslocaltrafficreplicationtophysicalnetwork.This
requiresIGMPsnoopingonthefirsthopswitch,butdoesnotrequirePIM.Firsthopswitch
handlestrafficreplicationforthesubnet.

77

vShield API Programming Guide

Working with Controllers


For the unicast or hybrid control plane mode, you must add an NSX controller to manage overlay transport and provide
East-West routing. The controller optimizes virtual machine broadcast (ARP only) traffic, and the learning is stored on
the host and the controller.

Add Controller
AddsanewNSXcontrolleronthespecifiedgivencluster.ThehostIdparameterisoptional.The
resourcePoolIdcanbeeithertheclusterIdorresourcePoolId.
TheIPaddressofthecontrollernodewillbeallocatedfromthespecifiedIPpool.deployTypedeterminesthe
controllernodememorysizeandcanbesmall,medium,orlarge.
Example 5-4. Add controller
Request
POST https://<nsxmgr-ip>/api/2.0/vdn/controller

RequestBody:
<controllerSpec>
<name>nsx-controller-node1</name>
<description>nsx-controller</description>
<ipPoolId>ipPool-1</ipPoolId>
<resourcePoolId>domain-c1</resourcePoolId>
<hostId>host-1</hostId>
<datastoreId>datastore-1</datastoreId>
<deployType>medium</deployType>
<networkId>dvportgroup-1</networkId>
<password>MyTestPassword</password>
</controllerSpec>

Query Controllers
Retrievesdetailsandruntimestatusforcontroller.Runtimestatuscanbeoneofthefollowing:

Deployingcontrollerisbeingdeployedandtheprocedurehasnotcompletedyet.

Removingcontrollerisbeingremovedandtheprocedurehasnotcompletedyet.

RunningcontrollerhasbeendeployedandcanrespondtoAPIinvocation.

UnknowncontrollerhasbeendeployedbutfailstorespondtoAPIinvocation.

Example 5-5. Query controllers


Request
GET https://<nsxmgr-ip>/api/2.0/vdn/controller

ResponseBody:
<controllers>
<controller>
<id>controller-...</id>
<name>controllerA</name>
<description>nvp-controller</description>
<ipAddress>10.1.1.1</ipAddress>
<status>RUNNING</status>
</controller>
...
</controllers>

78

VMware, Inc.

Chapter 5 Installing NSX Components

Query Controller Addition or Deletion Details


Retrievesstatusofcontrollercreationorremoval.Theprogressgivesapercentageindicationofcurrentdeploy
/removeprocedure.
Example 5-6. Query controller addition or deletion details
Request
GET https://<nsxmgr-ip>/api/2.0/vdn/controller/progress/<job_id>

ResponseBody:
<controllerDeploymentInfo>
<vmId>vm-1</vmId>
<progress>90</progress>
<status>PushingFile</status>
<exceptionMessage></exceptionMessage>
</controllerDeploymentInfo>

Query Controller Tech Support Logs


Retrievescontrollerlogs.Responsecontenttypeisapplication/octetstreamandresponseheaderisfilename.
Thisstreamsafairlylargebundleback(possiblyhundredsofMB).
Example 5-7. Query controller logs
Request
GET https://<nsxmgr-ip>/api/2.0/vdn/controller/{controllerId}/techsupportlogs

Delete Controller
DeletesNSXcontroller.Whendeletingthelastcontrollerfromacluster,theparameterforceRemovalForLast
mustbesettotrue.
Example 5-8. Delete controller
Request
DELETE https://<nsxmgr-ip>/api/2.0/vdn/controller/<controller-id>? forceRemoval=<true/false>

Query Cluster Information


Retrievesclusterwiseconfigurationinformationforcontroller.
Example 5-9. Query cluster details
Request
GET https://<nsxmgr-ip>/api/2.0/vdn/controller/cluster

ResponseBody:
<controllerConfig>
<sslEnabled>true</sslEnabled>
</controllerConfig>

Modify Cluster Configuration


Modifiesclusterwiseconfigurationinformationforcontroller.

VMware, Inc.

79

vShield API Programming Guide

Example 5-10. Modify cluster configuration


Request
PUT https://<nsxmgr-ip>/api/2.0/vdn/controller/cluster

RequestBody:
<controllerConfig>
<sslEnabled>true</sslEnabled>
</controllerConfig>

Add Controller Syslog Exporter


Configuresasyslogexporteronthespecifiedcontrollernode.
Example 5-11. Query controller syslog exporter
Request
POST https://<nsxmgr-ip>/api/2.0/vdn/controller/{controller-id}/syslog

RequestBody:
<controllerSyslogServer>
<syslogServer>10.135.14.236</syslogServer>
<port>514</port>
<protocol>UDP</protocol>
<level>INFO</level>
</controllerSyslogServer>

Query Controller Syslog Exporter


Retrievesdetailsabouttheconfiguredsyslogexporteronthespecifiedcontrollernode.
Example 5-12. Query controller syslog exporter
Request
GET https://<nsxmgr-ip>/api/2.0/vdn/controller/{controller-id}/syslog

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<controllerSyslogServer>
<syslogServer>10.135.14.236</syslogServer>
<port>514</port>
<protocol>UDP</protocol>
<level>INFO</level>
</controllerSyslogServer>

Delete Controller Syslog Exporter


Deletessyslogexporteronthespecifiedcontrollernode.
Example 5-13. Delete controller syslog exporter
Request
DELETE https://<nsxmgr-ip>/api/2.0/vdn/controller/{controller-id}/syslog

80

VMware, Inc.

Chapter 5 Installing NSX Components

Backup Controller Data


Takesasnapshotofthecontrolclusterfromthespecifiedcontrollernodet.
Example 5-14. Backup controller data
Request:

GET
https://NSXManagerIPAddress/api/2.0/vdn/controller/controllerID/snapshot

ToretrievethecontrollerIDs,logintothevSphereWebClient.NavigatetoNetworking&Security>
Installation.TheNSXControllerNodestableliststhecontrollerIDs(Namecolumn)andIPaddresses(Node
column)ofeachcontroller.
TheoutputoftheGETcallisanoctetstreamcontainingthecontrollersnapshot.Examplecalltodownloadthe
snapshotisasfollows.

curl -u admin:default -H "Accept: application/octet-stream" -X GET -k


https://NSXManagerIPAddress/api/2.0/vdn/controller/controllerID/snapshot
> controller_backup.snapshot

Working with Segment IDs


YoumustspecifyasegmentIDpoolforeachNSXManagertoisolateyournetworktraffic.IfanNSXcontroller
isnotdeployedinyourenvironment,youmustaddamulticastaddressrangetohelpinspreadingtraffic
acrossyournetworkandavoidoverloadingasinglemulticastaddress.

Add a new Segment ID Range


YoucanaddasegmentIDrange,fromwhichanIDisautomaticallyassignedtothelogicalswitch.
Example 5-15. Add a segment ID range
Request:
POST https://<vsm-ip>/api/2.0/vdn/config/segments

RequestBody:
<segmentRanges>
<segmentRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>1000</begin>
<end>1500</end>
</segmentRange>
<segmentRange>
....
</segmentRange>
....
</segmentRanges>

ThesegmentrangeisinclusivethebeginningandendingIDsareincluded.

Query all Segment ID Ranges


YoucanretrieveallsegmentIDranges.

VMware, Inc.

81

vShield API Programming Guide

Example 5-16. Get all Segment ID Ranges


Request:
GET https://<vsm-ip>/api/2.0/vdn/config/segments

ResponseBody:
<segmentRanges>
<segmentRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>5000</begin>
<end>9000</end>
</segmentRange>
<segmentRange>
....
</segmentRange>
</segmentRanges>

Query a Specific Segment ID Range


YoucanretrieveasegmentIDrangebyspecifyingthesegmentID.
Example 5-17. Get a specific Segment ID Range
Request:
GET https://<vsm-ip>/api/2.0/vdn/config/segments/SegmentID

ResponseBody:
<segmentRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>10000</begin>
<end>11000</end>
</segmentRange>

Update a Segment ID Range


Youcanupdatethename,description,orendofasegmentIDrange.
Example 5-18. Update a Segment ID Range
Request:
PUT https://<vsm-ip>/api/2.0/vdn/config/segments/SegmentID

Request Body:
<segmentRange>
<end>3000</end>
<name>name</name>
<desc>desc</desc>
</segmentRang>

Delete a Segment ID Range


YoucandeleteasegmentIDrange.
Example 5-19. Delete a Segment ID Range
Request:

82

VMware, Inc.

Chapter 5 Installing NSX Components

DELETE https://<vsm-ip>/api/2.0/vdn/config/segments/SegmentID

Configure VXLAN
Example 5-20. Install VXLAN
Request
POST https://<nsxmgr-ip>/api/2.0/nwfabric/configure

RequestBody:
<nwFabricFeatureConfig>
<featureId>com.vmware.vshield.vsm.vxlan</featureId>
<resourceConfig>
<resourceId>{CLUSTER MOID}</resourceId>
<configSpec class="clusterMappingSpec">
<switch><objectId>{DVS MOID}</objectId></switch>
<vlanId>0</vlanId>
<vmknicCount>1</vmknicCount>
<!-- ipPoolId is optional and if none is specified will assume DHCP for VTEP address assignment.-->
<ipPoolId>{IPADDRESSPOOL ID}</ipPoolId>
</configSpec>
</resourceConfig>
<resourceConfig>
<resourceId>{DVS MOID}</resourceId>
<configSpec class="vdsContext">
<switch><objectId>{DVS MOID}</objectId></switch>
<mtu>1600</mtu>
<!-- teaming value can be one of
FAILOVER_ORDER|ETHER_CHANNEL|LACP_ACTIVE|LACP_PASSIVE|LOADBALANCE_LOADBASE
D|LOADBALANCE_SRCID|LOADBALANCE_SRCMAC|LACP_V2 -->
<teaming>ETHER_CHANNEL</teaming>
</configSpec>
</resourceConfig>
</nwFabricFeatureConfig>

Install VXLAN
Example 5-21. Install VXLAN with LACPv2
Request
POST https://<nsxmgr-ip>/api/2.0/nwfabric/configure

RequestBody:
<nwFabricFeatureConfig>
<featureId>com.vmware.vshield.nsxmgr.vxlan</featureId>
<resourceConfig>
<resourceId>{CLUSTER MOID}</resourceId>
<configSpec class="clusterMappingSpec">
<switch><objectId>{DVS MOID}</objectId></switch>
<vlanId>0</vlanId>
<vmknicCount>1</vmknicCount>
</configSpec>
</resourceConfig>
<resourceConfig>
<resourceId>{DVS MOID}</resourceId>
<configSpec class="vdsContext">
<switch><objectId>{DVS MOID}</objectId></switch>
<mtu>1600</mtu>
<teaming>LACP_V2</teaming>
<!-- uplinkPortName should be as specified in vCenter. -->
<uplinkPortName>{LAG NAME}</uplinkPortName>

VMware, Inc.

83

vShield API Programming Guide

</configSpec>
</resourceConfig>
</nwFabricFeatureConfig>

Delete VXLAN
DeletesVXLANfromthespecifiedcluster.Thisdoesnotdeletethenetworkvirtualizationcomponentsfrom
thecluster.
Example 5-22. Delete VXLAN
Request
DELETE https://<nsxmgr-ip>/api/2.0/nwfabric/configure

Delete VXLAN with vdsContext


DeletesVXLANfromthespecifiedclusterandalsoremovesthevdsContext.
Example 5-23. Delete VXLAN
Request
DELETE https://<nsxmgr-ip>/api/2.0/nwfabric/configure

Working with Network Scopes


Anetworkscopeisthenetworkinginfrastructurewithinprovidervirtualdatacenters.

Create a Network Scope


Youmustspecifytheclustersthataretobepartofthenetworkscope.YoumusthavetheVLANID,UUIDof
thevCenterServer,andvDSID.
Example 5-24. Create a network scope
Request:
POST https://<vsm-ip>/api/2.0/vdn/scopes

RequestBody:
<vdnScope>
<clusters>
<cluster><cluster><objectId>domain-c59</objectId></cluster></cluster>
</clusters>
</vdnScope>

Edit a Network Scope


Youcanaddaclustertoordeleteaclusterfromanetworkscope.
Example 5-25. Create a network scope
Request:
POST https://<vsm-ip>/api/2.0/vdn/scopes/scopeID?action=patch

RequestBody:
<vdnScope>
<objectId>{id}</objectId>

84

VMware, Inc.

Chapter 5 Installing NSX Components

<clusters>
<cluster><cluster><objectId>domain-c59</objectId></cluster></cluster>
</clusters>
</vdnScope>

Update Attributes on a Network Scope


Youcanupdatetheattributesofanetworkscope.
Example 5-26. Update attributes of a network scope
Request:
PUT https://<vsm-ip>/api/2.0/vdn/scopes/scopeID/attributes

RequestBody:
<vdnScope>
<objectId>vdnScope-1</objectId>
<name>new name</name>
<description>new description</description>
</vdnScope>

Query existing Network Scopes


Youcanretrieveallexistingnetworkscopes.
Example 5-27. Get all network scopes
Request:
GET https://<vsm-ip>/api/2.0/vdn/scopes

ResponseBody:
<vdnScopes>
<vdnScope>
<objectId>vdnscope-2</objectId>
<type><typeName>VdnScope</typeName></type>
<name>My Name</name>
<description>My Description</description>
<revision>0</revision>
<objectTypeName>VdnScope</objectTypeName>
<extendedAttributes/>
<id>vdnscope-2</id>
<clusters>
<cluster>
<cluster>
<objectId>domain-c124</objectId>
<type><typeName>ClusterComputeResource</typeName></type>
<name>vxlan-cluster</name>
<scope><id>datacenter-2</id><objectTypeName>Datacenter</objectTypeName><name>dc1</name></scope>
<extendedAttributes/>
</cluster>
</cluster>
...
</clusters>
<virtualWireCount>10</virtualWireCount>
</vdnScope>
...
<vdnScope>...</vdnScope>
...
</vdnScopes>

VMware, Inc.

85

vShield API Programming Guide

Query a Specific Network Scope


Youcanretrieveaspecificnetworkscope.
Example 5-28. Get a network scope
Request:
GET https://<vsm-ip>/api/2.0/vdn/scopes/scopeID

ResponseBody:
<vdnScope>
<objectId>vdnscope-2</objectId>
<type><typeName>VdnScope</typeName></type>
<name>My Name</name>
<description>My description</description>
<revision>0</revision>
<objectTypeName>VdnScope</objectTypeName>
<extendedAttributes/>
<id>vdnscope-2</id>
<clusters>
<cluster>
<cluster>
<objectId>domain-c124</objectId>
<type><typeName>ClusterComputeResource</typeName></type>
<name>vxlan-cluster</name>
<scope><id>datacenter-2</id><objectTypeName>Datacenter</objectTypeName><name>dc1</name></scope>
<extendedAttributes/>
</cluster>
</cluster>
...
</clusters>
<virtualWireCount>10</virtualWireCount>
</vdnScope>

Delete a Network Scope


Youcandeleteanetworkscope.
Example 5-29. Delete network scope
Request:
DELETE https://<vsm-ip>/api/2.0/vdn/scopes/scopeID

Reset Communication
ResetscommunicationbetweenNSXManagerandahostorcluster.
Example 5-30. Reset communication
Request
POST https://<nsxmgr-ip>/api/2.0/nwfabric/configure?action=synchronize

Query Features on Cluster


Retrievesallfeaturesavailableonthecluster.
Example 5-31. Query features
Request
86

VMware, Inc.

Chapter 5 Installing NSX Components

POST https://<nsxmgr-ip>/api/2.0/nwfabric/features

ResponseBody:
<featureInfos>
<!-- Contains multiple featureInfo -->
<featureInfo>
<name>{FEATURE NAME}</name>
<featureId>{FEATURE ID}</featureId>
<version>{FEATURE VERSION}</version>
</featureInfo>
<featureInfos>

Query Status of Specific Resources


Example 5-32. Query status
Request
GET https://<nsxmgr-ip>/api/2.0/nwfabric/status?resource=<RESOURCE ID>

ResponseBody:
<resourceStatuses>
<resourceStatus>
<resource>
<objectId>{resource id}</objectId>
<objectTypeName>ClusterComputeResource</objectTypeName>
<nsxmgrUuid>jfldj</nsxmgrUuid>
<revision>2</revision>
<type>
<typeName>ClusterComputeResource</typeName>
</type>
<name>c-1</name>
<scope>
<id>datacenter-2</id>
<objectTypeName>Datacenter</objectTypeName>
<name>dc-1</name>
</scope>
<clientHandle>
</clientHandle>
<extendedAttributes/>
</resource>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.nwfabric.hostPrep</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>RED</status>
<message>
</message>
<installed>true</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.vxlan</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.messagingInfra</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>

VMware, Inc.

87

vShield API Programming Guide

<featureId>com.vmware.vshield.firewall</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
</resourceStatus>
</resourceStatuses>

Query Status of Child Resources


Example 5-33. Query status
Request
GET https://<nsxmgr-ip>/api/2.0/nwfabric/status/child/<PARENT RESOURCE ID>

ResponseBody:
<resourceStatuses>
<resourceStatus>
<resource>
<objectId>host-9</objectId>
<objectTypeName>HostSystem</objectTypeName>
<nsxmgrUuid>jfldj</nsxmgrUuid>
<revision>4</revision>
<type>
<typeName>HostSystem</typeName>
</type>
<name>10.135.14.186</name>
<scope>
<id>domain-c34</id>
<objectTypeName>ClusterComputeResource</objectTypeName>
<name>c-1</name>
</scope>
<clientHandle>
</clientHandle>
<extendedAttributes/>
</resource>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.nwfabric.hostPrep</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>RED</status>
<message>
</message>
<installed>true</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.vxlan</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.messagingInfra</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.firewall</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>

88

VMware, Inc.

Chapter 5 Installing NSX Components

<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
</resourceStatus>
</resourceStatuses>

Query Status of Resources by Criterion


Example 5-34. Query status
Request
GET https://<nsxmgr-ip>/api/2.0/nwfabric/status/alleligible/<RESOURCE TYPE>

ResponseBody:
<resourceStatuses>
<resourceStatus>
<resource>
<objectId>domain-c34</objectId>
<objectTypeName>ClusterComputeResource</objectTypeName>
<nsxmgrUuid>jfldj</nsxmgrUuid>
<revision>2</revision>
<type>
<typeName>ClusterComputeResource</typeName>
</type>
<name>c-1</name>
<scope>
<id>datacenter-2</id>
<objectTypeName>Datacenter</objectTypeName>
<name>dc-1</name>
</scope>
<clientHandle>
</clientHandle>
<extendedAttributes/>
</resource>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.nwfabric.hostPrep</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>RED</status>
<message>
</message>
<installed>true</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.vxlan</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.messagingInfra</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.firewall</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>

VMware, Inc.

89

vShield API Programming Guide

</resourceStatus>
<resourceStatus>
<resource>
<objectId>domain-c32</objectId>
<objectTypeName>ClusterComputeResource</objectTypeName>
<nsxmgrUuid>jfldj</nsxmgrUuid>
<revision>1</revision>
<type>
<typeName>ClusterComputeResource</typeName>
</type>
<name>c-2</name>
<scope>
<id>datacenter-12</id>
<objectTypeName>Datacenter</objectTypeName>
<name>dc-2</name>
</scope>
<clientHandle>
</clientHandle>
<extendedAttributes/>
</resource>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.nwfabric.hostPrep</featureId>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.vxlan</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.nsxmgr.messagingInfra</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
<nwFabricFeatureStatus>
<featureId>com.vmware.vshield.firewall</featureId>
<featureVersion>5.5</featureVersion>
<updateAvailable>false</updateAvailable>
<status>UNKNOWN</status>
<installed>false</installed>
</nwFabricFeatureStatus>
</resourceStatus>
</resourceStatuses>

Working with Services


Thesecurityfabricsimplifiesandautomatesdeploymentofsecurityservicesandprovideaplatformfor
configurationoftheelementsthatarerequiredtoprovidesecuritytoworkloads.Theseelementsinclude:

90

Internalcomponents:

USVM

EndpointMux

DataSecurity

LogicalFirewall

Externalcomponents

VMware, Inc.

Chapter 5 Installing NSX Components

PartnerOVFs/Vibs

Partnervendorpolicytemplates

Forpartnerservices,theoverallworkflowbeginswithregistrationofservicesbypartnerconsoles,followed
bydeploymentoftheservicesbytheadministrator.
Subsequentworkflowisasfollows:
1

Selecttheclustersonwhichtodeploythesecurityfabric(Mux,Trafficfilter,USVM).

SpecifyanIPpooltobeusedwiththeSVMs(availableonlyifthepartnerregistrationindicates
requirementofstaticIPs)

Selectportgroup(DVPG)tobeusedforeachcluster(adefaultisprepopulatedfortheuser).

Selectdatastoretobeusedforeachcluster(adefaultisprepopulatedfortheuser).

NSXManagerdeploysthecomponentsonallhostsoftheselectedclusters.

Onceyoudeploythesecurityfabric,anagencydefinestheconfigurationneededtodeployagents(host
componentsandappliances).Anagencyiscreatedperclusterperdeploymentspecassociatedwithservices.
Agentsaredeployedontheselectedclusters,andevents/hooksforalltherelevantactionsaregenerated.

Install Security Fabric


Example 5-35. Install service
Request
POST https://<nsxmgr-ip>/api/2.0/si/deploy?startTime=<time>

RequestBody
<clusterDeploymentConfigs>
<clusterDeploymentConfig>
<clusterId>cluster-id</clusterId>
<datastore>ds-id</datastore> <!-- Used only in POST. Should be empty in PUT -->
<services>
<serviceDeploymentConfig>
<serviceId>service-id</serviceId>
<dvPortGroup>dvpg-id</dvPortGroup>
<ipPool>ipPool</ipPool>
</serviceDeploymentConfig>
</services>
</clusterDeploymentConfig>
</clusterDeploymentConfigs>

where:

dataStoreNeedstobespecifiedonlyinPOSTcall.InPUTcall,itshouldbeleftemptyotherwisethecall
willfail.

dvPortGroupThisisoptional.Ifnotspecified,thenuserwillsettheAgentusingvCenterServer.

ipPoolThisisoptional.ifnotspecified,IPaddressisassignedthroughDHCP.

startTimeTimewhenthedeploymenttask(s)arescheduledfor.Ifthisisnotspecifiedthendeployment
willhappenimmediately.

Service Dependency
Servicesinstalledthroughthesecurityfabricmaybedependentonotherservices.Whenaninternalserviceis
registered,adependencyMap is maintained with the service-id and implementation type of the internal service.

VMware, Inc.

91

vShield API Programming Guide

When partner registers a new service, the security fabric looks up its implementation type in the dependencyMap to
identify the service it depends on, if any. Accordingly, a new field in Service object called dependsOn-service-id is
populated.

Deploying a Service with a Dependency


Example 5-36. Deploy service
Request
POST https://<nsxmgr-ip>/api/2.0/si/deploy

Identify Service Dependency


Liststheserviceonwhichthespecifiedservicedependson.
Example 5-37. Identify service dependency
Request
GET https://<nsxmgr-ip>/api/2.0/si/deploy/service/<service-id>/dependsOn

Uninstall Service Dependency


Liststheserviceonwhichthespecifiedservicedependson.
Example 5-38. Uninstall service dependency
Request
DELETE https://<nsxmgr-ip>/api/2.0/si/deploy/clutser/<cluster-id>

Ifyoutrytoremoveaserviceonwhichaservicedependsonanditisalreadyinstalled,theuninstallationfails.
Inordertouninstallservicesinanyorder,setparameterignoreDependencytrue.

Query Installed Services


Retrievesallservicescurrentlydeployedontheclusteralongwiththeirstatus.
Example 5-39. Query services
Request
GET https://<nsxmgr-ip>/api/2.0/si/deploy/cluster/<cluster-id>

ResponseBody
<deployedServices>
<deployedService>
<deploymentUnitId>deploymentunit-1</deploymentUnitId>
<serviceId>service-3</serviceId>
<cluster>
<objectId>domain-c41</objectId>
<objectTypeName>ClusterComputeResource</objectTypeName>
<nsxmgrUuid>42036483-6CF3-4F0F-B356-2EB1E6369C6F</nsxmgrUuid>
<revision>2</revision>
<type>
<typeName>ClusterComputeResource</typeName>
</type>
<name>Cluster-1</name>
<scope>
<id>datacenter-21</id>

92

VMware, Inc.

Chapter 5 Installing NSX Components

<objectTypeName>Datacenter</objectTypeName>
<name>nasingh-dc</name>
</scope>
<extendedAttributes/>
</cluster>
<serviceName>domain-c41_service-3</serviceName>
<datastore>
<objectId>datastore-29</objectId>
<objectTypeName>Datastore</objectTypeName>
<nsxmgrUuid>42036483-6CF3-4F0F-B356-2EB1E6369C6F</nsxmgrUuid>
<revision>1</revision>
<type>
<typeName>Datastore</typeName>
</type>
<name>datastore1</name>
<extendedAttributes/>
</datastore>
<dvPortGroup>
<objectId>dvportgroup-45</objectId>
<objectTypeName>DistributedVirtualPortgroup</objectTypeName>
<nsxmgrUuid>42036483-6CF3-4F0F-B356-2EB1E6369C6F</nsxmgrUuid>
<revision>2</revision>
<type>
<typeName>DistributedVirtualPortgroup</typeName>
</type>
<name>dvPortGroup</name>
<scope>
<id>datacenter-21</id>
<objectTypeName>Datacenter</objectTypeName>
<name>nasingh-dc</name>
</scope>
<extendedAttributes/>
</dvPortGroup>
<serviceStatus>SUCCEEDED</serviceStatus>
</deployedService>
</deployedServices>

Query Details about a Service


Retrievesdetailedinformationabouttheservice.
Example 5-40. Query service
Request
GET https://<nsxmgr-ip>/api/2.0/si/deploy/cluster/<cluster-id>/service/<service-id>

ResponseBody
SeeExample 539.

Query Clusters
Retrievesallclustersonwhichthespecifiedserviceisinstalled.
Example 5-41. Query clusters
Request
GET https://<nsxmgr-ip>/api/2.0/si/deploy/service/<service-id>

ResponseBody

VMware, Inc.

93

vShield API Programming Guide

SeeExample 539.

Upgrade Service
Upgradesservicetorecentversion.
Example 5-42. Query clusters
Request
PUT https://<nsxmgr-ip>/api/2.0/si/deploy/?startTime=<time>

RequestBody
<clusterDeploymentConfigs>
<clusterDeploymentConfig>
<clusterId>{clusterId}</clusterId>
<datastore>{datastoreId}</datastore>
<services>
<serviceDeploymentConfig>
<serviceId>{serviceId}</serviceId>
<serviceInstanceId>{serviceInstanceId}</serviceInstanceId>
<dvPortGroup>{dvpg ID}</dvPortGroup>
<ipPool>{ipPoolId}</ipPool>
</serviceDeploymentConfig>
</services>
</clusterDeploymentConfig>
</clusterDeploymentConfigs>

Thedatastore,dvPortGroup,andipPoolvariablesshouldeithernotbespecifiedorhavesamevalueas
providedattimeofdeployment.

Query Agents on Host


Retrievesallagentsonthespecifiedhost.TheresponsebodycontainsagentIDsforeachagent,whichyoucan
usetoretrievedetailsaboutthatagent.
Example 5-43. Query agents on host
Request
GET https://<nsxmgr-ip>/api/2.0/si/host/<host-id>/agents

ResponseBody
<fabricAgents>
<agent>
<agentId>nsxmgragent-1</agentId>
<agentName>agent name if present</agentName>
<serviceId>service-6</serviceId>
<serviceName>EndpointService</serviceName>
<operationalStatus>ENABLED</operationalStatus>
<progressStatus>IN_PROGRESS</progressStatus>
<vmId>vm-92</vmId>
<host>host-10</host>
<allocatedIpAddress>
<id>2</id>
<ipAddress>10.112.5.182</ipAddress>
<gateway>10.112.5.253</gateway>
<prefixLength>23</prefixLength>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<dnsSuffix>
</dnsSuffix>

94

VMware, Inc.

Chapter 5 Installing NSX Components

<subnetId>subnet-1</subnetId>
</allocatedIpAddress>
<serviceStatus>
<status>WARNING</status>
<errorId>partner_error</errorId>
<errorDescription>partner_error</errorDescription>
</serviceStatus>
<hostInfo>
<objectId>host-10</objectId>
<objectTypeName>HostSystem</objectTypeName>
<nsxmgrUuid>420369CD-2311-F1F7-D4AA-1158EA688E54</nsxmgrUuid>
<revision>1</revision>
<type>
<typeName>HostSystem</typeName>
</type>
<name>10.112.5.173</name>
<scope>
<id>domain-c7</id>
<objectTypeName>ClusterComputeResource</objectTypeName>
<name>Kaustubh-CL</name>
</scope>
<clientHandle>
</clientHandle>
<extendedAttributes/>
</hostInfo>
<initialData>partner data if present</initialData>
</agent>
</fabricAgents>

Query Agent Information


Retrievesagent(agents(hostcomponentsandappliances))details.
Example 5-44. Query agent details
Request
GET https://<nsxmgr-ip>/api/2.0/si/agent/<agent-id>

ResponseBody
<agent>
<agentId>nsxmgragent-1</agentId>
<agentName>agent name if present</agentName>
<serviceId>service-6</serviceId>
<serviceName>EndpointService</serviceName>
<operationalStatus>ENABLED</operationalStatus>
<progressStatus>IN_PROGRESS</progressStatus>
<vmId>vm-92</vmId>
<host>host-10</host>
<allocatedIpAddress>
<id>2</id>
<ipAddress>10.112.5.182</ipAddress>
<gateway>10.112.5.253</gateway>
<prefixLength>23</prefixLength>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<dnsSuffix>
</dnsSuffix>
<subnetId>subnet-1</subnetId>
</allocatedIpAddress>
<serviceStatus>
<status>WARNING</status>
<errorId>partner_error</errorId>
<errorDescription>partner_error</errorDescription>
</serviceStatus>
<hostInfo>

VMware, Inc.

95

vShield API Programming Guide

<objectId>host-10</objectId>
<objectTypeName>HostSystem</objectTypeName>
<nsxmgrUuid>420369CD-2311-F1F7-D4AA-1158EA688E54</nsxmgrUuid>
<revision>1</revision>
<type>
<typeName>HostSystem</typeName>
</type>
<name>10.112.5.173</name>
<scope>
<id>domain-c7</id>
<objectTypeName>ClusterComputeResource</objectTypeName>
<name>Kaustubh-CL</name>
</scope>
<clientHandle>
</clientHandle>
<extendedAttributes/>
</hostInfo>
<initialData>partner data if present</initialData>
</agent>

Query Agents for Deployment


Retrievesallagentsforthespecifieddeployment.
Example 5-45. Query agents for deployment
Request
GET https://<nsxmgr-ip>/api/2.0/si/deployment/<deploymentunit-id>/agents

ResponseBody
<fabricAgents>
<agent>
<agentId>nsxmgragent-1</agentId>
<agentName>agent name if present</agentName>
<serviceId>service-6</serviceId>
<serviceName>EndpointService</serviceName>
<operationalStatus>ENABLED</operationalStatus>
<progressStatus>IN_PROGRESS</progressStatus>
<vmId>vm-92</vmId>
<host>host-10</host>
<allocatedIpAddress>
<id>2</id>
<ipAddress>10.112.5.182</ipAddress>
<gateway>10.112.5.253</gateway>
<prefixLength>23</prefixLength>
<dnsServer1>10.112.0.1</dnsServer1>
<dnsServer2>10.112.0.2</dnsServer2>
<dnsSuffix>
</dnsSuffix>
<subnetId>subnet-1</subnetId>
</allocatedIpAddress>
<serviceStatus>
<status>WARNING</status>
<errorId>partner_error</errorId>
<errorDescription>partner_error</errorDescription>
</serviceStatus>
<hostInfo>
<objectId>host-10</objectId>
<objectTypeName>HostSystem</objectTypeName>
<nsxmgrUuid>420369CD-2311-F1F7-D4AA-1158EA688E54</nsxmgrUuid>
<revision>1</revision>
<type>
<typeName>HostSystem</typeName>
</type>
<name>10.112.5.173</name>

96

VMware, Inc.

Chapter 5 Installing NSX Components

<scope>
<id>domain-c7</id>
<objectTypeName>ClusterComputeResource</objectTypeName>
<name>Kaustubh-CL</name>
</scope>
<clientHandle>
</clientHandle>
<extendedAttributes/>
</hostInfo>
<initialData>partner data if present</initialData>
</agent>
</fabricAgents>

Working with Conflicting Agencies


WhentheNSXManagerdatabasebackupisrestoredtoanolderpointintime,itispossiblethatdeployment
unitsforsomeEAMAgenciesaremissing.TheseAPIshelptheadministratoridentifysuchEAMAgenciesand
takeappropriateaction.

Query Conflicts
RetrievesconflictingDeploymentUnitsandEAMAgencies,ifany,andtheallowedoperationsonthem.
Example 5-46. Query conflicts
Request
GET https://<nsxmgr-ip>/api/2.0/si//fabric/sync/conflicts

ResponseBody
<fabricSyncConflictInfo>
<fabricSyncConflictInfo>
<conflictExist>true</conflictExist>
<agencies>
<agenciesInfo>
<agencyConflictInfo>
<agencyId>agency-150</agencyId>
<agencyName>_VCNS_264_nasingh-cluster1_VMware Endpoint</agencyName>
</agencyConflictInfo>
</agenciesInfo>
<allowedOperations>
<conflictResolverOperation>DELETE</conflictResolverOperation>
<conflictResolverOperation>RESTORE</conflictResolverOperation>
</allowedOperations>
</agencies>
</fabricSyncConflictInfo>

Restore Conflicting Agencies


CreatesDeploymentUnitsforconflictingEAMAgencies.
Example 5-47. Query conflicts
Request
PUT https://<nsxmgr-ip>/api/2.0/si/fabric/sync/conflicts

RequestBody
<conflictResolverInfo>
<agencyAction>RESTORE</agencyAction>

VMware, Inc.

97

vShield API Programming Guide

</conflictResolverInfo>

Delete Conflicting Agencies


DeletesconflictingEAMAgencies.
Example 5-48. Delete conflicts
Request
PUT https://<nsxmgr-ip>/api/2.0/si/fabric/sync/conflicts

RequestBody
<conflictResolverInfo>
<agencyAction>DELETE</agencyAction>
</conflictResolverInfo>

Delete Deployment Units


DeletesDeploymentUnitsforconflictingEAMAgencies.
Example 5-49. Query conflicts
Request
PUT https://<nsxmgr-ip>/api/2.0/si/fabric/sync/conflicts

RequestBody
<conflictResolverInfo>
<deploymentUnitAction>DELETE</deploymentUnitAction>
</conflictResolverInfo>

Uninstalling Services
Uninstallsthespecifiedservicesfromthespecifiedlusters.
Example 5-50. Uninstall services from a cluster
Request:
DELETE https://<vsm-ip>/api/2.0/si/deploy/cluster/<cluster-id>?services=service-id1,service-id2&startTime=<time>

where:

serviceslistofserviceidsthatneedstobeuninstalledfromthecluster.Ifthisisnotspecifiedthenallthe
serviceswillbeuninstalled.

startTimetimewhentheuninstallwillbescheduledfor.Ifthisisnotspecifiedthenuninstallwillhappen
immediately.

Example 5-51. Uninstall specified service from specified clusters


Request:
DELETE

https://<vsm-ip>/api/2.0/si/deploy/service/<service-id>?clusters=cluster-id1,clus
ter-id2&startTime=<time>

where:
98

VMware, Inc.

Chapter 5 Installing NSX Components

clusterslistofclusteridsthatserviceneedstobeuninstalledfrom.

startTimetimewhentheuninstallwillbescheduledfor.Ifthisisnotspecifiedthenuninstallwillhappen
immediately.

VMware, Inc.

99

vShield API Programming Guide

100

VMware, Inc.

Working with Logical Switches

Aclouddeploymentoravirtualdatacenterhasavarietyofapplicationsacrossmultipletenants.These
applicationsandtenantsrequireisolationfromeachotherforsecurity,faultisolation,andavoiding
overlappingIPaddressingissues.TheNSXlogicalswitchcreateslogicalbroadcastdomainsorsegmentsto
whichanapplicationortenantvirtualmachinecanbelogicallywired.Thisallowsforflexibilityandspeedof
deploymentwhilestillprovidingallthecharacteristicsofaphysicalnetworksbroadcastdomains(VLANs)
withoutphysicalLayer2sprawlorspanningtreeissues.
Alogicalswitchisdistributedandcanspanarbitrarilylargecomputeclusters.Thisallowsforvirtualmachine
mobility(vMotion)withinthedatacenterwithoutlimitationsofthephysicalLayer2(VLAN)boundary.The
physicalinfrastructuredoesnothavetodealwithMAC/FIBtablelimitssincethelogicalswitchcontainsthe
broadcastdomaininsoftware.
AlogicalswitchismappedtoauniqueVXLAN,whichencapsulatesthevirtualmachinetrafficandcarriesit
overthephysicalIPnetwork.
TheNSXcontrolleristhecentralcontrolpointforalllogicalswitcheswithinanetworkandmaintains
informationofallvirtualmachines,hosts,logicalswitches,andVXLANs.Thecontrollersupportstwonew
logicalswitchcontrolplanemodes,UnicastandHybrid,ThesemodesdecoupleNSXfromthephysical
network.VXLANsnolongerrequirethephysicalnetworktosupportmulticastinordertohandlethe
Broadcast,Unknownunicast,andMulticast(BUM)trafficwithinalogicalswitch.Theunicastmodereplicates
alltheBUMtrafficlocallyonthehostandrequiresnophysicalnetworkconfiguration.Inthehybridmode,
someoftheBUMtrafficreplicationisoffloadedtothefirsthopphysicalswitchtoachievebetterperformance.
ThismoderequiresIGMPsnoopingtobeturnedonthefirsthopphysicalswitch.Virtualmachineswithina
logicalswitchcanuseandsendanytypeoftrafficincludingIPv6andmulticast.
YoumustbeaSecurity Administrator in order to create VXLAN networks.
IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.
Thischapterincludesthefollowingtopics:

PreparingforLogicalSwitchesonpage 102

ConfiguringSwitchesonpage 102

WorkingwithSegmentIDsonpage 104

WorkingwithMulticastAddressRangesonpage 105

WorkingwithNetworkScopesonpage 107

WorkingwithVirtualizedNetworksonpage 109

ManagingtheVXLANVirtualWireUDPPortonpage 112

QueryingAllocatedResourcesonpage 112

TestingMulticastGroupConnectivityonpage 113

VMware, Inc.

101

vShield API Programming Guide

PerformingPingTestonpage 114

Preparing for Logical Switches


Beforecreatingalogicalswitch,ensurethat:

you have installed the network virtualization components on the appropriate clusters

you have configured VXLAN on the appropriate clusters

Configuring Switches
YoumustprepareeachvDSbyspecifyingtheVLANforyourL2domainandtheMTUforeachvDS.

Prepare Switch
TheMTUisthemaximumamountofdatathatcanbetransmittedinonepacketbeforeitisdividedinto
smallerpackets.Theframesareslightlylargerinsizebecauseofthetrafficencapsulation,sotheMTUrequired
ishigherthanthestandardMTU.YoumustsettheMTUforeachswitchto1600orhigher.
Example 6-1. Prepare switch
Request:
POST https://<vsm-ip>/api/2.0/vdn/switches

RequestBody:
<vdsContext>
<switch>
<objectId>dvs-26</objectId>
<type><typeName>DistributedVirtualSwitch</typeName></type>
<name>My Name</name>
<revision>0</revision>
<objectTypeName>DistributedVirtualSwitch</objectTypeName>
</switch>
<teaming>ETHER_CHANNEL</teaming>
<mtu>mtu-value</mtu>
</vdsContext>

Query Configured Switches


Youcanretrieveallconfiguredswitches.
Example 6-2. Get all configured switches
Request:
GET https://<vsm-ip>/api/2.0/vdn/switches

ResponseBody:
<vdsContexts>
<vdsContext>
<switch>
<objectId>dvs-26</objectId>
<type><typeName>DistributedVirtualSwitch</typeName></type>
<name>My Name</name>
<revision>0</revision>
<objectTypeName>DistributedVirtualSwitch</objectTypeName>
</switch>
<teaming>LACP_PASSIVE</teaming>
<mtu>mtu-value</mtu>
</vdsContext>
...

102

VMware, Inc.

Chapter 6 Working with Logical Switches

<vdsContext>...</vdsContext>
...
</vdsContexts>

Query Configured Switches on Datacenter


Youcanretrieveallconfiguredswitchesonadatacenter.
Example 6-3. Get configured switches on a datacenter
Request:
GET https://<vsm-ip>/api/2.0/vdn/switches/datacenter/datacenterID

ResponseBody:
<vdsContexts>
<vdsContext>
<switch>
<objectId>dvs-26</objectId>
<type><typeName>DistributedVirtualSwitch</typeName></type>
<name>My Name</name>
<revision>0</revision>
<objectTypeName>DistributedVirtualSwitch</objectTypeName>
</switch>
<teaming>LACP_PASSIVE</teaming>
<mtu>mtu-value</mtu>
</vdsContext>
...
<vdsContext>...</vdsContext>
...
</vdsContexts>

Query Specific Switch


YoucanretrieveaspecificswitchbyspecifyingitsID.
Example 6-4. Get specific switch
Request:
GET https://<vsm-ip>/api/2.0/vdn/switches/switchID

ResponseBody:
<vdsContext>
<switch>
<objectId>dvs-26</objectId>
<type><typeName>DistributedVirtualSwitch</typeName></type>
<name>My Name</name>
<revision>0</revision>
<objectTypeName>DistributedVirtualSwitch</objectTypeName>
</switch>
<teaming>LACP_PASSIVE</teaming>
<mtu>mtu-value</mtu>
</vdsContext>

Delete Switch
Youcandeleteaswitch.

VMware, Inc.

103

vShield API Programming Guide

Example 6-5. Delete switch


Request:
DELETE https://<vsm-ip>/api/2.0/vdn/switches/switchID

Working with Segment IDs


YoucanspecifyasegmentIDpooltoisolateyournetworktraffic.

Add a new Segment ID Range


YoucanaddasegmentIDrange,fromwhichanIDisautomaticallyassignedtotheVXLANvirtualwire.
Example 6-6. Add a segment ID range
Request:
POST https://<vsm-ip>/api/2.0/vdn/config/segments

RequestBody:
<segmentRanges>
<segmentRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>1000</begin>
<end>1500</end>
</segmentRange>
<segmentRange>
....
</segmentRange>
....
</segmentRanges>

ThesegmentrangeisinclusivethebeginningandendingIDsareincluded.

Query all Segment ID Ranges


YoucanretrieveallsegmentIDranges.
Example 6-7. Get all Segment ID Ranges
Request:
GET https://<vsm-ip>/api/2.0/vdn/config/segments

ResponseBody:
<segmentRanges>
<segmentRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>5000</begin>
<end>9000</end>
</segmentRange>
<segmentRange>
....
</segmentRange>
</segmentRanges>

104

VMware, Inc.

Chapter 6 Working with Logical Switches

Query a Specific Segment ID Range


YoucanretrieveasegmentIDrangebyspecifyingthesegmentID.
Example 6-8. Get a specific Segment ID Range
Request:
GET https://<vsm-ip>/api/2.0/vdn/config/segments/SegmentID

ResponseBody:
<segmentRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>10000</begin>
<end>11000</end>
</segmentRange>

Update a Segment ID Range


Youcanupdatethename,description,orendofasegmentIDrange.
Example 6-9. Update a Segment ID Range
Request:
PUT https://<vsm-ip>/api/2.0/vdn/config/segments/SegmentID

Request Body:
<segmentRange>
<end>3000</end>
<name>name</name>
<desc>desc</desc>
</segmentRang>

Delete a Segment ID Range


YoucandeleteasegmentIDrange.
Example 6-10. Delete a Segment ID Range
Request:
DELETE https://<vsm-ip>/api/2.0/vdn/config/segments/SegmentID

Working with Multicast Address Ranges


Specifyingamulticastaddressrangehelpsinspreadingtrafficacrossyournetworktoavoidoverloadinga
singlemulticastaddress.AvirtualizednetworkreadyhostisassignedanIPaddressfromthisrange.

Add a new Multicast Address Range


Youcanaddanewmulticastaddressrange.
Example 6-11. Add a multicast address range
Request:
POST https://<vsm-ip>/api/2.0/vdn/config/multicasts

RequestBody:
VMware, Inc.

105

vShield API Programming Guide

<multicastRanges>
<multicastRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>239.1.1.1</begin>
<end>239.3.3.3</end>
</multicastRange>
<multicastRange>
....
</multicastRange>
....
</multicastRanges>

Theaddressrangeisinclusivethebeginningandendingaddressesareincluded.

Query all Multicast Address Ranges


Youcanretrieveallmulticastaddressranges.
Example 6-12. Get all multicast ranges
Request:
GET https://<vsm-ip>/api/2.0/vdn/config/multicasts

ResponseBody:
<multicastRanges>
<multicastRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>239.1.1.1</begin>
<end>239.3.3.3</end>
</multicastRange>
<multicastRange>
...
</multicastRange>
...
</multicastRanges>

Get a Specific Multicast Address Range


Youcanretrieveaspecificmulticastaddressrange.
Example 6-13. Get a multicast range
Request:
GET https://<vsm-ip>/api/2.0/vdn/config/multicasts/multicastAddressRangeID

ResponseBody:
<multicastRange>
<id>1</id>
<name>name</name>
<desc>desc</desc>
<begin>239.1.1.1</begin>
<end>239.3.3.3</end>
</multicastRange>

106

VMware, Inc.

Chapter 6 Working with Logical Switches

Update a Multicast Address Range


Youcanupdatethename,description,orendaddressofamulticastaddressrange.
Example 6-14. Update a multicast range
Request Header:
PUT https://<vsm-ip>/api/2.0/vdn/config/multicasts/multicastAddressRangeID

Request Body:
<<segmentRange>
<end>3000</end>
<name>name</name>
<desc>desc</desc>
</segmentRang>

Delete a Multicast Address Range


Youcandeleteamulticastaddressrange.
Example 6-15. Delete multicast address range
Request:
DELETE https://<vsm-ip>/api/2.0/vdn/config/multicasts/<multicasts/multicasts/
multicastAddressRangeID

Working with Network Scopes


Anetworkscopeisthenetworkinginfrastructurewithinprovidervirtualdatacenters.

Create a Network Scope


Youmustspecifytheclustersthataretobepartofthenetworkscope.YoumusthavetheVLANID,UUIDof
thevCenterServer,andvDSID.
Example 6-16. Create a network scope
Request:
POST https://<vsm-ip>/api/2.0/vdn/scopes

RequestBody:
<vdnScope>
<clusters>
<cluster><cluster><objectId>domain-c59</objectId></cluster></cluster>
</clusters>
</vdnScope>

Edit a Network Scope


Youcanaddaclustertoordeleteaclusterfromanetworkscope.
Example 6-17. Create a network scope
Request:
POST https://<vsm-ip>/api/2.0/vdn/scopes/scopeID?action=patch

RequestBody:

VMware, Inc.

107

vShield API Programming Guide

<vdnScope>
<objectId>{id}</objectId>
<clusters>
<cluster><cluster><objectId>domain-c59</objectId></cluster></cluster>
</clusters>
</vdnScope>

Update Attributes on a Network Scope


Youcanupdatetheattributesofanetworkscope.
Example 6-18. Update attributes of a network scope
Request:
PUT https://<vsm-ip>/api/2.0/vdn/scopes/scopeID/attributes

RequestBody:
<vdnScope>
<objectId>vdnScope-1</objectId>
<name>new name</name>
<description>new description</description>
</vdnScope>

Query existing Network Scopes


Youcanretrieveallexistingnetworkscopes.
Example 6-19. Get all network scopes
Request:
GET https://<vsm-ip>/api/2.0/vdn/scopes

ResponseBody:
<vdnScopes>
<vdnScope>
<objectId>vdnscope-2</objectId>
<type><typeName>VdnScope</typeName></type>
<name>My Name</name>
<description>My Description</description>
<revision>0</revision>
<objectTypeName>VdnScope</objectTypeName>
<extendedAttributes/>
<id>vdnscope-2</id>
<clusters>
<cluster>
<cluster>
<objectId>domain-c124</objectId>
<type><typeName>ClusterComputeResource</typeName></type>
<name>vxlan-cluster</name>
<scope><id>datacenter-2</id><objectTypeName>Datacenter</objectTypeName><name>dc1</name></scope>
<extendedAttributes/>
</cluster>
</cluster>
...
</clusters>
<virtualWireCount>10</virtualWireCount>
</vdnScope>
...
<vdnScope>...</vdnScope>
...

108

VMware, Inc.

Chapter 6 Working with Logical Switches

</vdnScopes>

Query a Specific Network Scope


Youcanretrieveaspecificnetworkscope.
Example 6-20. Get a network scope
Request:
GET https://<vsm-ip>/api/2.0/vdn/scopes/scopeID

ResponseBody:
<vdnScope>
<objectId>vdnscope-2</objectId>
<type><typeName>VdnScope</typeName></type>
<name>My Name</name>
<description>My description</description>
<revision>0</revision>
<objectTypeName>VdnScope</objectTypeName>
<extendedAttributes/>
<id>vdnscope-2</id>
<clusters>
<cluster>
<cluster>
<objectId>domain-c124</objectId>
<type><typeName>ClusterComputeResource</typeName></type>
<name>vxlan-cluster</name>
<scope><id>datacenter-2</id><objectTypeName>Datacenter</objectTypeName><name>dc1</name></scope>
<extendedAttributes/>
</cluster>
</cluster>
...
</clusters>
<virtualWireCount>10</virtualWireCount>
</vdnScope>

Delete a Network Scope


Youcandeleteanetworkscope.
Example 6-21. Delete network scope
Request:
DELETE https://<vsm-ip>/api/2.0/vdn/scopes/scopeID

Working with Virtualized Networks


AVXLANvirtualwireisacollectionofvDSportgroupsacrossmultiplevirtualdistributesswitches(vDS)
withinanetworkscope.

Create a VXLAN Virtual Wire


YoucancreateanewVXLANvirtualwireonthespecifiednetworkscope.Youmusthavedefinedasegment
IDrangeandamulticastaddressrangebeforecreatingaVXLANvirtualwire.
ThedefaultvalueofthecontrolPlaneModeparameteristhevaluespecifiedforthetransportzone.

VMware, Inc.

109

vShield API Programming Guide

Example 6-22. Create a VXLAN virtual wire


Request:
POST https://<vsm-ip>/api/2.0/vdn/scopes/scopeID/virtualwires

RequestBody:
<virtualWireCreateSpec>
<name>virtual wire name</name>
<description>virtual wire description</description>
<tenantId>virtual wire tenant</tenantId>
<controlPlaneMode>UNICAST_MODE</controlPlaneMode>...<!-- Optional. Default is the value specified for the transport
zone. -->
</virtualWireCreateSpec>

Query all VXLAN Virtual Wires on a Network Scope


YoucanretrieveallVXLANvirtualwiresonthespecifiednetworkscope.
Example 6-23. Get all VXLANvirtual wires
Request:
GET https://<vsm-ip>/api/2.0/vdn/scopes/scopeID/virtualwires
Response Body:
<virtualWires>
<sortedDataPage>
<datapart class="virtualWire">
<objectId>virtualwire-1</objectId>
<name>vWire1</name>
<description>virtual wire 1</description>
<tenantId>virtual wire tenant</tenantId>
<revision>0</revision>
<vdnScopeId>vdnscope-7</vdnScopeId>
<vdsContextWithBacking>
<teaming>ETHER_CHANNEL</teaming>
<switchId>dvs-81</switchId>
<backingType>portgroup</backingType>
<backingValue>dvportgroup-88</backingValue>
</vdsContextWithBacking>
<vdnId>5002</vdnId>
<multicastAddr>239.0.0.3</multicastAddr>
</datapart>
....
<datapart class="virtualWire">
....
</datapart>
<pagingInfo>
<pageSize>20</pageSize>
<startIndex>0</startIndex>
<totalCount>3</totalCount>
<sortOrderAscending>false</sortOrderAscending>
</pagingInfo>
</sortedDataPage>
</virtualWires>

Query all VXLAN Virtual Wires on all Network Scopes


YoucanretrieveallVXLANvirtualwiresacrossallnetworkscopes.
Example 6-24. Get all VXLANvirtual wires on all network scopes
Request:

110

VMware, Inc.

Chapter 6 Working with Logical Switches

GET https://<vsm-ip>/api/2.0/vdn/virtualwires

ResponseBody:
</virtualWires>
<sortedDataPage>
<datapart class="virtualWire">
<objectId>virtualwire-1</objectId>
<name>vWire1</name>
<description>virtual wire 1</description>
<tenantId>virtual wire tenant</tenantId>
<revision>0</revision>
<vdnScopeId>vdnscope-7</vdnScopeId>
<vdsContextWithBacking>
<teaming>ETHER_CHANNEL</teaming>
<switchId>dvs-81</switchId>
<backingType>portgroup</backingType>
<backingValue>dvportgroup-88</backingValue>
</vdsContextWithBacking>
<vdnId>5002</vdnId>
<multicastAddr>239.0.0.3</multicastAddr>
</datapart> ....
<datapart class="virtualWire"> ....
</datapart>
<pagingInfo>
<pageSize>20</pageSize>
<startIndex>0</startIndex>
<totalCount>3</totalCount>
<sortOrderAscending>false</sortOrderAscending>
</pagingInfo>
</sortedDataPage>
</virtualWires>

Query a Specific VXLAN Virtual Wire


YoucanretrievethedefinitionforaVXLANvirtualwire.
Example 6-25. Get a VXLANvirtual wire definition
Request:
GET https://<vsm-ip>/api/2.0/vdn/virtualwires/virtualWireID

ResponseBody:
<virtualWire>
<name>Test Virtual Wire</name>
<description>Test Virtual Wire Description</description>
<objectid>virtualwire-4</objectid>
<vdnScopeId>vdnscope-3</vdnScopeId>
<revision>1</revision>
<vdsContextWithBacking>
<teaming>ETHER_CHANNEL</teaming>
<switchId>dvs-162</switchId>
<backingType>PortGroup</backingType>
<backingValue>pg-moid</backingValue>
</vdsContextWithBacking>
<vdnId>5002</vdnId>
<multicastAddr>239.0.0.3</multicastAddr>
</virtualWire>

Modify Control Plane Mode


Youcanmodifythecontrolplanemodeofalogicalswitch.Thepossibleoptionsare:

VMware, Inc.

111

vShield API Programming Guide

Multicast: Multicast IP addresses on physical network is used for the control plane. This mode is

recommendedonlywhenyouareupgradingfromolderVXLANdeployments.Requires

PIM/IGMPonphysicalnetwork.

n Unicast: The control plane is handled by an NSX controller. All unicast traffic leverages headend

replication.NomulticastIPaddressesorspecialnetworkconfigurationisrequired.

n Hybrid: The optimized unicast mode. Offloads local traffic replication to physical network (L2

multicast).ThisrequiresIGMPsnoopingonthefirsthopswitch,butdoesnotrequirePIM.Firsthop

switchhandlestrafficreplicationforthesubnet.

Delete a VXLAN Virtual Wire


YoucandeleteaVXLANvirtualWire.
Example 6-26. Delete virtual wire
Request:
DELETE https://<vsm-ip>/api/2.0/vdn/virtualwires/virtualWireID

Managing the VXLAN Virtual Wire UDP Port


YoucanretrieveorupdatetheUDPport.

Get UDP Port


YoucanretrievetheUDPportfortheVXLANvirtualwire.
Example 6-27. Get UDP port
Request:
Get https://<vsm-ip>/api/2.0/vdn/config/vxlan/udp/port

Update UDP Port


YoucanchangetheUDPportfortheVXLANvirtualwire.Ifnotset,theportdefaultstoport8472.
Example 6-28. Change UDP port
Request:
PUT https://<vsm-ip>/api/2.0/vdn/config/vxlan/udp/port/port

Querying Allocated Resources


YoucanretrievealistofresourcesallocatedtoVXLANvirtualwiresinyournetwork.
Example 6-29. Get resources
GetsegmentIDsallocatedtoVXLANvirtualwires:
GET https://<vsm-ip>/api/2.0/vdn/config/resources/allocated?type=segmentId&pagesize={pageSize}&startindex={startIndex}

GetmulticastaddressrangeallocatedtoVXLANvirtualwires:

112

VMware, Inc.

Chapter 6 Working with Logical Switches

GET https://<vsm-ip>/api/2.0/vdn/config/resources/allocated?type=multicastAddress&pagesize={pageSize}&startindex={startIndex}

where

start indexisanoptionalparameterwhichspecifiesthestartingpointforretrievingtheresources.Ifthis
parameterisnotspecified,resourcesareretrievedfromthebeginning.

page sizeisanoptionalparameterthatlimitsthemaximumnumberofentriesreturnedbytheAPI.The
defaultvalueforthisparameteris256andthevalidrangeis11024.

Testing Multicast Group Connectivity


YoucanperformamulticastgroupconnectivitytestinanetworkscopeorVXLANvirtualwire.

Test Multicast Group Connectivity in a Network Scope


Example 6-30. Test multicast group connectivity in network scope
Request:
PUT https://<vsm-ip>/api/2.0/vdn/scopes/ScopeID/conn-check/multicast

RequestBody:
<testParameters>
<gateway>172.23.233.1</gateway>
<packetSize>1600</packetSize>
<expectedResponse>5</expectedResponse>
<returnHopCount>true</returnHopCount>
<returnRecordIp>true</returnRecordIp>
<sourceHost>
<hostId>host-9</hostId>
<switchId>dvs-22</switchId>
<vlanId>54</vlanId>
<sourceHost>
<destinationHost>
<hostId>host-92</hostId>
<switchId>dvs-22</switchId>
<vlanId>54</vlanId>
<destinationHost>
</testParameters>

Test Multicast Group Connectivity in a VXLAN Virtual Wire


Example 6-31. Test multicast group connectivity in virtual wire
Request:
PUT https://<vsm-ip>/api/2.0/vdn/scopes/virtualWireID/conn-check/multicast

RequestBody:
<testParameters>
<gateway>172.23.233.1</gateway>
<packetSize>1600</packetSize>
<expectedResponse>5</expectedResponse>
<returnHopCount>true</returnHopCount>
<returnRecordIp>true</returnRecordIp>
<sourceHost>
<hostId>host-9</hostId>
<switchId>dvs-22</switchId>
<vlanId>54</vlanId>
<sourceHost>
<destinationHost>

VMware, Inc.

113

vShield API Programming Guide

<hostId>host-92</hostId>
<switchId>dvs-22</switchId>
<vlanId>54</vlanId>
<destinationHost>
</testParameters>

Performing Ping Test


YoucanperformapointtopointconnectivitytestbetweentwohostsacrosswhichaVXLANvirtualwire
spans.
Example 6-32. Perform point to point test
Request:
PUT https://<vsm-ip>/api/2.0/vdn/virtualwires/virtualWireID/conn-check/p2p

RequestBody:
<testParameters>
<gateway>172.23.233.1</gateway>
<packetSize>1600</packetSize>
<expectedResponse>5</expectedResponse>
<returnHopCount>true</returnHopCount>
<returnRecordIp>true</returnRecordIp>
<sourceHost>
<hostId>host-9</hostId>
<switchId>dvs-22</switchId>
<vlanId>54</vlanId>
<sourceHost>
<destinationHost>
<hostId>host-92</hostId>
<switchId>dvs-22</switchId>
<vlanId>54</vlanId>
<destinationHost>
</testParameters>

114

VMware, Inc.

NSX Edge Logical Router Installation


and Management

NSXEdgeLogicalRouterprovidesEastWestdistributedroutingwithtenantIPaddressspaceanddatapath
isolation.Virtualmachinesorworkloadsthatresideonthesamehostondifferentsubnetscancommunicate
withoneanotherwithouthavingtotraverseatraditionalroutinginterface.Alogicalroutercanhaveeight
uplinkinterfacesanduptoathousandinternalinterfaces.
ForinformationonretrievingobjectsIDs,seeonpage 33.
Thischapterincludesthefollowingtopics:

InstallingaLogicalRouteronpage 115

QueryaLogicalRouteronpage 116

ModifyaRouteronpage 118

DeletingaRouteronpage 118

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Installing a Logical Router


Beforeinstallingalogicalrouter,youmustpreparethehostsontheappropriateclusters.Formore
information,seeWorkingwithNetworkVirtualizationComponentsonpage 76.
Alogicalroutercanhaveeightuplinkinterfacesanduptoathousandinternalinterfaces.
TheuserspecifiedconfigurationisstoredinthedatabaseandEdgeidentifierisreturnedtotheuser.This
identifiermustbeusedforfutureconfigurationsonthegivenEdge.
Ifanyappliance(s)arespecifiedandatleastoneconnectedinterface/vnicisspecified,thentheappliance(s)are
deployedandconfigurationisappliedtothem.
Example 7-1. Install a logical router
Request:
POST https://<nsxmgr-ip>/api/4.0/edges

RequestBody:
<edge>
<datacenterMoid>datacenter-2</datacenterMoid>
<type>distributedRouter</type>
<!-- Mandatory to create "distributedRouter" edge. When absent, defaults to
"gatewayServices" -->
<appliances>
<!-- Mandatory for "distributedRouter" edge. Atleast one appliance needs to be configured -->
<appliance>
<resourcePoolId>resgroup-20</resourcePoolId>
<datastoreId>datastore-23</datastoreId>
</appliance>

VMware, Inc.

115

vShield API Programming Guide

</appliances>
<mgmtInterface>
<!-- Mandatory for "distributedRouter" edge -->
<connectedToId>dvportgroup-38</connectedToId>
<addressGroups>
<addressGroup>
<primaryAddress>10.112.196.165</primaryAddress>
<subnetMask>255.255.252.0</subnetMask>
</addressGroup>
</addressGroups>
</mgmtInterface>
<interfaces>
<!-- Optional. Can be added later using modular APIs. Upto 999 interfaces supported. -->
<interface>
<type>uplink</type>
<mtu>1500</mtu>
<isConnected>true</isConnected>
<addressGroups>
<!-- Supports one or more addressGroups -->
<addressGroup>
<!-- AddressGroup on "distributedRouter" edge can have only primary ipAddresses. Secondary addresses
not supported -->
<primaryAddress>192.168.10.1</primaryAddress>
<!-- "distributedRouter" edge only supports IPv4 addresses -->
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<connectedToId>dvportgroup-39</connectedToId> <!-- "distributedRouter" edge does not support legacy portGroups -->
</interface>
<interface>
<type>internal</type>
<mtu>1500</mtu>
<isConnected>true</isConnected>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.20.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<connectedToId>dvportgroup-40</connectedToId>
</interface>
</interfaces>
</edge>

IMPORTANTThelocationheaderreturnstheedgeIdoftheinstalledrouter.YoumustusethisIDtoconfigure
andmanagethisNSXEdgeinstance.

Query a Logical Router


Retrievesinformationaboutthespecifiedrouter.
Example 7-2. Query a router
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}

ResponseBody:
<edgeSummaries>
<edge>
<id>edge-15</id>
<version>21</version>
<status>deployed</status>
<datacenterMoid>datacenter-2</datacenterMoid>
<datacenterName>Datacenter</datacenterName>
<tenant>default</tenant>
<name>vShield-edge-15</name>
<fqdn>vShield-edge-15</fqdn>
<enableAesni>true</enableAesni>
<enableFips>false</enableFips>
<vseLogLevel>info</vseLogLevel>

116

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

<appliances>
<applianceSize>compact</applianceSize>
<appliance>
<highAvailabilityIndex>0</highAvailabilityIndex>
<vcUuid>422f63b1-bb0e-ba50-3aae-4be1263db676</vcUuid>
<vmId>vm-62</vmId>
<resourcePoolId>resgroup-20</resourcePoolId>
<resourcePoolName>Resources</resourcePoolName>
<datastoreId>datastore-23</datastoreId>
<datastoreName>shahm-esx-storage</datastoreName>
<hostId>host-22</hostId>
<hostName>10.112.196.160</hostName>
<vmFolderId>group-v3</vmFolderId>
<vmFolderName>vm</vmFolderName>
<vmHostname>vShield-edge-15-0</vmHostname>
<vmName>vShield-edge-15-0</vmName>
<deployed>true</deployed>
<edgeId>edge-15</edgeId>
</appliance>
</appliances>
<cliSettings>
<remoteAccess>false</remoteAccess>
<userName>admin</userName>
</cliSettings>
<type>distributedRouter</type>
<mgmtInterface>
<label>vNic_0</label>
<name>mgmtInterface</name>
<addressGroups>
<addressGroup>
<primaryAddress>10.112.196.166</primaryAddress>
<subnetMask>255.255.252.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<index>0</index>
<connectedToId>dvportgroup-38</connectedToId>
<connectedToName>DvPortGroup1</connectedToName>
</mgmtInterface>
<interfaces>
<interface>
<label>vNic_1</label>
<name>interface1</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.10.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>uplink</type>
<isConnected>true</isConnected>
<index>1</index>
<connectedToId>dvportgroup-39</connectedToId>
<connectedToName>dvport-vlan-1</connectedToName>
</interface>
<interface>
<label>75649aea0000000a</label>
<name>interface10</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.20.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>internal</type>
<isConnected>true</isConnected>

VMware, Inc.

117

vShield API Programming Guide

<index>10</index>
<connectedToId>dvportgroup-40</connectedToId>
<connectedToName>dvport-vlan-2</connectedToName>
</interface>
<interface>
<label>75649aea0000000b</label>
<name>interface-11</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.50.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>internal</type>
<isConnected>true</isConnected>
<index>11</index>
<connectedToId>dvportgroup-37</connectedToId>
<connectedToName>DvSwitch2-DVUplinks-36</connectedToName>
</interface>
</interfaces>
<edgeAssistId>1969527530</edgeAssistId>
</edge>

Modify a Router
Replacestheconfigurationofthespecifiedrouter.
Example 7-3. Modify router
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}

RequestBody:
SeeExample 71.

Deleting a Router
Youcandeletealogicalrouterinstance.Appliancesassociatedwiththerouterinstancearedeletedaswell.
Example 7-4. Delete a router
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>

Working with Interfaces


AnNSXEdgeroutercanhaveeightuplinkinterfacesanduptoathousandinternalinterfaces.Itmusthaveat
leastoneinternalinterfacebeforeitcanbedeployed.

Working with Management Interfaces


Configure Management Interfaces
ConfiguremanagementinterfacesforanNSXEdgerouter.

118

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

Example 7-5. Configure management interfaces


Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId/mgmtinterface

RequestBody:
<mgmtInterface>
<addressGroups>
<addressGroup>
<primaryAddress>10.112.196.166</primaryAddress>
<subnetMask>255.255.252.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<connectedToId>dvportgroup-38</connectedToId>
</mgmtInterface>

Query Management Interfaces


RetrievesallmanagementinterfacesforthespecifiedNSXEdgerouter.
Example 7-6. Query interfaces
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId/mgmtinterface

ResponseBody:

<mgmtInterface>
<label>vNic_0</label>
<name>mgmtInterface</name>
<addressGroups>
<addressGroup>
<primaryAddress>10.112.196.166</primaryAddress>
<subnetMask>255.255.252.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<index>0</index>
<connectedToId>dvportgroup-38</connectedToId>
<connectedToName>DvPortGroup1</connectedToName>
</mgmtInterface>

Working with all Interfaces


AnNSXEdgeroutercanhaveupto8uplinkinterfaces.

Add Interfaces
ConfiguresoneormoreinterfaceforanNSXEdgeRouter.Thespecifiedconfigurationisstoredinthe
database.Ifanyappliance(s)isassociatedwiththisEdgeEdgeinstance,thespecifiedconfigurationisapplied
totheapplianceaswell.
Youshouldnotdefineaindexforthenewadditionofinterfaces.TheindexesaresystemgeneratedToupdate
theexistinginterfaces,includethemintheXMLwiththesystemgeneratedindexes(canbeobtainedbyaGET
call).
Example 7-7. Add an interface
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/interfaces/?action=patch

VMware, Inc.

119

vShield API Programming Guide

RequestBody:
<interfaces>
<interface>
<name>interface1</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.10.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>uplink</type>
<isConnected>true</isConnected>
<connectedToId>dvportgroup-39</connectedToId>
</interface>
<interface>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.20.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>internal</type>
<isConnected>true</isConnected>
<connectedToId>dvportgroup-40</connectedToId>
</interface>
<interface>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.50.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>internal</type>
<isConnected>true</isConnected>
<connectedToId>dvportgroup-37</connectedToId>
</interface>
</interfaces>

Query Interfaces for a NSX Edge Router


RetrievesallinterfacesforthespecifiedEdgerouter.
Example 7-8. Retrieve all interfaces
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/interfaces

ResponseBody:
<interfaces>
<interface>
<label>vNic_1</label>
<name>interface1</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.10.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>uplink</type>
<isConnected>true</isConnected>

120

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

<index>1</index>
<connectedToId>dvportgroup-39</connectedToId>
<connectedToName>dvport-vlan-1</connectedToName>
</interface>
<interface>
<label>75649aea0000000a</label>
<name>interface10</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.20.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>internal</type>
<isConnected>true</isConnected>
<index>10</index>
<connectedToId>dvportgroup-40</connectedToId>
<connectedToName>dvport-vlan-2</connectedToName>
</interface>
<interface>
<label>75649aea0000000b</label>
<name>interface-11</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.50.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>internal</type>
<isConnected>true</isConnected>
<index>11</index>
<connectedToId>dvportgroup-37</connectedToId>
<connectedToName>DvSwitch2-DVUplinks-36</connectedToName>
</interface>
</interfaces>

Delete Interfaces
DeletesoneormoreinterfacesforanNSXEdgeRouter.Storesthespecifiedconfigurationindatabase.Ifany
appliance(s)areassociatedwiththisedge,disconnectsanddeletestheinterface.
Example 7-9. Delete interface
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/interfaces/?index=<index1>&index=<index2>

Delete all Interfaces


DeletesallinterfacesforanNSXEdgeRouter.Storesthespecifiedconfigurationindatabase.Ifany
appliance(s)areassociatedwiththisedge,disconnectsanddeletestheinterface.
Example 7-10. Delete all interfaces
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/interfaces

VMware, Inc.

121

vShield API Programming Guide

Manage an NSX Edge Router Interface


YoucanmanageaspecificNSXEdgerouterinterface.

Retrieve Interface with Specific Index


RetrievestheinterfacewithspecifiedindexforaEdgeEdge.
Example 7-11. Get interface with specific index
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/interfaces/index

ResponseBody:
<interface>
<label>vNic_1</label>
<name>interface1</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.10.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>uplink</type>
<isConnected>true</isConnected>
<index>1</index>
<connectedToId>dvportgroup-39</connectedToId>
<connectedToName>dvport-vlan-1</connectedToName>
</interface>

Modify an Interface
Modifiesthespecifiedinterface.
Example 7-12. Modify interface
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/interfaces/<index>

ResponseBody:
<interface>
<name>interface1</name>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.10.1</primaryAddress>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<type>uplink</type>
<isConnected>true</isConnected>
<connectedToId>dvportgroup-39</connectedToId>
</interface>

Delete Interface Configuration


Deletestheinterfaceconfigurationandresetsittothefactorydefault.

122

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

Example 7-13. Delete interface configuration


Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/interfaces/index

Configure Routes
ConfiguresglobalConfig,staticRouting,OSPG,BGP,andISISroutes.
Example 7-14. Configure routes
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config

RequestBody:
<routing>
<routingGlobalConfig>
<routerId>1.1.1.1</routerId> <!-- Required when dynamic routing protocols like OSPF, BGP, IS-IS is configured -->
<logging>
<!-- Optional. When absent, enable=false and logLevel=INFO -->
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
<ipPrefixes> <!-- Optional. Required only if user wants to define redistribution rules in dynamic routing protocols like ospf, isis,
bgp -->
<ipPrefix>
<name>a</name> <!-- All the defined ipPrefix must have unique names -->
<ipAddress>10.112.196.160/24</ipAddress>
</ipPrefix>
<ipPrefix>
<name>b</name>
<ipAddress>192.168.10.0/24</ipAddress>
</ipPrefix>
</ipPrefixes>
</routingGlobalConfig>
<staticRouting>
<staticRoutes> <!-- Optional, if no static routes needs to be configured -->
<route>
<description>route1</description>
<vnic>0</vnic>
<network>3.1.1.0/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
<route>
<description>route2</description>
<vnic>1</vnic>
<network>4.1.1.0/22</network>
<nextHop>10.112.196.118</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
</staticRoutes>
<defaultRoute>
<!-- Optional, if no default routes needs to be configured -->
<description>defaultRoute</description>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the interface
on which this route is configured -->
</defaultRoute>
</staticRouting>
<ospf>
<!-- Optional, if no OSPF needs to be configured -->
<enabled>true</enabled> <!-- Optional. Defaults to true -->

VMware, Inc.

123

vShield API Programming Guide

<forwardingAddress>192.168.10.2</forwardingAddress> <!-- ipAddress on one of the uplink interfaces -->


<protocolAddress>192.168.10.3</protocolAddress> <!-- ipAddress on the same subnet as the forwardingAddress -->
<ospfAreas>
<ospfArea>
<areaId>100</areaId> <!-- Mandatory and unique. Valid values are 0-4294967295 -->
<type>normal</type> <!-- Optional. Default is normal. Valid inputs are normal, stub -->
<authentication>
<!-- Optional. When not specified, its "none" authentication. -->
<type>password</type> <!-- Valid values are none, password , md5 -->
<value>vmware123</value> <!-- Value as per the type of authentication -->
</authentication>
</ospfArea>
</ospfAreas>
<ospfInterfaces>
<ospfInterface>
<vnic>0</vnic>
<areaId>100</areaId>
<helloInterval>10</helloInterval> <!-- Optional. Default 10 sec. Valid values are 1-255-->
<deadInterval>40</deadInterval> <!-- Optional. Default 40 sec. Valid values are 1-65535 -->
<priority>128</priority> <!-- Optional. Default 128. Valid values are 0-255 -->
<cost>10</cost> <!-- Optional. Auto based on interface speed. Valid values are 1-65535 -->
</ospfInterface>
</ospfInterfaces>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<prefixName>b</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>true</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</ospf>
<bgp>
<!-- Optional, if no BGP needs to be configured -->
<enabled>true</enabled> <!-- Optional. Default is true -->
<localAS>65535</localAS>
<!-- Valid values are : 0-65535 -->
<bgpNeighbours>
<bgpNeighbour>
<ipAddress>192.168.10.10</ipAddress> <!-- Peer's IP. IPv4 only. Should not be same as any of interfaces's
IPs,forwardingAddress,protocolAddress -->
<forwardingAddress>192.168.1.10</forwardingAddress> <!-- Address defined on one of the uplink interfaces's -->
<protocolAddress>192.168.1.11</protocolAddress>
<!-- Address in the above same subnet as the forwardingAddress -->
<remoteAS>65500</remoteAS>
<!-- Valid values are 1-65534 -->
<weight>60</weight>
<!-- Optional. Default is 60. Valid values are 0-65535 -->
<holdDownTimer>180</holdDownTimer>
<!-- Optional. Default is 180 seconds. Valid values are : 2-65535. -->
<keepAliveTimer>60</keepAliveTimer> <!-- Optional. Default is 60 seconds. Valid values are : 1-65534. -->
<password>vmware123</password>
<!-- Optional -->
<bgpFilters>
<!-- Optional -->
<bgpFilter>

124

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

<direction>in</direction>
<!-- Valid values are in/out -->
<action>permit</action>
<!-- Valid values are permit/deny -->
<network>10.0.0.0/8</network> <!-- Valid values are CIDR networks. IPv4 only. IPv6 support not supported -->
<ipPrefixGe>17</ipPrefixGe> <!-- Optional. "Greater than or equal to" & used for filtering based on prefix length. Valid
IPv4 prefixes -->
<ipPrefixLe>32</ipPrefixLe> <!-- Optional. "Less than or equal to" & used for filtering based on prefix length. Valid IPv4
prefixes -->
</bgpFilter>
</bgpFilters>
</bgpNeighbour>
</bgpNeighbours>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>true</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>true</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</bgp>
</routing>

Query Routes
Retrievesglobal,static,OSPF,BGP,andISISconfigurations.
Example 7-15. Retrieve routes
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<routing>
<routingGlobalConfig>
<routerId>1.1.1.1</routerId>
<logging>
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
<ipPrefixes>
<ipPrefix>
<name>a</name>
<ipAddress>10.112.196.160/24</ipAddress>
</ipPrefix>
<ipPrefix>
<name>b</name>
<ipAddress>192.168.10.0/24</ipAddress>

VMware, Inc.

125

vShield API Programming Guide

</ipPrefix>
</ipPrefixes>
</routingGlobalConfig>
<staticRouting>
<staticRoutes>
<route>
<description>route1</description>
<vnic>0</vnic>
<network>3.1.1.0/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu>
<type>user</type>
</route>
<route>
<description>route2</description>
<vnic>1</vnic>
<network>4.1.1.0/22</network>
<nextHop>10.112.196.118</nextHop>
<mtu>1500</mtu>
<type>user</type>
</route>
</staticRoutes>
<defaultRoute>
<description>defaultRoute</description>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu>
</defaultRoute>
</staticRouting>
<ospf>
<enabled>true</enabled>
<forwardingAddress>192.168.10.2</forwardingAddress>
<protocolAddress>192.168.10.3</protocolAddress>
<ospfAreas>
<ospfArea>
<areaId>100</areaId>
<type>normal</type>
<authentication>
<type>password</type>
<value>vmware123</value>
</authentication>
</ospfArea>
</ospfAreas>
<ospfInterfaces>
<ospfInterface>
<vnic>0</vnic>
<areaId>100</areaId>
<helloInterval>10</helloInterval>
<deadInterval>40</deadInterval>
<priority>128</priority>
<cost>10</cost>
</ospfInterface>
</ospfInterfaces>
<redistribution>
<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>true</isis>
<ospf>false</ospf>
<bgp>false</bgp>
<static>false</static>
<connected>true</connected>
</from>
<action>deny</action>
</rule>

126

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

<rule>
<id>0</id>
<prefixName>b</prefixName>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>true</bgp>
<static>false</static>
<connected>false</connected>
</from>
<action>permit</action>
</rule>
</rules>
</redistribution>
</ospf>
<bgp>
<enabled>true</enabled>
<localAS>65535</localAS>
<bgpNeighbours>
<bgpNeighbour>
<ipAddress>192.168.10.10</ipAddress>
<forwardingAddress>192.168.1.10</forwardingAddress>
<protocolAddress>192.168.1.11</protocolAddress>
<remoteAS>65500</remoteAS>
<weight>60</weight>
<holdDownTimer>180</holdDownTimer>
<keepAliveTimer>60</keepAliveTimer>
<password>vmware123</password>
<bgpFilters>
<bgpFilter>
<direction>in</direction>
<action>permit</action>
<network>10.0.0.0/8</network>
<ipPrefixGe>17</ipPrefixGe>
<ipPrefixLe>32</ipPrefixLe>
</bgpFilter>
<bgpFilter>
<direction>out</direction>
<action>deny</action>
<network>20.0.0.0/26</network>
</bgpFilter>
</bgpFilters>
</bgpNeighbour>
</bgpNeighbours>
<redistribution>
<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>true</isis>
<ospf>true</ospf>
<bgp>false</bgp>
<static>true</static>
<connected>false</connected>
</from>
<action>deny</action>
</rule>
<rule>
<id>0</id>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>false</bgp>
<static>false</static>
<connected>true</connected>
</from>

VMware, Inc.

127

vShield API Programming Guide

<action>permit</action>
</rule>
</rules>
</redistribution>
</bgp>
</routing>

Delete Routes
DeletestheroutingconfigurationstoredintheNSXManagerdatabaseandthedefaultroutesfromthe
specifiedNSXEdgerouter.
Example 7-16. Delete routing
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config

Manage Global Routing Configuration


Configuresthedefaultgatewayforstaticroutesanddynamicroutingdetails.

Specify Global Configuration


Example 7-17. Configure global route
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/global

RequestBody:
<routingGlobalConfig>
<routerId>1.1.1.1</routerId> <!-- Required when dynamic routing protocols like OSPF, BGP, IS-IS is configured -->
<logging>
<!-- Optional. When absent, enable=false and logLevel=INFO -->
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
<ipPrefixes> <!-- Optional. Required only if user wants to define redistribution rules in dynamic routing protocols like ospf, isis,
bgp -->
<ipPrefix>
<name>a</name> <!-- All the defined ipPrefix must have unique names -->
<ipAddress>10.112.196.160/24</ipAddress>
</ipPrefix>
<ipPrefix>
<name>b</name>
<ipAddress>192.168.10.0/24</ipAddress>
</ipPrefix>
</ipPrefixes>
</routingGlobalConfig>

Query Global Route


RetrievesroutinginformationfromtheNSXManagerdatabaseforanedgewhichincludesthefollowing:

Defaultroutesettings

Staticrouteconfigurations

Example 7-18. Query global route


PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/global

128

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

<routingGlobalConfig>

Manage Static Routing


AddorquerystaticanddefaultroutesforsecifiedEdge.

Configure Static Routes


Configuresstaticanddefaultroutes.
Example 7-19. Configure static routes
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/static

RequestBody:
<staticRouting>
<staticRoutes>
<route>
<description>route1</description>
<vnic>0</vnic>
<network>3.1.1.4/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
<route>
<description>route2</description>
<vnic>1</vnic>
<network>4.1.1.4/22</network>
<nextHop>10.112.196.118</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
</staticRoutes>
<defaultRoute>
<description>defaultRoute</description>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the interface
on which this route is configured -->
</defaultRoute>
</staticRouting>

Query Static Routes


Retrievesstaticanddefaultroutes.
Example 7-20. Configure static routes
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/static

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<staticRouting>
<staticRoutes>
<route>
<description>route1</description>
<vnic>0</vnic>
<network>3.1.1.4/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu>
<type>user</type>
</route>

VMware, Inc.

129

vShield API Programming Guide

<route>
<description>route2</description>
<vnic>1</vnic>
<network>4.1.1.4/22</network>
<nextHop>10.112.196.118</nextHop>
<mtu>1500</mtu>
<type>user</type>
</route>
</staticRoutes>
<defaultRoute>
<description>defaultRoute</description>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu>
</defaultRoute>
</staticRouting>

Delete Static Routes


DeletesbothstaticanddefaultroutingconfigurationstoredintheNSXManagerdatabase.
Example 7-21. Delete static routes
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/static

Manage OSPF Routes for NSX Edge


NSXEdgesupportsOSPF,aninteriorgatewayprotocolthatroutesIPpacketsonlywithinasinglerouting
domain.Itgatherslinkstateinformationfromavailableroutersandconstructsatopologymapofthenetwork.
ThetopologydeterminestheroutingtablepresentedtotheInternetLayer,whichmakesroutingdecisions
basedonthedestinationIPaddressfoundinIPpackets.
OSPFroutingpoliciesprovideadynamicprocessoftrafficloadbalancingbetweenroutesofequalcost.An
OSPFnetworkisdividedintoroutingareastooptimizetraffic.AnareaisalogicalcollectionofOSPFnetworks,
routers,andlinksthathavethesameareaidentification.
AreasareidentifiedbyanAreaID.

Configure OSPF
Example 7-22. Configure OSPF
Request
PUThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/ospf
RequestBody:
<ospf>
<enabled>true</enabled>
<!-- When not specified, it will be treated as false, When false, it will delete the existing config -->
<ospfAreas>
<ospfArea>
<areaId>100</areaId> <!-- Mandatory and unique. Valid values are 0-4294967295 -->
<type>normal</type> <!-- Optional. Default is normal. Valid inputs are normal, nssa -->
<authentication>
<!-- Optional. When not specified, its "none" authentication. -->
<type>password</type> <!-- Valid values are none, password , md5 -->
<value>vmware123</value> <!-- Value as per the type of authentication -->
</authentication>
</ospfArea>
</ospfAreas>
<ospfInterfaces>
<ospfInterface>

130

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

<vnic>0</vnic>
<areaId>100</areaId>
<helloInterval>10</helloInterval> <!-- Optional. Default 10 sec. Valid values are 1-255-->
<deadInterval>40</deadInterval> <!-- Optional. Default 40 sec. Valid values are 1-65535 -->
<priority>128</priority> <!-- Optional. Default 128. Valid values are 0-255 -->
<cost>10</cost> <!-- Optional. Auto based on interface speed. Valid values are 1-65535 -->
</ospfInterface>
</ospfInterfaces>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<prefixName>b</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>true</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</ospf>

Query OSPF
Example 7-23. Query OSPF
Request
GEThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/ospf
ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<ospf>
<enabled>true</enabled>
<ospfAreas>
<ospfArea>
<areaId>100</areaId>
<type>normal</type>
<authentication>
<type>password</type>
<value>vmware123</value>
</authentication>
</ospfArea>
</ospfAreas>
<ospfInterfaces>
<ospfInterface>
<vnic>0</vnic>
<areaId>100</areaId>
<helloInterval>10</helloInterval>

VMware, Inc.

131

vShield API Programming Guide

<deadInterval>40</deadInterval>
<priority>128</priority>
<cost>10</cost>
</ospfInterface>
</ospfInterfaces>
<redistribution>
<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>true</isis>
<ospf>false</ospf>
<bgp>false</bgp>
<static>false</static>
<connected>true</connected>
</from>
<action>deny</action>
</rule>
<rule>
<id>0</id>
<prefixName>b</prefixName>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>true</bgp>
<static>false</static>
<connected>false</connected>
</from>
<action>permit</action>
</rule>
</rules>
</redistribution>
</ospf>

Delete OSPF
DeletesOSPFrouting.
Example 7-24. Delete OSPF
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/ospf

Manage ISIS Routes for NSX Edge


IntermediateSystemtoIntermediateSystem(ISIS)isaroutingprotocoldesignedtomoveinformationby
determiningthebestroutefordatagramsthroughapacketswitchednetwork.Atwolevelhierarchyisused
tosupportlargeroutingdomains.Alargedomainmaybedividedintoareas.Routingwithinanareais
referredtoasLevel1routing.RoutingbetweenareasisreferredtoasLevel2routing.ALevel2Intermediate
System(IS)keepstrackofthepathstodestinationareas.ALevel1ISkeepstrackoftheroutingwithinitsown
area.Forapacketgoingtoanotherarea,aLevel1ISsendsthepackettothenearestLevel2ISinitsownarea,
regardlessofwhatthedestinationareais.ThenthepackettravelsviaLevel2routingtothedestinationarea,
whereitmaytravelviaLevel1routingtothedestination.ThisisreferredtoasLevel12.

Configure ISIS
Example 7-25. Configure ISIS
Request

132

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

PUThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/isis
RequestBody:
<isis>
<enabled>true</enabled>
<systemId>0004.c150.f1c0</systemId> <!-- Optional. 6 byte length & specified in HEX. When not specified, derived
routingGlobalConfig.routerId -->
<areaIds> <!-- Atleast one is required. Max supported is 3 -->
<areaId>49.0005.8000.ab7c.0000.ffe9.0001</areaId>
<areaId>49.0005.8000.ab7c.0000.ffe9.0002</areaId> <!-- Variable length between 1 and 13 bytes & specified in HEX. -->
<areaId>49.0005.8000.ab7c.0000.ffe9.0003</areaId>
</areaIds>
<isType>level-1-2</isType> <!-- Optional. Default is 'level-1-2'. Valid values are level-1, level-2, level-1-2 -->
<domainPassword>vshield</domainPassword> <!-- Optional. Domain level authentication. Used when type is level-2 -->
<areaPassword>edge</areaPassword>
<!-- Optional. Area level authentication. Used when type is level-1 -->
<isisInterfaces>
<isisInterface>
<vnic>0</vnic>
<meshGroup>10</meshGroup>
<!-- Optional. Valid values are : 0-4294967295 -->
<helloInterval>10000</helloInterval> <!-- Optional. Default is 10000 millisecond . Valid values are : 10-600000 -->
<helloMultiplier>3</helloMultiplier> <!-- Optional. Default is 3. Valid values are : 2-100 -->
<lspInterval>33</lspInterval>
<!-- Optional. Default is 33 milliseconds. Valid values are : 1-65535 -->
<metric>10</metric>
<!-- Optional. Default is 10. Valid values are : 1-16777215 -->
<priority>64</priority>
<!-- Optional. Default is 64. Valid values are : 0-127 -->
<circuitType>level-1-2</circuitType> <!-- Optional. Valid values are level-1, level-2, level-1-2. If absent, 'type' from above is
used -->
<password>msr</password>
<!-- Optional. Per interface authentication -->
</isisInterface>
</isisInterfaces>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>true</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>true</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<prefixName>b</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>true</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</isis>

Query ISIS
Example 7-26. Query ISIS
Request

VMware, Inc.

133

vShield API Programming Guide

GEThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/isis
ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<isis>
<enabled>true</enabled>
<systemId>0004.c150.f1c0</systemId>
<areaIds>
<areaId>49.0005.8000.ab7c.0000.ffe9.0001</areaId>
<areaId>49.0005.8000.ab7c.0000.ffe9.0002</areaId>
<areaId>49.0005.8000.ab7c.0000.ffe9.0003</areaId>
</areaIds>
<isType>level-1-2</isType>
<domainPassword>vshield</domainPassword>
<areaPassword>edge</areaPassword>
<isisInterfaces>
<isisInterface>
<vnic>0</vnic>
<meshGroup>10</meshGroup>
<helloInterval>10000</helloInterval>
<helloMultiplier>3</helloMultiplier>
<lspInterval>33</lspInterval>
<metric>10</metric>
<priority>64</priority>
<circuitType>level-1-2</circuitType>
<password>msr</password>
</isisInterface>
</isisInterfaces>
<redistribution>
<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>false</isis>
<ospf>true</ospf>
<bgp>false</bgp>
<static>true</static>
<connected>false</connected>
</from>
<action>deny</action>
</rule>
<rule>
<id>0</id>
<prefixName>b</prefixName>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>true</bgp>
<static>false</static>
<connected>true</connected>
</from>
<action>permit</action>
</rule>
</rules>
</redistribution>
</isis>

Delete ISIS
DeletesISISrouting.
Example 7-27. Delete ISIS
Request
134

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/isis

Manage BGP Routes for NSX Edge


BorderGatewayProtocol(BGP)makescoreroutingdecisions.ItincludesatableofIPnetworksorprefixes
whichdesignatenetworkreachabilityamongautonomoussystems.Anunderlyingconnectionbetweentwo
BGPspeakersisestablishedbeforeanyroutinginformationisexchanged.Keepalivemessagesaresentoutby
theBGPspeakersinordertokeepthisrelationshipalive.Oncetheconnectionisestablished,theBGPspeakers
exchangeroutesandsynchronizetheirtables.

Configure BGP
Example 7-28. Configure BGP
Request
PUThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/bgp
RequestBody:
<bgp>
<enabled>true</enabled> <!-- Optional. Default is false -->
<localAS>65534</localAS>
<!-- Valid values are : 1-65534 -->
<bgpNeighbours>
<bgpNeighbour>
<ipAddress>192.168.1.10</ipAddress> <!-- IPv4 only. IPv6 support not supported -->
<remoteAS>65500</remoteAS>
<!-- Valid values are 0-65535 -->
<weight>60</weight>
<!-- Optional. Default is 60. Valid values are 0-65535 -->
<holdDownTimer>180</holdDownTimer>
<!-- Optional. Default is 180 seconds. Valid values are : 2-65535. -->
<keepAliveTimer>60</keepAliveTimer> <!-- Optional. Default is 60 seconds. Valid values are : 1-65534. -->
<password>vmware123</password>
<!-- Optional -->
<bgpFilters>
<!-- Optional -->
<bgpFilter>
<direction>in</direction>
<!-- Valid values are in/out -->
<action>permit</action>
<!-- Valid values are permit/deny -->
<network>10.0.0.0/8</network> <!-- Valid values are CIDR networks. IPv4 only. IPv6 support not supported -->
<ipPrefixGe>17</ipPrefixGe> <!-- Optional. "Greater than or equal to" & used for filtering based on prefix length. Valid
IPv4 prefixes -->
<ipPrefixLe>32</ipPrefixLe> <!-- Optional. "Less than or equal to" & used for filtering based on prefix length. Valid IPv4
prefixes -->
</bgpFilter>
</bgpFilters>
</bgpNeighbour>
</bgpNeighbours>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>true</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>true</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->

VMware, Inc.

135

vShield API Programming Guide

<connected>true</connected> <!-- Optional. Defaults to false -->


</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</bgp>

Query BGP
Example 7-29. Query BGP
Request
GEThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/bgp
ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<bgp>
<enabled>true</enabled>
<localAS>65535</localAS>
<bgpNeighbours>
<bgpNeighbour>
<ipAddress>192.168.1.10</ipAddress>
<remoteAS>65500</remoteAS>
<weight>60</weight>
<holdDownTimer>180</holdDownTimer>
<keepAliveTimer>60</keepAliveTimer>
<password>vmware123</password>
<bgpFilters>
<bgpFilter>
<direction>in</direction>
<action>permit</action>
<network>10.0.0.0/8</network>
<ipPrefixGe>17</ipPrefixGe>
<ipPrefixLe>32</ipPrefixLe>
</bgpFilter>
<bgpFilter>
<direction>out</direction>
<action>deny</action>
<network>20.0.0.0/26</network>
</bgpFilter>
</bgpFilters>
</bgpNeighbour>
</bgpNeighbours>
<redistribution>
<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>true</isis>
<ospf>true</ospf>
<bgp>false</bgp>
<static>true</static>
<connected>false</connected>
</from>
<action>deny</action>
</rule>
<rule>
<id>0</id>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>false</bgp>

136

VMware, Inc.

Chapter 7 NSX Edge Logical Router Installation and Management

<static>false</static>
<connected>true</connected>
</from>
<action>permit</action>
</rule>
</rules>
</redistribution>
</bgp>

Delete BGP
DeletesBGProuting.
Example 7-30. Delete BGP
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/bgp

Working with Bridging


YoucancreateanL2bridgebetweenalogicalswitchandaVLAN,whichenablesyoutomigratevirtual
workloadstophysicaldeviceswithnoimpactonIPaddresses.Alogicalnetworkcanleverageaphysical
gatewayandaccessexistingphysicalnetworkandsecurityresourcesbybridgingthelogicalswitchbroadcast
domaintotheVLANbroadcastdomain.
TheL2bridgerunsonthehostthathastheNSXEdgelogicalroutervirtualmachine.AnL2bridgeinstance
mapstoasingleVLAN,buttherecanbemultiplebridgeinstances.Thelogicalroutercannotbeusedasa
gatewayfordevicesconnectedtoabridge.
IfHighAvailabilityisenabledontheLogicalRouterandtheprimaryNSXEdgevirtualmachinegoesdown,
thebridgeisautomaticallymovedovertothehostwiththesecondaryvirtualmachine.Forthisseamless
migrationtohappen,VLANmusthavebeenconfiguredonthehostthathasthesecondaryNSXEdgevirtual
machine.

Configure a Bridge
Configuresabridge.
Example 7-31. Configure bridge
Request
PUThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/bridging/config
RequestBody:
<bridges>
<bridge>
<name>test1</name>
<virtualWire>virtualwire-1</virtualWire>
<dvportGroup>dvportgroup-36</dvportGroup>
</bridge>
<bridge>
<name>test2</name>
<virtualWire>virtualwire-2</virtualWire>
<dvportGroup>dvportgroup-37</dvportGroup>
</bridge>
</bridges>

VMware, Inc.

137

vShield API Programming Guide

Query Bridge Configuration


Retrievesbridgeconfiguration.

Query BGP
Example 7-32. Query bridges
Request
GEThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/bridging/config
ResponseBody:
<bridges>
<version>4</version>
<enabled>true</enabled>
<bridge>
<bridgeId>1</bridgeId>
<name>bridge1</name>
<virtualWire>dvportgroup-23</virtualWire>
<dvportGroup>dvportgroup-25</dvportGroup>
</bridge>
</bridges>

Delete Bridge Configuration


Deletesbridges.
Example 7-33. Delete bridges
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/bridging/config

138

VMware, Inc.

NSX Edge Services Gateway


Installation, Upgrade, and
Management

NSXEdgeServicesGatewaygivesyouaccesstoallNSXEdgeservicessuchasfirewall,NAT,DHCP,VPN,load
balancing,andhighavailability.YoucaninstallmultipleNSXEdgeservicesgatewayvirtualappliancesina
datacenter.EachNSXEdgevirtualappliancecanhaveatotaloftenuplinkandinternalnetworkinterfaces.
Theinternalinterfacesconnecttosecuredportgroupsandactasthegatewayforallprotectedvirtualmachines
intheportgroup.ThesubnetassignedtotheinternalinterfacecanbeapubliclyroutedIPspaceora
NATed/routedRFC1918privatespace.FirewallrulesandotherNSXEdgeservicesareenforcedontraffic
betweennetworkinterfaces.
UplinkinterfacesofNSXEdgeconnecttouplinkportgroupsthathaveaccesstoasharedcorporatenetwork
oraservicethatprovidesaccesslayernetworking.MultipleexternalIPaddressescanbeconfiguredforload
balancer,sitetositeVPN,andNATservices.
Afteryouinstallnetworkvirtualizationcomponentsandoneormorelogicalswitchesinyourenvironment,
youcansecureinternalnetworksbyinstallingaEdgeEdgeServicesgateway.
Thischapterincludesthefollowingtopics:

InstallingNSXEdgeServicesGatewayonpage 140

UpgradingvShieldEdge5.1.xor5.5toNSXEdgeonpage 142

QueryInstalledEdgesonpage 142

ModifyingNSXEdgeConfigurationonpage 146

DeletingNSXEdgeonpage 150

ConfiguringEdgeServicesinAsyncModeonpage 150

ConfiguringCertificatesonpage 151

WorkingwithNSXEdgeFirewallonpage 154

WorkingwithNATonpage 163

WorkingwithRoutingonpage 166

WorkingwithLoadBalanceronpage 180

ManagingSSLVPNonpage 206

WorkingwithL2VPNonpage 235

WorkingwithIPSECVPNonpage 238

ManaginganNSXEdgeonpage 243

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

VMware, Inc.

139

vShield API Programming Guide

Installing NSX Edge Services Gateway


TheNSXEdgeinstallationAPIcopiestheNSXEdgeOVFfromtheEdgeManagertothespecifieddatastore
anddeploysanNSXdEdgeonthegivendatacenter.AftertheNSXEdgeisinstalled,thevirtualmachine
powersonandinitializesaccordingtothegivennetworkconfiguration.Ifanapplianceisadded,itisdeployed
withthespecifiedconfiguration.
InstallinganNSXEdgeinstanceaddsavirtualmachinetothevCenterServerinventory,Youmustspecifyan
IPaddressforthemanagementinterface,andyoumaynametheNSXEdgeinstance.
TheconfigurationyouspecifywhenyouinstallanNSXEdgeisstoredinthedatabase.Ifanapplianceisadded,
theconfigurationisappliedtoitanditisdeployed.
NOTEDonotusehidden/systemresourcepoolIDsastheyarenotsupportedontheUI.
Example 8-1. Install Services Gateway
Request
POST https://<nsxmgr-ip>/api/4.0/edges/

RequestBody
<edge>
<datacenterMoid>datacenter-2</datacenterMoid>
<name>org1-edge</name> <!-- optional. Default is vShield-<edgeId>. Used as a vm name on VC appended by "-<haIndex>" -->
<description>Description for the edge gateway</description> <!-- optional -->
<tenant>org1</tenant> <!-- optional. Will be used in syslog messages -->
<fqdn>org1edge1</fqdn> <!-- optional. Default is vShield-<edgeId>. Used to set hostanme on the vm. Appended by "-<haIndex>" -->
<vseLogLevel>info</vseLogLevel> <!-- optional. Default is info. Other possible values are EMERGENCY, ALERT, CRITICAL,
ERROR, WARNING, NOTICE, DEBUG -->
<enableAesni>false</enableAesni> <!-- optional. Default is true -->
<enableFips>true</enableFips> <!-- optional. Default is false -->
<appliances> <!-- maximum 2 appliances can be configured. Until one appliance is configured, none of the configured features
configured will serve the network -->
<applianceSize>compact</applianceSize> <!-- optional. Default is compact. Other possible values are large|xlarge|quadlarge -->
<enableCoreDump>true</enableCoreDump> <!-- optional. default is false. Enabling core-dump will deploy an extra disk for
core-dump files, which will consume 1GB for COMPACT, LARGE, and QUADLARGE, and 8G for XLARGE
Edge.-->
<appliance>
<resourcePoolId>resgroup-53</resourcePoolId>
<datastoreId>datastore-29</datastoreId>
<hostId>host-28</hostId> <!-- optional -->
<vmFolderId>group-v38</vmFolderId> <!-- optional -->
<customField> <!-- optional -->
<key>system.service.vmware.vsla.main01</key>
<value>string</value>
</customField>
<cpuReservation> <!-- optional -->
<limit>2399</limit>
<reservation>500</reservation>
<shares>500</shares>
</cpuReservation>
<memoryReservation> <!-- optional -->
<limit>5000</limit>
<reservation>500</reservation>
<shares>20480</shares>
</memoryReservation>
</appliance>
</appliances>
<vnics> <!-- mamimum 10 interfaces index:0-9 can be configured. Until one connected vnic is configured, none of the configured
features will serve the network -->
<vnic>
<index>0</index>
<name>internal0</name> <!-- optional. System has default Names. format vNic0 ... vNic7 -->
<type>internal</type> <!-- optional. Default is internal. Other possible value is "uplink" -->
<portgroupId>dvportgroup-114</portgroupId> <!-- Possible values here are portgroupIds or virtualWire-id. portgroupId needs to be
defined if isConnected=true -->

140

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<addressGroups>
<addressGroup> <!-- Vnic can be configured to have more than one addressGroup/subnets -->
<primaryAddress>192.168.3.1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>192.168.3.2</ipAddress>
<ipAddress>192.168.3.3</ipAddress> <!-- Optional. This way multiple IP Addresses can be assigned to a vnic/interface -->
</secondaryAddresses>
<subnetMask>255.255.255.0</subnetMask> <!-- either subnetMask or subnetPrefixLength should be provided. If both then
subnetprefixLength is ignored -->
</addressGroup>
<addressGroup> <!-- Vnic can be configured to have more than one addressGroup/subnets -->
<primaryAddress>192.168.4.1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>192.168.4.2</ipAddress>
<ipAddress>192.168.4.3</ipAddress> <!-- Optional. This way multiple IP Addresses can be assigned to a vnic/interface -->
</secondaryAddresses>
<subnetPrefixLength>24</subnetPrefixLength>
</addressGroup>
<addressGroup> <!-- ipv6 addressGroup -->
<primaryAddress>ffff::1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>ffff::2</ipAddress>
</secondaryAddresses>
<subnetPrefixLength>64</subnetPrefixLength> <!-- prefixLength valid values 1-128 -->
</addressGroup>
</addressGroups>
<macAddress> <!-- optional. When not specified, macAddresses will be managed by VC -->
<edgeVmHaIndex>0</edgeVmHaIndex>
<value>00:50:56:01:03:23</value> <!-- optional. User must ensure that macAddresses provided are unique withing the given layer 2
domain. -->
</macAddress>
<fenceParameter> <!-- optional -->
<key>ethernet0.filter1.param1</key>
<value>1</value>
</fenceParameter>
<mtu>1500</mtu> <!-- optional. Default is 1500 -->
<enableProxyArp>false</enableProxyArp> <!-- optional. Default is false -->
<enableSendRedirects>true</enableSendRedirects> <!-- optional. Default is true -->
<isConnected>true</isConnected> <!-- optional. Default is false -->
<inShapingPolicy> <!-- optional -->
<averageBandwidth>200000000</averageBandwidth>
<peakBandwidth>200000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</inShapingPolicy>
<outShapingPolicy> <!-- optional -->
<averageBandwidth>400000000</averageBandwidth>
<peakBandwidth>400000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</outShapingPolicy>
</vnic>
</vnics>
<cliSettings> <!-- optional. Default user/pass is admin/default, and remoteAccess is false (i.e. disabled) -->
<userName>test</userName> <!-- When you change the userName, you are overwriting the current userName. -->
<password>test123!</password> <!-- The password should be atleast 12 characters long, must be a mix of alphabets, digits and
special characters. Must contain at-least 1 uppercase, 1 lowercase, 1 special character and 1 digit. In addition, a
character cannot be repeated 3 or more times consectively.-->
<remoteAccess>false</remoteAccess> <!-- remote Access specifies whether cli console access over ssh must be enabled. Relevant
firewall rules to allow traffic on port 22 must be opened by user/client. Please note: it is advisable to restrict ssh
access to Edge cli to only a limited ip addresses - so firewall rules must be opened cautiously. -->
</cliSettings>
<autoConfiguration> <!-- optional -->
<enabled>true</enabled> <!-- Optional. Default:true. If set to false, user should add the nat,firewall,routing config to control plane
work for LB, VPN, etc -->
<rulePriority>high</rulePriority> <!-- Optional. Default is high. Other possible value is low -->

VMware, Inc.

141

vShield API Programming Guide

</autoConfiguration>
<dnsClient> <!-- optional. if the primary/secondary are specified and the DNS service not, the primary/secondary will to used as
the default of the DNS service. -->
<primaryDns>10.117.0.1</primaryDns>
<secondaryDns>10.117.0.2</secondaryDns>
<domainName>vmware.com</domainName>
<domainName>foo.com</domainName>
</dnsClient>
<queryDaemon> <!-- optional. defined for the sake of communication between SLB VM and edge vm for GSLB feature. -->
<enabled>true</enabled> <!-- default to false-->
<port>5666</port> <!-- default to 5666 -->
</queryDaemon>
</edge>

Upgrading vShield Edge 5.1.x or 5.5 to NSX Edge


UpgradesvShieldEdge5.1.xor5.5toNSXEdge.Theappliancesareupgradedandfeatureconfigurationsare
retainedandupgraded
Example 8-2. Upgrade vShield Edge
Request:
POST https://<nsxmgr-ip>/api//4.0/edges/{edgeId}?action=upgrade

IMPORTANTThelocationheaderreturnstheedgeIdoftheupgradedNSXEdge.YoumustusethisIDto
configureandmanagethisEdgeinstance.
IfvShieldEdgeinthepreviousreleasewasinstalledusinghidden/systemresourcepoolIDs,theUImayshow
unusualbehavior.

Query Installed Edges


YoucanretrievealistofNSXEdgesinyourinventoryorfiltertheresultsbydatacenterorportgroup.
Example 8-3. Retrieve Edges
RetrieveallEdgesRequest:
GET https://<nsxmgr-ip>/api/4.0/edges/

RetrieveEdgesbydatacenter:
GET /api/4.0/edges/?datacenter=<datacenterMoid>

RetrieveEdgesonspecifiedtenant:
GET /api/4.0/edges/?tenant=<tenantId>

RetrieveEdgeswithoneinterfaceonspecifiedportgroup:
GET /api/4.0/edges/?pg=<pgMoId>

RetrieveEdgeswithspecifiedtenantandportgroup:
GET /api/4.0/edges/?tenant=<tenant>&pg=<pgMoId>

Example 8-4. Retrieve Edge details


Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>

ResponseBody

142

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<edge>
<id>edge-79</id>
<version>5</version>
<description>testEdge</description>
<status>deployed</status>
<datacenterMoid>datacenter-2</datacenterMoid>
<datacenterName>datacenterForEdge</datacenterName>
<name>testEdge</name>
<fqdn>testEdge</fqdn>
<enableAesni>true</enableAesni>
<enableFips>false</enableFips>
<vseLogLevel>info</vseLogLevel>
<edgeAssistId>1460487509</edgeAssistId>
<vnics>
<vnic>
<index>0</index>
<name>uplink-vnic-network-2581</name>
<type>uplink</type>
<portgroupId>network-2581</portgroupId>
<portgroupName>Mgmt</portgroupName>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.3.1</primaryAddress>
<secondaryAddresses>
<ipAddress>192.168.3.2</ipAddress>
<ipAddress>192.168.3.3</ipAddress>
</secondaryAddresses>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
<addressGroup>
<primaryAddress>192.168.4.1</primaryAddress>
<secondaryAddresses>
<ipAddress>192.168.4.2</ipAddress>
<ipAddress>192.168.4.3</ipAddress>
</secondaryAddresses>
<subnetMask>255.255.255.0</subnetMask> <!-- GET will always have subnetMask field for ipv4 and subnetPrefixLength for ipv6
-->
</addressGroup>
<addressGroup>
<primaryAddress>ffff::1</primaryAddress>
<secondaryAddresses>
<ipAddress>ffff::2</ipAddress>
</secondaryAddresses>
<subnetPrefixLength>64</subnetPrefixLength>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<enableProxyArp>false</enableProxyArp>
<enableSendRedirects>true</enableSendRedirects>
<isConnected>true</isConnected>
</vnic>
.....
</vnics>
<appliances>
<applianceSize>compact</applianceSize>
<appliance>
<highAvailabilityIndex>0</highAvailabilityIndex>
<vcUuid>4208f392-1693-11db-6355-4affd859ef33</vcUuid>
<vmId>vm-4021</vmId>
<resourcePoolId>resgroup-2454</resourcePoolId>
<resourcePoolName>Resources</resourcePoolName>
<datastoreId>datastore-2457</datastoreId>
<datastoreName>shahm-esx-storage</datastoreName>
<hostId>host-2455</hostId>
<hostName>10.112.196.160</hostName>
<vmFolderId>group-v3</vmFolderId>
<vmFolderName>vm</vmFolderName>
<vmHostname>vShieldEdge-network-2264-0</vmHostname>

VMware, Inc.

143

vShield API Programming Guide

<vmName>vShield-edge-79-0</vmName>
<deployed>true</deployed>
<edgeId>edge-79</edgeId>
</appliance>
</appliances>
<cliSettings>
<remoteAccess>false</remoteAccess>
<userName>admin</userName>
</cliSettings>
<features>
<featureConfig/>
<firewall>
<version>1</version>
<enabled>true</enabled>
<defaultPolicy>
<action>deny</action>
<loggingEnabled>false</loggingEnabled>
</defaultPolicy>
<rules>
<rule>
<id>131078</id>
<ruleTag>131078</ruleTag>
<name>rule1</name>
<ruleType>user</ruleType>
<source>
<groupingObjectId>ipset-938</groupingObjectId>
</source>
<destination/>
<application>
<applicationId>application-666</applicationId>
</application>
<action>accept</action>
<enabled>true</enabled>
<loggingEnabled>false</loggingEnabled>
<matchTranslated>false</matchTranslated>
</rule>
....
</rules>
</firewall>
<routing>
<version>1</version>
<enabled>true</enabled>
<staticRouting>
<defaultRoute>
<vnic>0</vnic>
<gatewayAddress>10.112.3.253</gatewayAddress>
<description>defaultGw on the external interface</description>
</defaultRoute>
<staticRoutes>
<route>
<vnic>0</vnic>
<network>192.168.30.0/24</network>
<nextHop>10.112.2.41</nextHop>
<type>user</type>
</route>
...
</staticRoutes>
</staticRouting>
<ospf>
<enabled>false</enabled>
</ospf>
</routing>
<highAvailability>
<version>1</version>
<enabled>false</enabled>
<declareDeadTime>6</declareDeadTime>
<logging>
<enable>false</enable>

144

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<logLevel>info</logLevel>
</logging>
</highAvailability>
<syslog>
<version>1</version>
<enabled>true</enabled>
<protocol>udp</protocol>
<serverAddresses>
<ipAddress>1.1.1.1</ipAddress>
<ipAddress>1.1.1.2</ipAddress>
</serverAddresses>
</syslog>
<ipsec>
<version>1</version>
<enabled>true</enabled>
<logging>
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
<sites>
<site>
<enabled>true</enabled>
<name>site1</name>
<localId>10.112.2.40</localId>
<localIp>10.112.2.40</localIp>
<peerId>10.112.2.41</peerId>
<peerIp>10.112.2.41</peerIp>
<encryptionAlgorithm>aes256</encryptionAlgorithm>
<mtu>1500</mtu>
<enablePfs>true</enablePfs>
<dhGroup>dh2</dhGroup>
<localSubnets>
<subnet>192.168.10.0/24</subnet>
</localSubnets>
<peerSubnets>
<subnet>192.168.40.0/24</subnet>
</peerSubnets>
<psk>1234</psk>
<authenticationMode>psk</authenticationMode>
</site>
....
</sites>
<global>
<caCertificates/>
<crlCertificates/>
</global>
</ipsec>
<dhcp>
<version>1</version>
<enabled>false</enabled>
<staticBindings>
<staticBinding>
<autoConfigureDNS>true</autoConfigureDNS>
<bindingId>binding-1</bindingId>
<vmId>vm-2460</vmId>
<vnicId>1</vnicId>
<hostname>test</hostname>
<ipAddress>192.168.10.6</ipAddress>
<defaultGateway>192.168.10.1</defaultGateway>
<leaseTime>86400</leaseTime>
</staticBinding>
....
</staticBindings>
<ipPools>
<ipPool>
<autoConfigureDNS>true</autoConfigureDNS>
<poolId>pool-1</poolId>
<ipRange>192.168.10.2-192.168.10.5</ipRange>

VMware, Inc.

145

vShield API Programming Guide

<defaultGateway>192.168.10.1</defaultGateway>
<leaseTime>86400</leaseTime>
</ipPool>
....
</ipPools>
<logging>
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
</dhcp>
<nat>
<version>1</version>
<enabled>true</enabled>
<natRules>
<natRule>
<ruleId>196610</ruleId>
<ruleTag>196610</ruleTag>
<ruleType>user</ruleType>
<action>dnat</action>
<vnic>1</vnic>
<originalAddress>10.112.196.162</originalAddress>
<translatedAddress>192.168.10.3</translatedAddress>
<loggingEnabled>false</loggingEnabled>
<enabled>true</enabled>
<protocol>tcp</protocol>
<originalPort>80</originalPort>
<translatedPort>80</translatedPort>
</natRule>
....
</natRules>
</nat>
<featureConfig/>
</features>
<autoConfiguration>
<enabled>true</enabled>
<rulePriority>high</rulePriority>
</autoConfiguration>
<dnsClient>
<primaryDns>10.117.0.1</primaryDns>
<secondaryDns>10.117.0.2</secondaryDns>
<domainName>vmware.com</domainName>
<domainName>foo.com</domainName>
</dnsClient>
<queryDaemon>
<enabled>true</enabled>
<port>5666</port>
</queryDaemon>
</edge>

Modifying NSX Edge Configuration


ReplacescurrentNSXEdgeconfiguration.
Example 8-5. Modify Edge configuration
Request:
PUT https://<nsxmgr-ip>/api//4.0/edges/{edgeId}

RequestBody:
<edge>
<id>edge-79</id>
<description>testEdge</description>
<datacenterMoid>datacenter-2</datacenterMoid>
<name>testEdge</name>

146

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<fqdn>testEdge</fqdn>
<enableAesni>true</enableAesni>
<enableFips>false</enableFips>
<vseLogLevel>info</vseLogLevel>
<vnics>
<vnic>
<index>0</index>
<name>uplink-vnic-network-2581</name>
<type>uplink</type>
<portgroupId>network-2581</portgroupId>
<addressGroups>
<addressGroup> <!-- Vnic can be configured to have more than one addressGroup/subnets -->
<primaryAddress>192.168.3.1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>192.168.3.2</ipAddress>
<ipAddress>192.168.3.3</ipAddress> <!-- Optional. This way multiple IP Addresses can be assigned to a vnic/interface -->
</secondaryAddresses>
<subnetMask>255.255.255.0</subnetMask> <!-- either subnetMask or subnetPrefixLength should be provided. If both then
subnetprefixLength is ignored -->
</addressGroup>
<addressGroup> <!-- Vnic can be configured to have more than one addressGroup/subnets -->
<primaryAddress>192.168.4.1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>192.168.4.2</ipAddress>
<ipAddress>192.168.4.3</ipAddress> <!-- Optional. This way multiple IP Addresses can be assigned to a vnic/interface -->
</secondaryAddresses>
<subnetPrefixLength>24</subnetPrefixLength> <!-- subnetPrefixLength valid values for ipv4 1-32 -->
</addressGroup>
<addressGroup> <!-- ipv6 addressGroup -->
<primaryAddress>ffff::1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>ffff::2</ipAddress>
</secondaryAddresses>
<subnetPrefixLength>64</subnetPrefixLength> <!-- subnetPrefixLength valid values 1-128 -->
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<enableProxyArp>false</enableProxyArp>
<enableSendRedirects>true</enableSendRedirects>
<isConnected>true</isConnected>
<inShapingPolicy> <!-- optional -->
<averageBandwidth>200000000</averageBandwidth>
<peakBandwidth>200000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</inShapingPolicy>
<outShapingPolicy> <!-- optional -->
<averageBandwidth>400000000</averageBandwidth>
<peakBandwidth>400000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</outShapingPolicy>
</vnic>
</vnic>
.....
</vnics>
<appliances>
<applianceSize>compact</applianceSize>
<appliance>
<resourcePoolId>resgroup-2454</resourcePoolId>
<datastoreId>datastore-2457</datastoreId>
<vmFolderId>group-v3</vmFolderId>
</appliance>
</appliances>
<cliSettings>
<remoteAccess>false</remoteAccess>

VMware, Inc.

147

vShield API Programming Guide

<userName>admin</userName>
</cliSettings>
<features>
<firewall>
<defaultPolicy>
<action>deny</action>
<loggingEnabled>false</loggingEnabled>
</defaultPolicy>
<rules>
<rule>
<id>131078</id>
<ruleTag>131078</ruleTag>
<name>rule1</name>
<ruleType>user</ruleType>
<source>
<groupingObjectId>ipset-938</groupingObjectId>
</source>
<destination/>
<application>
<applicationId>application-666</applicationId>
</application>
<action>accept</action>
<enabled>true</enabled>
<loggingEnabled>false</loggingEnabled>
<matchTranslated>false</matchTranslated>
</rule>
....
</rules>
</firewall>
<routing>
<staticRouting>
<defaultRoute>
<vnic>0</vnic>
<gatewayAddress>10.112.3.253</gatewayAddress>
<description>defaultGw on the external interface</description>
</defaultRoute>
<staticRoutes>
<route>
<vnic>0</vnic>
<network>192.168.30.0/24</network>
<nextHop>10.112.2.41</nextHop>
<type>user</type>
</route>
...
</staticRoutes>
</staticRouting>
<ospf>
<enabled>false</enabled>
</ospf>
</routing>
<highAvailability>
<enabled>false</enabled>
<declareDeadTime>6</declareDeadTime>
<logging>
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
</highAvailability>
<syslog>
<protocol>udp</protocol>
<serverAddresses>
<ipAddress>1.1.1.1</ipAddress>
<ipAddress>1.1.1.2</ipAddress>
</serverAddresses>
</syslog>
<ipsec>
<enabled>true</enabled>
<logging>

148

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<enable>false</enable>
<logLevel>info</logLevel>
</logging>
<sites>
<site>
<enabled>true</enabled>
<name>site1</name>
<localId>10.112.2.40</localId>
<localIp>10.112.2.40</localIp>
<peerId>10.112.2.41</peerId>
<peerIp>10.112.2.41</peerIp>
<encryptionAlgorithm>aes256</encryptionAlgorithm>
<mtu>1500</mtu>
<enablePfs>true</enablePfs>
<dhGroup>dh2</dhGroup>
<localSubnets>
<subnet>192.168.10.0/24</subnet>
</localSubnets>
<peerSubnets>
<subnet>192.168.40.0/24</subnet>
</peerSubnets>
<psk>1234</psk>
<authenticationMode>psk</authenticationMode>
</site>
....
</sites>
<global>
<caCertificates/>
<crlCertificates/>
</global>
</ipsec>
<dhcp>
<enabled>true</enabled>
<staticBindings>
<staticBinding>
<autoConfigureDNS>true</autoConfigureDNS>
<bindingId>binding-1</bindingId>
<vmId>vm-2460</vmId>
<vnicId>1</vnicId>
<hostname>test</hostname>
<ipAddress>192.168.10.6</ipAddress>
<defaultGateway>192.168.10.1</defaultGateway>
<leaseTime>86400</leaseTime>
</staticBinding>
....
</staticBindings>
<ipPools>
<ipPool>
<autoConfigureDNS>true</autoConfigureDNS>
<poolId>pool-1</poolId>
<ipRange>192.168.10.2-192.168.10.5</ipRange>
<defaultGateway>192.168.10.1</defaultGateway>
<leaseTime>86400</leaseTime>
</ipPool>
....
</ipPools>
<logging>
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
</dhcp>
<nat>
<natRules>
<natRule>
<ruleId>196610</ruleId>
<ruleTag>196610</ruleTag>
<ruleType>user</ruleType>
<action>dnat</action>

VMware, Inc.

149

vShield API Programming Guide

<vnic>1</vnic>
<originalAddress>10.112.196.162</originalAddress>
<translatedAddress>192.168.10.3</translatedAddress>
<loggingEnabled>false</loggingEnabled>
<enabled>true</enabled>
<protocol>tcp</protocol>
<originalPort>80</originalPort>
<translatedPort>80</translatedPort>
</natRule>
....
</natRules>
</nat>
</features>
<autoConfiguration>
<enabled>true</enabled>
<rulePriority>high</rulePriority>
</autoConfiguration>
</edge>

wheregroupingObjectIdcanbecluster,network,etc.

Deleting NSX Edge


DeletesspecifiedEdgefromdatabase.Associatedappliancesarealsodeleted.
Example 8-6. Delete Edge
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/{edgeId}

Configuring Edge Services in Async Mode


YoucanconfigureEdgetoworkinasyncmode.Intheasyncmode,accepted commands return an Accepted status
and a taskId. To know the status of the task, you can check the status of that taskId.
TheadvantageoftheasyncmodeisthatAPIsarereturnedveryfastandactionslikevmdeployment,reboots,
publishtoEdgeappliance,etcaredonebehindthesceneunderthetaskId.
Toconfigureasyncmode,?async=trueattheendofany4.0serviceconfigurationURLforPOST,PUT,and
DELETEcalls.Withoutasyncmode,thelocationheaderinHTTPresponsehastheresourceIDwhereasin
asyncmode,locationheaderhasthejobID.

Query Async Job Status


Retrievesjobstatus(SUCCESS/FAILED/QUEUED/RUNNING/ROLLBACK),URIoftheresource,andIDof
theresourceasshowninoutputrepresentation.
Example 8-7. Query job status
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/jobs/<jobId>

ResponseBody:
<edgeJob>
<jobId>jobdata-2128</jobId>
<message>Deploying vShield Edge Virtual Machine TestEdge11-0</message>
<status>RUNNING</status>
<result>
<key>ResultURI</key>
<value>/api/4.0/edges/edge-4</value>

150

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

</result>
<result>
<key>edgeId</key>
<value>edge-4</value>
</result>
</edgeJob>

Query all Jobs


Example 8-8. Query all jobs
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeid}/jobs?status=all

RequestBody:
<edgeJobs>
<edgeJob>
<jobId>jobdata-917</jobId>
<status>COMPLETED</status>
<result>
<key>edgeId</key>
<value>edge-4</value>
</result>
</edgeJob>
<edgeJob>
<jobId>jobdata-915</jobId>
<status>COMPLETED</status>
<result>
<key>edgeId</key>
<value>edge-4</value>
</result>
</edgeJob>
<edgeJob>

Query active Jobs


Example 8-9. Query active jobs
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeid}/jobs?status=active

RequestBody:
<edgeJobs>
<edgeJob>
<jobId>jobdata-917</jobId>
<message>Publishing configurations on vShield Edge Virtual Machine vm-65</message>
<status>RUNNING</status>
<result>
<key>edgeId</key>
<value>edge-4</value>
</result>
</edgeJob>
</edgeJobs>

Configuring Certificates
vShieldEdgesupportsselfsignedcertificates,certificatessignedbyaCertificationAuthority(CA),and
certificatesgeneratedandsignedbyaCA.

VMware, Inc.

151

vShield API Programming Guide

Working with Certificates


Allowsyoutomanageselfsignedcertificates.

Create Certificate
Createsasingleormultiplecertificates.
Example 8-10. Create self signed certificate
Request:
POST https://<vsm-ip>/api/2.0/services/truststore/certificate/<scopeId>
<trustObject>
<pemEncoding></pemEncoding>
<privateKey></privateKey>
<passphrase></passphrase>
</trustObject>

Create Certificate or Certificate Chain for CSR


Importsacertificateoracertificatechainagainstacertificatesigningrequest.
Example 8-11. Create certificate for CSR
Request:
POST https://<vsm-ip>/api/2.0/services/truststore/certificate?csrId=<csrId>

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<trustObject>
<pemEncoding></pemEncoding>
</trustObject>

Query Certificates
RetrievesthecertificateobjectforthespecifiedcertificateID.IfthecertificateIDisachain,multiplecertificate
objectsareretrieved.
Example 8-12. Query specific certificate
Request:
GET https://<vsm-ip>/api/2.0/services/truststore/certificate/<certificateId>

Example 8-13. Query all certificates for a scope


Request:
GET https://<vsm-ip>/api/2.0/services/truststore/certificate/scope/<scopeId>

Delete Certificate
Deletesthespecifiedcertificate.
Example 8-14. Delete certificate
Request:

152

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

DELETE https://<vsm-ip>/api/2.0/services/truststore/certificate/<certificateId>

Working with Certificate Signing Requests (CSRs)


AllowsyoutomanageCSRs.

Create CSR
Example 8-15. Create CSR
Request:
POST https://<vsm-ip>/api/2.0/services/truststore/csr/<scopeId>

RequestBody:
<csr>
<subject>
<attribute>
<key>CN</key>
<value>VSM</value>
</attribute>
<attribute>
<key>O</key>
<value>VMware</value>
</attribute>
<attribute>
<key>OU</key>
<value>IN</value>
</attribute>
<attribute>
<key>C</key>
<value>IN</value>
</attribute>
</subject>
<algorithm>RSA</algorithm>
<keySize>1024</keySize>
</csr>

Create Self Signed Certificate for CSR


Example 8-16. Create self signed certificate for CSR
Request:
PUT https://<vsm-ip>/api/2.0/services/truststore/csr/<csrId>?noOfDays=<value>

Query CSRs
RetrievesspecifiedCSRorallCSRsforspecifiedscope.
Example 8-17. Query specific CSR
GET https://<vsm-ip>/api/2.0/services/truststore/csr/<csrId>

Example 8-18. Query CSRs for specific scope


GET https://<vsm-ip>/api/2.0/services/truststore/csr/scope/<scopeId>

RequestBody:
<csrs>
<csr>

VMware, Inc.

153

vShield API Programming Guide

...
</csr>
<csr>
...
</csr>
...
</csrs>

Working with Certificate Revocation List (CRL)


AllowsyoutomanageCRLs.

Create a CRL
CreatesaCRLonthespecifiedscope.
Example 8-19. Create CRL
Request:
POST https://<vsm-ip>/api/2.0/services/truststore/crl/<scopId>
Request Body:
<trustObject>
<pemEncoding></pemEncoding>
</trustObject>

Query CRL
RetrievesallCRLscertificatesforthespecifiedcertificateorscope.
Example 8-20. Query CRL
RetrievecertificateobjectforthespecifiedcertificateID:
GET https://<vsm-ip>/api/2.0/services/truststore/crl/<crlId>

Retrieveallcertificatesforthespecifiedscope:
GET https://<vsm-ip>/api/2.0/services/truststore/crl/scope/<scopeId>

Delete CRL
DeletesthespecifiedCRL.
Example 8-21. Delete CRL
Request:
DELETE https://<vsm-ip>/api/2.0/services/truststore/crl/<crlId>

Working with NSX Edge Firewall


EdgeFirewallprovidesperimetersecurityfunctionalityincludingfirewall,NetworkAddressTranslation
(NAT)aswellasSitetositeIPSecandSSLVPNfunctionality.Thissolutionisavailableinthevirtualmachine
formfactorandcanbedeployedinaHighAvailabilitymode.

154

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Configure Firewall
ConfiguresfirewallforanEdgeandstoresthespecifiedconfigurationindatabase.Ifanyappliance(s)are
associatedwiththisedge,appliestheconfigurationtothese.WhileusingthisAPI,theusershouldsendthe
globalConfig,defaultPolicyandtherules.Ifeitherofthemarenotsent,thepreviousconfigifanyonthose
fieldswillberemovedandwillbechangedtothesystemdefaults.
Example 8-22. Configure firewall
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config

RequestBody:
<?xml version="1.0"?>
<firewall>
<defaultPolicy> <-- Optional. default is deny -->
<action>deny</action>
<loggingEnabled>false</loggingEnabled> <!-- Optional. Defaults to false -->
</defaultPolicy>
<globalConfig> <!-- Optional -->
<tcpPickOngoingConnections>false</tcpPickOngoingConnections> <!-- Optional. Defaults to false -->
<tcpAllowOutOfWindowPackets>false</tcpAllowOutOfWindowPackets> <!-- Optional. Defaults to false -->
<tcpSendResetForClosedVsePorts>true</tcpSendResetForClosedVsePorts> <!-- Optional. Defaults to true -->
<dropInvalidTraffic>true</dropInvalidTraffic> <!-- Optional. Defaults to true -->
<logInvalidTraffic>false</logInvalidTraffic> <!-- Optional. Defaults to false -->
<tcpTimeoutOpen>30</tcpTimeoutOpen>
<!-- Optional. Defaults to 30 -->
<tcpTimeoutEstablished>3600</tcpTimeoutEstablished> <!-- Optional. Defaults to 3600 -->
<tcpTimeoutClose>30</tcpTimeoutClose> <!-- Optional. Defaults to 30 -->
<udpTimeout>60</udpTimeout>
<!-- Optional. Defaults to 60 -->
<icmpTimeout>10</icmpTimeout>
<!-- Optional. Defaults to 10 -->
<icmp6Timeout>10</icmp6Timeout>
<!-- Optional. Defaults to 10 -->
<ipGenericTimeout>120</ipGenericTimeout> <!-- Optional. Defaults to 120 -->
</globalConfig>
<rules>
<rule>
<ruleTag>1</ruleTag>
<!-- Optional. This can be used to specify user controlled ids on VSE. The inputs here should be
1-65536. If not specified, VSM will generate ruleId -->
<name>rule1</name>
<!-- Optional -->
<source>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
<ipAddress>1.1.1.1</ipAddress> <!-- Possible formats are IP, IP1-IPn, CIDR. Can define multiple of these -->
</source>
<destination>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<groupingObjectId>ipset-126</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define
multiple of these -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
<ipAddress>192.168.10.0/24</ipAddress> <!-- Possible formats are IP, IP1-IPn, CIDR. Can define multiple of these -->
</destination>
<application>
<!-- Optional. Default behaviour is like "any". applicationsetId or applicationgroupId can be used -->
<applicationId>application-155</applicationId> <!-- Id of Service available to the edge. Can define multiple of these -->
<service> <!-- Can define multiple of these -->
<protocol>tcp</protocol>
<port>80</port> <!-- Default is "any". Can define multiple of these -->
<sourcePort>1500</sourcePort> <!-- Default is "any". Can define multiple of these -->
</service>
</application>
<matchTranslated>true</matchTranslated>
<!-- Optional. Default behaviour is like "false" -->
<direction>in</direction>
<!-- Optional. Default behaviour is like "any". Possible values are in|out -->
<action>accept</action>
<!-- Mandatory. Possible values are accept|deny -->
<enabled>true</enabled>
<!-- Optional. Defaults to true -->

VMware, Inc.

155

vShield API Programming Guide

<loggingEnabled>true</loggingEnabled> <!-- Optional. Defaults to false -->


<description>comments</description>
<!-- Optional -->
</rule>
<rule>
...
</rule>
.....
</rules>
</firewall>

whereruleIduniquelyidentifiesaruleandshouldbespecifiedonlyforrulesthatarebeingupdated.
IfruleTagisspecified,therulesonEdgeareconfiguredusingthisuserinput.Otherwise,Edgeisconfigured
usingruleIdsgeneratedbyNSXManager.

Query Firewall Configuration


RetrievesfirewallconfigurationonspecifiedEdge.
Example 8-23. Query firewall
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config

ResponseBody:
<firewall>
<version>1</version>
<enabled>true</enabled>
<defaultPolicy>
<action>deny</action>
<loggingEnabled>false</loggingEnabled>
</defaultPolicy>
<globalConfig>
<tcpPickOngoingConnections>false</tcpPickOngoingConnections>
<tcpAllowOutOfWindowPackets>false</tcpAllowOutOfWindowPackets>
<tcpSendResetForClosedVsePorts>true</tcpSendResetForClosedVsePorts>
<dropInvalidTraffic>true</dropInvalidTraffic>
<logInvalidTraffic>false</logInvalidTraffic>
<tcpTimeoutOpen>30</tcpTimeoutOpen>
<tcpTimeoutEstablished>3600</tcpTimeoutEstablished>
<tcpTimeoutClose>30</tcpTimeoutClose>
<udpTimeout>60</udpTimeout>
<icmpTimeout>10</icmpTimeout>
<icmp6Timeout>10</icmp6Timeout>
<ipGenericTimeout>120</ipGenericTimeout>
</globalConfig>
<rules>
<rule>
<id>131079</id>
<ruleTag>131079</ruleTag>
<name>firewall</name>
<ruleType>internal_high</ruleType>
<source>
<vnicGroupId>vse</vnicGroupId>
</source>
<action>accept</action>
<enabled>true</enabled>
<loggingEnabled>false</loggingEnabled>
<description>firewall</description>
</rule>
<rule>
<id>131080</id>
<ruleTag>131080</ruleTag>

156

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<name>ipsec</name>
<ruleType>internal_high</ruleType>
<source>
<groupingObjectId>ipset-934</groupingObjectId>
<groupingObjectId>ipset-933</groupingObjectId>
</source>
<destination>
<groupingObjectId>ipset-934</groupingObjectId>
<groupingObjectId>ipset-933</groupingObjectId>
</destination>
<application>
<applicationId>application-661</applicationId>
<applicationId>application-662</applicationId>
</application>
<action>accept</action>
<enabled>true</enabled>
<loggingEnabled>false</loggingEnabled>
<description>ipsec</description>
</rule>
<rule>
<id>131077</id>
<ruleTag>131077</ruleTag>
<name>name1</name>
<ruleType>user</ruleType>
<source>
<groupingObjectId>ipset-940</groupingObjectId>
<ipAddress>1.1.1.1</ipAddress> <!-- IP -->
<ipAddress>2.2.2.2/24</ipAddress> <!-- CIDR -->
<ipAddress>1.1.1.1-1.1.1.10</ipAddress> <!-- IP Range -->
</source>
<destination>
<groupingObjectId>ipset-941</groupingObjectId>
<vnicGroupId>vse</vnicGroupId>
<vnicGroupId>external</vnicGroupId>
</destination>
<application> <!-- Optional. Default behaviour is "any:any". Can define multiple of these -->
<applicationId>application-667</applicationId>
<service> <!-- Optional. Can define multiple of these -->
<protocol>tcp</protocol>
<port>80</port>
</service>
</application>
<action>deny</action>
<direction>in</direction>
<enabled>true</enabled>
<loggingEnabled>false</loggingEnabled>
<matchTranslated>true</matchTranslated>
</rule>
<rule>
<id>131078</id>
<ruleTag>131078</ruleTag>
<name>name2</name>
<ruleType>user</ruleType>
<source>
<groupingObjectId>ipset-938</groupingObjectId>
</source>
<destination/>
<application>
<applicationId>application-666</applicationId>
</application>
<action>accept</action>
<enabled>true</enabled>
<loggingEnabled>false</loggingEnabled>
<matchTranslated>false</matchTranslated>
</rule>

VMware, Inc.

157

vShield API Programming Guide

<rule>
<id>131075</id>
<ruleTag>131075</ruleTag>
<name>default rule for ingress traffic</name>
<ruleType>default_policy</ruleType>
<action>deny</action>
<enabled>true</enabled>
<loggingEnabled>false</loggingEnabled>
<description>default rule for ingress traffic</description>
</rule>
</rules>
</firewall>

Append Firewall Rules


Addsoneormorerulesbelowtheexistingrulesintherulestable.
Example 8-24. Add firewall rule
POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/firewall/config/rules

RequestBody:
<rules>
<rule>
<ruleTag>1</ruleTag>
<!-- Optional. This can be used to specify user controlled ids on VSE. The inputs here should be
1-65536. If not specified, VSM will generate ruleId -->
<name>rule1</name>
<!-- Optional -->
<source>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
</source>
<destination>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<groupingObjectId>ipset-126</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define
multiple of these -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
</destination>
<application>
<!-- Optional. Default behaviour is like "any". applicationsetId or applicationgroupId can be used -->
<applicationId>application-155</applicationId> <!-- Id of Service available to the edge. Can define multiple of these -->
</application>
<matchTranslated>true</matchTranslated>
<!-- Optional. Default behaviour is like "false" -->
<direction>in</direction>
<!-- Optional. Default behaviour is like "any". Possible values are in|out -->
<action>accept</action>
<!-- Mandatory. Possible values are accept|deny -->
<enabled>true</enabled>
<!-- Optional. Defaults to true -->
<loggingEnabled>true</loggingEnabled> <!-- Optional. Defaults to false -->
<description>comments</description>
<!-- Optional -->
</rule>
<rule>
...
</rule>

Add a Firewall Rule Above a Specific Rule


YoucanaddaruleaboveaspecificrulebyindicatingitsruleID.Ifnouserrulesexistinthefirewallrulestable,
youcanspecifyruleId=0.IfyoudonotspecifyaruleIDorthespecifiedruleIDdoesnotexist,EdgeManager
displaysanerror.
Example 8-25. Add a rule above a specific rule
Request:

158

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/firewall/config/rules?aboveRuleId=<ruleId>

RequestBody:
<rule>
<ruleTag>1</ruleTag>
<!-- Optional. This can be used to specify user controlled ids on VSE. The inputs here should be
1-65536. If not specified, VSM will generate ruleId -->
<name>rule1</name>
<!-- Optional -->
<source>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
</source>
<destination>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<groupingObjectId>ipset-126</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define
multiple of these -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
</destination>
<application>
<!-- Optional. Default behaviour is like "any". applicationsetId or applicationgroupId can be used -->
<applicationId>application-155</applicationId> <!-- Id of Service available to the edge. Can define multiple of these -->
</application>
<matchTranslated>true</matchTranslated>
<!-- Optional. Default behaviour is like "false" -->
<direction>in</direction>
<!-- Optional. Default behaviour is like "any". Possible values are in|out -->
<action>accept</action>
<!-- Mandatory. Possible values are accept|deny -->
<enabled>true</enabled>
<!-- Optional. Defaults to true -->
<loggingEnabled>true</loggingEnabled> <!-- Optional. Defaults to false -->
<description>comments</description>
<!-- Optional -->
</rule>

Query Specific Rule


Example 8-26. Retrieve specific rule
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/firewall/config/rules/<ruleId>

ResponseBody:
<rule>
<name>new rule</name>
<source>
<vnicGroupId>vnic-index-5</vnicGroupId>
</source>
<destination>
<groupingObjectId>ipset-127</groupingObjectId>
</destination>
<action>accept</action>
<enabled>true</enabled>
<loggingEnabled>true</loggingEnabled>
<description/>
</rule>

Modify Firewall Rule


YoucanmodifyarulebyspecifyingitsruleID.
Example 8-27. .Update specific rule
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/firewall/config/rules/<ruleId>

ResponseBody:
<rule>

VMware, Inc.

159

vShield API Programming Guide

<ruleTag>1</ruleTag>
<!-- Optional. This can be used to specify user controlled ids on VSE. The inputs here should be
1-65536. If not specified, VSM will generate ruleId -->
<name>rule1</name>
<!-- Optional -->
<source>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
</source>
<destination>
<!-- Optional. Default behaviour is like "any". ipsetId or predefined-vnicGroupIds can be used -->
<groupingObjectId>ipset-126</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
<vnicGroupId>vnic-index-5</vnicGroupId> <!-- Possible values are "vnic-index-[0-9]", "vse", "external" or "internal". Can define
multiple of these -->
<groupingObjectId>ipset-128</groupingObjectId> <!-- Id of IPAddresses grouping Objects available to the edge. Can define multiple
of these -->
</destination>
<application>
<!-- Optional. Default behaviour is like "any". applicationsetId or applicationgroupId can be used -->
<applicationId>application-155</applicationId> <!-- Id of Service available to the edge. Can define multiple of these -->
</application>
<matchTranslated>true</matchTranslated>
<!-- Optional. Default behaviour is like "false" -->
<direction>in</direction>
<!-- Optional. Default behaviour is like "any". Possible values are in|out -->
<action>accept</action>
<!-- Mandatory. Possible values are accept|deny -->
<enabled>true</enabled>
<!-- Optional. Defaults to true -->
<loggingEnabled>true</loggingEnabled> <!-- Optional. Defaults to false -->
<description>comments</description>
<!-- Optional -->
</rule>

Delete a Firewall Rule


DeletestherulewiththespecifiedruleID.
Example 8-28. Delete firewall rule
RequestBody;
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/firewall/config/rules/<ruleId>

Delete Firewall Configuration


DeletesfirewallconfigurationforEdge.
Example 8-29. Delete firewall configuration
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config

Manage Global Firewall Configuration


Globalfirewallconfigurationallowsfinegrainedtuningoffirewallbehavioranditsstatefulsessiontimeouts.
Thedefaultsettingsoftheseparametersaresetfornormalstatefulfirewalloperation.Administratorsarenot
expectedtomodifythesedefaultsettingsunlesstosupportaspecificcustomscenario.

Query Global Firewall Configuration


Retrievesthefirewalldefaultpolicyforanedge.

160

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-30. Query global firewall configuration


Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config/global

ResponseBody:
<globalConfig>
<tcpPickOngoingConnections>false</tcpPickOngoingConnections>
<tcpAllowOutOfWindowPackets>false</tcpAllowOutOfWindowPackets>
<tcpSendResetForClosedVsePorts>true</tcpSendResetForClosedVsePorts>
<dropInvalidTraffic>true</dropInvalidTraffic>
<logInvalidTraffic>false</logInvalidTraffic>
<tcpTimeoutOpen>30</tcpTimeoutOpen>
<tcpTimeoutEstablished>3600</tcpTimeoutEstablished>
<tcpTimeoutClose>30</tcpTimeoutClose>
<udpTimeout>60</udpTimeout>
<icmpTimeout>10</icmpTimeout>
<icmp6Timeout>10</icmp6Timeout>
<ipGenericTimeout>120</ipGenericTimeout>
</globalConfig>

Modify Global Configuration


Configuresfirewallglobalconfigforanedge.Storesthespecifiedconfigurationindatabase.Ifany
appliance(s)areassociatedwiththisedge,appliestheconfigurationtothese.Doesnotchangethe
defaultPolicyandrules.
Example 8-31. Modify global firewall configuration
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config/global

ResponseBody:
<globalConfig> <!-- Optional -->
<tcpPickOngoingConnections>false</tcpPickOngoingConnections> <!-- Optional. Defaults to false -->
<tcpAllowOutOfWindowPackets>false</tcpAllowOutOfWindowPackets> <!-- Optional. Defaults to false -->
<tcpSendResetForClosedVsePorts>true</tcpSendResetForClosedVsePorts> <!-- Optional. Defaults to true -->
<dropInvalidTraffic>true</dropInvalidTraffic> <!-- Optional. Defaults to true -->
<logInvalidTraffic>false</logInvalidTraffic> <!-- Optional. Defaults to false -->
<tcpTimeoutOpen>30</tcpTimeoutOpen>
<!-- Optional. Defaults to 30 -->
<tcpTimeoutEstablished>3600</tcpTimeoutEstablished> <!-- Optional. Defaults to 3600 -->
<tcpTimeoutClose>30</tcpTimeoutClose> <!-- Optional. Defaults to 30 -->
<udpTimeout>60</udpTimeout>
<!-- Optional. Defaults to 60 -->
<icmpTimeout>10</icmpTimeout>
<!-- Optional. Defaults to 10 -->
<icmp6Timeout>10</icmp6Timeout>
<!-- Optional. Defaults to 10 -->
<ipGenericTimeout>120</ipGenericTimeout> <!-- Optional. Defaults to 120 -->
</globalConfig>

Manage Default Firewall Policy


Defaultfirewallsettingsapplytotrafficthatdoesnotmatchanyoftheuserdefinedfirewallrules.Thedefault
Edgefirewallpolicyblocksallincomingtraffic.

Query Default Firewall Policy


RetrievesdefaultfirewallpolicyforthespecifiedEdge.
Example 8-32. Query default firewall configuration
Request:

VMware, Inc.

161

vShield API Programming Guide

GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config/defaultpolicy

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<firewallDefaultPolicy>
<action>ACCEPT</action>
<loggingEnabled>true</loggingEnabled>
</firewallDefaultPolicy>

Modify Default Firewall Policy


ConfiguresdefaultfirewallpolicyforthespecifiedEdge.
Example 8-33. Modify default firewall configuration
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config/defaultpolicy

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<firewallDefaultPolicy>
<action>ACCEPT</action>
<loggingEnabled>true</loggingEnabled>
</firewallDefaultPolicy>

Query Firewall Statistics


Retrievesnumberofongoingconnectionsforthefirewallconfiguration.
Example 8-34. Query firewall statistics
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/statistics/dashboard/firewall?interval=<range>

ResponseBody:
<dashboardStatistics>
<meta>
<startTime>1336068000</startTime> <!-- in seconds -->
<endTime>1336100700</endTime> <!-- in seconds -->
<interval>300</interval>
</meta>
<data>
<firewall>
</firewall>
</data>
</dashboardStatistics>

whereinput range can be given in query parameter:


Default(whennotspecified):60mins(Onehour)
Thisinputiseither160minutesoroneDay|oneWeek|oneMonth|oneYear

Query Firewall Statistics for Rule


Retrievesstatisticsforarule.

162

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-35. Query statistics for a rule


Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/statistics/{ruleId}

ResponseBody:
<firewallRuleStats>
<timestamp>1342317563</timestamp>
<connectionCount>0</connectionCount>
<packetCount>0</packetCount>
<byteCount>0</byteCount>
</firewallRuleStats>

Disable Firewall
FirewallcanbedisabledonlyonanxlargeEdge.
Example 8-36. Disable Firewall
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/firewall/config

RequestBody:
<firewall><enabled>false</enabled></firewall>

Working with NAT


Configure NAT
NSXEdgeprovidesnetworkaddresstranslation(NAT)servicetoprotecttheIPaddressesofinternal(private)
networksfromthepublicnetwork.YoucanconfigureNATrulestoprovideaccesstoservicesrunningon
privatelyaddressedvirtualmachines.TherearetwotypesofNATrulesthatcanbeconfigured:SNATand
DNAT.WhenyoupostaNATconfiguration,alltherules(bothSNATandDNAT)mustbepostedtogether.
Otherwise,onlythepostedrulesareretained,andunpostedrulesaredeleted.
AllSNATandDNATrulesconfiguredbyusingRESTrequestsappearundertheNATtabfortheappropriate
EdgeEdgeintheEdgeManageruserinterfaceandinthevSphereClientplugin.
Example 8-37. Configure SNAT and DNAT rules for a Edge Edge
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/nat/config
<nat>
<natRules>
<natRule>
<ruleTag>65537</ruleTag>
<!-- Optional. Can be used to specify user-controlled ids on VSE. Valid inputs
65537-131072. If not specified, vShield manager will generate ruleId -->
<action>dnat</action>
<vnic>0</vnic>
<originalAddress>10.112.196.116</originalAddress>
<translatedAddress>172.16.1.10</translatedAddress>
<loggingEnabled>true</loggingEnabled> <!-- Optional. Default is false -->
<enabled>true</enabled>
<!-- Optional. Default is true -->
<description>my comments</description> <!-- Optional -->
<protocol>tcp</protocol>
<!-- Optional. Default is "any". This tag is not supported for SNAT rule -->
<translatedPort>3389</translatedPort> <!-- Optional. Default is "any". This tag is not supported for SNAT rule -->
<originalPort>3389</originalPort>
<!-- Optional. Default is "any". This tag is not supported for SNAT rule -->
</natRule>
<natRule>

VMware, Inc.

163

vShield API Programming Guide

<ruleTag>65538</ruleTag>
<!-- Optional. Can be used to specify user-controlled ids on VSE. Valid inputs
65537-131072. If not specified, VSM will generate ruleId -->
<action>snat</action>
<vnic>1</vnic>
<originalAddress>172.16.1.10</originalAddress>
<translatedAddress>10.112.196.116</translatedAddress>
<loggingEnabled>false</loggingEnabled> <!-- Optional. Default is "false" -->
<enabled>true</enabled>
<!-- Optional. Default is "true" -->
<description>no comments</description> <!-- Optional. Default is "any" -->
</natRule>
</natRules>
</nat>

Forthedatapathtowork,youneedtoaddfirewallrulestoallowtherequiredtrafficforIPaddressesandport
pertheNATrules.
Rules:

Youmustadd<icmpType>ifyouconfigureicmpastheprotocol.

TheoriginalAddressandtranslatedAddresselementscanbeenteredineitherofthesemethods:

<ipAddress>specifiedasasingleIPaddress,ahyphenseparatedIPaddressrange(forexample,
192.168.10.1-192.168.10.2555)orasubnetinCIDRnotation(198.168.10.1/24).

thekeywordany

TheoriginalPortandtranslatedPortparameterscanbeenteredinoneofthefollowingformats:thekeyword
any,theportnumberasaninteger,orarangeofportnumber,forexampleportX-portY.

YoucanaddmultipleSNATrulesbyenteringmultiple<type>snat</type>sectionsinthebody.

SNATdoesnotsupportportorprotocolparameters.

Loggingisdisabledbydefault.Toenablelogging,addan<enableLog>elementsettotrue.

Query NAT Rules for a Edge Edge


Example 8-38. Query SNAT and DNAT rules for a Edge Edge
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/nat/config

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<nat>
<natRules>
<natRule>
<ruleTag>196609</ruleTag>
<ruleId>196609</ruleId>
<action>dnat</action>
<vnic>0</vnic>
<originalAddress>10.112.196.116</originalAddress>
<translatedAddress>172.16.1.10</translatedAddress>
<loggingEnabled>true</loggingEnabled>
<enabled>true</enabled>
<description>my comments</description>
<protocol>tcp</protocol>
<translatedPort>3389</translatedPort>
<originalPort>3389</originalPort>
<ruleType>user</ruleType>
</natRule>
<natRule>
<ruleTag>196609</ruleTag>
<ruleId>196609</ruleId>
<action>snat</action>
<vnic>1</vnic>
<originalAddress>172.16.1.10</originalAddress>
<translatedAddress>10.112.196.116</translatedAddress>

164

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<loggingEnabled>false</loggingEnabled>
<enabled>true</enabled>
<description>no comments</description>
<protocol>any</protocol>
<originalPort>any</originalPort>
<translatedPort>any</translatedPort
<ruleType>user</ruleType>
</natRule>
</natRules>
</nat>

Delete all NAT Rules


DeletesallSNATandDNATrulesforaEdgeEdge.Theautoplumbedrulescontinuetoexist.
Example 8-39. Delete NAT rules
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/nat/config

Add a NAT Rule above a Specific Rule


AddsaNATruleabovethespecifiedruleID.IfnoNATrulesexistintheNATrulestable,youcanspecify
ruleId=0.IfyoudonotspecifyaruleIDorthespecifiedruleIDdoesnotexist,EdgeManagerdisplaysanerror.
Example 8-40. Add a NAT rule above a specific rule
POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/nat/config/rules?aboveRuleId=<ruleId>

RequestBody:
<natRule>
<action>dnat</action>
<vnic>0</vnic>
<originalAddress>10.112.196.116</originalAddress>
<translatedAddress>172.16.1.10</translatedAddress>
<loggingEnabled>true</loggingEnabled>
<enabled>true</enabled>
<description>my comments</description>
<protocol>tcp</protocol>
<translatedPort>3389</translatedPort>
<originalPort>3389</originalPort>
</natRule>

Append NAT Rules


AppendsoneormorerulestothebottomoftheNATrulestable.
Example 8-41. Add NAT rules to the bottom of the rules table
POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/nat/config/rules

ResponseBody:
<natRules>
<natRule>
<action>dnat</action>
<vnic>0</vnic>
<originalAddress>10.112.196.116</originalAddress>
<translatedAddress>172.16.1.10</translatedAddress>
<loggingEnabled>true</loggingEnabled>
<enabled>true</enabled>
<description>my comments</description>

VMware, Inc.

165

vShield API Programming Guide

<protocol>tcp</protocol>
<translatedPort>3389</translatedPort>
<originalPort>3389</originalPort>
</natRule>
</natRules>

wherevnicistheinternaloruplinkinterfaceoftheEdgeEdge(09).

Modify a NAT Rule


ReplacestheNATrulewiththespecifiedruleID.
Example 8-42. Replaces a NAT rule
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/nat/config/rules/ruleID

ResponseBody:
<natRule>
<action>dnat</action>
<vnic>0</vnic>
<originalAddress>10.112.196.116</originalAddress>
<translatedAddress>172.16.1.10</translatedAddress>
<loggingEnabled>true</loggingEnabled>
<enabled>true</enabled>
<description>my comments</description>
<protocol>tcp</protocol>
<translatedPort>3389</translatedPort>
<originalPort>3389</originalPort>
</natRule>

wherevnicistheinternaloruplinkinterfaceoftheEdgeEdge(09).

Delete a NAT Rule


DeletestherulewiththespecifiedruleID.
Example 8-43. Delete NAT rule
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/nat/config/rules/ruleID

Working with Routing


YoucanspecifystaticanddynamicroutingforeachNSXEdge.
Dynamicroutingprovidesthenecessaryforwardinginformationbetweenlayer2broadcastdomains,thereby
allowingyoutodecreaselayer2broadcastdomainsandimprovenetworkefficiencyandscale.NSXextends
thisintelligencetowheretheworkloadsresidefordoingEastWestrouting.Thisallowsmoredirectvirtual
machinetovirtualmachinecommunicationwithoutthecostlyortimelyneedtoextendhops.Atthesame
time,NSXalsoprovidesNorthSouthconnectivity,therebyenablingtenantstoaccesspublicnetworks.

Configure Routes
ConfiguresglobalConfig,staticRouting,OSPG,BGP,andISIS.
Example 8-44. Configure routes
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config
<routing>
<routingGlobalConfig>
<routerId>1.1.1.1</routerId> <!-- Required when dynamic routing protocols like OSPF, BGP, IS-IS is configured -->

166

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<logging>
<!-- Optional. When absent, enable=false and logLevel=INFO -->
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
<ipPrefixes> <!-- Optional. Required only if user wants to define redistribution rules in dynamic routing protocols like ospf, isis,
bgp -->
<ipPrefix>
<name>a</name> <!-- All the defined ipPrefix must have unique names -->
<ipAddress>10.112.196.160/24</ipAddress>
</ipPrefix>
<ipPrefix>
<name>b</name>
<ipAddress>192.168.10.0/24</ipAddress>
</ipPrefix>
</ipPrefixes>
</routingGlobalConfig>
<staticRouting>
<staticRoutes> <!-- Optional, if no static routes needs to be configured -->
<route>
<description>route1</description>
<vnic>0</vnic>
<network>3.1.1.4/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
<route>
<description>route2</description>
<vnic>1</vnic>
<network>4.1.1.4/22</network>
<nextHop>10.112.196.118</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
</staticRoutes>
<defaultRoute>
<!-- Optional, if no default routes needs to be configured -->
<description>defaultRoute</description>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the interface
on which this route is configured -->
</defaultRoute>
</staticRouting>
<ospf>
<!-- Optional, if no OSPF needs to be configured -->
<enabled>true</enabled> <!-- Optional. Defaults to true -->
<ospfAreas>
<ospfArea>
<areaId>100</areaId> <!-- Mandatory and unique. Valid values are 0-4294967295 -->
<type>normal</type> <!-- Optional. Default is normal. Valid inputs are normal, nssa -->
<authentication>
<!-- Optional. When not specified, its "none" authentication. -->
<type>password</type> <!-- Valid values are none, password , md5 -->
<value>vmware123</value> <!-- Value as per the type of authentication -->
</authentication>
</ospfArea>
</ospfAreas>
<ospfInterfaces>
<ospfInterface>
<vnic>0</vnic>
<areaId>100</areaId>
<helloInterval>10</helloInterval> <!-- Optional. Default 10 sec. Valid values are 1-255-->
<deadInterval>40</deadInterval> <!-- Optional. Default 40 sec. Valid values are 1-65535 -->
<priority>128</priority> <!-- Optional. Default 128. Valid values are 0-255 -->
<cost>10</cost> <!-- Optional. Auto based on interface speed. Valid values are 1-65535 -->
</ospfInterface>
</ospfInterfaces>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>

VMware, Inc.

167

vShield API Programming Guide

<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<prefixName>b</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>true</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</ospf>
<isis>
<!-- Optional, if no ISIS needs to be configured -->
<enabled>true</enabled> <!-- Optional. Defaults to true -->
<systemId>0004.c150.f1c0</systemId> <!-- Optional. 6 byte length & specified in HEX. When not specified, derived
routingGlobalConfig.routerId -->
<areaIds> <!-- Atleast one is required. Max supported is 3 -->
<areaId>49.0005.8000.ab7c.0000.ffe9.0001</areaId>
<areaId>49.0005.8000.ab7c.0000.ffe9.0002</areaId> <!-- Variable length between 1 and 13 bytes & specified in HEX. -->
<areaId>49.0005.8000.ab7c.0000.ffe9.0003</areaId>
</areaIds>
<isType>level-1-2</isType> <!-- Optional. Default is 'level-1-2'. Valid values are level-1, level-2, level-1-2 -->
<domainPassword>vshield</domainPassword> <!-- Optional. Domain level authentication. Used when type is level-2 -->
<areaPassword>edge</areaPassword>
<!-- Optional. Area level authentication. Used when type is level-1 -->
<isisInterfaces>
<isisInterface>
<vnic>1</vnic>
<meshGroup>10</meshGroup>
<!-- Optional. Valid values are : 0-4294967295 -->
<helloInterval>10000</helloInterval> <!-- Optional. Default is 10000 millisecond . Valid values are : 10-600000 -->
<helloMultiplier>3</helloMultiplier> <!-- Optional. Default is 3. Valid values are : 2-100 -->
<lspInterval>33</lspInterval>
<!-- Optional. Default is 33 milliseconds. Valid values are : 1-65535 -->
<metric>10</metric>
<!-- Optional. Default is 10. Valid values are : 1-16777215 -->
<priority>64</priority>
<!-- Optional. Default is 64. Valid values are : 0-127 -->
<circuitType>level-1-2</circuitType> <!-- Optional. Valid values are level-1, level-2, level-1-2. If absent, 'type' from above is
used -->
<password>msr</password>
<!-- Optional. Per interface authentication -->
</isisInterface>
</isisInterfaces>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>true</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>true</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>

168

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<rule>
<prefixName>b</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>true</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</isis>
<bgp>
<!-- Optional, if no BGP needs to be configured -->
<enabled>true</enabled> <!-- Optional. Default is true -->
<localAS>1</localAS>
<!-- Valid values are : 0-65535 -->
<bgpNeighbours>
<bgpNeighbour>
<ipAddress>192.168.1.10</ipAddress> <!-- IPv4 only. IPv6 support not supported -->
<remoteAS>65500</remoteAS>
<!-- Valid values are 0-65535 -->
<weight>60</weight>
<!-- Optional. Default is 60. Valid values are 0-65535 -->
<holdDownTimer>180</holdDownTimer>
<!-- Optional. Default is 180 seconds. Valid values are : 2-65535 . -->
<keepAliveTimer>60</keepAliveTimer> <!-- Optional. Default is 60 seconds. Valid values are : 1-65534 . -->
<password>vmware123</password>
<!-- Optional -->
<bgpFilters>
<!-- Optional -->
<bgpFilter>
<direction>in</direction>
<!-- Valid values are in/out -->
<action>permit</action>
<!-- Valid values are permit/deny -->
<network>10.0.0.0/8</network> <!-- Valid values are CIDR networks. IPv4 only. IPv6 support not supported -->
<ipPrefixGe>17</ipPrefixGe> <!-- Optional. "Greater than or equal to" & used for filtering based on prefix length. Valid
IPv4 prefixes -->
<ipPrefixLe>32</ipPrefixLe> <!-- Optional. "Less than or equal to" & used for filtering based on prefix length. Valid IPv4
prefixes -->
</bgpFilter>
</bgpFilters>
</bgpNeighbour>
</bgpNeighbours>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>true</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>true</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</bgp>

VMware, Inc.

169

vShield API Programming Guide

</routing>

Query Routes
Example 8-45. Retrieve routes
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<staticRouting>
<staticRoutes>
<route>
<vnic>0</vnic>
<network>3.1.1.4/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default is MTU of the
interface on which this route is configured -->
<type>user</type>
</route>
<route>
<vnic>1</vnic>
<network>4.1.1.4/22</network>
<nextHop>10.112.196.118</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default is MTU of the
interface on which this route is configured -->
<type>user</type>
</route>
</staticRoutes>
<defaultRoute>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default is MTU of the interface
on which this route is configured -->
</defaultRoute>
</staticRouting>

Delete Routes
DeletestheroutingconfigurationstoredintheNSXManagerdatabaseandthedefaultroutesfromthe
specifiedNSXEdgeappliance.
Example 8-46. Delete routing
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config

Manage Global Routing Configuration


Configuresthedefaultgatewayforstaticroutesanddynamicroutingdetails.

Specify Global Configuration


Example 8-47. Configure global route
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/global

RequestBody:

170

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<routingGlobalConfig>
<routerId>1.1.1.1</routerId> <!-- Required when dynamic routing protocols like OSPF, BGP, IS-IS is configured -->
<logging>
<!-- Optional. When absent, enable=false and logLevel=INFO -->
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
<ipPrefixes> <!-- Optional. Required only if user wants to define redistribution rules in dynamic routing protocols like ospf, isis,
bgp -->
<ipPrefix>
<name>a</name> <!-- All the defined ipPrefix must have unique names -->
<ipAddress>10.112.196.160/24</ipAddress>
</ipPrefix>
<ipPrefix>
<name>b</name>
<ipAddress>192.168.10.0/24</ipAddress>
</ipPrefix>
</ipPrefixes>
</routingGlobalConfig>

Query Global Route


RetrievesroutinginformationfromtheNSXManagerdatabaseforanedgewhichincludesthefollowing:

Defaultroutesettings

Staticrouteconfigurations

Example 8-48. Query global route


RequestBody:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/global

Manage Static Routing


AddorquerystaticanddefaultroutesforsecifiedEdge.

Configure Static Routes


Configuresstaticanddefaultroutes.
Example 8-49. Configure static routes
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/static

RequestBody:
<staticRouting>
<staticRoutes>
<route>
<description>route1</description>
<vnic>0</vnic>
<network>3.1.1.4/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
<route>
<description>route2</description>
<vnic>1</vnic>
<network>4.1.1.4/22</network>
<nextHop>10.112.196.118</nextHop>

VMware, Inc.

171

vShield API Programming Guide

<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the
interface on which this route is configured -->
</route>
</staticRoutes>
<defaultRoute>
<description>defaultRoute</description>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu> <!-- Optional. Valid value:smaller than the MTU set on the interface. Default will be the MTU of the interface
on which this route is configured -->
</defaultRoute>
</staticRouting>

Query Static Routes


Retrievesstaticanddefaultroutes.
Example 8-50. Query static routes
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/static

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<staticRouting>
<staticRoutes>
<route>
<description>route1</description>
<vnic>0</vnic>
<network>3.1.1.4/22</network>
<nextHop>172.16.1.14</nextHop>
<mtu>1500</mtu>
<type>user</type>
</route>
<route>
<description>route2</description>
<vnic>1</vnic>
<network>4.1.1.4/22</network>
<nextHop>10.112.196.118</nextHop>
<mtu>1500</mtu>
<type>user</type>
</route>
</staticRoutes>
<defaultRoute>
<description>defaultRoute</description>
<vnic>0</vnic>
<gatewayAddress>172.16.1.12</gatewayAddress>
<mtu>1500</mtu>
</defaultRoute>
</staticRouting>

Delete Static Routes


DeletesbothstaticanddefaultroutingconfigurationstoredintheNSXManagerdatabase.
Example 8-51. Delete static routes
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/static

172

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Manage OSPF Routes for NSX Edge


NSXEdgesupportsOSPF,aninteriorgatewayprotocolthatroutesIPpacketsonlywithinasinglerouting
domain.Itgatherslinkstateinformationfromavailableroutersandconstructsatopologymapofthenetwork.
ThetopologydeterminestheroutingtablepresentedtotheInternetLayer,whichmakesroutingdecisions
basedonthedestinationIPaddressfoundinIPpackets.
OSPFroutingpoliciesprovideadynamicprocessoftrafficloadbalancingbetweenroutesofequalcost.An
OSPFnetworkisdividedintoroutingareastooptimizetraffic.AnareaisalogicalcollectionofOSPF
networks,routers,andlinksthathavethesameareaidentification.
AreasareidentifiedbyanAreaID.

Configure OSPF
Example 8-52. Configure OSPF
Request
PUThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/ospf
RequestBody:
<ospf>
<enabled>true</enabled>
<!-- When not specified, it will be treated as false, When false, it will delete the existing config -->
<ospfAreas>
<ospfArea>
<areaId>100</areaId> <!-- Mandatory and unique. Valid values are 0-4294967295 -->
<type>normal</type> <!-- Optional. Default is normal. Valid inputs are normal, nssa -->
<authentication>
<!-- Optional. When not specified, its "none" authentication. -->
<type>password</type> <!-- Valid values are none, password , md5 -->
<value>vmware123</value> <!-- Value as per the type of authentication -->
</authentication>
</ospfArea>
</ospfAreas>
<ospfInterfaces>
<ospfInterface>
<vnic>0</vnic>
<areaId>100</areaId>
<helloInterval>10</helloInterval> <!-- Optional. Default 10 sec. Valid values are 1-255-->
<deadInterval>40</deadInterval> <!-- Optional. Default 40 sec. Valid values are 1-65535 -->
<priority>128</priority> <!-- Optional. Default 128. Valid values are 0-255 -->
<cost>10</cost> <!-- Optional. Auto based on interface speed. Valid values are 1-65535 -->
</ospfInterface>
</ospfInterfaces>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<prefixName>b</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>true</bgp>
<!-- Optional. Defaults to false -->

VMware, Inc.

173

vShield API Programming Guide

<static>false</static> <!-- Optional. Defaults to false -->


<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</ospf>

Query OSPF
Example 8-53. Query OSPF
Request
GEThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/ospf
RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<ospf>
<enabled>true</enabled>
<ospfAreas>
<ospfArea>
<areaId>100</areaId>
<type>normal</type>
<authentication>
<type>password</type>
<value>vmware123</value>
</authentication>
</ospfArea>
</ospfAreas>
<ospfInterfaces>
<ospfInterface>
<vnic>0</vnic>
<areaId>100</areaId>
<helloInterval>10</helloInterval>
<deadInterval>40</deadInterval>
<priority>128</priority>
<cost>10</cost>
</ospfInterface>
</ospfInterfaces>
<redistribution>
<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>true</isis>
<ospf>false</ospf>
<bgp>false</bgp>
<static>false</static>
<connected>true</connected>
</from>
<action>deny</action>
</rule>
<rule>
<id>0</id>
<prefixName>b</prefixName>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>true</bgp>
<static>false</static>
<connected>false</connected>
</from>

174

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<action>permit</action>
</rule>
</rules>
</redistribution>
</ospf>

Delete OSPF
DeletesOSPFrouting.
Example 8-54. Delete OSPF
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/ospf

Manage ISIS Routes for NSX Edge


IntermediateSystemtoIntermediateSystem(ISIS)isaroutingprotocoldesignedtomoveinformationby
determiningthebestroutefordatagramsthroughapacketswitchednetwork.Atwolevelhierarchyisused
tosupportlargeroutingdomains.Alargedomainmaybedividedintoareas.Routingwithinanareais
referredtoasLevel1routing.RoutingbetweenareasisreferredtoasLevel2routing.ALevel2Intermediate
System(IS)keepstrackofthepathstodestinationareas.ALevel1ISkeepstrackoftheroutingwithinitsown
area.Forapacketgoingtoanotherarea,aLevel1ISsendsthepackettothenearestLevel2ISinitsownarea,
regardlessofwhatthedestinationareais.ThenthepackettravelsviaLevel2routingtothedestinationarea,
whereitmaytravelviaLevel1routingtothedestination.ThisisreferredtoasLevel12.

Configure ISIS
Example 8-55. Configure ISIS
Request
PUThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/isis
RequestBody:
<isis>
<enabled>true</enabled>
<systemId>0004.c150.f1c0</systemId> <!-- Optional. 6 byte length & specified in HEX. When not specified, derived
routingGlobalConfig.routerId -->
<areaIds> <!-- Atleast one is required. Max supported is 3 -->
<areaId>49.0005.8000.ab7c.0000.ffe9.0001</areaId>
<areaId>49.0005.8000.ab7c.0000.ffe9.0002</areaId> <!-- Variable length between 1 and 13 bytes & specified in HEX. -->
<areaId>49.0005.8000.ab7c.0000.ffe9.0003</areaId>
</areaIds>
<isType>level-1-2</isType> <!-- Optional. Default is 'level-1-2'. Valid values are level-1, level-2, level-1-2 -->
<domainPassword>vshield</domainPassword> <!-- Optional. Domain level authentication. Used when type is level-2 -->
<areaPassword>edge</areaPassword>
<!-- Optional. Area level authentication. Used when type is level-1 -->
<isisInterfaces>
<isisInterface>
<vnic>0</vnic>
<meshGroup>10</meshGroup>
<!-- Optional. Valid values are : 0-4294967295 -->
<helloInterval>10000</helloInterval> <!-- Optional. Default is 10000 millisecond . Valid values are : 10-600000 -->
<helloMultiplier>3</helloMultiplier> <!-- Optional. Default is 3. Valid values are : 2-100 -->
<lspInterval>33</lspInterval>
<!-- Optional. Default is 33 milliseconds. Valid values are : 1-65535 -->
<metric>10</metric>
<!-- Optional. Default is 10. Valid values are : 1-16777215 -->
<priority>64</priority>
<!-- Optional. Default is 64. Valid values are : 0-127 -->
<circuitType>level-1-2</circuitType> <!-- Optional. Valid values are level-1, level-2, level-1-2. If absent, 'type' from above is
used -->
<password>msr</password>
<!-- Optional. Per interface authentication -->
</isisInterface>
</isisInterfaces>

VMware, Inc.

175

vShield API Programming Guide

<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>true</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>true</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<prefixName>b</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>true</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</isis>

Query ISIS
Example 8-56. Query ISIS
Request
GEThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/isis
RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<isis>
<enabled>true</enabled>
<systemId>0004.c150.f1c0</systemId>
<areaIds>
<areaId>49.0005.8000.ab7c.0000.ffe9.0001</areaId>
<areaId>49.0005.8000.ab7c.0000.ffe9.0002</areaId>
<areaId>49.0005.8000.ab7c.0000.ffe9.0003</areaId>
</areaIds>
<isType>level-1-2</isType>
<domainPassword>vshield</domainPassword>
<areaPassword>edge</areaPassword>
<isisInterfaces>
<isisInterface>
<vnic>0</vnic>
<meshGroup>10</meshGroup>
<helloInterval>10000</helloInterval>
<helloMultiplier>3</helloMultiplier>
<lspInterval>33</lspInterval>
<metric>10</metric>
<priority>64</priority>
<circuitType>level-1-2</circuitType>
<password>msr</password>
</isisInterface>
</isisInterfaces>
<redistribution>

176

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>false</isis>
<ospf>true</ospf>
<bgp>false</bgp>
<static>true</static>
<connected>false</connected>
</from>
<action>deny</action>
</rule>
<rule>
<id>0</id>
<prefixName>b</prefixName>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>true</bgp>
<static>false</static>
<connected>true</connected>
</from>
<action>permit</action>
</rule>
</rules>
</redistribution>
</isis>

Delete ISIS
DeletesISISrouting.
Example 8-57. Delete ISIS
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/isis

Manage BGP Routes for NSX Edge


BorderGatewayProtocol(BGP)makescoreroutingdecisions.ItincludesatableofIPnetworksorprefixes
whichdesignatenetworkreachabilityamongautonomoussystems.Anunderlyingconnectionbetweentwo
BGPspeakersisestablishedbeforeanyroutinginformationisexchanged.Keepalivemessagesaresentoutby
theBGPspeakersinordertokeepthisrelationshipalive.Oncetheconnectionisestablished,theBGPspeakers
exchangeroutesandsynchronizetheirtables.

Configure BGP
Example 8-58. Configure BGP
Request
PUThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/bgp
RequestBody:
<bgp>
<enabled>true</enabled> <!-- Optional. Default is false -->
<localAS>65534</localAS>
<!-- Valid values are : 1-65534 -->
<bgpNeighbours>
<bgpNeighbour>
<ipAddress>192.168.1.10</ipAddress> <!-- IPv4 only. IPv6 support not supported -->
VMware, Inc.

177

vShield API Programming Guide

<remoteAS>65500</remoteAS>
<!-- Valid values are 0-65535 -->
<weight>60</weight>
<!-- Optional. Default is 60. Valid values are 0-65535 -->
<holdDownTimer>180</holdDownTimer>
<!-- Optional. Default is 180 seconds. Valid values are : 2-65535. -->
<keepAliveTimer>60</keepAliveTimer> <!-- Optional. Default is 60 seconds. Valid values are : 1-65534. -->
<password>vmware123</password>
<!-- Optional -->
<bgpFilters>
<!-- Optional -->
<bgpFilter>
<direction>in</direction>
<!-- Valid values are in/out -->
<action>permit</action>
<!-- Valid values are permit/deny -->
<network>10.0.0.0/8</network> <!-- Valid values are CIDR networks. IPv4 only. IPv6 support not supported -->
<ipPrefixGe>17</ipPrefixGe> <!-- Optional. "Greater than or equal to" & used for filtering based on prefix length. Valid
IPv4 prefixes -->
<ipPrefixLe>32</ipPrefixLe> <!-- Optional. "Less than or equal to" & used for filtering based on prefix length. Valid IPv4
prefixes -->
</bgpFilter>
</bgpFilters>
</bgpNeighbour>
</bgpNeighbours>
<redistribution>
<enabled>true</enabled> <!-- Optional. Defaults to false. -->
<rules>
<rule>
<prefixName>a</prefixName> <!-- Optional. Default is "any". prefixName used here should be defined in the
routingGlobalConfig->ipPrefixes -->
<from>
<isis>true</isis>
<!-- Optional. Defaults to false -->
<ospf>true</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>true</static> <!-- Optional. Defaults to false -->
<connected>false</connected> <!-- Optional. Defaults to false -->
</from>
<action>deny</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
<rule>
<from>
<isis>false</isis>
<!-- Optional. Defaults to false -->
<ospf>false</ospf>
<!-- Optional. Defaults to false -->
<bgp>false</bgp>
<!-- Optional. Defaults to false -->
<static>false</static> <!-- Optional. Defaults to false -->
<connected>true</connected> <!-- Optional. Defaults to false -->
</from>
<action>permit</action> <!-- Mandatory. Valid values are deny|permit -->
</rule>
</rules>
</redistribution>
</bgp>

Query BGP
Example 8-59. Query BGP
Request
GEThttps://<nsxmgrip>/api/4.0/edges/<edgeId>/routing/config/bgp
RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<bgp>
<enabled>true</enabled>
<localAS>65535</localAS>
<bgpNeighbours>
<bgpNeighbour>
<ipAddress>192.168.1.10</ipAddress>
<remoteAS>65500</remoteAS>
<weight>60</weight>
<holdDownTimer>180</holdDownTimer>

178

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<keepAliveTimer>60</keepAliveTimer>
<password>vmware123</password>
<bgpFilters>
<bgpFilter>
<direction>in</direction>
<action>permit</action>
<network>10.0.0.0/8</network>
<ipPrefixGe>17</ipPrefixGe>
<ipPrefixLe>32</ipPrefixLe>
</bgpFilter>
<bgpFilter>
<direction>out</direction>
<action>deny</action>
<network>20.0.0.0/26</network>
</bgpFilter>
</bgpFilters>
</bgpNeighbour>
</bgpNeighbours>
<redistribution>
<enabled>true</enabled>
<rules>
<rule>
<id>1</id>
<prefixName>a</prefixName>
<from>
<isis>true</isis>
<ospf>true</ospf>
<bgp>false</bgp>
<static>true</static>
<connected>false</connected>
</from>
<action>deny</action>
</rule>
<rule>
<id>0</id>
<from>
<isis>false</isis>
<ospf>false</ospf>
<bgp>false</bgp>
<static>false</static>
<connected>true</connected>
</from>
<action>permit</action>
</rule>
</rules>
</redistribution>
</bgp>

Delete BGP
DeletesBGProuting.
Example 8-60. Delete BGP
Request
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/routing/config/bgp

VMware, Inc.

179

vShield API Programming Guide

Working with Load Balancer


TheNSXEdgeloadbalancerenablesnetworktraffictofollowmultiplepathstoaspecificdestination.It
distributesincomingservicerequestsevenlyamongmultipleserversinsuchawaythattheloaddistribution
istransparenttousers.Loadbalancingthushelpsinachievingoptimalresourceutilization,maximizing
throughput,minimizingresponsetime,andavoidingoverload.NSXEdgeprovidesloadbalancingupto
Layer7.
Youmapanexternal,orpublic,IPaddresstoasetofinternalserversforloadbalancing.Theloadbalancer
acceptsTCP,HTTP,orHTTPSrequestsontheexternalIPaddressanddecideswhichinternalservertouse.
Port8090isthedefaultlisteningportforTCP,port80isthedefaultportforHTTP,andport443isthedefault
portforHTTPs.

Configure Load Balancer


Theinputcontainsfiveparts:applicationprofile,virtualserver,pool,monitorandapplicationrule.
Example 8-61. Configure load balancer
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config

RequestBody:
<loadBalancer>
<enabled>true</enabled>
<!-- optional, default is true -->
<enableServiceInsertion>false</enableServiceInsertion>
<!-- optional, default is false-->
<accelerationEnabled>true</accelerationEnabled>
<!-- optional, default is false-->
<logging>
<!-- optional, default is false/INFO -->
<enable>true</enable>
<logLevel>debug</logLevel>
<!-- valid values include: emergency, alert, critical, error, warning, notice, info,
debug -->
</logging>
<virtualServer>
<!-- 0-64 virtualServer items could be added -->
<virtualServerId>virtualServer-1</virtualServerId>
<!-- optional, virtualServerId should match virtualServer-X pattern -->
<name>http_vip</name>
<!-- required, unique virtualServer name per edge -->
<description>http virtualServer</description>
<!-- optional -->
<enabled>true</enabled>
<!-- optional, default is true -->
<ipAddress>10.117.35.172</ipAddress>
<!-- required, a valid Edge vNic ip address(ipv4/ipv6) -->
<protocol>http</protocol>
<!-- required, valid values are http/https/tcp -->
<port>80</port>
<!-- required, 1~65535 -->
<connectionLimit>123</connectionLimit>
<!-- optional, default is 0 -->
<connectionRateLimit>123</connectionRateLimit>
<!-- optional, default is null -->
<applicationProfileId>applicationProfile-1</applicationProfileId> <!-- required, a valid applicationProfileId -->
<defaultPoolId>pool-1</defaultPoolId>
<!-- optional, a valid poolId -->
<enableServiceInsertion>false</enableServiceInsertion>
<!-- optional, default is false -->
<accelerationEnabled>true</accelerationEnabled>
<!-- optional, default is false -->
<!-- <vendorProfile> -->
<!-- <vendorTemplateId>577</vendorTemplateId> -->
<!-- required, a valid vendorTemplateId -->
<!-- <vendorTemplateName>F5</vendorTemplateName> -->
<!-- optional -->
<!-- <profileAttributes> -->
<!-- optional -->
<!-- <attribute> -->
<!-<key>abcd</key> -->
<!-<name>abcd</name> -->
<!-<value>1234</value> -->
<!-- </attribute> -->
<!-- </profileAttributes> -->
<!-- </vendorProfile> -->
<!-- optional, it is required when per virtualServer enableServiceInsertion flag
and global enabledServiceInsertion flag are set to true, the VIP would be offloaded to vendor devices instead of
Edge -->
</virtualServer>
<virtualServer>
<virtualServerId>virtualServer-2</virtualServerId>
<name>https_vip</name>
<description>https virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>https</protocol>

180

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<port>443</port>
<connectionLimit>123</connectionLimit>
<connectionRateLimit>123</connectionRateLimit>
<applicationProfileId>applicationProfile-2</applicationProfileId>
<defaultPoolId>pool-2</defaultPoolId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>false</accelerationEnabled>
</virtualServer>
<virtualServer>
<virtualServerId>virtualServer-3</virtualServerId>
<name>tcp_transparent_vip</name>
<description>tcp virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>tcp</protocol>
<port>1234</port>
<connectionLimit>123</connectionLimit>
<applicationProfileId>applicationProfile-3</applicationProfileId>
<defaultPoolId>pool-3</defaultPoolId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>
<virtualServer>
<virtualServerId>virtualServer-4</virtualServerId>
<name>tcp_snat_vip</name>
<description>tcp snat virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>tcp</protocol>
<port>1235</port>
<connectionLimit>123</connectionLimit>
<applicationProfileId>applicationProfile-3</applicationProfileId>
<defaultPoolId>pool-4</defaultPoolId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>
<applicationProfile>
<applicationProfileId>applicationProfile-1</applicationProfileId>
<name>http_application_profile</name>
<insertXForwardedFor>true</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
<persistence>
<method>cookie</method>
<!-- required, cookie is used for http protocol, ssl_sessionid for https -->
<cookieName>JSESSIONID</cookieName>
<!-- optional, required when method is cookie -->
<cookieMode>insert</cookieMode>
<!-- optional, valid values are insert/prefix/app, required when method is
cookie -->
</persistence>
</applicationProfile>
<applicationProfile>
<applicationProfileId>applicationProfile-2</applicationProfileId> <!-- optional, it should match "applicationProfile-X" patter and
required when it is referenced -->
<name>https_application_profile</name>
<!-- required -->
<insertXForwardedFor>true</insertXForwardedFor>
<!-- optional, default is false -->
<sslPassthrough>true</sslPassthrough>
<!-- optional, default is false -->
<persistence>
<!-- optional -->
<method>ssl_sessionid</method>
<!-- required, valid values are ssl_sessionid, cookie, sourceip, msrdp -->
</persistence>
</applicationProfile>
<applicationProfile>
<applicationProfileId>applicationProfile-3</applicationProfileId>
<name>tcp_application_profile</name>
<insertXForwardedFor>false</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
</applicationProfile>
<pool>
<!-- 0-64 pool items could be added -->
<poolId>pool-1</poolId>
<!-- optional, it should match "pool-X" pattern, this item is required when it
has reference -->
<name>pool-http</name>
<!-- required, unique pool name per edge -->

VMware, Inc.

181

vShield API Programming Guide

<description>pool-http</description>
<!-- optional -->
<transparent>false</transparent>
<!-- optional, default is false -->
<algorithm>round-robin</algorithm>
<!-- optional, valid values are round-robin, ip-hash, uri, leastconn, default
is round-robin -->
<monitorId>monitor-1</monitorId>
<!-- optional, it should be a valid monitorId, it is an array -->
<member>
<!-- 0-32 pool member items could be added -->
<memberId>member-1</memberId>
<!-- optional, it should match "member-X" pattern, this item is required
when it has reference -->
<ipAddress>192.168.101.201</ipAddress>
<!-- optional, a valid ip address(ipv4/ipv6), it is required when
groupingObjectId is not specified -->
<!-- <groupingObjectId>vm-24</groupingObjectId> -->
<!-- optional, groupingObject id such as vm-24, network-25,
dvportgroup-26 -->
<weight>1</weight>
<!-- optional, default is 1 -->
<port>80</port>
<!-- required -->
<minConn>10</minConn>
<!-- optional, default is 0 -->
<maxConn>100</maxConn>
<!-- optional, default is 0 -->
<name>m1</name>
<!-- optional, it is required when it is used in ACL rule -->
</member>
<member>
<memberId>member-2</memberId>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>80</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m2</name>
<condition>enabled</condition>
<!-- optional, default is enabled, valid values are enabled/disabled -->
</member>
</pool>
<pool>
<poolId>pool-2</poolId>
<name>pool-https</name>
<description>pool-https</description>
<transparent>false</transparent>
<algorithm>round-robin</algorithm>
<monitorId>monitor-2</monitorId>
<member>
<memberId>member-3</memberId>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<port>443</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m3</name>
</member>
<member>
<memberId>member-4</memberId>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>443</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m4</name>
</member>
</pool>
<pool>
<poolId>pool-3</poolId>
<name>pool-tcp</name>
<description>pool-tcp</description>
<transparent>true</transparent>
<algorithm>round-robin</algorithm>
<monitorId>monitor-3</monitorId>
<member>
<memberId>member-5</memberId>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>

182

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<maxConn>100</maxConn>
<name>m5</name>
<monitorPort>80</monitorPort>
</member>
<member>
<memberId>member-6</memberId>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m6</name>
<monitorPort>80</monitorPort>
</member>
</pool>
<pool>
<poolId>pool-4</poolId>
<name>pool-tcp-snat</name>
<description>pool-tcp-snat</description>
<transparent>false</transparent>
<algorithm>round-robin</algorithm>
<monitorId>monitor-3</monitorId>
<member>
<memberId>member-7</memberId>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m7</name>
<monitorPort>80</monitorPort>
</member>
<member>
<memberId>member-8</memberId>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m8</name>
<monitorPort>80</monitorPort>
</member>
</pool>
<monitor>
<monitorId>monitor-1</monitorId>
<!-- optional, this item should follow "monitor-X" pattern, it is required
when it is referenced -->
<type>http</type>
<!-- required, valid values are http/https/tcp -->
<interval>5</interval>
<!-- optional, default is 5 -->
<timeout>15</timeout>
<!-- optional, default is 15 -->
<maxRetries>3</maxRetries>
<!-- optional, default is 3 -->
<method>GET</method>
<!-- optional, valid value is
OPTIONS/GET/HEAD/POST/PUT/DELETE/TRACE/CONNECT -->
<url>/</url>
<!-- optional -->
<name>http-monitor</name>
<!-- required -->
<!-- <expected>HTTP/1</expected> -->
<!-- optional, Expected response string. Default is "HTTP/1" for http(s)
protocol -->
<!-- <send>hello</send> -->
<!-- optional, URL encoded http POST data for http(s) protocol -->
<!-- <receive>ok</received> -->
<!-- optional, String to expect in the content for http(s) protocol -->
<!-- <extension>no-body
max-age=3h
content-type=Application/xml</extension> -->
<!-- optional, advanced setting for monitor to fill more customized
parameters -->
</monitor>
<monitor>
<monitorId>monitor-2</monitorId>
<type>https</type>
<interval>5</interval>

VMware, Inc.

183

vShield API Programming Guide

<timeout>15</timeout>
<maxRetries>3</maxRetries>
<method>GET</method>
<url>/</url>
<name>https-monitor</name>
</monitor>
<monitor>
<monitorId>monitor-3</monitorId>
<type>tcp</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<name>tcp-monitor</name>
</monitor>
</loadBalancer>configuration example2 to show HTTP/HTTPS Redirection, SSL Offloading, Content Switching, HTTP
HealthMonitor
<loadBalancer>
<enabled>true</enabled>
<accelerationEnabled>true</accelerationEnabled>
<logging>
<enable>true</enable>
<logLevel>debug</logLevel>
</logging>
<applicationRule>
<applicationRuleId>applicationRule-1</applicationRuleId>
<!-- optional, it should follow "applicationRule-X" pattern,
required when it is referenced -->
<name>traffic_ctrl_rule</name>
<!-- required, unique applicationRule name per Edge -->
<script>acl srv1_full srv_conn(pool-http/m1) gt 50
acl srv2_full srv_conn(pool-http/m2) gt 50
use_backend pool-backup if srv1_full or srv2_full</script>
<!-- required, one ACL rule -->
</applicationRule>
<applicationRule>
<applicationRuleId>applicationRule-2</applicationRuleId>
<name>redirection_rule</name>
<script>acl google_page url_beg /google
redirect location https://www.google.com/ if google_page</script>
</applicationRule>
<applicationRule>
<applicationRuleId>applicationRule-3</applicationRuleId>
<name>l7_rule</name>
<script>acl backup_page url_beg /backup
use_backend pool-backup if backup_page</script>
</applicationRule>
<virtualServer>
<virtualServerId>virtualServer-1</virtualServerId>
<name>http_redirection_vip</name>
<description>http redirection virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.171</ipAddress>
<protocol>http</protocol>
<port>80</port>
<connectionLimit>123</connectionLimit>
<connectionRateLimit>123</connectionRateLimit>
<applicationProfileId>applicationProfile-1</applicationProfileId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>
<virtualServer>
<virtualServerId>virtualServer-2</virtualServerId>
<name>https_vip</name>
<description>https virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.171</ipAddress>
<protocol>https</protocol>
<port>443</port>
<connectionLimit>123</connectionLimit>
<connectionRateLimit>123</connectionRateLimit>

184

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<defaultPoolId>pool-1</defaultPoolId>
<applicationProfileId>applicationProfile-2</applicationProfileId>
<applicationRuleId>applicationRule-1</applicationRuleId>
<!-- optional, it is applicationRuleId list, each item should be a
valid applicationRuleId -->
<applicationRuleId>applicationRule-2</applicationRuleId>
<applicationRuleId>applicationRule-3</applicationRuleId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>
<applicationProfile>
<applicationProfileId>applicationProfile-1</applicationProfileId>
<name>https_redirection_application_profile</name>
<insertXForwardedFor>false</insertXForwardedFor>
<sslPassthrough>false</sslPassthrough>
<httpRedirect>
<!-- optional -->
<to>https://10.117.35.171</to>
<!-- required, a uri -->
</httpRedirect>
</applicationProfile>
<applicationProfile>
<applicationProfileId>applicationProfile-2</applicationProfileId>
<name>ssl_offloading_application_profile</name>
<insertXForwardedFor>false</insertXForwardedFor>
<!-- <serverSslEnabled>true</serverSslEnabled> -->
<!-- optional, default is true, it is a switch flag to enable/disable
serverSsl offloading -->
<sslPassthrough>false</sslPassthrough>
<clientSsl>
<!-- optional -->
<clientAuth>ignore</clientAuth>
<!-- optional, valid values are ignore/required -->
<ciphers>AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH</ciphers>
<!-- required, ciphers -->
<serviceCertificate>certificate-4</serviceCertificate>
<!-- required, a serviceCertificate List -->
<caCertificate>certificate-3</caCertificate>
<!-- required, a ca list -->
<crlCertificate>crl-1</crlCertificate>
<!-- optional, a crl list -->
</clientSsl>
<!-<serverSsl>
<ciphers>AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH</ciphers>
<serviceCertificate>certificate-4</serviceCertificate>
<caCertificate>certificate-3</caCertificate>
<crlCertificate>crl-1</crlCertificate>
</serverSsl>
-->
</applicationProfile>
<pool>
<poolId>pool-1</poolId>
<name>pool-http</name>
<description>pool-http</description>
<transparent>false</transparent>
<algorithm>round-robin</algorithm>
<monitorId>monitor-1</monitorId>
<member>
<memberId>member-1</memberId>
<ipAddress>192.168.101.101</ipAddress>
<weight>1</weight>
<port>80</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m1</name>
</member>
<member>
<memberId>member-2</memberId>
<ipAddress>192.168.101.102</ipAddress>
<weight>1</weight>
<port>80</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m2</name>
</member>
</pool>
<pool>

VMware, Inc.

185

vShield API Programming Guide

<poolId>pool-2</poolId>
<name>pool-backup</name>
<description>pool backup</description>
<transparent>false</transparent>
<algorithm>round-robin</algorithm>
<monitorId>monitor-1</monitorId>
<member>
<memberId>member-3</memberId>
<ipAddress>192.168.102.101</ipAddress>
<weight>1</weight>
<port>80</port>
<name>m3</name>
</member>
<member>
<memberId>member-4</memberId>
<ipAddress>192.168.102.102</ipAddress>
<weight>1</weight>
<port>80</port>
<name>m4</name>
</member>
</pool>
<monitor>
<monitorId>monitor-1</monitorId>
<type>http</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<method>GET</method>
<url>/</url>
<name>http-monitor</name>
</monitor>
</loadBalancer>

Forthedatapathtowork,youneedtoaddfirewallrulestoallowrequiredtrafficaspertheloadbalancer
configuration.

Query Load Balancer Configuration


Getscurrentloadbalancerconfiguration.
Example 8-62. Retrieve load balancer configuration
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config

ResponseBody:
SeeExample 861.

Delete Load Balancer Configuration


Example 8-63. Delete load balancer configuration
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config

186

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Manage Application profiles


Youcreateanapplicationprofiletodefinethebehaviorofaparticulartypeofnetworktraffic.After
configuringaprofile,youassociatetheprofilewithavirtualserver.Thevirtualserverthenprocessestraffic
accordingtothevaluesspecifiedintheprofile.Usingprofilesenhancesyourcontrolovermanagingnetwork
traffic,andmakestrafficmanagementtaskseasierandmoreefficient.

Append Application Profile


Addsanapplicationprofile.
Example 8-64. Append profile
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationprofiles

RequestBody:
<applicationProfile>
<name>http_application_profile_2</name>
<insertXForwardedFor>true</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
<persistence>
<method>cookie</method>
<cookieName>JSESSIONID</cookieName>
<cookieMode>insert</cookieMode>
</persistence>
</applicationProfile>

Modify Application Profile


Modifiesanapplicationprofile.
Example 8-65. Modify profile
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationprofiles/{applicationProfileId}

RequestBody:
<applicationProfile>
<name>http_application_profile_2</name>
<insertXForwardedFor>true</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
<persistence>
<method>cookie</method>
<cookieName>JSESSIONID</cookieName>
<cookieMode>insert</cookieMode>
</persistence>
</applicationProfile>

Query Application Profile


Retrievesanapplicationprofile.
Example 8-66. Query profile
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationprofiles/{applicationProfileId}

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>

VMware, Inc.

187

vShield API Programming Guide

<applicationProfile>
<applicationProfileId>applicationProfile-5</applicationProfileId>
<persistence>
<method>cookie</method>
<cookieName>JSESSIONID</cookieName>
<cookieMode>insert</cookieMode>
</persistence>
<name>http_application_profile_2</name>
<insertXForwardedFor>true</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
</applicationProfile>

Query all Application Profiles


RetrievesallapplicationprofilesonEdge.
Example 8-67. Query profiles
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationprofiles/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<loadBalancer>
<applicationProfile>
<applicationProfileId>applicationProfile-1</applicationProfileId>
<persistence>
<method>cookie</method>
<cookieName>JSESSIONID</cookieName>
<cookieMode>insert</cookieMode>
</persistence>
<name>http_application_profile</name>
<insertXForwardedFor>true</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
</applicationProfile>
<applicationProfile>
<applicationProfileId>applicationProfile-2</applicationProfileId>
<persistence>
<method>ssl_sessionid</method>
</persistence>
<name>https_application_profile</name>
<insertXForwardedFor>true</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
</applicationProfile>
<applicationProfile>
<applicationProfileId>applicationProfile-3</applicationProfileId>
<name>tcp_application_profile</name>
<insertXForwardedFor>false</insertXForwardedFor>
<sslPassthrough>true</sslPassthrough>
</applicationProfile>
</loadBalancer>

Delete Application Profile


Deletesanapplicationprofile.
Example 8-68. Delete profile
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationprofiles/{applicationProfileId}

188

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Delete all Application Profiles


Deletesallapplicationprofile.
Example 8-69. Delete profiles
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationprofiles

Manage Application Rules


You can write an application rule to directly manipulate and manage IP application traffic.

Append Application Rule


Addsanapplicationrule.
Example 8-70. Append rule
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationrules

RequestBody:
<applicationRule>
<name>redirection_rule</name>
<script>acl vmware_page url_beg /vmware
redirect location https://www.vmware.com/ if vmware_page</script>
</applicationRule>

Modify Application Rule


Modifiesanapplicationrule.
Example 8-71. Modify rule
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationrules/{applicationruleId}

RequestBody:
See Example 8-70.

Query Application Rule


Retrievesanapplicationrule.
Example 8-72. Query rule
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationrules/{applicationruleId}

ResponseBody:
See Example 8-70.

Query all Application Rules


RetrievesallapplicationrulesonEdge.
VMware, Inc.

189

vShield API Programming Guide

Example 8-73. Query rules


Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationrules/{applicationruleId}

Delete Application Rule


Deletesanapplicationrule.
Example 8-74. Delete rule
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationrules/{applicationruleId}

Delete all Application Rules


Deletesallapplicationrules.
Example 8-75. Delete rules
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/applicationrules

Manage Load Balancer Monitors


Youcreateaservicemonitortodefinehealthcheckparametersforaparticulartypeofnetworktraffic.When
youassociateaservicemonitorwithapool,thepoolmembersaremonitoredaccordingtotheservicemonitor
parameters.

Append Monitor
Addsaloadbalancermonitor.
Example 8-76. Append monitor
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/monitors

RequestBody:
<monitor>
<type>http</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<method>GET</method>
<url>/</url>
<name>http-monitor-2</name>
</monitor>

Modify Monitor
Modifiesaloadbalancermonitor.
Example 8-77. Modify monitor
Request:
190

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/monitors/{monitorId}

RequestBody:
<monitor>
<type>http</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<method>GET</method>
<url>/</url>
<name>http-monitor-2</name>
</monitor>

Query Monitor
Retrievesaloadbalancermonitor.
Example 8-78. Query monitor
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/monitors{monitorId}

ResponseBody:
<monitor>
<type>http</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<method>GET</method>
<url>/</url>
<name>http-monitor-2</name>
</monitor>

Query all Monitors


Retrievesallloadbalancermonitors.
Example 8-79. Query monitors
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/monitors

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<loadBalancer>
<monitor>
<monitorId>monitor-1</monitorId>
<type>http</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<method>GET</method>
<url>/</url>
<name>http-monitor</name>
</monitor>
<monitor>
<monitorId>monitor-2</monitorId>
<type>https</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<method>GET</method>
<url>/</url>

VMware, Inc.

191

vShield API Programming Guide

<name>https-monitor</name>
</monitor>
<monitor>
<monitorId>monitor-3</monitorId>
<type>tcp</type>
<interval>5</interval>
<timeout>15</timeout>
<maxRetries>3</maxRetries>
<name>tcp-monitor</name>
</monitor>
</loadBalancer>

Delete Monitor
Deletesaloadbalancermonitor.
Example 8-80. Delete monitor
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/monitors/{monitorId}

Delete all Monitors


Deletesallloadbalancermonitors.
Example 8-81. Delete monitors
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/monitors

Manage Virtual Servers


You can add an NSX Edge internal or uplink interface as a virtual server.

Append Virtual Server


Addsavirtualserver.
Example 8-82. Append virtual server
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/virtualservers

RequestBody:
<virtualServer>
<name>http_vip_2</name>
<description>http virtualServer 2</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>http</protocol>
<port>82</port>
<connectionLimit>123</connectionLimit>
<connectionRateLimit>123</connectionRateLimit>
<applicationProfileId>applicationProfile-1</applicationProfileId>
<defaultPoolId>pool-1</defaultPoolId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>

192

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Query a Virtual Server


Retrievesspecifiedvirtualserverdetails.
Example 8-83. Query virtual server
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/virtualservers/virtualserverID

ResponseBody:
SeeExample 882.

Query all Virtual Servers


Retrievesallvirtualservers.
Example 8-84. Query virtual servers
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/virtualservers

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<loadBalancer>
<virtualServer>
<virtualServerId>virtualServer-1</virtualServerId>
<name>http_vip</name>
<description>http virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>http</protocol>
<port>80</port>
<connectionLimit>123</connectionLimit>
<connectionRateLimit>123</connectionRateLimit>
<defaultPoolId>pool-1</defaultPoolId>
<applicationProfileId>applicationProfile-1</applicationProfileId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>
<virtualServer>
<virtualServerId>virtualServer-2</virtualServerId>
<name>https_vip</name>
<description>https virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>https</protocol>
<port>443</port>
<connectionLimit>123</connectionLimit>
<connectionRateLimit>123</connectionRateLimit>
<defaultPoolId>pool-2</defaultPoolId>
<applicationProfileId>applicationProfile-2</applicationProfileId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>false</accelerationEnabled>
</virtualServer>
<virtualServer>
<virtualServerId>virtualServer-3</virtualServerId>
<name>tcp_transparent_vip</name>
<description>tcp virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>tcp</protocol>
<port>1234</port>
<connectionLimit>123</connectionLimit>

VMware, Inc.

193

vShield API Programming Guide

<defaultPoolId>pool-3</defaultPoolId>
<applicationProfileId>applicationProfile-3</applicationProfileId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>
<virtualServer>
<virtualServerId>virtualServer-4</virtualServerId>
<name>tcp_snat_vip</name>
<description>tcp snat virtualServer</description>
<enabled>true</enabled>
<ipAddress>10.117.35.172</ipAddress>
<protocol>tcp</protocol>
<port>1235</port>
<connectionLimit>123</connectionLimit>
<defaultPoolId>pool-4</defaultPoolId>
<applicationProfileId>applicationProfile-3</applicationProfileId>
<enableServiceInsertion>false</enableServiceInsertion>
<accelerationEnabled>true</accelerationEnabled>
</virtualServer>
</loadBalancer>

Delete a Virtual Server


Deletesspecifiedvirtualserver.
Example 8-85. Delete virtual server
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/virtualservers/virtualserverID

Delete all Virtual Server


Deletesallvirtualservers.
Example 8-86. Delete all virtual server
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/virtualservers

Manage Backend Pools


Youcanaddaserverpooltomanageandsharebackendserversflexiblyandefficiently.Apoolmanagesload
balancerdistributionmethodsandhasaservicemonitorattachedtoitforhealthcheckparameters.

Append Backend Pool


AddsaloadbalancerserverpooltothespecifiedNSXEdge.
Example 8-87. Append backend pool
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/pools

RequestBody:
<pool>
<name>pool-tcp-snat-2</name>
<description>pool-tcp-snat-2</description>
<transparent>false</transparent>
<algorithm>round-robin</algorithm>

194

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<monitorId>monitor-3</monitorId>
<member>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m5</name>
<monitorPort>80</monitorPort>
</member>
<member>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m6</name>
<monitorPort>80</monitorPort>
</member>
</pool>

Modify a Backend Pool


Updatesthespecifiedpool.
Example 8-88. Modify backend pool
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/pools/poolID

RequestBody:
<pool>
<name>pool-tcp-snat-2</name>
<description>pool-tcp-snat-3</description>
<transparent>false</transparent>
<algorithm>round-robin</algorithm>
<monitorId>monitor-3</monitorId>
<member>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m5</name>
<monitorPort>80</monitorPort>
</member>
<member>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>1234</port>
<minConn>10</minConn>
<maxConn>100</maxConn>
<name>m6</name>
<monitorPort>80</monitorPort>
</member>
</pool>

Query Backend Pool Details


Retrievesinformationaboutthespecifiedpool.

VMware, Inc.

195

vShield API Programming Guide

Example 8-89. Get backend pool details


Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/pools/poolID

ResponseBody:
See Example Example 8-88.

Query all Backend Pools


GetsallbackendpoolsconfiguredforthespecifiedNSXEdge.
Example 8-90. Query all backend pools
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/pools

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<loadBalancer>
<pool>
<type>slb</type>
<poolId>pool-1</poolId>
<name>pool-http</name>
<description>pool-http</description>
<algorithm>round-robin</algorithm>
<transparent>true</transparent>
<monitorId>monitor-1</monitorId>
<member>
<memberId>member-1</memberId>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<port>80</port>
<maxConn>100</maxConn>
<minConn>10</minConn>
<condition>enabled</condition>
<name>m1</name>
</member>
<member>
<memberId>member-2</memberId>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>80</port>
<maxConn>100</maxConn>
<minConn>10</minConn>
<condition>enabled</condition>
<name>m2</name>
</member>
</pool>
<pool>
<type>slb</type>
<poolId>pool-2</poolId>
<name>pool-https</name>
<description>pool-https</description>
<algorithm>round-robin</algorithm>
<transparent>false</transparent>
<monitorId>monitor-2</monitorId>
<member>
<memberId>member-11</memberId>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<port>443</port>
<maxConn>100</maxConn>

196

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<minConn>10</minConn>
<condition>enabled</condition>
<name>m3</name>
</member>
<member>
<memberId>member-4</memberId>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<port>443</port>
<maxConn>100</maxConn>
<minConn>10</minConn>
<condition>enabled</condition>
<name>m4</name>
</member>
</pool>
<pool>
<type>slb</type>
<poolId>pool-3</poolId>
<name>pool-tcp</name>
<description>pool-tcp</description>
<algorithm>round-robin</algorithm>
<transparent>true</transparent>
<monitorId>monitor-3</monitorId>
<member>
<memberId>member-5</memberId>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<monitorPort>80</monitorPort>
<port>1234</port>
<maxConn>100</maxConn>
<minConn>10</minConn>
<condition>enabled</condition>
<name>m5</name>
</member>
<member>
<memberId>member-6</memberId>
<ipAddress>192.168.101.202</ipAddress>
<weight>1</weight>
<monitorPort>80</monitorPort>
<port>1234</port>
<maxConn>100</maxConn>
<minConn>10</minConn>
<condition>enabled</condition>
<name>m6</name>
</member>
</pool>
<pool>
<type>slb</type>
<poolId>pool-4</poolId>
<name>pool-tcp-snat</name>
<description>pool-tcp-snat</description>
<algorithm>round-robin</algorithm>
<transparent>false</transparent>
<monitorId>monitor-3</monitorId>
<member>
<memberId>member-7</memberId>
<ipAddress>192.168.101.201</ipAddress>
<weight>1</weight>
<monitorPort>80</monitorPort>
<port>1234</port>
<maxConn>100</maxConn>
<minConn>10</minConn>
<condition>enabled</condition>
<name>m7</name>
</member>
<member>
<memberId>member-8</memberId>
<ipAddress>192.168.101.202</ipAddress>

VMware, Inc.

197

vShield API Programming Guide

<weight>1</weight>
<monitorPort>80</monitorPort>
<port>1234</port>
<maxConn>100</maxConn>
<minConn>10</minConn>
<condition>enabled</condition>
<name>m8</name>
</member>
</pool>
</loadBalancer>

Delete a Backend Pool


Deletesthespecifiedpool.
Example 8-91. Delete backend pool
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/pools/poolID

Delete all Backend Pools


DeletesallbackendpoolsconfiguredforthespecifiedNSXEdge.
Example 8-92. Delete backend pool
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/config/pools

Query Statistics
Retrievesloadbalancerstatistics.
Example 8-93. Retrieve load balancer statistics
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/loadbalancer/statistics

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<loadBalancerStatusAndStats>
<timeStamp>1359722922</timeStamp>
<pool>
<poolId>pool-1</poolId>
<name>pool-http</name>
<member>
<memberId>member-1</memberId>
<name>m1</name>
<ipAddress>192.168.101.201</ipAddress>
<status>UP</status>
<bytesIn>70771</bytesIn>
<bytesOut>74619</bytesOut>
<curSessions>0</curSessions>
<maxSessions>1</maxSessions>
<rate>0</rate>
<rateMax>17</rateMax>
<totalSessions>142</totalSessions>
</member>
<member>

198

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<memberId>member-2</memberId>
<name>m2</name>
<ipAddress>192.168.101.202</ipAddress>
<status>UP</status>
<bytesIn>70823</bytesIn>
<bytesOut>70605</bytesOut>
<curSessions>0</curSessions>
<maxSessions>1</maxSessions>
<rate>0</rate>
<rateMax>17</rateMax>
<totalSessions>141</totalSessions>
</member>
<status>UP</status>
<bytesIn>141594</bytesIn>
<bytesOut>145224</bytesOut>
<curSessions>0</curSessions>
<maxSessions>2</maxSessions>
<rate>0</rate>
<rateMax>34</rateMax>
<totalSessions>283</totalSessions>
</pool>
<virtualServer>
<virtualServerId>virtualServer-9</virtualServerId>
<name>http_vip</name>
<ipAddress>10.117.35.172</ipAddress>
<status>OPEN</status>
<bytesIn>141594</bytesIn>
<bytesOut>145224</bytesOut>
<curSessions>1</curSessions>
<httpReqTotal>283</httpReqTotal>
<httpReqRate>0</httpReqRate>
<httpReqRateMax>34</httpReqRateMax>
<maxSessions>2</maxSessions>
<rate>0</rate>
<rateLimit>0</rateLimit>
<rateMax>2</rateMax>
<totalSessions>13</totalSessions>
</virtualServer>
<globalSite>
<name>BJ site</name>
<globalSiteId>site-3</globalSiteId>
<msgSent>3</msgSent>
<msgRecv>747</msgRecv>
<msgRate>0</msgRate>
<dnsReq>0</dnsReq>
<dnsResolved>0</dnsResolved>
</globalSite>
<globalIp>
<fqdn>www.company.com</fqdn>
<globalIpId>gip-3</globalIpId>
<dnsReq>0</dnsReq>
<dnsResolved>0</dnsResolved>
<dnsMiss>0</dnsMiss>
</globalIp>
<globalPool>
<name>www-primary</name>
<poolId>pool-1</poolId>
<dnsReq>0</dnsReq>
<dnsResolved>0</dnsResolved>
<dnsMiss>0</dnsMiss>
<member>
<name>10.117.7.110</name>
<memberId>member-3</memberId>
<status>up</status>
<dnsHit>0</dnsHit>
<cpuUsage>3</cpuUsage>
<memUsage>91</memUsage>
<sessions>0</sessions>

VMware, Inc.

199

vShield API Programming Guide

<curConn>14</curConn>
<sessLimit>0</sessLimit>
<sessRate>0</sessRate>
<totalThroughput>0</totalThroughput>
<packagesPerSec>0</packagesPerSec>
</member>
</globalPool>
<globalPool>
<name>www-primary</name>
<poolId>pool-1</poolId>
<dnsReq>0</dnsReq>
<dnsResolved>0</dnsResolved>
<dnsMiss>0</dnsMiss>
<member>
<name>10.117.7.110</name>
<memberId>member-3</memberId>
<status>up</status>
<dnsHit>0</dnsHit>
<cpuUsage>3</cpuUsage>
<memUsage>91</memUsage>
<sessions>0</sessions>
<curConn>14</curConn>
<sessLimit>0</sessLimit>
<sessRate>0</sessRate>
<totalThroughput>0</totalThroughput>
<packagesPerSec>0</packagesPerSec>
</member>
</globalPool>
</loadBalancerStatusAndStats>

Update LoadBalancer Acceleration Mode


Example 8-94. Update acceleration mode
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId/loadbalancer/acceleration?enable=true/false

Update Load Balancer Member Condition


Example 8-95. Update member condition
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId/loadbalancer/config/members/{memberId}?enable=true/false

Working with DHCP


NSXEdgeprovidesDHCPservicetobindassignedIPaddressestoMACaddresses,helpingtopreventMAC
spoofingattacks.AllvirtualmachinesprotectedbyaNSXEdgecanobtainIPaddressesdynamicallyfromthe
NSXEdgeDHCPservice.
NSXEdgesupportsIPaddresspoolingandonetoonestaticIPaddressallocationbasedonthevCenter
managedobjectID(vmId)andinterfaceID(interfaceId)oftherequestingclient.
IfeitherbindingsorpoolsarenotincludedinthePUTcall,existingbindingsorpoolsaredeleted.
AllDHCPsettingsconfiguredbyRESTrequestsappearundertheNSXEdge>DHCPtabfortheappropriate
NSXEdgeintheNSXManageruserinterfaceandinvSphereClientplugin.
NSXEdgeDHCPserviceadherestothefollowingrules:

200

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

ListensontheNSXEdgeinternalinterface(nonuplinkinterface)forDHCPdiscovery.

Asstatedabove,vmIdspecifiesthevc-moref-idofthevirtualmachine,andvnicIdspecifiestheindexofthe
vNicfortherequestingclient.Thehostnameisanidentificationofthebindingbeingcreated.ThishostName
isnotpushedasthespecifiedhostnameofthevirtualmachine.

Bydefault,allclientsusetheIPaddressoftheinternalinterfaceoftheNSXEdgeasthedefaultgateway
address.Tooverrideit,specifydefaultGatewayperbindingorperpool.Theclientsbroadcastand
subnetMaskvaluesarefromtheinternalinterfaceforthecontainernetwork.

leaseTimecanbeinfinite,oranumberofseconds.Ifnotspecified,thedefaultleasetimeis1day.

Loggingisdisabledbydefault.

Settingtheparameterenable=truestartstheDHCPservicewhileenable=falsestopstheservice.

BothstaticBindingandipPoolsmustbepartoftherequestbody.Else,theywillbedeletedifconfigured
earlier.

Configure DHCP
Example 8-96. Configure DHCP service
PUT https://<vsm-ip>/api/4.0/<edgeId>/dhcp/config

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<dhcp>
<enabled>true</enabled> <!-- optional, default is "true". -->
<staticBindings>
<staticBinding>
<!-- NOTE: user can either specify macAddress directly, or specify vmId and vnicId.
In case both are specified, only macAddress will be used; vmId and vnicId
will be ignored.-->
<macAddress>12:34:56:78:90:AB</macAddress> <!-- optional. -->
<vmId>vm-111</vmId> <!-- optional. the vm must be connected to the given vNic below. -->
<vnicId>1</vnicId> <!-- optional. possible values 0 to 9 -->
<hostname>abcd</hostname> <!-- optional. disallow duplicate. the -->
<ipAddress>192.168.4.2</ipAddress> <!-- required. the IP must belongs to one subnet of edge vNics,
but must NOT overlap any primary/secondary ips of defined explicitly in vNic. -->
<defaultGateway>192.168.4.1</defaultGateway> <!-- optional. default is the primary ip of the belonging vNic.-->
<domainName>eng.vmware.com</domainName> <!-- optional. -->
<primaryNameServer>192.168.4.1</primaryNameServer> <!-- optional. if autoConfigDNS=true, the DNS
primary/secondary ips will be generated from DNS service(if configured). -->
<secondaryNameServer>4.2.2.4</secondaryNameServer> <!-- ditto. -->
<leaseTime>infinite</leaseTime> <!-- optional. in second, default is "86400". valid leaseTime
is a valid digit, or "infinite". -->
<autoConfigDNS>true</autpConfigDNS> <!-- optional. default is true. -->
</staticBinding>
</staticBindings>
<ipPools>
<ipPool>
<ipRange>192.168.4.192-192.168.4.220</ipRange> <!-- required. the ipRange must belongs to one of
a subnet of Edge vNics. And can NOT contains any ip that defined explicitly as vNic
primary ip or secondary ip. -->
<defaultGateway>192.168.4.1</defaultGateway> <!-- optional. default is the primary ip of the belonging vNic.-->
<domainName>eng.vmware.com</domainName> <!-- optional. -->
<primaryNameServer>192.168.4.1</primaryNameServer> <!-- optional. if autoConfigDNS=true, the dns
primary/secondary ips will be generated from DNS service(if configured). -->
<secondaryNameServer>4.2.2.4</secondaryNameServer> <!-- ditto. -->
<leaseTime>3600</leaseTime> <!-- optional. in second, default is "86400". valid leaseTime is a valid
digit, or "infinite". -->
<autoConfigDNS>true</autoConfigDNS> <!-- optional. default is true. -->
</ipPool>
</ipPools>
<logging> <!-- optional. logging is disable by default. -->
<enable>false</enable> <!-- optional, default is false. -->

VMware, Inc.

201

vShield API Programming Guide

<logLevel>info</logLevel> <!-- optional, default is "info". -->


</logging>
</dhcp>

NOTEIftheNSXEdgeautoConfiguration flagandautoConfigureDNS istrue,andtheprimaryNameServeror


secondaryNameServerparametersarenotspecified,NSXManagerappliestheDNSsettingstotheDHCP
configuration.

Query DHCP Configuration


GetstheDHCPconfigurationonaNSXEdgeincludingIPpoolandstaticbindingassignments.
Example 8-97. Get DHCP configuration
GET https://<vsm-ip>/api/4.0/<edgeId>/dhcp/config

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<dhcp>
<enabled>true</enabled>
<staticBindings>
<staticBinding>
<vmId>vm-111</vmId>
<vnicId>1</vnicId>
<hostname>abcd</hostname>
<ipAddress>192.168.4.2</ipAddress>
<defaultGateway>192.168.4.1</defaultGateway>
<domainName>eng.vmware.com</domainName>
<primaryNameServer>192.168.4.1</primaryNameServer>
<secondaryNameServer>4.2.2.4</secondaryNameServer>
<leaseTime>infinite</leaseTime>
<autoConfigureDNS>true</autoConfigureDNS>
</staticBinding>
</staticBindings>
<ipPools>
<ipPool>
<ipRange>192.168.4.192-192.168.4.220</ipRange>
<defaultGateway>192.168.4.1</defaultGateway>
<domainName>eng.vmware.com</domainName>
<primaryNameServer>192.168.4.1</primaryNameServer>
<secondaryNameServer>4.2.2.4</secondaryNameServer>
<leaseTime>3600</leaseTime>
<autoConfigureDNS>true</autoConfigureDNS>
</ipPool>
</ipPools>
<logging>
<enable>false</enable>
<logLevel>info</logLevel>
</logging>
</dhcp>

Delete DHCP Configuration


DeletestheDHCPconfigurationandreversetheconfigurationbacktofactorydefaults.
Example 8-98. Delete DHCP configuration
Request:
DELETE https://<vsm-ip>/api/4.0/<edgeId>/dhcp/config

202

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Retrieve DHCP Lease Information


Example 8-99. Get DHCP lease information
GET https://<vsm-ip>/api/4.0/<edgeId>/dhcp/leaseinfo

ResponseBody:
<dhcpLeases>
<timeStamp>1326950787</timeStamp>
<dhcpLeaseInfo>
<leaseInfo>
<uid>\001\000PV\265\204\207</uid>
<macAddress>00:50:56:b5:84:87</macAddress>
<ipAddress>192.168.4.2</ipAddress>
<clientHostname>vto-suse-dev</clientHostname>
<bindingState>active</bindingState>
<nextBindingState>free</nextBindingState>
<cltt>4 2012/01/19 05:24:50</cltt>
<starts>4 2012/01/19 05:24:50</starts>
<ends>4 2012/01/19 17:24:50</ends>
<hardwareType>ethernet</hardwareType>
</leaseInfo>
</dhcpLeaseInfo>
</dhcp>

Append IP Pool to DHCP Configuration


AppendsanIPpooltotheDHCPconfiguration.ReturnsapoolIDwithinaLocationHTTPheader.
Example 8-100. Add IP pool
POST https://<vsm-ip>/api/4.0/<edgeId>/dhcp/config/ippools

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<ipPool>
<ipRange>192.168.5.2-192.168.5.20</ipRange>
<defaultGateway>192.168.5.1</defaultGateway>
<domainName>eng.vmware.com</domainName>
<primaryNameServer>1.2.3.4</primaryNameServer>
<secondaryNameServer>4.3.2.1</secondaryNameServer>
<leaseTime>3600</leaseTime>
<autoConfigureDNS>true</autoConfigureDNS>
</ipPool>

Append Static Binding to DHCP Configuration


AppendsastaticbindingtotheDHCPconfiguration.AstaticbindingIDisreturnedwithinaLocationHTTP
header.
Example 8-101. Add static binding
POST https://<vsm-ip>/api/4.0/<edgeId>/dhcp/config/bindings

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<staticBinding>
<vmId>vm-157</vmId>
<vnicId>3</vnicId> <!-- possible values 0 to 9 -->
<hostname>vShield-edge-2-0</hostname>
<ipAddress>192.168.6.66</ipAddress>
<defaultGateway>192.168.6.1</defaultGateway>
<domainName>eng.vmware.com</domainName>
<primaryNameServer>1.2.3.4</primaryNameServer>

VMware, Inc.

203

vShield API Programming Guide

<secondaryNameServer>4.3.2.1</secondaryNameServer>
<leaseTime>infinite</leaseTime>
<autoConfigureDNS>true</autoConfigureDNS>
</staticBinding>

Delete DHCP Pool


Deletesapoolspecifiedbypoolid.
Example 8-102. Delete DHCP pool
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/dhcp/config/ippools/<poolId>

Delete DHCP Static Binding


Deletesthestaticbindingspecifiedbybindingid.
Example 8-103. Delete DHCP static binding
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/dhcp/config/bindings/<bindingId>

Working with High Availability (HA)


HighAvailability(HA)ensuresthataNSXEdgeapplianceisalwaysavailableonyourvirtualizednetwork.
YoucanenableHAeitherwheninstallingNSXEdgeoronaninstalledNSXEdgeinstance.
IfasingleapplianceisassociatedwithNSXEdge,theapplianceconfigurationisclonedforthestandby
appliance.IftwoappliancesareassociatedwithNSXEdgeandoneofthemisdeployed,thisRESTcalldeploys
theremainingapplianceandpushHAconfigurationtoboth.
HAreliesonaninternalinterface.Ifaninternalinterfacedoesnotexist,thiscallwillnotdeploythesecondary
appliance,orpushHAconfigtoappliance.TheenablingofHAwillbedoneonceanavailableinternal
interfaceisadded.
IfthePUTcallincludesanemptyxml<highAvailability />orenabled=false,itactsasaDELETEcall.
Example 8-104. Configure high availability
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/highavailability/config

RequestBody:
<highAvailability>
<vnic>1</vnic> <!-- Optional. User can provide the vNic Index. If not provided, the first internal-connected vnic will be used as
the vnic -->
<ipAddresses> <!-- Optional. It is a pair of ipAddresses with /30 subnet mandatory, one for each appliance. If provided, they
must NOT overlap with any subnet defined on the Edge vNics. If not specified, a pair of ips will be picked
up from reserved subnet 169.254.0.0/16. -->
<ipAddress>192.168.10.1/30</ipAddress>
<ipAddress>192.168.10.2/30</ipAddress>
</ipAddresses>
<declareDeadTime>6</declareDeadTime> <!-- Optional. Default is 6 seconds -->
<enabled>true<enabled> <!-- optional, defaults to true. The enabled flag will cause the HA appliance be deployed or
destroyed. -->
</highAvailability>

204

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Retrieve High Availability Configuration


Example 8-105. Get high availability configuration
Request:api/
GET https://<vsm-ip>/4.0/edges/<edgeId>/highavailability/config

RequestBody:
<highAvailability>
<vnic>1</vnic>
<ipAddresses>
<ipAddress>192.168.10.1/30</ipAddress>
<ipAddress>192.168.10.2/30</ipAddress>
</ipAddresses>
<declareDeadTime>6</declareDeadTime> <!-- Optional. Default is 6 seconds -->
</highAvailability>

Delete High Availability Configuration


NSXManagerdeletesthestandbyapplianceandremovestheHAconfigfromtheactiveappliance.
YoucanalsodeletetheHAconfigurationbyusingaPUTcallwithemptyxml<highAvailability/>orwith
<highAvailability><enabled>false</enabled></highAvailability>.
Example 8-106. Delete high availability configuration
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/highavailability/config

Working with Syslog


Youcanconfigureoneortworemotesyslogservers.NSXEdgeeventsandlogsrelatedtofirewalleventsthat
flowfromNSXEdgeappliancesaresenttothesyslogservers.

Configure Syslog
Configuressyslogservers.
Example 8-107. Configure syslog servers
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/syslog/config

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<syslog>
<protocol>udp</protocol>
<!-- Optional. Default is "udp". Valid values : tcp|udp -->
<serverAddresses>
<!-- Maximum 2 remote IPs can be configured. -->
<ipAddress>1.1.1.1</ipAddress>
<ipAddress>1.1.1.2</ipAddress>
</serverAddresses>
</syslog>

Query Syslog
Retrievessyslogserverinformation.

VMware, Inc.

205

vShield API Programming Guide

Example 8-108. Query syslog servers


Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/syslog/config

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<syslog>
<protocol>udp</protocol>
<!-- Optional. Default is "udp". Valid values : tcp|udp -->
<serverAddresses>
<!-- Maximum 2 remote IPs can be configured. -->
<ipAddress>1.1.1.1</ipAddress>
<ipAddress>1.1.1.2</ipAddress>
</serverAddresses>
</syslog>

Delete Syslog
Deletessyslogservers.
Example 8-109. Delete syslog servers
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/syslog/config

Managing SSL VPN


WithSSLVPNPlus,remoteuserscanconnectsecurelytoprivatenetworksbehindaNSXEdgegateway.
Remoteuserscanaccessserversandapplicationsintheprivatenetworks.

Enable or Disable SSL VPN


EnablesordisablesSSLVPNontheNSXEdgeappliance.
Example 8-110. Enable or disable SSL VPN
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/?enableService=true|False

Query SSL VPN Details


RetrievesSSLVPNdetails.
Example 8-111. Get SSL VPN details
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/

Manage Server Settings


Apply Server Settings
ConfiguresSSLVPNserveronport443usingthecertificatenamedservercertthatisalreadyuploadedonthe
NSXEdgeapplianceandthespecifiedcipher.

206

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-112. Apply server settings


Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/server/

RequestBody:
<?xml version="1.0" encoding=UTF-8?>
<serverSettings>
<serverAddresses>
<ipAddress>10.112.243.109</ipAddress> <!-- Ipv4 or IPV6 address of any of the external vnic. ipv4 and ipv6 both can not
configured. -->
</serverAddresses>
<port>443</port> <!--optional. Default is 60003 -->
<!-- Certificate has to be generated using certificate REST API and id returned should be mentioned here-->
<!-- <certificateId>certificate-1</certificateId> --> <!-- optional. -->
<cipherList>
<!-- any one or more of the following ciphers can be part of configuration -->
<!RC4-MD5|AES128-SHA|AES256-SHA|DES-CBC3-SHA-->
<cipher>RC4-MD5</cipher>
<cipher>AES128-SHA</cipher>
<cipher>AES256-SHA</cipher>
<cipher>DES-CBC3-SHA</cipher>
</cipherList>
</serverSettings>

Query Server Settings


Getsserversettings.
Example 8-113. Apply server settings
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/server/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<serverSettings>
<serverAddresses>
<ipAddress>10.110.12.249</ipAddress>
</serverAddresses>
<port>60003</port>
<certificateId>certificate-1</certificateId>
<cipherList>
<cipher>RC4-MD5</cipher>
</cipherList>
</serverSettings>

Configure Private Networks


Add Private Network
ConfiguresaprivatenetworkthattheadministratorwantstoexposetoremoteusersovertheSSLVPNtunnel.
Example 8-114. Add private network
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/privatenetworks/

RequestBody:
<?xml version="1.0" encoding=UTF-8?>

VMware, Inc.

207

vShield API Programming Guide

<privateNetwork>
<description>This is a private network for UI-team</description>
<network>192.168.1.0/24</network>
<sendOverTunnel>
<!--optional. -->
<ports>20-40</ports>
<!-- optional. Default is 0-0 -->
<optimize>false</optimize> <!--optional. Default is true -->
</sendOverTunnel>
<enabled>true</enabled>
<!--optional. Default is true-->
</privateNetwork>

Modify Private Network


ModifiesthespecifiedprivatenetworkintheSSLVPNserviceonNSXEdge.
Example 8-115. Add private network
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/privatenetworks/privateNetworkID

RequestBody:
<?xml version="1.0" encoding=UTF-8?>
<privateNetwork>
<description>This is a private network for UI-team</description>
<network>192.168.1.0/24</network>
<sendOverTunnel>
<ports>20-40</ports>
<optimize>false</optimize>
</sendOverTunnel>
<enabled>true</enabled>
</privateNetwork>

Query Specific Private Network


GetsthespecifiedprivatenetworkprofileintheSSLVPNinstanceonNSXEdge.
Example 8-116. Query private network
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/privatenetworks/privateNetworkID

RequestBody:
<?xml version="1.0" encoding=UTF-8?>
<privateNetwork>
<description>This is a private network for UI-team</description>
<network>192.168.1.0/24</network>
<sendOverTunnel>
<ports>20-40</ports>
<optimize>false</optimize>
</sendOverTunnel>
<enabled>true</enabled>
</privateNetwork>

Query all Private Networks


GetsallprivatenetworkprofilesintheSSLVPNinstanceonNSXEdge.
Example 8-117. Query private network
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/privatenetworks/

208

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

RequestBody:
<?xml version="1.0" encoding=UTF-8?>
<privateNetwork>
<privateNetwork>
<onjectId>privatenetwork-1</objectId>
<description>This is a private network for pune-qa-team</description>
<network>192.168.1.0/24</network>
<sendOverTunnel>
<ports>10-20</ports>
<optimize>true</optimize>
</sendOverTunnel>
<enabled>true</enabled>
</privateNetwork>
</privateNetwork>

Delete Private Network


DeletesthespecifieddynamicIPaddressconfigurationfromtheSSLVPNinstanceonNSXEdge.
Example 8-118. Delete private network
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
privatenetworks/privatenetworkID

Delete all Private Networks


DeletesalldynamicIPaddressconfigurationsfromtheSSLVPNinstanceonNSXEdge.
Example 8-119. Delete private network
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
privatenetworks/

Apply All Private Networks


UpdatesallprivatenetworkconfigurationsofNSXEdgewiththegivenlistofprivatenetworkconfigurations.
Iftheconfigurationispresent,itisupdated;ifitisnotpresent,anewprivatenetworkconfigurationiscreated.
ExistingconfigurationsnotincludedintheRESTcallaredeleted.
Example 8-120. Apply all private networks
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
privatenetworks/

Configure Web Resource


Add Portal Web Resource
Adds a web access server that the remote user can connect to via a web browser.
Example 8-121. Add portal web resource
Request:

VMware, Inc.

209

vShield API Programming Guide

POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/webresources/

RequestBody:
<?xml version="1.0" encoding=UTF-8?>
<webResource>
<name>VMware</name>
<url>http://www.vmware.com</url>
<method name="POST">
<data>username=stalin </data>
</method>
<description>Click here to visit the corporate intranet Homepage </description>
<enabled>true</enabled>
<!--optional. Default is true-->
</webResource>

Modify Portal Web Resource


Modifies the specified web access server.
Example 8-122. Modify portal web resource
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/webresources/ID

RequestBody:
<?xml version="1.0" encoding=UTF-8?>
<webResource>
<name>VMware</name>
<url>http://www.vmware.com</url>
<method name="POST">
<data>username=stalin </data>
</method>
<description>Click here to visit the corporate intranet Homepage </description>
<enabled>true</enabled>
<!--optional. Default is true-->
</webResource>

Query Portal Web Resource


Gets the specified web access server.
Example 8-123. Get specific portal web resource
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/webresources/ID

ResponseBody:
<?xml version="1.0" encoding=UTF-8?>
<webResource>
<name>VMware</name>
<url>http://www.vmware.com</url>
<method name="POST">
<data>username=stalin </data>
</method>
<description>Click here to visit the corporate intranet Homepage </description>
<enabled>true</enabled>
<!--optional. Default is true-->
</webResource>

Query all Web Resources


GetsallwebresourcesontheSSLVPNinstance.

210

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-124. Get portal web resource


Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/webresources/

ResponseBody:
<?xml version="1.0" encoding=UTF-8?>
<webResources>
<webResource>
<objectId>webresource-1</objectId>
<name>VMware</name>
<url>http://www.vmware.com</url>
<method name="POST">
<data>username=stalin </data>
</method>
<description>Click here to visit the corporate intranet Homepage </description>
<enabled>true</enabled>
</webResource>
</webResources>

Delete Portal Web Resource


Deletes the specified web access server.
Example 8-125. Delete specific portal web resource
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/webresources/ID

Deletes all Web Resources


DeletesallwebresourcesontheSSLVPNinstance.
Example 8-126. Deletes all portal web resources
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/webresources/

Apply All Web Resources


UpdateswebresourceconfigurationsofNSXEdgewiththegivenlistofwebresourceconfigurations.Ifthe
configurationispresent,itisupdated;ifitisnotpresent,anewwebresourceconfigurationiscreated.Existing
configurationsnotincludedintheRESTcallaredeleted.
Example 8-127. Apply all private networks
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
privatenetworks/

Configure Users
Add User
Addsanewportaluser.

VMware, Inc.

211

vShield API Programming Guide

Example 8-128. Add a user


Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/localserver/users/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<user>
<userId>stalin</userId>
<password>apple@123</password>
<firstName>STALIN</firstName>
<lastName>RAJAKILLI</lastName>
<description>This user belong to vsm team</description>
<disableUserAccount>false</disableUserAccount>
<!--optional. Default is false-->
<passwordNeverExpires>true</passwordNeverExpires>
<!--optional. Default is false-->
<allowChangePassword>
<changePasswordOnNextLogin>false</changePasswordOnNextLogin> <!--optional. Default is false-->
</allowChangePassword>
</user>

Modify User
Modifiesthespecifiedportaluser.
Example 8-129. Modify user
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/localserver/users/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<user>
<userId>stalin</userId>
<password>apple@123</password>
<firstName>STALIN</firstName>
<lastName>RAJAKILLI</lastName>
<description>This user belong to vsm team</description>
<disableUserAccount>false</disableUserAccount>
<!--optional. Default is false-->
<passwordNeverExpires>true</passwordNeverExpires>
<!--optional. Default is false-->
<allowChangePassword>
<changePasswordOnNextLogin>false</changePasswordOnNextLogin> <!--optional. Default is false-->
</allowChangePassword>
</user>

Query User Details


Getsinformationaboutthespecifieduser.
Example 8-130. Query user
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/localserver/users/userID

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user>
<userId>stalin</userId>
<firstName>Bob</firstName>
<lastName>Weber</lastName>

212

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<disableUserAccount>false</disableUserAccount>
<!--optional. Default is false-->
<passwordNeverExpires>true</passwordNeverExpires>
<!--optional. Default is false-->
<allowChangePassword>
<changePasswordOnNextLogin>false</changePasswordOnNextLogin> <!--optional. Default is false-->
</allowChangePassword>
</user>

Delete User
Deletesspecifieduser.
Example 8-131. Delete user
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/localserver/users/userID

Delete all Users


DeletesallusersonthespecifiedSSLVPNinstance.
Example 8-132. Delete all user
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/localserver/users/

Apply all Users


UpdatesallusersofNSXEdgewiththegivenlistofusers.Iftheuserispresent,itisupdated;ifitisnotpresent,
anewuseriscreated.ExistingusersnotincludedintheRESTcallaredeleted.
Example 8-133. Apply all users
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/auth/localusers/users

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user>
<userId>stalin</userId>
<password>apple@123</password>
<firstName>Bob</firstName>
<lastName>Weber</lastName>
<description>This user belong to vsm team</description>
<disableUserAccount>false</disableUserAccount>
<passwordNeverExpires>true</passwordNeverExpires>
<allowChangePassword>
<changePasswordOnNextLogin>false</changePasswordOnNextLogin>
</allowChangePassword>
</user>

Configure IP Pool
You can add, edit, or delete an IP pool.

VMware, Inc.

213

vShield API Programming Guide

Add IP Pool
CreatesanIPpoolthatwillbeusedtoassignIPaddresstoremoteusers.
Example 8-134. Add IP pool
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/ippools/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<ipAddressPool>
<description>description</description>
<ipRange>10.112.243.11-10.112.243.57</ipRange>
<netmask>255.0.0.0</netmask>
<gateway>192.168.1.1</gateway>
<primaryDns>192.168.10.1</primaryDns
<!--optional. -->
<secondaryDns>4.2.2.2</secondaryDns>
<!--optional. -->
<dnsSuffix></dnsSuffix>
<winsServer>10.112.243.201</winsServer>
<enabled>true</enabled>
<!--optional. Default is true-->
</ipAddressPool>

Modify IP Pool
ModifiesthespecifiedIPpool.
Example 8-135. Modify IP pool
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/ippools/ippoolID

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<ipAddressPool>
<description>description</description>
<ipRange>10.112.243.11-10.112.243.57</ipRange>
<netmask>255.0.0.0</netmask>
<gateway>192.168.1.1</gateway>
<primaryDns>192.168.10.1</primaryDns
<secondaryDns>4.2.2.2</secondaryDns>
<dnsSuffix></dnsSuffix>
<winsServer>10.112.243.201</winsServer>
<enabled>true</enabled>
</ipAddressPool>

Query IP Pool
GetsdetailsoftheIPpool.
Example 8-136. Get IP pool
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/ippools/ippoolID

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<ipAddressPool>
<objectId>ipPool-1</objectId>
<description>description</description>
<ipRange>10.112.243.11-10.112.243.57</ipRange>

214

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<netmask>255.0.0.0</netmask>
<gateway>192.168.1.1</gateway>
<primaryDns>192.168.10.1</primaryDns
<!--optional. -->
<secondaryDns>4.2.2.2</secondaryDns>
<!--optional. -->
<dnsSuffix></dnsSuffix>
<winsServer>10.112.243.201</winsServer>
<enabled>true</enabled>
<!--optional. Default is true-->
</ipAddressPool>

Query all IP Pools


GetsallIPpoolsconfiguredontheSSLVPNinstance.
Example 8-137. Gets all IP pools
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/ippools/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<ipAddressPool>
<objectId>ipPool-1</objectId>
<description>description</description>
<ipRange>10.112.243.11-10.112.243.57</ipRange>
<netmask>255.0.0.0</netmask>
<gateway>192.168.1.1</gateway>
<primaryDns>192.168.10.1</primaryDns
<!--optional. -->
<secondaryDns>4.2.2.2</secondaryDns>
<!--optional. -->
<dnsSuffix></dnsSuffix>
<winsServer>10.112.243.201</winsServer>
<enabled>true</enabled>
<!--optional. Default is true-->
</ipAddressPool>

Delete IP Pool
DeletesthespecifiedIPpool.
Example 8-138. Delete IP pool
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
ippools/ippoolID

Deletes all IP Pools


DeletesallIPpoolsontheSSLVPNinstance.
Example 8-139. Deletes all IP pools
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
ippools/

Apply all IP Pools


UpdatesallIPpoolsofNSXEdgewiththegivenlistofusers.IftheIPpoolispresent,itisupdated;ifitisnot
present,anewIPpooliscreated.ExistingpoolsnotincludedintheRESTcallaredeleted.

VMware, Inc.

215

vShield API Programming Guide

Example 8-140. Apply IP pools


Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/ippools/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<ipAddressPools>
<ipAddressPool>
<description>description</description>
<ipRange>10.112.243.11-10.112.243.57</ipRange>
<netmask>255.0.0.0</netmask>
<gateway>192.168.1.1</gateway>
<primaryDns>192.168.10.1</primaryDns
<secondaryDns>4.2.2.2</secondaryDns>
<dnsSuffix></dnsSuffix>
<winsServer>10.112.243.201</winsServer>
<enabled>true</enabled>
</ipAddressPool>
<ipAddressPools>

Configure Network Extension Client Parameters


Apply Client Configuration
Setsadvancedparametersforfullaccessclientconfigurationssuchaswhetherclientshouldautoreconnect
incaseofnetworkfailuresornetworkunavailability,orwhethertheclientshouldbeuninstalledafterlogout.
Example 8-141. Apply IP pools
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/clientconfig/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<clientConfiguration>
<autoReconnect>true</autoReconnect>
<!--optional. Default is false-->
<fullTunnel>
<!--optional. Default Tunnel mode is SPLIT-->
<excludeLocalSubnets>true</excludeLocalSubnets> <!--optional. Default is false-->
<gatewayIp>10.112.243.11</gatewayIp>
</fullTunnel>
<upgradeNotification>false</upgradeNotification> <!--optional. Default is false-->
</clientConfiguration>

Get Client Configuration


Getsinformationaboutthespecifiedclient.
Example 8-142. Get client configuration
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/clientconfig/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<clientConfiguration>
<autoReconnect>true</autoReconnect> <!--optional. Default is false-->
<tunnelConfiguration>
<excludeLocalSubnets>true</excludeLocalSubnets> <!--optional. Default is false-->
<gatewayIp>10.112.243.11</gatewayIp>
</tunnelConfiguration>

216

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<upgradeNotification>false</upgradeNotification> <!--optional. Default is false-->


</clientConfiguration>

Configure Network Extension Client Installation Package


You can add, delete, or edit an installation package for the SSL client.

Add Client Installation Package


Createssetupexecutables(installers)forfullaccessnetworkclients.Thesesetupbinariesarelaterdownloaded
byremoteclientsandinstalledontheirsystems.Theprimaryparametersneededtoconfigurethissetupare
hostnameofthegateway,anditsportandaprofilenamewhichisshowntotheusertoidentifythis
connection.Administratorcanalsosetfewotherparameterssuchaswhethertoautomaticallystartthe
applicationonwindowslogin,hidethesystemtrayiconetc.
Example 8-143. Add installation package
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/installpackages/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<clientInstallPackage>
<profileName>client</profileName>
<gatewayList>
<gateway>
<hostName>10.112.243.123</hostName>
<port>443</port> <!--optional. Default is 443-->
</gateway>
</gatewayList>
<startClientOnLogon>false</startClientOnLogon> <!--optional. Default is false-->
<hideSystrayIcon>true</hideSystrayIcon> <!--optional. Default is false-->
<rememberPassword>true</rememberPassword> <!--optional. Default is false-->
<silentModeOperation>true</silentModeOperation> !--optional. Default is false-->
<silentModeInstallation>false</silentModeInstallation> <!--optional. Default is false-->
<hideNetworkAdaptor>false</hideNetworkAdaptor> <!--optional. Default is false-->
<createDesktopIcon>true</createDesktopIcon> <!--optional. Default is true-->
<enforceServerSecurityCertValidation>false</enforceServerSecurityCertValidation> <!--optional. Default is true-->
<createLinuxClient>false</createLinuxClient> <!--optional. Default is false-->
<createMacClient>false</createMacClient> <!--optional. Default is false-->
<description>windows client</description>
<enabled>true</enabled> <!--optional. Default is true-->
</clientInstallPackage>

Modify Client Installation Package


Modifiesthespecifiedinstallationpackage.
Example 8-144. Modify installation package
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
installpackages/ID

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<clientInstallPackage>
<profileName>client</profileName>
<gatewayList>
<gateway>
<hostName>10.112.243.123</hostName>
VMware, Inc.

217

vShield API Programming Guide

<port>443</port> <!--optional. Default is 443-->


</gateway>
</gatewayList>
<startClientOnLogon>false</startClientOnLogon>
<!--optional. Default is false-->
<hideSystrayIcon>true</hideSystrayIcon>
<!--optional. Default is false-->
<rememberPassword>true</rememberPassword>
<!--optional. Default is false-->
<silentModeOperation>true</silentModeOperation>
<!--optional. Default is false-->
<silentModeInstallation>false</silentModeInstallation> <!--optional. Default is false-->
<hideNetworkAdaptor>false</hideNetworkAdaptor>
<!--optional. Default is false-->
<createDesktopIcon>true</createDesktopIcon>
<!--optional. Default is true-->
<enforceServerSecurityCertValidation>false</enforceServerSecurityCertValidation>
Default is true-->
<createLinuxClient>false</createLinuxClient>
<!--optional. Default is false-->
<createMacClient>false</createMacClient>
<!--optional. Default is false-->
<description>windows client</description>
<enabled>true</enabled>
<!--optional. Default is true-->
</clientInstallPackage>

<!--optional.

Query Client Installation Package


Getsinformationaboutthespecifiedinstallationpackage.
Example 8-145. Query installation package
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
installpackages/ID

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<clientInstallPackage>
<objectId>clientinstallpackage-1</objectId>
<profileName>client</profileName> <gatewayList>
<gatewayList>
<gateway>
<hostName>10.112.243.123</hostName>
<port>443</port> <!--optional. Default is 443-->
</gateway>
</gatewayList>
<startClientOnLogon>false</startClientOnLogon>
<hideSystrayIcon>true</hideSystrayIcon>
<rememberPassword>true</rememberPassword>
<silentModeOperation>true</silentModeOperation>
<silentModeInstallation>false</silentModeInstallation>
<hideNetworkAdaptor>false</hideNetworkAdaptor>
<createDesktopIcon>true</createDesktopIcon>
<enforceServerSecurityCertValidation>false</enforceServerSecurityCertValidation>
<createLinuxClient>false</createLinuxClient>
<createMacClient>false</createMacClient>
<description>windows client</description>
<enabled>true</enabled>
</clientInstallPackage>

Query all Client Installation Packages


Getsinformationaboutallinstallationpackages.
Example 8-146. Query all installation package
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
installpackages/

218

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<clientInstallPackages>
<clientInstallPackage>
<objectId>clientinstallpackage-1</objectId>
<profileName>client</profileName> <gatewayList>
<gatewayList>
<gateway>
<hostName>10.112.243.123</hostName>
<port>443</port>
</gateway>
</gatewayList>
<startClientOnLogon>false</startClientOnLogon>
<hideSystrayIcon>true</hideSystrayIcon>
<rememberPassword>true</rememberPassword>
<silentModeOperation>true</silentModeOperation>
<silentModeInstallation>false</silentModeInstallation>
<hideNetworkAdaptor>false</hideNetworkAdaptor>
<createDesktopIcon>true</createDesktopIcon>
<enforceServerSecurityCertValidation>false</enforceServerSecurityCertValidation>
<createLinuxClient>false</createLinuxClient>
<createMacClient>false</createMacClient>
<description>windows client</description>
<enabled>true</enabled>
</clientInstallPackage>
<clientInstallPackage>

Delete Client Installation Package


Deletesthespecifiedinstallationpackage.
Example 8-147. Delete installation package
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
installpackages/ID

Delete all Client Installation Packages


Deletesallinstallationpackages.
Example 8-148. Delete all installation packages
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
installpackages/

Apply all Installation Packages


UpdatesallinstallationpackagesonNSXEdgewiththegivenlistofinstallationpackages.Iftheinstallation
packageispresent,itisupdated;ifitisnotpresent,anewinstallationpackageiscreated.Existinginstallation
packagesnotincludedintheRESTcallaredeleted.
Example 8-149. Apply installationpackages
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/client/networkextension/
installpackages/

VMware, Inc.

219

vShield API Programming Guide

RequestBody:
<clientInstallPackages>
<clientInstallPackage>
<objectId>clientinstallpackage-1</objectId>
<profileName>client</profileName> <gatewayList>
<gatewayList>
<gateway>
<hostName>10.112.243.123</hostName>
<port>443</port>
</gateway>
</gatewayList>
<startClientOnLogon>false</startClientOnLogon>
<hideSystrayIcon>true</hideSystrayIcon>
<rememberPassword>true</rememberPassword>
<silentModeOperation>true</silentModeOperation>
<silentModeInstallation>false</silentModeInstallation>
<hideNetworkAdaptor>false</hideNetworkAdaptor>
<createDesktopIcon>true</createDesktopIcon>
<enforceServerSecurityCertValidation>false</enforceServerSecurityCertValidation>
<createLinuxClient>false</createLinuxClient>
<createMacClient>false</createMacClient>
<description>windows client</description>
<enabled>true</enabled>
</clientInstallPackage>
<clientInstallPackage>

Configure Portal Layouts


Youcanconfigurethe web layout bound to the SSL VPN client.

Upload Portal Logo


Uploadstheportallogofromthegivenlocalpath.
Example 8-150. Upload portal logo
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/images/portallogo/

Upload Phat Banner


Uploadsthephatclientbannerfromthegivenlocalpath.Thephatbannerimagemustinthebmpformat.
Example 8-151. Upload phat banner
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/images/phatbanner

Upload Client Connected Icon


Uploadstheclientconnectediconfromthegivenlocalpath.Theiconimagemustbeoftypeico.
Example 8-152. Upload clientconnectedicon
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/images/connecticon/

220

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Upload Client Disconnected Icon


Uploadstheclientdisconnectediconfromthegivenlocalpath.Theiconimagemustbeoftypeico.
Example 8-153. Upload clientdisconnectedicon
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/images/disconnecticon/

Upload Client Desktop Icon


Uploadstheclientdesktopiconfromthegivenlocalpath.Theiconimagemustbeoftypeico.
Example 8-154. Upload clientdesktopicon
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/images/desktopicon/

Upload Error Connected Icon


Uploadstheclienterrorconnectediconfromthegivenlocalpath.Theiconimagemustbeoftypeico.
Example 8-155. Upload clientdesktopicon
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/images/erroricon/

Apply Layout Configuration


Setstheportallayout.
Example 8-156. Apply layout configuration
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/images/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<!-- portal layout configuration-->
<portalTitle>Pepsi Remote Access</portalTitle><!--optional. Default value is VMware -->
<companyName>pepsi, Inc.</companyName><!--optional. Default value is VMware -->
<!-- Portal Color Configuration-->
<logoBackgroundColor>FFFFFF</logoBackgroundColor><!--optional. Default value is FFFFFF -->
<titleColor>996600</titleColor><!--optional. Default value is 996600 -->
<topFrameColor>000000</topFrameColor><!--optional. Default value is 000000 -->
<menuBarColor>999999</menuBarColor><!--optional. Default value is 999999 -->
<rowAlternativeColor>FFFFFF</rowAlternativeColor><!--optional. Default value is FFFFFF -->
<bodyColor>FFFFFF</bodyColor><!--optional. Default value is FFFFFF -->
<rowColor>F5F5F5</rowColor><!--optional. Default value is F5F5F5 -->
</layout>

Query Portal Layout


getstheportallayoutconfiguration.

VMware, Inc.

221

vShield API Programming Guide

Example 8-157. Query layout configuration


Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/layout/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<!-- portal layout configuration-->
<portalTitle>Pepsi Remote Access</portalTitle><!--optional. Default value is VMware -->
<companyName>pepsi, Inc.</companyName><!--optional. Default value is VMware -->
<!-- Portal Color Configuration-->
<logoBackgroundColor>FFFFFF</logoBackgroundColor><!--optional. Default value is FFFFFF -->
<titleColor>996600</titleColor><!--optional. Default value is 996600 -->
<topFrameColor>000000</topFrameColor><!--optional. Default value is 000000 -->
<menuBarColor>999999</menuBarColor><!--optional. Default value is 999999 -->
<rowAlternativeColor>FFFFFF</rowAlternativeColor><!--optional. Default value is FFFFFF -->
<bodyColor>FFFFFF</bodyColor><!--optional. Default value is FFFFFF -->
<rowColor>F5F5F5</rowColor><!--optional. Default value is F5F5F5 -->
</layout>

Configure Authentication Parameters


Youcanaddanexternalauthenticationserver(AD,LDAP,Radius,orRSA)whichisboundtotheSSL
gateway.Allusersintheboundedauthenticatedserverwillbeauthenticated.

Upload RSA Config File


UploadstheRSAconfigurationfiletoNSXManager.
Example 8-158. Upload RSA config file
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/settings/rsaconfigfile/

Apply Authentication Configuration


Setsauthenticationprocessforremoteusers.Theadministratorspecifieswhetherusernamepasswordbased
authenticationshouldbeenabledandthelistanddetailsofauthenticationserverssuchasactivedirectory,
ldap,radiusetc.Theadministratorcanalsoenableclientcertificatebasedauthentication.
Example 8-159. Apply Authentication Configuration
Request:edgeId
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/settings/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<authenticationConfig>
<passwordAuthentication>
<authenticationTimeout>1</authenticationTimeout>
<!--optional. Default value is 1 mins-->
<!-- Only four auth servers can be part of authentication configuration including secondary auth server and can be of type
AD,LDAP,RADIUS,LOCAL and RSA -->
<primaryAuthServers>
<com.vmware.vshield.edge.sslvpn.dto.LdapAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<!--optional. Default value is 639 if ssl enabled or 389 for normal cfg-->
<timeOut>20</timeOut>
<!--optional. Default value is 10 secs-->
<enableSsl>false</enableSsl>
<!--optional. Default is false-->
<searchBase>searchbasevalue</searchBase>

222

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<!--optional.-->
<loginAttributeName>cain</loginAttributeName> <!--optional. Default is sAMAccountName -->
<searchFilter>found</searchFilter>
<!--optional. Default is 'objectClass=*'-->
<enabled>true</enabled>
<!--optional. Default is ture-->
</com.vmware.vshield.edge.sslvpn.dto.LdapAuthServerDto>
<com.vmware.vshield.edge.sslvpn.dto.RadiusAuthServerDto>
<ip>3.3.3.3</ip>
<port>90</port>
<!--optional. Default value is 1812-->
<timeOut>20</timeOut>
<!--optional. Default value is 10 secs-->
<secret>struct9870</secret>
<nasIp>1.1.1.9</nasIp>
<!--optional. Default value is 0.0.0.0-->
<retryCount>10</retryCount>
<!--optional. Default value is 3-->
</com.vmware.vshield.edge.sslvpn.dto.RadiusAuthServerDto>
<com.vmware.vshield.edge.sslvpn.dto.LocalAuthServerDto>
<!--Only one Local auth server can be part of authentication configuration -->
<enabled>true</enabled>
<passwordPolicy>
<!-- optional. -->
<minLength>1</minLength>
<!--optional. Default value is 1-->
<maxLength>1</maxLength>
<!--optional. Default value is 63-->
<minAlphabets>0</minAlphabets>
<!--optional -->
<minDigits>0</minDigits>
<!--optional -->
<minSpecialChar>1</minSpecialChar>
<!--optional -->
<allowUserIdWithinPassword>false</allowUserIdWithinPassword> <!-- optional. Default value is false
-->
<passwordLifeTime>20</passwordLifeTime>
<!--optional. Default value is 30 days-->
<expiryNotification>1</expiryNotification>
<!--optional. Default value is 25 days-->
</passwordPolicy>
<accountLockoutPolicy>
<!--optional -->
<retryCount>3</retryCount>
<!--optional. Default value is 3-->
<retryDuration>3</retryDuration>
<!--optional. Default value is 2 days -->
<lockoutDuration>3</lockoutDuration>
<!--optional. Default value is 2 days -->
</accountLockoutPolicy>
</com.vmware.vshield.edge.sslvpn.dto.LocalAuthServerDto>
<!-- Only one RSA auth server can be configured. RSA configuration file has to be uploaded prior to config RSA
auth server RSA timeOut is optional. Default value is 60 secs-->
<com.vmware.vshield.edge.sslvpn.dto.RsaAuthServerDto>
<timeOut>20</timeOut>
<sourceIp>1.2.2.3</sourceIp>
</com.vmware.vshield.edge.sslvpn.dto.RsaAuthServerDto> -->
</primaryAuthServers>
<secondaryAuthServer>
<!--Any of one of the auth server AD, LDAP, RSA, LOCAL or RADIUS can be sec auth server -->
<com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<!--optional. Default value is 639 if ssl enabled or 389 for normal cfg-->
<timeOut>20</timeOut>
<!--optional. Default value is 10 secs-->
<enableSsl>false</enableSsl>
<!--optional. Default is false-->
<searchBase>searchbasevalue</searchBase>
<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<!--optional. -->
<loginAttributeName>cain</loginAttributeName>
<!--optional. Default is sAMAccountName -->
<searchFilter>found</searchFilter>
<!--optional. Default is 'objectClass=*'-->
<terminateSessionOnAuthFails>false</terminateSessionOnAuthFails> <!--optional. Default is false-->
<enabled>true</enabled>
</com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
</secondaryAuthServer>
</passwordAuthentication>
</authenticationConfig>

Query Authentication Configuration


Getsinformationaboutthespecifiedauthenticationserver.

VMware, Inc.

223

vShield API Programming Guide

Example 8-160. Query Authentication Configuration


Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/auth/settings/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<com.vmware.vshield.edge.sslvpn.dto.AuthenticationConfigurationDto>
<passwordAuthentication>
<authenticationTimeout>1</authenticationTimeout>
<primaryAuthServers>
<com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<timeOut>20</timeOut>
<enableSsl>false</enableSsl>
<searchBase>searchbasevalue</searchBase>
<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<loginAttributeName>cain</loginAttributeName>
<searchFilter>found</searchFilter>
<enabled>true</enabled>
<com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
</primaryAuthServers>
<secondaryAuthServer>
<com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<timeOut>20</timeOut>
<enableSsl>false</enableSsl>
<searchBase>searchbasevalue</searchBase>
<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<loginAttributeName>cain</loginAttributeName>
<searchFilter>found</searchFilter>
<terminateSessionOnAuthFails>false</terminateSessionOnAuthFails>
<enabled>true</enabled>
</com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
</secondaryAuthServer>
</passwordAuthentication>
</authenticationConfig>

Configure SSL VPN Advanced Configuration


Apply advanced configuration
Appliesadvancedconfiguration.
Example 8-161. Apply advanced configuration
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/advancedconfig/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<advancedConfig>
<enableCompression>false</enableCompression>
<!--optional. Default is false-->
<forceVirtualKeyboard>false</forceVirtualKeyboard> <!--optional. Default is false-->
<preventMultipleLogon>true</preventMultipleLogon> <!--optional. Default is false-->
<randomizeVirtualkeys>false</randomizeVirtualkeys> <!--optional. Default is false-->
<timeout>
<!--optional. -->
<forcedTimeout>16</forcedTimeout>
<!--optional. Value is in minute(s)-->
<sessionIdleTimeout>10</sessionIdleTimeout>
<!--optional. Default is 10 mins-->

224

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

</timeout>
<clientNotification></clientNotification>
<enablePublicUrlAccess>false</enablePublicUrlAccess> <!--optional. Default is false-->
<enableLogging>false</enableLogging>
<!--optional. Default is false-->
</advancedConfig>

Query Advanced Configuration


RetrievesSSLVPNadvancedconfiguration.
Example 8-162. Query advanced configuration
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/advancedconfig/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<advancedConfig>
<enableCompression>false</enableCompression>
<!--optional. Default is false-->
<forceVirtualKeyboard>false</forceVirtualKeyboard> <!--optional. Default is false-->
<preventMultipleLogon>true</preventMultipleLogon> <!--optional. Default is false-->
<randomizeVirtualkeys>false</randomizeVirtualkeys> <!--optional. Default is false-->
<timeout>
<!--optional. -->
<forcedTimeout>16</forcedTimeout>
<!--optional. Value is in minute(s)-->
<sessionIdleTimeout>10</sessionIdleTimeout>
<!--optional. Default is 10 mins-->
</timeout>
<clientNotification></clientNotification>
<enablePublicUrlAccess>false</enablePublicUrlAccess> <!--optional. Default is false-->
<enableLogging>false</enableLogging>
<!--optional. Default is false-->
</advancedConfig>

Working with Active Clients


YoucanretrievealistofactiveclientsfortheSSLVPNsessionanddisconnectaspecificclient.

Query Active Clients


RetrievesalistofactiveclientsfortheSSLVPNsession.
Example 8-163. Query active clients
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/activesessions/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<activeSessions>
<activeSession>
<sessionId>488382</sessionId>
<sessionType>PHAT</sessionType>
<userName>demo</userName>
<startTime>2011-09-24-06:00</startTime>
<upTime>101400</upTime>
<idleTime>2</idleTime>
<totalNonTcpBytesReceived>6576</totalNonTcpBytesReceived>
<totalTcpBytesReceived>30816</totalTcpBytesReceived>
<totalNonTcpBytesSent>0</totalNonTcpBytesSent>
<totalTcpBytesSent>152722</totalTcpBytesSent>
<clientInternalIp>1.0.192.10</clientInternalIp>
<clientVirtualIP>192.168.27.20</clientVirtualIP>
<clientExternalNatIp>10.112.243.227</clientExternalNatIp>

VMware, Inc.

225

vShield API Programming Guide

<clientExternalNatPort>50498</clientExternalNatPort>
<totalConnections>2</totalConnections>
<totalActiveConnection>4</totalActiveConnection>
</activeSession>
</activeSessions>

Disconnect Active Client


Disconnectsanactiveclient.
Example 8-164. Disconnect active client
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/activesessions/sessionId

Manage Logon and Logoff scripts


You can bind a login or logoff script to the NSX Edge gateway.

Upload Script
Youcanaddmultipleloginorlogoffscripts.Forexample,youcanbindaloginscriptforstartingInternet
Explorerwithgmail.com.WhentheremoteuserlogsintotheSSLclient,InternetExploreropensup
gmail.com.
TheuploadscriptreturnsascriptfileIDwhichisusedtoconfigurethefileparameters.
Example 8-165. Upload script
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/file/

Configure Script Parameters


Configuresparametersassociatedwiththeuploadedscriptfile.
Example 8-166. Add script parameters
Request:
POST https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<logonLogoffScript>
<scriptFileId>logonlogoffscriptfile-12</scriptFileId> <!-- Script file id generated using upload script file REST API-->
<type>BOTH</type>
<description>Testing modify script</description>
<enabled>false</enabled>
<!--optional. Default is true -->
</logonLogoffScript>

Modify Script Configuration


ModifiestheparametersassociatedwiththespecifiedscriptfileID.
Example 8-167. Modify script parameters
Request:

226

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/scriptFileId

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<logonLogoffScript>
<scriptFileId>logonlogoffscriptfile-12</scriptFileId>
<type>BOTH</type>
<description>Testing modify sscript</description>
<enabled>false</enabled>
</logonLogoffScript>

Query Script Configuration


RetrievesparametersassociatedwiththespecifiedscriptfileID.
Example 8-168. Get script parameters
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/scriptFileId

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<logonLogoffScript>
<objectId>logonlogoffscript-1</objectId>
<scriptFileId>logonlogoffscriptfile-12</scriptFileId>
<type>BOTH</type>
<description>Testing modify script</description>
<scriptFileUri>https://vsm-ip/api/4.0/edges/edge-id/sslvpn/config/script/file/scriptFileId/</scriptFileUri>
<enabled>false</enabled>
</logonLogoffScript>

Query All Script Configurations


RetrievesallscriptconfigurationsforthespecifiedNSXEdge.
Example 8-169. Get all script parameters
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<logonLogoffScript>
<logonLogoffScript>
<scriptFileId>logonlogoffscriptfile-12</scriptFileId>
<type>BOTH</type>
<description>Testing modify sscript</description>
<enabled>false</enabled>
</logonLogoffScript>
</logonLogoffScript>

Delete Script Configuration


DeletestheparametersassociatedwiththespecifiedscriptfileID.
Example 8-170. Delete script parameters
Request:

VMware, Inc.

227

vShield API Programming Guide

DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/scriptFileId

Delete All Script Configuragtions


DeletesallscriptconfigurationsforthespecifiedNSXEdge.
Example 8-171. Delete script parameters
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/

Apply All Script Configurations


UpdatesallscriptconfigurationsonthespecifiedNSXEdgewiththegivenlistofconfigurations.Ifthe
configurationispresent,itisupdated;ifitisnotpresent,anewconfigurationiscreated.Existing
configurationsnotincludedintheRESTcallaredeleted.
Example 8-172. Apply script configurations
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/script/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<logonLogoffScript>
<logonLogoffScript>
<objectId>logonlogoffscript-1</objectId>
<scriptFileId>logonlogoffscriptfile-12</scriptFileId>
<type>BOTH</type>
<enabled>false</enabled>
<description>This script will run on both login and logoff of phat client</description>
</logonLogoffScript>
</logonLogoffScript>

Reconfigure SSL VPN


PushestheentireSSLVPNconfigurationtothespecifiedNSXEdgeinasinglecall.
Example 8-173. Reconfigure SSL VPN
Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<sslvpnConfig>
<enabled>true</enabled>
<logging> <!-- optional . -->
<enable>false</enable>
<logLevel>debug</logLevel>
</logging>
<serverSettings>
<ip>10.112.243.109</ip>
<port>443</port>
<!--optional. Default is 443 -->
<!-- Certificate has to be generated using certificate REST API and id returned should be mentioned here-->
<!--<certificateId>certificate-1</certificateId> -->
<!-- optional -->
<cipherList> <!-- any one or more of the following ciphers can be part of configuration -->
<cipher>RC4-MD5</cipher>
<cipher>AES128-SHA</cipher>
<cipher>AES256-SHA</cipher>

228

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<cipher>DES-CBC3-SHA</cipher>
</cipherList>
</serverSettings>
<privateNetworks>
<privateNetwork>
<description>This is a private network for UI-team</description>
<network>192.168.1.0/24</network>
<sendOverTunnel>
<ports>20-40</ports>
<!-- optional. Default is 0-0 -->
<optimize>false</optimize>
<!--optional. Default is true -->
</sendOverTunnel>
<enabled>true</enabled>
<!--optional. Default is true-->
</privateNetwork>
</privateNetworks>
<users>
<user>
<userId>stalin</userId>
<password>apple@123</password>
<firstName>STALIN</firstName>
<lastName>RAJAKILLI</lastName>
<description>This user belong to vsm team</description>
<disableUserAccount>false</disableUserAccount>
<!--optional. Default is false-->
<passwordNeverExpires>true</passwordNeverExpires>
<!--optional. Default is false-->
<allowChangePassword>
<changePasswordOnNextLogin>false</changePasswordOnNextLogin>
<!--optional. Default is false-->
</allowChangePassword>
</user>
</users>
<ipAddressPools>
<ipAddressPool>
<description>description</description>
<ipRange>10.112.243.11-10.112.243.57</ipRange>
<netmask>255.0.0.0</netmask>
<gateway>192.168.1.1</gateway>
<primaryDns>192.168.10.1</primaryDns>
<secondaryDns>4.2.2.2</secondaryDns>
<dnsSuffix></dnsSuffix>
<winsServer>10.112.243.201</winsServer>
<enabled>true</enabled>
<!--optional. Default is true-->
</ipAddressPool>
</ipAddressPools>
<clientInstallPackages>
<clientInstallPackage>
<profileName>client</profileName>
<gatewayList>
<gateway>
<hostName>10.112.243.123</hostName>
<port>443</port>
<!--optional. Default is 443-->
</gateway>
</gatewayList>
<!-- Optional Parameters-->
<startClientOnLogon>false</startClientOnLogon>
<!--optional. Default is false-->
<hideSystrayIcon>true</hideSystrayIcon>
<!--optional. Default is false-->
<rememberPassword>true</rememberPassword>
<!--optional. Default is false-->
<silentModeOperation>true</silentModeOperation>
<!--optional. Default is false-->
<silentModeInstallation>false</silentModeInstallation>
<!--optional. Default is false-->
<hideNetworkAdaptor>false</hideNetworkAdaptor>
<!--optional. Default is false-->
<createDesktopIcon>true</createDesktopIcon>
<!--optional. Default is true-->
<enforceServerSecurityCertValidation>false</enforceServerSecurityCertValidation>
<!--optional. Default is true-->
<createLinuxClient>false</createLinuxClient>
<!--optional. Default is false-->
<createMacClient>false</createMacClient>
<!--optional. Default is false-->
<description>windows client</description>
<enabled>true</enabled>
<!--optional. Default is true-->
</clientInstallPackage>
</clientInstallPackages>
<webResources>
<webResource>

VMware, Inc.

229

vShield API Programming Guide

<name>VMware</name>
<url>http://www.vmware.com</url>
<method name="POST">
<data>username=stalin </data>
</method>
<description>Click here to visit the corporate intranet Homepage </description>
<enabled>true</enabled>
<!--optional. Default is true-->
</webResource>
</webResources>
<clientConfiguration>
<autoReconnect>true</autoReconnect>
<!--optional. Default is false-->
<fullTunnel><!--optional. Default Tunnel mode is SPLIT-->
<excludeLocalSubnets>true</excludeLocalSubnets>
<!--optional. Default is false-->
<gatewayIp>10.112.243.11</gatewayIp>
</fullTunnel>
<upgradeNotification>false</upgradeNotification>
<!--optional. Default is false-->
</clientConfiguration>
<advancedConfig>
<enableCompression>false</enableCompression>
<!--optional. Default is false-->
<forceVirtualKeyboard>false</forceVirtualKeyboard>
<!--optional. Default is false-->
<preventMultipleLogon>true</preventMultipleLogon>
<!--optional. Default is false-->
<randomizeVirtualkeys>false</randomizeVirtualkeys>
<!--optional. Default is false-->
<timeout><!--optional. -->
<forcedTimeout>16</forcedTimeout>
<!--optional. -->
<sessionIdleTimeout>10</sessionIdleTimeout>
<!--optional. Default value is 10 mins-->
</timeout>
<clientNotification></clientNotification>
<enablePublicUrlAccess>false</enablePublicUrlAccess>
<!--optional. Default is false-->
<enableLogging>false</enableLogging>
<!--optional. Default is false-->
</advancedConfig>
<authenticationConfiguration>
<passwordAuthentication>
<authenticationTimeout>1</authenticationTimeout>
<!--optional. Default value is 1 mins-->
<!-- Only four auth servers can be part of authentication configuration including secondary auth server
and can be of
type AD,LDAP,RADIUS,LOCAL and RSA -->
<primaryAuthServers>
<com.vmware.vshield.edge.sslvpn.dto.LdapAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<!--optional. Default value is 639 if ssl enabled or 389 for
normal cfg-->
<timeOut>20</timeOut>
<!--optional. Default value is 10 secs-->
<enableSsl>false</enableSsl>
<!--optional. Default is false-->
<searchBase>searchbasevalue</searchBase>
<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<!--optional.-->
<loginAttributeName>cain</loginAttributeName>
<!--optional. Default is sAMAccountName
-->
<searchFilter>found</searchFilter>
<!--optional. Default is 'objectClass=*'-->
<enabled>true</enabled>
<!--optional. Default is ture-->
</com.vmware.vshield.edge.sslvpn.dto.LdapAuthServerDto>
<com.vmware.vshield.edge.sslvpn.dto.RadiusAuthServerDto>
<ip>3.3.3.3</ip>
<port>90</port>
<!--optional. Default value is 1812-->
<timeOut>20</timeOut>
<!--optional. Default value is 10 secs-->
<secret>struct9870</secret>
<nasIp>1.1.1.9</nasIp>
<!--optional. Default value is 0.0.0.0-->
<retryCount>10</retryCount>
<!--optional. Default value is 3-->
</com.vmware.vshield.edge.sslvpn.dto.RadiusAuthServerDto>
<com.vmware.vshield.edge.sslvpn.dto.LocalAuthServerDto>
<!--Only one Local auth server can be part of authentication configuration
-->
<enabled>true</enabled>
<passwordPolicy>
<!-- optional. -->
<minLength>1</minLength>
<!--optional. Default value is 1-->
<maxLength>63</maxLength>
<!--optional. Default value is 63-->
<minAlphabets>0</minAlphabets>
<!--optional -->
<minDigits>0</minDigits>
<!--optional -->

230

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<minSpecialChar>1</minSpecialChar>
<!--optional -->
<allowUserIdWithinPassword>false</allowUserIdWithinPassword> <!-- optional. Default value is false
-->
<passwordLifeTime>20</passwordLifeTime>
<!--optional. Default value is 30 days-->
<expiryNotification>1</expiryNotification>
<!--optional. Default value is 25 days-->
</passwordPolicy>
<accountLockoutPolicy>
<!--optional -->
<retryCount>3</retryCount>
<!--optional. Default value is 3-->
<retryDuration>3</retryDuration>
<!--optional. Default value is 2 days -->
<lockoutDuration>3</lockoutDuration>
<!--optional. Default value is 2 days -->
</accountLockoutPolicy>
</com.vmware.vshield.edge.sslvpn.dto.LocalAuthServerDto>
<!-- Only one RSA auth server can be configured.RSA configuration file
has to be uploaded prior to config RSA auth server RSA timeOut is optional. Default value is 60
secs -->
<!--<com.vmware.vshield.edge.sslvpn.dto.RsaAuthServerDto>
<timeOut>20</timeOut>
<sourceIp>1.2.2.3</sourceIp>
</com.vmware.vshield.edge.sslvpn.dto.RsaAuthServerDto> -->
</primaryAuthServers>
<secondaryAuthServer>
<!--Any of one of the auth server AD, LDAP, RSA, LOCAL or RADIUS can be sec auth server -->
<com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<!--optional. Default value is 639 if ssl enabled or 389 for
normal cfg-->
<timeOut>20</timeOut>
<!--optional. Default value is 10 secs-->
<enableSsl>false</enableSsl>
<!--optional. Default is false-->
<searchBase>searchbasevalue</searchBase>
<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<!--optional. -->
<loginAttributeName>cain</loginAttributeName>
<!--optional. Default is sAMAccountName
-->
<searchFilter>found</searchFilter>
<!--optional. Default is 'objectClass=*'-->
<terminateSessionOnAuthFails>false</terminateSessionOnAuthFails>
<!--optional. Default is false-->
<enabled>true</enabled>
</com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
</secondaryAuthServer>
</passwordAuthentication>
</authenticationConfiguration>
</sslvpnConfig>

Query SSL VPN Configuration


RetrievestheSSLVPNconfigurationsofthespecifiedNSXEdge.
Example 8-174. Query SSL VPN Configuration
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<sslvpnConfig>
<version>32</version>
<enabled>true</enabled>
<logging> <!-- optional . -->
<enable>false</enable>
<logLevel>debug</logLevel>
</logging>
<serverSettings>
<ip>10.112.243.109</ip>
<port>443</port>
<certificateId>certificate-1</certificateId> -->

VMware, Inc.

231

vShield API Programming Guide

<cipherList>
<cipher>RC4-MD5</cipher>
<cipher>AES128-SHA</cipher>
<cipher>AES256-SHA</cipher>
<cipher>DES-CBC3-SHA</cipher>
</cipherList>
</serverSettings>
<privateNetworks>
<privateNetwork>
<description>This is a private network for UI-team</description>
<network>192.168.1.0/24</network>
<sendOverTunnel>
<ports>20-40</ports>
<optimize>false</optimize>
</sendOverTunnel>
<enabled>true</enabled>
</privateNetwork>
</privateNetworks>
<users>
<user>
<userId>stalin</userId>
<password>apple@123</password>
<firstName>STALIN</firstName>
<lastName>RAJAKILLI</lastName>
<description>This user belong to vsm team</description>
<disableUserAccount>false</disableUserAccount>
<passwordNeverExpires>true</passwordNeverExpires>
<allowChangePassword>
<changePasswordOnNextLogin>false</changePasswordOnNextLogin>
</allowChangePassword>
</user>
</users>
<ipAddressPools>
<ipAddressPool>
<description>description</description>
<ipRange>10.112.243.11-10.112.243.57</ipRange>
<netmask>255.0.0.0</netmask>
<gateway>192.168.1.1</gateway>
<primaryDns>192.168.10.1</primaryDns>
<secondaryDns>4.2.2.2</secondaryDns>
<dnsSuffix></dnsSuffix>
<winsServer>10.112.243.201</winsServer>
<enabled>true</enabled>
</ipAddressPool>
</ipAddressPools>
<clientInstallPackages>
<clientInstallPackage>
<profileName>client</profileName>
<gatewayList>
<gateway>
<hostName>10.112.243.123</hostName>
<port>443</port>
</gateway>
</gatewayList>
<!-- Optional Parameters-->
<startClientOnLogon>false</startClientOnLogon>
<hideSystrayIcon>true</hideSystrayIcon>
<rememberPassword>true</rememberPassword>
<silentModeOperation>true</silentModeOperation>
<silentModeInstallation>false</silentModeInstallation>
<hideNetworkAdaptor>false</hideNetworkAdaptor>
<createDesktopIcon>true</createDesktopIcon>
<enforceServerSecurityCertValidation>false</enforceServerSecurityCertValidation>
<createLinuxClient>false</createLinuxClient>
<createMacClient>false</createMacClient>
<description>windows client</description>
<enabled>true</enabled>
</clientInstallPackage>

232

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

</clientInstallPackages>
<webResources>
<webResource>
<name>VMware</name>
<url>http://www.vmware.com</url>
<method name="POST">
<data>username=stalin </data>
</method>
<description>Click here to visit the corporate intranet Homepage </description>
<enabled>true</enabled>
</webResource>
</webResources>
<clientConfiguration>
<autoReconnect>true</autoReconnect>
<fullTunnel>
<excludeLocalSubnets>true</excludeLocalSubnets>
<gatewayIp>10.112.243.11</gatewayIp>
</fullTunnel>
<upgradeNotification>false</upgradeNotification>
</clientConfiguration>
<advancedConfig>
<enableCompression>false</enableCompression>
<forceVirtualKeyboard>false</forceVirtualKeyboard>
<preventMultipleLogon>true</preventMultipleLogon>
<randomizeVirtualkeys>false</randomizeVirtualkeys>
<timeout>
<forcedTimeout>16</forcedTimeout>
<sessionIdleTimeout>10</sessionIdleTimeout>
</timeout>
<clientNotification></clientNotification>
<enablePublicUrlAccess>false</enablePublicUrlAccess>
<enableLogging>false</enableLogging>
</advancedConfig>
<authenticationConfiguration>
<passwordAuthentication>
<authenticationTimeout>1</authenticationTimeout>
<primaryAuthServers>
<com.vmware.vshield.edge.sslvpn.dto.LdapAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<timeOut>20</timeOut>
<enableSsl>false</enableSsl>
<searchBase>searchbasevalue</searchBase>
<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<loginAttributeName>cain</loginAttributeName>
<searchFilter>found</searchFilter>
<enabled>true</enabled>
</com.vmware.vshield.edge.sslvpn.dto.LdapAuthServerDto>
<com.vmware.vshield.edge.sslvpn.dto.RadiusAuthServerDto>
<ip>3.3.3.3</ip>
<port>90</port>
<timeOut>20</timeOut>
<secret>struct9870</secret>
<nasIp>1.1.1.9</nasIp>
<retryCount>10</retryCount>
</com.vmware.vshield.edge.sslvpn.dto.RadiusAuthServerDto>
<com.vmware.vshield.edge.sslvpn.dto.LocalAuthServerDto>
<enabled>true</enabled>
<passwordPolicy>
<minLength>1</minLength>
<maxLength>63</maxLength>
<minAlphabets>0</minAlphabets>
<minDigits>0</minDigits>
<minSpecialChar>1</minSpecialChar>
<allowUserIdWithinPassword>false</allowUserIdWithinPassword>
<passwordLifeTime>20</passwordLifeTime>
<expiryNotification>1</expiryNotification>

VMware, Inc.

233

vShield API Programming Guide

</passwordPolicy>
<accountLockoutPolicy>
<retryCount>3</retryCount>
<retryDuration>3</retryDuration>
<lockoutDuration>3</lockoutDuration>
</accountLockoutPolicy>
</com.vmware.vshield.edge.sslvpn.dto.LocalAuthServerDto>
<!--<com.vmware.vshield.edge.sslvpn.dto.RsaAuthServerDto>
<timeOut>20</timeOut>
<sourceIp>1.2.2.3</sourceIp>
</com.vmware.vshield.edge.sslvpn.dto.RsaAuthServerDto>
</primaryAuthServers>
<secondaryAuthServer>
<com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
<ip>1.1.1.1</ip>
<port>90</port>
<timeOut>20</timeOut>
<enableSsl>false</enableSsl>
<searchBase>searchbasevalue</searchBase>
<bindDomainName>binddnvalue</bindDomainName>
<bindPassword>password</bindPassword>
<loginAttributeName>cain</loginAttributeName>
<searchFilter>found</searchFilter>
<terminateSessionOnAuthFails>false</terminateSessionOnAuthFails>
<enabled>true</enabled>
</com.vmware.vshield.edge.sslvpn.dto.AdAuthServerDto>
</secondaryAuthServer>
</passwordAuthentication>
</authenticationConfiguration>
</sslvpnConfig>

Delete SSL VPN Configuration


DeletestheSSLVPNconfigurationsonthespecifiedNSXEdge.
Example 8-175. Delete SSL VPN Configuration
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/sslvpn/config/

Query SSL VPN Statistics


RetrievesSSLVPNstatisticsonthespecifiedNSXEdge.
Example 8-176. Get SSL VPN statistics
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/statistics/dashboard/sslvpn?interval=<range>
oneDay|oneWeek|oneMonth|oneYear. Default is 60 minutes -->

<!--range can be 1 - 60 minutes or

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<dashboardStatistics>
<meta>
<startTime>1344809160</startTime>
<endTime>1344809460</endTime>
<interval>300</interval>
</meta>
<data>
<sslvpn>
<sslvpnBytesOut>
<dashboardStatistic>
234

<!-- in seconds -->


<!-- in seconds -->

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<timestamp>1344809160</timestamp>
<value>0.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>0.0</value>
</dashboardStatistic>
</sslvpnBytesOut>
<sslvpnBytesIn>
<dashboardStatistic>
<timestamp>1344809160</timestamp>
<value>0.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>0.0</value>
</dashboardStatistic>
</sslvpnBytesIn>
<activeClients>
<dashboardStatistic>
<timestamp>1344809160</timestamp>
<value>4.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>4.0</value>
</dashboardStatistic>
</activeClients>
<authFailures>
<dashboardStatistic>
<timestamp>1344809160</timestamp>
<value>2.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>2.0</value>
</dashboardStatistic>
</authFailures>
<sessionsCreated>
<dashboardStatistic>
<timestamp>1344809160</timestamp>
<value>4.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>4.0</value>
</dashboardStatistic>
</sessionsCreated>
</sslvpn>
</data>
</dashboardStatistics>

Working with L2 VPN


L2VPNallowsyoutoconfigureatunnelbetweentwosites.Virtualmachinesremainonthesamesubnetin
spiteofbeingmovedbetweenthesesites,whichenablesyoutoextendyourdatacenter.AnNSXEdgeatone
sitecanprovideallservicestovirtualmachinesontheothersite.
InordertocreatetheL2VPNtunnel,youconfigureanL2VPNserverandL2VPNclient.

Configure L2VPN
YoufirstenabletheL2VPNserviceontheNSXEdgeinstanceandthenconfigureaserverandaclient.

VMware, Inc.

235

vShield API Programming Guide

Example 8-177. Configure L2VPN


Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/l2vpn/config/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<l2Vpn>
<enabled>true</enabled> <!-- Optional, true by default -->
<logging> <!-- optional. Disable by default. -->
<logLevel>debug</logLevel> <!-- optional, default is INFO. -->
<enable>true</enable> <!-- optional, false by default. -->
</logging>
<l2VpnSites>
<l2VpnSite>
<enabled>true</enabled> <!-- Optional, true by default -->
<name></name> <!-- Optional -->
<description></description> <!-- Optional -->
<server> <!-- optional. Either server or client should be configured-->
<configuration>
<listenerIp>11.0.0.11</listenerIp> <!-- Required. IP of external interface onwhich L2VPN service to listen on -->
<listenerPort>443</listenerPort> <!-- optional. 443 by default. Port onwhich L2VPN service to listen on -->
<encryptionAlgorithm>AES256-SHA</encryptionAlgorithm> <!-- Optional, aes256 by default.-->
<serverCertificate>certificate-4</serverCertificate> <!-- Optional. If not specified server will use its default(selfsigned) certificate-->
<vnic>0</vnic> <!-- Required. Traffic from this internal vnic interface will be forwarded to L2VPN tunnel -->
</configuration>
<l2VpnUsers> <!-- Required. List of users will be added in server's local database and will authenticate client when connects with
these credentials-->
<l2VpnUser>
<userId>admin</userId>
<password>default</password>
</l2VpnUser>
</l2VpnUsers>
</server>
<client> <!-- optional. Either server or client should be configured-->
<configuration>
<serverAddress>11.0.0.11</serverAddress> <!-- Required. IP/Hostname to connect -->
<serverPort>443</serverPort> <!-- optional. 443 by default. Port to connect on -->
<caCertificate>certificate-4</caCertificate> <!-- Optional. Validate server certificate sent from server againt this cerficate-->
<vnic>0</vnic> <!-- Required. Traffic from this internal vnic interface will be forwarded to L2VPN tunnel -->
</configuration>
<proxySetting> <!-- Optional, List of proxy configurations -->
<type>http</type>
<address>10.112.243.202</address>
<port>443</port>
<userName>root</userName>
<password>java123</password>
</proxySetting>
<l2VpnUser> <!-- Required. these credentials will be used to get authenticated by server-->
<userId>admin</userId>
<password>default</password>
</l2VpnUser>
</client>
</l2VpnSite>
</l2VpnSites>

236

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

</l2Vpn>

Query L2VPN
RetrievesthecurrentL2VPNconfigurationforNSXEdge.
Example 8-178. Query L2VPN
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/l2vpn/config/

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<l2Vpn>
<enabled>true</enabled>
<logging>
<logLevel>debug</logLevel>
<enable>true</enable>
</logging>
<l2VpnSites>
<l2VpnSite>
<enabled>true</enabled>
<name></name>
<description></description>
<server>
<configuration>
<listenerIp>11.0.0.11</listenerIp>
<listenerPort>443</listenerPort>
<encryptionAlgorithm>AES256-SHA</encryptionAlgorithm>
<serverCertificate>certificate-4</serverCertificate>
<vnic>0</vnic>
</configuration>
<l2VpnUsers>
<l2VpnUser>
<userId>admin</userId>
</l2VpnUser>
</l2VpnUsers>
</server>
</l2VpnSite>
</l2VpnSites>
</l2Vpn>

Query L2VPN Statistics


RetrievesL2VPNstatisticswhichhasinformationsuchastunnelstatus,sentbytes,recievedbytesetc.forthe
givenedge.
Example 8-179. Query L2VPN statistics
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/l2vpn/config/statistics

ResponseBody:

VMware, Inc.

237

vShield API Programming Guide

<l2vpnStatusAndStats>
<timeStamp>1380045713</timeStamp>
<siteStats>
<l2vpnStats>
<tunnelStatus>up</tunnelStatus>
<establishedDate>0</establishedDate>
<txBytesFromLocalSubnet>1726046</txBytesFromLocalSubnet>
<rxBytesOnLocalSubnet>1838385</rxBytesOnLocalSubnet>
</l2vpnStats>
</siteStats>
</l2vpnStatusAndStats>

Enable L2VPN
EnablesordisablestheL2VPNserviceonedgeapplianceaccordingtothevalueofthequeryparameter
enableService.
Example 8-180. Enable L2VPN
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/l2vpn/config/?enableService=true

ResultCodes:
OnSuccess:204NoContent
OnFailure:

400BadRequest

403Forbiddeniftheuserisnothavingappropriateroleandscope

404Notfound

Delete L2VPN
Example 8-181. Delete L2VPN
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/l2vpn/config/

Working with IPSEC VPN


NSXEdgesupportssitetositeIPSecVPNbetweenanNSXEdgeinstanceandremotesites.NSXEdge
supportscertificateauthentication,presharedkeymode,IPunicasttraffic,andnodynamicroutingprotocol
betweentheNSXEdgeinstanceandremoteVPNrouters.BehindeachremoteVPNrouter,youcanconfigure
multiplesubnetstoconnecttotheinternalnetworkbehindanNSXEdgethroughIPSectunnels.Thesesubnets
andtheinternalnetworkbehindaNSXEdgemusthaveaddressrangesthatdonotoverlap.
YoucandeployanNSXEdgeagentbehindaNATdevice.Inthisdeployment,theNATdevicetranslatesthe
VPNaddressofanNSXEdgeinstancetoapubliclyaccessibleaddressfacingtheInternet.RemoteVPNrouters
usethispublicaddresstoaccesstheNSXEdgeinstance.
YoucanplaceremoteVPNroutersbehindaNATdeviceaswell.YoumustprovidetheVPNnativeaddress
andtheVPNGatewayIDtosetupthetunnel.Onbothends,staticonetooneNATisrequiredfortheVPN
address.
Youcanhaveamaximumof64tunnelsacrossamaximumof10sites.

238

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-182. Configure IPSEC VPN


Request:
PUT https://<vsm-ip>/api/4.0/edges/<edgeId>/ipsec/config

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<ipsec>
<enabled>true</enabled> <!-- Optional, true by default -->
<logging> <!-- optional. logging is disable by default. -->
<logLevel>debug</logLevel> <!-- optional, default is info. -->
<enable>true</enable> <!-- optional, default is false. -->
</logging>
<global>
<psk>hello123</psk> <!-- Required only when peerIp is specified as any in siteConfig -->
<serviceCertificate>certificate-4</serviceCertificate> <!-- Required when x.509 certificate mode is selected -->
<caCertificates> <!-- Optional, CA list -->
<caCertificate>certificate-3</caCertificate>
</caCertificates>
<crlCertificates> <!-- Optional, CRL list -->
<crlCertificate>crl-1</crlCertificate>
</crlCertificates>
</global>
<sites>
<site>
<enabled>true</enabled>
<!-- Optional, true by default -->
<name>VPN to edge-pa-1</name>
<!-- Optional -->
<description>psk VPN to edge-pa-1 192.168.11.0/24 == 192.168.1.0/24</description>
<!-- Optional -->
<localId>11.0.0.11</localId>
<localIp>11.0.0.11</localIp>
<peerId>11.0.0.1</peerId>
<peerIp>any</peerIp>
<!-- Can be a Ipv4Address such as 11.0.0.3 -->
<encryptionAlgorithm>aes256</encryptionAlgorithm>
<!-- Optional, default aes256-->
<authenticationMode>psk</authenticationMode>
<!-- Possible values are psk and x.509 -->
<!-- <psk>hello123</psk> -->
<!-- Required if peerIp is not any -->
<enablePfs>true</enablePfs>
<!-- Optional, true by default -->
<dhGroup>dh2</dhGroup>
<!-- Optional, dh2 by default -->
<localSubnets>
<subnet>192.168.11.0/24</subnet>
</localSubnets>
<peerSubnets>
<subnet>192.168.1.0/24</subnet>
</peerSubnets>
</site>
<site>
<name>VPN to edge-right</name>
<description>certificate VPN to edge-right 192.168.22.0/24 == 192.168.2.0/24</description>
<localId>11.0.0.12</localId>
<localIp>11.0.0.12</localIp>
<peerId>C=CN, ST=BJ, L=BJ, O=VMware, OU=DEV, CN=Right</peerId> <!-- Should be a DN if
authenticationMode is x.509 -->
<peerIp>11.0.0.2</peerIp>
<encryptionAlgorithm>aes256</encryptionAlgorithm>
<authenticationMode>x.509</authenticationMode>
<enablePfs>true</enablePfs>
<dhGroup>dh2</dhGroup>
<localSubnets>
<subnet>192.168.22.0/24</subnet>
</localSubnets>
<peerSubnets>
<subnet>192.168.2.0/24</subnet>
</peerSubnets>
</site>
</sites>

VMware, Inc.

239

vShield API Programming Guide

</ipsec>

Retrieve IPSec Configuration


Example 8-183. Get IPSec Configuration
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/ipsec/config

ResponseBodywhenIPSecisnotconfigured:
<?xml version="1.0" encoding="UTF-8"?>
<ipsec>
<enabled>true</enabled>
<logging>
<enable>true</enable>
<logLevel>debug</logLevel>
</logging>
<sites/> <!-- No site to site config present -->
</ipsec>

ResponseBodywhenIPSecisconfiguredforsitetosite:
<?xml version="1.0" encoding="UTF-8"?>
<ipsec>
<enabled>true</enabled>
<logging>
<logLevel>debug</logLevel>
<enable>true</enable>
</logging>
<global>
<psk>hello123</psk>
<serviceCertificate>certificate-4</serviceCertificate>
<caCertificates> <!-- Optional, CA list -->
<caCertificate>certificate-3</caCertificate>
</caCertificates>
<crlCertificates>
<crlCertificate>crl-1</crlCertificate>
</crlCertificates>
</global>
<sites>
<site>
<enabled>true</enabled>
<name>VPN to edge-pa-1</name>
<description>psk VPN to edge-pa-1 192.168.11.0/24 == 192.168.1.0/24</description>
<localId>11.0.0.11</localId>
<localIp>11.0.0.11</localIp>
<peerId>11.0.0.1</peerId>
<peerIp>any</peerIp>
<encryptionAlgorithm>aes256</encryptionAlgorithm>
<authenticationMode>psk</authenticationMode>
<enablePfs>true</enablePfs>
<dhGroup>dh2</dhGroup>
<localSubnets>
<subnet>192.168.11.0/24</subnet>
</localSubnets>
<peerSubnets>
<subnet>192.168.1.0/24</subnet>
</peerSubnets>
</site>
<site>
<name>VPN to edge-right</name>
<description>certificate VPN to edge-right 192.168.22.0/24 == 192.168.2.0/24</description>
<localId>11.0.0.12</localId>
<localIp>11.0.0.12</localIp>
<peerId>C=CN, ST=BJ, L=BJ, O=VMware, OU=DEV, CN=Right</peerId>

240

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<peerIp>11.0.0.2</peerIp>
<encryptionAlgorithm>aes256</encryptionAlgorithm>
<authenticationMode>x.509</authenticationMode>
<enablePfs>true</enablePfs>
<dhGroup>dh2</dhGroup>
<localSubnets>
<subnet>192.168.22.0/24</subnet>
</localSubnets>
<peerSubnets>
<subnet>192.168.2.0/24</subnet>
</peerSubnets>
</site>
</sites>
</ipsec>

Retrieve IPSec Statistics


Example 8-184. Get IPSEC statistics
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/ipsec/statistics

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ipsecStatusAndStats>
<siteStatistics>
<ikeStatus>
<channelStatus>up</channelStatus>
<channelState>STATE_MAIN_I4 (ISAKMP SA established)</channelState>
<lastInformationalMessage></lastInformationalMessage>
<localIpAddress>10.0.0.12</localIpAddress>
<peerId>11.0.0.12</peerId>
<peerIpAddress>10.0.0.2</peerIpAddress>
</ikeStatus>
<tunnelStats>
<tunnelStatus>up</tunnelStatus>
<tunnelState>STATE_QUICK_I2 (sent QI2, IPsec SA established)</tunnelState>
<lastInformationalMessage></lastInformationalMessage>
<localSubnet>192.168.2.0/24</localSubnet>
<peerSubnet>192.168.22.0/24</peerSubnet>
</tunnelStats>
</siteStatistics>
<siteStatistics>
<ikeStatus>
<channelStatus>up</channelStatus>
<channelState>STATE_MAIN_I4 (ISAKMP SA established)</channelState>
<lastInformationalMessage></lastInformationalMessage>
<localIpAddress>10.0.0.11</localIpAddress>
<peerId>11.0.0.11</peerId>
<peerIpAddress>10.0.0.1</peerIpAddress>
</ikeStatus>
<tunnelStats>
<tunnelStatus>up</tunnelStatus>
<tunnelState>STATE_QUICK_I2 (sent QI2, IPsec SA established)</tunnelState>
<lastInformationalMessage></lastInformationalMessage>
<localSubnet>192.168.1.0/24</localSubnet>
<peerSubnet>192.168.11.0/24</peerSubnet>
</tunnelStats>
</siteStatistics>
<timeStamp>1325766138</timeStamp>
</ipsecStatusAndStats>

VMware, Inc.

241

vShield API Programming Guide

Query Tunnel Traffic Statistics


Retrievestunneltrafficstatisticsforthespecifiedtimeinterval.Defaultintervalis1hour.Otherpossiblevalues
are1-60 minutes|one day|one week|one month|one year.
Example 8-185. Get tunnel traffic statistics
Request:
GET https://<vsm-ip>/api/4.0/edges/<edgeId>/statistics/dashboard/ipsec?interval=<range>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<dashboardStatistics>
<meta>
<startTime>1344809160</startTime>
<!-- in seconds -->
<endTime>1344809460</endTime>
<!-- in seconds -->
<interval>300</interval>
</meta>
<data>
<ipsec>
<ipsecTunnels>
<dashboardStatistic>
<timestamp>1344809160</timestamp>
<value>0.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>0.0</value>
</dashboardStatistic>
</ipsecTunnels>
<ipsecBytesIn>
<dashboardStatistic>
<timestamp>1344809160</timestamp>
<value>0.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>0.0</value>
</dashboardStatistic>
</ipsecBytesIn>
<ipsecBytesOut>
<dashboardStatistic>
<timestamp>1344809160</timestamp>
<value>0.0</value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp>1344809460</timestamp>
<value>0.0</value>
</dashboardStatistic>
</ipsecBytesOut>
</ipsec>
</data>
</dashboardStatistics>

Delete IPSec Configuration


DeletestheIPSECconfigurationforthespecifiedNSXEdge.
Example 8-186. Delete IPSec
Request:
DELETE https://<vsm-ip>/api/4.0/edges/<edgeId>/ipsec/config/

242

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Managing an NSX Edge


Force Sync Edge
ResynchronizestheNSXEdgevirtualmachines.
Example 8-187. Force sync Edge
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId}?action=forcesync

Redeploy Edge
RedeploysNSXEdgevirtualmachines.
Example 8-188. Redeploy Edge
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId}?action=redeploy

Update DNS Settings


Updatednssettings(primary/secondaryandsearchdomain)ofanEdge.
Example 8-189. Update DNS
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/dnsClient

RequestBody:

<dnsClient>
<primaryDns>10.117.0.1</primaryDns>
<secondaryDns>10.117.0.2</secondaryDns>
<domainName>vmware.com</domainName>
<domainName>foo.com</domainName>
</dnsClient>

Modify AESNI Setting


RedeploysNSXEdgevirtualmachines.
Example 8-190. Modify AESNI
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/aesni?enable=true|false

VMware, Inc.

243

vShield API Programming Guide

Modify Edge Appliance Core Dump Setting


EnablingEdgeappliancecoredumpfeatureresultsindeploymentofaninbuiltextradisktosavethe
coredumpfiles.Theextradiskconsumes1GBforcompactedgeand8GBforotheredgetypes.Disablingthis
featuredetachesthedisk.
Example 8-191. Modify core dump setting
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/coredump?enable=true|false

Modify FIPs Setting


Example 8-192. Modify FIPs
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/fips?enable=true|false

Modify Log Setting


Example 8-193. Modify log setting
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/logging?level=<logLevel>

Query Edge Summary


RetrievesdetailsaboutthespecifiedEdge.
Example 8-194. Retrieve Edge details
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/summary

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<edgeSummary>
<objectId>edge-32</objectId>
<type>
<typeName>Edge</typeName>
</type>
<name>vShield-edge-32</name>
<revision>16</revision>
<objectTypeName>Edge</objectTypeName>
<id>edge-32</id>
<state>deployed</state>
<datacenterMoid>datacenter-2</datacenterMoid>
<datacenterName>Datacenter</datacenterName>
<apiVersion>4.0</apiVersion>
<numberOfConnectedVnics>2</numberOfConnectedVnics>
<appliancesSummary>
<vmVersion>5.1.0</vmVersion>
<applianceSize>compact</applianceSize>
<fqdn>vShield-edge-32</fqdn>
<numberOfDeployedVms>1</numberOfDeployedVms>
<activeVseHaIndex>0</activeVseHaIndex>
<vmMoidOfActiveVse>vm-301</vmMoidOfActiveVse>
244

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<vmNameOfActiveVse>vShield-edge-32-0</vmNameOfActiveVse>
<hostMoidOfActiveVse>host-159</hostMoidOfActiveVse>
<hostNameOfActiveVse>10.20.114.8</hostNameOfActiveVse>
<resourcePoolMoidOfActiveVse>resgroup-208</resourcePoolMoidOfActiveVse>
<resourcePoolNameOfActiveVse>Resources</resourcePoolNameOfActiveVse>
<dataStoreMoidOfActiveVse>datastore-160</dataStoreMoidOfActiveVse>
<dataStoreNameOfActiveVse>storage1</dataStoreNameOfActiveVse>
<statusFromVseUpdatedOn>1310625858000</statusFromVseUpdatedOn>
</appliancesSummary>
<featureCapabilities>
<timestamp>1337956125602</timestamp>
<featureCapability>
<service>nat</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_RULES_PER_ACTION</key>
<value>2048</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>syslog</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_SERVER_IPS</key>
<value>2</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>staticRouting</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_ROUTES</key>
<value>2048</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>ipsec</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_TUNNELS</key>
<value>64</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>loadBalancer</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_POOLS</key>
<value>10</value>
</configurationLimit>
<configurationLimit>
<key>MAX_VIRTUAL_SERVERS</key>
<value>10</value>
</configurationLimit>
<configurationLimit>
<key>MAX_MEMBERS_IN_POOL</key>
<value>32</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>fw</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_RULES</key>
<value>2048</value>
</configurationLimit>
</featureCapability>
<featureCapability>

VMware, Inc.

245

vShield API Programming Guide

<service>dns</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_SERVER_IPS</key>
<value>2</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>sslvpn</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_CONCURRENT_USERS</key>
<value>25</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>edge</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_APPLIANCES</key>
<value>2</value>
</configurationLimit>
<configurationLimit>
<key>MAX_VNICS</key>
<value>10</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>firewall</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_RULES</key>
<value>2048</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>dhcp</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_POOL_AND_BINDINGS</key>
<value>2048</value>
</configurationLimit>
</featureCapability>
<featureCapability>
<service>highAvailability</service>
<isSupported>true</isSupported>
<configurationLimit>
<key>MAX_MANAGEMENT_IPS</key>
<value>2</value>
</configurationLimit>
</featureCapability>
</featureCapabilities>
</edgeSummary>

Query Edge Status


RetrievesthestatusofthespecifiedEdge.
Example 8-195. Query status
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/status

RequestBody:
<edgeStatus>

246

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<timestamp>1343739873000</timestamp>
<systemStatus>good</systemStatus>
<activeVseHaIndex>0</activeVseHaIndex>
<edgeStatus>GREEN</edgeStatus>
<!-- {GREY,RED,YELLOW,GREEN}. GREY => unknown status. RED => None of appliance in serving state. YELLOW =>
Intermittent health check failures.
If health check fails for 5 consecutive times for all appliance (2 for HA else 1) then status will turn to RED. GREEN => Good
-->
<publishStatus>APPLIED</publishStatus> <!-- Applied or persisted i.e., not applied to vse yet-->
<version>8</version> <!-- Current configuration version -->
<edgeVmStatus>
<edgeVmStatus>
<edgeVMStatus>GREEN</edgeVMStatus> <!-- individual vm status -->
<haState>active</haState> <!-- active / standy -->
<index>0</index>
<id>vm-358</id>
<name>test2-0</name>
</edgeVmStatus>
<edgeVmStatus>
<edgeVMStatus>GREEN</edgeVMStatus>
<haState>active</haState>
<index>1</index>
<id>vm-362</id>
<name>test2-1</name>
</edgeVmStatus>
</edgeVmStatus>
<featureStatuses>
<featureStatus>
<service>loadBalancer</service>
<configured>false</configured>
<serverStatus>down</serverStatus>
</featureStatus>
<featureStatus>
<service>dhcp</service>
<configured>true</configured>
<publishStatus>Applied</publishStatus>
<serverStatus>up</serverStatus>
</featureStatus>
<featureStatus>
<service>sslvpn</service>
<configured>false</configured>
<serverStatus>down</serverStatus>
</featureStatus>
<featureStatus>
<service>syslog</service>
<configured>false</configured>
<serverStatus>up</serverStatus>
</featureStatus>
<featureStatus>
<service>nat</service>
<configured>false</configured>
</featureStatus>
<featureStatus>
<service>dns</service>
<configured>false</configured>
<serverStatus>down</serverStatus>
</featureStatus>
<featureStatus>
<service>ipsec</service>
<configured>false</configured>
<serverStatus>down</serverStatus>
</featureStatus>
<featureStatus>
<service>firewall</service>
<configured>true</configured>
<publishStatus>Applied</publishStatus>
</featureStatus>
<featureStatus>

VMware, Inc.

247

vShield API Programming Guide

<service>staticRouting</service>
<configured>false</configured>
</featureStatus>
<featureStatus>
<service>highAvailability</service>
<configured>true</configured>
<publishStatus>Applied</publishStatus>
<serverStatus>up</serverStatus>
</featureStatus>
</featureStatuses>
</edgeStatus>

Thiscallcanbeusedwiththefollowingqueryparameters:

getlatest:fetchesthestatuslivefromNSXEdgewhensettotrue(default).Whenfalse,fetchesthelatest
availablestatusfromdatabase.

detailed:fetchesthedetailedstatusperfeaturewhensettotrue.Whenfalse(default),givesanaggregated
summaryofthestatusperfeature.

Samplecallsinclude:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/status?getlatest=false&detailed=true
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/status?getlatest=true&detailed=true
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/status?getlatest=false&detailed=false
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/status?detailed=true
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/status?getlatest=false

Query Edge Tech Support Logs


RetrievesthetechsupportlogsforthespecifiedEdge.
Example 8-196. Query tech support logs
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/techsupportlogs

Manage CLI Credentials and Access


YoucanmodifytheCLIcredentialsandenableordisableSSHservicesforaEdgeEdge.

Modify CLI Credentials


YoucanusethisAPIto:

ModifythepasswordandpasswordexpiryforanexistingCLIuser.

ChangetheCLIlogin(ssh)bannertext.

ModifyboththeusernameandpasswordforEdgeCLIUser.Thisresultsin:

deletionoftheolduser.

creationofthenewuserwithspecifiedusernameandpassword.

Example 8-197. Modify CLI credentials


Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/{edgeId}/clisettings

RequestBody:
<cliSettings> <!-- optional. Default user/pass is admin/default, and remoteAccess is false (i.e. disabled) -->
<userName>test</userName>

248

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<password>testpass</password>
<remoteAccess>true</remoteAccess>
<passwordExpiry>30</passwordExpiry> <!-- optional. in days. defaults to 90.-->
<sshLoginBannerText>
<!-- optional. pre-formatted text. default to system default banner text. -->
Hello, VshieldEdge Administrator
</sshLoginBanerText>
</cliSettings>

Change CLI Remote Access


EnablesordisablestheSSHserviceonthespecifiedEdgeEdge.
Example 8-198. Change CLI remote access
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/cliremoteaccess?enable=true|false

Manage Auto Configuration Settings


Autoconfigurationdefaultsettingisenabledbydefaultandthepriorityishigh.
Ifyoudisableautoconfigurationsettings,youmustaddtherequiredNAT,firewall,routingrulestoenable
controlchanneltrafficforotherservicessuchasloadbalancing,VPN,etc.
Ifyouchangethepriorityoftheautoconfigurationsettingstolow,theinternal/autoconfiguredrulesare
placedinlowerprecedencethantherulesyoucreate.Withthis,youcanagaincontrolspecialallow/denyrules
fortheseservicestoo.Forexample,youcanblockspecificIPaddressesfromaccessingtheVPNservices.

Modify Auto Configuration Settings


ChangestheautoconfigurationsettingsfortheNSXEdge.
Example 8-199. Modify auto configuration settings
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/autoconfiguration

RequestBody:
<autoConfiguration>
<enabled>true</enabled>
<rulePriority>high</rulePriority>
</autoConfiguration>

Query Auto Configuration Settings


RetrievesautoconfigurationsettingsfortheNSXEdge.
Example 8-200. Retrieve auto configuration settings
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/autoconfiguration

ResponseBody:
<autoConfiguration>
<enabled>true</enabled>
<rulePriority>high</rulePriority>
</autoConfiguration>

Working with Appliances


YoucanmanagetheEdgeEdgeapplianceswiththeseRESTcalls.

VMware, Inc.

249

vShield API Programming Guide

NOTEDonotusehidden/systemresourcepoolIDsastheyarenotsupportedontheUI.

Query Appliance Configuration


Retrievesconfigurationofbothappliances.
Example 8-201. Get appliance configuration
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/appliances

ResponseBody:
<appliances>
<applianceSize>large</applianceSize>
<appliance>
<highAvailabilityIndex>0</highAvailabilityIndex>
<resourcePoolId>resgroup-53</resourcePoolId>
<datastoreId>datastore-29</datastoreId>
<hostId>host-28</hostId>
<vmFolderId>group-v38</vmFolderId>
<customField>
<key>system.service.vmware.vsla.main01</key>
<value>string</value>
</customField>
<cpuReservation>
<limit>2399</limit>
<reservation>500</reservation>
<shares>500</shares>
</cpuReservation>
<memoryReservation>
<limit>5000</limit>
<reservation>500</reservation>
<shares>20480</shares>
</memoryReservation>
</appliance>
<appliance>
<highAvailabilityIndex>1</highAvailabilityIndex>
<resourcePoolId>resgroup-53</resourcePoolId>
<datastoreId>datastore-29</datastoreId>
<hostId>host-28</hostId>
<vmFolderId>group-v38</vmFolderId>
<customField>
<key>system.service.vmware.vsla.main01</key>
<value>string</value>
</customField>
<cpuReservation>
<limit>2399</limit>
<reservation>500</reservation>
<shares>500</shares>
</cpuReservation>
<memoryReservation>
<limit>5000</limit>
<reservation>500</reservation>
<shares>20480</shares>
</memoryReservation>
</appliance>
</appliances>

Modify Appliance Configuration


YoucanretrievetheconfigurationofbothappliancesbyusingtheGETcallinExample 8201andreplacethe
size,resourcepool,datastore,andcustomparametersoftheappliancesbyusingaPUTcall.Ifthereweretwo
appliancesearlieryouPUTonlyoneappliance,theotherapplianceisdeleted.

250

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-202. Modify appliance configuration


Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/appliances

RequestBody:
<appliances>
<applianceSize>COMPACT</applianceSize>
<appliance>
<resourcePoolId>resgroup-1610</resourcePoolId>
<datastoreId>datastore-5288</datastoreId>
</appliance>
<appliance>
<resourcePoolId>resgroup-1610</resourcePoolId>
<datastoreId>datastore-5288</datastoreId>
</appliance>
</appliances>

Change Appliance Size


Changesthesizeofbothappliances.
Example 8-203. Change appliance size
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/appliances/?size=compact|large|xlarge

Manage an Appliance
YoucanmanageanappliancebyspecifyingitsHAindex.
Query Appliance
RetrievestheconfigurationoftheappliancewiththespecifiedhaIndex.
Example 8-204. Get configuration of appliance with specified haIndex
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/appliances/haIndex

ResponseBody:
<appliance>
<resourcePoolId>resgroup-53</resourcePoolId>
<datastoreId>datastore-29</datastoreId>
<hostId>host-28</hostId>
<vmFolderId>group-v38</vmFolderId>
<customField>
<key>system.service.vmware.vsla.main01</key>
<value>string</value>
</customField>
<cpuReservation>
<limit>2399</limit>
<reservation>500</reservation>
<shares>500</shares>
</cpuReservation>
<memoryReservation>
<limit>5000</limit>
<reservation>500</reservation>
<shares>20480</shares>
</memoryReservation>

VMware, Inc.

251

vShield API Programming Guide

</appliance>

Modify Appliance
ModifiestheconfigurationoftheappliancewiththespecifiedhaIndex.
Example 8-205. Modify configuration of appliance with specified haIndex
Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/appliances/haIndex

RequestBody:
<appliance>
<resourcePoolId>resgroup-53</resourcePoolId>
<datastoreId>datastore-29</datastoreId>
<hostId>host-28</hostId>
<vmFolderId>group-v38</vmFolderId>
<customField>
<key>system.service.vmware.vsla.main01</key>
<value>string</value>
</customField>
<cpuReservation>
<limit>2399</limit>
<reservation>500</reservation>
<shares>500</shares>
</cpuReservation>
<memoryReservation>
<limit>5000</limit>
<reservation>500</reservation>
<shares>20480</shares>
</memoryReservation>
</appliance>

Delete Appliance
DeletestheappliancewiththespecifiedhaIndex.
Example 8-206. Delete appliance configuration
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/appliances/haIndex

Working with Interfaces


YoucanadduptoteninternaloruplinkinterfacestoeachEdgeEdgeinstance.AEdgeEdgemusthaveatleast
oneinternalinterfacebeforeitcanbedeployed.

Add Interfaces
YoucanconfigureoneormoreinterfaceforanNSXEdge.Thespecifiedconfigurationisstoredinthedatabase.
Ifanyappliance(s)isassociatedwiththisEdgeEdgeinstance,thespecifiedconfigurationisappliedtothe
applianceaswell.
Example 8-207. Add an interface
Request:
POST https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/vnics/?action=patch

RequestBody:
252

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

<vnics> <!-- mamimum 10 interfaces index:0-9 can be configured. Until one connected vnic is configured, none of the configured
features will serve the network -->
<vnic>
<index>0</index>
<name>internal0</name> <!-- optional. System has default Names. format vNic0 ... vNic7 -->
<type>internal</type> <!-- optional. Default is internal. Other possible value is "uplink" -->
<portgroupId>dvportgroup-114</portgroupId> <!-- Possible values here are portgroupIds or virtualWire-id. portgroupId needs to be
defined if isConnected=true -->
<addressGroups>
<addressGroup> <!-- Vnic can be configured to have more than one addressGroup/subnets -->
<primaryAddress>192.168.3.1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>192.168.3.2</ipAddress>
<ipAddress>192.168.3.3</ipAddress> <!-- Optional. This way multiple IP Addresses can be assigned to a vnic/interface -->
</secondaryAddresses>
<subnetMask>255.255.255.0</subnetMask> <!-- either subnetMask or subnetPrefixLength should be provided. If both then
subnetprefixLength is ignored -->
</addressGroup>
<addressGroup> <!-- Vnic can be configured to have more than one addressGroup/subnets -->
<primaryAddress>192.168.4.1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>192.168.4.2</ipAddress>
<ipAddress>192.168.4.3</ipAddress> <!-- Optional. This way multiple IP Addresses can be assigned to a vnic/interface -->
</secondaryAddresses>
<subnetPrefixLength>24</subnetPrefixLength>
</addressGroup>
<addressGroup> <!-- ipv6 addressGroup -->
<primaryAddress>ffff::1</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses> <!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>ffff::2</ipAddress>
</secondaryAddresses>
<subnetPrefixLength>64</subnetPrefixLength> <!-- prefixLength valid values 1-128 -->
</addressGroup>
</addressGroups>
<macAddress> <!-- optional. When not specified, macAddresses will be managed by VC -->
<edgeVmHaIndex>0</edgeVmHaIndex> <!-- possible values 0 or 1 when HA is enabled -->
<value>00:50:56:01:03:23</value> <!-- optional. User must ensure that macAddresses provided are unique within the given layer 2
domain. -->
</macAddress>
<fenceParameter> <!-- optional -->
<key>ethernet0.filter1.param1</key>
<value>1</value>
</fenceParameter>
<mtu>1500</mtu> <!-- optional. Default is 1500 -->
<enableProxyArp>false</enableProxyArp> <!-- optional. Default is false -->
<enableSendRedirects>true</enableSendRedirects> <!-- optional. Default is true -->
<enableBridgeMode>false</enableBridgeMode> <!-- optional. Default is false -->
<isConnected>true</isConnected> <!-- optional. Default is false -->
<inShapingPolicy> <!-- optional -->
<averageBandwidth>200000000</averageBandwidth>
<peakBandwidth>200000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</inShapingPolicy>
<outShapingPolicy> <!-- optional -->
<averageBandwidth>400000000</averageBandwidth>
<peakBandwidth>400000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</outShapingPolicy>
</vnic>
</vnics>

where:

VMware, Inc.

253

vShield API Programming Guide

inShapingPolicy,outShapingPolicyareoptional.Canonlybespecifiedforavnicconnectedtoa
distributedportgroup.

averageBandwidthisarequiredfield.Otherfieldsareoptional.Ifnotspecified,peakBandwidthis
defaultedtoaverageBandwidth,burstSizeisdefaultedto0,enabledisdefaultedtotrue,inheritedis
defaultedtofalse.averageBandwidth,peakBandwidthandburstSizevaluesareinbitspersecond.

addressGroupscontainsIPaddressesfortheinterfacewitheachaddressGrouprepresentingtheIPaddresses
withinthesamesubnet.Foreachsubnet,youcanspecifyaprimaryAddress(required),secondaryAddress
(optional),andthesubnetMask(required).

Retrieve Interfaces for a Edge Edge


RetrievesallinterfacesforthespecifiedEdgeEdge.
Example 8-208. Retrieve all interfaces
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/vnics

ResponseBody:
<vnics>
<vnic>
<index>0</index>
<name>uplink-vnic-network-2581</name>
<type>uplink</type>
<portgroupId>network-2581</portgroupId>
<addressGroups>
<addressGroup>
<primaryAddress>10.112.2.40</primaryAddress>
<secondaryAddresses>
<ipAddress>10.112.2.42</ipAddress>
</secondaryAddresses>
<subnetMask>255.255.254.0</subnetMask>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<enableProxyArp>false</enableProxyArp>
<enableSendRedirects>true</enableSendRedirects>
<isConnected>true</isConnected>
<inShapingPolicy>
<averageBandwidth>200000000</averageBandwidth>
<peakBandwidth>200000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</inShapingPolicy>
<outShapingPolicy>
<averageBandwidth>400000000</averageBandwidth>
<peakBandwidth>400000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</outShapingPolicy>
</vnic>
<vnic>
...
</vnic>
</vnics>

Delete Interfaces
DeletesoneormoreinterfacesforaEdgeEdge.Storesthespecifiedconfigurationindatabase.Ifany
appliance(s)areassociatedwiththisedge,disconnectsanddeletestheinterface.

254

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-209. Delete interface


Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/vnics/?index=<vnicIndexId1>&index=<vnicIndexId2>

Manage a Edge Interface


YoucanmanageaspecificEdgeinterface.

Retrieve Interface with Specific Index


RetrievestheinterfacewithspecifiedindexforaEdgeEdge.
Example 8-210. Get interface with specific index
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/vnics/index

ResponseBody:
<vnic>
<index>0</index>
<name>uplink-vnic-network-2581</name>
<type>uplink</type>
<portgroupId>network-2581</portgroupId>
<portgroupName>Mgmt</portgroupName>
<addressGroups>
<addressGroup>
<primaryAddress>192.168.3.1</primaryAddress>
<secondaryAddresses>
<ipAddress>192.168.3.2</ipAddress>
<ipAddress>192.168.3.3</ipAddress>
</secondaryAddresses>
<subnetMask>255.255.255.0</subnetMask>
</addressGroup>
<addressGroup>
<primaryAddress>192.168.4.1</primaryAddress>
<secondaryAddresses>
<ipAddress>192.168.4.2</ipAddress>
<ipAddress>192.168.4.3</ipAddress>
</secondaryAddresses>
<subnetMask>255.255.255.0</subnetMask> <!-- GET will always have subnetMask field for ipv4 and subnetPrefixLength for ipv6
-->
</addressGroup>
<addressGroup>
<primaryAddress>ffff::1</primaryAddress>
<secondaryAddresses>
<ipAddress>ffff::2</ipAddress>
</secondaryAddresses>
<subnetPrefixLength>64</subnetPrefixLength>
</addressGroup>
</addressGroups>
<mtu>1500</mtu>
<enableProxyArp>false</enableProxyArp>
<enableSendRedirects>true</enableSendRedirects>
<isConnected>true</isConnected>
</vnic>

Modify an Interface
Modifiesthespecifiedinterface.

VMware, Inc.

255

vShield API Programming Guide

Example 8-211. Modify interface


Request:
PUT https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/vnics/<index>

ResponseBody:
<vnic>
<index>0</index>
<!-- optional. System has default Names. format vNic0 ... vNic7 -->
<name>uplink-vnic-network-2581</name>
<!-- optional. Default is internal>
<type>uplink</type>
<portgroupId>network-2581</portgroupId>
<!-- Possible values are portgroupIds or virtualWire-id. portgroupId
needs to be defined if isConnected=true -->
<addressGroups>
<addressGroup>
<!-- Vnic can be configured to have more than one addressGroup/subnets -->
<primaryAddress>10.112.2.40</primaryAddress> <!-- This is mandatory for an addressGroup -->
<secondaryAddresses><!-- Optional. Should be used to add/defined other IPs used for NAT, LB, VPN, etc -->
<ipAddress>10.112.2.42</ipAddress>
</secondaryAddresses>
<subnetMask>255.255.254.0</subnetMask>
</addressGroup>
</addressGroups>
<macAddress>
<!-- optional. When not specified, macAddresses will be managed by VC -->
<edgeVmHaIndex>0</edgeVmHaIndex>
<value>00:50:56:01:03:23</value>
</macAddress>
<fenceParameter>
<!-- optional -->
<key>ethernet0.filter1.param1</key>
<value>1</value>
</fenceParameter>
<mtu>1500</mtu>
<!-- Default is 1500.-->
<enableProxyArp>false</enableProxyArp>
<!--Default is false.-->
<enableSendRedirects>true</enableSendRedirects>
<!--Default is true.-->
<isConnected>true</isConnected>
<!--Default is false.-->
<inShapingPolicy>
<!-- optional -->
<averageBandwidth>200000000</averageBandwidth>
<peakBandwidth>200000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</inShapingPolicy>
<outShapingPolicy>
<!-- optional -->
<averageBandwidth>400000000</averageBandwidth>
<peakBandwidth>400000000</peakBandwidth>
<burstSize>0</burstSize>
<enabled>true</enabled>
<inherited>false</inherited>
</outShapingPolicy>
</vnic>

Delete Interface Configuration


Deletestheinterfaceconfigurationandresetsittothefactorydefault.
Example 8-212. Delete interface configuration
Request:
DELETE https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/vnics/index

256

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Query Interface Statistics


Query Statistics for all Interfaces
Retrievesstatisticsforallconfiguredinterfacesbetweenthespecifiedstartandendtimes.Whenstartandend
timearenotspecified,allstatisticssincetheEdgeEdgedeployedaredisplayed.Whennoendtimeisspecified,
thecurrentEdgeManagertimeissetasendTime.Eachrecordhasthestatsof5minutesgranularity.
Example 8-213. Get interface statistics
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/statistics/interfaces

ResponseBody:
<statistics>
<meta>
<startTime>1336068000</startTime>
<!-- in seconds -->
<endTime>1336100700</endTime>
<!-- in seconds -->
<interval>300</interval>
<!-- 5 mins interval -->
</meta>
<data>
<statistic>
<vnic>0</vnic>
<timestamp>1336068000</timestamp>
<in>9.1914285714e+02</in>
<!-- Rx rate ( Kilobits per second - kbps ) -->
<out>5.1402857143e+02</out>
<!-- Tx rate ( Kilobits per second - kbps ) -->
</statistic>
...
...
<statistic>
<vnic>1</vnic>
<timestamp>1336100700</timestamp>
<in>9.2914285714e+02</in>
<out>5.2402857143e+02</out>
</statistic>
</data>
</statistics>

Query Statistics for Uplink Interfaces


Retrievesstatisticsforalluplinkinterfacesbetweenthespecifiedstartandendtimes.Whenstartandendtime
arenotspecified,allstatisticssincetheEdgeEdgedeployedaredisplayed.Whennoendtimeisspecified,the
currentEdgeManagertimeissetasendTime.Eachrecordhasthestatsof5minutesgranularity.
Example 8-214. Get uplink interface statistics
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/statistics/interfaces/uplink

ResponseBody:
<statistics>
<meta>
<startTime>1336068000</startTime>
<!-- in seconds -->
<endTime>1336100700</endTime>
<!-- in seconds -->
<interval>300</interval>
<!-- 5 mins interval -->
</meta>
<data>
<statistic>
<vnic>0</vnic>

VMware, Inc.

257

vShield API Programming Guide

<timestamp>1336068000</timestamp>
<in>9.1914285714e+02</in>
<!-- Rx rate ( Kilobits per second - kbps ) -->
<out>5.1402857143e+02</out>
<!-- Tx rate ( Kilobits per second - kbps ) -->
</statistic>
...
...
<statistic>
<vnic>1</vnic>
<timestamp>1336100700</timestamp>
<in>9.2914285714e+02</in>
<out>5.2402857143e+02</out>
</statistic>
</data>
</statistics>

Query Statistics for Internal Interfaces


Retrievesstatisticsforallinternalinterfacesbetweenthespecifiedstartandendtimes.Whenstartandend
timearenotspecified,allstatisticssincetheEdgeEdgedeployedaredisplayed.Whennoendtimeisspecified,
thecurrentEdgeManagertimeissetasendTime.Eachrecordhasthestatsof5minutesgranularity.
Example 8-215. Get internal interface statistics
Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/statistics/interfaces/internal

ResponseBody:
<statistics>
<meta>
<startTime>1336068000</startTime>
<!-- in seconds -->
<endTime>1336100700</endTime>
<!-- in seconds -->
<interval>300</interval>
<!-- 5 mins interval -->
</meta>
<data>
<statistic>
<vnic>0</vnic>
<timestamp>1336068000</timestamp>
<in>9.1914285714e+02</in>
<!-- Rx rate ( Kilobits per second - kbps ) -->
<out>5.1402857143e+02</out>
<!-- Tx rate ( Kilobits per second - kbps ) -->
</statistic>
...
...
<statistic>
<vnic>1</vnic>
<timestamp>1336100700</timestamp>
<in>9.2914285714e+02</in>
<out>5.2402857143e+02</out>
</statistic>
</data>
</statistics>

Query Dashboard Statistics


Retrievesdashboardstatisticsbetweenthespecifiedstartandendtimes.Whenstartandendtimearenot
specified,allstatisticssincetheEdgeEdgedeployedaredisplayed.Whennoendtimeisspecified,thecurrent
EdgeManagertimeissetasendTime.Eachrecordhasthestatsof5minutesgranularity.

258

VMware, Inc.

Chapter 8 NSX Edge Services Gateway Installation, Upgrade, and Management

Example 8-216. Get interface statistics


Request:
GET https://<nsxmgr-ip>/api/4.0/edges/<edgeId>/statistics/dashboard/interface?interval=<range>

ResponseBody:
<dashboardstatistics>
<meta>
<startTime>1336068000</startTime>
<!-- in seconds -->
<endTime>1336100700</endTime>
<!-- in seconds -->
<interval>300</interval>
<!-- 5 mins interval -->
</meta>
<data>
<interfaces>
<vNic_0_in_pkt>
<dashboardStatistic>
<timestamp></timestamp>
<value></value>
</dashboardStatistic>
<dashboardStatistic>
<timestamp></timestamp>
<value></value>
</dashboardStatistic>
...
...
<vNic_0_in_pkt>
...
...
</interfaces>
</data>
</data>
</dashboardstatistics>

VMware, Inc.

259

vShield API Programming Guide

260

VMware, Inc.

Distributed Firewall Management

DistributedFirewallisahypervisorkernelembeddedfirewallthatprovidesvisibilityandcontrolfor
virtualizedworkloadsandnetworks.YoucancreateaccesscontrolpoliciesbasedonVMwarevCenterobjects
likedatacentersandclusters,virtualmachinenamesandtags,networkconstructslikeIP/VLAN/VXLAN
addresses,aswellasusergroupidentityfromActiveDirectory.FirewallrulesareenforcedatthevNIClevel
ofeachvirtualmachinetoprovideconsistentaccesscontrolevenwhenthevirtualmachinegetsvMotioned.
Thehypervisorembeddednatureofthefirewalldeliversclosetolineratethroughputtoenablehigher
workloadconsolidationonphysicalservers.Thedistributednatureofthefirewallprovidesascaleout
architecturethatautomaticallyextendsfirewallcapacitywhenadditionalhostsareaddedtoaprepared
cluster.
DistributedFirewalloffersmultiplesetsofconfigurablerules:Layer3(L3)rules(Generaltab)andLayer2(L2)
rules(Ethernettab).Layer2firewallrulesareprocessedbeforeLayer3rules.Thedefaultfirewallruleallows
allL3andL2traffictopassthroughallclustersinyourinfrastructure.Thedefaultruleisalwaysatthebottom
oftherulestableandcannotbedeletedoraddedto.However,youcanchangetheActionelementoftherule
fromAllowtoBlock,addcommentsfortherule,andindicatewhethertrafficforthatruleshouldbelogged.
Firewallrulesarecreatedattheglobalscope,butyoucanthennarrowthescope(datacenter,cluster,
distributedvirtualportgroup,network,virtualmachine,vNIC,orvirtualwire)atwhichyouwanttoapply
therulebyusingtheAppliedTokeyword.
Userdefinedfirewallrulesareenforcedintoptobottomordering,withapervirtualNIClevelprecedence.
EachtrafficsessionischeckedagainstthetopruleintheFirewalltablebeforemovingdownthesubsequent
rulesinthetable.Thefirstruleinthetablethatmatchesthetrafficparametersisenforced.
Thefollowngtableliststheelementsthatcanbeusedinfirewallrules.
Table 9-1. Firewall rule elements
Element

Keyword for API

Used In

application

Application

service

applicationgroup

ApplicationGroup

service

clustercomputeresource

ClusterComputeResource

AppliedTo

datacenter

Datacenter

source/destination
AppliedTo

distributedvirtualportgroup

DistributedVirtualPortgroup

source/destination
AppliedTo

globalroot

GlobalRoot

source/destination

IPv4addresses

Ipv4Address

source/destination

IPv6addresses

Ipv6Address

source/destination

logicalswitch

VirtualWire

source/destination
AppliedTo

network

VMware, Inc.

Network

AppliedTo

261

vShield API Programming Guide

Table 9-1. Firewall rule elements


Element

Keyword for API

Used In

resourcepool

ResourcePool

source/destination

securitygroup

SecurityGroup

source/destination

virtualapp

VirtualApp

source/destination

virtualmachine

VirtualMachine

source/destination
AppliedTo

vNIC

Vnic

source/destination
AppliedTo

ForinformationoncreatinganIPSet,seeWorkingwithIPsetsonpage 60.Forinformationoncreatinga
securitygroup,seeWorkingwithSecurityGroupsonpage 53.
Distributedfirewallcanhelpincreatingidentitybasedrulesaswell.Administratorscanenforceaccesscontrol
basedontheusersgroupmembershipasdefinedintheenterpriseActiveDirectory.Herearesomescenarios
whereidentitybasedfirewallrulescanbeused:

Useraccessingvirtualapplicationsusingalaptop/mobiledevicewhereADisusedforuserauthentication

UseraccessingvirtualapplicationsusingVDIinfrastructurewherethevirtualmachinesareMicrosoft
Windowsbased

Thischapterincludesthefollowingtopics:

ConfiguringDistributedFirewallonpage 262

WorkingwithFirewallSectionsonpage 266

WorkingwithFirewallRulesonpage 270

QueryStatusonpage 273

SynchronizingandEnablingFirewallonpage 276

ImportingandExportingFirewallConfigurationsonpage 277

FirewallMigrationSwitchonpage 281

ConfiguringFailSafeModeforDistributedFirewallonpage 282

WorkingwithSpoofGuardonpage 283

GettingFlowStatisticDetailsonpage 285

FlowExclusiononpage 291

ExcludingVirtualMachinesfromFirewallProtectiononpage 293

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Configuring Distributed Firewall


Thefirewalltableincludesonesectionbydefaultthatcontainsthedefaultrule.Youcanaddadditional
sectionstosegregatefirewallrules
Firewallrulesareenforcedintoptobottomordering.DistributedFirewallcheckseachtrafficsessionagainst
thetopruleinthefirewalltablebeforemovingdownthesubsequentrulesinthetable.Thefirstruleinthe
tablethatmatchesthetrafficparametersisenforced.SeetheNSXAdministrationGuideformoreinformation
aboutthehierarchyofDistributedFirewallrules.

262

VMware, Inc.

Chapter 9 Distributed Firewall Management

Query Firewall Configuration


YoucanretrievethethefullfirewallconfigurationconsistingofallrulesthathasbeendefinedontheNSX
Manager.
Example 9-1. Get firewall configuration for NSX Manager
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config

ResponseBody:
HTTP/1.1 200 OK
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Set-Cookie: JSESSIONID=4CAE025C868939C35245B2553079807A; Path=/
ETag: 1395341576368
Date: Wed, 02 Oct 2013 20:58:39 GMT
Server: vShield Manager
Content-Type: application/xml
Transfer-Encoding: chunked
<?xml version="1.0" encoding="UTF-8"?>
<firewallConfiguration timestamp="1360144793284">
<contextId>globalroot-0</contextId>
<layer3Sections>
<section id="2" name="defaultSectionLayer3" generationNumber="1360144793284" timestamp="1360144793284">
<rule id="2" disabled="false" logged="false">
<name>Default Rule</name>
<action>DENY</action>
<sectionId>2</sectionId>
</rule>
</section>
</layer3Sections>
<layer2Sections>
<section id="1" name="defaultSectionLayer2" generationNumber="1360144793284" timestamp="1360144793284">
<rule id="1" disabled="false" logged="false">
<name>Default Rule</name>
<action>ALLOW</action>
<sectionId>1</sectionId>
</rule>
</section>
</layer2Sections>
</firewallConfiguration>

Modify Firewall Configuration


Followtheprocedurebelowtomodifythefirewallconfiguration.
1

RunaGETcallforthefirewallconfiguration.

ExtracttheXMLfromtheresponsebodyoftheGETcallandmodifyitasrequired.

FromtheResponseHeaderinStep1,copytheEtagheadervalue.

VMware, Inc.

263

vShield API Programming Guide

AddthenumberastheIfMatchheaderinthePUTcall.

PassthemodifiedXMLastheRequestBodyinaPUTcall.

Notallfieldsarerequiredwhilesendingtherequest.Refertotheoptionalfieldintheschema
definitionofvariousobjects.Alltheoptionalfieldsaresafetobeignoredwhilesendingthe
configurationtoserver.Forexample,ifanIPSetisreferencedintheruleonlyIPSetandTypeis
neededintheSource/DestinationobjectsandnotNameandisValidtags.

IDsfornewobjects(rule/section)shouldberemovedorsettozero.

Ifnewentities(sections/rules)havebeensentintherequest,theresponsewillcontainthe
systemgeneratedids,whichareassignedtothesenewentities.TheseIDidentifiestheresourceand
canbeusedintheurlsifyouwanttooperateontheseentitiesusingthoseURLs.

Example 9-2. Modify firewall configuration


Request:
PUT https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config
--header 'Content-Type:text/xml' --header 'if-match:"1380747467905"

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<firewallConfiguration timestamp="1359979620727">
<contextId>globalroot-0</contextId>
<layer3Sections>
<section id="2" name="defaultSectionLayer3" generationNumber="1359979620727" timestamp="1359979620727">
<rule disabled="false" logged="true">
<name>okn-1</name>
<action>ALLOW</action>
<sources excluded="false">
<source>
<value>datacenter-57</value>
<type>Datacenter</type>
</source>
<source>
<value>domain-c62</value>
<type>ClusterComputeResource</type>
</source>
<source>
<value>10.112.1.1</value>
<type>Ipv4Address</type>
</source>
</sources>
<services>
<service>
<destinationPort>80</destinationPort>

264

VMware, Inc.

Chapter 9 Distributed Firewall Management

<protocol>6</protocol>
<subProtocol>6</subProtocol>
</service>
<service>
<value>application-161</value>
<type>Application</type>
</service>
</services>
<appliedToList>
<appliedTo>
<value>5013bcd8-c666-1e28-c7a9-600da945954f.000</value>
<type>Vnic</type>
</appliedTo>
<appliedTo>
<value>vm-126</value>
<type>VirtualMachine</type>
</appliedTo>
</appliedToList>
</rule>
<rule disabled="true" logged="true">
<name>Matru-1</name>
<action>ALLOW</action>
<sectionId>2</sectionId>
</rule>
<rule disabled="true" logged="true">
<name>Matru-2</name>
<action>ALLOW</action>
<sectionId>2</sectionId>
</rule>
<rule disabled="true" logged="true">
<name>Matru-3</name>
<action>ALLOW</action>
<sectionId>2</sectionId>
</rule>
<rule id="2" disabled="true" logged="false">
<name>Default Rule</name>
<action>DENY</action>
<sectionId>2</sectionId>
</rule>
</section>
</layer3Sections>
<layer2Sections>
<section id="1" name="defaultSectionLayer2" generationNumber="1359979620727" timestamp="1359979620727">
<rule id="1" disabled="false" logged="false">
<name>Default Rule</name>
<action>ALLOW</action>
<sectionId>1</sectionId>
</rule>
</section>
</layer2Sections>
</firewallConfiguration>

Delete Firewall Configuration


Restoresdefaultconfiguration,whichmeansonedefaultLayer3sectionwithdefaultallowruleandone
defaultLayer2Sectionwithdefaultallowrule.
Example 9-3. Delete firewall configuration
Request:
DELETE https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config

VMware, Inc.

265

vShield API Programming Guide

Working with Firewall Sections


YoucanusesectionsinthefirewalltabletogrouplogicalrulesbasedonAppliedToorforatenantusecase.A
firewallsectionisthesmallestunitofconfigurationwhichcanbeupdatedindependently.Therearetwokinds
ofsections

Layer3Sectioncontainslayer3rules

Layer2Sectioncontainslayer2rules

Query Firewall Sections


RetrievessectionconfigurationeitherbysectionIDorsectionname.
Example 9-4. Getsectionconfiguration
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config/layer3sections|layer2sections/<sectionId> |<sectionName>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<section id="4" name="TestSection" generationNumber="1360149234572" timestamp="1360149234572">
<rule id="16" disabled="false" logged="true">
<name>okn-2</name>
<action>ALLOW</action>
<appliedToList>
<appliedTo>
<name>vm1 - Network adapter 1</name>
<value>5013bcd8-c666-1e28-c7a9-600da945954f.000</value>
<type>Vnic</type>
<isValid>true</isValid>
</appliedTo>
<appliedTo>
<name>Small XP-2</name>
<value>vm-126</value>
<type>VirtualMachine</type>
<isValid>true</isValid>
</appliedTo>
</appliedToList>
<sectionId>4</sectionId>
<sources excluded="false">
<source>
<name>5.1 ESX</name>
<value>datacenter-57</value>
<type>Datacenter</type>
<isValid>true</isValid>
</source>
<source>
<name>5.1</name>
<value>domain-c62</value>
<type>ClusterComputeResource</type>
<isValid>true</isValid>
</source>
<source>
<value>10.112.1.1</value>
<type>Ipv4Address</type>
<isValid>true</isValid>
</source>
</sources>
<services>
<service>
<destinationPort>80</destinationPort>
<protocol>6</protocol>
<subProtocol>6</subProtocol>
</service>
<service>

266

VMware, Inc.

Chapter 9 Distributed Firewall Management

<name>VMware-VDM2.x-Ephemeral</name>
<value>application-161</value>
<isValid>true</isValid>
</service>
</services>
</rule>
<rule id="15" disabled="true" logged="true">
<name>Matru-3</name>
<action>ALLOW</action>
<sectionId>4</sectionId>
</rule>
<rule id="14" disabled="true" logged="true">
<name>test-3</name>
<action>ALLOW</action>
<sectionId>4</sectionId>
</rule>
<rule id="13" disabled="true" logged="true">
<name>test-2</name>
<action>ALLOW</action>
<sectionId>4</sectionId>
</rule>
<rule id="12" disabled="true" logged="false">
<name>test-1</name>
<action>DENY</action>
<sectionId>4</sectionId>
</rule>
</section>

Add Firewall Section


Addsasectionatthetopofthefirewalltable.
Example 9-5. Addsection
Request:
POST https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config/layer3sections|layer2sections

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<section name="TestSection">
<rule disabled="false" logged="true">
<name>okn-2</name>
<action>ALLOW</action>
<appliedToList>
<appliedTo>
<name>vm1 - Network adapter 1</name>
<value>5013bcd8-c666-1e28-c7a9-600da945954f.000</value>
<type>Vnic</type>
<isValid>true</isValid>
</appliedTo>
<appliedTo>
<name>Small XP-2</name>
<value>vm-126</value>
<type>VirtualMachine</type>
<isValid>true</isValid>
</appliedTo>
</appliedToList>
<sources excluded="false">
<source>
<name>5.1 ESX</name>
<value>datacenter-57</value>
<type>Datacenter</type>
<isValid>true</isValid>
</source>
<source>

VMware, Inc.

267

vShield API Programming Guide

<name>5.1</name>
<value>domain-c62</value>
<type>ClusterComputeResource</type>
<isValid>true</isValid>
</source>
<source>
<value>10.112.1.1</value>
<type>Ipv4Address</type>
<isValid>true</isValid>
</source>
</sources>
<services>
<service>
<destinationPort>80</destinationPort>
<protocol>6</protocol>
<subProtocol>6</subProtocol>
</service>
<service>
<name>VMware-VDM2.x-Ephemeral</name>
<value>application-161</value>
<isValid>true</isValid>
</service>
</services>
</rule>
<rule disabled="true" logged="true">
<name>Matru-3</name>
<action>ALLOW</action>
</rule>
<rule disabled="true" logged="true">
<name>test-3</name>
<action>ALLOW</action>
</rule>
<rule disabled="true" logged="true">
<name>test-2</name>
<action>ALLOW</action>
</rule>
<rule disabled="true" logged="false">
<name>test-1</name>
<action>DENY</action>
</rule>
</section>

LocationHeaderintheresponsebodycontainstheresourceurlforthenewlycreatedruleresource.ThisURL
canbeusedtoidentifythisresource.

Modify Firewall Section


Followtheprocedurebelowtomodifyafirewallsection.

268

RunaGETcallforthefirewallsection.

ExtracttheXMLfromtheresponsebodyoftheGETcallandmodifyitasrequired.

FromtheResponseHeaderinStep1,copytheEtagheadervalue.

VMware, Inc.

Chapter 9 Distributed Firewall Management

AddthenumberastheIfMatchheaderinthePUTcall.

PassthemodifiedXMLastheRequestBodyinaPUTcall.

Notallfieldsarerequiredwhilesendingtherequest.Refertotheoptionalfieldintheschema
definitionofvariousobjects.Alltheoptionalfieldsaresafetobeignoredwhilesendingthe
configurationtoserver.Forexample,ifanIPSetisreferencedintheruleonlyIPSetandTypeis
neededintheSource/DestinationobjectsandnotNameandisValidtags.

IDsfornewobjects(rule/section)shouldberemovedorsettozero.

Ifnewentities(sections/rules)havebeensentintherequest,theresponsewillcontainthe
systemgeneratedids,whichareassignedtothesenewentities.TheseIDidentifiestheresourceand
canbeusedintheurlsifyouwanttooperateontheseentitiesusingthoseURLs.

Example 9-6. Modifysection


Request:
PUT https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config/layer3sections|layer2sections/<sectionId> |<sectionName>
--header 'Content-Type:text/xml' --header 'if-match:"1360149234572"

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<section id="4" name="TestSectionRenamed" generationNumber="1360149234572" timestamp="1360149234572">
<rule id="16" disabled="false" logged="false">
<name>okn-2</name>
<action>ALLOW</action>
<appliedToList>
<appliedTo>
<name>vm1 - Network adapter 1</name>
<value>5013bcd8-c666-1e28-c7a9-600da945954f.000</value>
<type>Vnic</type>
<isValid>true</isValid>
</appliedTo>
<appliedTo>
<name>Small XP-2</name>
<value>vm-126</value>
<type>VirtualMachine</type>
<isValid>true</isValid>
</appliedTo>
</appliedToList>
<sectionId>4</sectionId>
<sources excluded="false">
<source>
<name>5.1 ESX</name>
<value>datacenter-57</value>
<type>Datacenter</type>
<isValid>true</isValid>
</source>
<source>
<name>5.1</name>
<value>domain-c62</value>
<type>ClusterComputeResource</type>
<isValid>true</isValid>
</source>
<source>
<value>10.112.1.1</value>
<type>Ipv4Address</type>
<isValid>true</isValid>
</source>
VMware, Inc.

269

vShield API Programming Guide

</sources>
<services>
<service>
<destinationPort>80</destinationPort>
<protocol>6</protocol>
<subProtocol>6</subProtocol>
</service>
<service>
<name>VMware-VDM2.x-Ephemeral</name>
<value>application-161</value>
<isValid>true</isValid>
</service>
</services>
</rule>
<rule id="15" disabled="true" logged="true">
<name>Matru-3</name>
<action>DENY</action>
<sectionId>4</sectionId>
</rule>
<rule id="14" disabled="true" logged="true">
<name>test-3</name>
<action>ALLOW</action>
<sectionId>4</sectionId>
</rule>
<rule id="13" disabled="true" logged="true">
<name>test-2</name>
<action>ALLOW</action>
<sectionId>4</sectionId>
</rule>
<rule id="12" disabled="true" logged="false">
<name>test-1</name>
<action>DENY</action>
<sectionId>4</sectionId>
</rule>
</section>

Delete Firewall Section


Deletesthespecifiedsection.Ifthesectioncontainsadefaultrule,thesectionisnotdeletedbutallrulesexcept
forthedefaultruleareremovedfromthatsection.
Ifthesectiondoesnotcontainadefaultrule,thesectionandallitsrulesaredeleted.
Example 9-7. Deletesection
Request:
DELETE https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config/layer3sections|layer2sections/<sectionId> |<sectionName>

Working with Firewall Rules


Youaddfirewallrulesattheglobalscope.Youcanthennarrowdownthescope(datacenter,cluster,
distributedvirtualportgroup,network,virtualmachine,vNIC,orvirtualwire)atwhichyouwanttoapply
therule.Firewallallowsyoutoaddmultipleobjectsatthesourceanddestinationlevelsforeachrule,which
helpsreducethetotalnumberoffirewallrulestobeadded.
Toaddaidentitybasedfirewallrule,firstcreateasecuritygroupbasedonDirectoryGroupobjects.Then
createafirewallrulewiththesecuritygroupasthesourceordestination.

Query Firewall Rule


RetrievesruledetailsfromeitheraLayer3orLayer2section.

270

VMware, Inc.

Chapter 9 Distributed Firewall Management

Example 9-8. Get firewall rule


Request:
GET https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/config/layer3sections|layer3sections/<sectionNumber>/rules/<ruleNumber>

ResponseBody:
HTTP/1.1 200 OK
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Set-Cookie: JSESSIONID=FED4857DF7A2A5CCD7F818A87F463629; Path=/
ETag: 1380747467905
Date: Wed, 02 Oct 2013 21:04:29 GMT
Server: vShield Manager
Content-Type: application/xml
Transfer-Encoding: chunked
<?xml version="1.0" encoding="UTF-8"?>
<rule id="1807" disabled="false" logged="true">
<name>Section-2-Rule-1</name>
<action>allow</action>
<notes>Example with multile sources and any appliedTo with source containing vnics and raw-ips</notes>
<sources excluded="false">
<source>
<value>10.112.1.0-10.112.1.10</value>
<type>Ipv4Address</type>
<isValid>true</isValid>
</source>
<source>
<name>2-rhel53-srv-32-local-129-fa110b77-c303-4113-ab66-88c5ed9a5177 - Network adapter 1</name>
<value>fa110b77-c303-4113-ab66-88c5ed9a5177.000</value>
<type>Vnic</type>
<isValid>true</isValid>
</source>
<source>
<value>192.168.1.1</value>
<type>Ipv4Address</type>
<isValid>true</isValid>
</source>
</sources>
<destinations excluded="false">
<destination>
<name>1-datacenter-129</name>
<value>datacenter-237</value>
<type>Datacenter</type>
<isValid>true</isValid>
</destination>
</destinations>
<services>
<service>
<name>AD Server</name>
<value>application-256</value>
<type>Application</type>
<isValid>true</isValid>
</service>
</services>
</rule>

Add Firewall Rule


AddsaruleatthetopoftheexistingconfigurationinaLayer2orLayer3section.
Example 9-9. Add firewall rule
Request:

VMware, Inc.

271

vShield API Programming Guide

POST https://<nsxmgr-ip>/api/4.0/firewall//globalroot-0/config/layer3sections|layer3sections/<sectionNumber>/rules

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<rule disabled="enabled" logged="false">
<name>AddRuleTest</name>
<action>allow</action>
<notes />
<appliedToList>
<appliedTo>
<value>datacenter-26</value>
<type>Datacenter</type>
</appliedTo>
</appliedToList>
<sectionId>2</sectionId>
<sources excluded="true">
<source>
<value>datacenter-26</value>
<type>Datacenter</type>
</source>
</sources>
<services>
<service>
<value>application-216</value>
</service>
</services>
</rule>

LocationHeaderintheresponsebodycontainstheresourceurlforthenewlycreatedruleresource.ThisURL
canbeusedtoidentifythisresource.

Modify Firewall Rule


ModifiesaruleintheLayer2orLayer3section.Followtheprocedurebelowtomodifyafirewallrule.
Followtheprocedurebelowtomodifythefirewallconfiguration.

272

RunaGETcallforthefirewallfules.

ExtracttheXMLfromtheresponsebodyoftheGETcallandmodifyitasrequired.

FromtheResponseHeaderinStep1,copytheEtagheadervalue.

AddthenumberastheIfMatchheaderinthePUTcall.

PassthemodifiedXMLastheRequestBodyinaPUTcall.

VMware, Inc.

Chapter 9 Distributed Firewall Management

Notallfieldsarerequiredwhilesendingtherequest.Refertotheoptionalfieldintheschema
definitionofvariousobjects.Alltheoptionalfieldsaresafetobeignoredwhilesendingthe
configurationtoserver.Forexample,ifanIPSetisreferencedintheruleonlyIPSetandTypeis
neededintheSource/DestinationobjectsandnotNameandisValidtags.

IDsfornewobjects(rule/section)shouldberemovedorsettozero.

Ifnewentities(sections/rules)havebeensentintherequest,theresponsewillcontainthe
systemgeneratedids,whichareassignedtothesenewentities.TheseIDidentifiestheresourceand
canbeusedintheurlsifyouwanttooperateontheseentitiesusingthoseURLs.

Example 9-10. Modify firewall rule


Request:
PUT https://<nsxmgr-ip>/api/4.0/firewall//globalroot-0/config/layer3sections|layer3sections/<sectionNumber>/rules
--header 'Content-Type:text/xml' --header 'if-match:"1380747467905"'

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<rule id="23" disabled="enabled" logged="true">
<name>AddRuleTestUpdated</name>
<action>allow</action>
<notes />
<appliedToList>
<appliedTo>
<value>datacenter-26</value>
<type>Datacenter</type>
</appliedTo>
</appliedToList>
<sectionId>2</sectionId>
<sources excluded="true">
<source>
<value>datacenter-26</value>
<type>Datacenter</type>
</source>
</sources>
<services>
<service>
<value>application-216</value>
</service>
</services>
</rule>

LocationHeaderintheresponsebodycontainstheresourceurlforthenewlycreatedruleresource.ThisURL
canbeusedtoidentifythisresource.

Query Status
Retrievesstatusoftheentirefirewallconfigurationorindividualsections.

Query Firewall Configuration Status


Example 9-11. Get firewall configuration status
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall//globalroot-0/status

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<firewallStatus>
<startTime>1380747467905</startTime>

VMware, Inc.

273

vShield API Programming Guide

<status>published</status>
<generationNumber>1380747467905</generationNumber>
<clusterList>
<clusterStatus>
<clusterId>domain-c256</clusterId>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<hostStatusList>
<hostStatus>
<hostId>host-244</hostId>
<hostName>10.24.227.43</hostName>
<status>published</status>
<errorCode>0</errorCode>
<startTime>1380725776946</startTime>
<endTime>1380747469986</endTime>
<generationNumber>1380747467905</generationNumber>
<clusterId>domain-c256</clusterId>
</hostStatus>
</hostStatusList>
</clusterStatus>
<clusterStatus>
<clusterId>domain-c322</clusterId>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<hostStatusList>
<hostStatus>
<hostId>host-310</hostId>
<hostName>10.24.227.75</hostName>
<status>published</status>
<errorCode>0</errorCode>
<startTime>1380746933333</startTime>
<endTime>1380747470292</endTime>
<generationNumber>1380747467905</generationNumber>
<clusterId>domain-c322</clusterId>
</hostStatus>
</hostStatusList>
</clusterStatus>
</clusterList>
</firewallStatus>

Query Layer3 Section Status


Example 9-12. Get Layer3 status
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall//globalroot-0/status/layer3sections/<sectionNumber>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<firewallStatus>
<startTime>1380747467905</startTime>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<clusterList>
<clusterStatus>
<clusterId>domain-c256</clusterId>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<hostStatusList>
<hostStatus>
<hostId>host-244</hostId>
<hostName>10.24.227.43</hostName>
<status>published</status>
<errorCode>0</errorCode>

274

VMware, Inc.

Chapter 9 Distributed Firewall Management

<startTime>1380725776946</startTime>
<endTime>1380747469986</endTime>
<generationNumber>1380747467905</generationNumber>
<clusterId>domain-c256</clusterId>
</hostStatus>
</hostStatusList>
</clusterStatus>
<clusterStatus>
<clusterId>domain-c322</clusterId>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<hostStatusList>
<hostStatus>
<hostId>host-310</hostId>
<hostName>10.24.227.75</hostName>
<status>published</status>
<errorCode>0</errorCode>
<startTime>1380746933333</startTime>
<endTime>1380747470292</endTime>
<generationNumber>1380747467905</generationNumber>
<clusterId>domain-c322</clusterId>
</hostStatus>
</hostStatusList>
</clusterStatus>
</clusterList>
</firewallStatus>

Query Layer2 Section Status


Example 9-13. Get layer2 status
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall//globalroot-0/status/layer2sections/<sectionNumber>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<firewallStatus>
<startTime>1380747467905</startTime>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<clusterList>
<clusterStatus>
<clusterId>domain-c256</clusterId>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<hostStatusList>
<hostStatus>
<hostId>host-244</hostId>
<hostName>10.24.227.43</hostName>
<status>published</status>
<errorCode>0</errorCode>
<startTime>1380725776946</startTime>
<endTime>1380747469986</endTime>
<generationNumber>1380747467905</generationNumber>
<clusterId>domain-c256</clusterId>
</hostStatus>
</hostStatusList>
</clusterStatus>
<clusterStatus>
<clusterId>domain-c322</clusterId>
<status>published</status>
<generationNumber>1380747467905</generationNumber>
<hostStatusList>
<hostStatus>

VMware, Inc.

275

vShield API Programming Guide

<hostId>host-310</hostId>
<hostName>10.24.227.75</hostName>
<status>published</status>
<errorCode>0</errorCode>
<startTime>1380746933333</startTime>
<endTime>1380747470292</endTime>
<generationNumber>1380747467905</generationNumber>
<clusterId>domain-c322</clusterId>
</hostStatus>
</hostStatusList>
</clusterStatus>
</clusterList>
</firewallStatus>

Synchronizing and Enabling Firewall


You can force hosts and clusters to synchronize with the last good configuration in the NSX Manager database.

Force Sync Host


Forcesthehosttosynchwiththelastgoodconfiguration
Example 9-14. Force sync host
Request:
POST https://<nsxmgr-ip>/api/4.0/firewall/forceSync/<hostID>

ResponseBody:
HTTP/1.1 200 OK
Cache-Control: no-cache
Set-Cookie: JSESSIONID=EADEDB6AC7323C3FE42E43B8739FBB1F; Path=/
Location: /api/2.0/services/taskservice/job/jobdata-658
Date: Wed, 02 Oct 2013 21:08:52 GMT
Server: vShield Manager
Content-Length: 0

ThelocationheadercontainsthetaskURL,whichcanbeusedtomonitortheoveralltaskstatus.

Force Sync Cluster


Example 9-15. Force sync cluster
Request:
POST https://<nsxmgr-ip>/api/4.0/firewall/forceSync/<clusterID>

ResponseBody:
HTTP/1.1 200 OK
Cache-Control: no-cache
Set-Cookie: JSESSIONID=EADEDB6AC7323C3FE42E43B8739FBB1F; Path=/
Location: /api/2.0/services/taskservice/job/jobdata-659
Date: Wed, 02 Oct 2013 21:08:52 GMT
Server: vShield Manager
Content-Length: 0

ThelocationheadercontainsthetaskURL,whichcanbeusedtomonitortheoveralltaskstatus.

276

VMware, Inc.

Chapter 9 Distributed Firewall Management

Enable or Disable APIs for a Cluster


Youcandisablefirewallcomponentsonacluster.Iffirewallisdisabledonacluster,allnetworktrafficpasses
throughthehostsinthatclusterwithoutanyvalidation.
Example 9-16. Enable or disable API
Request:
POST https://<nsxmgr-ip>/api/4.0/firewall/<domainID>/enable/true|false

Importing and Exporting Firewall Configurations


Youmaymakechangestoafirewallconfigurationandsaveadraftcopyforfutureuse.Acopyofevery
publishedconfigurationisalsosavedasadraft.Amaximumof100configurationscanbesavedatatime.90
outofthese100canbeautosavedconfigurationsfromapublishoperation.Whenthelimitisreached,the
oldestconfigurationthatisnotmarkedforpreserveispurgedtomakewayforanewone.
YoucanalsoimportandexportfirewallconfigurationsinXMLformat.

Save a Configuration
Example 9-17. Save a firewall configuration
Request:
POST https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/drafts

RequestBody:
<firewallDraft name="TestDraft">
<description>Test draft</description> <!-- optional -->
<preserve>true</preserve> <!-- optional, default = true -->
<mode>userdefined</mode>
<config>
<contextId>globalroot-0</contextId>
<layer3Sections>
<section name="Default Section Layer3" >
<rule id="1001" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer3Sections>
<layer2Sections>
<section name="Default Section Layer2">
<rule id="1003" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer2Sections>
</config>
</firewallDraft>

ResponseBody:
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<firewallDraft id="23" name="TestDraft" timestamp="1377631752553">
<description>Test draft</description>
<preserve>true</preserve>
<user>localadmin</user>

VMware, Inc.

277

vShield API Programming Guide

<mode>userdefined</mode>
</firewallDraft>

Query all Saved Configurations


Example 9-18. Get all saved firewall configurations
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/drafts/

RequestBody:
<firewallDrafts>
<firewallDraft id="3" name="AutoSaved_2013-Aug-22 17:13:08" timestamp="1377191588887">
<description>Auto saved draft</description>
<preserve>false</preserve>
<user>root</user>
<mode>autosaved</mode>
</firewallDraft>
<firewallDraft id="2" name="AutoSaved_2013-Aug-22 15:46:40" timestamp="1377186400472">
<description>Auto saved draft</description>
<preserve>false</preserve>
<user>root</user>
<mode>autosaved</mode>
</firewallDraft>
<firewallDraft id="1" name="AutoSaved_2013-Aug-22 15:42:36" timestamp="1377186156947">
<description>Auto saved draft</description>
<preserve>false</preserve>
<user>root</user>
<mode>autosaved</mode>
</firewallDraft>
</firewallDrafts>

Query a Saved Configuration


RetrievethedraftIDoftheconfiguration.SeeGetallsavedfirewallconfigurationsonpage 278.
Example 9-19. Get a saved firewall configuration
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/drafts/<draftID>

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<firewallDraft id="1" name="AutoSaved_2013-Aug-22 15:42:36" timestamp="1377186156947">
<description>Auto saved draft</description>
<preserve>false</preserve>
<user>root</user>
<mode>autosaved</mode>
<config timestamp="1377186104244">
<contextId>globalroot-0</contextId>
<layer3Sections>
<section id="1002" name="Default Section Layer3" generationNumber="1377186104244" timestamp="1377186104244">
<rule disabled="false" logged="false">
<name>Default Rule NDP - Edit</name>
<action>allow</action>
<sectionId>1002</sectionId>
<services>
<service>
<name>IPv6-ICMP Neighbor Solicitation</name>
<value>application-182</value>
<type>Application</type>

278

VMware, Inc.

Chapter 9 Distributed Firewall Management

<isValid>true</isValid>
</service>
</services>
</rule>
<rule id="1002" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<sectionId>1002</sectionId>
<precedence>default</precedence>
</rule>
</section>
</layer3Sections>
<layer2Sections>
<section id="1001" name="Default Section Layer2" generationNumber="1377186104244" timestamp="1377186104244">
<rule id="1001" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<sectionId>1001</sectionId>
<precedence>default</precedence>
</rule>
</section>
</layer2Sections>
<generationNumber>1377285109371</generationNumber>
</config>
</firewallDraft>

Modify a Saved Configuration


RetrievethedraftIDoftheconfiguration.SeeGetallsavedfirewallconfigurationsonpage 278.
Example 9-20. Update a saved firewall configuration
Request:
PUT https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/drafts/<draftID>

RequestBody:
<f<firewallDraft name="TestDraft">
<description>Test draft</description> <!-- optional -->
<preserve>true</preserve> <!-- optional, default = true -->
<mode>userdefined</mode>
<config>
<contextId>globalroot-0</contextId>
<layer3Sections>
<section name="Default Section Layer3" >
<rule id="1001" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer3Sections>
<layer2Sections>
<section name="Default Section Layer2">
<rule id="1003" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer2Sections>
</config>
</firewallDraft>

ResponseBody:

VMware, Inc.

279

vShield API Programming Guide

HTTP/1.1 200 OK
<firewallDraft id="23" name="TestDraft" timestamp="1377631752553">
<description>Test draft</description>
<preserve>true</preserve>
<user>localadmin</user>
<mode>userdefined</mode>
</firewallDraft>

Delete a Saved Configuration


RetrievethedraftIDoftheconfiguration.SeeGetallsavedfirewallconfigurationsonpage 278.
Example 9-21. Delete a saved firewall configuration
Request:
DELETE https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/drafts/<draftID>

Export a Saved Configuration


RetrievethedraftIDoftheconfiguration.SeeGetallsavedfirewallconfigurationsonpage 278.
Example 9-22. Export a saved firewall configuration
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/drafts/<draftID>/action/export

ResponseBody:
<firewallDraft id="23" name="TestDraft" timestamp="1377631752553">
<description>Test draft Edit</description>
<preserve>false</preserve>
<user>localadmin</user>
<mode>userdefined</mode>
<config timestamp="0">
<contextId>globalroot-0</contextId>
<layer3Sections>
<section name="Default Section Layer3" timestamp="0">
<rule id="1002" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer3Sections>
<layer2Sections>
<section name="Default Section Layer2" timestamp="0">
<rule id="1001" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer2Sections>
<generationNumber>1377285109371</generationNumber>
</config>
</firewallDraft>

Import a Saved Configuration


RetrievethedraftIDoftheconfiguration.SeeGetallsavedfirewallconfigurationsonpage 278.

280

VMware, Inc.

Chapter 9 Distributed Firewall Management

Usetheresponsebodyoftheexportcommandastherequestbodyinthiscommand.SeeExportasaved
firewallconfigurationonpage 280.
Example 9-23. Import a saved firewall configuration
Request:
POST https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/drafts/<draftID>/action/import

RequestBody:
<firewallDraft id="23" name="TestDraft" timestamp="1377631752553">
<description>Test draft Edit</description>
<preserve>false</preserve>
<user>localadmin</user>
<mode>userdefined</mode>
<config timestamp="0">
<contextId>globalroot-0</contextId>
<layer3Sections>
<section name="Default Section Layer3" timestamp="0">
<rule id="1002" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer3Sections>
<layer2Sections>
<section name="Default Section Layer2" timestamp="0">
<rule id="1001" disabled="false" logged="false">
<name>Default Rule</name>
<action>allow</action>
<precedence>default</precedence>
</rule>
</section>
</layer2Sections>
<generationNumber>1377285109371</generationNumber>
</config>
</firewallDraft>

ResponseBody:
HTTP/1.1 200 OK
<firewallDraft id="24" name="TestDraft" timestamp="1377632629140">
<description>Test draft Edit</description>
<preserve>false</preserve>
<user>localadmin</user>
<mode>imported</mode>
</firewallDraft>

Firewall Migration Switch


Example 9-24. Firewall migration
Request:
GET https://<nsxmgr-ip>/api/4.0/firewall/globalroot-0/state

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<rule id="1807" disabled="false" logged="true">
<name>Section-2-Rule-1</name>
<action>allow</action>
<notes>Example with multile sources and any appliedTo with source containing vnics and raw-ips</notes>
<sources excluded="false">
<source>

VMware, Inc.

281

vShield API Programming Guide

<value>10.112.1.0-10.112.1.10</value>
<type>Ipv4Address</type>
<isValid>true</isValid>
</source>
<source>
<name>2-rhel53-srv-32-local-129-fa110b77-c303-4113-ab66-88c5ed9a5177 - Network adapter 1</name>
<value>fa110b77-c303-4113-ab66-88c5ed9a5177.000</value>
<type>Vnic</type>
<isValid>true</isValid>
</source>
<source>
<value>192.168.1.1</value>
<type>Ipv4Address</type>
<isValid>true</isValid>
</source>
</sources>
<destinations excluded="false">
<destination>
<name>1-datacenter-129</name>
<value>datacenter-237</value>
<type>Datacenter</type>
<isValid>true</isValid>
</destination>
</destinations>
<services>
<service>
<name>AD Server</name>
<value>application-256</value>
<type>Application</type>
<isValid>true</isValid>
</service>
</services>
</rule>

Configuring Fail-Safe Mode for Distributed Firewall


Bydefault,failureorunavailabilityofthevShieldAppapplianceresultsintrafficbeingblocked(failclose).
Youcanchangethistoallowtraffic(failopen).

Configure Fail-Safe Mode for vShield App Firewall


Example 9-25. Configure fail-safe mode
Example:
PUT https://<nsxmgr-ip>/api/2.1/app/failsafemode
Request Body
<VshieldAppConfiguration>
<failsafeConfiguration>
<failsafemode>FAIL_OPEN</failsafemode>
</failsafeConfiguration>
</VshieldAppConfiguration>

Query Fail-Safe Mode Configuration for vShield App Firewall


Example 9-26. Get fail-safe mode configuration
Example:
GET https://<nsxmgr-ip>/api/2.1/app/failsafemode

282

VMware, Inc.

Chapter 9 Distributed Firewall Management

Working with SpoofGuard


AftersynchronizingwiththevCenterServer,NSXManagercollectstheIPaddressesofallvCenterguest
virtualmachinesfromVMwareToolsoneachvirtualmachine.Ifavirtualmachinehasbeencompromised,
theIPaddresscanbespoofedandmalicioustransmissionscanbypassfirewallpolicies.
YoucreateaSpoofGuardpolicyforspecificnetworksthatallowsyoutoauthorizetheIPaddressesreported
byVMwareToolsandalterthemifnecessarytopreventspoofing.SpoofGuardinherentlytruststheMAC
addressesofvirtualmachinescollectedfromtheVMXfilesandvSphereSDK.Operatingseparatelyfrom
Firewallrules,youcanuseSpoofGuardtoblocktrafficdeterminedtobespoofed.

Create SpoofGuard Policy


YoucancreateaSpoofGuardpolicytospecifytheoperationmodeforspecificnetworks.Thesystemgenerated
policyappliestoportgroupsandlogicalswitchesnotcoveredbyexistingSpoofGuardpolicies.
Example 9-27. Create SpoofGuard policy
Request:
POST https://<nsxmgr-ip>/api/4.0/services/spoofguard/policies/

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<spoofguardPolicy>
<name>rest-spoofguard-policy-1</name>
<description>Test description</description>
<operationMode>TOFU</operationMode>
<enforcementPoint>
<id>dvportgroup-28</id>
<name>network 1</name>
<type>dvportgroup</type>
</enforcementPoint>
<enforcementPoint>
<id>dvportgroup-12</id>
<name>network 2</name>
<type>dvportgroup</type>
</enforcementPoint>
<allowLocalIPs>true</allowLocalIPs>
</spoofguardPolicy>

ResponseBody:
HTTP/1.1 201 Created
Location: /api/4.0/services/spoofguard/policy/spoofguardpolicy-2

Modify SpoofGuard Policy


UpdatesaSpoofGuardpolicy.
Example 9-28. Create SpoofGuard policy
Request:
PUT https://<nsxmgr-ip>/api/4.0/services/spoofguard/policies/<policy-id>

RequestBody:
<spoofguardPolicy>
<policyId>spoofguardpolicy-2</policyId>
<name>rest-spoofguard-policy-1</name>
<description>Test description changed</description>
<operationMode>TOFU</operationMode>
<enforcementPoint>
<id>dvportgroup-28</id>

VMware, Inc.

283

vShield API Programming Guide

<name>network 1</name>
<type>dvportgroup</type>
</enforcementPoint>
<enforcementPoint>
<id>dvportgroup-12</id>
<name>network 2</name>
<type>dvportgroup</type>
</enforcementPoint>
<allowLocalIPs>true</allowLocalIPs>
</spoofguardPolicy>

Query SpoofGuard Policy


RetrievesaSpoofGuardpolicy.
Example 9-29. Query SpoofGuard policy
Request:
GET https://<nsxmgr-ip>/api/4.0/services/spoofguard/policies/<policy-id>

RequestBody:
<spoofguardPolicy>
<policyId>spoofguardpolicy-2</policyId>
<name>rest-spoofguard-policy-1</name>
<description>Test description changed</description>
<operationMode>TOFU</operationMode>
<enforcementPoint>
<id>dvportgroup-28</id>
<name>network 1</name>
<type>dvportgroup</type>
</enforcementPoint>
<enforcementPoint>
<id>dvportgroup-12</id>
<name>network 2</name>
<type>dvportgroup</type>
</enforcementPoint>
<publishedOn>2011-10-28 16:12:20.0</publishedOn>
<publishedBy>system_user</publishedBy>
<allowLocalIPs>true</allowLocalIPs>
<publishedPending>false</publishedPending>
<defaultPolicy>false</defaultPolicy>
<publishPending>false</publishPending>
<statistics>
<inSync>true</inSync>
<activeCount>0</activeCount>
<inactiveCount>0</inactiveCount>
<activeSinceLastPublishedCount>0</activeSinceLastPublishedCount>
<requireReviewCount>0</requireReviewCount>
<duplicateCount>0</duplicateCount>
<unpublishedCount>0</unpublishedCount>
</statistics>
</spoofguardPolicy>

Query all SpoofGuard Policies


RetrievesallSpoofGuardpolicies.
Example 9-30. Query SpoofGuard policies
Request:
GET https://<nsxmgr-ip>/api/4.0/services/spoofguard/policies/

284

VMware, Inc.

Chapter 9 Distributed Firewall Management

RequestBody:
<spoofguardPolicies>
<spoofguardPolicy>
<policyId>spoofguardpolicy-1</policyId>
<name>system-spoofguard-policy-1</name>
<description>Test description</description>
<operationMode>TOFU</operationMode>
<allowLocalIPs>true</allowLocalIPs>
<defaultPolicy>true</defaultPolicy>
<publishedOn>2011-10-28 16:12:20.0</publishedOn>
</spoofguardPolicy>
<spoofguardPolicy>
<policyId>spoofguardpolicy-2</policyId>
<name>rest-spoofguard-policy-1</name>
<description>Test description changed</description>
<operationMode>TOFU</operationMode>
<enforcementPoint>
<id>dvportgroup-28</id>
<name>network 1</name>
<type>dvportgroup</type>
</enforcementPoint>
<enforcementPoint>
<id>dvportgroup-12</id>
<name>network 2</name>
<type>dvportgroup</type>
</enforcementPoint>
<publishedOn>2011-10-28 16:12:20.0</publishedOn>
<publishedBy>system_user</publishedBy>
<allowLocalIPs>true</allowLocalIPs>
<publishedPending>false</publishedPending>
<defaultPolicy>false</defaultPolicy>
</spoofguardPolicy>
</spoofguardPolicies>

Delete SpoofGuard Policy


DeletesaSpoofGuardpolicy.
Example 9-31. Delete SpoofGuard policy
Request:
DELETE https://<nsxmgr-ip>/api/4.0/services/spoofguard/policies/<policy-id>

Getting Flow Statistic Details


YoucanretrieveadetailedviewofthetrafficonyourvirtualnetworkthatpassedthroughDistributed
Firewall.

Get Flow Statistics


Youcanretrieveflowstatisticsforadatacenter,portgroup,virtualmachine,orvNIC.
Example 9-32. Retrieve flow statistics
Request:
GET https://<nsxmgr-ip>/api/2.1/app/flow/flowstats?contextId=datacenter-21&flowType=TCP_UDP
&startTime=0&endTime=1320917094000&startIndex=0&pageSize=2

RequestBody:
<FlowStatsPage>

VMware, Inc.

285

vShield API Programming Guide

<pagingInfo>
<contextId>datacenter-2538</contextId>
<flowType>TCP_UDP</flowType>
<startTime>1327405883000</startTime>
<endTime>1327482600000</endTime>
<totalCount>817</totalCount>
<startIndex>0</startIndex>
<pageSize>2</pageSize>
</pagingInfo>
<flowStatsTcpUdp>
<startTime>1327405883000</startTime>
<endTime>1327446000000</endTime>
<ruleId>1001</ruleId>
<blocked>0</blocked>
<protocol>5</protocol>
<direction>1</direction>
<sessions>1449</sessions>
<sourcePackets>1449</sourcePackets>
<destinationPackets>0</destinationPackets>
<sourceBytes>227493</sourceBytes>
<destinationBytes>0</destinationBytes>
<networkId>network-2553</networkId>
<sourceIp>10.112.199.174</sourceIp>
<destinationIp>255.255.255.255</destinationIp>
<destinationPort>17500</destinationPort>
<controlProtocol></controlProtocol>
<controlSourceIp>0.0.0.0</controlSourceIp>
<controlDestinationIp>0.0.0.0</controlDestinationIp>
<controlDestinationPort>0</controlDestinationPort>
<controlDirection>0</controlDirection>
</flowStatsTcpUdp>
<flowStatsTcpUdp>
<startTime>1327405883000</startTime>
<endTime>1327446000000</endTime>
<ruleId>1001</ruleId>
<blocked>0</blocked>
<protocol>5</protocol>
<direction>1</direction>
<sessions>69</sessions>
<sourcePackets>69</sourcePackets>
<destinationPackets>0</destinationPackets>
<sourceBytes>17832</sourceBytes>
<destinationBytes>0</destinationBytes>
<networkId>network-2553</networkId>
<sourceIp>10.112.199.13</sourceIp>
<destinationIp>10.112.199.255</destinationIp>
<destinationPort>138</destinationPort>
<controlProtocol></controlProtocol>
<controlSourceIp>0.0.0.0</controlSourceIp>
<controlDestinationIp>0.0.0.0</controlDestinationIp>
<controlDestinationPort>0</controlDestinationPort>
<controlDirection>0</controlDirection>
</flowStatsTcpUdp>
</FlowStatsPage>

Queryparametersaredescribedinthetablebelow.
Table 9-2. Query parameters for retrieving flow statistics call

286

Parameter

Description

flowStats

Typeoftheflowtoberetrieved.PossiblevaluesareTCP_UDP,LAYER2,andLAYER3

contextId

vcmorefidofthedatacenter,portgroup,virtualmachine,orUUIDofthevNICfor
whichtrafficflowistoberetrieved.

startTime

Flowswithstarttimegreaterthanthespecifiedtimearetoberetrieved.

endTime

Flowswithstarttimelowerthanthespecifiedtimearetoberetrieved.
VMware, Inc.

Chapter 9 Distributed Firewall Management

Table 9-2. Query parameters for retrieving flow statistics call


Parameter

Description

startIndex

Optionalparameterthatspecifiesthestartingpointforretrievingtheflows.Ifthisparameteris
notspecified,flowsareretrievedfromthebeginning.

pageSize

OptionalparameterthatlimitsthemaximumnumberofentriesreturnedbytheAPI.Thedefault
valueforthisparameteris256andthevalidrangeis11024.

Table 9-3. Response values for retrieving flow statistics call


Value

Description

startTime

Starttimeforcurrentflow.

endTime

Endtimeforcurrentflow.

ruleId

ruleIdforcurrentflow.

blocked

Indicateswhethertrafficisblocked0:Flowallowed,1:Flowblocked,2:Flow
blockedbySpoofguard.

protocol

protocolinflow0:TCP,1:UDP,2:ICMP.

direction

Directionofflow0:Tovirtualmachine,1:Fromvirtualmachine.

sessions

Numberofsessionsincurrentflow.

sourcePackets

CountofPacketsfromSourcetoDestinationincurrentflow.

destinationPackets

CountofPacketsfromDestinationtoSourceincurrentflow.

sourceBytes

CountofBytestransferredfromSourcetoDestinationincurrentflow.

destinationBytes

CountofBytestransferredfromDestinationtoSourceincurrentflow.

sourceIp

SourceIPofcurrentflow.

destinationIp

DestinationIPofcurrentflow.

sourceMac

SourceMacofcurrentflow.

destinationMac

DestinationMacofcurrentflow.

subtype

Identifiesthesubtypeofcurrentflow.

destinationPort

PortnumberofDestinationforTCP/UDPtraffic.

controlProtocol

ControlprotocolfordynamicTCPtraffic.

controlSourceIp

ControlsourceIPfordynamicTCPtraffic.

controlDestinationIp

ControldestinationIPfordynamicTCPtraffic.

controlDestinationPort

ControldestinationportfordynamicTCPtraffic.

controlDirection

ControldirectionfordynamicTCPtraffic0:Source>Destination,
1:Destination>Source.

Get Flow Meta-Data


Youcanretrievethefollowinginformationforeachflowtype:

minimumstatstime

maximumendtime

totalflowcount

Example 9-33. Get flow meta-data for flow type


Request:
GET https://<nsxmgr-ip>/api/2.1/app/flow/flowstats?contextId=datacenter-2538\&flowType=TCP_UDP\
&startTime=1327405883000\&endTime=1327482600000\&startIndex=0\&pageSize=2

VMware, Inc.

287

vShield API Programming Guide

ResponseBody:
<FlowStatsPage>
<pagingInfo>
<contextId>datacenter-2538</contextId>
<flowType>TCP_UDP</flowType>
<startTime>1327405883000</startTime>
<endTime>1327482600000</endTime>
<totalCount>817</totalCount>
<startIndex>0</startIndex>
<pageSize>2</pageSize>
</pagingInfo>
<flowStatsTcpUdp>
<startTime>1327405883000</startTime>
<endTime>1327446000000</endTime>
<ruleId>1001</ruleId>
<blocked>0</blocked>
<protocol>5</protocol>
<direction>1</direction>
<sessions>1449</sessions>
<sourcePackets>1449</sourcePackets>
<destinationPackets>0</destinationPackets>
<sourceBytes>227493</sourceBytes>
<destinationBytes>0</destinationBytes>
<networkId>network-2553</networkId>
<sourceIp>10.112.199.174</sourceIp>
<destinationIp>255.255.255.255</destinationIp>
<destinationPort>17500</destinationPort>
<controlProtocol></controlProtocol>
<controlSourceIp>0.0.0.0</controlSourceIp>
<controlDestinationIp>0.0.0.0</controlDestinationIp>
<controlDestinationPort>0</controlDestinationPort>
<controlDirection>0</controlDirection>
</flowStatsTcpUdp>
<flowStatsTcpUdp>
<startTime>1327405883000</startTime>
<endTime>1327446000000</endTime>
<ruleId>1001</ruleId>
<blocked>0</blocked>
<protocol>5</protocol>
<direction>1</direction>
<sessions>69</sessions>
<sourcePackets>69</sourcePackets>
<destinationPackets>0</destinationPackets>
<sourceBytes>17832</sourceBytes>
<destinationBytes>0</destinationBytes>
<networkId>network-2553</networkId>
<sourceIp>10.112.199.13</sourceIp>
<destinationIp>10.112.199.255</destinationIp>
<destinationPort>138</destinationPort>
<controlProtocol></controlProtocol>
<controlSourceIp>0.0.0.0</controlSourceIp>
<controlDestinationIp>0.0.0.0</controlDestinationIp>
<controlDestinationPort>0</controlDestinationPort>
<controlDirection>0</controlDirection>
</flowStatsTcpUdp>
</FlowStatsPage>

Query Flow Summary


Retrievesflowsummaryforgivencontext.
Example 9-34. Get flow summary
Request:

288

VMware, Inc.

Chapter 9 Distributed Firewall Management

GET
https://<nsxmgr-ip>/api/2.1/app/internal/flow/flowsummary?contextId=datacenter-2538&&startTime=13274058
83000&endTime=1327482600000

where

contextId:vcmorefidofthedatacenter,portgroup,virtualmachine,oruuidincasevNICforwhichthe
trafficflowistoberetrieved.

startTime:Flowswithstarttimegreaterthanthiswillbefetched.

endTime:Flowswithendtimelesserthanthiswillbefetched.

Query Flow Table


Retrievestoprowsforgivencontextandtabletype.
Example 9-35. Get flow table
Request:
GET
https://<nsxmgr-ip>/api/2.1/app/internal/flow/flowtable?contextId=datacenter-2538&&startTime=132740588300
0&endTime=1327482600000&tableType=source

where

contextId:vcmorefidofthedatacenter,portgroup,virtualmachine,oruuidincasevNICforwhichthe
trafficflowistoberetrieved.

startTime:Flowswithstarttimegreaterthanthiswillbefetched.

endTime:Flowswithendtimelesserthanthiswillbefetched.

tableType:Thisparameterindicatesthetypeoftheflowtobefetched.Possiblevaluesare:Source,
Application,Destination.

maxRows:(optional)Maximumnumberofrowstobereturned(defaultvalue:5).

Query Flow Details


Retrievesflowdetailsforgivencontext.
Example 9-36. Get flow details
Request:
GET
https://<nsxmgr-ip>/api/2.1/app/internal/flow/flowdetaild?contextId=datacenter-2538&&&flowType=Allowed&
startTime=0&endTime=1327482600000

where

contextId:vcmorefidofthedatacenter,portgroup,virtualmachine,oruuidincasevNICforwhichthe
trafficflowistoberetrieved.

flowType:Thisparameterindicatesthetypeoftheflowtobefetched.PossiblevaluesforflowType
parameterare:AllowedorBlocked.

startTime:Flowswithstarttimegreaterthanthiswillbefetched.

endTime:Flowswithendtimelesserthanthiswillbefetched.

VMware, Inc.

289

vShield API Programming Guide

Query Paged Flow Details


Retrievesapageofflowdetailsforgivencontext.
Example 9-37. Get flow details
Request:
GET https://<nsxmgr-ip>/api/2.1/app/internal/flow/pagedflowdetails?contextId=datacenter-2538&&&
flowType=Allowed&startTime=0&endTime=1327482600000

where

contextId:vcmorefidofthedatacenter,portgroup,virtualmachine,oruuidincasevNICforwhichthe
trafficflowistoberetrieved.

flowType:Thisparameterindicatesthetypeoftheflowtobefetched.PossiblevaluesforflowType
parameterare:AllowedorBlocked.

startTime:Flowswithstarttimegreaterthanthiswillbefetched.

endTime:Flowswithendtimelesserthanthiswillbefetched.

startIndex:(optional)Thisisthestartindexoftheflowstobereturned(defaultvalue:0).

pageSize:(optional)Thisisthemaximumnumberofflowstobereturnedinasinglegetcall(defaultvalue
is256).

Query Flow Details Application


Retrievesflowdetailsforgivencontextbyapplication.Ifavailable,thesourceanddestinationnamesare
returned.
Example 9-38. Get flow details by application
Request:
GET
https://<nsxmgr-ip>/api/2.1/app/internal/flow/flowdetaild/application?contextId=datacenter-2538&&&flowType
=Allowed&startTime=0&endTime=1327482600000&serviceId=application-211

where

contextId:vcmorefidofthedatacenter,portgroup,virtualmachine,oruuidincasevNICforwhichthe
trafficflowistoberetrieved.

flowType:Thisparameterindicatesthetypeoftheflowtobefetched.PossiblevaluesforflowType
parameterare:AllowedorBlocked.

startTime:Flowswithstarttimegreaterthanthiswillbefetched.

endTime:Flowswithendtimelesserthanthiswillbefetched.

serviceId:Theserviceidentifieroftheapplicationtobequeried.

Query Paged Flow Details Application


Retrievesapageofflowdetailsforgivencontextbyapplication.Ifavailable,thesourceanddestinationnames
arereturned.
Example 9-39. Get paged flow details by application
Request:

290

VMware, Inc.

Chapter 9 Distributed Firewall Management

GET
https://<nsxmgr-ip>/api/2.1/app/internal/flow/pagedflowdetails/application?contextId=datacenter-2538&&&flow
Type=Allowed&startTime=0&endTime=1327482600000&serviceId=application-211

where

contextId:vcmorefidofthedatacenter,portgroup,virtualmachine,oruuidincasevNICforwhichthe
trafficflowistoberetrieved.

flowType:Thisparameterindicatesthetypeoftheflowtobefetched.PossiblevaluesforflowType
parameterare:AllowedorBlocked.

startTime:Flowswithstarttimegreaterthanthiswillbefetched.

endTime:Flowswithendtimelesserthanthiswillbefetched.

serviceId:Theserviceidentifieroftheapplicationtobequeried.

startIndex:(optional)Thisisthestartindexoftheflowstobereturned(defaultvalue:0).

pageSize:(optional)Thisisthemaximumnumberofflowstobereturnedinasinglegetcall(defaultvalue
is256).

Flow Exclusion
Firewallingisdonebyakernelmodulepresentoneachhost.Thiskernelmoduleoneachhostgeneratesflow
recordsfornetworkactivityhappeningonprotectedonVMs.Theseflowrecordsgeneratedoneachhostare
senttoNSXManager,whichconsumestherecordsfromallhostsanddisplaysaggregatedmeaningful
information.Duetothevastamountofflowrecordswhichcanbegeneratedonahost,capabilityhasbeen
providedtoexcludegenerationofflowrecordsbythekernelmoduleaspercriteriachosenbyadministrator.
Followingknobsareprovidedtocontrolflowexclusion.Allexclusionparametersareappliedgloballyonall
hosts.

DisableFlowscompletelyatagloballevel

Ignoreallowedflows

Ignoreblockedflows

Ignorelayer2flows

SourceIPstoignore.Ex:10.112.3.14,10.112.3.1510.112.3.18,192.168.1.1\24

Sourcecontainerstoignore.ContainercancontainVm,vNic,IPSet,MACSet

DestinationIPstoignore.

Destinationcontainerstoignore.ContainercancontainVm,vNic,IPSet,MACSet

Destinationports

Servicecontainerstoignore.ContainercancontainApplicationorApplicationgroup

Flowexclusionhappensatthesourceofgenerationofflowrecordsi.e.hostitself.Thefollowingflowsare
discardedbydefault:

BroadcastIP(255.255.255.255)

Localmulticastgroup(224.0.0.0/24)

BroadcastMACaddress(FF:FF:FF:FF:FF:FF)

Exclude Flows
Excludesspecifiedflows.

VMware, Inc.

291

vShield API Programming Guide

Example 9-40. Exclude flows


Request:
POST https://<nsxmgr-ip>/api/2.1/app/flow/config

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<FlowConfiguration>
<collectFlows>true</collectFlows>
<ignoreBlockedFlows>false</ignoreBlockedFlows>
<ignoreLayer2Flows>false</ignoreLayer2Flows>
<sourceIPs>10.112.3.14, 10.112.3.15-10.112.3.18,192.168.1.1\24</sourceIPs>
<sourceContainer>
<name>vm1 - Network adapter 1</name>
<id>5013bcd8-c666-1e28-c7a9-600da945954f.000</id>
<type>Vnic</type>
</sourceContainer>
<sourceContainer>
<name>Large XP-1</name>
<id>vm-126</id>
<type>VirtualMachine</type>
</sourceContainer>
<destinationIPs>10.112.3.14, 10.112.3.15-10.112.3.18,192.168.1.1\24</destinationIPs>
<destinationContainer>
<name>vm2 - Network adapter 2</name>
<id>5013bcd8-c666-1e28-c7a9-600da945954f.000</id>
<type>Vnic</type>
</destinationContainer>
<destinationContainer>
<name>Small XP-2</name>
<id>vm-226</id>
<type>VirtualMachine</type>
</destinationContainer>
<destinationPorts>22, 40-50, 60</destinationPorts>
<service>
<name>VMware-VDM2.x-Ephemeral</name>
<id>application-161</id>
</service>
</FlowConfiguration>

Query Excluded Flows


Retrievesexcludedflowdetails.
Example 9-41. Get excluded flows
Request:
GET https://<nsxmgr-ip>/api/2.1/app/flow/config

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<FlowConfiguration>
<collectFlows>true</collectFlows>
<ignoreBlockedFlows>false</ignoreBlockedFlows>
<ignoreLayer2Flows>false</ignoreLayer2Flows>
<sourceIPs>10.112.3.14, 10.112.3.15-10.112.3.18,192.168.1.1\24</sourceIPs>
<sourceContainer><name>vm1 - Network adapter 1</name>
<id>5013bcd8-c666-1e28-c7a9-600da945954f.000</id><type>Vnic</type></sourceContainer>
<sourceContainer><name>Large XP-1</name><id>vm-126</id><type>VirtualMachine</type></sourceContainer>
<destinationIPs>10.112.3.14, 10.112.3.15-10.112.3.18,192.168.1.1\24</destinationIPs>
<destinationContainer><name>vm2 - Network adapter 2</name>
<id>5013bcd8-c666-1e28-c7a9-600da945954f.000</id><type>Vnic</type></destinationContainer>
<destinationContainer><name>Small XP-2</name><id>vm-226</id><type>VirtualMachine</type></destinationContainer>

292

VMware, Inc.

Chapter 9 Distributed Firewall Management

<destinationPorts>22, 40-50, 60</destinationPorts>


<service><name>VMware-VDM2.x-Ephemeral</name><id>application-161</id></service>
</FlowConfiguration>

Excluding Virtual Machines from Firewall Protection


Youcanexcludeasetofvirtualmachinesfrombeingprotected.ThisexclusionlistisappliedacrossFirewall
ruleswithinthespecifiedNSXManager.IfavirtualmachinehasmultiplevNICs,allofthemareexcluded
fromprotection.

Add a Virtual Machine to the Exclusion List


Youcanaddavirtualmachinetotheexclusionlist.
Example 9-42. Add a virtual machine to exclusion list
Example:
PUT https://<nsxmgr-ip>/api/2.1/app/excludelist/<memberId>

WherememberIdisthevcmorefidofavirtualmachine.

Get Virtual Machine Exclusion List


Youcanretrievethesetofvirtualmachinesintheexclusionlist.
Example 9-43. Get exclusion list
Example:
GET https://<nsxmgr-ip>/api/2.1/app/excludelist/

ResponseBody:
<VshieldAppConfiguration>
<excludeListConfiguration>
<objectId>excludeList-1</objectId>
<type>
<typeName>ExcludeList</typeName>
</type>
<revision>1</revision>
<objectTypeName>ExcludeList</objectTypeName>
<excludeMember>
<member>
<objectId>vm-2371</objectId>
<type>
<typeName>VirtualMachine</typeName>
</type>
<name>VC-Win2k3</name>
<revision>2</revision>
<objectTypeName>VirtualMachine</objectTypeName>
<scope>
<id>domain-c731</id>
<objectTypeName>ClusterComputeResource</objectTypeName>
<name>Database-CL</name>
</scope>
</member>
</excludeMember>
</excludeListConfiguration>
</VshieldAppConfiguration>

VMware, Inc.

293

vShield API Programming Guide

Delete a Virtual Machine from Exclusion List


Youcandeleteavirtualmachinesfromtheexclusionlist.
Example 9-44. Delete virtual machine from exclusion list
Example:
DELETE https://<nsxmgr-ip>/api/2.1/app/excludelist/<memberID>

WherememberIdisthevcmorefidofavirtualmachine.

294

VMware, Inc.

10

Service Composer Management

10

Service Composer helps you provision and assign network and security services to applications in a virtual infrastructure. You map these services to a security group, and the services are applied to the virtual machines in the security
group.
Security Group
You begin by creating a security group to define assets that you want to protect. Security groups may be static (including
specific virtual machines) or dynamic where membership may be defined in one or more of the following ways:

vCentercontainers(clusters,portgroups,ordatacenters)

Securitytags,IPset,MACset,orevenothersecuritygroups.Forexample,youmayincludeacriteriato
addallmemberstaggedwiththespecifiedsecuritytag(suchasAntiVirus.virusFound)tothesecurity
group.

DirectoryGroups(ifNSXManagerisregisteredwithActiveDirectory)

RegularexpressionssuchasvirtualmachineswithnameVM1

Note that security group membership changes constantly. For example, a virtual machine tagged with the AntiVirus.virusFound tag is moved into the Quarantine security group. When the virus is cleaned and this tag is removed from
the virtual machine, it again moves out of the Quarantine security group.
Security Policy
A security policy is a collection of the following service configurations.
Table 10-1. Security services contained in a security policy
Service

Description

Applies to

Firewallrules

Rulesthatdefinethetraffictobeallowedto,from,orwithinthesecurity
group.

vNIC

Endpointservice

DataSecurityorthirdpartysolutionproviderservicessuchasantivirusor
vulnerabilitymanagementservices.

virtualmachines

Network
introspection
services

ServicesthatmonitoryournetworksuchasIPS.

virtualmachines

Mapping Security Policy to Security Group


Youmapasecuritypolicy(saySP1)toasecuritygroup(saySG1).TheservicesconfiguredforSP1areapplied
toallvirtualmachinesthataremembersofSG1.
Ifavirtualmachinebelongstomorethanonesecuritygroup,theservicesthatareappliedtothevirtual
machinedependsontheprecedenceofthesecuritypolicymappedtothesecuritygroups.

VMware, Inc.

295

vShield API Programming Guide

authenticationServiceComposerprofilescanbeexportedandimportedasbackupsorforuseinother
environments.Thisapproachtomanagingnetworkandsecurityserviceshelpsyouwithactionableand
repeatablesecuritypolicymanagement.
Thischapterincludesthefollowingtopics:

WorkingwithSecurityPolicies

WorkingwithSecurityActions

QuerySecurityPoliciesMappedtoaSecurityGroup

QueryServiceProviderData

QuerySecurityGroupEffectiveMembership

QuerySecurityGroupstowhichaVMBelongs

IMPORTANTAllNSXvSphereRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIon
page 25fordetailsaboutbasicauthentication.

Working with Security Policies


AsecuritypolicyisasetofEndpoint,firewall,andnetworkintrospectionservicesthatcanbeappliedtoa
securitygroup.
Forinformationoncreatingasecuritygroup,seeWorkingwithSecurityGroupsonpage 53.

Creating a Security Policy


Whencreatingasecuritypolicy,aparentsecuritypolicycanbespecifiedifrequired.Thesecuritypolicy
inherits services from the parent security policy. Securitygroupbindingsandactionscanalsobespecifiedwhile
creatingthepolicy.Notethatexecutionorderofactionsinacategoryisimpliedbytheirorderinthelist.The
responseofthecallhasLocationheaderpopulatedwiththeURIusingwhichthecreatedobjectcanbefetched.
Prerequisites
Ensurethat:

the required VMware built in services (such as Distributed Firewall, Data Security, and Endpoint) are installed. See
NSX Installation and Upgrade Guide.

the required partner services have been registered with NSX Manager.

therequiredsecuritygroupshavebeencreated.

Example 10-1. Create security policy


Request:
POST https://<nsxmgr-ip>/api/2.0/services/policy/securitypolicy

RequestBody:
<securityPolicy>
<name></name>
<description></description>
<precedence></precedence>
<parent>
<objectId></objectId>
</parent>
<securityGroupBinding>
<objectId></objectId>
</securityGroupBinding>
<securityGroupBinding>
...
</securityGroupBinding>

296

VMware, Inc.

Chapter 10 Service Composer Management

...
...
<securityGroupBinding>
...
</securityGroupBinding>
<actionsByCategory>
<category>firewall</category>
<action class="firewallSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<secondarySecurityGroup>
<objectId></objectId>
</secondarySecurityGroup>
<secondarySecurityGroup>
...
</secondarySecurityGroup>
...
...
<secondarySecurityGroup>
...
</secondarySecurityGroup>
<applications>
<application>
<objectId></objectId>
</application>
<applicationGroup>
<objectId></objectId>
</applicationGroup>
...
...
</applications>
<logged></logged>
<action></action>
<direction></direction>
<outsideSecondaryContainer></outsideSecondaryContainer>
</action>
<action>
...
</action>
...
...
<action>
...
</action>
</actionsByCategory>
<actionsByCategory>
<category>endpoint</category>
<action class="endpointSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<serviceId></serviceId>
<vendorTemplateId></vendorTemplateId>
</action>
</actionsByCategory>
<actionsByCategory>
<category>traffic_steering</category>
<action class="trafficSteeringSecurityAction">
<name></name>

VMware, Inc.

297

vShield API Programming Guide

<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<logged></logged>
<redirect></redirect>
<serviceProfile>
<objectId></objectId>
</serviceProfile>
</action>
</actionsByCategory>
</securityPolicy>

Description of Tags
ThissectiondescribesthetagsspecifictoServiceComposermanagement.
Common Tags

executionOrderCategoryCategorytowhichtheactionbelongsto(endpoint,firewallortraffic_steering)

actionTypeDefinesthetypeofactionbelongingtoagivenexecutionOrderCategory

isEnabledIndicateswhetheranactionisenabled

isActionEnforcedEnforcesanactionofaparentpolicyonitschildpoliciesforagivenactionTypeand
executionOrderCategory.Notethatinapolicyhierarchy,foragivenactionTypeand
executionOrderCategory,therecanbeonlyoneactionwhichcanbemarkedasenforced.

isActiveInasecuritypolicyhierarchy,anactionwithinapolicymayormaynotbeactivebasedonthe
precedenceofthepolicyorusageofisActionEnforcedflaginthathierarchy

securityPolicyParentpolicyinanaction

secondarySecurityGroupApplicableforactionswhichneedsecondarysecuritygroups,saya
sourcedestinationfirewallrule

Output only Tags

executionOrderDefinesthesequenceinwhichactionsbelongingtoanexecutionOrderCategoryare
executed.Notethatthisisnotaninputparameteranditsvalueisimpliedbytheindexinthelist.

Firewall Category Tags

applicationsApplications/applicationgroupsonwhichtherulesaretobeapplied

loggedFlagtoenableloggingofthetrafficthatishitbythisrule

actionAlloworblockthetraffic

directionDirectionoftraffictowardsprimarysecuritygroup.Possiblevalues:inbound,outbound,intra

outsideSecondaryContainerFlagtospecifyoutsidei.e.outsidesecuritygroup3

Endpoint Category Tags

298

serviceIdIDoftheservice(asregisteredwiththeserviceinsertionmodule).Ifthistagisnull,the
functionalitytype(asdefinedinactionTypetag)isnotappliedwhichwillalsoresultinblockingthe
actions(ofgivenfunctionalitytype)thatareinheritedfromtheparentseicritypolicy.Thisistrueifthere
isnoactionofenforetype.

vendorTemplateIdIDofspecificvendorconfiguration.

invalidServiceIdFlagtoindicatethattheservicethatwasreferencedinthisruleisdeleted,whichmake
theruleineffective(ordeviatefromtheoriginalintentthatexistedwhileconfiguringtherule).Youmust
eithermodifythisrulebyaddingcorrectServiceordeletethisrule.
VMware, Inc.

Chapter 10 Service Composer Management

invalidVendorTemplateIdFlagtoindicatethatthevendortemplatethatwasreferencedinthisruleis
deleted,whichmaketheruleineffective(ordeviatefromtheoriginalintentthatexistedwhileconfiguring
therule).YoumusteitherfixthisrulebyaddingcorrectServiceordeletethisrule.

serviceNameNameoftheservice

vendorTemplateNameNameofvendortemplate

TrafficSteering/NetX Category Tags

redirectFlagtoindicatewhethertoredirectthetrafficornot

serviceProfileServiceprofileforwhichredirectionisbeingconfigured

loggedFlagtoenableloggingofthetrafficthatishitbythisrule

Querying Security Policies


YoucanretrieveaspecificsecuritypolicybyspecifyingitsIDorallsecuritypolicies.
Example 10-2. Query security policies
Request:
GET https://<nsxmgr-ip>/api/2.0/services/policy/securitypolicy/securitypolicyID | all

ResponseBody:
<securityPolicy><securityPolicy>
<name></name>
<description></description>
<precedence></precedence>
<parent>
<objectId></objectId>
</parent>
<securityGroupBinding>
<objectId></objectId>
</securityGroupBinding>
<securityGroupBinding>
...
</securityGroupBinding>
...
...
<securityGroupBinding>
...
</securityGroupBinding>
<actionsByCategory>
<category>firewall</category>
<action class="firewallSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<secondarySecurityGroup>
<objectId></objectId>
</secondarySecurityGroup>
<secondarySecurityGroup>
...
</secondarySecurityGroup>
...
...
<secondarySecurityGroup>
...
</secondarySecurityGroup>
<applications>
VMware, Inc.

299

vShield API Programming Guide

<application>
<objectId></objectId>
</application>
<applicationGroup>
<objectId></objectId>
</applicationGroup>
...
...
</applications>
<logged></logged>
<action></action>
<direction></direction>
<outsideSecondaryContainer></outsideSecondaryContainer>
</action>
<action>
...
</action>
...
...
<action>
...
</action>
</actionsByCategory>
<actionsByCategory>
<category>endpoint</category>
<action class="endpointSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<serviceId></serviceId>
<vendorTemplateId></vendorTemplateId>
</action>
</actionsByCategory>
<actionsByCategory>
<category>traffic_steering</category>
<action class="trafficSteeringSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<logged></logged>
<redirect></redirect>
<serviceProfile>
<objectId></objectId>
</serviceProfile>
</action>
</actionsByCategory>
</securityPolicy>
<name></name>
<description></description>
<precedence></precedence>
<parent>
<objectId></objectId>
</parent>
<securityGroupBinding>
<objectId></objectId>

300

VMware, Inc.

Chapter 10 Service Composer Management

</securityGroupBinding>
<securityGroupBinding>
...
</securityGroupBinding>
...
...
<securityGroupBinding>
...
</securityGroupBinding>
<actionsByCategory>
<category>firewall</category>
<action class="firewallSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<secondarySecurityGroup>
<objectId></objectId>
</secondarySecurityGroup>
<secondarySecurityGroup>
...
</secondarySecurityGroup>
...
...
<secondarySecurityGroup>
...
</secondarySecurityGroup>
<applications>
<application>
<objectId></objectId>
</application>
<applicationGroup>
<objectId></objectId>
</applicationGroup>
...
...
</applications>
<logged></logged>
<action></action>
<direction></direction>
<outsideSecondaryContainer></outsideSecondaryContainer>
</action>
<action>
...
</action>
...
...
<action>
...
</action>
</actionsByCategory>
<actionsByCategory>
<category>endpoint</category>
<action class="endpointSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<serviceId></serviceId>
<vendorTemplateId></vendorTemplateId>
</action>
</actionsByCategory>

VMware, Inc.

301

vShield API Programming Guide

<actionsByCategory>
<category>traffic_steering</category>
<action class="trafficSteeringSecurityAction">
<name></name>
<description></description>
<category></category>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<logged></logged>
<redirect></redirect>
<serviceProfile>
<objectId></objectId>
</serviceProfile>
</action>
</actionsByCategory>
</securityPolicy>

Edit a Security Policy


Toupdateasecuritypolicy,youmustfirstfetchit.Formoreinformation,seeQueryingSecurityPolicies.
YoutheneditthereceivedXMLandpassitbackastheinput.Thespecifiedconfigurationreplacesthecurrent
configuration.
SecuritygroupmappingsprovidedinthePUTcallreplacesthesecuritygroupmappingsforthesecurity
policy.Toremoveallmappings,deletethesecurityGroupBindingsparameter.
YoucanaddorupdateactionsforthesecuritypolicybyeditingtheactionsByCategoryparameter.Toremove
allactions(belongingtoallcategories),deletetheactionsByCategoryparameter.Toremoveactionsbelonging
toaspecificcategory,deletetheblockforthatcategory.
Example 10-3. Edit a security policy
Request:
PUT https://<nsxmgr-ip>/api/2.0/services/policy/securitypolicy/securitypolicyID

ResponseBody:
SeeExample 102.

Delete a Security Policy


Whenyoudeleteasecuritypolicy,itschildsecuritypoliciesandalltheactionsinitaredeletedaswell.
Example 10-4. Delete a security policy
Request:
DELETE https://<nsxmgr-ip>/api/2.0/services/policy/securitypolicy/securitypolicyID?force=<true/false>

Ifyousettheforceparametertotrue,thesecuritypolicyisdeletedevenifitisbeingusedsomewhere.

302

VMware, Inc.

Chapter 10 Service Composer Management

Export a Security Policy Configuration


YoucanexportaServiceComposerconfiguration(alongwiththesecuritygroupstowhichthesecurity
policiesaremapped)andsaveittoyourdesktop.Thesavedconfigurationcanbeusedasabackupfor
situationswhereyoumayaccidentallydeleteapolicyconfiguration,oritcanbeexportedforuseinanother
NSXManagerenvironment.
Example 10-5. Export a security policy
Requestforselectiveexport:
GET
https://<nsxmgr-ip>/api/2.0/services/policy/securitypolicy/hierarchy?policyIds=comma_separated_securitypolicy
_ids&prefix=optional_some_prefix_before_names

Requestforexportingallpolicies:
GET https://<nsxmgr-ip>/api/2.0/services/policy/hierarchy?prefix=optional_some_prefix_before_names

ResponseBody:
<securityPolicyHierarchy>
<name></name>
<description></description>
<securityPolicy></securityPolicy>
<securityPolicy></securityPolicy>
...
...
<securityPolicy></securityPolicy>
<securityGroup></securityGroup>
<securityGroup></securityGroup>
...
...
<securityGroup></securityGroup>
</securityPolicyHierarchy>

Ifaprefixisspecified,itisaddedbeforethenamesofthesecuritypolicy,securityaction,andsecuritygroup
objectsintheexportedXML.Theprefixcanthusbeusedtoindicatetheremotesourcefromwherethe
hierarchywasexported.

Import a Security Policy Configuration


Youcancreatemultiplesecuritypoliciesandparentchildhierarchiesusingthedatafetchedthroughexport.
Allobjectsincludingsecuritypolicies,securitygroupsandsecurityactionsarecreatedonaglobalscope.
Example 10-6. Import a security policy
Requestforselectiveexport:
POST https://<nsxmgr-ip>/api/2.0/services/policy/securitypolicy/hierarchy?suffix=optional_suffix_to_be_added_after_names

RequestBody:
SeeExample 105.

Ifasuffixisspecified,itisaddedafterthenamesofthesecuritypolicy,securityaction,andsecuritygroup
objectsintheexportedXML.Thesuffixcanthusbeusedtodifferentiatelocallycreatedobjectsfromimported
ones.
Locationofthenewlycreatedsecuritypolicyobjects(multiplelocationsareseparatedbycommas)is
populatedintheLocationheaderoftheresponse.

VMware, Inc.

303

vShield API Programming Guide

Query Security Actions for a Security Policy


Youcanretrieveallsecurityactionsapplicableonasecuritypolicy.Thislistincludessecurityactionsfrom
associatedparentsecuritypolicies,ifany.SecurityactionsperExecutionOrderCategoryaresortedbasedon
theweightofsecurityactionsindescendingorder.
Example 10-7. Query security actions for a security policy
Request:
GET https://<nsxmgr-ip>/api/2.0/services/policy/securitypolicy/securitypolicyId/securityactions

ResponseBody:
<securityPolicies>
<securityPolicy></securityPolicy>
<securityPolicy></securityPolicy>
...
...
<securityPolicy></securityPolicy>
</securityPolicies>

Working with Security Actions


Query Virtual Machines for a Security Action
YoucanfetchallVirtualMachineobjectsonwhichsecurityactionofagivencategoryandattributehasbeen
applied.
Example 10-8. Query virtual machines for security action
Request:
GET
https://<nsxmgr-ip>/api/2.0/services/policy/securityaction/category/virtualmachines?attributeKey=attribute_nam
e&attributeValue=attribute_value

ResponseBody:
<vmnodes>
<vmnode>
<vmId></vmId>
<vmName></vmName>
</vmnode>
<vmnode>
<vmId></vmId>
<vmName></vmName>
</vmnode>
...
...
<vmnode>
<vmId></vmId>
<vmName></vmName>
</vmnode>
</vmnodes>

Query Security Actions Applicable on a Security Group


YoucanfetchallsecurityactionsapplicableonasecuritygroupforallExecutionOrderCategories.Thelistis
sortedbasedontheweightofsecurityactionsindescendingorder.TheisActivetagindicatesifasecurityaction
willbeapplied(bytheenforcementengine)onthesecuritygroup.

304

VMware, Inc.

Chapter 10 Service Composer Management

Example 10-9. Query security actions for security group


Request:
GET https://<nsxmgr-ip>/api/2.0/services/policy/securitygroup/securitygroupID/securityactions

ResponseBody:
<securityActionsByCategoryMap>
<actionsByCategory>
<category>firewall</category>
<action class="firewallSecurityAction">
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<description></description>
<category></category>
<executionOrder></executionOrder>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<secondarySecurityGroup>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<description></description>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
<description></description>
</scope>
<extendedAttributes></extendedAttributes>
</secondarySecurityGroup>
<secondarySecurityGroup>
...
</secondarySecurityGroup>
...
...
<secondarySecurityGroup>
...
</secondarySecurityGroup>
<securityPolicy>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<description></description>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
<description></description>
</scope>
VMware, Inc.

305

vShield API Programming Guide

</securityPolicy>
<invalidSecondaryContainers></invalidSecondaryContainers>
<applications>
<application>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
</scope>
<clientHandle></clientHandle>
<extendedAttributes/>
<inheritanceAllowed></inheritanceAllowed>
<element>
<applicationProtocol></applicationProtocol>
<value></value>
</element>
</application>
<application>
...
</application>
...
...
</applications>
<invalidApplications>false</invalidApplications>
<logged>false</logged>
<action>block</action>
<direction>inbound</direction>
<outsideSecondaryContainer>true</outsideSecondaryContainer>
</action>
<action>
</action>
...
...
<action>
...
</action>
</actionsByCategory>
<actionsByCategory>
<category>endpoint</category>
<action class="endpointSecurityAction">
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<description></description>
<category></category>
<executionOrder></executionOrder>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<securityPolicy>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>

306

VMware, Inc.

Chapter 10 Service Composer Management

<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<description></description>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
<description></description>
</scope>
</securityPolicy>
<serviceName></serviceName>
<serviceId></serviceId>
<vendorTemplateId></vendorTemplateId>
<invalidServiceId></invalidServiceId>
<vendorTemplateName></vendorTemplateName>
<invalidVendorTemplateId></invalidVendorTemplateId>
</action>
<action>
</action>
...
...
<action>
...
</action>
</actionsByCategory>
<actionsByCategory>
<category>traffic_steering</category>
<action class="trafficSteeringSecurityAction">
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<description></description>
<category></category>
<executionOrder></executionOrder>
<actionType></actionType>
<isActionEnforced></isActionEnforced>
<isActive></isActive>
<isEnabled></isEnabled>
<securityPolicy>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<description></description>
<scope>
<id></id>
<objectTypeName></objectTypeName>
<name></name>
<description></description>
</scope>
</securityPolicy>
<logged></logged>
<serviceProfile>
<objectId></objectId>
<objectTypeName></objectTypeName>

VMware, Inc.

307

vShield API Programming Guide

<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name>P</name>
<clientHandle>
</clientHandle>
<extendedAttributes/>
<profileAttributes>
<id></id>
<revision></revision>
<attribute>
<id></id>
<revision></revision>
<key></key>
<name></name>
<value></value>
</attribute>
<attribute>
...
</attribute>
</profileAttributes>
<service>
<objectId></objectId>
<objectTypeName></objectTypeName>
<vsmUuid></vsmUuid>
<revision></revision>
<type>
<typeName></typeName>
</type>
<name></name>
<clientHandle></clientHandle>
<extendedAttributes/>
</service>
<category></category>
<vendorTemplate>
<id></id>
<revision></revision>
<name></name>
<idFromVendor></idFromVendor>
<vendorAttributes>
<id></id>
<revision></revision>
</vendorAttributes>
</vendorTemplate>
<status></status>
<vendorAttributes>
<id></id>
<revision></revision>
</vendorAttributes>
<runtime>
<nonCompliantDvpg/>
<nonCompliantVwire/>
</runtime>
<serviceProfileBinding>
<distributedVirtualPortGroups/>
<virtualWires/>
<excludedVnics/>
<virtualServers/>
</serviceProfileBinding>
</serviceProfile>
<redirect></redirect>
</action>
<action>
</action>
...
...

308

VMware, Inc.

Chapter 10 Service Composer Management

<action>
...
</action>
</actionsByCategory>
</securityActionsByCategoryMap>

Query Security Action Applicable on A Virtual Machine


YoucanfetchthesecurityactionsapplicableonavirtualmachineforallExecutionOrderCategories.Thelist
ofSecurityActionsperExecutionOrderCategoryissortedbasedontheweightofsecurityactionsin
descendingorder.TheisActivetagindicateswhetherasecurityactionwillbeapplied(bytheenforcement
engine)onthevirtualmachine.
Example 10-10. Query security actions on a virtual machine
Request:
GET https://<nsxmgr-ip>/api/2.0/services/policy/virtualmachine/VM_ID//securityactions

ResponseBody:
<securityPolicies>
<securityPolicy></securityPolicy>
<securityPolicy></securityPolicy>
...
...
<securityPolicy></securityPolicy>
</securityPolicies>

Query Security Policies Mapped to a Security Group


Youcanretrievethesecuritypoliciesmappedtoasecuritygroup.Thelistissortedbasedontheprecedence
ofsecuritypolicyprecedenceindescendingorder.Thesecuritypolicywiththehighestprecedence(highest
numericvalue)isthefirstentry(index=0)inthelist.
Example 10-11. Query security policies mapped to a security group
Request:
GET https://<nsxmgr-ip>/api/2.0/services/policy/securitygroup/securitygroupID/securitypolicies

ResponseBody:
<securityPolicies>
<securityPolicy></securityPolicy>
<securityPolicy></securityPolicy>
...
...
<securityPolicy></securityPolicy>
</securityPolicies>

Query Service Provider Data


Youcanquerytheserviceproviderofagivencategorytofetchanobjectcontainingproviderspecificdata
basedontherequestedproperty/valuepairs.
Example 10-12. Query service provider data
Request:
GET https://<nsxmgr-ip>/api/2.0/services/policy/serviceprovider/category

VMware, Inc.

309

vShield API Programming Guide

RequestBody:
<keyValues>
<keyValue>
<key></key>
<value></value>
</keyValue>
<keyValue>
..
</keyValue>
..
..
<keyValue>
..
</keyValue>
</keyValues>

Query Security Group Effective Membership


Retrieveseffectivemembershipofasecuritygroupintermsofvirtualmachines.Theeffectivemembershipis
calculatedusingallthethreemembershipcomponentsofasecuritygroupstaticinclude,staticexclude,and
dynamicusingthefollowingformula:
Effectivemembershipvirtualmachines=[(VMsresultingfromstaticincludecomponent+VMsresultingfrom
dynamiccomponent)(VMsresultingfromstaticexcludecomponent)]
Example 10-13. Query virtual machines in a security group
Request:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/{securityGroupId}/translation/virtualmachines

Query Security Groups to which a VM Belongs


Retrievesthecollectionofsecuritygroupstowhichavirtualmachineisadirectorindirectmember.Indirect
membershipinvolvesnestingofsecuritygroups.
Example 10-14. Query security groups to which a virtual machine belongs
Request:
GET https://<nsxmgr-ip>/api/2.0/services/securitygroup/lookup/virtualmachine/<virtualMachineId>

310

VMware, Inc.

11

Data Security Configuration

11

DataSecurityprovidesvisibilityintosensitivedatastoredwithinyourorganizationsvirtualizedandcloud
environments.BasedontheviolationsreportedbyDataSecurity,youcanensurethatsensitivedatais
adequatelyprotectedandassesscompliancewithregulationsaroundtheworld.
Thischapterincludesthefollowingtopics:

DataSecurityUserRolesonpage 311

DefiningaDataSecurityPolicyonpage 312

SavingandPublishingPoliciesonpage 317

DataSecurityScanningonpage 318

QueryingScanResultsonpage 319

QueryingViolationDetailsonpage 323

TobeginusingDataSecurity,youcreateapolicythatdefinestheregulationsthatapplytodatasecurityinyour
organizationandspecifiestheareasofyourenvironmentandfilestobescanned.WhenyoustartaData
Securityscan,analyzesthedataonthevirtualmachinesinyourvSphereinventoryandreportsthenumberof
violationsdetectedandthefilesthatviolatedyourpolicy.
Afteryouanalyzetheresultsofthescan,youcanedityourpolicyasrequired.Whenyoueditapolicy,you
mustenableitbypublishingthechanges.
NotethatyoucannotinstallDataSecurityusingaRESTAPI.ForinformationoninstallingDataSecurity,see
theNSXInstallationandUpgradeGuide.
TodeployDataSecurity,youmustinstallthelatestversionofVMwareToolsoneachvirtualmachinethatyou
wanttoscan.ThisinstallsaThinAgent,whichallowstheSVMtoscanthevirtualmachines.

Data Security User Roles


Ausersroledeterminestheactionsthattheusercanperform.Ausercanonlyhaveonerole.Youcannotadd
aroletoauser,orremoveanassignedrolefromauser,butyoucanchangetheassignedroleforauser.
Table 11-1. Data Security User Roles
Role

Actions Allowed

Enterpriseadministrator

Alloperationsandsecurity.

vShieldadministrator

NSXoperationsonly:forexample,installvirtualappliances,andconfigureportgroups.

Securityadministrator

Createandpublishpolicies,viewviolationreports.Cannotstartorstopdatasecurityscans.

Auditor

Viewconfiguredpoliciesandviolationreports.Readonly.

VMware, Inc.

311

vShield API Programming Guide

Defining a Data Security Policy


Inordertodetectsensitivedatainyourenvironment,youmustcreateadatasecuritypolicy.Youmustbea
SecurityAdministratortocreatepolicies.
Todefineapolicy,youmustspecifythefollowing:

Regulations
AregulationisadataprivacylawforprotectingPCI(PaymentCardIndustry),PHI(ProtectedHealth
Information)andPII(PersonallyIdentifiableInformation)information.Youcanselecttheregulationsthat
yourcompanyneedstocomplyto.Whenyourunascan,DataSecurityidentifiesdatathatviolatesthe
regulationsinyourpolicy,andishencesensitiveforyourorganization.

Participatingareas
Bydefault,yourentirevCenterinventoryisscanned.Toscanasubsetofyourinventory,youcanspecify
thesecuritygroupsthatyouwanttoincludeorexclude.

Filefilters
Youcancreatefilterstolimitthedatabeingscannedandexcludethefiletypesunlikelytocontain
sensitivedatafromthescan.

InthedatasecurityAPIs,dlpinthepathnamestandsfordatalossprevention(DLP).

Query Regulations
Youcanretrievethelistofavailableregulationsforapolicy.TheoutputincludesregulationIDsandthe
embeddedclassificationsforeachregulation.
Example 11-1. Get all SDD policy regulations
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/regulation

Response:
<set>
<Regulation>
Regulation ID
<id>66</id>
<name>California AB-1298</name>
<description>Identifies documents and transmissions that contain protected health information (ePHI) and personally
identifiable information (PII) as regulated by California AB-1298 (Civil Code 56, 1785 and 1798)...
<classifications>
<Classification>
<id>10</id>
Classification ID
<name>Credit Card Track Data</name>
<providerName>Credit Card Track Data</providerName>
<description>Credit Card Track Data</description>
<customizable>false</customizable>
</Classification>
...

Enable a Regulation
YoucanenableoneormoreregulationsbyputtingtheregulationIDsintothepolicy.Youcangetthe
appropriateregulationIDsfromtheoutputoftheretrieveregulationsAPI(seeExample 111).Intheexample
requestbody,regulation66isCaliforniaAB1298,andregulations67and68originateelsewhere.
Example 11-2. Enable a regulation
Request:

312

VMware, Inc.

Chapter 11 Data Security Configuration

PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/regulations

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<set>
<long>66</long>
<long>67</long>
<long>68</long>
</set>

Query Classification Value


YoucanretrievetheclassificationvaluesassociatedwithregulationsthatmonitorGroupInsuranceNumbers,
HealthPlanBeneficiaryNumbers,MedicalRecordNumbers,orPatientIdentificationNumbers.Theoutput
includestheclassificationID.
Example 11-3. Get all classification values associated with customizable classifications
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/classificationvalue

Configure a Customized Regex as a Classification Value


YoucanconfigureaClassificationValuewithacustomizedregexthatmustbematchedduringviolation
inspection.YoumustincludetheappropriateclassificationID,whichyoucangetfromtheoutputofthe
retrieveclassificationvalueAPI.

Example 11-4. Configure a customized regex as a classification value


Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/classificationvalues
Authorization: Basic YWRtaW46ZGVmYXVsdA==
<set>

Classification ID

<ClassificationValue>
<id>3</id>
<classification>
<id>15</id>
<name>Health Plan Beneficiary Numbers</name>
<providerName>Health Plan Beneficiary Numbers</providerName>
Regex
<description>Health Plan Beneficiary Numbers</description>
<customizable>true</customizable>
</classification>
<value>PATNUM-[0-9]{10}</value>
</ClassificationValue>
</set>

View the List of Excludable Areas


Youcanretrievethelistofdatacenters,clusters,andresourcepoolsinyourinventorytohelpyoudetermine
theareasyoumightwanttoexcludefrompolicyinspection.
Example 11-5. View the list of excludable areas
Request:

VMware, Inc.

313

vShield API Programming Guide

GET https://<nsxmgr-ip>/api/2.0/dlp/excludableareas

Response:
<set>
<EnhancedInfo>
<objectId>datacenter-2</objectId>
<name>jdoe</name>
<revision>32</revision>
<objectTypeName>Datacenter</objectTypeName>
<ownerName>VMware</ownerName>
</EnhancedInfo>
<EnhancedInfo>
<objectId>datacenter-94</objectId>
<name>jdoe</name>
<revision>32</revision>
<objectTypeName>Datacenter</objectTypeName>
<ownerName>VMware</ownerName>
</EnhancedInfo>
<EnhancedInfo>
<objectId>resgroup-3725</objectId>
<name>ResourcePool1</name>
<revision>2</revision>
<objectTypeName>ResourcePool</objectTypeName>
<ownerName>jdoe</ownerName>
</EnhancedInfo>
<EnhancedInfo>
<objectId>domain-c2720</objectId>
<name>Cluster1</name>
<revision>17</revision>
<objectTypeName>ClusterComputeResource</objectTypeName>
<ownerName>jdoe</ownerName>
</EnhancedInfo>
<EnhancedInfo>
<objectId>resgroup-3726</objectId>
<name>ResourcePool2</name>
<revision>1</revision>
<objectTypeName>ResourcePool</objectTypeName>
<ownerName>jdoe</ownerName>
</EnhancedInfo>
</set>

Exclude Areas from Policy Inspection


ThisAPIisdeprecatedasof5.0.1.Instead,usetheAPIforexcludingsecuritygroupsfromascan.Formore
information,seeExample 118,Excludeasecuritygroupfromthescan,onpage 315.
Youcanexcludeoneormoredatacenters,resourcepoolsorclustersfrompolicyinspectionbyincludingthe
objectIDofeachareatoexclude.YoucangettheobjectIDfromtheoutputoftheViewthelistofexcludable
areasAPI(seeExample 115).
Example 11-6. Exclude areas from policy inspection
Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/excludedareas
Authorization: Basic YWRtaW46ZGVmYXVsdA==
<set>
<string>datacenter-3720</string>
</set>

314

VMware, Inc.

Chapter 11 Data Security Configuration

Specify Security Groups to be Scanned


Toscanasubsetofyourinventory,youcanspecifythesecuritygroupsthatyouwanttoincludeorexcludein
thedatasecurityscan.
Example 11-7. Include a security group in the scan
Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/includedsecuritygroups/

RequestBody:
<set>
<string>securitygroup-id-1</string>
<string>securitygroup-id-1</string>
</set>

Example 11-8. Exclude a security group from the scan


Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/excludedsecuritygroups/

RequestBody:
<set>
<string>securitygroup-id-1</string>
<string>securitygroup-id-1</string>
</set>

Query Security Groups Being Scanned


Youcanretrievethesecuritygroupsthathavebeenincludedorexcludedfromdatasecurityscans.
Example 11-9. Get included security groups
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/policy/includedsecuritygroups

Response:
<set>
<basicinfo>
<objectId>securitygroup-1</objectId>
<type>
<typeName>SecurityGroup</typeName>
</type>
<name>included</name>
<revision>2</revision>
<objectTypeName>SecurityGroup</objectTypeName>
<scope>
<id>datacenter-2</id>
<objectTypeName>Datacenter</objectTypeName>
<name>jkiryakoza</name>
</scope>
</basicinfo>
</set>

Example 11-10. Get excluded security groups


Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/policy/excludedsecuritygroups/
VMware, Inc.

315

vShield API Programming Guide

Response:
<set>
<basicinfo>
<objectId>securitygroup-1</objectId>
<type>
<typeName>SecurityGroup</typeName>
</type>
<name>included</name>
<revision>2</revision>
<objectTypeName>SecurityGroup</objectTypeName>
<scope>
<id>datacenter-2</id>
<objectTypeName>Datacenter</objectTypeName>
<name>jkiryakoza</name>
</scope>
</basicinfo>
</set>

Configure File Filters


Youcanrestrictthefilesyouwanttoscanbasedonsize,lastmodifieddate,orfileextensions.
Thefollowingfilefiltersareavailable:

sizeLessThanBytesscanonlyfileswithabytesizelessthanthespecifiednumber.

lastModifiedBeforescanonlyfilesmodifiedbeforethespecifieddate.Thedatemustbespecifiedin
GMTformat(YYYYMMDDHH:MM:SS).

lastModifiedAfterscanonlyfilesmodifiedafterthespecifieddate.ThedatemustbespecifiedinGMT
format(YYYYMMDDHH:MM:SS).

extensionsIncludedBooleanvalueasinTable 111.
Table 11-2. Included extensions parameter
Value of the extensionsIncluded parameter

Result

truefollowedbytheextensionsparameter
containingoneormoreextensions

Onlyfileswiththespecifiedextensionsarescanned

falsefollowedbytheextensionsparameter
containingoneormoreextensions

Allfilesarescannedexceptthosewiththespecifiedextensions.

ThescanAllFilesparameterdeterminesifallfilesshouldbeinspectedduringascanoperation.Thisparameter
overridesallotherparameters,sosetthisparametertofalseifyouareconfiguringafilter.
Example 11-11. Scan only PDF and XLXS files modified after 10/19/2011
Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/FileFilters
<FileFilters>
<scanAllFiles>false</scanAllFiles>
<lastModifiedAfter>2011-10-19 15:16:04.0 EST</lastModifiedAfter>
<extensionsIncluded>true</extensionsIncluded>
<extensions>pdf,xlsx</extensions>
</FileFilters>

Example 11-12. Scan all files except PDF and XLXS files
Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/FileFilters
<FileFilters>

316

VMware, Inc.

Chapter 11 Data Security Configuration

<scanAllFiles>false</scanAllFiles>
<extensionsIncluded>false</extensionsIncluded>
<extensions>pdf,xlsx</extensions>
</FileFilters>

Example 11-13. Scan PDF and XLXS files that are less than 100 MB in size
Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/FileFilters
<FileFilters>
<scanAllFiles>false</scanAllFiles>
<sizeLessThanBytes>100000000</sizeLessThanBytes>
<extensionsIncluded>true</extensionsIncluded>
<extensions>pdf,xlsx</extensions>
</FileFilters>

Saving and Publishing Policies


Afteryouhavedefinedadatasecuritypolicy,youcanedititbychangingtheregulationsselected,areas
excludedfromthescan,orthefilefilters.Toapplytheeditedpolicy,youmustpublishit.

Query Saved Policy


Asabestpractice,youshouldretrieveandreviewthelastsavedpolicybeforepublishingit.Eachpolicy
containsarevisionvaluethatcanbeusedtotrackversionhistory.
Example 11-14. Get saved SDD policy
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/policy/saved
Authorization: Basic YWRtaW46ZGVmYXVsdA==

Response:thefollowingresponsecontainsapolicywithasingleregulation,IndianaHB1101.
<DlpPolicy>
<objectId>DlpPolicy-1</objectId>
<type>
<typeName>DlpPolicy</typeName>
</type>
<name>DlpPolicy-One</name>
<revision>6</revision>
<objectTypeName>DlpPolicy</objectTypeName>
<regulations>
<Regulation>
<id>37</id>
<name>Indiana HB-1101</name>
<description>Indiana HB-1101</description>
<classifications>
<Classification>
<id>16</id>
<name>US National Provider Identifier</name>
<providerName>US National Provider Identifier</providerName>
<description>US National Provider Identifier</description>
<customizable>false</customizable>
</Classification>
<classifications>
<regions>
<string>North America</string>
<string>USA</string>
</regions>
<categories>
<string>PHI</string>
<string>PCI</string>

VMware, Inc.

317

vShield API Programming Guide

<string>PII</string>
</categories>
</Regulation>
</regulations>
<regulationsChanged>false</regulationsChanged>
<excludedAreas/>
<excludedAreasChanged>false</excludedAreasChanged>
<fileFilters>
<scanAllFiles>false</scanAllFiles>
<sizeLessThanBytes>0</sizeLessThanBytes>
<extensionsIncluded>false</extensionsIncluded>
</fileFilters>
<fileFiltersChanged>false</fileFiltersChanged>
<classificationValues>
<ClassificationValue>
<id>1</id>
<classification>
<id>19</id>
<name>Patient Identification Numbers</name>
<providerName>Patient Identification Numbers</providerName>
<description>Patient Identification Numbers</description>
<customizable>true</customizable>
</classification>
<value>deg</value>
</ClassificationValue>
</classificationValues>
<classificationValuesChanged>false</classificationValuesChanged>
<lastUpdatedOn class="sql-timestamp">2012-01-04 21:25:08.0</lastUpdatedOn>
<lastUpdatedBy>admin</lastUpdatedBy>
</DlpPolicy>

Query Published Policy


YoucanretrievethecurrentlypublishedSDDpolicythatisactiveonallvShieldEndpointSVMs.
Example 11-15. Get published SDD policy
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/policy/published
Authorization: Basic YWRtaW46ZGVmYXVsdA==

Publish the Updated Policy


Afterupdatingapolicywithaddedregulations,excludedareas,orcustomizedregexvaluespublishthepolicy
toenforcethenewparameters.
Example 11-16. Publish the updated policy
Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/policy/publish

Data Security Scanning


Runningadatasecurityscanidentifiesdatainyourvirtualenvironmentthatviolatesyourpolicy.
Allvirtualmachinesinyourdatacenterarescannedonceduringascan.Ifthepolicyiseditedandpublished
whileascanisrunning,thescanrestarts.Thisrescanensuresthatallvirtualmachinescomplywiththeedited
policy.Arescanistriggeredbypublishinganeditedpolicy,notbydataupdatesonyourvirtualmachines.
Afteryoustartascan,itcontinuestorununtilyoupauseorstopit.

318

VMware, Inc.

Chapter 11 Data Security Configuration

Ifnewvirtualmachinesareaddedtoyourinventorywhileascanisinprogress,thosemachineswillalsobe
scanned.Ifavirtualmachineismovedtoanexcludedclusterorresourcepoolwhilethedatasecurityscanis
inprogress,thefilesonthatvirtualmachinearenotscanned.IncaseavirtualmachineismovedviavMotion
toanotherhost,thescancontinuesonthesecondhost(filesthatwerescannedwhilethevirtualmachinewas
ontheprevioushostarenotscannedagain).
DataSecurityscansonevirtualmachineonahostatatimetominimizeimpactonperformance.VMware
recommendsthatyoupausethescanduringnormalbusinesshourstoavoidanyperformanceoverhead.

Start, Pause, Resume, or Stop a Scan Operation


Youcanstartorstopascanoperation.Thescanoperationoptionsareasfollows:

START:Startanewscan.

PAUSE:Pauseastartedscan.

RESUME:Resumeapausedscan.

STOP:Stopanyscan.

Example 11-17. Start, pause, resume, or stop a scan operation


Request:
PUT https://<nsxmgr-ip>/api/2.0/dlp/scanop
<ScanOp>STOP</ScanOp>

Query Status for a Scan Operation


YoucanretrievethestatusofthescanoperationtodetermineifascanisSTARTED(thatis,inprogress),
PAUSED,orSTOPPED.ThenextScanOpsparameterindicatesthescanoperationspossiblefromyourcurrent
state.Inthefollowingexample,thecurrentscanstateisStoppedandtheonlyactionyoucanperformisStart
thescan.
Example 11-18. Get scan status
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/scanstatus

Response:
<DlpScanStatus>
<currentScanState>STOPPED</currentScanState>
<nextScanOps><ScanOp>START</ScanOp></nextScanOps>
<vmsInProgress>0</vmsInProgress>
<vmsCompleted>0</vmsCompleted>
</DlpScanStatus>

Querying Scan Results


Youcanretrievedetailedresultsofthecurrentdatasecurityscanaswellassummaryresultsfortheprevious
fivescans.

Get List of Virtual Machines Being Scanned


Youcanretrieveinformationaboutthevirtualmachinesbeingscannedbyascan.
Example 11-19. Get list of virtual machines being scanned
Request:

VMware, Inc.

319

vShield API Programming Guide

GET https://<nsxmgr-ip>/api/2.0/dlp/scan/current/vms/<id>
?scanstatus=COMPLETED&pagesize=10&startindex=1

Response:
<?xml version="1.0" encoding="UTF-8"?>
<VmScanStatusDp>
<dataPage>
<pagingInfo>
<pageSize>10</pageSize>
<startIndex>1</startIndex>
<totalCount>2</totalCount>
<sortOrderAscending>false</sortOrderAscending>
</pagingInfo>
<VmScanStatus>
<startTime>1320803585000</startTime>
<endTime>1320803826000</endTime>
<vmMoId>vm-25</vmMoId>
<scanStatus>COMPLETED</scanStatus>
<violationCount>8</violationCount>
<vmName>jim-win2k8-32-mux</vmName>
<dcName>jack</dcName>
</VmScanStatus>
</dataPage>
</VmScanStatusDp>

Where

idisanoptionalparameterwhichlimitsthefilterresultsbytheVCMOIDofadatacenter,cluster,or
resourcepool.

scanstatusspecifiesthescanstatusofthevirtualmachinestoberetrieved.Possiblevaluesareall,notstarted,
started,andcompleted.Thislimitstheresultstovirtualmachinesthathavethespecifiedscanstate.

pagesizelimitsthemaximumnumberofentriesreturnedbytheAPI.Thedefaultvalueforthisparameter
is256andthevalidrangeis11024.

startindexspecifiesthestartingpointforretrievingthelogs.Ifthisparameterisnotspecified,logsare
retrievedfromthebeginning.

Get Number of Virtual Machines Being Scanned


Youcanretrievethenumberofvirtualmachinesbeingscanned.
Example 11-20. Get number of virtual machines being scanned
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/scan/current/vms/count/<id>?scanstatus=COMPLETED

Where

scanstatusisanoptionalparameterthatspecifiesthescanstatusofthevirtualmachinestoberetrieved.
Possiblevaluesareall,notstarted,started,andcompleted.Thislimitstheresultstovirtualmachinesthathave
thespecifiedscanstate.

idisanoptionalparameterwhichlimitsthefilterresultsbytheVCMOIDofadatacenter,cluster,or
resourcepool.

Get Summary Information about the Last Five Scans


Youcanretrievethestartandendtime,totalnumberofvirtualmachinesscanned,andtotalnumberof
violationsforthelastfivecompleteddatasecurityscans.

320

VMware, Inc.

Chapter 11 Data Security Configuration

Example 11-21. Get summary information about last five scans


Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/completedscansummaries

Response:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<CompletedScanSummary>
<globalScanId>5</globalScanId>
<startTime class="sql-timestamp">2011-11-09 17:02:48.0</startTime>
<endTime class="sql-timestamp">2011-11-09 17:02:55.0</endTime>
<totalVmsScannedCount>0</totalVmsScannedCount>
<totalViolationCount>0</totalViolationCount>
</CompletedScanSummary>
</list>

Scan ID

Get Information for Virtual Machines Scanned During Previous Scan


Youcanretrievethefollowinginformationaboutthevirtualmachinesscannedduringthepreviousdata
securityscan:

ID

Name

Scanstatus

Violationcount

Example 11-22. Get Information for virtual machines scanned during last scan
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/scan/<scan_ID>/detailsascsv

Retrieve Information About Previous Scan Results


YoucanretrieveadetailedreportabouttheresultsofthepreviousscaninaCSVformat.
Example 11-23. Retrieves Information for virtual machines scanned during last scan
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/scan/<scan_ID>/violatingfilesascsv

Get XML Representation of Policy Used for Previous Scan


YoucanretrievetheXML representation of the policyusedinthepreviousscan.
Example 11-24. Get XML representation of policy used in previous scan
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/scan/<scan_ID>/policyasxml

Response:
<DlpPolicy>
<objectId>dlppolicy-2</objectId>
<type>
<typeName>DlpPolicy</typeName>
VMware, Inc.

321

vShield API Programming Guide

</type>
<name>Published Policy</name>
<revision>2</revision>
<objectTypeName>DlpPolicy</objectTypeName>
<regulations/>
<regulationsChanged>false</regulationsChanged>
<excludedAreas/>
<excludedAreasChanged>false</excludedAreasChanged>
<excludedSecurityGroups>
<basicinfo>
<objectId>securitygroup-1</objectId>
<type>
<typeName>SecurityGroup</typeName>
</type>
<name>included</name>
<revision>2</revision>
<objectTypeName>SecurityGroup</objectTypeName>
<scope>
<id>datacenter-2</id>
<objectTypeName>Datacenter</objectTypeName>
<name>jkiryakoza</name>
</scope>
</basicinfo>
</excludedSecurityGroups>
<excludedSecurityGroupsChanged>false</excludedSecurityGroupsChanged>
<includedSecurityGroups>
<basicinfo>
<objectId>securitygroup-1</objectId>
<type reference="../../../excludedSecurityGroups/basicinfo/type"/>
<name>included</name>
<revision>2</revision>
<objectTypeName>SecurityGroup</objectTypeName>
<scope>
<id>datacenter-2</id>
<objectTypeName>Datacenter</objectTypeName>
<name>jkiryakoza</name>
</scope>
</basicinfo>
</includedSecurityGroups>
<includedSecurityGroupsChanged>false</includedSecurityGroupsChanged>
<fileFilters>
<scanAllFiles>false</scanAllFiles>
<sizeLessThanBytes>0</sizeLessThanBytes>
<extensionsIncluded>true</extensionsIncluded>
<extensions>doc,docm,docx,dot,dotx,dotm,wri,xla,xlam,xls,xlt,xltx,xltm,xlsx,xlsb,xlsm,ppt,pptx,pptm,pot,potx,potm,ppsx,ppsm,mdb,
mpp,pdf,txt,log,csv,htm,html,xml,text,rtf,svg,ps,gs,vis,msg,rfc822,pm,swf,dgn,jpg,CATAnalysis,CATDrawing,C
ATFCT,CATMaterial,CATPart,CATProcess,CATProduct,CATShape,CATSWL,CATSystem,3DXML,7z,cab,emx,
gz,hqx,jar,lha,lzh,rar,tar,uue,z,zip,eml,mail,cal,cont,task,note,jrnl,pst</extensions>
</fileFilters>
<fileFiltersChanged>false</fileFiltersChanged>
<classificationValues>
<ClassificationValue>
<id>33</id>
<classification>
<id>90</id>
<name>Custom Accounts</name>
<providerName>Custom Accounts</providerName>
<description>Custom Accounts</description>
<customizable>true</customizable>
</classification>
</ClassificationValue>
<ClassificationValue>
...
<classificationValuesChanged>false</classificationValuesChanged>
<lastUpdatedOn class="sql-timestamp">2011-11-09 16:59:01.0</lastUpdatedOn>
<lastUpdatedBy>dlp</lastUpdatedBy>

322

VMware, Inc.

Chapter 11 Data Security Configuration

</DlpPolicy>

Querying Violation Details


Onceyoustartadatasecurityscan,NSXreportstheregulationsthatarebeingviolatedbythefilesinyour
inventory,andtheviolatingfiles.Ifyoufixaviolatingfile(bydeletingthesensitiveinformationfromthefile,
deletingorencryptingthefile,oreditingthepolicy),thefilewillcontinuetobedisplayedintheViolatingfiles
sectionuntilthecurrentscancompletes,andanewscanstartsandcompletes.
YoumustbeaSecurityAdministratororAuditortoviewreports.

Get List of Violation Counts


Youcanviewareportthatdisplaystheviolatedregulationswiththenumberofviolationsforeachregulation.
TheviolatingfilesreportrequiresfilteringbynodeID.
Example 11-25. Get violation count for entire inventory
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/violations/

Example 11-26. Get violation count for specific resource


Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/violations/<context_ID>

ResponseBody
<list>
<Violations>
<scope>
<objectId>group-d1</objectId>
<type>
<typeName>Folder</typeName>
</type>
<name>Datacenters</name>
<revision>1</revision>
<objectTypeName>Folder</objectTypeName>
</scope>
<regulation>
<id>100</id>
<name>California AB-1298</name>
<description>Identifies documents and transmissions that contain protected health information (ePHI) and personally
identifiable information (PII) as regulated by California AB-1298 (Civil Code 56, 1785 and
1798). California residents medical and health insurance information, when combined with
personally identifiable information must be protected from unauthorized access, destruction, use,
modification, or disclosure. Any business that operates in California and owns or licenses
computerized ePHI and PII data for California residents, regardless of the physical location of
the business, is required to comply with this law. This policy detects US Social Security
Numbers, credit card numbers, California drivers license numbers, US National Provider
Numbers, group insurance numbers, health plan beneficiary numbers, medical record numbers,
patient identifiers, birth and death certificates and Healthcare Dictionaries.
</description>
<classifications>
<Classification>
<id>76</id>
<name>Health Plan Beneficiary Numbers</name>
<providerName>Health Plan Beneficiary Numbers</providerName>
<description>Health Plan Beneficiary Numbers</description> <customizable>true</customizable>
</Classification>
...
<regions>

VMware, Inc.

323

vShield API Programming Guide

<string>NA</string>
</regions>
<categories>
<string>PHI</string>
<string>PCI</string>
<string>PII</string>
</categories>
</regulation>
<violationCount>1</violationCount>
</Violations>
<Violations>
</list>

Wherecontext_ID istheMOIDofadatacenter,cluster,folder,resourcepool,orvirtualmachine.

Get List of Violating Files


Youcanviewareportthatdisplaystheviolatingfilesandtheregulationseachfileviolated.ThisAPIrequires
filteringbycontextnodeID,andreturnsaformattedXMLreportshowingviolatingfiles.
Example 11-27. Get violating files for entire inventory
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/violatingfiles?pagesize=<i>&startindex=<j>

Where:

pagesizeisthenumberofresultstoview.

startindexisthepagenumberfromwhichtheresultsshouldbedisplayed.

Example 11-28. Get violating files for a resource


Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/violatingfiles/<context_ID>?pagesize=<i>&startindex=<j>

ResponseBody:
<ViolatingFiles>
<dataPage>
<pagingInfo>
<pageSize>10</pageSize>
<startIndex>0</startIndex>
<totalCount>1</totalCount>
<sortOrderAscending>false</sortOrderAscending>
</pagingInfo>
<ViolatingFile>
<identifier>59</identifier>
<revision>0</revision>
<fileName>C:\TruePositives\SocialSecurityNumbersTP1.05.txt</fileName>
<fileExtension />
<fileLastModifiedTime class="sql-timestamp">2011-02-01 15:02:00.0</fileLastModifiedTime>
<vm>
<name>jim-xp32-dlp1</name>
<revision>0</revision>
</vm>
<cluster>
<name>JimCluster</name>
<revision>0</revision>
</cluster> \
<dataCenter>
<name>jkiryakoza</name>
<revision>0</revision>
</dataCenter>

324

VMware, Inc.

Chapter 11 Data Security Configuration

<violations>
<ViolationInfo>
<identifier>99</identifier>
<revision>0</revision>
<regulation>
<objectId>152</objectId>
<name>California SB-1386</name>
<description>Identifies documents and transmissions that contain personally identifiable information
(PII) as regulated by California SB-1386 (Civil Code 1798). Businesses that
own or license computerized PII about California residents are required to
maintain security procedures and practices to protect it from unauthorized
access, destruction, use, modification, or disclosure. Any business that operates
in California and owns or licenses computerized PII data for California
residents, regardless of the physical location of the business, is required to
comply with this law. This policy detects US Social Security numbers, credit
card numbers and California drivers license numbers. This regulation has been
amended to protect health and medical information that can be found in
California AB-1298. </description>
<revision>0</revision> </regulation>
<firstViolationReportedTime class="sql-timestamp">2012-01-26
12:56:42.0</firstViolationReportedTime>
<lastViolationReportedTime class="sql-timestamp">2012-01-26
12:56:42.0</lastViolationReportedTime>
<cumulativeViolationCount>1</cumulativeViolationCount>
<violationCount>0</violationCount>
</ViolationInfo>
</violations>
</ViolatingFile>
</dataPage>
</ViolatingFiles>

Where:

context_IDistheMOIDofadatacenter,cluster,folder,resourcepool,orvirtualmachine..

pagesizeisthenumberofresultstoview.

startindexisthepagenumberfromwhichtheresultsshouldbedisplayed.

Get List of Violating Files in CSV Format


YoucanviewareportthatdisplaystheviolatingfilesandtheregulationseachfileviolatedinaCSVformat.
Example 11-29. Get list of violating files in CSV format
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/violatingfilesascsv

Get Violations in Entire Inventory


YoucanviewareportoftheviolatedregulationsandtheviolatingfilesfortheentireinventoryinCSV(comma
separatedvariable)format.
Example 11-30. Get list of violated regulations
Request:
GET https://<nsxmgr-ip>/api/2.0/dlp/violatingfilescsv/<context_ID>

Wherecontext_ID istheMOIDofadatacenter,cluster,folder,resourcepool,orvirtualmachine.

VMware, Inc.

325

vShield API Programming Guide

326

VMware, Inc.

12

Activity Monitoring

12

ActivityMonitoringprovidesvisibilityintoyourvirtualnetworktoensurethatsecuritypoliciesatyour
organizationarebeingenforcedcorrectly.
ASecuritypolicymaymandatewhoisallowedaccesstowhatapplications.TheCloudadministratorcan
generateActivityMonitoringreportstoseeiftheIPbasedfirewallrulethattheysetisdoingtheintended
work.Byprovidinguserandapplicationleveldetail,ActivityMonitoringtranslateshighlevelsecuritypolicies
tolowlevelIPaddressandnetworkbasedimplementation.
OnceyouenabledatacollectionforActivityMonitoring,youcanrunreportstoviewinboundtraffic(suchas
virtualmachinesbeingaccessedbyusers)aswellasoutboundtraffic(resourceutilization,interactionbetween
inventorycontainers,andADgroupsthataccessedaserver).
Thechapterincludesthefollowingtopics:

DataCollectiononpage 327

QueryResourcesonpage 330

QueryUserDetailsonpage 333

QueryDiscoveredUserDetailsonpage 337

WorkingwithDomainsonpage 338

WorkingwithActivityMonitoringSyslogSupportonpage 341

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Data Collection
YoumustenabledatacollectionforoneormorevirtualmachinesonavCenterServerbeforerunningan
ActivityMonitoringreport.Beforerunningareport,ensurethattheenabledvirtualmachinesareactiveand
aregeneratingnetworktraffic.
YoushouldalsoregisterNSXManagerwiththeADDomainController.SeeWorkingwithDomainson
page 338.
NotethatonlyactiveconnectionsaretrackedbyActivityMonitoring.Virtualmachinetrafficblockedby
firewallrulesatthevNIClevelisnotreflectedinreports.
Incaseofanemergencysuchasanetworkoverload,youcanturnoffdatacollectionatagloballevel.This
overridesallotherdatacollectionsettings.
SomeAPIcallsmayrequiretheVMID,whichistheMOIDoftheguestvirtualmachine.Youcanretrievethis
byqueyingthevCentermobstructure(https:<vcip>/mob).TheVMIDislistedunderhoststructure.

VMware, Inc.

327

vShield API Programming Guide

Enable Data Collection on a Single Virtual Machine


YoumustenabledatacollectionatleastfiveminutesbeforerunninganActivityMonitoringreport.
Example 12-1. Enable data collection on a virtual machine
Request:
POST https://<nsxmgr_ip>/api/1.0/eventcontrol/vm/<vmID>/request

RequestBody:
<perVmConfig>
<actions>
<action>
<type>per_vm_config</type>
<value>enabled</value>
</action>
</actions>
</perVmConfig>

Disable Data Collection on a Single Virtual Machine


Example 12-2. Disable data collection on a virtual machine
Request:
POST https://<nsxmgr_ip>/api/1.0/eventcontrol/vm/<vmID>/request

RequestBody:
<perVmConfig>
<actions>
<action>
<type>per_vm_config</type>
<value>disabled</value>
</action>
</actions>
</perVmConfig>

Override Data Collection


Incaseofanemergencysuchasanetworkoverload,youcanturnoffdatacollectionatagloballevel(jill
switch).Thisoverridesallotherdatacollectionsettings.

Turn On Kill Switch


Example 12-3. Turn on kill switch
Request:
POST https://<nsxmgr_ip>/api/1.0/eventcontrol/eventcontrol-root/request

RequestBody:
<request>
<actions>
<action>
<type>global_switch</type>
<value>disabled</value>
</action>
</actions>
</request>

328

VMware, Inc.

Chapter 12 Activity Monitoring

Turn Off Kill Switch


Example 12-4. Turn off kill switch
Request:
POST https://<nsxmgr_ip>/api/1.0/eventcontrol/eventcontrol-root/request

RequestBody:
<request>
<actions>
<action>
<type>global_switch</type>
<value>enabled</value>
</action>
</actions>
</request>

Query Per Virtual Machine Data Collection


Whenreportingpervirtualmachineconfiguration,currentkillswitchstatusisalsoreportedtoo.Theeffective
configurationofavirtualmachineisdeterminedbybothkillswitchconfigandpervirtualmachine
configuration.Ifkillswitchison,eventcollectioniseffectivelydisabledregardlessofwhatitspervirtual
machineconfigurationis;ifkillswitchisoff,pervirtualmachineconfigurationdetermineswhetherevent
collectionshouldbeperformedforthisvirtualmachine.
Example 12-5. Retrieve per virtual machine configuration when kill switch is on and when per virtual machine
configuration is enabled for specified virtual machine
Request:
GET https://<nsxmgr_ip>/api/1.0/eventcontrol/eventcontrol/config/vm/<vm-id>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<perVmConfig>
<actions>
<action>
<type>global_switch</type>
<value>disabled</value>
</action>
<action>
<type>per_vm_config</type>
<value>enabled</value>
</action>
</actions>
</perVmConfig>

Example 12-6. Retrieve per virtual machine configuration when kill switch is off and when per virtualmachine
configuration is enabled for specified virtual machine
Request:
GET https://<nsxmgr_ip>/api/1.0/eventcontrol/eventcontrol/config/vm/<vm-id>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<perVmConfig>
<actions>
<action>
<type>global_switch</type>
<value>enabled</value>

VMware, Inc.

329

vShield API Programming Guide

</action>
<action>
<type>per_vm_config</type>
<value>enabled</value>
</action>
</actions>
</perVmConfig>

Query Resources
Thismethodallowyoutogettheaggregateduseractivity(actionrecords)forthegivensetofparameters.The
sameAPIisusedforallreports.

Prerequisites

vShield Endpoint must be installed in your environment. See NSX Installation and Upgrade Guide.

NSX Manager must be registered with Active Directory.

Data collection must be enabled on one or more virtual machines.

Table 12-1. Parameters for GET https://<nsxmgr-ip>/api/3.0/ai/records


Parameter
Name

Description

Mandatory?

Valid Values

Default Value

Example

query

Nameofreport

Yes

resource,adg,containers,
sam,vma

query=resource

None

interval

Relativetimeto
currenttime

Yes

numberfollowedbyeither
ofm,h,d,ors

interval=60m,
interval=1h

60m

stime

Starttimeforquery

No.Intervalis
usedifstimeand
etimearenot
specified.

yyyymmddTh24:mi:ss

stime=20120228T21:00
:00

None

etime

Endtimeforquery

No.Intervalis
usedifstimeand
etimearenot
specified.

yyyymmddTh24:mi:ss

etime=20120229T21:00
:00

None

param

Parametertobe
appliedtoquery

Dependson
query

format,
<paramname>:<paramtyp
e>:<commaseparatedvalu
es>:<operator>

param:src:SECURITY_
GROUP:1:INCLUDE

None

pagesize

Numberofrecordsto
beretrieved

No

Anynumber
(recommendedisbetween
1002000)

pagesize=1000

1024

startindex

Startrecordnumber
(usedforpagination)

No

numberforthenextpage
youwanttoretrieve

startindex=100

View Outbound Activity


Youcanviewwhatapplicationsarebeingrunbyasecuritygroupordesktoppoolandthendrilldowninto
thereporttofindoutwhichclientapplicationsaremakingoutboundconnectionsbyaparticulargroupof
users.Youcanalsodiscoverallusergroupsanduserswhoareaccessingaparticularapplication,whichcan
helpyoudetermineifyouneedtoadjustidentityfirewallinyourenvironment.

Parameter Values

330

query=resource

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

VMware, Inc.

Chapter 12 Activity Monitoring

possiblevaluesforresourcequerytype,

<paramname>

src

dest

app

requiredparameters=src,dest

<paramtype>

forsrcSECURITY_GROUP,DIRECTORY_GROUP,DESKTOP_POOL

fordestVIRTUAL_MACHINE

forappSRC_APP

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

<operator>INCLUDE,EXCLUDE(defaultisINCLUDE)

Example 12-7. View user activities to VM id 1 originating from application id 1


Request:
GET
https://<nsxmgr_ip>/api/3.0/ai/records?query=resource&interval=60m&param=src:DIRECTORY_GROUP&par
am=dest:VIRTUAL_MACHINE:1&param=app:SRC_APP:1

View Inbound Activity


You can view all inbound activity to a server by desktop pool, security group, or AD group.

Parameter Values

query=sam

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

<paramname>

src

dest

app

requiredparameters=src,dest

<paramtype>

forsrcSECURITY_GROUP,DIRECTORY_GROUP,DESKTOP_POOL

fordestVIRTUAL_MACHINE

forappDEST_APP

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

<operator>INCLUDE,EXCLUDE,NOT(defaultisINCLUDE)

Example 12-8. View user activities to VM id 1 originating from application id 1


Request:

VMware, Inc.

331

vShield API Programming Guide

GET https://<nsxmgr_ip>/api/3.0/ai/records?query=containers&interval=60m&
param=dest:SECURITY_GROUP:1:EXCLUDE&param=src:SECURITY_GROUP:1

View Interaction between Inventory Containers


YoucanviewthetrafficpassingbetweendefinedcontainerssuchasADgroups,securitygroupsand/or
desktoppools.Thiscanhelpyouidentifyandconfigureaccesstosharedservicesandtoresolvemisconfigured
relationshipsbetweenInventorycontainerdefinitions,desktoppoolsandADgroups.

Parameter Values

query=containers

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

<paramname>

src

dest

requiredparameters=src,dest

<paramtype>

forsrcSECURITY_GROUP,DIRECTORY_GROUP,DESKTOP_POOL

fordestSECURITY_GROUP,DESKTOP_POOL

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

<operator>INCLUDE,EXCLUDE,NOT(defaultisINCLUDE)

Example 12-9. View interaction between inventory containers


Request:
GET https://<nsxmgr_ip>/api/3.0/ai/records?query=containers&interval=60m&
param=dest:SECURITY_GROUP:1:EXCLUDE&param=src:SECURITY_GROUP:1

View Outbound AD Group Activity


YoucanviewthetrafficbetweenmembersofdefinedActiveDirectorygroupsandcanusethisdatatofine
tuneyourfirewallrules.

Parameter Values

query=adg

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

<paramname>
src

adg

requiredparameters=src

<paramtype>

332

srcSECURITY_GROUP,DESKTOP_POOL

adgUSER

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

VMware, Inc.

Chapter 12 Activity Monitoring

<operator>INCLUDE,EXCLUDE(defaultisINCLUDE)

Example 12-10. View interaction between inventory containers


Request:
GET https://<nsxmgr_ip>/api/3.0/ai/records?query=adg&interval=24h&
param=adg:USER:1:INCLUDE&param=src:SECURITY_GROUP:1:EXCLUDE

Query User Details


Thismethodallowsyoutoretrieveuserdetailrecordsforthegivensetofparameters.

Table 12-2. Parameters for GET https://<nsxmgr-ip>/api/3.0/ai/userdetails


Paramete
r Name

Description

Mandatory?

Valid Values

Default Value

Example

query

Nameofreport

Yes

resource,adg,contain
ers,sam,vma

query=resource

None

interval

Relativetimeto
currenttime

Yes

numberfollowedby
eitherofm,h,d,ors

interval=60m,interval=1h

60m

stime

Starttimeforquery

No.Intervalisusedif
stimeandetimeare
notspecified.

yyyymmddTh24:mi
:ss

stime=20120228T21:00:00

None

etime

Endtimeforquery

No.Intervalisusedif
stimeandetimeare
notspecified.

yyyymmddTh24:mi
:ss

etime=20120229T21:00:00

None

param

Parametertobe
appliedtoquery

Dependsonquery

format,
<paramname>:<para
mtype>:<commasep
aratedvalues>:<oper
ator>

param:src:SECURITY_GRO
UP:1:INCLUDE

None

pagesize

Numberofrecordsto
beretrieved

No

Anynumber
(recommendedis
between1002000)

pagesize=1000

1024

startindex

Startrecordnumber
(usedforpagination)

No

numberforthenext
pageyouwantto
retrieve

startindex=100

View Outbound Activity


Youcanviewwhatapplicationsarebeingrunbyasecuritygroupordesktoppoolandthendrilldowninto
thereporttofindoutwhichclientapplicationsaremakingoutboundconnectionsbyaparticulargroupof
users.Youcanalsodiscoverallusergroupsanduserswhoareaccessingaparticularapplication,whichcan
helpyoudetermineifyouneedtoadjustidentityfirewallinyourenvironment.

Parameter Values

query=resource

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

possiblevaluesforresourcequerytype,

<paramname>

VMware, Inc.

src

dest

333

vShield API Programming Guide

requiredparameters=src,dest

<paramtype>

forsrcSECURITY_GROUP,DIRECTORY_GROUP,DESKTOP_POOL

fordestIP(thishastobeavalidIPaddressinthedotnotation,xx.xx.xx.xx)

forappSRC_APP

<operator>INCLUDE,EXCLUDE(defaultisINCLUDE)

Example 12-11. View user activities to VM id1 originating from application id1
Request:
GET
https://<nsxmgr_ip>/api/3.0/ai/userdetails?query=resource&stime=2012-10-15T00:00:00&etime=2012-10-20T0
0:00:00&param=src:DIRECTORY_GROUP:2&param=app:SRC_APP:16&param=dest:IP:172.16.4.52

View Inbound Activity


You can view all inbound activity to a server by desktop pool, security group, or AD group.

Parameter Values

query=sam

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

<paramname>

src

dest

app

requiredparameters=src,dest,app

<paramtype>

forsrcSECURITY_GROUP,DIRECTORY_GROUP,DESKTOP_POOL

fordestVIRTUAL_MACHINE

forappDEST_APP

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

<operator>INCLUDE,EXCLUDE,NOT(defaultisINCLUDE)

Example 12-12. View user activities to VM id 1 originating from application id 1


Request:
GET
https://<nsxmgr_ip>/api/3.0//userdetails?query=sam&interval=60m&param=app:DEST_APP:1:EXCLUDE&par
am=dest:IP:1:EXCLUDE&param=src:SECURITY_GROUP:1:EXCLUDE

View Interaction between Inventory Containers


YoucanviewthetrafficpassingbetweendefinedconatinerssuchasADgroups,securitygroupsand/or
desktoppools.Thiscanhelpyouidentifyandconfigureaccesstosharedservicesandtoresolvemisconfigured
relationshipsbetweenInventorycontainerdefinitions,desktoppoolsandADgroups.

334

VMware, Inc.

Chapter 12 Activity Monitoring

Parameter Values

query=containers

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

<paramname>

src

dest

requiredparameters=src,dest

<paramtype>

forsrcSECURITY_GROUP,DIRECTORY_GROUP,DESKTOP_POOL

fordestSECURITY_GROUP,DESKTOP_POOL

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

<operator>INCLUDE,EXCLUDE,NOT(defaultisINCLUDE)

Example 12-13. View interaction between inventory containers


Request:
GET
https://<nsxmgr_ip>/api/3.0/ai/userdetails?query=containers&interval=60m&param=dest:SECURITY_GROUP:
1:EXCLUDE&param=src:SECURITY_GROUP:1

View Outbound AD Group Activity


YoucanviewthetrafficbetweenmembersofdefinedActiveDirectorygroupsandcanusethisdatatofine
tuneyourfirewallrules.

Parameter Values

query=adg

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

<paramname>

src

adg

requiredparameters=src

<paramtype>

srcSECURITY_GROUP,DESKTOP_POOL

adgUSER

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

<operator>INCLUDE,EXCLUDE(defaultisINCLUDE)

Example 12-14. View interaction between inventory containers


Request:
GET
https://<nsxmgr_ip>/api/3.0/ai/userdetails?query=adg&interval=24h&param=adg:USER:1:INCLUDE&param=sr
c:SECURITY_GROUP:1:EXCLUDE

VMware, Inc.

335

vShield API Programming Guide

View Virtual Machine Activity Report


Youcanviewtraffictoorfromavirtualmachineorasetofvirtualmachinesinyourenvironment.

Parameter Values

query=vma

param=<paramname>:<paramtype>:<commaseparatedvalues>:<operator>

<paramname>

src(foroutboundtraffic)

dest(forinboundtraffic)

appSRC_APP,DEST_APP

requiredparameters=none(ifnoparameterpassedthenthiswouldshowallSAMactivities)

<paramtype>

srcSECURITY_GROUP,DESKTOP_POOL

destVIRTUAL_MACHINE,VM_UUID

adgUSER

ParameterValuescommaseparatednumbers(optional).Ifnonespecifiedthennofilterisapplied.

<operator>INCLUDE,EXCLUDE(defaultisINCLUDE)

Example 12-15. View inbound vm activities to a VM id1 for a specific service used (app=16)
Request:
GET
https://<nsxmgr_ip>/api/3.0/ai/userdetails?query=vma&interval=60m&param=dest:VIRTUAL_MACHINE:1&p
aram=app:DEST_APP:16

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<DataPage>
<pagingInfo>
<pageSize>1024</pageSize>
<startIndex>0</startIndex>
<totalCount>5</totalCount>
<sortOrderAscending>false</sortOrderAscending>
</pagingInfo>
<aiActionRecord>
<application>JABBER</application>
<connectionCount>3</connectionCount>
<destHost>PMI-BL-X61$</destHost>
<destIP>172.16.4.21</destIP>
<id>0</id>
<srcContainer>HOKUIFLVPC</srcContainer>
</aiActionRecord>
<aiActionRecord>
<application>SLP</application>
<connectionCount>2</connectionCount>
<destHost>ENGG-LAPTOP-002$</destHost>
<destIP>172.16.4.48</destIP>
<id>0</id>
<srcContainer>HOKUIFLVPC</srcContainer>
</aiActionRecord>
<aiActionRecord>
<application>KEYSERV</application>
<connectionCount>1</connectionCount>
<destHost>PMI00ELTON03$</destHost>
<destIP>172.16.1.12</destIP>

336

VMware, Inc.

Chapter 12 Activity Monitoring

<id>0</id>
<srcContainer>HOKUIFLVPC</srcContainer>
</aiActionRecord>
<aiActionRecord>
<application>ACCOUNT_MGMT</application>
<connectionCount>1</connectionCount>
<destHost>PMIFEEXCH01$</destHost>
<destIP>172.16.4.70</destIP>
<id>0</id>
<srcContainer>HOKUIFLVPC</srcContainer>
</aiActionRecord>
<aiActionRecord>
<application>PNA</application>
<connectionCount>3</connectionCount>
<destHost>IDC-DEV-1$</destHost>
<destIP>10.0.200.92</destIP>
<id>0</id>
<srcContainer>HOKUIFLVPC</srcContainer>
</aiActionRecord>
</DataPage>

Query Discovered User Details


Thismethodretrievesthelistofalldiscoveredusers(bothbyagentintrospectionandLDAPSync)andtheir
detail.
Example 12-16. Retrieve user details
Retrieveuserdetailsforaspecificuser:
GET https://<nsxmgr_ip>/api/3.0/ai/user/<userID>

Retrieveappdetails:
GET https://<nsxmgr_ip>/api/3.0/ai/app

Retrieveapplicationdetailsforaspecificapplication:
GET https://<nsxmgr_ip>/api/3.0/ai/app/<appID>

Retrievelistofalldiscoveredhosts(bothbyagentintrospectionandLDAPSync)andtheirdetail:
GET https://<nsxmgr_ip>/api/3.0/ai/host

Retrievehostdetails:
GET https://<nsxmgr_ip>/api/3.0/ai/host/<hostID>

Retrievelistofalldiscovereddesktoppoolsbyagentintrospection:
GET https://<nsxmgr_ip>/api/3.0/ai/desktoppool

Retrievedetailsspecificdesktoppool:
GET https://<nsxmgr_ip>/api/3.0/ai/desktoppool/<desktoppoolID>

Retrievelistofalldiscoveredvirtualmachines:
GET https://<nsxmgr_ip>/api/3.0/ai/vm

Retrievedetailsaboutaspecificvirtualmachine:
GET https://<nsxmgr_ip>/api/3.0/ai/vm/<vmID>

Retrievelistofallthediscovered(andconfigured)LDAPdirectorygroups:
GET https://<nsxmgr_ip>/api/3.0/ai/directorygroup

Retrievedetailsaboutaspecificdirectorygroups:
GET https://<nsxmgr_ip>/api/3.0/ai/directorygroup/<directorygroupID>

VMware, Inc.

337

vShield API Programming Guide

RetrievelistofADgroupsauserbelongsto:
GET https://<nsxmgr_ip>/api/3.0/ai/directorygroup/user/<userID>

Retrievelistofalltheobservedsecuritygroups.Observedentitiesaretheonesthatarereportedbytheagents.
Forex,ifahostactivityisreportedbyanagentandifthathostbelongstoasecuritygroupthenthatsecurity
groupwouldreportedasobservedinSAMdatabase:
GET https://<nsxmgr_ip>/api/3.0/ai/securitygroup

Retrievedetailsaboutspecificsecuritygroup:
GET https://<nsxmgr_ip>/api/3.0/ai/securitygroup/<securitygroupID>

Working with Domains


Afteryoucreateadomain,youcanapplyasecuritypolicytoitandrunqueriestoviewtheapplicationsand
virtualmachinesbeingaccessedbytheusersofadomain.

Register a Domain with NSX Manager


YoucanaregisteroneormoreWindowsdomainswithanNSXManagerandassociatedvCenterserver.
NSXManagergetsgroupanduserinformationaswellastherelationshipbetweenthemfromeachdomain
thatitisregisteredwith.NSXManageralsoretrievesActiveDirectorycredentials.
YoucanapplysecuritypoliciesonanActiveDirectorydomainandrunqueriestogetinformationonvirtual
machinesandapplicationsaccessedbyuserswithinanActiveDirectorydomain.
Example 12-17. Register or update domain
Request:
POST https://<nsxmgr_ip>/api/3.0/directory/updateDomain

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<DirectoryDomain>
<name>vs4.net</name>
<type>ActiveDirectory</type>
<netbiosName>VS4</netbiosName>
<username>Administrator</username>
<password>xxx</password>
</DirectoryDomain>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<DirectoryDomain>
<id>2</id>
<name>vs4.net</name>
<type>ActiveDirectory</type>
<netbiosName>VS4</netbiosName>
<username>Administrator</username>
<baseDn>DC=vs4,DC=net</baseDn>
</DirectoryDomain>

338

VMware, Inc.

Chapter 12 Activity Monitoring

Parameter Values for Register/Update Domain

Parameter Name

Description

Mandatory?

ID

Domainid.
Ifyouwanttocreateanewdomain,donotprovidethisvalue.Otherwise,systemwillfindan
existingdomainobjectbythisIDandupdateit.

true if
update
existing
domain

name

Domainname.
Thisshouldbedomainsfullqualifiedname.Incaseagentdiscovered,thiswillbeNetBIOS
name,soyouneedtoupdateittoFQNinordertosupportLDAPsyncandeventlogreader.

trueifcreatinga
newdomain

description

Domaindescription

false

type

Domaintype.
Validvalueinclude:AGENT_DISCOVERED,ActiveDirectory,SPECIAL
DoNOTmodifySPECIALdomain(wewillputguardlater).ForLDAPsyncandeventlog
readerwork,thisneedtobesenttoActiveDirectory.

trueifcreatinga
newdomain

netbiosName

NetBIOSnameofdomain.
ThisisDomainsNetBIOSname.Checkwindowsdomainsetting,forvalueofit.Normally
AgentreportdomainnameisNetBIOSname.ButconfirmfromWindowsdomainsetting.

false

baseDn

DomainsBaseDN(forLDAPsync).
BaseDNisREQUIREDforLDAPSync.Ifyouhaveadomainlike:w2k3.vshield.vmware.com,
thebaseDNisverylikelytobe:DC=w2k3,DC=vshield,DC=vmware,DC=com.Another
exampleis:domainnameis:vs4.net,thebaseDNshouldbe:DC=vs4,DC=net.Ifyoudont
knowwhatisthis,useaLDAPclientandconnecttodomaincontroller,thatwillgiveyou
domainsbaseDN.

false

rootDn

LDAPSyncrootDN.
SpecifywhereshouldLDAPsyncstartfromLDAPtree.Thiscouldbeabsolutepath,for
example:OU=Engineer,DC=vs4,DC=net,orrelativepath(relatetoBaseDN),forexample:
OU=Engineer.Dontusethiscolumninmostcases.

false

securityId

DomainsSecurityID(SID).
ThisshouldbefilledbyLDAPsyncprocess,justdontusethiscolumnunlessyouknowwhat
youaredoing.

false

username

DomainsUsername(UsedforLDAPSyncand/orEventLogreader)

false

password

Userpassword

false

eventLogUsernam
e

Domainseventlogreaderusername(willuseaboveusernameifthisisNULL)

false

eventLogPassword

Domainseventlogreaderpassword

false

Query Domains
Retrievesallagentdiscovered(orconfigured)LDAPdomains.
Example 12-18. Query domains
Request:
GET https://<nsxmgr_ip>/api/1.0/directory/listDomains

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<DirectoryDomains>
<DirectoryDomain>
<id>2</id>
<name>vs4.net</name>
<type>ActiveDirectory</type>
<netbiosName>VS4</netbiosName>
<username>Administrator</username>
<baseDn>DC=vs4,DC=net</baseDn>

VMware, Inc.

339

vShield API Programming Guide

</DirectoryDomain>
</DirectoryDomains>

Delete Domain
Deletesdomain.
Example 12-19. Delete domain
Request:
DELETE https://<nsxmgr_ip>/api/1.0/directory/deleteDomain/<Domain Id>

Working with LDAP Servers


Example 12-20. Create LDAP server
Request:
POST https://<nsxmgr_ip>/api/1.0/directory/updateLdapServer

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<LDAPServer>
<domainId>4</domainId>
<hostName>10.142.72.70</hostName>
<enabled>true</enabled>
</LDAPServer>

IftheResponseBodyisnot200 for OK,logintoyourNSXManagerandtrytopingthehostname.


Example 12-21. LDAP server calls
QueryLDAPserversforadomain:
GET https://<nsxmgr_ip>/api/1.0/directory/listLdapServersForDomain/<domain id>

StartLDAPfullsync:
PUT https://<nsxmgr_ip>/api/1.0/directory/fullSync/<domain id>

StartLDAPdeltasync:
PUT https://<nsxmgr_ip>/api/1.0/directory/deltaSync/<domain id>

DeleteLDAPserver:
DELETE https://<nsxmgr_ip>/api/1.0/directory/deleteLdapServer/<LdapServerID>

Working with EventLog Servers


Example 12-22. Create EventLog server
Request:
POST https://<nsxmgr_ip>/api/1.0/directory/updateEventLogServer

RequestBody:
<?xml version="1.0" encoding="UTF-8"?>
<EventlogServer>
<id>1</id>

340

VMware, Inc.

Chapter 12 Activity Monitoring

<domainId>4</domainId>
<hostName>10.142.72.70</hostName>
<enabled>false</enabled>
</EventlogServer>

Example 12-23. EventLog server calls


QueryEventLogserversforadomain:
GET https://<nsxmgr_ip>/api/1.0/directory/listEventLogServersForDomain/<EventLogServer id>

DeleteEventLogserver:
DELETE https://<nsxmgr_ip>/api/1.0/directory/deleteEventLogServer/<EventLogServerID>

Working with Mapping Lists


Example 12-24. Query mapping lists
Queryusertoipmappinglistfromdatabase:
GET https://<nsxmgr_ip>/api/1.0/identity/userIpMapping

Queryhosttoipmappinglistfromdatabase:
GET https://<nsxmgr_ip>/api/1.0/identity/hostIpMapping

QuerysetofusersassociatedwithagivensetofIPaddressesduringaspecifiedtimeperiod.Sincemorethan
oneusercanbeassociatedwithasingleIPaddressduringthespecifiedtimeperiod,eachIPaddresscanbe
associatedwithzeroormore(i.eaSETof)users:
GET https://<nsxmgr_ip>/api/1.0/identity/ipToUserMapping

QuerysetofWindowsDomainGroups(ADGroups)towhichthespecifieduserbelongs:
GET https://<nsxmgr_ip>/api/1.0/identity/directoryGroupsForUser

CreatestaticuserIPmapping:
POST https://<nsxmgr_ip>/api/1.0/identity/staticUserMapping/<userID>/<IP>

QuerystaticuserIPmappinglist:
GET https://<nsxmgr_ip>/api/1.0/identity/staticUserMappings

QuerystaticuserIPmappingforspecifieduser:
GET https://<nsxmgr_ip>/api/1.0/identity/staticUserMappingsbyUser/<userID>

QuerystaticuserIPmappingforspecifiedIP:
GET https://<nsxmgr_ip>/api/1.0/identity/staticUserMappingsbyIP/<userID>

DeletestaticuserIPmappingforspecifieduser:
DELETE https://<nsxmgr_ip>/api/1.0/identity/staticUserMappingsbyUser/<userID>

DeletestaticuserIPmappingforspecifiedIP:
DELETE https://<nsxmgr_ip>/api/1.0/identity/staticUserMappingsbyIP/<userID>

Working with Activity Monitoring Syslog Support


Example 12-25. Enable Activity Monitoring syslog support
Request:

VMware, Inc.

341

vShield API Programming Guide

POST https://<vsm_ip>/api/1.0/sam/syslog/enable

Example 12-26. Disable Activity Monitoring syslog support


Request:
POST https://<vsm_ip>/api/1.0/sam/syslog/disable

342

VMware, Inc.

13

Task Framework Management

13

TheNSXManagerrequirescommunicationwithyourvCenterServerandservicessuchasDNSandNTPto
providedetailsonyourVMwareInfrastructureinventory.
Thechapterincludesthefollowingtopics:

AboutTaskFrameworkonpage 343

QueryJobInstancesforJobIDonpage 344

QueryLatestJobInstancesforJobIDonpage 345

BlockRESTThreadonpage 345

QueryJobInstancesbyCriteriononpage 345

IMPORTANTAllRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25fordetails
aboutbasicauthorization.

About Task Framework


Thetaskframeworkprovidestheabstractionneededtoexecuteasynchronoustasksusingaglobalthreadpool.
AJobisidentifiedbyaJobID.Ajobhasasetoftaskswithinit.Thesetasksareexecutedeithersynchronously
orinparallelbasedontheirdependencieswithothertasksintheJob.TheJobistheprimaryinterfaceto
interactwiththeTaskFrameworktogetthedetailsofthejobandthetaskswithinit.Thiscouldbethestatus
ofthejob,thestatusofthetaskswithinit,etc.
WhenaJobisscheduledforexecution,itisputintoaqueuedstate.Thisistrueforajobthathastoexecute
immediatelyorajobthatisscheduledforlaterexecution.
Atthescheduledtimewhenthetaskrunsitisputintoexecutingstate.Oncethetaskfinishesitsexecution,it
isconsideredascompleted.Thetaskframeworkthenqueriesthetasktocheckiftheexecutionwassuccessful
ornot.Basedonthisstatus,thetaskismarkedascompletedorfailed.Ifthetaskissuccessful,thenexttaskin
theJobisexecuted.Ifthetaskfails,theappropriatefaultpolicyactionistaken.
Thefaultpolicyspecifiesthetypeofactiontobetakenasoneofthefollowing:

Retry:Frameworkattemptstoretrythetask.Jobdata/datapopulatedduringtheearlierrunissupplied
tothetaskbeforeexecution.

Rollback:Frameworkrollsbackthetask.

RollbackRetry:Frameworkrollsbackthetaskandretriesit.

Abort:Frameworkabortsthetask(andtheJob).

Ignore:Frameworkignoresthefailure/timeoutandproceedswithexecutionofsubsequenttasks,ifany,
inthejob.

VMware, Inc.

343

vShield API Programming Guide

Everytaskcandefineatimeoutvaluewhichindicatesthemaximumesitmatedtimeforthetasktocomplete.
Beyondthistime,thetaskisconsideredtohavetimedoutandanappropriatefaultpolicyactionistakenon
thetask.Thetaskframeworkmonitorstheexecutingtasksatperiodicintervalsoftimetocheckwhetherthey
havetimedout.Ifthefaultpolicyindicatesthataretryhastobedoneincaseofatimeout,thetaskframework
retriesthetask.

Query Job Instances for Job ID


RetrievesalljobinstancesforthespecifiedjobID.Ifajobisaonetimejob,asinglejobinstanceisreturned.If
ajobisarecurringjob,allinstancesforthegivenjobIDarereturned.
Example 13-1. Query job instances
RequestBody:
GET https://<nsxmgr-ip>/api/2.0/services/taskservice/job/<jobID>

ResponseBody:
<?xml version="1.0" encoding="UTF-8"?>
<jobInstances>
<jobInstance>
<id>jobinstance-1</id>
<name>SVM Updater</name>
<taskInstances>
<taskInstance>
<id>taskinstance-1</id>
<name>SVM Updater</name>
<startTimeMillis>1375867719752</startTimeMillis>
<endTimeMillis>1375867720025</endTimeMillis>
<taskStatus>COMPLETED</taskStatus>
<timeoutRetryCount>0</timeoutRetryCount>
<failureRetryCount>0</failureRetryCount>
<taskOutput />
<taskData />
</taskInstance>
</taskInstances>
<startTimeMillis>1375867719663</startTimeMillis>
<endTimeMillis>1375867720050</endTimeMillis>
<status>COMPLETED</status>
<timeoutRetryCount>0</timeoutRetryCount>
<failureRetryCount>0</failureRetryCount>
<job>
<id>jobdata-1</id>
<name>SVM Updater</name>
<description>Updating all sdd SVMs at startup.</description>
<creationTimeMillis>1375867718710</creationTimeMillis>
<nextExecutionTimeMillis>0</nextExecutionTimeMillis>
<taskList>
<task>
<id>task-1</id>
<name>SVM Updater</name>
<description>Updating all sdd SVMs at startup.
</description>
<failurePolicy>
<faultAction>RETRY</faultAction>
<retryLimit>30</retryLimit>
<retryInterval>60000</retryInterval>
</failurePolicy>
<timeoutPolicy>
<faultAction>IGNORE</faultAction>
<retryLimit>0</retryLimit>
<retryInterval>-1</retryInterval>
</timeoutPolicy>
<priority>5</priority>
<timeoutMillis>-1</timeoutMillis>
<visible>false</visible>

344

VMware, Inc.

Chapter 13 Task Framework Management

<systemTask>true</systemTask>
<taskClass>com.vmware.vshield.dlp.service.impl.DlpServiceImpl$1
</taskClass>
<creationTimeMillis>1375867718729
</creationTimeMillis>
<jobId>jobdata-1</jobId>
<nextExecutionTime>0</nextExecutionTime>
</task>
</taskList>
<jobOwner>Unknown</jobOwner>
<scope>/globalroot-0</scope>
</job>
<jobOutput />
</jobInstance>
</jobInstances>

Query Latest Job Instances for Job ID


Incaseofcronjobsorfixeddelayjobs,therecanbemultiplejobinstancesforthesamejobdependingupon
thenumberoftimesthejobwasexecuted.Thiscallfetchesthelatestjobinstanceforagivenjobid.
Example 13-2. Query job instances
RequestBody:
GET https://<nsxmgr-ip>/api/2.0/services/taskservice/job/<jobID>

ResponseBody:
SeeExample 131

Block REST Thread


ThisisablockingcallwhereaservicehasscheduledajobandaRESTthreadneedstobeblockedtillthejob
getscompleted.Ifthejobwasalreadycompleted,thenthejobinstanceisreturnedimmediately.Ifthejobis
stillexecutingthentheRESTthreadisblockedandreturnsafterthejobcompletes.
Example 13-3. Query job instances
RequestBody:
GET https://<nsxmgr-ip>/api/2.0/services/taskservice/job/<jobID>

ResponseBody:
SeeExample 131.

Query Job Instances by Criterion


Youcanspecifyfilteringcriteriaandpaginginformationandquerythetaskframework.
Example 13-4. Query job instances by criterion
RequestBody:
GET
https://<nsxmgr-ip>/api/2.0/services/taskservice/job/startIndex=<0>&pageSize=<10>&sortBy=startTime&sortOr
derAscending=false|true

ResponseBody:

VMware, Inc.

345

vShield API Programming Guide

SeeExample 131.

346

VMware, Inc.

14

Object IDs

14

ThissectiondescribeshowtoretrievetheIDsfortheobjectsinyourvirtualinventory.
Thechapterincludesthefollowingtopics:

QueryDatacenterMOIDonpage 347

QueryDatacenterIDonpage 347

QueryHostIDonpage 347authentication

QueryPortgroupIDonpage 348

QueryVMIDonpage 348

IMPORTANTAllNSXRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Query Datacenter MOID


1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

Clickcontent.

ClickontherootFoldervalue.

ClickonthechildEntityvalue.
ThedatacenterMOIDisdisplayedontopofthewindow.

Query Datacenter ID
1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

Clickcontent.

ClickontherootFoldervalue.

ClickonthechildEntityvalue.
ThedatacentervalueisthedatacenterID.

Query Host ID
1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

VMware, Inc.

347

vShield API Programming Guide

Clickcontent.

ClickontherootFoldervalue.

ClickonthechildEntityvalue.

Clickonthedatacentervalue.
Thehost valueisthehostID.

Query Portgroup ID
1

Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob

Clickcontent.

ClickontherootFoldervalue.

ClickonthechildEntityvalue.

Clickonthedatacentervalue.

Clickonthehost value.
ThenetworkpropertyvalueistheportgroupID.

Query VMID
Inawebbrowser,typethefollowing:
http://<vCenter-IP>/mob
TheVMIDislistedunderhoststructure.

348

VMware, Inc.

15

vShield Endpoint Management

15

UsingthesewithnewerNSX6.0basedsolutionscouldresultinlossoffeatures.
ThemanagementAPIlistedinthischapteraretobeusedonlywithvShieldPartnersolutionsthatweredevelopedwithEPSecPartnerProgram3.0orearlier(forvShield5.5orearlier).ThesepartnersolutionsarealsosupportedonNSX6.0andneedtheAPIslistedbelow.TheseAPIshouldnotbeusedwithpartnersolutionsdevelopedspecificallyforNSX6.0orlater,asthesenewersolutionsautomatetheregistrationanddeploymentprocessbyusingthenewfeaturesintroducedinNSX.

AvShieldEndpointappliancedeliversanintrospectionbasedantivirussolutionthatusesthehypervisorto
scanguestvirtualmachinesfromtheoutsidewithonlyathinagentoneachguestvirtualmachine.
Thischapterincludesthefollowingtopics:

OverviewofSolutionRegistrationonpage 349

RegisteringaSolutionwithvShieldEndpointServiceonpage 350

QueryingRegistrationStatusofvShieldEndpointonpage 351

QueryingActivatedSecurityVirtualMachinesforaSolutiononpage 352

UnregisteringaSolutionwithvShieldEndpointonpage 353

StatusCodesandErrorSchemaonpage 354

IMPORTANTAllvShieldRESTrequestsrequireauthentication.SeeUsingtheNSXRESTAPIonpage 25for
detailsaboutbasicauthorization.

Overview of Solution Registration


ToregisterathirdpartysolutionwithvShieldEndpoint,clientscanusefourRESTcallstodothefollowing:
1

Registerthevendor.

Registeroneormoresolutions.

SetthesolutionIPaddressandport(forallhosts).

Activateregisteredsolutionsperhost.

NOTESteps1through3needtobeperformedoncepersolution,whilestep4needstobeperformedforeach
host.
Tounregisterasolution,clientsessentiallyperformthesestepsinreverse:
5

Deactivatesolutionsperhost.

UnsetasolutionsIPaddressandport.

Unregistersolutions.

Unregisterthevendor.

Toupdateregistrationinformationforavendororsolution,clientsmustfirstunregisterthatentityandthen
reregister.ThefollowingsectionsdetailthespecificRESTcallstoperformregistrationandunregistration.

VMware, Inc.

349

vShield API Programming Guide

Registering a Solution with vShield Endpoint Service


TheAPIsdescribedinthissectionregisteravendor,solutions,setnetworkaddress,andactivatesolutions.
Foralistofreturnstatuscodes,seeReturnStatusCodesonpage 354.

Register a Vendor
Youcanregisterthevendorofanantivirussolution.
Example 15-1. Register a vendor
Request:
POST https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration

RequestBody:
<VendorInfo>
<id>vendor_id</id>
<title>vendor_title</title>
<description>vendor_description</description>
</VendorInfo>

Intherequestbody,vendor_idistheVMwareassignedIDforthevendor,whilevendor_titleand
vendor_descriptionarevendorprovidedstrings.

Register a Solution
Youcanregisteranantivirussolution.
Example 15-2. Register a solution
Request:
POST https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>

RequestBody:
<SolutionInfo>
<altitude>solution_altitude</altitude>
<title>solution_title</title>
<description>solution_description</description>
</SolutionInfo>

Intherequest,<vendor_id>isthepreviouslyregisteredIDforthevendor.
Intherequestbody,solution_altitudeistheVMwareassignedaltitudeforthesolution,solution_titleand
solution_descriptionarevendorprovidedstrings.SeeAltitudeofaSolutiononpage 350.

Altitude of a Solution
AltitudeisanumberthatVMwareassignstouniquelyidentifythesolution.Thealtitudedescribesthetypeof
solutionandtheorderinwhichthesolutionreceiveseventsrelativetoothersolutionsonthesamehost.

IP Address and Port for a Solution


YoucansetasolutionsIPaddressandportonthevNIChost.
Example 15-3. Set IP address and port
Request:
POST https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>/<altitude>/location

350

VMware, Inc.

Chapter 15 vShield Endpoint Management

RequestBody:
<LocationInfo>
<ip>solution_ip_address</ip>
<port>solution_port</port>
</LocationInfo>

Intherequest,<vendor_id>isthepreviouslyregisteredIDforthevendor,and<altitude>forthealtitude.
Intherequestbody,solution_ip_addressisthesolutionsIPv4addressforthevNICthatisconnectedtothe
VMkernelportgroup(forexample,169.254.1.31).ThisaddressmustbewithintherangeofVMwareassigned
IPaddressesforthesolution.Thesolution_portistheportonwhichthesolutionacceptsconnections.
Ifyouwanttochangethelocationofasolution,deactivateallsecurityvirtualmachines,changethelocation,
andthenreactivateallsecurityvirtualmachines.

Activate a Solution
Youcanactivateasolutionthathasbeenregisteredandlocated.
Example 15-4. Activate solution
Request:
POST https://<nsxmgr-ip>/api/2.0/endpointsecurity/activation/<vendor_id>/<altitude>

RequestBody:
<ActivationInfo>
<moid>svm_moid</moid>
</ActivationInfo>

Intherequest,<vendor_id>isthepreviouslyregisteredIDforthevendor,and<altitude>forthealtitude.
Intherequestbody,svm_moidisthemanagedobjectIDoftheactivatedsolutionsvirtualmachine.

Querying Registration Status of vShield Endpoint


YoucanusethesameURLsshownintheprevioussectionwiththeGETmethodtoretrievevendorregistration
information,solutionregistrationinformation,locationinformation,andsolutionactivationstatus.

Get Vendor Registration


Youcanretrievevendorregistrationinformation.
Example 15-5. Get list of all registered vendors
Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/vendors

Example 15-6. Get vendor registration information


Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>

Get Solution Registration


Youcanretrievesolutionregistrationinformation.

VMware, Inc.

351

vShield API Programming Guide

Example 15-7. Get all registered solutions for a vendor


Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>/solutions

Example 15-8. Get solution registration information


Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>/<altitude>

Get IP Address of a Solution


ThiscallretrievestheIPaddressandportassociatedwithasolution.
Example 15-9. Get IP address and port of a solution
Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>/<altitude>/location

Get Activation Status of a Solution


Thiscallretrievessolutionactivationstatus,giventhemanagedobjectreference<moid>ofitsvirtualmachine.
Example 15-10. Get activation status of a solution
Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/activation/<vendor_id>/<altitude>/<moid>

Statuscanbefalse(notactivated)ortrue(activated).

Querying Activated Security Virtual Machines for a Solution


Youcanretrievealistofactivatedsecurityvirtualmachinesforasolution,aswellastheactivationinformation
forallactivatedsecurityvirtualmachinesonahost.

Query Activated Security Virtual Machines


Youcanretrievealistofactivatedsecurityvirtualmachinesforthespecifiedsolution.
Example 15-11. Get activated security virtual machines
Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/activation/<vendor_id>/<solution_id>

ResponseBody:
<ActivatedSVMs>
<ActivationInfo>
<moid>vm-819</moid>
<hostMoid>host-9</hostMoid>
<vmName>VMWARE-Data Security-10.24.130.174</vmName>
<hostName>10.24.130.174</hostName>
<clusterName>Dev</clusterName>
<dcName>dev</dcName>
<vendorId>VMWARE</vendorId>

352

VMware, Inc.

Chapter 15 vShield Endpoint Management

<solutionId>6341068275337723904</solutionId>
</ActivationInfo>
...
</ActivatedSVMs>

Intherequest,vendor_idistheVMwareassignedIDforthevendor,whilesolution_idisthesolutionID.

Query Activation Information


Youcanretrieveactivationinformationforallactivatedsecurityvirtualmachinesonthespecifiedhost.
Example 15-12. Get activation information
Request:
GET https://<nsxmgr-ip>/api/2.0/endpointsecurity/activation?hostId=<hostID>

ResponseBody:
<ActivatedSVMs>
<ActivationInfo>
<moid>vm-819</moid>
<hostMoid>host-9</hostMoid>
<vmName>VMWARE-Data Security-10.24.130.174</vmName>
<hostName>10.24.130.174</hostName>
<clusterName>Dev</clusterName>
<dcName>dev</dcName>
<vendorId>VMWARE</vendorId>
<solutionId>6341068275337723904</solutionId>
</ActivationInfo>
...
</ActivatedSVMs>

Unregistering a Solution with vShield Endpoint


YoucanusethesameURIsshowninthefirstsectionwiththeDELETEmethodtounregisteravendor,
unregisterasolution,unsetlocationinformation,ordeactivateasolution.

Unregister a Vendor
Thiscallunregistersavendor.
Example 15-13. Unregister a vendor
Request:
DELETE https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>

Unregister a Solution
Thiscallunregistersasolution.
Example 15-14. Unregister a vendor
Request:
DELETE https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>/<altitude>

VMware, Inc.

353

vShield API Programming Guide

Unset IP Address
ThiscallunsetsasolutionsIPaddressandport.
Example 15-15. Unset IP address and port
Request:
DELETE https://<nsxmgr-ip>/api/2.0/endpointsecurity/registration/<vendor_id>/<altitude>/location

Deactivate a Solution
Thiscalldeactivatesasolutiononahost.
Example 15-16. Deactivate a solution
Request:
DELETE https://<nsxmgr-ip>/api/2.0/endpointsecurity/activation/<vendor_id>/<altitude>/<moid>

Status Codes and Error Schema


ThissectionlistsvariousstatuscodesreturnedfromtheRESTAPI,andshowstheerrorschema.

Return Status Codes


The200codesindicatesuccess,the400codesindicatesomefailure,andthe600codesarecallspecific.

354

200OKoperationsuccessful

201Created:Entitysuccessfullyaltered.

400BadRequest:Internalerrorcodes.PleaserefertotheErrorSchemaformoredetails.

401Unauthorized:Incorrectusernameorpassword.

600UnrecognizedvendorID.

601Vendorisalreadyregistered.

602Unrecognizedaltitude.

603Solutionisalreadyregistered.

604InvalidIPv4address.

605Invalidport.

606Portoutofrange.

607Unrecognizedmoid.

608Locationinformationisalreadyset.

609Locationnotset.

612Solutionsstillregistered.

613Solutionlocationinformationstillset.

614Solutionstillactivated.

615Solutionnotactivated.

616Solutionisalreadyactivated.

617IP:Portalreadyinuse.

618BadsolutionID.

619vShieldEndpointisnotlicensed.

620Internalerror.

VMware, Inc.

Chapter 15 vShield Endpoint Management

Error Schema
HereistheXMLschemaforvShieldEndpointregistrationerrors.
<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="Error">
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="xs:unsignedInt"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

VMware, Inc.

355

vShield API Programming Guide

356

VMware, Inc.

16AppendixB:

Deprecated APIs

16

ThefollowingAPIshavebeendeprecatedintheNSX6.0release.
Table 16-1. Deprecated APIs
Deprecated API

Alternate API(s)

Local user management


/api/2.0/global/heartbeat

/api/1.0/appliance-management/global/info

/api/2.0/global/config

/api/2.0/services/vcconfig
/api/2.0/services/ssoconfig
/api/1.0/appliance-management/system/network/dns
/api/1.0/appliance-management/system/timesettings

/api/2.0/global/vcInfo

/api/2.0/services/vcconfig

/api/2.0/global/techsupportlogs

/api/1.0/appliance-management/techsupportlogs/NSX

/api/2.0/vdn/map/cluster/clusterID
/api/2.0/services/usermgmt/securityprofile

VMware, Inc.

357

vShield API Programming Guide

358

VMware, Inc.

Appendix A: Schemas

TheRESTAPIconfigurationofthevShieldEdgeandvShieldAppvirtualmachinessupportsschemasfor
installationandservicemanagement.
Thisappendixcoversthefollowingtopics:

FirewallSchemasonpage 359

Deprecated:vShieldManagerGlobalConfigurationSchemaonpage 361

Deprecated:ESXHostPreparationandUninstallationSchemaonpage 366

Deprecated:vShieldAppSchemasonpage 367

ErrorMessageSchemaonpage 373

Firewall Schemas
Firewall Configuration Schema

VMware, Inc.

359

vShield API Programming Guide

Firewall Section Schema

360

VMware, Inc.

Appendix A: Schemas

Firewall Sections Schema

Deprecated: vShield Manager Global Configuration Schema


ThefollowingschemashowsvShieldManagerRESTconfiguration.
Thisreplacesthe1.0APIschemaitemsforvCentersynchronization,DNSservice,virtualmachine
information,andsecuritygroups.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="vmware.vshield.edge.2.0"
xmlns:vse="vmware.vshield.edge.2.0"
elementFormDefault="qualified">
<xs:element name="nsxmgrGlobalConfig">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="vshieldEdgeReleaseInfo" type="vse:ReleaseInfoType"/> <!-- In response
from server -->
<xs:element minOccurs="0" name="vcInfo" type="vse:VcInfoType" />
<xs:element minOccurs="0" name="hostInfo" type="vse:HostInfoType" />
<xs:element minOccurs="0" name="techSupportLogsTarFilePath" type="xs:string"/>
<xs:element minOccurs="0" name="auditLogs" type="vse:AuditLogsType" />
<xs:element minOccurs="0" name="dnsInfo" type="vse:DnsInfoType" />
<xs:element minOccurs="0" name="versionInfo" type="xs:string" /> <!-- only in response -->
<xs:element minOccurs="0" name="vpnLicensed" type="xs:boolean" /> <!-- only in response -->
<xs:element minOccurs="0" name="ipsecVpnTunnels" type="vse:IpsecVpnTunnels" /> <!-- only in response -->
<xs:element minOccurs="0" maxOccurs="1" name="nsxmgrCapability" type="vse:nsxmgrCapabilityType"/>
<!-- only in response -->
<xs:element minOccurs="0" maxOccurs="1" name="timeInfo" type="vse:TimeInfoType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ReleaseInfoType">
<!-- can be re-used for release information of vshield, vShield
Manager, or vShield Edge-->
<xs:sequence>
<xs:element name="buildNumber" type="xs:NMTOKEN" /> <!-- add fields as required -->

VMware, Inc.

361

vShield API Programming Guide

<xs:element minOccurs ="0" name="vseLocationOnnsxmgr" type="xs:string" />


</xs:sequence>
</xs:complexType>
<xs:complexType name="SSOInfoType">
<xs:sequence>
<xs:element minOccurs="0" name="nsxmgrSolutionName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="lookupServiceUrl">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ssoAdminUserName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ssoAdminPassword">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="certificateThumbprint">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern
value="[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0
-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F09]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}"></xs:patt
ern>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="VcInfoType">
<xs:sequence>
<xs:element name="ipAddress">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="userName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="password">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>

362

VMware, Inc.

Appendix A: Schemas

</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="token">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="certificateThumbprint">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{
2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0
-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="pluginDownloadServer">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="pluginDownloadPort">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HostInfoType">
<xs:sequence>
<xs:element name="hostId" type="xs:string" />
<xs:element name="ipAddress" type="xs:string" />
<xs:element name="userName" type="xs:string" />
<xs:element name="password" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="SecurityGroups">
<xs:choice>
<xs:element name="securityGroup" type="vse:SecurityGroup" maxOccurs="unbounded" />
<xs:element name="securityGroupIdList" type="vse:SecurityGroupIdList" />
</xs:choice>
</xs:complexType>
<xs:complexType name="SecurityGroup">
<xs:sequence>
<xs:element name="securityGroupBaseNode" type="xs:string"/>
<xs:element name="securityGroupName" type="xs:string"/>
<xs:element name="securityGroupId" type="xs:string" minOccurs="0" />
<xs:element name="securityGroupNodeList" type="vse:NodeList" minOccurs="0"/>
<xs:element name="securityGroupIpList" type="vse:IpList" minOccurs="0" />
</xs:sequence>
</xs:complexType >
<xs:complexType name="SecurityGroupIdList">
<xs:sequence>
<xs:element name="securityGroupId" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

VMware, Inc.

363

vShield API Programming Guide

<xs:complexType name="IpList">
<xs:sequence>
<xs:element name="ip" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="NodeList">
<xs:sequence>
<xs:element name="node" type="vse:SecurityGroupNode" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="SecurityGroupNode">
<xs:sequence>
<xs:element name="id" type="xs:string" />
<xs:element name="name" type="xs:string" minOccurs="0" />
<xs:element name="ipList" type="vse:IpList" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="VnicsType">
<xs:sequence>
<xs:element name="vnic" type="vse:VnicType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="VnicType">
<xs:sequence>
<xs:element name="id" type="xs:string" />
<xs:element name="name" type="xs:string" />
<xs:element name="ipList" type="vse:IpList" minOccurs="0" maxOccurs="1"/>
<!-- Will be good if we can also send this information
<xs:element name="VLAN" type="xs:int" />
<xs:element name="PortGroup" type="xs:string" />
<xs:element name="Protected" type="xs:boolean"/> -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="AuditLogsType">
<xs:sequence>
<xs:element name="auditLog" type="vse:AuditLogType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DnsInfoType">
<xs:sequence>
<xs:element name="primaryDns" type="xs:string"/>
<xs:element minOccurs="0" name="secondaryDns" type="xs:string"/>
<xs:element minOccurs="0" name="tertiaryDns" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AuditLogType">
<xs:sequence>
<xs:element name="id" type="xs:string" />
<xs:element name="userName" type="xs:string" />
<xs:element name="accessInterface" type="xs:string" />
<xs:element name="module" type="xs:string" />
<xs:element name="operation" type="xs:string" />
<xs:element name="status" type="xs:string" />
<xs:element name="operationSpan" type="xs:string" />
<xs:element name="resource" type="xs:string" />
<xs:element name="timestamp" type="xs:string" />
<xs:element name="notes" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="IpsecVpnTunnels">
<xs:sequence>

364

VMware, Inc.

Appendix A: Schemas

<xs:element name="lastEventId" type="xs:unsignedInt" />


<xs:element minOccurs="0" maxOccurs="unbounded" name="ipsecVpnTunnelStatusList"
type="vse:IpsecVpnTunnelStatus" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="IpsecVpnTunnelStatus">
<xs:sequence>
<xs:element name="networkId" type="xs:string" />
<xs:element name="ipsecVpnTunnelConfig" type="vse:IpsecVpnTunnelConfigType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="IpsecVpnTunnelConfigType"> <!--only in response -->
<xs:sequence>
<xs:element name="peerName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="256"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="peerId" type="xs:string" />
<xs:element name="peerIpAddress" type="xs:string" />
<xs:element maxOccurs="64" name="localSubnet" type="xs:string" /> <!-- localSubnet * peerSubnet * noOfSites
should not be more than 64 -->
<xs:element maxOccurs="64" name="peerSubnet" type="xs:string" /> <!-- localSubnet * peerSubnet * noOfSites should
not be more than 64 -->
<xs:element name="authenticationMode" >
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="((psk)|(x.509))"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="preSharedKey" type="xs:string" />
<xs:element minOccurs="0" name="encryptionAlgorithm" type="xs:string" />
<xs:element minOccurs="0" name="mtu" type="xs:unsignedInt" />
<xs:element minOccurs="0" name="status" type="xs:string" />
<xs:element minOccurs="0" name="stateChangeReason" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="nsxmgrCapabilityType">
<xs:sequence>
<xs:element name="ipsecVpnCapability" type="xs:boolean"/>
<xs:element name="webLoadBalancerCapability" type="xs:boolean"/>
<xs:element name="natCapability" type="xs:boolean"/>
<xs:element name="firewallCapability" type="xs:boolean"/>
<xs:element name="dhcpCapability" type="xs:boolean"/>
<xs:element name="staticRoutingCapability" type="xs:boolean"/>
<xs:element name="nsxmgrVersion" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TimeInfoType">
<xs:sequence>
<xs:element minOccurs="0" name="clock" type="xs:string"/>
<xs:element minOccurs="0" name="ntpServer" type="xs:string"/>
<xs:element minOccurs="0" name="zone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

VMware, Inc.

365

vShield API Programming Guide

Deprecated: ESX Host Preparation and Uninstallation Schema


ThisschemacanbeusedtoinstalloruninstallvShieldAppandvShieldEndpointservicesonanESXhost.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="VshieldConfiguration">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" name="VszInstallParams" type="VszInstallParams"/>
<xs:element minOccurs="0" name="EpsecInstallParams" type="xs:boolean"/>
<xs:element name="InstallAction" type="InstallAction"/> <!-- InstallAction to be taken on appliance install/upgrade -->
<xs:element name="InstallStatus" type="InstallStatus"/> <!-- only in response -->
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="InstallStatus">
<xs:sequence>
<xs:element minOccurs="0" name="ProgressState" type="xs:string"/>
<xs:element minOccurs="0" name="ProgressSubState" type="xs:string"/>
<xs:element minOccurs="0" name="InstalledServices" type="InstalledServices"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="InstalledServices">
<xs:sequence>
<xs:element name="VszInstalled" type="xs:boolean"/>
<xs:element name="EpsecInstalled" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<!-- Install parameters -->
<xs:complexType name="VszInstallParams">
<xs:sequence>
<xs:element name="DatastoreId" type="Moid"/>
<xs:element name="ManagementPortSwitchId" type="xs:string"/> <!-- contains the networkId of the mgmt
portgroup -->
<xs:element name="MgmtInterface" type="MgmtInterfaceType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MgmtInterfaceType">
<xs:sequence>
<xs:element name="IpAddress" type="IP"/>
<xs:element name="NetworkMask" type="IP"/>
<xs:element name="DefaultGw" type="IP"/>
</xs:sequence>
</xs:complexType>

<xs:simpleType name="InstallAction">
<xs:restriction base="xs:string">
<xs:enumeration value="install"/>
<xs:enumeration value="upgrade"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="IP">
<xs:restriction base="xs:string">
<xs:pattern value=
"((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])
"/>
</xs:restriction>
</xs:simpleType>

366

VMware, Inc.

Appendix A: Schemas

<xs:simpleType name="Moid">
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9\-]+"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

Deprecated: vShield App Schemas


ThefollowingschemasdetailvShieldAppconfigurationviaRESTAPI.

vShield App Configuration Schema


ThisschemaconfiguresavShieldAppafterinstallation.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="ZonesConfiguration">
<xs:complexType>
<xs:all>
<xs:element name="VszInstallParams" type="VszInstallParams" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- Install parameters -->
<xs:complexType name="VszInstallParamsType">
<xs:sequence>
<xs:element name="NodeId" type="xs:string"/>
<xs:element name="DatacenterId" type="xs:string"/>
<xs:element name="DatastoreId" type="xs:string"/>
<xs:element name="NameForZones" type="xs:string"/>
<xs:element name="VswitchForMgmt" type="xs:string"/>
<xs:element name="MgmtInterface" type="InterfaceType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="InterfaceType">
<xs:sequence>
<xs:element name="IpAddress" type="xs:NMTOKEN"/>
<xs:element name="NetworkMask" type="xs:NMTOKEN"/>
<xs:element name="DefaultGw" type="xs:NMTOKEN"/>
<xs:element minOccurs="0" name="VlanTag" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

vShield App Firewall Schema


ThisschemaconfiguresthefirewallrulesenforcedbyavShieldApp.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >
<xs:element name="VshieldAppConfiguration">
<xs:complexType>
<xs:choice>
<xs:element name="firewallConfiguration" type="FirewallConfigurationDto" />
<xs:element name="firewallConfigurationHistoryList" type="FirewallConfigHistoryInfoListDto" />
<xs:element name="consolidatedConfiguration" type="FirewallConfigurationDto" maxOccurs="unbounded" />
<xs:element name="status" type="StatusDto" />
<xs:element name="datacenterState" type="DatacenterStateDto" />
<xs:element name="protocolsList" type="ProtocolListDto" />
<xs:element name="protocolTypes" type="ProtocolsTypeEnum" maxOccurs="4" />

VMware, Inc.

367

vShield API Programming Guide

</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name="FirewallConfigHistoryInfoListDto">
<xs:sequence>
<xs:element name="contextId" type="xs:string" />
<xs:element name="firewallConfigHistoryInfo" type="FirewallConfigHistoryInfoDto"maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="FirewallConfigHistoryInfoDto">
<xs:sequence>
<xs:element name="configId" type="xs:long" />
<xs:element name="userId" type="xs:string" />
<xs:element name="timestamp" type="xs:long" />
<xs:element name="status" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="DatacenterStateDto">
<xs:sequence>
<xs:element name="datacenterId" type="xs:string" />
<xs:element name="userId" type="xs:string" minOccurs="0" />
<xs:element name="timestamp" type="xs:long" minOccurs="0" />
<xs:element name="status" type="DatacenterStatusEnum" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="StatusDto">
<xs:sequence>
<xs:element name="currentState" type="ConfigStateEnum" />
<xs:element name="failedPublishInfo" type="FailedPublishInfoDto" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute name="contextId" type="xs:string" use="required" />
<xs:attribute name="generationNumber" type="xs:long" />
</xs:complexType>
<xs:complexType name="FailedPublishInfoDto">
<xs:sequence>
<xs:element name="applianceIp" type="xs:string" />
<xs:element name="timestamp" type="xs:long" />
<xs:element name="errorDescription" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="FirewallConfigurationDto">
<xs:sequence>
<xs:element name="layer3FirewallRule" type="Layer3FirewallRuleDto" maxOccurs="unbounded" minOccurs="0"
/>
<xs:element name="layer2FirewallRule" type="Layer2FirewallRuleDto" maxOccurs="unbounded" minOccurs="0"
/>
</xs:sequence>
<xs:attribute name="provisioned" type="xs:boolean" use="optional" />
<xs:attribute name="contextId" type="xs:string" use="required" />
<xs:attribute name="timestamp" type="xs:long" use="optional" />
<xs:attribute name="generationNumber" type="xs:long" use="optional" />
</xs:complexType>
<xs:complexType name="ApplicationDto">
<xs:choice>
<xs:element name="applicationSetId" type="xs:string" />
</xs:choice>
</xs:complexType>
<xs:complexType name="DestinationDto" abstract="true">
<xs:sequence>
<xs:element name="address" type="AddressDto" minOccurs="0" />

368

VMware, Inc.

Appendix A: Schemas

<!-- Only in response, not considered in request -->


</xs:sequence>
</xs:complexType>
<xs:complexType name="Layer2DestinationDto">
<xs:complexContent>
<xs:extension base="DestinationDto">
</xs:extension>
<xs:element name="application" type="ApplicationDto" minOccurs="0" />
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Layer3DestinationDto">
<xs:sequence>
<xs:element name="address" type="AddressDto" minOccurs="0" />
<xs:element name="application" type="ApplicationDto" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="Layer3SourceAddressDto">
<xs:sequence>
<xs:element name="address" type="AddressDto" minOccurs="0" />
<xs:element name="portInfo" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="FirewallRuleDto" abstract="true">
<xs:sequence>
<xs:element name="action" type="ActionEnum" />
<xs:element name="logged" type="xs:boolean" />
<xs:element name="notes" type="xs:string" minOccurs="0" />
</xs:sequence>
<xs:attribute name="id" type="xs:long" use="required" />
<xs:attribute name="precedence" type="PrecedenceEnum" use="optional" />
<xs:attribute name="disabled" type="xs:boolean" use="optional" />
</xs:complexType>
<xs:complexType name="Layer2FirewallRuleDto">
<xs:complexContent>
<xs:extension base="FirewallRuleDto">
<xs:sequence>
<xs:element name="source" type="AddressDto" minOccurs="0" />
<xs:element name="destination" type="Layer2DestinationDto" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="Layer3FirewallRuleDto">
<xs:complexContent>
<xs:extension base="FirewallRuleDto">
<xs:sequence>
<xs:element name="source" type="Layer3SourceAddressDto" minOccurs="0" />
<xs:element name="destination" type="Layer3DestinationDto" minOccurs="0" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="AddressDto">
<xs:choice>
<xs:element name="containerId" type="xs:string" minOccurs="0">
</xs:element>
</xs:choice>
<xs:attribute name="exclude" type="xs:boolean" use="optional" default="false" />
</xs:complexType>

VMware, Inc.

369

vShield API Programming Guide

<xs:simpleType name="ActionEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="allow" />
<xs:enumeration value="deny" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PrecedenceEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="default" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ConfigStateEnum">
<xs:restriction base="xs:NCName">
<!-- <xs:enumeration value="saved" /> -->
<xs:enumeration value="published" />
<xs:enumeration value="inprogress" />
<xs:enumeration value="publishFailed" />
<xs:enumeration value="Deleted" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="DatacenterStatusEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="upgrading" />
<xs:enumeration value="backwardCompatible" />
<xs:enumeration value="backwardCompatibleReadyForSwitch" />
<xs:enumeration value="migrating" />
<xs:enumeration value="regular" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ProtocolsTypeEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="application" />
<xs:enumeration value="ipv4" />
<xs:enumeration value="icmp" />
<xs:enumeration value="ethernet" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

vShield App SpoofGuard Schema


ThefollowingschemadetailsSpoofGuardconfiguration.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"elementFormDefault="qualified">
<xs:element name="VshieldConfiguration">
<xs:complexType>
<xs:choice>
<xs:element name="globalSettings" type="GlobalSettingsDto" />
<xs:element name="ipAssignmentStatistic" type="IpAssignmentStatisticDto" />
<xs:element name="vnicIdList" type="VnicIdListDto" />
<xs:element name="ipAssignmentDetailsList" type="IpAssignmentDetailsListDto" />
<xs:element name="pagedIpAssignmentDetailsList" type="PagedIpAssignmentDetailsListDto" />
<xs:element name="approveIpInfo" type="VnicInfoDto" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name="PagedIpAssignmentDetailsListDto">
<xs:sequence>

370

VMware, Inc.

Appendix A: Schemas

<xs:element name="ipAssignmentDetails" type="IpAssignmentDetailsDto" maxOccurs="unbounded" />


<xs:element name="pagingDetails" type="PagingInfoDto" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="PagingInfoDto">
<xs:sequence>
<xs:element name="pageSize" type="xs:int" />
<xs:element name="startIndex" type="xs:int" />
<xs:element name="totalCount" type="xs:int" />
<xs:element name="sortOrderAscending" type="xs:boolean" />
<xs:element name="sortBy" type="PagingSortByEnum" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="IpAssignmentDetailsListDto">
<xs:sequence>
<xs:element name="ipAssignmentDetails" type="IpAssignmentDetailsDto"maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="IpAssignmentDetailsDto">
<xs:sequence>
<xs:element name="vnicId" type="xs:string" />
<xs:element name="macAddress" type="xs:string" />
<xs:element name="ipAddress" type="xs:string" />
<xs:element name="vnicName" type="xs:string" />
<xs:element name="networkId" type="xs:string" />
<xs:element name="vmId" type="xs:string" />
<xs:element name="vmName" type="xs:string" />
<xs:element name="approvedIpAddress" type="xs:string" />
<xs:element name="approvedBy" type="xs:string" />
<xs:element name="approvedOn" type="xs:long" />
<xs:element name="publishedIpAddress" type="xs:string" />
<xs:element name="publishedBy" type="xs:string" />
<xs:element name="publishedOn" type="xs:long" />
<xs:element name="reviewRequired" type="xs:boolean" />
<xs:element name="duplicateCount" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="IpAssignmentStatisticDto">
<xs:sequence>
<xs:element name="contextId" type="xs:string" />
<xs:element name="inSync" type="xs:boolean" />
<xs:element name="activeCount" type="xs:long" />
<xs:element name="inactiveCount" type="xs:long" />
<xs:element name="activeSinceLastPublishedCount" type="xs:long" />
<xs:element name="requireReviewCount" type="xs:long" />
<xs:element name="duplicateCount" type="xs:long" />
<xs:element name="unpublishedCount" type="xs:long" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="VnicIdListDto">
<xs:sequence>
<xs:element name="vnicId" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="VnicInfoDto">
<xs:sequence>
<xs:element name="vnicId" type="xs:string" />
<xs:element name="ipAddress" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="GlobalSettingsDto">

VMware, Inc.

371

vShield API Programming Guide

<xs:sequence>
<xs:element name="status" type="OperationStatusEnum" />
<xs:element name="mode" type="OperationModeEnum" />
<!-- optional parameters will be part of response only -->
<xs:element name="timestamp" type="xs:long" minOccurs="0" />
<xs:element name="publishedBy" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="OperationStatusEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="enabled" />
<xs:enumeration value="disabled" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="OperationModeEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="trustOnFirstUse" />
<xs:enumeration value="manual" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PagingSortByEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="VM_NAME" />
<xs:enumeration value="MAC" />
<xs:enumeration value="APPROVED_IP" />
<xs:enumeration value="CURRENT_IP" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

vShield App Namespace Schema


Thefollowingschemadetailsnamespaceconfiguration.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="vmware.vshield.global.20.namespace"
xmlns:vsns="vmware.vshield.global.20.namespace" elementFormDefault="qualified">
<xs:element name="VshieldConfiguration">
<xs:complexType>
<xs:choice>
<xs:element maxOccurs="unbounded" name="namespace" type="vsns:NamespaceDto" />
<xs:element maxOccurs="3" name="namespacesType" type="vsns:NamespacesTypeEnum" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name="NamespaceDto">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="namespacePortGroup" type="vsns:PortGroupDto" />
</xs:sequence>
<xs:attribute name="type" use="required" type="vsns:NamespacesTypeEnum" />
<xs:attribute name="id" use="optional" type="xs:long" />
</xs:complexType>
<xs:complexType name="PortGroupDto">
<xs:sequence>
<xs:element maxOccurs="1" name="Id" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="NamespacesTypeEnum">
<xs:restriction base="xs:NCName">
<xs:enumeration value="DEFAULT" />

372

VMware, Inc.

Appendix A: Schemas

<xs:enumeration value="PORTGROUP" />


<xs:enumeration value="NONE" />
</xs:restriction>
</xs:simpleType>
</xs:schema>Retrieved from "https://wiki.eng.vmware.com/NS_DEV/vShieldManager/nsxmgr30/App/ipad/xsd"

Error Message Schema


Thisschemadetailserrormessages.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Errors">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Error" type="ErrorType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ErrorType">
<xs:sequence>
<xs:element name="code" type="xs:unsignedInt"/>
<xs:element name="description" type="xs:string"/>
<xs:element minOccurs="0" name="detailedDescription" type="xs:string"/>
<xs:element minOccurs="0" name="index" type="xs:int"/>
<xs:element minOccurs="0" name="resource" type="xs:NMTOKEN"/>
<xs:element minOccurs="0" name="requestId" type="xs:NMTOKEN"/>
<xs:element minOccurs="0" name="module" type="xs:NMTOKEN"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

IfaRESTAPIcallresultsinanerror,theHTTPreplycontainsthefollowinginformation.

AnXMLerrordocumentastheresponsebody

ContentType:application/xml

Anappropriate2xx,4xx,or5xxHTTPstatuscode

Table 17-1. Error Message Status Codes


Code

Description

200 OK

Therequestwasvalidandhasbeencompleted.Generally,thisresponseisaccompanied
byabodydocument(XML).

201 Created

Therequestwascompletedandnewresourcewascreated.TheLocationheaderofthe
responsecontainstheURIofnewlycreatedresource.

204 No Content

Sameas200 OK,buttheresponsebodyisempty(NoXML).

400 Bad Request

Therequestbodycontainsaninvalidrepresentationortherepresentationoftheentityis
missinginformation.TheresponseisaccompaniedbyErrorObject(XML).

401 Unauthorized

Anauthorizationheaderwasexpected.RequestwithinvalidornovShieldManager
Token.

403 Forbidden

Theuserdoesnothaveenoughprivilegestoaccesstheresource.

404 Not Found

Theresourcewasnotfound.TheresponseisaccompaniedbyErrorObject(XML).

500 Internal Server Error

Unexpectederrorwiththeserver.TheresponseisaccompaniedbyErrorObject(XML).

503 Service Unavailable

Cannotproceedwiththerequest,becausesomeoftheservicesareunavailable.Example:
vShieldEdgeisUnreachable.TheresponseisaccompaniedbyErrorObject(XML).

VMware, Inc.

373

vShield API Programming Guide

374

VMware, Inc.

Das könnte Ihnen auch gefallen