summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/ztpv4
diff options
context:
space:
mode:
authorPablo Mazzini <pmazzini@gmail.com>2021-08-10 07:48:32 +0100
committerinsomniac <insomniacslk@users.noreply.github.com>2021-10-26 14:51:28 +0200
commitad197bcd36fd5fde44d2eacc50c5aa7aef87a742 (patch)
tree18ea982692e684dc474ddb1b503028ef16c29674 /dhcpv4/ztpv4
parent94de7a00bf095cb550525eb3744e56e1f3dc4899 (diff)
use iana EntID
Diffstat (limited to 'dhcpv4/ztpv4')
-rw-r--r--dhcpv4/ztpv4/ztp.go10
-rw-r--r--dhcpv4/ztpv4/ztp_test.go8
2 files changed, 9 insertions, 9 deletions
diff --git a/dhcpv4/ztpv4/ztp.go b/dhcpv4/ztpv4/ztp.go
index af7c8f7..ecb63c6 100644
--- a/dhcpv4/ztpv4/ztp.go
+++ b/dhcpv4/ztpv4/ztp.go
@@ -75,12 +75,12 @@ func parseClassIdentifier(packet *dhcpv4.DHCPv4) (*VendorData, error) {
// 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’.
- case strings.HasPrefix(vc, strconv.Itoa(int(iana.EntIDCienaCorporation))):
+ case strings.HasPrefix(vc, strconv.Itoa(int(iana.EnterpriseIDCienaCorporation))):
v := strings.Split(vc, "-")
if len(v) != 3 {
return nil, fmt.Errorf("%w got '%s'", errVendorOptionMalformed, vc)
}
- vd.VendorName = iana.EntIDCienaCorporation.String()
+ vd.VendorName = iana.EnterpriseIDCienaCorporation.String()
vd.Model = v[1] + "-" + v[2]
vd.Serial = dhcpv4.GetString(dhcpv4.OptionClientIdentifier, packet.Options)
if len(vd.Serial) == 0 {
@@ -91,7 +91,7 @@ func parseClassIdentifier(packet *dhcpv4.DHCPv4) (*VendorData, error) {
// Cisco Firepower FPR4100/9300 models use Opt 60 for model info
// and Opt 61 contains the serial number
case vc == "FPR4100" || vc == "FPR9300":
- vd.VendorName = iana.EntIDCiscoSystems.String()
+ vd.VendorName = iana.EnterpriseIDCiscoSystems.String()
vd.Model = vc
vd.Serial = dhcpv4.GetString(dhcpv4.OptionClientIdentifier, packet.Options)
if len(vd.Serial) == 0 {
@@ -107,8 +107,8 @@ func parseVIVC(packet *dhcpv4.DHCPv4) (*VendorData, error) {
vd := &VendorData{}
for _, id := range packet.VIVC() {
- if id.EntID == uint32(iana.EntIDCiscoSystems) {
- vd.VendorName = iana.EntIDCiscoSystems.String()
+ if id.EntID == iana.EnterpriseIDCiscoSystems {
+ vd.VendorName = iana.EnterpriseIDCiscoSystems.String()
//SN:0;PID:R-IOSXRV9000-CC
for _, f := range bytes.Split(id.Data, []byte(";")) {
p := bytes.Split(f, []byte(":"))
diff --git a/dhcpv4/ztpv4/ztp_test.go b/dhcpv4/ztpv4/ztp_test.go
index 5fa3f40..5d8ae8d 100644
--- a/dhcpv4/ztpv4/ztp_test.go
+++ b/dhcpv4/ztpv4/ztp_test.go
@@ -95,19 +95,19 @@ func TestParseVIVC(t *testing.T) {
tt := []struct {
name string
vivc string
- entID iana.EntID
+ entID iana.EnterpriseID
want *VendorData
fail bool
}{
{
name: "cisco",
- entID: iana.EntIDCiscoSystems,
+ entID: iana.EnterpriseIDCiscoSystems,
vivc: "SN:0;PID:R-IOSXRV9000-CC",
want: &VendorData{VendorName: "Cisco Systems", Model: "R-IOSXRV9000-CC", Serial: "0"},
},
{
name: "ciscoMultipleColonDelimiters",
- entID: iana.EntIDCiscoSystems,
+ entID: iana.EnterpriseIDCiscoSystems,
vivc: "SN:0:123;PID:R-IOSXRV9000-CC:456",
fail: true,
},
@@ -121,7 +121,7 @@ func TestParseVIVC(t *testing.T) {
}
if tc.vivc != "" {
- vivc := dhcpv4.VIVCIdentifier{EntID: uint32(tc.entID), Data: []byte(tc.vivc)}
+ vivc := dhcpv4.VIVCIdentifier{EntID: tc.entID, Data: []byte(tc.vivc)}
packet.UpdateOption(dhcpv4.OptVIVC(vivc))
}