summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dhcpv4/ztpv4/ztp.go7
-rw-r--r--dhcpv4/ztpv4/ztp_test.go14
2 files changed, 11 insertions, 10 deletions
diff --git a/dhcpv4/ztpv4/ztp.go b/dhcpv4/ztpv4/ztp.go
index c57d958..af7c8f7 100644
--- a/dhcpv4/ztpv4/ztp.go
+++ b/dhcpv4/ztpv4/ztp.go
@@ -49,7 +49,7 @@ func parseClassIdentifier(packet *dhcpv4.DHCPv4) (*VendorData, error) {
return vd, nil
// Juniper option 60 parsing is a bit more nuanced. The following are all
- // "valid" identifying stings for Juniper:
+ // "valid" identifying strings for Juniper:
// Juniper-ptx1000-DD576 <vendor>-<model>-<serial
// Juniper-qfx10008 <vendor>-<model> (serial in hostname option)
// Juniper-qfx10002-361-DN817 <vendor>-<model>-<serial> (model has a dash in it!)
@@ -70,11 +70,11 @@ func parseClassIdentifier(packet *dhcpv4.DHCPv4) (*VendorData, error) {
return vd, nil
// For Ciena the class identifier (opt 60) is written in the following format:
- // {vendor iana code}-{product}-{type}
+ // {vendor iana code}-{product}-{type}
// For Ciena the iana code is 1271
// The product type is a number that maps to a Ciena product
// The type is used to identified different subtype of the product.
- // An example can be ‘1271-23422Z11-123’.
+ // An example can be ‘1271-23422Z11-123’.
case strings.HasPrefix(vc, strconv.Itoa(int(iana.EntIDCienaCorporation))):
v := strings.Split(vc, "-")
if len(v) != 3 {
@@ -99,6 +99,7 @@ func parseClassIdentifier(packet *dhcpv4.DHCPv4) (*VendorData, error) {
}
return vd, nil
}
+
return nil, nil
}
diff --git a/dhcpv4/ztpv4/ztp_test.go b/dhcpv4/ztpv4/ztp_test.go
index bee2230..5fa3f40 100644
--- a/dhcpv4/ztpv4/ztp_test.go
+++ b/dhcpv4/ztpv4/ztp_test.go
@@ -47,13 +47,6 @@ func TestParseClassIdentifier(t *testing.T) {
want: &VendorData{VendorName: "ZPESystems", Model: "NSC", Serial: "001234567"},
},
{
- name: "cisco",
- vc: "FPR4100",
- ci: []byte("JMX2525X0BW"),
- want: &VendorData{VendorName: "Cisco Systems", Model: "FPR4100", Serial: "JMX2525X0BW"},
- },
- {name: "ciscoNoSerial", vc: "FPR4100", fail: true},
- {
name: "ciena",
vc: "1271-00011E00-032",
ci: []byte("JUSTASN"),
@@ -61,6 +54,13 @@ func TestParseClassIdentifier(t *testing.T) {
},
{name: "cienaInvalidVendorClass", vc: "127100011E00032", fail: true},
{name: "cienaNoSerial", vc: "1271-00011E00-032", fail: true},
+ {
+ name: "cisco",
+ vc: "FPR4100",
+ ci: []byte("JMX2525X0BW"),
+ want: &VendorData{VendorName: "Cisco Systems", Model: "FPR4100", Serial: "JMX2525X0BW"},
+ },
+ {name: "ciscoNoSerial", vc: "FPR4100", fail: true},
}
for _, tc := range tt {