Commit e5c3a4c5 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Change protolan so that an iface can reference an underlying member.

parent 7c1e5607
......@@ -1854,21 +1854,24 @@ sub Instantiate($)
my $vnode = $protomember->{'vnode'};
my $vport = $protomember->{'vport'};
my $iface = $protomember->{'iface'};
my $attributes = $protomember->{'attrs'};
my $interface = $lan->AddInterface($node, $vnode, $vport, $iface);
my $pport = $protomember->{'pport'};
my $member;
if (defined($pport)) {
$member = $lan->AddMember($node, $pport);
if (!defined($member)) {
$lan->Destroy();
return -1;
}
}
my $interface =
$lan->AddInterface($node, $vnode, $vport, $iface, $member);
if (!defined($interface)) {
$lan->Destroy();
return -1;
}
if (defined($attributes)) {
foreach my $attrkey (keys(%{$attributes})) {
my $attrvalue = $attributes->{$attrkey};
$interface->SetAttribute($attrkey, $attrvalue);
}
}
}
$self->{'INSTANCE'} = $lan;
return 0;
......@@ -1965,8 +1968,12 @@ sub Dump($)
my $vnode = $interface->{'vnode'};
my $vport = $interface->{'vport'};
my $iface = $interface->{'iface'};
my $pport = $interface->{'pport'};
$string .= "$vnode:$vport:$nodeid:$iface, ";
$string .= "$vnode:$vport:$nodeid:$iface";
$string .= ":$pport"
if (defined($pport));
$string .= ", ";
}
return $string;
}
......@@ -1976,7 +1983,7 @@ sub Dump($)
#
sub AddInterface($$$$$;$)
{
my ($self, $node, $vnode, $vport, $iface, $attributes) = @_;
my ($self, $node, $vnode, $vport, $iface, $pport) = @_;
if (!ref($node)) {
$node = Node->Lookup($node);
......@@ -1994,7 +2001,7 @@ sub AddInterface($$$$$;$)
"vnode" => $vnode,
"vport" => $vport,
"iface" => $iface,
"attrs" => $attributes,
"pport" => $pport,
};
return 0;
}
......
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