Programmer's Guide (Supporting ADX v03.1.00) Manual

Brocade Virtual ADX XML API Programmer’s Guide 823
53-1003248-01
Example: Adding and binding a real server and a VIP
B
System.out.println("Successfully created virtual server port [ "
+ virtualServerPort + " ]");
return virtualPort;
}
/**
* Bind Real port to virtual port
*
* @param virtualPort
* @param realPort
* @throws RuntimeFault_datatype
* @throws RemoteException
*/
public void bind(ServerPort virtualPort, ServerPort realPort)
throws RuntimeFault_datatype, RemoteException {
BindRealServerPortToVipPort_datatype arg0 = new
BindRealServerPortToVipPort_datatype(virtualPort, realPort);
RequestHeader_datatype arg1 = new RequestHeader_datatype();
slbService.bindRealServerPortToVipPort(arg0, arg1);
System.out.println("Successfully binded real port [ "
+ realPort.getPort().getNameOrNumber()
+ " ] to virtual port [ "
+ virtualPort.getPort().getNameOrNumber() + " ]");
}
/**
* Save configuration
*
* @throws RuntimeFault_datatype
* @throws RemoteException
*/
public void saveConfiguration() throws RuntimeFault_datatype,
RemoteException {
RequestHeader_datatype rhold = new RequestHeader_datatype();
WriteConfig_datatype wcon = new WriteConfig_datatype();
sysService.writeConfig(wcon, rhold);
System.out.println("Successfully saved configuration");
}
public static void main(String[] args) throws MalformedURLException,
ServiceException, Exception {
Usecase1 bindTest = new Usecase1();
/**
* Initialize parameters in the initialization block before execution.
*/
// Initialize SYS Service
bindTest.initSysService();
// Get ADX Version
bindTest.getVersion();
// Initialize SLB Service
bindTest.initSlbService();
// Create Real Server
Server realServer = bindTest.createRealServer();
// Create Real Server Port
ServerPort realPort = bindTest.createRealServerPort(realServer);
// Create Virtual Server
Server virtualServer = bindTest.createVirtualServer();
// Create Virtual Server Port
ServerPort virtualPort = bindTest
.createVirtualServerPort(virtualServer);