To update the candidate configuration on a device running Junos OSĪnd then commits the new configuration. The following example performs a load merge operation load configuration data as Junos XML tag elementsĭevice.loadXMLConfiguration(ftp_config.toString(), "merge") device.loadXMLFile(config_file_xml, "merge") load configuration data as formatted ASCII textĭevice.loadTextConfiguration("system ", "merge") device.loadTextFile(config_file_text, "merge") load configuration data as Junos OS configuration mode commandsĭevice.loadSetConfiguration("set system services ftp") device.loadSetFile(config_file_set) open a private copy of the candidate configuration XML ftp_config = builder.createNewConfig("system", "services", "ftp") ĭevice device = new Device("10.10.1.1","admin","PaSsWoRd",null) String config_file_xml = "configs/r1-config-xml.txt" String config_file_text = "configs/r1-config-text.txt" String config_file_set = "configs/r1-config-set.txt" The appropriate hierarchy in the desired format. When loading from a file, the file should contain The Java statement for each type of load configuration Into the candidate configuration at the hierarchy level. The following code snippet merges the ftp statement LoadXMLFile(String filePath, String loadType)-Load The configuration data in the program code as a object, which is passed to the method. LoadXMLConfiguration(String XMLConfiguration, String loadType)-Specify Hierarchy under the root, the tag element, down to each new or changed element. Include the tag elements representing all levels of the configuration ![]() ![]() The configuration data from the file specified by filePath.įollowing methods load configuration data as Junos XML tag elements. LoadTextFile(String filePath, String loadType)-Load The configuration data in the program code, either as a method argument LoadTextConfiguration(String textConfiguration, String loadType)-Specify Junos OS CLI notations-the newline character, tabs, spaces,īraces, and square brackets-to indicate the hierarchical relationships Methods load configuration data as formatted ASCII text. LoadSetFile(String filePath)-Load the configuration data from the file specified LoadSetConfiguration(String setCommands)-Specify the configuration data in the programĬode, either as a method argument or as a variable passed to the method. Or you can use navigation commands, such as edit, to moveĪround the configuration hierarchy as you do in CLI configuration For eachĮlement, you can specify the complete statement path in the command, OS executes the configuration instructions line by line. On devices running Junos OS Release 11.4 or a later release. Junos OS configuration mode commands-The following methods load configuration data as a set of Mode commands load merge or load replace on The string argument loadType has a value of either merge or replace, which performs the equivalent of the configuration On the source and the format of the data. The method used to load the configuration data depends Your configuration changes are loaded into the global copy of the With the string argument "private" on the device object before loading To configure a private copy of the candidate configuration,Ĭall the openConfiguration("private") method Supply the configuration data in the program code, or you can referenceĭata files that include the desired configuration changes. ![]() To load configuration data on a remote device, the Device object has several methods that enable you toĭefine the configuration data as a set of Junos OS configuration modeĬommands, formatted ASCII text, or Junos XML tag elements. The methods are overloaded to take a number of different formats. Has methods to help you configure remote devices.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |