Commit 8ae61ad7 authored by Leigh Stoller's avatar Leigh Stoller

Add conversion support for fixed ifaces. Closes issue #290.

parent d0ee85be
......@@ -1053,11 +1053,13 @@ sub addNode($$$)
#
# Interfaces are simple.
#
my $client_id = GetTextOrFail("client_id", $ref);
my $ip = GeniXML::GetIp($ref, $ref->parentNode);
my $mask = GeniXML::GetMask($ref, $ref->parentNode);
my $client_id = GetTextOrFail("client_id", $ref);
my $ip = GeniXML::GetIp($ref, $ref->parentNode);
my $mask = GeniXML::GetMask($ref, $ref->parentNode);
my $component_id = GeniXML::GetNodeId($ref);
APT_Rspec::Iface->new($rspec, $node, $client_id, $ip, $mask);
APT_Rspec::Iface->new($rspec, $node,
$client_id, $ip, $mask, $component_id);
};
#
......@@ -1251,17 +1253,18 @@ use English;
use GeniXML;
use GeniHRN;
sub new($$$$$$)
sub new($$$$$$$)
{
my ($class, $rspec, $node, $client_id, $ip, $mask) = @_;
my ($class, $rspec, $node, $client_id, $ip, $mask, $component_id) = @_;
my $self = {
"client_id" => $client_id,
"node_id" => $node->client_id(),
"ip" => $ip,
"mask" => $mask,
"statements" => [],
"tag" => "iface" . scalar(keys(%{$rspec->ifaces()})),
"client_id" => $client_id,
"node_id" => $node->client_id(),
"ip" => $ip,
"mask" => $mask,
"component_id" => $component_id,
"statements" => [],
"tag" => "iface" . scalar(keys(%{$rspec->ifaces()})),
};
bless($self, $class);
$rspec->addIface($self);
......@@ -1272,6 +1275,7 @@ sub client_id($) { return $_[0]->{'client_id'}; }
sub node_id($) { return $_[0]->{'node_id'}; }
sub ip($) { return $_[0]->{'ip'}; }
sub mask($) { return $_[0]->{'mask'}; }
sub component_id($) { return $_[0]->{'component_id'}; }
sub statements($) { return $_[0]->{'statements'}; }
sub tag($) { return $_[0]->{'tag'}; }
......@@ -1309,7 +1313,7 @@ sub Compare($$)
# cause of the alternate naming issue (node:id).
last SWITCH;
};
/^(node_id|ip|mask)$/i && do {
/^(node_id|ip|mask|component_id)$/i && do {
return 1
if (APT_Rspec::CompareValues("Iface: $client_id: $key",
$val1,$val2));
......
......@@ -339,10 +339,11 @@ sub GenerateNodeStatements($)
# Interfaces.
#
foreach my $iface (@{$node->ifacelist()}) {
my $iface_id = $iface->{'client_id'};
my $itag = $iface->{'tag'};
my $ip = $iface->{'ip'};
my $mask = $iface->{'mask'};
my $iface_id = $iface->{'client_id'};
my $itag = $iface->{'tag'};
my $ip = $iface->{'ip'};
my $mask = $iface->{'mask'};
my $component_id = $iface->{'component_id'};
#
# geni-lib is going to name the interfaces as node_id:iface_id
......@@ -375,6 +376,10 @@ sub GenerateNodeStatements($)
else {
$node->addStatement("$itag = ${ntag}.addInterface('$iface_id'" .
(defined($addr) ? ", $addr" : "") . ")");
if (defined($component_id)) {
$node->addStatement("${itag}.component_id = ".
"'$component_id'");
}
}
}
foreach my $id (sort(keys(%{$node->{'blockstores'}}))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment