* Added MTU, NTP and DNS fields to install manifest step 2.

* Got the first BCN part of step 3 working.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent 7edfd0cb2d
commit e54aaad807
  1. 237
      cgi-bin/striker
  2. 235
      html/skins/alteeve/anvil.html
  3. 10
      share/words.xml
  4. 83
      tools/test.pl

@ -1534,17 +1534,23 @@ sub handle_manifest
{
my ($anvil) = @_;
$anvil->data->{cgi}{step}{value} = 1 if not defined $anvil->data->{cgi}{step}{value};
$anvil->data->{cgi}{prefix}{value} = "" if not defined $anvil->data->{cgi}{prefix}{value};
$anvil->data->{cgi}{prefix}{alert} = 0 if not defined $anvil->data->{cgi}{prefix}{alert};
$anvil->data->{cgi}{domain}{value} = "" if not defined $anvil->data->{cgi}{domain}{value};
$anvil->data->{cgi}{domain}{alert} = 0 if not defined $anvil->data->{cgi}{domain}{alert};
$anvil->data->{cgi}{sequence}{value} = "" if not defined $anvil->data->{cgi}{sequence}{value};
$anvil->data->{cgi}{sequence}{alert} = 0 if not defined $anvil->data->{cgi}{sequence}{alert};
$anvil->data->{cgi}{bcn_count}{value} = 1 if not defined $anvil->data->{cgi}{bcn_count}{value};
$anvil->data->{cgi}{bcn_count}{alert} = 0 if not defined $anvil->data->{cgi}{bcn_count}{alert};
$anvil->data->{cgi}{ifn_count}{value} = 1 if not defined $anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{cgi}{ifn_count}{alert} = 0 if not defined $anvil->data->{cgi}{ifn_count}{alert};
$anvil->data->{cgi}{step}{value} = 1 if not defined $anvil->data->{cgi}{step}{value};
$anvil->data->{cgi}{prefix}{value} = "" if not defined $anvil->data->{cgi}{prefix}{value};
$anvil->data->{cgi}{prefix}{alert} = 0 if not defined $anvil->data->{cgi}{prefix}{alert};
$anvil->data->{cgi}{domain}{value} = "" if not defined $anvil->data->{cgi}{domain}{value};
$anvil->data->{cgi}{domain}{alert} = 0 if not defined $anvil->data->{cgi}{domain}{alert};
$anvil->data->{cgi}{sequence}{value} = "" if not defined $anvil->data->{cgi}{sequence}{value};
$anvil->data->{cgi}{sequence}{alert} = 0 if not defined $anvil->data->{cgi}{sequence}{alert};
$anvil->data->{cgi}{bcn_count}{value} = 1 if not defined $anvil->data->{cgi}{bcn_count}{value};
$anvil->data->{cgi}{bcn_count}{alert} = 0 if not defined $anvil->data->{cgi}{bcn_count}{alert};
$anvil->data->{cgi}{ifn_count}{value} = 1 if not defined $anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{cgi}{ifn_count}{alert} = 0 if not defined $anvil->data->{cgi}{ifn_count}{alert};
$anvil->data->{cgi}{dns}{value} = "8.8.8.8,8.8.4.4" if not defined $anvil->data->{cgi}{dns}{value};
$anvil->data->{cgi}{dns}{alert} = 0 if not defined $anvil->data->{cgi}{dns}{alert};
$anvil->data->{cgi}{ntp}{value} = "" if not defined $anvil->data->{cgi}{ntp}{value};
$anvil->data->{cgi}{ntp}{alert} = 0 if not defined $anvil->data->{cgi}{ntp}{alert};
$anvil->data->{cgi}{mtu}{value} = 1500 if not defined $anvil->data->{cgi}{mtu}{value};
$anvil->data->{cgi}{mtu}{alert} = 0 if not defined $anvil->data->{cgi}{mtu}{alert};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::step::value" => $anvil->data->{cgi}{step}{value},
"cgi::prefix::value" => $anvil->data->{cgi}{prefix}{value},
@ -1552,6 +1558,9 @@ sub handle_manifest
"cgi::sequence::value" => $anvil->data->{cgi}{sequence}{value},
"cgi::bcn_count::value" => $anvil->data->{cgi}{bcn_count}{value},
"cgi::ifn_count::value" => $anvil->data->{cgi}{ifn_count}{value},
"cgi::dns::value" => $anvil->data->{cgi}{dns}{value},
"cgi::ntp::value" => $anvil->data->{cgi}{ntp}{value},
"cgi::mtu::value" => $anvil->data->{cgi}{mtu}{value},
}});
if ($anvil->data->{cgi}{step}{value} > 1)
@ -1674,20 +1683,26 @@ sub handle_manifest
{
my $say_bcn = $anvil->Words->string({key => "striker_0018", variables => { number => $i }});
my $network_key = "bcn".$i."_network";
my $subnet_key = "bcn".$i."_subnet";
my $gateway_key = "bcn".$i."_gateway";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
say_bcn => $say_bcn,
network_key => $network_key,
subnet_key => $subnet_key,
gateway_key => $gateway_key,
}});
$anvil->data->{cgi}{$network_key}{value} = "10.20".$i.".0.0" if not defined $anvil->data->{cgi}{$network_key}{value};
$anvil->data->{cgi}{$network_key}{alert} = 0 if not defined $anvil->data->{cgi}{$network_key}{alert};
$anvil->data->{cgi}{$subnet_key}{value} = "255.255.0.0" if not defined $anvil->data->{cgi}{$subnet_key}{value};
$anvil->data->{cgi}{$subnet_key}{alert} = 0 if not defined $anvil->data->{cgi}{$subnet_key}{alert};
$anvil->data->{cgi}{$gateway_key}{value} = "" if not defined $anvil->data->{cgi}{$gateway_key}{value};
$anvil->data->{cgi}{$gateway_key}{alert} = 0 if not defined $anvil->data->{cgi}{$gateway_key}{alert};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${network_key}::value" => $anvil->data->{cgi}{$network_key}{value},
"cgi::${network_key}::alert" => $anvil->data->{cgi}{$network_key}{alert},
"cgi::${subnet_key}::value" => $anvil->data->{cgi}{$subnet_key}{value},
"cgi::${subnet_key}::alert" => $anvil->data->{cgi}{$subnet_key}{alert},
"cgi::${gateway_key}::value" => $anvil->data->{cgi}{$gateway_key}{value},
"cgi::${gateway_key}::alert" => $anvil->data->{cgi}{$gateway_key}{alert},
}});
@ -1697,7 +1712,7 @@ sub handle_manifest
network_name => $network_key,
network_class => $anvil->data->{cgi}{$network_key}{alert} ? "input_alert" : "",
network_value => $anvil->data->{cgi}{$network_key}{value},
subnet => "255.255.0.0",
subnet => '255.255.0.0 <input type="hidden" name="'.$subnet_key.'" id="'.$subnet_key.'" value="'.$anvil->data->{cgi}{$subnet_key}{value}.'" />',
gateway_name => $gateway_key,
gateway_class => $anvil->data->{cgi}{$gateway_key}{alert} ? "input_alert" : "",
gateway_value => $anvil->data->{cgi}{$gateway_key}{value},
@ -1708,15 +1723,17 @@ sub handle_manifest
my $say_sn = $anvil->Words->string({key => "striker_0020", variables => { number => '1' }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { say_sn => $say_sn }});
$anvil->data->{cgi}{sn1_network}{value} = "10.101.0.0" if not defined $anvil->data->{cgi}{sn1_network}{value};
$anvil->data->{cgi}{sn1_network}{alert} = 0 if not defined $anvil->data->{cgi}{sn1_network}{alert};
$anvil->data->{cgi}{sn1_network}{value} = "10.101.0.0" if not defined $anvil->data->{cgi}{sn1_network}{value};
$anvil->data->{cgi}{sn1_network}{alert} = 0 if not defined $anvil->data->{cgi}{sn1_network}{alert};
$anvil->data->{cgi}{sn1_subnet}{value} = "255.255.0.0" if not defined $anvil->data->{cgi}{sn1_subnet}{value};
$anvil->data->{cgi}{sn1_subnet}{alert} = 0 if not defined $anvil->data->{cgi}{sn1_subnet}{alert};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::sn1_network::value" => $anvil->data->{cgi}{sn1_network}{value} }});
$network_form .= $anvil->Template->get({file => "anvil.html", name => "manifest-step2-network-entry", variables => {
network => $say_sn,
network_name => "sn1_network",
network_class => $anvil->data->{cgi}{sn1_network}{alert} ? "input_alert" : "",
network_value => $anvil->data->{cgi}{sn1_network}{value},
subnet => "255.255.0.0",
subnet => '255.255.0.0 <input type="hidden" name="sn1_subnet" id="sn1_subnet" value="'.$anvil->data->{cgi}{sn1_subnet}{value}.'" />',
}});
# Now IFNs
@ -1773,16 +1790,132 @@ sub handle_manifest
$anvil->data->{form}{back_link} = "?anvil=true&task=manifests&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=1&prefix=".$anvil->data->{cgi}{prefix}{value}."&domain=".$anvil->data->{cgi}{domain}{value}."&sequence=".$anvil->data->{cgi}{sequence}{value}."&ifn_count=".$anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{form}{refresh_link} = "?anvil=true&task=manifests&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=2&prefix=".$anvil->data->{cgi}{prefix}{value}."&domain=".$anvil->data->{cgi}{domain}{value}."&sequence=".$anvil->data->{cgi}{sequence}{value}."&ifn_count=".$anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "manifest-step2", variables => {
title => $anvil->Words->string({key => "striker_0226", variables => { number => 2 }}),
networks => $network_form,
number => "X",
title => $anvil->Words->string({key => "striker_0226", variables => { number => 2 }}),
networks => $network_form,
dns => $anvil->data->{cgi}{dns}{value},
dns_class => $anvil->data->{cgi}{dns}{alert} ? "input_alert" : "",
ntp => $anvil->data->{cgi}{ntp}{value},
ntp_class => $anvil->data->{cgi}{ntp}{alert} ? "input_alert" : "",
mtu => $anvil->data->{cgi}{mtu}{value},
mtu_class => $anvil->data->{cgi}{mtu}{alert} ? "input_alert" : "",
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
}
elsif ($anvil->data->{cgi}{step}{value} eq "3")
{
# Build and show the main manifest page!
my $sequence = $anvil->data->{cgi}{sequence}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sequence => $sequence }});
my $network_form = "";
my $ipmi_ip_guess = "";
foreach my $i (1..$anvil->data->{cgi}{bcn_count}{value})
{
my $say_bcn = $anvil->Words->string({key => "striker_0018", variables => { number => $i }});
my $network_key = "bcn".$i."_network";
my $subnet_key = "bcn".$i."_subnet";
my $gateway_key = "bcn".$i."_gateway";
my $node1_network_key = "node1_bcn".$i."_network";
my $node2_network_key = "node2_bcn".$i."_network";
my $dr1_network_key = "dr1_bcn".$i."_network";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
say_bcn => $say_bcn,
network_key => $network_key,
subnet_key => $subnet_key,
gateway_key => $gateway_key,
node1_network_key => $node1_network_key,
node2_network_key => $node2_network_key,
dr1_network_key => $dr1_network_key,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${network_key}::value" => $anvil->data->{cgi}{$network_key}{value},
"cgi::${network_key}::alert" => $anvil->data->{cgi}{$network_key}{alert},
"cgi::${subnet_key}::value" => $anvil->data->{cgi}{$subnet_key}{value},
"cgi::${subnet_key}::alert" => $anvil->data->{cgi}{$subnet_key}{alert},
"cgi::${gateway_key}::value" => $anvil->data->{cgi}{$gateway_key}{value},
"cgi::${gateway_key}::alert" => $anvil->data->{cgi}{$gateway_key}{alert},
}});
# On the BCN, we can confidently take the first two octets from 'network' and add our
# guesses to the last two octets.
if ($anvil->data->{cgi}{$network_key}{value} =~ /^(\d{1,3}\.\d{1,3})\.0\.0/)
{
my $first_two_octets = $1;
my $ip_third_octet = 8 + (2 * $sequence); # Thanks to Leigh Nunan (@leighnunan) for this elegant sequence formula
my $host_ip = $first_two_octets.".".$ip_third_octet;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
first_two_octets => $first_two_octets,
ip_third_octet => $ip_third_octet,
host_ip => $host_ip,
}});
$anvil->data->{cgi}{$node1_network_key}{value} = $host_ip.".1" if not defined $anvil->data->{cgi}{$node1_network_key}{value};
$anvil->data->{cgi}{$node2_network_key}{value} = $host_ip.".2" if not defined $anvil->data->{cgi}{$node2_network_key}{value};
$anvil->data->{cgi}{$dr1_network_key}{value} = $host_ip.".3" if not defined $anvil->data->{cgi}{$dr1_network_key}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${node1_network_key}::value" => $anvil->data->{cgi}{$node1_network_key}{value},
"cgi::${node2_network_key}::value" => $anvil->data->{cgi}{$node2_network_key}{value},
"cgi::${dr1_network_key}::value" => $anvil->data->{cgi}{$dr1_network_key}{value},
}});
# If $i = 1, build the IPMI IP guess
if ($i == 1)
{
my $ipmi_third_octet = 8 + (2 * $sequence) + 1;
$ipmi_ip_guess = $first_two_octets.".".$ipmi_third_octet;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
ipmi_third_octet => $ipmi_third_octet,
ipmi_ip_guess => $ipmi_ip_guess,
}});
$anvil->data->{cgi}{node1_ipmi_ip}{value} = $ipmi_ip_guess.".1" if not defined $anvil->data->{cgi}{node1_ipmi_ip}{value};
$anvil->data->{cgi}{node2_ipmi_ip}{value} = $ipmi_ip_guess.".2" if not defined $anvil->data->{cgi}{node2_ipmi_ip}{value};
$anvil->data->{cgi}{dr1_ipmi_ip}{value} = $ipmi_ip_guess.".3" if not defined $anvil->data->{cgi}{dr1_ipmi_ip}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::node1_ipmi_ip::value" => $anvil->data->{cgi}{node1_ipmi_ip}{value},
"cgi::node2_ipmi_ip::value" => $anvil->data->{cgi}{node2_ipmi_ip}{value},
"cgi::dr1_ipmi_ip::value" => $anvil->data->{cgi}{dr1_ipmi_ip}{value},
}});
}
}
# It should never happen, but in case the regex missed, set the guessed IPs to empty strings.
$anvil->data->{cgi}{$node1_network_key}{value} = "" if not defined $anvil->data->{cgi}{$node1_network_key}{value};
$anvil->data->{cgi}{$node2_network_key}{value} = "" if not defined $anvil->data->{cgi}{$node2_network_key}{value};
$anvil->data->{cgi}{$dr1_network_key}{value} = "" if not defined $anvil->data->{cgi}{$dr1_network_key}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${node1_network_key}::value" => $anvil->data->{cgi}{$node1_network_key}{value},
"cgi::${node2_network_key}::value" => $anvil->data->{cgi}{$node2_network_key}{value},
"cgi::${dr1_network_key}::value" => $anvil->data->{cgi}{$dr1_network_key}{value},
}});
$network_form .= $anvil->Template->get({file => "anvil.html", name => "manifest-step3-network-entry", variables => {
network => $say_bcn,
network_name => $network_key,
network_value => $anvil->data->{cgi}{$network_key}{value},
subnet_name => $subnet_key,
subnet_value => $anvil->data->{cgi}{$subnet_key}{value},
gateway_name => $gateway_key,
gateway_value => $anvil->data->{cgi}{$gateway_key}{value},
node1_network_name => $node1_network_key,
node1_network_value => $anvil->data->{cgi}{$node1_network_key}{value},
node1_network_class => $anvil->data->{cgi}{$node1_network_key}{alert} ? "input_alert" : "",
node2_network_name => $node2_network_key,
node2_network_value => $anvil->data->{cgi}{$node2_network_key}{value},
node2_network_class => $anvil->data->{cgi}{$node2_network_key}{alert} ? "input_alert" : "",
dr1_network_name => $dr1_network_key,
dr1_network_value => $anvil->data->{cgi}{$dr1_network_key}{value},
dr1_network_class => $anvil->data->{cgi}{$dr1_network_key}{alert} ? "input_alert" : "",
}});
}
$anvil->data->{form}{back_link} = "?anvil=true&task=manifests&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=1&prefix=".$anvil->data->{cgi}{prefix}{value}."&domain=".$anvil->data->{cgi}{domain}{value}."&sequence=".$anvil->data->{cgi}{sequence}{value}."&ifn_count=".$anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{form}{refresh_link} = "?anvil=true&task=manifests&manifest_uuid=".$anvil->data->{cgi}{manifest_uuid}{value}."&step=2&prefix=".$anvil->data->{cgi}{prefix}{value}."&domain=".$anvil->data->{cgi}{domain}{value}."&sequence=".$anvil->data->{cgi}{sequence}{value}."&ifn_count=".$anvil->data->{cgi}{ifn_count}{value};
$anvil->data->{form}{body} = $anvil->Template->get({file => "anvil.html", name => "manifest-step3", variables => {
title => $anvil->Words->string({key => "striker_0226", variables => { number => 3 }}),
networks => $network_form,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'form::body' => $anvil->data->{form}{body} }});
}
return(0);
@ -1863,6 +1996,74 @@ sub sanity_check_manifest_step2
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sane => $sane }});
}
# If DNS is specified, make sure it/they are valid.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::dns::value" => $anvil->data->{cgi}{dns}{value} }});
if ($anvil->data->{cgi}{dns}{value})
{
foreach my $ip (split/,/, $anvil->data->{cgi}{dns}{value})
{
$ip =~ s/^\s+//;
$ip =~ s/\s+$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ip => $ip }});
if (not $anvil->Validate->is_ipv4({ip => $ip}))
{
# Bad network
my $message = $anvil->Words->string({key => "error_0015"});
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $message }});
$anvil->data->{cgi}{dns}{alert} = 1;
$sane = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
sane => $sane,
ip => $ip,
"cgi::dns::alert" => $anvil->data->{cgi}{dns}{alert},
"cgi::dns::value" => $anvil->data->{cgi}{dns}{value},
}});
}
}
}
# If NTP is specified, make sure it/they are valid.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "cgi::ntp::value" => $anvil->data->{cgi}{ntp}{value} }});
if ($anvil->data->{cgi}{ntp}{value})
{
foreach my $ip (split/,/, $anvil->data->{cgi}{ntp}{value})
{
$ip =~ s/^\s+//;
$ip =~ s/\s+$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ip => $ip }});
if (not $anvil->Validate->is_ipv4({ip => $ip}))
{
# Bad network
my $message = $anvil->Words->string({key => "error_0122"});
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $message }});
$anvil->data->{cgi}{ntp}{alert} = 1;
$sane = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
sane => $sane,
ip => $ip,
"cgi::ntp::alert" => $anvil->data->{cgi}{ntp}{alert},
"cgi::ntp::value" => $anvil->data->{cgi}{ntp}{value},
}});
}
}
}
# Make sure the MTU is sane
if (not $anvil->Validate->is_positive_integer({number => $anvil->data->{cgi}{mtu}{value}}))
{
my $message = $anvil->Words->string({key => "error_0123"});
$anvil->data->{form}{error_massage} = $anvil->Template->get({file => "main.html", name => "error_message", variables => { error_message => $message }});
$anvil->data->{cgi}{mtu}{alert} = 1;
$sane = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
sane => $sane,
"cgi::mtu::alert" => $anvil->data->{cgi}{mtu}{alert},
"cgi::mtu::value" => $anvil->data->{cgi}{mtu}{value},
}});
}
return($sane);
}

