Commit 9caa8436 authored by Gary Wong's avatar Gary Wong

Bug fix: GetTicket was failing to handle links when specified with fixed

interfaces given as URNs.
parent 12516745
......@@ -837,6 +837,10 @@ sub GetTicket($;$)
}
my $iface_ref = $ifacemap{$node_nickname}->{$iface_id}->{"rspec"};
my $iface_name = $iface_ref->{"component_id"} || "";
if( GeniHRN::IsValid( $iface_name ) ) {
my ($urn_authority,$urn_node,$urn_iface) = GeniHRN::ParseInterface( $iface_name );
$iface_name = $urn_iface;
}
my $iface_vport = $ifacemap{$node_nickname}->{$iface_id}->{"vport"};
# XXX
......
......@@ -68,7 +68,7 @@ sub IsValid($)
# mandatory: partly to avoid ambiguity between resource type
# namespaces, and partly to avoid ambiguity between a resource-type
# and a resource-name containing (escaped) whitespace.
return $hrn =~ m'^[uU][rR][nN]:[pP][uU][bB][lL][iI][cC][iI][dD]:IDN\+[A-Za-z0-9.-]+(?::[A-Za-z0-9.-]+)*\+\w+\+(?:[-!$()*,.0-9=@A-Z_a-z]|(?:%[0-9A-Fa-f][0-9A-Fa-f]))+$';
return $hrn =~ m'^[uU][rR][nN]:[pP][uU][bB][lL][iI][cC][iI][dD]:IDN\+[A-Za-z0-9.-]+(?::[A-Za-z0-9.-]+)*\+\w+\+(?:[-!$()*,./0-9:=@A-Z_a-z]|(?:%[0-9A-Fa-f][0-9A-Fa-f]))+$';
}
# Perform RFC 3151 transcription (from a string of legal public identifier
......@@ -233,5 +233,19 @@ sub GenerateInterface($$$)
return Generate( $authority, "interface", $node . "//" . $interface );
}
# Undo the GenerateInterface into a authority/name/interface triplet.
sub ParseInterface($)
{
my ($urn) = @_;
my ($authority,$type,$id) = Parse( $urn );
return undef if $type ne "interface";
return undef unless $id =~ m{(.*)//(.*)};
return ( $authority, $1, $2 );
}
# _Always_ make sure that this 1 is at the end of the file...
1;
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