From 94e5923c9c44b0e829d793508e6772e6a96feb47 Mon Sep 17 00:00:00 2001 From: Chris Koch Date: Sat, 28 Dec 2019 03:39:31 -0800 Subject: v6: add RemoteID getter to RelayOptions Signed-off-by: Chris Koch --- dhcpv6/ztpv6/parse_remote_id_test.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'dhcpv6/ztpv6/parse_remote_id_test.go') diff --git a/dhcpv6/ztpv6/parse_remote_id_test.go b/dhcpv6/ztpv6/parse_remote_id_test.go index 3f4c02e..48d20bc 100644 --- a/dhcpv6/ztpv6/parse_remote_id_test.go +++ b/dhcpv6/ztpv6/parse_remote_id_test.go @@ -64,16 +64,14 @@ func TestParseRemoteID(t *testing.T) { } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { - packet, err := dhcpv6.NewMessage() - if err != nil { - t.Fatalf("failed to creat dhcpv6 packet object: %v", err) + m := &dhcpv6.RelayMessage{ + MessageType: dhcpv6.MessageTypeRelayForward, } - opt := dhcpv6.OptRemoteId{} - opt.SetRemoteID(tc.circuit) - opt.SetEnterpriseNumber(1234) - packet.AddOption(&opt) + // Has to be a well-formed relay message with the OptRelayMsg. + m.Options.Add(dhcpv6.OptRelayMessage(&dhcpv6.Message{})) + m.Options.Add(&dhcpv6.OptRemoteID{RemoteID: tc.circuit, EnterpriseNumber: 1234}) - circuit, err := ParseRemoteId(packet) + circuit, err := ParseRemoteID(m) if err != nil && !tc.fail { t.Errorf("unexpected failure: %v", err) } -- cgit v1.2.3