Comware Based
cancel
Showing results for 
Search instead for 
Did you mean: 

Executing a file (with commands) on comware 7.

sdide
Respected Contributor

Executing a file (with commands) on comware 7.

hi,

 

I'm looking for a Comware 7 equivalent to the Comware 5 command "execute".

This command in Comware 5 takes a file (lising in cleartext CLI-commands)  as an argument.

 

I can't seem to find it?

 

I have a file that lists some commands - how can I upload that file and execute it on a comware 7 switch?

 

Regards.

Søren Dideriksen, Network Administrator
Region Midtjylland
2 REPLIES
Pete W
Valued Contributor

Re: Executing a file (with commands) on comware 7.

Did you ever find a solution to this issue?

MASE
CCNP
Meru MCSE
sdide
Respected Contributor

Re: Executing a file (with commands) on comware 7.

Hi,

Sort of.

I use python to do the task.

### sdide -2016
import comware

try:
	print "openning file"
	file = open("commands.txt","r")
except IOError as e:
        print("\nError %d reading file ' %s '\n" % (e.errno, e.filename) )
        quit()
mycommand = "system-view"
for line in file:
	line = line.rstrip()
        if len(line) > 1:
		mycommand = mycommand+" ;"+line

comware.CLI(mycommand)

So you have a file with all the commands (eg . command.txt) and you do (priviledged ):

> python abovescript.py commands.txt

So its not really a clean solution. but i works for me.

Regards

Søren Dideriksen, Network Administrator
Region Midtjylland