diff options
-rw-r--r-- | dhcpv4/ztpv4/ztp_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/dhcpv4/ztpv4/ztp_test.go b/dhcpv4/ztpv4/ztp_test.go index c9c8d86..9950bf5 100644 --- a/dhcpv4/ztpv4/ztp_test.go +++ b/dhcpv4/ztpv4/ztp_test.go @@ -53,9 +53,11 @@ func TestParseV4VendorClass(t *testing.T) { t.Fatalf("failed to creat dhcpv4 packet object: %v", err) } - packet.AddOption(&dhcpv4.OptClassIdentifier{ - Identifier: tc.vc, - }) + if tc.vc != "" { + packet.AddOption(&dhcpv4.OptClassIdentifier{ + Identifier: tc.vc, + }) + } if tc.hostname != "" { packet.AddOption(&dhcpv4.OptHostName{ |