summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/ztpv6/parse_remote_id_test.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2019-12-28 03:39:31 -0800
committerChris K <c@chrisko.ch>2020-03-09 15:38:59 -0700
commit94e5923c9c44b0e829d793508e6772e6a96feb47 (patch)
treecaca593a883f537a376682aa90312123b929a214 /dhcpv6/ztpv6/parse_remote_id_test.go
parenta3af88f6782eba884ef5216b987bf4e2a96ff033 (diff)
v6: add RemoteID getter to RelayOptions
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/ztpv6/parse_remote_id_test.go')
-rw-r--r--dhcpv6/ztpv6/parse_remote_id_test.go14
1 files changed, 6 insertions, 8 deletions
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)
}