-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from bio-routing/feature/ipfix
Add IPFIX support
- Loading branch information
Showing
13 changed files
with
524 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ipfix | ||
|
||
import ( | ||
"testing" | ||
"unsafe" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDecodeTemplate(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
pkt *Packet | ||
end unsafe.Pointer | ||
size uintptr | ||
expected *Packet | ||
}{ | ||
{ | ||
name: "Test #1", | ||
pkt: &Packet{ | ||
Templates: make([]*TemplateRecords, 0), | ||
}, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
decodeTemplate(test.pkt, test.end, test.size) | ||
assert.Equal(t, test.expected, test.pkt, test.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package ipfix | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestIsEnterprise(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
tmpl *TemplateRecord | ||
expected bool | ||
}{ | ||
{ | ||
name: "test #1", | ||
tmpl: &TemplateRecord{ | ||
Type: 0, | ||
}, | ||
expected: false, | ||
}, | ||
{ | ||
name: "test #2", | ||
tmpl: &TemplateRecord{ | ||
Type: 65535, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "test #3", | ||
tmpl: &TemplateRecord{ | ||
Type: 32768, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "test #4", | ||
tmpl: &TemplateRecord{ | ||
Type: 32767, | ||
}, | ||
expected: false, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
assert.Equal(t, test.expected, test.tmpl.isEnterprise(), test.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.