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