How to build an application that sends a text file to a router?

Unanswered Question
Nov 22nd, 2009
User Badges:

Greetings..


I'm a student & am building a java application for a network course project. Now, I'm stuck on this point. I want to send a text file that contains configurations to a Cisco router or a switch. How to do so without the use of the HyperTerminal? Just from my application to the router.
Will it be possible if I make an TFTP server in my application?


Thanks in advance for your reply.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Jon Marshall Sun, 11/22/2009 - 10:07
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

Okay, firstly i am not a Java Programmer so i'm not sure exactly what factilies Java supplies.


Having said that there are a number of ways to remotely configure a router/switch. It's important to note however that simply having tftp functionality within your app would not be enough because to use tftp you really need to be on the router/switch and then pull the config file rather than just push it from your Java app. So


1) telnet/ssh allows you to remotely connect to a router/switchand from there either

   i) enter commands

  ii) tell the router to remotely download a config from your tftp server


2) SNMP allows you to send instructions/commands to the router/switch - note that is SNMP write must be enabled not just SNMP read


Personally if Java supported it, it may well be easier to go the SNMP path as long as all you want to do is supported by SNMP and the device could be configured as Read/write.



If not then you will need to remotely connect to the device using telnet/ssh. Once this has been done you can then choose either i) or ii) from above. One thing worth mentioning is that the script languages Perl and TCL both have methods for connecting to a router/switch and then sending commands to it -


Perl uses the Net::Telnet::Cisco module or the Expect module

TCL uses Expect

Not sure if Python has one or not.


I only mention this because certainly there is an interface between Java and Python for example - JPython, so there may well be the same for Perl/TCL so it may be easier to use one of these rather then write the whole thing from scratch yourself.


Jon

bdooonName Sun, 11/22/2009 - 10:31
User Badges:

Thank you very much for your informative reply. I really appreciate it.

Another question, won't the TFTP be enough if my PC is connected to the router? I mean I don't need to be remote, but I want to be able to upload the text file (or sent it) from my application, not from the HyperTerminal.


Thanks again.

Jon Marshall Sun, 11/22/2009 - 10:40
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

bdooonName wrote:


Thank you very much for your informative reply. I really appreciate it.

Another question, won't the TFTP be enough if my PC is connected to the router? I mean I don't need to be remote, but I want to be able to upload the text file (or sent it) from my application, not from the HyperTerminal.


Thanks again.


If your PC is already connected to the router how is it connected ? via a console cable or via ethernet.


Either way you still need to be able to tell the router to download a config file and this comes back to what i was saying previously. You either need to be on the router so you may well end up writing your own hyperterm client or you could use SNMP if via ethernet.


It really boils down to the APIs that Cisco make available for you to hook into. I don't know what they are and whether they provide a Java interface which is why i only talked about the ways i can think of making it work.


Jon

Actions

This Discussion