summaryrefslogtreecommitdiffhomepage
path: root/packet/validate_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'packet/validate_test.go')
-rw-r--r--packet/validate_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/packet/validate_test.go b/packet/validate_test.go
new file mode 100644
index 00000000..3bdb0949
--- /dev/null
+++ b/packet/validate_test.go
@@ -0,0 +1,29 @@
+package bgp
+
+import (
+ "github.com/stretchr/testify/assert"
+ "testing"
+)
+
+func update1() *BGPMessage {
+ aspath := []AsPathParamInterface{
+ NewAsPathParam(2, []uint16{65001}),
+ }
+
+ p := []PathAttributeInterface{
+ NewPathAttributeOrigin(1),
+ NewPathAttributeAsPath(aspath),
+ NewPathAttributeNextHop("192.168.1.1"),
+ }
+
+ n := []NLRInfo{*NewNLRInfo(24, "10.10.10.0")}
+ return NewBGPUpdateMessage(nil, p, n)
+}
+
+func Test_Validate_OK(t *testing.T) {
+ message := update1().Body.(*BGPUpdate)
+ res, err := ValidateUpdateMsg(message)
+ assert.Equal(t, true, res)
+ assert.NoError(t, err)
+
+}