summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorkevin <kworm@missouri-telecom.com>2019-11-20 13:57:37 -0600
committerChris K <c@chrisko.ch>2019-11-20 12:30:56 -0800
commitec0e0154d15c429b3dcc56af60a2d7b62eb3d5e7 (patch)
treead5b42ee71e49c2dcb02da5155da005bc1876e17
parent41dec12ba9ae4e2cae509497e75922bbcf096ec0 (diff)
Add test for WithRelayAgentInfo modifier.
Signed-off-by: kevin <kworm@missouri-telecom.com>
-rw-r--r--dhcpv4/modifiers_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/dhcpv4/modifiers_test.go b/dhcpv4/modifiers_test.go
index 3617deb..274b409 100644
--- a/dhcpv4/modifiers_test.go
+++ b/dhcpv4/modifiers_test.go
@@ -162,3 +162,22 @@ func TestWithRouter(t *testing.T) {
ortr := d.Router()
require.Equal(t, rtr, ortr[0])
}
+
+func TestWithRelayAgentInfo(t *testing.T) {
+ req, _ := New(WithGeneric(OptionRelayAgentInformation, []byte{
+ 1, 5, 'l', 'i', 'n', 'u', 'x',
+ 2, 4, 'b', 'o', 'o', 't',
+ }))
+ req.OpCode = OpcodeBootRequest
+
+ resp, _ := NewReplyFromRequest(req)
+
+ opt := resp.RelayAgentInfo()
+ require.NotNil(t, opt)
+ require.Equal(t, len(opt.Options), 2)
+
+ circuit := opt.Get(GenericOptionCode(1))
+ remote := opt.Get(GenericOptionCode(2))
+ require.Equal(t, circuit, []byte("linux"))
+ require.Equal(t, remote, []byte("boot"))
+}