0 Replies Latest reply on Jun 6, 2017 10:07 AM by swf5002@psu.edu

    Compliance Report - Need Help with Selection Criteria / Regex


      I'm working on a way to verify that Juniper primary partitions and backup partitions are running the same level of software.  I have created a custom config type that runs the command "show system snapshot media internal" and dumps it as a config.  This returns the following information:


      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: Apr 17 10:54:22 2017
      JUNOS version on snapshot:
        junos  : 15.1X49-D70.3-domestic


      I need to compare the two bolded lines lines that start with "  junos  :"and verify that they are the same, and report if they're different (I don't care about the precise logic or how it reports as long as I know whether or not they are the same). I'm working with compliance reporting to search the config.


      I thought about searching config block starting with "junos    :" and ending with ^ for a regex newline but I'm not having success.  Anyone have any ideas?  I would try grepping the output from the initial show command itself but you cannot put quotes within quotes in the device template and i'd need that to search terms.


      I searched using these terms:


      block start: (?=.*Information)(?=.*\(backup\))

      block end: .*domestic\s


      that worked.


      Message was edited by OP