From ec5c7ba66f06056fe8de535af42ef2896422bde8 Mon Sep 17 00:00:00 2001 From: Hrvoje Cavrak Date: Thu, 18 Aug 2022 14:36:40 +0200 Subject: Add ZTPv6 Cisco Support Adding ZTPv6 Cisco support based on Option 17 Suboption 1 (Vendor Specific Information Option). Signed-off-by: Hrvoje Cavrak --- dhcpv6/ztpv6/parse_vendor_options.go | 3 ++- dhcpv6/ztpv6/parse_vendor_options_test.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dhcpv6/ztpv6/parse_vendor_options.go b/dhcpv6/ztpv6/parse_vendor_options.go index 3d1fd01..b3ce55b 100644 --- a/dhcpv6/ztpv6/parse_vendor_options.go +++ b/dhcpv6/ztpv6/parse_vendor_options.go @@ -46,7 +46,8 @@ func ParseVendorData(packet dhcpv6.DHCPv6) (*VendorData, error) { for _, d := range vData { switch { // Arista;DCS-0000;00.00;ZZZ00000000 - case strings.HasPrefix(d, "Arista;"): + // Cisco;8800;12.34;FOC00000000 + case strings.HasPrefix(d, "Arista;"), strings.HasPrefix(d, "Cisco;"): p := strings.Split(d, ";") if len(p) < 4 { return nil, errVendorOptionMalformed diff --git a/dhcpv6/ztpv6/parse_vendor_options_test.go b/dhcpv6/ztpv6/parse_vendor_options_test.go index cd2fb3d..03ff8cf 100644 --- a/dhcpv6/ztpv6/parse_vendor_options_test.go +++ b/dhcpv6/ztpv6/parse_vendor_options_test.go @@ -18,11 +18,16 @@ func TestParseVendorDataWithVendorOpts(t *testing.T) { {name: "empty", fail: true}, {name: "unknownVendor", vc: "VendorX;BFR10K;XX12345", fail: true, want: nil}, {name: "truncatedArista", vc: "Arista;1234", fail: true, want: nil}, + {name: "truncatedCisco", vc: "Cisco;1234", fail: true, want: nil}, {name: "truncatedZPE", vc: "ZPESystems:1234", fail: true, want: nil}, { name: "arista", vc: "Arista;DCS-7050S-64;01.23;JPE12345678", want: &VendorData{VendorName: "Arista", Model: "DCS-7050S-64", Serial: "JPE12345678"}, + }, { + name: "cisco", + vc: "Cisco;SYS-8801;01.23;FOC12345678", + want: &VendorData{VendorName: "Cisco", Model: "SYS-8801", Serial: "FOC12345678"}, }, { name: "zpe", vc: "ZPESystems:NSC:001234567", -- cgit v1.2.3