Forum Discussion
shiff_128078
Nimbostratus
Jul 10, 2004Please Help!!!
I am not the developer of this application, but the network admin so please keep that in mind with your answers. We have written a webgui to allow us to take many nodes offline and online at once acc...
mdowns_127773
Nimbostratus
Jul 14, 2004Joe:
Good afternoon. I'm the developer working with Shiff on the WebGUI project. Thanks for your help; we both appreciate it.
Essentially, what we're doing is pretty straightforward, it seems, and I imagine that there's a setting that I'm not applying/overlooking, or something equally as silly.
Here's the snippet from the page class. Again, nothing mindblowing: just a query out to get the BigIP data (GetBigIPInfo), then a pull from a datagrid on the WebForm (toggleDataGrid), and finally the call out to the BigIP class (SetAll):
DataRow row = BigIPService.GetBigIPInfo(); //Returns General IP Data for the BigIP itself from SQL
BigIp bigIP = new BigIp(GetString(row, "IPAddress"), GetString(row, "PortNumber"), GetString(row, "UserName"), GetString(row, "Password"));
foreach (DataRow ipRow in ((DataTable)toggleDataGrid.DataSource).Rows)
{
//For every ip/port combo handled by the BigIP, enable or disable as requested
string ipPortDefinition = GetString(ipRow, "IPAddress") + ":" + GetString(ipRow, "HttpPort");
bigIP.SetAll(ipPortDefinition, Convert.ToBoolean(ViewState["EnableAction"].ToString()));
if (SqlUtil.GetString(ipRow, "HttpsPort") != "") //If IP has a -secure- port, as well
{
ipPortDefinition = GetString(ipRow, "IPAddress") + ":" + GetString(ipRow, "HttpsPort");
bigIP.SetAll(ipPortDefinition, Convert.ToBoolean(ViewState["EnableAction"].ToString()));
}
}
Here are the calls I'm making from within the BigIP class. The only real change here is the addition of "SetAll", which wasn't in the SDK:
public void SetAll(string ipPortDefinition, bool enabled)
{
SetAvailable(ipPortDefinition, enabled);
SetEnabled(ipPortDefinition, enabled);
}
public void SetAvailable(string ipPortDefinition, bool enabled)
{
int state = 1;
ITCMCommonIPPortDefinition [] node_defs = new ITCMCommonIPPortDefinition[1];
node_defs[0] = GetIpPortDefinition(ipPortDefinition);
if (enabled)
state = 2;
LocalLBNode.set_availability(node_defs, state);
}
public void SetEnabled(string ipPortDefinition, bool enabled)
{
int state = 0;
ITCMCommonIPPortDefinition [] node_defs = new ITCMCommonIPPortDefinition[1];
node_defs[0] = GetIpPortDefinition(ipPortDefinition);
if (enabled)
state = 1;
LocalLBNode.set_state(node_defs, state);
}
private ITCMCommonIPPortDefinition GetIpPortDefinition(string ipPortDefinition)
{
if (ipPortDefinition.IndexOf(":") != -1)
{
string[] values = ipPortDefinition.Split(':');
if (values.Length == 2)
{
ITCMCommonIPPortDefinition portDefinition = new ITCMCommonIPPortDefinition();
portDefinition.address = values[0];
portDefinition.port = Convert.ToInt32(values[1]);
return portDefinition;
}
else
throw new Exception("Invalid IP Port Definition '" + ipPortDefinition + "'. Format must be 'IPAddress:Port'");
}
else
throw new Exception("Invalid IP Port Definition '" + ipPortDefinition + "'. Format must be 'IPAddress:Port'");
}
Judging from your earlier post, perhaps I'm required to specifically set node_defs[0].address and .port on every occasion? But, GetIpPortDefinition should be setting all of those variables without any major issues.
Regardless, thanks again for taking a look. We appreciate it.
-Matt
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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