NetConfig extract “DEST” and “TRXID”

Homepage Clovertech Forums Cloverleaf NetConfig extract “DEST” and “TRXID”

  • Creator
    Topic
  • #121118
    Joe kavanagh
    Participant

    Hello All,

    Anyone have a script that can parse below the DATAXLATE and grab routes paired with the TRXID?  I’m having an issue trying to parse that out, I’m pretty new to TCL.  I’ve tried splitting by \n or \r or “{” and not able to grasp the data.

     

    #grab threads
    set siteconns [lsort [netcfgGetConnList]]
    set output [open “~/temp/client_serv_list/$site.txt” “w”]
    set sep “{”
    foreach thread $siteconns {
    set data [netcfgGetConnData $thread]
    #set protocol {}; keylget data PROTOCOL.TYPE protocol
    #set xlate {}; keylget data DATAXLATE xlate
    set client {}; keylget data PROTOCOL.ISSERVER client
    set multiSER {}; keylget data PROTOCOL.ISMULTI multiSER
    set dataxlate {}; keylget data DATAXLATE dataxlate
    set sections [split $dataxlate $sep]
    set trxid [regexp {TRXID:\s*(\S+)} $sections ]

    if {$client == 0 && $multiSER == 0} {
    puts $output “Clients:$thread:$client”
    }
    if {$client == 1 || $multiSER == 1} {
    puts $output “Servers:$thread:$client:$multiSER:$trxid”
    }
    }

    #close file
    close $output

    Thank you,
    joekavanagh889@hotmail.com

Viewing 4 reply threads
  • Author
    Replies
    • #121119
      Jim Kosloskey
      Participant

      If you are on a later release of Cloverleaf, you can use the NCI (NetConfig Interface I think) to extract info from the NetConfig. It is documented fairly well in help but if you want an example I can provide one email me if you want that.

      If on older Cloverleaf, there is an undocumented set of commands. Others on Clovertech do that and will have examples. I do not use those functions.

       

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #121120
      Charlie Bursell
      Participant

      As Jim said you can use the NCI interface.  The commands are in the online docs.

      If me I would do something like: (Assuming you want current site NetConfig)

      netconfig load $::HciSiteDir/NetConfig

      foreach conn [netconfig get connection list] {

      set data [netconfig get connection data $conn]
      set klst [keylget data DATAXLATE]

      foreach {full part} [regexp -all -inline {DEST (.*?)\}} $klst] {
      echo THREAD $conn –> $part
      }
      }

      Note: Only threads with destinations will be listed as others will return empty from regexp command

      Note the use of the regexp inline command.  To me, much easier than trying to drill down further as now you get into lists of keyed lists, etc.

      I hope I did not misunderstand what you wanted.  If so this will still give you a kick start.

       

    • #121121
      Jim Vilbrandt
      Participant

      Hello Joe,

      DATAXLATE is a single list with a list of 0-n routes and the routes contain lists of 0-n route details.

      Get the list of routes:

      set rteLst [lindex $dataxlate]

      Then loop through the list looking for the fields you want:

      foreach rte $rteLst {
        keylget rte TRXID trxid
        echo $trxid
      }

      Regards, Jim

    • #121124
      Joe kavanagh
      Participant

      Thank you, yes if there are now commands used for version 19.1.  Please let me know if not i will try the options above later on today.  I appreciate the quick responses.

       

      If you can send some of you examples, that would be greatly appreciated.  The end results is to be able to run something like this and do some quick reviews of settings to make sure items are built correctly.

      It wont let me put my email:  joekavanagh889 hotmail.com

      • This reply was modified 8 months, 1 week ago by Joe kavanagh.

      Thank you,
      joekavanagh889@hotmail.com

    • #121136
      Jeff Dinsmore
      Participant

      We have some tools to read some NetConfig content – the stuff we’ve needed for our automation.

      But this looked like fun so I played around with adding routing/xlate info as well.

      Attached is a fairly complete example proc that will read NetConfig for a specified site.

      usage: readNetConfigExt <site> <arrayName>

      >>> something like: readNetConfigExt lab netConfigArray

      There is also a proc to print what was read.

      usage: printNetConfigExt <arrayName>

      >>> something like: printNetConfigExt netConfigArray

       

      Attachments:
      You must be logged in to view attached files.

      Jeff Dinsmore
      Chesapeake Regional Healthcare

Viewing 4 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,447
Topic Tags
288
Empty Topic Tags
10