Commit f7ef98f5 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Treat external_subport field as a URN and not an interface id.

Also, multiple ports on the same contact node will now be consolidated into one stitch:node tag with multiple stitch:port children.
parent 16059fee
...@@ -416,8 +416,13 @@ while (my ($cnode, $ccard, $cport, $ciface, $enode, $ecard, $eport, $eiface, ...@@ -416,8 +416,13 @@ while (my ($cnode, $ccard, $cport, $ciface, $enode, $ecard, $eport, $eiface,
if (! defined($ciface)) { if (! defined($ciface)) {
$ciface = "$ccard.$cport"; $ciface = "$ccard.$cport";
} }
my $ciface_urn;
if (defined($subport)) { if (defined($subport)) {
$ciface = $subport; $ciface_urn = $subport;
} else {
$ciface_urn = GeniHRN::GenerateInterface($OURDOMAIN,
$cnode,
$ciface);
} }
if (! defined($external_iface_urn)) { if (! defined($external_iface_urn)) {
$external_iface_urn = $external_network_iface_urn; $external_iface_urn = $external_network_iface_urn;
...@@ -434,9 +439,7 @@ while (my ($cnode, $ccard, $cport, $ciface, $enode, $ecard, $eport, $eiface, ...@@ -434,9 +439,7 @@ while (my ($cnode, $ccard, $cport, $ciface, $enode, $ecard, $eport, $eiface,
} else { } else {
$contact_nodes{$cnode} = [$enode]; $contact_nodes{$cnode} = [$enode];
} }
$contact_ifaces{"$cnode:$enode"} = GeniHRN::GenerateInterface($OURDOMAIN, $contact_ifaces{"$cnode:$enode"} = $ciface_urn;
$cnode,
$ciface);
} }
print_header(); print_header();
...@@ -2192,15 +2195,7 @@ sub print_footer { ...@@ -2192,15 +2195,7 @@ sub print_footer {
foreach my $node (keys(%contact_nodes)) { foreach my $node (keys(%contact_nodes)) {
foreach my $external (@{ $contact_nodes{$node} }) { print_stitch_node($node);
my $vlans = $external_nodes{$external};
if (defined($external_links{"$node:$external"})) {
print_stitch_node($node,
$contact_ifaces{"$node:$external"},
$external_ifaces{"$node:$external"},
1000000, $vlans, 0);
}
}
} }
print "</aggregate>\n"; print "</aggregate>\n";
print "</stitching>\n"; print "</stitching>\n";
...@@ -2935,18 +2930,33 @@ sub print_type_relation ...@@ -2935,18 +2930,33 @@ sub print_type_relation
} }
sub print_stitch_node sub print_stitch_node
{
my ($node) = @_;
my $node_urn = GeniHRN::Generate($OURDOMAIN, "node", $node);
print "<node id=\"$node_urn\">\n";
foreach my $external (@{ $contact_nodes{$node} }) {
my $vlans = $external_nodes{$external};
if (defined($external_links{"$node:$external"})) {
print_stitch_port($node,
$contact_ifaces{"$node:$external"},
$external_ifaces{"$node:$external"},
1000000, $vlans, 0);
}
}
print "</node>\n";
}
sub print_stitch_port
{ {
my ($node, $iface_urn, $remote_iface_urn, $capacity, my ($node, $iface_urn, $remote_iface_urn, $capacity,
$vlans, $vlan_will_translate) = @_; $vlans, $vlan_will_translate) = @_;
my (undef, undef, $iface) = GeniHRN::ParseInterface($iface_urn); my (undef, undef, $iface) = GeniHRN::ParseInterface($iface_urn);
my $node_urn = GeniHRN::Generate($OURDOMAIN, "node", $node);
my $port_urn = GeniHRN::Generate($OURDOMAIN, "stitchport", my $port_urn = GeniHRN::Generate($OURDOMAIN, "stitchport",
$node . "//" . $iface); $node . "//" . $iface);
my $vlan_translate = "false"; my $vlan_translate = "false";
if ($vlan_will_translate) { if ($vlan_will_translate) {
$vlan_translate = "true"; $vlan_translate = "true";
} }
print "<node id=\"$node_urn\">\n";
print " <port id=\"$port_urn\">\n"; print " <port id=\"$port_urn\">\n";
print " <capacity>$capacity</capacity>\n"; print " <capacity>$capacity</capacity>\n";
print " <maximumReservableCapacity>$capacity". print " <maximumReservableCapacity>$capacity".
...@@ -2977,7 +2987,6 @@ sub print_stitch_node ...@@ -2977,7 +2987,6 @@ sub print_stitch_node
print " </switchingCapabilityDescriptor>\n"; print " </switchingCapabilityDescriptor>\n";
print " </link>\n"; print " </link>\n";
print " </port>\n"; print " </port>\n";
print "</node>\n";
} }
sub fatal($) sub fatal($)
......
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