forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[scripts] Adds support for management (1.0) commands (sonic-net#745)
Add utility to translate text output of syseeprom dump into JSON, for consumption by new management (1.0) command. Signed-off-by: Howard Persh <[email protected]>
- Loading branch information
1 parent
2d55a50
commit 72112b0
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "}" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters