Forum Discussion
George_Watkins_
May 10, 2012Historic F5 Account
Hi Chandan,
The issue you are running into is that the src_file_names parameter expects an array of zone file paths formatted as strings. The strings are the paths of zone files that are stored locally on the BIG-IP. You may want to add an upload method (likely SSH) to your code that pushes your zone file to /tmp on the BIG-IP. Here is a working example written in Java:
package com.f5se.examples;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
public class CreateZone {
public static void main(String[] args) {
iControl.BigIP bigip = new iControl.BigIP("test-ltm-ve-03", "admin", "admin");
bigip.setIgnoreInvalidCert(true);
iControl.services.ManagementZoneInfo[] zone_info = new iControl.services.ManagementZoneInfo[1];
zone_info[0] = new iControl.services.ManagementZoneInfo();
zone_info[0].setView_name("external");
zone_info[0].setZone_name("element.local.");
zone_info[0].setZone_type(iControl.services.ManagementZoneType.MASTER);
zone_info[0].setZone_file("db.element.local");
zone_info[0].setOption_seq(new String[0]);
String[] src_file_names = new String[] { "/tmp/db.element.local" };
boolean[] sync_ptrs = new boolean[1];
sync_ptrs[0] = true;
try {
bigip.ManagementZone().add_zone_file(zone_info, src_file_names, sync_ptrs);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Hope that helps,
George