diff --git a/protocols/bmp/packet/initiation_message.go b/protocols/bmp/packet/initiation_message.go index 6a3c02f6276f2bd610cfba56b31148427db55d90..076d0f4b8a7c9713b1f75a76086c310140daf28f 100644 --- a/protocols/bmp/packet/initiation_message.go +++ b/protocols/bmp/packet/initiation_message.go @@ -16,11 +16,6 @@ func (im *InitiationMessage) MsgType() uint8 { return im.CommonHeader.MsgType } -// SetCommonHeader sets the common header -func (im *InitiationMessage) SetCommonHeader(ch *CommonHeader) { - im.CommonHeader = ch -} - func decodeInitiationMessage(buf *bytes.Buffer, ch *CommonHeader) (Msg, error) { im := &InitiationMessage{ TLVs: make([]*InformationTLV, 0, 2), diff --git a/protocols/bmp/packet/initiation_message_test.go b/protocols/bmp/packet/initiation_message_test.go index fdd327371f576a06ecc16aed06c254aeff96a163..4513a2bed89f4e7c448e4ef87b432e6a68b4c1c1 100644 --- a/protocols/bmp/packet/initiation_message_test.go +++ b/protocols/bmp/packet/initiation_message_test.go @@ -7,6 +7,17 @@ import ( "github.com/stretchr/testify/assert" ) +func TestInitiationMessageMsgType(t *testing.T) { + pd := &InitiationMessage{ + CommonHeader: &CommonHeader{ + MsgType: 100, + }, + } + + if pd.MsgType() != 100 { + t.Errorf("Unexpected result") + } +} func TestDecodeInitiationMessage(t *testing.T) { tests := []struct { name string diff --git a/protocols/bmp/packet/peer_down_test.go b/protocols/bmp/packet/peer_down_test.go index 01d7dac8db6dd65dbebbbf68b90ff5baf65ed420..61f2e9a6d76ee3900c55ba32851e900d57fcb698 100644 --- a/protocols/bmp/packet/peer_down_test.go +++ b/protocols/bmp/packet/peer_down_test.go @@ -7,6 +7,18 @@ import ( "github.com/stretchr/testify/assert" ) +func TestPeerDownMsgType(t *testing.T) { + pd := &PeerDownNotification{ + CommonHeader: &CommonHeader{ + MsgType: 100, + }, + } + + if pd.MsgType() != 100 { + t.Errorf("Unexpected result") + } +} + func TestDecodePeerDownNotification(t *testing.T) { tests := []struct { name string diff --git a/protocols/bmp/packet/peer_up_test.go b/protocols/bmp/packet/peer_up_test.go index c3c2c35f317ab2a08ae01423db74c8b11dc56448..240f38abba6682eda3e7d6e755d2a1759f6aab88 100644 --- a/protocols/bmp/packet/peer_up_test.go +++ b/protocols/bmp/packet/peer_up_test.go @@ -7,6 +7,17 @@ import ( "github.com/stretchr/testify/assert" ) +func TestPeerUpMsgType(t *testing.T) { + pd := &PeerUpNotification{ + CommonHeader: &CommonHeader{ + MsgType: 100, + }, + } + + if pd.MsgType() != 100 { + t.Errorf("Unexpected result") + } +} func TestDecodePeerUp(t *testing.T) { tests := []struct { name string diff --git a/protocols/bmp/packet/route_mirroring_test.go b/protocols/bmp/packet/route_mirroring_test.go index dd885aca49d74c545b05798cb47df882e18693c7..c62799a37a2c1bfa53c01eafb90979aa896716be 100644 --- a/protocols/bmp/packet/route_mirroring_test.go +++ b/protocols/bmp/packet/route_mirroring_test.go @@ -7,6 +7,17 @@ import ( "github.com/stretchr/testify/assert" ) +func TestRouteMirrorType(t *testing.T) { + pd := &RouteMirroringMsg{ + CommonHeader: &CommonHeader{ + MsgType: 100, + }, + } + + if pd.MsgType() != 100 { + t.Errorf("Unexpected result") + } +} func TestDecodeRouteMirroringMsg(t *testing.T) { tests := []struct { name string diff --git a/protocols/bmp/packet/route_monitoring_test.go b/protocols/bmp/packet/route_monitoring_test.go index c6cee1f7f1aea3e48bcf57177fcc0f34b2aaf1d8..d28169346d6312f757fd317b879c55e20dd43847 100644 --- a/protocols/bmp/packet/route_monitoring_test.go +++ b/protocols/bmp/packet/route_monitoring_test.go @@ -7,6 +7,17 @@ import ( "github.com/stretchr/testify/assert" ) +func TestRouteMonitoringMsgType(t *testing.T) { + pd := &RouteMonitoringMsg{ + CommonHeader: &CommonHeader{ + MsgType: 100, + }, + } + + if pd.MsgType() != 100 { + t.Errorf("Unexpected result") + } +} func TestDecodeRouteMonitoringMsg(t *testing.T) { tests := []struct { name string diff --git a/protocols/bmp/packet/stats_report_test.go b/protocols/bmp/packet/stats_report_test.go index f3a6329dbba9e7d38e90b6a8f2e97147fdc39f91..2fc47cbb4a1b69c55834af7db122215dfdf32a2b 100644 --- a/protocols/bmp/packet/stats_report_test.go +++ b/protocols/bmp/packet/stats_report_test.go @@ -7,6 +7,18 @@ import ( "github.com/stretchr/testify/assert" ) +func TestStatsReportMsgType(t *testing.T) { + pd := &StatsReport{ + CommonHeader: &CommonHeader{ + MsgType: 100, + }, + } + + if pd.MsgType() != 100 { + t.Errorf("Unexpected result") + } +} + func TestDecodeStatsReport(t *testing.T) { tests := []struct { name string diff --git a/protocols/bmp/packet/termination_message_test.go b/protocols/bmp/packet/termination_message_test.go index 052290bdf74fc8b268aa4f18f275b10bde93c05d..412704b8693e170d505bebfb42f786338bd5bb3d 100644 --- a/protocols/bmp/packet/termination_message_test.go +++ b/protocols/bmp/packet/termination_message_test.go @@ -7,6 +7,17 @@ import ( "github.com/stretchr/testify/assert" ) +func TestTerminationMessageType(t *testing.T) { + pd := &TerminationMessage{ + CommonHeader: &CommonHeader{ + MsgType: 100, + }, + } + + if pd.MsgType() != 100 { + t.Errorf("Unexpected result") + } +} func TestDecodeTerminationMessage(t *testing.T) { tests := []struct { name string