summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_4rd_test.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2023-02-18 18:56:49 -0800
committerChris K <c@chrisko.ch>2023-02-19 22:39:16 -0800
commit1e0fe5ce427973ca92a0dfb1a06a252ddb0dd4be (patch)
tree3edd59a0dbceb21debe8558bbb6a2d5e9ae5fa4e /dhcpv6/option_4rd_test.go
parent54181a38109b83fef570bb6ff42cede506070ee6 (diff)
Option 4RD: switch to FromBytes
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_4rd_test.go')
-rw-r--r--dhcpv6/option_4rd_test.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/dhcpv6/option_4rd_test.go b/dhcpv6/option_4rd_test.go
index ad72445..6af9b67 100644
--- a/dhcpv6/option_4rd_test.go
+++ b/dhcpv6/option_4rd_test.go
@@ -9,7 +9,8 @@ import (
func TestOpt4RDNonMapRuleParse(t *testing.T) {
data := []byte{0x81, 0xaa, 0x05, 0xd4}
- opt, err := ParseOpt4RDNonMapRule(data)
+ var opt Opt4RDNonMapRule
+ err := opt.FromBytes(data)
require.NoError(t, err)
require.True(t, opt.HubAndSpoke)
require.NotNil(t, opt.TrafficClass)
@@ -18,7 +19,8 @@ func TestOpt4RDNonMapRuleParse(t *testing.T) {
// Remove the TrafficClass flag and check value is ignored
data[0] = 0x80
- opt, err = ParseOpt4RDNonMapRule(data)
+ opt = Opt4RDNonMapRule{}
+ err = opt.FromBytes(data)
require.NoError(t, err)
require.True(t, opt.HubAndSpoke)
require.Nil(t, opt.TrafficClass)
@@ -77,7 +79,8 @@ func TestOpt4RDMapRuleParse(t *testing.T) {
append(ip4addr.To4(), ip6addr...)...,
)
- opt, err := ParseOpt4RDMapRule(data)
+ var opt Opt4RDMapRule
+ err = opt.FromBytes(data)
require.NoError(t, err)
require.EqualValues(t, *ip6net, opt.Prefix6)
require.EqualValues(t, *ip4net, opt.Prefix4)
@@ -162,9 +165,10 @@ func TestOpt4RDRoundTrip(t *testing.T) {
},
}
- rtOpt, err := ParseOpt4RD(opt.ToBytes())
+ var rtOpt Opt4RD
+ err := rtOpt.FromBytes(opt.ToBytes())
require.NoError(t, err)
require.NotNil(t, rtOpt)
- require.Equal(t, opt, *rtOpt)
+ require.Equal(t, opt, rtOpt)
}