netcfgLoad: Extracting DEST

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf netcfgLoad: Extracting DEST

  • Creator
    Topic
  • #50648

    Two things I’ve never been able to really get my head around string map and keyed lists. I’m trying to write a script that will use netcfgload to print out thread/connection destinations.

    This little script extracts the info for a thread named conn_6:

    Code:

    netcfgLoad
    echo [netcfgGetConnData conn_6]

    Sample output:
    [code]

    -- Max Drown (Infor)

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

      Max,

      Try treating that as a list (use lindex and 0 as the list element) then treat what is returned as a keyed list.

      It looks to me like this is a keyed list inside a list inside a keyed list.

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

    • #66961
      Anonymous
      Participant

      Quick and dirty. This is a very simply loop to pull out all the dest for a give thread.

      netcfgLoad

      set THREAD_DATA [netcfgGetConnData EPIC_ADT]

      keylget THREAD_DATA DATAXLATE XLATE_PATHS

      foreach NAME $XLATE_PATHS {

      foreach INDEX $NAME  {

      if { ! [string compare [lindex $INDEX 0]  ROUTE_DETAILS ]} {

      set LIST_TWO [lindex $INDEX 1]

      foreach DEST $LIST_TWO {

      echo ++ [lindex $DEST 0] ++

      }

      }

      }

      }

    • #66962

      This seems to work:

      Code:

      global HciRootDir HciSiteDir HciSite

      netcfgLoad

      set connData [netcfgGetConnData conn_6]
      keylget connData DATAXLATE result
      #echo $result
      #echo [lindex [lindex $result 0] 0]
      set result [lindex $result 0]
      keylget result ROUTE_DETAILS result
      #echo $result

      foreach dest $result {
         keylget dest DEST result
         echo $result
      }

      Output:

      Code:

      conn_7
      conn_8
      conn_9

      -- Max Drown (Infor)

    • #66963
      James Cobane
      Participant

      Max,

      For reference, I’ve attached a .tar file containing several scripts I’ve written to extract information from the NetConfig and also a word document with a brief description and sample output for each of the scripts.  You can find which one is closest to what you are trying to achieve and then modify it as necessary.  Hopefully, it will give some ideas on how to get to what you want.

      Hope this helps.

      Jim Cobane

      Henry Ford Health

    • #66964

      Thanks!

      -- Max Drown (Infor)

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,296
Replies
34,439
Topic Tags
287
Empty Topic Tags
10