summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/dhcpv6_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/dhcpv6_test.go')
-rw-r--r--dhcpv6/dhcpv6_test.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go
index 4a44e0e..6840252 100644
--- a/dhcpv6/dhcpv6_test.go
+++ b/dhcpv6/dhcpv6_test.go
@@ -215,5 +215,52 @@ func TestNewMessageTypeSolicitWithCID(t *testing.T) {
require.Equal(t, len(opts), 2)
}
+
+func TestIsUsingUEFIArchTypeTrue(t *testing.T) {
+ msg := DHCPv6Message{}
+ opt := OptClientArchType{ArchTypes: []iana.ArchType{iana.EFI_BC}}
+ msg.AddOption(&opt)
+ require.True(t, IsUsingUEFI(&msg))
+}
+
+func TestIsUsingUEFIArchTypeFalse(t *testing.T) {
+ msg := DHCPv6Message{}
+ opt := OptClientArchType{ArchTypes: []iana.ArchType{iana.INTEL_X86PC}}
+ msg.AddOption(&opt)
+ require.False(t, IsUsingUEFI(&msg))
+}
+
+func TestIsUsingUEFIUserClassTrue(t *testing.T) {
+ msg := DHCPv6Message{}
+ opt := OptUserClass{UserClasses: [][]byte{[]byte("ipxeUEFI")}}
+ msg.AddOption(&opt)
+ require.True(t, IsUsingUEFI(&msg))
+}
+
+func TestIsUsingUEFIUserClassFalse(t *testing.T) {
+ msg := DHCPv6Message{}
+ opt := OptUserClass{UserClasses: [][]byte{[]byte("ipxeLegacy")}}
+ msg.AddOption(&opt)
+ require.False(t, IsUsingUEFI(&msg))
+}
+
+func TestGetTransactionIDMessage(t *testing.T) {
+ message, err := NewMessage()
+ require.NoError(t, err)
+ transactionID, err := GetTransactionID(message)
+ require.NoError(t, err)
+ require.Equal(t, transactionID, message.(*DHCPv6Message).TransactionID())
+}
+
+func TestGetTransactionIDRelay(t *testing.T) {
+ message, err := NewMessage()
+ require.NoError(t, err)
+ relay, err := EncapsulateRelay(message, MessageTypeRelayForward, nil, nil)
+ require.NoError(t, err)
+ transactionID, err := GetTransactionID(relay)
+ require.NoError(t, err)
+ require.Equal(t, transactionID, message.(*DHCPv6Message).TransactionID())
+}
+
// TODO test NewMessageTypeSolicit
// test String and Summary