Skip to content
Snippets Groups Projects
Unverified Commit 1337ccc9 authored by Daniel Czerwonk's avatar Daniel Czerwonk Committed by GitHub
Browse files

Merge pull request #24 from bio-routing/bug/fixEmptyASPath

Adding support for empty AS paths
parents 02ba36de a7def170
No related branches found
No related tags found
No related merge requests found
...@@ -467,6 +467,10 @@ func ParseASPathStr(asPathString string) (*PathAttribute, error) { ...@@ -467,6 +467,10 @@ func ParseASPathStr(asPathString string) (*PathAttribute, error) {
newSegmentNeeded := true newSegmentNeeded := true
currentSegment := -1 currentSegment := -1
for _, asn := range strings.Split(asPathString, " ") { for _, asn := range strings.Split(asPathString, " ") {
if asn == "" {
continue
}
if isBeginOfASSet(asn) { if isBeginOfASSet(asn) {
currentType = ASSet currentType = ASSet
newSegmentNeeded = true newSegmentNeeded = true
......
...@@ -1298,6 +1298,15 @@ func TestParseASPathStr(t *testing.T) { ...@@ -1298,6 +1298,15 @@ func TestParseASPathStr(t *testing.T) {
wantFail bool wantFail bool
expected *PathAttribute expected *PathAttribute
}{ }{
{
name: "Empty AS Path",
input: "",
wantFail: false,
expected: &PathAttribute{
TypeCode: ASPathAttr,
Value: ASPath{},
},
},
{ {
name: "Simple AS_SEQUENCE", name: "Simple AS_SEQUENCE",
input: "3320 15169", input: "3320 15169",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment