1 Reply Latest reply on Jun 6, 2017 10:04 AM by swf5002@psu.edu

    NCM Compliance - Need to compare two lines in a config to verify they are identical

    swf5002@psu.edu

      Juniper devices have two partitions on which they install a primary and backup copy of the filesystem.  In case of failure of the primary, it boots of the backup.  When you do an upgrade of software, by default it does not copy the updated package to the backup partition, you have to run a command to get that to happen.  So anyway I want to make a compliance report that checks the backup and primary partitions contain the same software package.  You cannot get this data via snmp, only via this command (with sample output):

       

      > show system snapshot media internal

      Information for snapshot on       internal (/dev/da0s1a) (backup)

      Creation date: Jun 24 04:30:48 2016

      JUNOS version on snapshot:

        junos  : 15.1X49-D45-domestic

      Information for snapshot on       internal (/dev/da0s2a) (primary)

      Creation date: Jan 24 11:34:11 2017

      JUNOS version on snapshot:

        junos  : 15.1X49-D70.3-domestic

       

      You can display this as XML, and I thought I would create a custom NCM config type with this command so I can have this data and search it.  It's not available in the output of the actual configuration of the device.  Here's an example of the XML output:

       

       

      > show system snapshot media internal | display xml

      <rpc-reply xmlns:junos="http://xml.juniper.net/junos/15.1X49/junos">

          <snapshot-information>

                <snapshot-medium>

                    internal (/dev/da0s1a) (backup)

                </snapshot-medium>

                <creation-date>

              Jun 24 04:30:48 2016

                </creation-date>

                <software-version>

                                      <package>

                                      <package-name>junos</package-name>

                                      <package-version>15.1X49-D45-domestic</package-version>

                                      </package>

                </software-version>

                <snapshot-medium>

                    internal (/dev/da0s2a) (primary)

                </snapshot-medium>

                <creation-date>

              Jan 24 11:34:11 2017

                </creation-date>

                <software-version>

                                      <package>

                                      <package-name>junos</package-name>

                                      <package-version>15.1X49-D70.3-domestic</package-version>

                                      </package>

                </software-version>

          </snapshot-information>

          <cli>

              <banner></banner>

          </cli>

      </rpc-reply>

       

       

      So, I need to compare that backup package-version (in this case 15.1X49-D45-domestic), to the primary package-version (15.1X49-D70.3-domestic).  From there I can run a remediation command to copy the primary over to the backup.

       

      In NCM, I don't believe I can pull data out as a variable and compare it later on down the config.  I also can't just tell it to look at all these configs for 15.1X49-D70 because my devices have different software versions, both on the primary and backup partitions.  Any ttoughts as to if / how I can pull this off?