For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

RudiVanSchalkwy's avatar
RudiVanSchalkwy
Icon for Nimbostratus rankNimbostratus
Jul 17, 2019
Solved

TMSH Command via Python SDK

I was hoping to get some assistance in executing TMSH commands via the Python SDK. From the documentation i can easily execute any BASH command but i'm struggling with TMSH commands.

I need to execute the following including console output.

run /cm config-sync to-group Syncfailover

and slso check the status with

show /cm sync-status

  1. Expected console output for show
  2. CM::Sync Status
  3. ----------------------------------------------------------------------------
  4. Color    green
  5. Status   In Sync
  6. Summary
  7. Details
  8.          /Common/host1.company.com: connected (for 2548 seconds)
  9.          /Common/sync-fail-test (In Sync):
  10.           - all 2 devices consistent
  11.          /Common/device_trust_group (In Sync):
  12.           - all 2 devices consistent

The Documentation doesn't really give a noob like me information for achieving above. They only mention a very simple example in saving a config. ie

mgmt.tm.sys.config.exec_cmd('save')

5 Replies

  • >> Check Sync Status

    https://f5-sdk.readthedocs.io/en/latest/apidoc/f5.bigip.tm.cm.html#module-f5.bigip.tm.cm.sync_status

    https://f5-sdk.readthedocs.io/en/latest/_modules/f5/bigip/tm/cm/sync_status.html#Sync_Status

     

    >> Sync To-Group

    https://f5-sdk.readthedocs.io/en/latest/apidoc/f5.bigip.tm.cm.html#f5.bigip.tm.cm.device_group.Device_Group

    https://f5-sdk.readthedocs.io/en/latest/_modules/f5/bigip/tm/cm/device_group.html#Device_Group.sync_to

     

    Hope this helps.

     

    KR,

    Dario.