[Javanetsim-cvs] javaNetSim/core CommandProcessor.java, 1.5, 1.6 DeviceConfig.java, 1.5, 1.6 Ethern
Status: Beta
Brought to you by:
darkkey
From: QweR <qw...@us...> - 2007-10-18 22:22:15
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17909/core Modified Files: CommandProcessor.java DeviceConfig.java EthernetNetworkInterface.java Simulation.java Log Message: some console command was corrected Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CommandProcessor.java 16 Oct 2007 23:02:31 -0000 1.5 --- CommandProcessor.java 18 Oct 2007 22:22:09 -0000 1.6 *************** *** 10,13 **** --- 10,16 ---- package core; + import core.protocolsuite.tcp_ip.DHCPC; + import core.protocolsuite.tcp_ip.DHCPD; + import core.protocolsuite.tcp_ip.IPV4Address; import core.protocolsuite.tcp_ip.InvalidIPAddressException; import core.protocolsuite.tcp_ip.InvalidSubnetMaskException; *************** *** 19,22 **** --- 22,26 ---- import core.protocolsuite.tcp_ip.jnSocket; import java.util.Enumeration; + import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; *************** *** 40,43 **** --- 44,48 ---- private NetworkLayerDevice device; private CommandsTree commands = new CommandsTree(); + private Hashtable pools = new Hashtable(); private NoCommandClass noCommand = new NoCommandClass(); *************** *** 77,80 **** --- 82,89 ---- private no_interface__mac_address_CommandClass no_interface__mac_address_Command = new no_interface__mac_address_CommandClass(); private no_interface__shutdown_CommandClass no_interface__shutdown_Command = new no_interface__shutdown_CommandClass(); + private ip_dhcp_pool_CommandClass ip_dhcp_pool_Command = new ip_dhcp_pool_CommandClass(); + private no_ip_dhcp_pool_CommandClass no_ip_dhcp_pool_Command = new no_ip_dhcp_pool_CommandClass(); + private ip_local_pool_CommandClass ip_local_pool_Command = new ip_local_pool_CommandClass(); + private no_ip_local_pool_CommandClass no_ip_local_pool_Command = new no_ip_local_pool_CommandClass(); private ip_route_CommandClass ip_route_Command = new ip_route_CommandClass(); private no_ip_route_CommandClass no_ip_route_Command = new no_ip_route_CommandClass(); *************** *** 154,158 **** commands.add("interface * mac-address", interface__mac_address_Command, CONF_MODE | NETWORK_LAYER, "<MAC>", "Manually set interface MAC address"); commands.add("interface * shutdown", interface__shutdown_Command, CONF_MODE | NETWORK_LAYER, "<cr>", "Shutdown the selected interface"); - commands.addDescription("no interface","Select an interface to configure"); commands.addDescription("no interface *","Any available interface name"); --- 163,166 ---- *************** *** 172,181 **** commands.add("no interface * shutdown", no_interface__shutdown_Command, CONF_MODE | NETWORK_LAYER, "<cr>", "Up the selected interface"); commands.addDescription("ip","Global IP configuration subcommands"); ! commands.addDescription("no ip","Global IP configuration subcommands"); ! commands.add("ip route", ip_route_Command, CONF_MODE | NETWORK_LAYER, "(<host ip>|<network ip>) <netmask> <gateway> <target interface>", "Add route record"); commands.add("no ip route", no_ip_route_Command, CONF_MODE | NETWORK_LAYER, "(<host ip>|<network ip>)", "Delete route record"); commands.addDescription("ip tcp","Global TCP parameters"); commands.add("ip tcp window-size", ip_tcp_window_size_Command, CONF_MODE | TRANSPORT_LAYER, "<window-size>", "TCP window size"); commands.addDescription("show","Show running system information"); commands.add("show access-lists", show_access_lists_Command, STD_CONF_MODE | TRANSPORT_LAYER, "<1-2699 | WORD>", "List access lists"); --- 180,198 ---- commands.add("no interface * shutdown", no_interface__shutdown_Command, CONF_MODE | NETWORK_LAYER, "<cr>", "Up the selected interface"); + commands.addDescription("ip dhcp","Configure DHCP server"); + commands.addDescription("no ip dhcp","Configure DHCP server"); + commands.add("ip dhcp pool", ip_dhcp_pool_Command, CONF_MODE | APPLICATION_LAYER, "<pool>", "Configure DHCP address pools"); + commands.add("no ip dhcp pool", no_ip_dhcp_pool_Command, CONF_MODE | APPLICATION_LAYER, "<pool>", "Configure DHCP address pools"); + commands.addDescription("ip local","Specify local options"); + commands.addDescription("no ip local","Specify local options"); + commands.add("ip local pool", ip_local_pool_Command, CONF_MODE | NETWORK_LAYER, "<pool> <first ip> <last ip>", "IP Local address pool lists"); + commands.add("no ip local pool", no_ip_local_pool_Command, CONF_MODE | NETWORK_LAYER, "<pool>", "IP Local address pool lists"); commands.addDescription("ip","Global IP configuration subcommands"); ! commands.addDescription("no ip","Negative global IP configuration subcommands"); ! commands.add("ip route", ip_route_Command, CONF_MODE | NETWORK_LAYER, "(<host ip>|<network ip>) <netmask> <gateway> [<target interface>]", "Add route record"); commands.add("no ip route", no_ip_route_Command, CONF_MODE | NETWORK_LAYER, "(<host ip>|<network ip>)", "Delete route record"); commands.addDescription("ip tcp","Global TCP parameters"); commands.add("ip tcp window-size", ip_tcp_window_size_Command, CONF_MODE | TRANSPORT_LAYER, "<window-size>", "TCP window size"); + commands.addDescription("show","Show running system information"); commands.add("show access-lists", show_access_lists_Command, STD_CONF_MODE | TRANSPORT_LAYER, "<1-2699 | WORD>", "List access lists"); *************** *** 210,213 **** --- 227,231 ---- commands.add("show udp statistics", show_udp_statistics_Command, STD_CONF_MODE | TRANSPORT_LAYER, "<cr>", "UDP statistics"); commands.add("show version", show_version_Command, STD_CONF_MODE | NO_LAYER, "<cr>", "System hardware and software status"); + commands.addDescription("snmp-server","Modify SNMP engine parameters"); commands.add("snmp-server community", snmp_server_community_Command, CONF_MODE | APPLICATION_LAYER, "<community>", "Enable SNMP; set community string"); *************** *** 298,302 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 316,320 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 312,316 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 330,334 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 324,328 **** device.removeARP(ArpTable.get(i).get(0)); } ! out += "ARP table have been cleared\n"; return out; } --- 342,346 ---- device.removeARP(ArpTable.get(i).get(0)); } ! out += "ARP table has been cleared\n"; return out; } *************** *** 389,393 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 407,411 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 417,421 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 435,439 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 448,452 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 466,470 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 483,487 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 501,505 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 528,532 **** String out = ""; if(device instanceof ApplicationLayerDevice){ ! } else{ --- 546,576 ---- String out = ""; if(device instanceof ApplicationLayerDevice){ ! DHCPC dhcpc = (DHCPC)((ApplicationLayerDevice)device).getApp(PC.DHCP_CLIENT_ID); ! if(dhcpc!=null){ ! if(params.size()==1){ ! try { ! if(device.getNetworkInterface(params.get(0))!=null){ ! dhcpc.StartDHCPC(params.get(0), "169.254.0.1"); ! } ! } catch (InvalidNetworkInterfaceNameException ex) { ! out += "Invalid interface name\n"; ! } catch (CommunicationException ex) { ! //ex.printStackTrace(); ! } catch (LowLinkException ex) { ! //ex.printStackTrace(); ! } catch (TransportLayerException ex) { ! //ex.printStackTrace(); ! } catch (InvalidNetworkLayerDeviceException ex) { ! out += "internal error: Invalid network layer device\n"; ! //ex.printStackTrace(); ! } ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! } ! else{ ! out += "This instruction not supported by device\n"; ! } } else{ *************** *** 549,553 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 593,597 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 567,571 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 611,615 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 584,588 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 628,632 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 606,610 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 650,654 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 640,644 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 684,688 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 685,689 **** String out = ""; if(device instanceof ApplicationLayerDevice){ ! } else{ --- 729,752 ---- String out = ""; if(device instanceof ApplicationLayerDevice){ ! DHCPC dhcpc = (DHCPC)((ApplicationLayerDevice)device).getApp(PC.DHCP_CLIENT_ID); ! if(dhcpc!=null){ ! if(params.size()==1){ ! try { ! if(device.getNetworkInterface(params.get(0))!=null){ ! dhcpc.Close(); ! } ! } catch (InvalidNetworkInterfaceNameException ex) { ! out += "Invalid interface name\n"; ! } catch (TransportLayerException ex) { ! //ex.printStackTrace(); ! } ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! } ! else{ ! out += "This instruction not supported by device\n"; ! } } else{ *************** *** 698,702 **** if(params.size()==1){ try { ! device.setMACAddress(params.get(0), params.get(1)); device.getConfig().remove("^interface "+params.get(0)+" mac-address "); } catch (InvalidNetworkInterfaceNameException ex) { --- 761,765 ---- if(params.size()==1){ try { ! device.setMACAddress(params.get(0), null); device.getConfig().remove("^interface "+params.get(0)+" mac-address "); } catch (InvalidNetworkInterfaceNameException ex) { *************** *** 705,709 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 768,772 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 723,727 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 786,879 ---- } else{ ! out += "error: invalid parameters\n"; ! } ! return out; ! } ! }; ! class ip_dhcp_pool_CommandClass implements CommandInterface{ ! public String call(Vector<String> params){ ! String out = ""; ! if(device instanceof ApplicationLayerDevice){ ! DHCPD dhcpd = (DHCPD)((ApplicationLayerDevice)device).getApp(PC.DHCP_SERVER_ID); ! if(dhcpd!=null){ ! if(params.size()==1){ ! String poolname = params.get(0); ! Pair ipmask = (Pair) pools.get(poolname); ! if(ipmask!=null){ ! DHCPD.pool pool = dhcpd.new_pool(); ! pool.IP = (String) ipmask.getFirst(); ! pool.Genmask = (String) ipmask.getSecond(); ! pool.Gateway = "???.???.???.???";; ! pool.MAC = "??:??:??:??:??:??"; ! dhcpd.pools.put(poolname, pool); ! try { ! dhcpd.Listen(); ! } catch (TransportLayerException ex) { ! out += "error: dhcp server has not started to listen"; ! } ! device.getConfig().remove("^ip dhcp pool "+poolname+"$"); ! device.getConfig().add("ip dhcp pool "+poolname); ! } ! else{ ! out += "error: pool "+poolname+" not exists\n"; ! } ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! } ! else{ ! out += "This instruction not supported by device\n"; ! } ! } ! else{ ! out += "This instruction not supported by device\n"; ! } ! return out; ! } ! }; ! class no_ip_dhcp_pool_CommandClass implements CommandInterface{ ! public String call(Vector<String> params){ ! return ""; ! } ! }; ! class ip_local_pool_CommandClass implements CommandInterface{ ! public String call(Vector<String> params){ ! String out = ""; ! if(params.size()==3){ ! String poolname = params.get(0); ! if(IPV4Address.validateDecIP(params.get(1)) && IPV4Address.validateDecSubnetMask(params.get(2), params.get(1))){ ! if(pools.containsKey(poolname)){ ! ((Pair)pools.get(poolname)).setFirst(params.get(1)); ! ((Pair)pools.get(poolname)).setSecond(params.get(2)); ! } ! else{ ! pools.put(poolname, new Pair(params.get(1), params.get(2))); ! } ! device.getConfig().remove("^ip local pool "+poolname+" "); ! device.getConfig().addBefore("ip local pool "+poolname+" "+params.get(1)+" "+params.get(2), device.getConfig().working_config, " pool "+poolname+"($| ?)"); ! } ! else{ ! out += "error: invalid ip address or net mask\n"; ! } ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! return out; ! } ! }; ! class no_ip_local_pool_CommandClass implements CommandInterface{ ! public String call(Vector<String> params){ ! String out = ""; ! if(params.size()==1){ ! String poolname = params.get(0); ! if(pools.containsKey(poolname)){ ! pools.remove(poolname); ! } ! device.getConfig().remove("^ip local pool "+poolname+" "); ! } ! else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 731,742 **** public String call(Vector<String> params){ String out = ""; ! if(params.size()==4){ ! device.getConfig().remove("^ip route "+params.get(0)+" "+params.get(1)); ! device.getConfig().add("ip route "+params.get(0)+" "+params.get(1)+" "+params.get(2)+" "+params.get(3)); ! device.addRoute(new Route_entry(params.get(0), params.get(2), params.get(1), params.get(3), 0)); ! out+="Route added.\n"; } else{ ! out += "Invalid parameters\n"; } return out; --- 883,914 ---- public String call(Vector<String> params){ String out = ""; ! if(params.size()==4 || params.size()==3){ ! String dest = params.get(0); ! String mask = params.get(1); ! device.getConfig().remove("^ip route "+dest+" "+mask); ! if(params.size()==4){ ! device.getConfig().add("ip route "+dest+" "+mask+" "+params.get(2)+" "+params.get(3)); ! } ! else{ ! device.getConfig().add("ip route "+dest+" "+mask+" "+params.get(2)+" eth0"); ! } ! if((dest.compareToIgnoreCase("default")==0 || dest.equals("0.0.0.0")) && mask.equals("0.0.0.0")){ ! try { ! device.setDefaultGateway(params.get(2)); ! out+="Default gateway added.\n"; ! } catch (InvalidNodeNameException ex) { ! out+="internal error: invalid node name!\n"; ! ex.printStackTrace(); ! } catch (InvalidDefaultGatewayException ex) { ! out+="error: invalid default gateway.\n"; ! } ! } ! else{ ! device.addRoute(new Route_entry(params.get(0), params.get(2), params.get(1), params.get(3), 0)); ! out+="Route added.\n"; ! } } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 747,756 **** String out = ""; if(params.size()==1){ ! device.getConfig().remove("^ip route "+params.get(0)); ! device.removeRoute(params.get(0)); ! out+="Route to " + params.get(0) + " removed.\n"; } else{ ! out += "Invalid parameters\n"; } return out; --- 919,942 ---- String out = ""; if(params.size()==1){ ! String dest = params.get(0); ! device.getConfig().remove("^ip route "+dest); ! if(dest.compareToIgnoreCase("default")==0 || dest.equals("0.0.0.0")){ ! try { ! device.setDefaultGateway(null); ! out+="Default gateway removed.\n"; ! } catch (InvalidNodeNameException ex) { ! out+="internal error: invalid node name!\n"; ! ex.printStackTrace(); ! } catch (InvalidDefaultGatewayException ex) { ! out+="internal error: invalid default gateway.\n"; ! } ! } ! else{ ! device.removeRoute(dest); ! out+="Route to " + params.get(0) + " removed.\n"; ! } } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 772,776 **** } else{ ! out += "Invalid parameters\n"; } } --- 958,962 ---- } else{ ! out += "error: invalid parameters\n"; } } *************** *** 911,915 **** } else{ ! out += "Invalid parameters\n"; } return out; --- 1097,1101 ---- } else{ ! out += "error: invalid parameters\n"; } return out; *************** *** 1149,1153 **** } else{ ! out += "Invalid parameters\n"; } } --- 1335,1339 ---- } else{ ! out += "error: invalid parameters\n"; } } *************** *** 1175,1179 **** } else{ ! out += "Invalid parameters\n"; } } --- 1361,1365 ---- } else{ ! out += "error: invalid parameters\n"; } } *************** *** 1210,1218 **** device.getConfig().add("snmp server port "+params.get(0)); }catch(NumberFormatException e){ ! out += "Invalid parameters\n"; } } else{ ! out += "Invalid parameters\n"; } } --- 1396,1404 ---- device.getConfig().add("snmp server port "+params.get(0)); }catch(NumberFormatException e){ ! out += "error: invalid parameters\n"; } } else{ ! out += "error: invalid parameters\n"; } } *************** *** 1261,1269 **** device.getConfig().add("telnet server "+params.get(0)); }catch(NumberFormatException e){ ! out += "Invalid parameters\n"; } } else{ ! out += "Invalid parameters\n"; } } --- 1447,1455 ---- device.getConfig().add("telnet server "+params.get(0)); }catch(NumberFormatException e){ ! out += "error: invalid parameters\n"; } } else{ ! out += "error: invalid parameters\n"; } } *************** *** 1291,1295 **** } else{ ! out += "Invalid parameters\n"; } } --- 1477,1481 ---- } else{ ! out += "error: invalid parameters\n"; } } Index: EthernetNetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/EthernetNetworkInterface.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EthernetNetworkInterface.java 13 Oct 2007 12:57:00 -0000 1.8 --- EthernetNetworkInterface.java 18 Oct 2007 22:22:09 -0000 1.9 *************** *** 56,60 **** * Stores The MAC address for each instance of this class * */ ! protected String MACAddress; /** --- 56,61 ---- * Stores The MAC address for each instance of this class * */ ! protected String MACAddress; ! protected String defaultMACAddress; /** *************** *** 73,77 **** //set MAC address to null, as hub dont have MAC address. }else{ ! MACAddress = setMacAddress(); } --- 74,79 ---- //set MAC address to null, as hub dont have MAC address. }else{ ! MACAddress = setMacAddress(); ! defaultMACAddress = MACAddress; } *************** *** 212,216 **** protected final void setMacAddress(String macAddress){ ! this.MACAddress = macAddress; } --- 214,223 ---- protected final void setMacAddress(String macAddress){ ! if(macAddress==null){ ! this.MACAddress = defaultMACAddress; ! } ! else{ ! this.MACAddress = macAddress; ! } } Index: DeviceConfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DeviceConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DeviceConfig.java 16 Oct 2007 23:02:31 -0000 1.5 --- DeviceConfig.java 18 Oct 2007 22:22:09 -0000 1.6 *************** *** 92,101 **** */ public boolean add(String command){ ! return addBefore(command, null); } ! public boolean addBefore(String command, String beforeCommand){ boolean result = false; ! LinkedList config = getConfig(working_config); boolean found = false; int index = -1; --- 92,105 ---- */ public boolean add(String command){ ! return add(command, working_config); } ! public boolean add(String command, int config_name){ ! return addBefore(command, config_name, null); ! } ! ! public boolean addBefore(String command, int config_name, String beforeCommand){ boolean result = false; ! LinkedList config = getConfig(config_name); boolean found = false; int index = -1; *************** *** 133,141 **** */ public boolean remove(String command){ boolean result = false; try{ Pattern p = Pattern.compile(command); ! LinkedList config = getConfig(working_config); Iterator<String> it = config.iterator(); while(it.hasNext()){ --- 137,149 ---- */ public boolean remove(String command){ + return remove(command, working_config); + } + + public boolean remove(String command, int config_name){ boolean result = false; try{ Pattern p = Pattern.compile(command); ! LinkedList config = getConfig(config_name); Iterator<String> it = config.iterator(); while(it.hasNext()){ *************** *** 156,164 **** */ public boolean isExists(String command){ boolean result = false; try{ Pattern p = Pattern.compile(command); ! LinkedList config = getConfig(working_config); Iterator<String> it = config.iterator(); while(it.hasNext() && !result){ --- 164,176 ---- */ public boolean isExists(String command){ + return isExists(command, working_config); + } + + public boolean isExists(String command, int config_name){ boolean result = false; try{ Pattern p = Pattern.compile(command); ! LinkedList config = getConfig(config_name); Iterator<String> it = config.iterator(); while(it.hasNext() && !result){ Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Simulation.java 16 Oct 2007 23:02:31 -0000 1.19 --- Simulation.java 18 Oct 2007 22:22:09 -0000 1.20 *************** *** 350,353 **** --- 350,355 ---- //nld.setCustomSubnetMask(inInterface, inCustomSubnetMask); nld.getConfig().executeCommand("interface "+inInterface+" ip address "+nld.getIPAddress(inInterface)+" "+inCustomSubnetMask); + nld.getConfig().remove("interface "+inInterface+" ip address ", DeviceConfig.STARTUP_CONFIG); + nld.getConfig().add("interface "+inInterface+" ip address "+nld.getIPAddress(inInterface)+" "+inCustomSubnetMask, DeviceConfig.STARTUP_CONFIG); } else *************** *** 385,390 **** { //test if device is a network layer device NetworkLayerDevice t = (NetworkLayerDevice)temp; ! t.setDefaultGateway(inGatewayIPAddress); ! //t.getConfig().executeCommand("ip route 0.0.0.0 0.0.0.0 "+inGatewayIPAddress+" eth0"); //t.getConfig().executeCommand("ip route default 0.0.0.0 "+inGatewayIPAddress+" eth0"); } --- 387,394 ---- { //test if device is a network layer device NetworkLayerDevice t = (NetworkLayerDevice)temp; ! //t.setDefaultGateway(inGatewayIPAddress); ! t.getConfig().executeCommand("ip route 0.0.0.0 0.0.0.0 "+inGatewayIPAddress+" eth0"); ! t.getConfig().remove("^ip route 0.0.0.0 0.0.0.0 ", DeviceConfig.STARTUP_CONFIG); ! t.getConfig().add("ip route 0.0.0.0 0.0.0.0 "+inGatewayIPAddress+" eth0", DeviceConfig.STARTUP_CONFIG); //t.getConfig().executeCommand("ip route default 0.0.0.0 "+inGatewayIPAddress+" eth0"); } *************** *** 447,450 **** --- 451,456 ---- //t.setIPAddress(inNodeInterface,inIPAddress); t.getConfig().executeCommand("interface "+inNodeInterface+" ip address "+inIPAddress+" "+t.getSubnetMask(inNodeInterface)); + t.getConfig().remove("^interface "+inNodeInterface+" ip address ", DeviceConfig.STARTUP_CONFIG); + t.getConfig().add("interface "+inNodeInterface+" ip address "+inIPAddress+" "+t.getSubnetMask(inNodeInterface), DeviceConfig.STARTUP_CONFIG); macAddress = t.getMACAddress(inNodeInterface); updateARP(inIPAddress, macAddress, inNodeName); *************** *** 531,534 **** --- 537,542 ---- //tempNet.addToARPStatic(inIPAddress, inMACAddress); tempNet.getConfig().executeCommand("arp "+inIPAddress+" "+inMACAddress); + tempNet.getConfig().remove("^arp "+inIPAddress+" ", DeviceConfig.STARTUP_CONFIG); + tempNet.getConfig().add("arp "+inIPAddress+" "+inMACAddress, DeviceConfig.STARTUP_CONFIG); } *************** *** 551,554 **** --- 559,563 ---- //tempNet.removeARP(inIPAddress); tempNet.getConfig().executeCommand("no arp "+inIPAddress); + tempNet.getConfig().add("no arp "+inIPAddress, DeviceConfig.STARTUP_CONFIG); } |