Showing results for 
Search instead for 
Did you mean: 

IMC: deploy config file name too long

Occasional Contributor

IMC: deploy config file name too long


I need to configure an adapter for ORing devices under IMC.

I have created the adapter and I can backup the configuration. However when I try to deploy the config it fails.

I investigate and saw the device only support to download through TFTP file name with max character lengh of 15.

As IMC, when it backups the config put a long name: IP_running/startup_datetime.cfg, the name of the file is too long and the device don't understand it.

Is it possible and how can I rename the file before IMC download the config file to the device ?



Honored Contributor

Re: IMC: deploy config file name too long

You should be able to do it with the TCL "file copy" and "file delete" commands. 

I don't know anything about ORing network devices. Does it work like IOS, where IMC logs into the switch, and issues a command like "copy tftp://<IP>/<filename> running-config" ?

If it does, then using the Cisco/CiscoIOSGeneric/deploy_running_config_tftp.tcl as a base file, I might do something like this:

Near the top of the file, declare a new filename variable, and then copy the default ($TFTPFile) to this new name:

set TFTPFileLocal oring.cfg

file copy -force $TFTPFile $TFTPFileLocal

Change this line: "send "copy tftp://$TFTPServer/$TFTPFile running-config\r"" to this:

send "copy tftp://$TFTPServer/$TFTPFileLocal running-config\r"

At the end add a cleanup function like this:

file delete -force $TFTPFileLocal

I haven't tested that, but it will _probably_ work. You may need to play around with paths.  Take a look at the *scp.tcl scripts for some other examples of file operations with TCL.

The other wrinkle is that using a static filename will cause you problems, e.g. if there are multiple parallel operations. May be better to at least do something like naming them <IP>.cfg.

See this code block for some examples of manipulating filenames:

set index1 [string last / $TFTPFile]
set len [string length $TFTPFile]
incr index1
set FileName [string range $TFTPFile $index1 $len]

You might need to do something similar with matching on '_'.

All the above said: That's a pretty terrible device if it only supports TFTP, and only 15-char filenames. Do they support any modern file transfer methods?