* Added missing foreign key references to the SQL schema.
* Added support to tools/anvil-update-states to connect bonds to bridges, as appropriate.
* Finished the logic in test.pl to pull the network data (with connections between bridges, bonds and interfaces) needed for the WebUI.
Signed-off-by: Digimer <digimer@alteeve.ca>
foreach my $bridge_name (sort {$a cmp $b} keys %{$anvil->data->{bridge}{'local'}})
foreach my $bridge_name (sort {$a cmp $b} keys %{$anvil->data->{bridge}{'local'}})
{
{
my $bridge_uuid = $anvil->data->{bridge_by_name}{$bridge_name};
my $bridge_uuid = $anvil->data->{bridge_by_name}{$bridge_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
bridge_name => $bridge_name,
bridge_name => $bridge_name,
bridge_uuid => $bridge_uuid,
bridge_uuid => $bridge_uuid,
}});
}});
foreach my $interface_name (sort {$a cmp $b} @{$anvil->data->{bridge}{'local'}{$bridge_name}{interfaces}})
foreach my $interface_name (sort {$a cmp $b} @{$anvil->data->{bridge}{'local'}{$bridge_name}{interfaces}})
{
{
my $interface_uuid = exists $anvil->data->{bond_by_name}{$interface_name} ? $anvil->data->{bond_by_name}{$interface_name} : $anvil->data->{interface_by_name}{$interface_name};
my $interface_uuid = exists $anvil->data->{interface_by_name}{$interface_name} ? $anvil->data->{interface_by_name}{$interface_name} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
my $bond_uuid = exists $anvil->data->{bond_by_name}{$interface_name} ? $anvil->data->{bond_by_name}{$interface_name} : "";
interface_name => $interface_name,
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
interface_uuid => $interface_uuid,
's1:interface_name' => $interface_name,
's2:interface_uuid' => $interface_uuid,
's3:bond_uuid' => $bond_uuid,
}});
}});
# Read the interface_bridge_uuid and, if it doesn't match, update it.
# Is this interface a bond or an interface?
my $query = "SELECT network_interface_bridge_uuid FROM network_interfaces WHERE network_interface_uuid = ".$anvil->Database->quote($interface_uuid).";";
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
results => $results,
count => $count,
}});
my $interface_bridge_uuid = defined $results->[0]->[0] ? $results->[0]->[0] : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { interface_bridge_uuid => $interface_bridge_uuid }});
if (($bridge_uuid) && ($interface_bridge_uuid ne $bridge_uuid))
{
{
# Update it.
# Read the interface_bridge_uuid and, if it doesn't match, update it.
my $query = "
my $query = "SELECT network_interface_bridge_uuid FROM network_interfaces WHERE network_interface_uuid = ".$anvil->Database->quote($interface_uuid).";";
print$spaces." Up delay: [".$say_up_delay." (".$up_delay.")], Down delay: [".$say_down_delay." (".$down_delay.")], MII polling interval: [".$mii_polling_interval."]\n";
print" Up delay: [".$say_up_delay." (".$up_delay.")], Down delay: [".$say_down_delay." (".$down_delay.")], MII polling interval: [".$mii_polling_interval."]\n";