|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.adaptation.snmp.DistCisco
public class DistCisco
Put new configuration to cisco device. Modifies the running-config, changes are lost after rebooting the router. (todo: should modify startup-config as well)
For the transfer, a TFTP server is launched. To configure the server port, the property
adaptation.distribution.tftp.port is used. If it is set to 0, a tftp server is
expected to be running outside of Verinec = no server is started.
If the property is not set, the default port 69 is used (note that on most systems,
Verinec needs to run with administrator privileges to be allowed to open ports below 1024).
Unfortunately, Cisco does not have a parameter for the tftp server port. It will always try
port 69. Either you have to start the server from outside on that port, run Verinec as root,
or redirect port 69 to the high port of your choice. On Linux, this can be done with
iptables -t nat -A PREROUTING -p tcp --dport 69 -j REDIRECT --to-port <port>
adaptation.distribution.tftp.localpath can be used to define where the root
directory of the tftp server is. If the port is 0, it must be set, otherwise it is optional,
and java.io.tmpdir is used as default.
Hint: Cisco has the bad habit of sending requests from IP 10.10.10.1 even if Ethernet0 interface is set to a different IP. If cisco is not your default gateway (you will notice that communication times out, you can add a route for this. On Windows, open a shell and type route add 10.10.0.0 mask 255.255.0.0 172.16.1.254 metric 1 where 172.16.1.254 is the IP you assigned the cisco router (or your gateway to reach the cisco router).
Note: If the internal tftp server is used, this class is not thread save and can not be used to distribute two configurations at the same time.
IDistributor| Field Summary | |
|---|---|
private String |
communityName
|
private String |
hostIP
Our own ip. |
private File |
localpath
Root directory for the tftp server. |
private Logger |
log
|
private int |
port
Port for the tftp server to start. |
(package private) String |
prepend
Text to prepend to the configuration file. |
private static String |
prop_tftppath
|
private static String |
prop_tftpport
|
private String |
snmpVersion
|
private String |
targetAddress
|
| Constructor Summary | |
|---|---|
DistCisco()
|
|
| Method Summary | |
|---|---|
private void |
communityProcess(Element comElem)
|
private static String |
determineLocalIP(String remoteHost)
Determine which IP is used when connecting to the remote host. |
void |
distribute(Element config)
Execute the distribution action, that is sending the configuration file to a Cisco router |
String |
execute(Element command)
Supports special commands: cisco-delete-all-acl: download running-config from target, parse it for existing access lists and delete them all. |
void |
setTarget(Element target)
Set the target for snmp operation, i.e for sending the configuration file to Cisco router. |
private void |
snmpv3Process(Element snmpv3Elem)
Collects the different information in the snmpv3 Element, according to the schema. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Logger log
private static final String prop_tftpport
private static final String prop_tftppath
private String targetAddress
private String hostIP
private String communityName
private String snmpVersion
String prepend
private File localpath
private int port
| Constructor Detail |
|---|
public DistCisco()
| Method Detail |
|---|
public void setTarget(Element target)
throws VerinecException
setTarget in interface IDistributortarget - a cisco target according to the schema.
VerinecException - If the target type is not supported or invalid.
public void distribute(Element config)
throws VerinecException
distribute in interface IDistributorconfig - A result-file according to the schema.
VerinecException - If the config is not a result-file or if could not write to temp File
public String execute(Element command)
throws VerinecException
execute in interface IDistributorcommand - The command to execute
VerinecException - If temporary file can not be created.
private static String determineLocalIP(String remoteHost)
throws VerinecException
remoteHost -
VerinecExceptionprivate void communityProcess(Element comElem)
private void snmpv3Process(Element snmpv3Elem)
snmpv3Elem - The parameters element for SNMPv3.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||