Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scripts] Adds support for management (1.0) commands #745

Merged
merged 1 commit into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions scripts/syseeprom-to-json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/awk -f

BEGIN { print "{"; n = 0 }

function sep()
{
if (n > 0) print ", ";
++n;
}

/Product Name/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Part Number/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Serial Number/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Base MAC Address/ { sep(); print "\"" $1 " " $2 " " $3 "\": \"" $6 "\""; }
/Manufacture Date/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Device Version/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Label Revision/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Platform Name/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/ONIE Version/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/MAC Addresses/ { sep(); print "\"" $1 " " $2 "\": " $5; }
/Manfacturer/ { sep(); print "\"" $1 "\": \"" $4 "\""; }
/Manfacture Country/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Vendor Name/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Diag Version/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Service Tag/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Hardware Version/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Software Version/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Manfacture Date/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }
/Model Name/ { sep(); print "\"" $1 " " $2 "\": \"" $5 "\""; }

END { print "}" }
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
'scripts/route_check.py',
'scripts/route_check_test.sh',
'scripts/sfpshow',
'scripts/syseeprom-to-json',
'scripts/teamshow',
'scripts/warm-reboot',
'scripts/watermarkstat',
Expand Down