diff options
author | insomniac <insomniacslk@users.noreply.github.com> | 2018-11-12 13:46:50 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-12 13:46:50 +0000 |
commit | 22ab333fff995af78b17bb533de93317fc7b65d5 (patch) | |
tree | ad115cae67c2d5f96b97d868727b30dc3818f681 /dhcpv4/options_test.go | |
parent | 08eace5b3537c9cedf8fbf2f2a61562e3ffbc302 (diff) | |
parent | 5ee47520014b0835b58e3624381e01bdf14ef9ba (diff) |
add OptRelayAgentInformation (#193)
Diffstat (limited to 'dhcpv4/options_test.go')
-rw-r--r-- | dhcpv4/options_test.go | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/dhcpv4/options_test.go b/dhcpv4/options_test.go index c06f6f5..bf869f2 100644 --- a/dhcpv4/options_test.go +++ b/dhcpv4/options_test.go @@ -57,6 +57,22 @@ func TestParseOption(t *testing.T) { require.Equal(t, 4, opt.Length(), "Length") require.Equal(t, option, opt.ToBytes(), "ToBytes") + // Option root path + option = []byte{17, 4, '/', 'f', 'o', 'o'} + opt, err = ParseOption(option) + require.NoError(t, err) + require.Equal(t, OptionRootPath, opt.Code(), "Code") + require.Equal(t, 4, opt.Length(), "Length") + require.Equal(t, option, opt.ToBytes(), "ToBytes") + + // Option broadcast address + option = []byte{28, 4, 255, 255, 255, 255} + opt, err = ParseOption(option) + require.NoError(t, err) + require.Equal(t, OptionBroadcastAddress, opt.Code(), "Code") + require.Equal(t, 4, opt.Length(), "Length") + require.Equal(t, option, opt.ToBytes(), "ToBytes") + // Option NTP servers option = []byte{42, 4, 10, 10, 10, 10} opt, err = ParseOption(option) @@ -73,6 +89,14 @@ func TestParseOption(t *testing.T) { require.Equal(t, 4, opt.Length(), "Length") require.Equal(t, option, opt.ToBytes(), "ToBytes") + // Requested IP address lease time + option = []byte{51, 4, 0, 0, 0, 0} + opt, err = ParseOption(option) + require.NoError(t, err) + require.Equal(t, OptionIPAddressLeaseTime, opt.Code(), "Code") + require.Equal(t, 4, opt.Length(), "Length") + require.Equal(t, option, opt.ToBytes(), "ToBytes") + // Message type option = []byte{53, 1, 1} opt, err = ParseOption(option) @@ -137,18 +161,19 @@ func TestParseOption(t *testing.T) { require.Equal(t, 5, opt.Length(), "Length") require.Equal(t, option, opt.ToBytes(), "ToBytes") - // Option client system architecture type option - option = []byte{93, 4, 't', 'e', 's', 't'} + // Option relay agent information + option = []byte{82, 2, 1, 0} opt, err = ParseOption(option) require.NoError(t, err) - require.Equal(t, OptionClientSystemArchitectureType, opt.Code(), "Code") - require.Equal(t, 4, opt.Length(), "Length") + require.Equal(t, OptionRelayAgentInformation, opt.Code(), "Code") + require.Equal(t, 2, opt.Length(), "Length") require.Equal(t, option, opt.ToBytes(), "ToBytes") - option = []byte{17, 4, '/', 'f', 'o', 'o'} + // Option client system architecture type option + option = []byte{93, 4, 't', 'e', 's', 't'} opt, err = ParseOption(option) require.NoError(t, err) - require.Equal(t, OptionRootPath, opt.Code(), "Code") + require.Equal(t, OptionClientSystemArchitectureType, opt.Code(), "Code") require.Equal(t, 4, opt.Length(), "Length") require.Equal(t, option, opt.ToBytes(), "ToBytes") } |