So it looks like you could get serial-number if you change the
var $cmd = <get-chassis-inventory> { <models>; }
to
var $cmd = <get-chassis-inventory>;
in the function ztp:serial-number. That will stop the error message and actually return some xml output.
The question is, will that be backward-compatible with 14.x or do you need to check Junos version before doing the needful.
re: 'hardware-type' the info you're looking as <model-number> in function ztp:hardware-type for *appears* to be kept in <description>. (I say this based on your previously posted XML output.) Is that right ?
If so, then try modifying that function ztp:hardware-type to replace the line
/var $model-full = jcs:execute( $jnx, $cmd )//chassis-module/model-number;
with the line
/var $model-full = jcs:execute( $jnx, $cmd )//chassis-module/description;
...and see if that works.
Same caveat re: backward compatibility applies.
Try that and report back here.
BTW: where do you come by this script ? Was it written in-house? Provided by someone at Juniper ?
/doug