@ -297,6 +297,38 @@
&nbsp;
</td>
</tr>
<tr>
<td class="column_header">
<!-- DNS -->
#!string!striker_0037!#
</td>
<td colspan="3">
<input type="text" name="dns" id="dns" value="#!variable!dns!#" style="width: 30em;" class="#!variable!dns_class!#" />
</td>
</tr>
<tr>
<td class="column_header">
<!-- NTP -->
#!string!striker_0251!#
</td>
<td colspan="3">
<input type="text" name="ntp" id="ntp" value="#!variable!ntp!#" style="width: 30em;" class="#!variable!ntp_class!#" />
</td>
</tr>
<tr>
<td class="column_header">
<!-- MTU -->
#!string!striker_0253!#
</td>
<td colspan="3">
<input type="number" name="mtu" id="mtu" value="#!variable!mtu!#" style="width: 30em;" class="#!variable!mtu_class!#" />
</td>
</tr>
<tr>
<td colspan="4">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="back" id="back" value="#!string!striker_0098!#" class="button">
@ -358,6 +390,38 @@
&nbsp;
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- DNS -->
#!string!striker_0037!#
</td>
<td>
#!string!striker_0038!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- NTP -->
#!string!striker_0251!#
</td>
<td>
#!string!striker_0252!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- MTU -->
#!string!striker_0253!#
</td>
<td>
#!string!striker_0254!#
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- BCN -->
@ -391,6 +455,177 @@
</table>
<!-- end manifest-step2 -->
<!-- start manifest-step3-network-entry -->
<tr>
<td class="column_header">
<!-- Network Name -->
#!variable!network!#: &nbsp;
<input type="hidden" name="#!variable!network_name!#" id="#!variable!network_name!#" value="#!variable!network_value!#" />
<input type="hidden" name="#!variable!subnet_name!#" id="#!variable!subnet_name!#" value="#!variable!subnet_value!#" />
<input type="hidden" name="#!variable!gateway_name!#" id="#!variable!gateway_name!#" value="#!variable!gateway_value!#" />
</td>
<td class="fixed_width_no_wrap">
<input type="text" name="#!variable!node1_network_name!#" id="#!variable!node1_network_name!#" value="#!variable!node1_network_value!#" width="15" style="width: 15em;" class="#!variable!node1_network_class!#" />
</td>
<td class="fixed_width_no_wrap">
<input type="text" name="#!variable!node2_network_name!#" id="#!variable!node2_network_name!#" value="#!variable!node2_network_value!#" width="15" style="width: 15em;" class="#!variable!node2_network_class!#" />
</td>
<td class="fixed_width_no_wrap">
<input type="text" name="#!variable!dr1_network_name!#" id="#!variable!dr1_network_name!#" value="#!variable!dr1_network_value!#" width="15" style="width: 15em;" class="#!variable!dr1_network_class!#" />
</td>
</tr>
<!-- end manifest-step3-network-entry -->
<!-- start manifest-step3 -->
<table align="center" class="anvil_main_menu">
<script type="text/javascript" src="/skins/alteeve/anvil.js"></script>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td class="title">
#!variable!title!#
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td class="description">
#!string!striker_0250!#
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td>
<form name="manifest_step3" action="" method="post">
<table align="center" class="anvil_main_menu">
<tr>
<td class="column_header">
<!-- Variable -->
&nbsp;
</td>
<td class="column_header">
<!-- Node 1 -->
#!string!striker_0255!#
</td>
<td class="column_header">
<!-- Node 2 -->
#!string!striker_0256!#
</td>
<td class="column_header">
<!-- DR Host -->
#!string!striker_0257!#
</td>
</tr>
#!variable!networks!#
<tr>
<td colspan="4">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="back" id="back" value="#!string!striker_0098!#" class="button">
</td>
<td colspan="2" style="text-align: right;">
<input type="submit" name="next" id="next" value="#!string!striker_0013!#" class="button">
</td>
<input type="hidden" name="prefix" id="prefix" value="#!data!cgi::prefix::value!#">
<input type="hidden" name="domain" id="domain" value="#!data!cgi::domain::value!#">
<input type="hidden" name="sequence" id="sequence" value="#!data!cgi::sequence::value!#">
<input type="hidden" name="bcn_count" id="bcn_count" value="#!data!cgi::bcn_count::value!#">
<input type="hidden" name="ifn_count" id="ifn_count" value="#!data!cgi::ifn_count::value!#">
<input type="hidden" name="step" id="step" value="3">
<input type="hidden" name="anvil" id="anvil" value="true">
<input type="hidden" name="task" id="task" value="manifests">
<input type="hidden" name="manifest_uuid" id="manifest_uuid" value="#!data!cgi::manifest_uuid::value!#">
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<table class="centered">
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- Network -->
#!string!striker_0149!#
</td>
<td>
#!string!message_0163!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- Subnet Mask -->
#!string!striker_0025!#
</td>
<td>
#!string!message_0164!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- Gateway -->
#!string!striker_0026!#
</td>
<td>
#!string!message_0165!#
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- BCN -->
#!string!message_0160!# &nbsp;
</td>
<td>
#!string!message_0131!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- SN -->
#!string!message_0161!# &nbsp;
</td>
<td>
#!string!message_0132!#
</td>
</tr>
<tr style="border: 1px dotted #7f7f7f;">
<td class="column_header">
<!-- IFN -->
#!string!message_0162!# &nbsp;
</td>
<td>
#!string!message_0133!#
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- end manifest-step3 -->
<!-- start fence-agent-configuration -->
<table align="center" class="anvil_main_menu">
<script type="text/javascript" src="/skins/alteeve/anvil.js"></script>

@ -180,6 +180,8 @@ The error was:
<key name="error_0119">The IP given for the network: [#!variable!name!#] does not appear to be the network base IP. Did you mean: [#!variable!ip!#]?</key>
<key name="error_0120">The IP given for the network: [#!variable!network!#] with the subnet mask: [#!variable!subnet!#] does not appear to be a valid network range.</key>
<key name="error_0121">The gateway: [#!variable!gateway!#] does not apear to be in the network: [#!variable!network!#]/[#!variable!subnet!#].</key>
<key name="error_0122">An NTP entry is bad. One or more IPv4 addresses can be specified, with a comma separating multiple IPs.</key>
<key name="error_0123">The MTU needs to be a positive integer equal or above '512' bytes.</key>
<!-- Table headers -->
<key name="header_0001">Current Network Interfaces and States</key>
@ -1361,6 +1363,14 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="striker_0247">This is the domain name you would like to use for this #!string!brand_0006!#. This will be used in the next step when setting default hostnames for various devices.</key>
<key name="striker_0248">The second step specified the networks (subnets) that will be used for each network. Generally, you only want to change the IFN(s). The BCN and SN are always '/16' subnets and should only be changed if they conflict with an existing IFN.</key>
<key name="striker_0249">Default</key>
<key name="striker_0250">The third step is where it all comes together!</key>
<key name="striker_0251"><![CDATA[<a href="https://en.wikipedia.org/wiki/Network_Time_Protocol" target="_new">NTP</a>]]></key>
<key name="striker_0252"><![CDATA[You can specify which network time servers to use, if necessary. You can use commas to specify two or more <a href="https://en.wikipedia.org/wiki/Network_Time_Protocol" target="_new">NTP</a> servers.]]></key>
<key name="striker_0253"><![CDATA[<a href="https://en.wikipedia.org/wiki/Maximum_transmission_unit" target="_new">MTU<a/>]]></key>
<key name="striker_0254"><![CDATA[If you network supports "Jumbo Frames" (maximum transmission unit size, <a href="https://en.wikipedia.org/wiki/Maximum_transmission_unit" target="_new">MTU<a/>, over 1500 bytes), you can specify the maximum size in bytes here. Be sure all equipment support your chosen MTU size! When in doubt, leave this set to 1500.]]></key>
<key name="striker_0255">Node 1</key>
<key name="striker_0256">Node 2</key>
<key name="striker_0257">DR Host</key>
<!-- These are generally units and appended to numbers -->
<key name="suffix_0001">#!variable!number!#/sec</key>

@ -15,47 +15,54 @@ if (($running_directory =~ /^\./) && ($ENV{PWD}))
# Turn off buffering so that the pinwheel will display while waiting for the SSH call(s) to complete.
$| = 1;
# 2.75 = 69.85 - use up to 55 mm
# 2.25 = 57.15 - use up to 45 mm
# 1.75 = 44.45 - use up to 30 mm
# 1.25 = 31.75 - use up to 20 mm
my $one_two_five = [];
my $one_seven_five = [];
my $two_two_five = [];
my $two_seven_five = [];
my $data = "26,31,25,22,24,23,,
,36,37,34,30,38,35,,
,43,43,42,34,39,35,,
,47,47,48,40,33,31,23,17,
,47,47,41,37,35,22,19,8,11
,42,42,46,50,39,27,21,5,10
,42,40,43,49,35,33,30,26,
,39,39,36,39,31,28,25,25,
,36,35,32,29,19,20,15,15,
,33,31,31,15,21,23,17,11,
,31,33,30,23,26,21,20,14,
,23,42,26,17,12,20,16,20";
foreach my $line (split/\n/, $data)
foreach my $i (1..6)
{
foreach my $depth (split/,/, $line)
{
next if not $depth;
if ($depth >= 45) { push @{$two_seven_five}, $depth; }
elsif ($depth >= 30) { push @{$two_two_five}, $depth; }
elsif ($depth >= 20) { push @{$one_seven_five}, $depth; }
else { push @{$one_two_five}, $depth; }
}
my $out = 8 + (2 * $i);
print "$i: [$out]\n";
}
print "2.75\": [".@{$two_seven_five}."]\n";
print "2.25\": [".@{$two_two_five}."]\n";
print "1.75\": [".@{$one_seven_five}."]\n";
print "1.25\": [".@{$one_two_five}."]\n";
print "Total: [".(@{$two_seven_five} + @{$two_two_five} + @{$one_seven_five} + @{$one_two_five})."]\n";
# # 2.75 = 69.85 - use up to 55 mm
# # 2.25 = 57.15 - use up to 45 mm
# # 1.75 = 44.45 - use up to 30 mm
# # 1.25 = 31.75 - use up to 20 mm
#
# my $one_two_five = [];
# my $one_seven_five = [];
# my $two_two_five = [];
# my $two_seven_five = [];
#
# my $data = "26,31,25,22,24,23,,
# ,36,37,34,30,38,35,,
# ,43,43,42,34,39,35,,
# ,47,47,48,40,33,31,23,17,
# ,47,47,41,37,35,22,19,8,11
# ,42,42,46,50,39,27,21,5,10
# ,42,40,43,49,35,33,30,26,
# ,39,39,36,39,31,28,25,25,
# ,36,35,32,29,19,20,15,15,
# ,33,31,31,15,21,23,17,11,
# ,31,33,30,23,26,21,20,14,
# ,23,42,26,17,12,20,16,20";
#
#
# foreach my $line (split/\n/, $data)
# {
# foreach my $depth (split/,/, $line)
# {
# next if not $depth;
# if ($depth >= 45) { push @{$two_seven_five}, $depth; }
# elsif ($depth >= 30) { push @{$two_two_five}, $depth; }
# elsif ($depth >= 20) { push @{$one_seven_five}, $depth; }
# else { push @{$one_two_five}, $depth; }
# }
# }
#
# print "2.75\": [".@{$two_seven_five}."]\n";
# print "2.25\": [".@{$two_two_five}."]\n";
# print "1.75\": [".@{$one_seven_five}."]\n";
# print "1.25\": [".@{$one_two_five}."]\n";
# print "Total: [".(@{$two_seven_five} + @{$two_two_five} + @{$one_seven_five} + @{$one_two_five})."]\n";
# my $anvil = Anvil::Tools->new({debug => 3});
# $anvil->Log->secure({set => 1});

Loading…
Cancel
Save