# ***** BEGIN LICENSE BLOCK ***** # # Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren # Copyright (C) 2017-2020 Olof Hagsand # # This file is part of CLIXON # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), # in which case the provisions of the GPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of the GPL, and not to allow others to # use your version of this file under the terms of Apache License version 2, # indicate your decision by deleting the provisions above and replace them with # the notice and other provisions required by the GPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the Apache License version 2 or the GPL. # # ***** END LICENSE BLOCK ***** # Clixon example specification CLICON_MODE="example"; CLICON_PROMPT="%U@%H> "; CLICON_PLUGIN="example_cli"; # Translate variable "value" by incrementing its characters translate value (),cli_set("/translate/value"); # Note, when switching to PT, change datamodel to only @datamodel set @datamodel, cli_set(); merge @datamodel, cli_merge(); create @datamodel, cli_create(); delete("Delete a configuration item") @datamodel, cli_del(); validate("Validate changes"), cli_validate(); commit("Commit the changes"), cli_commit(); quit("Quit"), cli_quit(); delete("Delete a configuration item") all("Delete whole candidate configuration"), delete_all("candidate"); startup("Store running as startup config"), db_copy("running", "startup"); no("Negate or remove") debug("Debugging parts of the system"), cli_debug_cli((int32)0); debug("Debugging parts of the system"), cli_debug_cli((int32)1);{ level("Set debug level: 1..n") ("Set debug level (0..n)"), cli_debug_backend(); } copy("Copy and create a new object") { interface("Copy interface"){ (|("name of interface to copy from")) to("Copy to interface") ("Name of interface to copy to"), cli_copy_config("candidate","//interface[%s='%s']","urn:ietf:params:xml:ns:yang:ietf-interfaces","name","name","toname"); } } discard("Discard edits (rollback 0)"), discard_changes(); compare("Compare running and candidate"), compare_dbs((int32)1); show("Show a particular state of the system"){ xpath("Show configuration") ("XPATH expression") ("Namespace"), show_conf_xpath("candidate"); version("Show version"), cli_show_version("candidate", "text", "/"); compare("Compare candidate and running databases"), compare_dbs((int32)0);{ xml("Show comparison in xml"), compare_dbs((int32)0); text("Show comparison in text"), compare_dbs((int32)1); } state("Show configuration and state"), cli_show_config_state("running", "text", "/");{ xml("Show configuration and state as XML"), cli_show_config_state("running", "xml", "/");{ @datamodel, cli_show_auto_state("running", "xml"); } } configuration("Show configuration"), cli_show_config("candidate", "text", "/");{ xml("Show configuration as XML"), cli_show_config("candidate", "xml", "/");{ @datamodel, cli_show_auto("candidate", "xml"); } cli("Show configuration as CLI commands"), cli_show_config("candidate", "cli", "/");{ @datamodel, cli_show_auto("candidate", "cli"); } netconf("Show configuration as netconf edit-config operation"), cli_show_config("candidate", "netconf", "/");{ @datamodel, cli_show_auto("candidate", "netconf"); } text("Show configuration as text"), cli_show_config("candidate","text","/");{ @datamodel, cli_show_auto("candidate", "text"); } json("Show configuration as JSON"), cli_show_config("candidate", "json", "/");{ @datamodel, cli_show_auto("candidate", "json"); } } } save("Save candidate configuration to XML file") ("Filename (local filename)"), save_config_file("candidate","filename"); load("Load configuration from XML file") ("Filename (local filename)"),load_config_file("filename", "replace");{ replace("Replace candidate with file contents"), load_config_file("filename", "replace"); merge("Merge file with existent candidate"), load_config_file("filename", "merge"); } example("This is a comment") ("Just a random number"), mycallback("myarg"); rpc("example rpc") ("routing instance"), example_client_rpc(""); notify("Get notifications from backend"), cli_notify("EXAMPLE", "1", "text"); no("Negate") notify("Get notifications from backend"), cli_notify("EXAMPLE", "0", "xml"); lock,cli_lock("candidate"); unlock,cli_unlock("candidate");