Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Jul 20, 2017

python load sys config merge from-terminal

def send_tmsh_cmd(self,command):
        payload = {}
        cmd = "-c \'" + command + "\'"
        payload['command'] = 'run'
        payload['utilCmdArgs'] = cmd
        req_url = self.mgmt_url + "/util/bash"

load sys config merge from-terminal Enter configuration. Press CTRL-D to submit or CTRL-C to cancel.

I am using python to send tmsh command to F5

currently, I want to merge a local file to remote f5

how to achieve this?

1: tried to send it in this way:

tmsh

load sys config merge from-terminal

ltm pool LVSP00-CPS_80 { load-balancing-mode round-robin monitor JBossDeploymentStatus_8080 and MaintFlagHTTP1.1_80 }

but how to send ctrl-d?

2: another way is to copy this file to f5, then merger it?

1 Reply

  • I started to look at this but realised this is really a Python question not an F5 question so might have better luck asking on Stackoverflow.com. What you need is to send EOF, which is what Ctrl-D does, this might be just sending \0 (null) or \n\n at the end of your config string but never tried it.

     

    Having said that think might be a better way. iControlREST is one option and the one I like the most, check out the example and look at the iControlREST info her on DevCentral. Python VS and Pool Create iControl example

     

    The second is to upload you configure file to merge using SCP or SFTP then run the TMSH load merge command referencing the uploaded file but comes with its own challenges and risks, again not something I have tryed with python.