diff options
author | Chris Koch <chrisko@google.com> | 2019-12-28 00:57:21 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2020-03-05 15:51:55 +0000 |
commit | c483f8beb41f894c3d9c5adf0781c73ca1fbd7ac (patch) | |
tree | 73f0afcf6f50af83220f4f2d67e7edbc2cb71326 /dhcpv6/dhcpv6_test.go | |
parent | 8d3e32a40580e3e227f64d9068f84b321e7921b2 (diff) |
v6: add ClientID getter
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/dhcpv6_test.go')
-rw-r--r-- | dhcpv6/dhcpv6_test.go | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go index b23a858..6f476a1 100644 --- a/dhcpv6/dhcpv6_test.go +++ b/dhcpv6/dhcpv6_test.go @@ -165,11 +165,9 @@ func TestNewAdvertiseFromSolicit(t *testing.T) { MessageType: MessageTypeSolicit, TransactionID: TransactionID{0xa, 0xb, 0xc}, } - cid := OptClientId{} - s.AddOption(&cid) - duid := Duid{} + s.AddOption(OptClientID(Duid{})) - a, err := NewAdvertiseFromSolicit(&s, WithServerID(duid)) + a, err := NewAdvertiseFromSolicit(&s, WithServerID(Duid{})) require.NoError(t, err) require.Equal(t, a.TransactionID, s.TransactionID) require.Equal(t, a.Type(), MessageTypeAdvertise) @@ -180,11 +178,10 @@ func TestNewReplyFromMessage(t *testing.T) { TransactionID: TransactionID{0xa, 0xb, 0xc}, MessageType: MessageTypeConfirm, } - cid := OptClientId{} - msg.AddOption(&cid) + var duid Duid + msg.AddOption(OptClientID(duid)) sid := OptServerId{} - duid := Duid{} - sid.Sid = duid + sid.Sid = Duid{} msg.AddOption(&sid) rep, err := NewReplyFromMessage(&msg, WithServerID(duid)) @@ -242,11 +239,9 @@ func TestNewMessageTypeSolicit(t *testing.T) { require.Equal(t, s.Type(), MessageTypeSolicit) // Check CID - cidOption := s.GetOneOption(OptionClientID) - require.NotNil(t, cidOption) - cid, ok := cidOption.(*OptClientId) - require.True(t, ok) - require.Equal(t, cid.Cid, duid) + cduid := s.Options.ClientID() + require.NotNil(t, cduid) + require.Equal(t, cduid, &duid) // Check ORO oroOption := s.GetOneOption(OptionORO) |