cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
977
Views
0
Helpful
2
Replies

Can't execute command line commands when python script is running on XE router

gio_mur01
Level 1
Level 1

Hello everyone, I am new on Cisco community, so hope I am in the right place to ask the following question.

 

I am trying to automate interface shutdown process on gns3  csr1000v 16.12 router (ios XE Gibraltar), which is running on remote dell esxi gns3vm server.

I have executing some EEM python script on iox XE 16.12 giblartar through guestshell container python interpreter. 

I mean the code looks at eem track object state and if it goes down it start executing some python code that is under this (::cisco::eem::event_register_track 51 state down maxrun 2400).

In script I am using python module schedule to run some function inside script every one minute. (So once tracking object goes down script starts running every one minute until tracking object goes up).

 

Problem:

The script is working well, doing it's job, but once it is running I can't type (execute) cli commands ("show ip int b",  "show ip route", ect.). It starts showing output and than at some point stopping and showing nothing.  It seems that ios (maybe csr1000v cpu) can't handle executing both python script (which is executing python interpreter inside guestshell) and cli commands both at the same time. I thought that maybe problem was in multi threading so I added some basic multhithreading capability to my python script (I am beginner in programming), but it didn't work. Maybe it is the problem of running it on virtual device and on real one it will work. What you think might be problem?

 

Thank in advance

2 Replies 2

omz
VIP Alumni
VIP Alumni

Hi 

Can you test with the devnet always-on sandbox?

What resources the csr1000v have in gns3 vm?

Can you share the script?

Thanks for the reply,

I haven't test it on sandbox (I am just starting to prepare for devnet certification and it's is new to me). Will test it.

csr1000v has: 4096 MB Ram, 2 vCPUs, Image: csr1000v-universalk9.16.12.02-serial.qcow2.

 

Can't share the whole script, but basically what it does is when specific tracking object goes down it starts checking connectivity with couple remote devices by pinging their interfaces every one minute using python schedule module.

I mean: 

    import schedule

    schedule.every().minute.do(function name)

and then some while loop:

while tracking_object == ' down'   # checking tracking object state

   schedule.run_pending()

   time.sleep(60)

   some_variable = tracking_state()  # reading tracking object state

   if some_variable == 'up':

      schedule.cancel_job(function name)

      break

 

So when the script is running in the background and i am starting executing some cli commands (for example: 'show ip route') at some point (frequently, when the output is big and i have to press space (more) to show remaining part of it) it stops and shows nothing and when i am pressing for example enter cursor just entering new black line without showing anything and when I enter backspace it displays  "^H"  symbol.

If you want I print screen it and post here.

 

Thanks for you attention and time