Parsing NetConfig

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Parsing NetConfig

  • Creator
    Topic
  • #51174
    Craig Weldy
    Participant

      I am trying to create a list with each inbound thread and then under it the destination threads of each route that thread has.  Below you will find a segment of the code I am using (Env is CL 5.6  on AIX 5.3).  I am able to get down to the point where I get the value for DATAXLATE which is also listed below, but at that point it is no longer just Key/Value pairs, it is a series of blank bracket groups with Key/Value pairs inside it.

      Can someone help me get through to the point where I can get the value of Key DEST?  With the code below, I don’t get any errors, I just don’t get any value.

      I know there are other netcfg commands but I don’t know which one I need to grab the list of ROUTE_DETAILS.

      Thanks for your help!

      CODE SNIPIT (TCL):


      set processesList [netcfgGetProcList]

      foreach process $processesList {

        set threadsList [netcfgGetProcConns $process]

        foreach thread $threadsList {

           set thrdlen [string length $thread]

           set thrdidx [expr $thrdlen – 2]

           set thrdend [string range $thread $thrdidx $thrdlen]

           set thrdidx2 [expr $thrdlen – 3]

           set thrdidx2b [expr $thrdidx2 + 1]

           set thrdend2 [string range $thread $thrdidx2 $thrdidx2b]

           if {[string compare $thrdend “in”] == 0 ||

               [string compare $thrdend2 “in”] == 0 } {

              echo $thread

              set connData [netcfgGetConnData $thread]

              set dataXlate [keylget connData DATAXLATE]

              echo $dataXlate

              ############ WORKING TO HERE ##############

              set routeDestList [netcfgGetGroupConns $dataXlate]

              foreach route $routeDestList {

                 set routedest [keylget route DEST]

                 echo $routedest

              }

              echo

           }

        }

      }

      VALUE OF DATAXLATE FROM ECHO COMMAND ABOVE:


             {

                 { ROUTE_DETAILS {

                     {

                         { DEST hpptcpout }

                         { PROCS {

                             { ARGS {{}} }

                             { PROCS tps_MSH_NE_Continue }

                         } }

                         { TYPE raw }

                     }

                 } }

                 { TRXID _HCI_static_route_ }

                 { WILDCARD OFF }

             } {

                 { ROUTE_DETAILS {

                     {

                         { DEST phstcpout }

                         { ELEVATEWARNINGFORPARSE {} }

                         { POSTPROCS {

                             { ARGS {} }

                             { PROCS {} }

                         } }

                         { PREPROCS {

                             { ARGS {{}} }

                             { PROCS tps_MSH_HS_Continue }

                         } }

                         { READONLY 0 }

                         { TYPE xlate }

                         { XLATE x_hpp_a14_to_phs_a14.xlt }

                     } {

                         { DEST startcpout }

                         { ELEVATEWARNINGFORPARSE {} }

                         { POSTPROCS {

                             { ARGS {} }

                             { PROCS {} }

                         } }

                         { PREPROCS {

                             { ARGS {{}} }

                             { PROCS tps_MSH.5_ST1_Continue }

                         } }

                         { READONLY 0 }

                         { TYPE xlate }

                         { XLATE x_hpp_a14_to_star_a14.xlt }

                     }

                 } }

                 { TRXID ADT_A14 }

                 { WILDCARD OFF }

             }

      Craig Weldy
      Senior Interface Analyst
      Beacon Health System
      South Bend, In, 46615

    Viewing 2 reply threads
    • Author
      Replies
      • #69038

        This is an example proc that I use for a bigger script, but you should be able to modify it for your own needs.

        Code:

        proc parseRoutes {hciRoot hciSite} {

           netcfgLoad $hciRoot/$hciSite/NetConfig

           set connList [lsort [netcfgGetConnList]]

           foreach conn $connList {
               set connData [netcfgGetConnData $conn]
               keylget connData DATAXLATE routeList
               set routes {}
               foreach route $routeList {
                   keylget route ROUTE_DETAILS routeDetail
                   foreach detail $routeDetail {
                       keylget detail DEST dest
                       lappend routes $dest
                   }
               }
               puts “$conn $routes”
               keylset resultList $conn $routes
           }

           #puts [keylget resultList conn06_in]
           #puts $resultList
           return $resultList
        }

        parseRoutes /hci/quovadx/qdx5.6/integrator [lindex $argv 0]

        -- Max Drown (Infor)

      • #69039
        James Cobane
        Participant

          Craig,

          Attached is a tcl script that produces a list of the inbound threads and there corresponding outbounds.  Modify as you see fit.

          Hope this helps.

          Jim Cobane

          Henry Ford Health

        • #69040
          Craig Weldy
          Participant

            Thanks guys.  As always it looks like this is just what I need.

            Craig Weldy
            Senior Interface Analyst
            Beacon Health System
            South Bend, In, 46615

        Viewing 2 reply threads
        • The forum ‘Cloverleaf’ is closed to new topics and replies.