Forum Discussion
Fuchan_Tan_3092
Feb 17, 2012Nimbostratus
How to properly construct statsNames?
Hi,
Given the follwing tcl script that create a stats profile:
profile stats my_stats_profile {
defaults from stats
field1 total
field2 winners
}
To create the profile as described above using iControl Assember, I started the code as follows:
public void createLocalStatsProfile(String hostName, String profileName) throws Exception{
String [] profile_names = new String[1];
profile_names[0] = profileName;
// create profile
i_interfaces.getLocalLBProfileUserStatistic().create(profile_names);
// set statistic_name
iControl.LocalLBProfileUserStatisticUserStatisticName[][] statsNames = new iControl.LocalLBProfileUserStatisticUserStatisticName[1][2];
//help is need here to properly construct statsNames
.....
.....
.....
i_interfaces.getLocalLBProfileUserStatistic().set_statistic_name(profile_names, statsNames);
// set default profile String [] defaults = new String[1]; defaults[0] = "stats"; i_interfaces.getLocalLBProfileUserStatistic().set_default_profile(profile_names, defaults);
}
Thanks in advance.
Mike Tan
- Sorry for the delay on the reply, this one slipped by me.
// Create a new 2-d array with the first dimension of size 1 (for the single profile) iControl.LocalLBProfileUserStatisticUserStatisticName[][] statsNames = new iControl.LocalLBProfileUserStatisticUserStatisticName[1][]; // Allocate the 2nd dimension for index 0 to a size of 2 (2 keys for the single profile) statsNames[0] = new iControl.LocalLBProfileUserStatisticUserStatisticName[2]; statsNames[0][0] = new iControl.LocalLBProfileUserStatisticUserStatisticName(); statsNames[0][0].setStatistic_key(iControl.LocalLBProfileUserStatisticUserStatisticKey.USER_STATISTIC_1); statsNames[0][0].setStatistic_name(new iControl.LocalLBProfileString()); statsNames[0][0].getStatistic_name().setValue("total"); statsNames[0][0].getStatistic_name().setDefault_flag(false); statsNames[0][1] = new iControl.LocalLBProfileUserStatisticUserStatisticName(); statsNames[0][1].setStatistic_key(iControl.LocalLBProfileUserStatisticUserStatisticKey.USER_STATISTIC_2); statsNames[0][1].setStatistic_name(new iControl.LocalLBProfileString()); statsNames[0][0].getStatistic_name().setValue("winners"); statsNames[0][0].getStatistic_name().setDefault_flag(false); i_interfaces.getLocalLBProfileUserStatistic().set_statistic_name(profile_names, statsNames);
- Fuchan_Tan_3092NimbostratusJoe,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects