diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-05-17 11:07:18 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-05-22 13:12:02 +0900 |
commit | 5bb073815657d605c77376a51e6219a593eb7af6 (patch) | |
tree | 08a6539364618a0cffc42c4930831937b21b1510 /packet/bmp/bmp_test.go | |
parent | fa1378f58bb6306e0c327f2a69a798a46c9865a4 (diff) |
packet/bmp: Implement BMPStatisticsReport serializer
Currently, only parser for BMPStatisticsReport is implemented and does
not support the per-AFI/SAFI stats TLV types.
This patch implements BMPStatisticsReport serializer and re-implements
the stats TLV parser/serializer to support the missing TLV types.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'packet/bmp/bmp_test.go')
-rw-r--r-- | packet/bmp/bmp_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packet/bmp/bmp_test.go b/packet/bmp/bmp_test.go index 3d7737e0..5e70710f 100644 --- a/packet/bmp/bmp_test.go +++ b/packet/bmp/bmp_test.go @@ -67,6 +67,19 @@ func Test_RouteMonitoring(t *testing.T) { verify(t, NewBMPRouteMonitoring(*p0, m)) } +func Test_StatisticsReport(t *testing.T) { + p0 := NewBMPPeerHeader(0, 0, 1000, "10.0.0.1", 70000, "10.0.0.2", 1) + s0 := NewBMPStatisticsReport( + *p0, + []BMPStatsTLVInterface{ + NewBMPStatsTLV32(BMP_STAT_TYPE_REJECTED, 100), + NewBMPStatsTLV64(BMP_STAT_TYPE_ADJ_RIB_IN, 200), + NewBMPStatsTLVPerAfiSafi64(BMP_STAT_TYPE_PER_AFI_SAFI_LOC_RIB, bgp.AFI_IP, bgp.SAFI_UNICAST, 300), + }, + ) + verify(t, s0) +} + func Test_BogusHeader(t *testing.T) { h, err := ParseBMPMessage(make([]byte, 10)) assert.Nil(t, h) |