{"id":18804437,"url":"https://github.com/abates/netconf","last_synced_at":"2025-07-18T17:03:36.705Z","repository":{"id":3047987,"uuid":"4069327","full_name":"abates/Netconf","owner":"abates","description":null,"archived":false,"fork":false,"pushed_at":"2014-03-11T12:55:09.000Z","size":178,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T18:47:58.379Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-18T22:48:56.000Z","updated_at":"2022-01-12T00:55:27.000Z","dependencies_parsed_at":"2022-08-31T20:50:24.253Z","dependency_job_id":null,"html_url":"https://github.com/abates/Netconf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abates/Netconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abates%2FNetconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abates%2FNetconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abates%2FNetconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abates%2FNetconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abates","download_url":"https://codeload.github.com/abates/Netconf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abates%2FNetconf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265798037,"owners_count":23829874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T22:39:14.923Z","updated_at":"2025-07-18T17:03:36.663Z","avatar_url":"https://github.com/abates.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Netconf\n=======\n\nIntroduction\n------------\n\nRuby implementation of some Netconf (RFC 6241) capabilities.  In addition\nto the Netconf base capabilities, there is specific support for managing \nJuniper Infranet Controllers\n\nFor examples of use with a Juniper Infranet confoller see the code in\nthe examples/ directory\n\nExamples\n--------\n\n### Connecting to a device (default port 22)\n    begin\n      n = Netconf::Factory.create(\n        :transport =\u003e 'ssh',\n        :login =\u003e 'username',\n        :password =\u003e 'password',\n        :hostname =\u003e 'host.example.com' \n      )\n    rescue Netconf::RPCException =\u003e e\n      puts \"RPCException received:\"\n      e.errors.each do |error|\n        puts \"\\t#{error.error_message}\"\n      end\n    end\n\n### Connecting to a device (alternate port)\n    begin\n      n = Netconf::Factory.create(\n        :transport =\u003e 'ssh',\n        :login =\u003e 'username',\n        :password =\u003e 'password',\n        :hostname =\u003e 'host.example.com',\n        :port =\u003e 830\n      )\n    rescue Netconf::RPCException =\u003e e\n      puts \"RPCException received:\"\n      e.errors.each do |error|\n        puts \"\\t#{error.error_message}\"\n      end\n    end\n\n### Getting the entire config\n    begin\n      n = Netconf::Factory.create(\n        :transport =\u003e 'ssh',\n        :login =\u003e 'username',\n        :password =\u003e 'password',\n        :hostname =\u003e 'host.example.com',\n        :port =\u003e 830\n      )\n      config = n.get_config\n    rescue Netconf::RPCException =\u003e e\n      puts \"RPCException received:\"\n      e.errors.each do |error|\n        puts \"\\t#{error.error_message}\"\n      end\n    end\n\n### Getting a specific block of config\n    begin\n      n = Netconf::Factory.create(\n        :transport =\u003e 'ssh',\n        :login =\u003e 'username',\n        :password =\u003e 'password',\n        :hostname =\u003e 'host.example.com',\n        :port =\u003e 830\n      )\n      filter = \u003c\u003c_EOF\n       \u003ct:top xmlns:t=\"http://example.com/schema/1.2/config\"\u003e\n         \u003ct:interfaces\u003e\n           \u003ct:interface t:ifName=\"eth0\"/\u003e\n         \u003c/t:interfaces\u003e\n       \u003c/t:top\u003e\n      _EOF\n      config = n.get_config(filter)\n    rescue Netconf::RPCException =\u003e e\n      puts \"RPCException received:\"\n      e.errors.each do |error|\n        puts \"\\t#{error.error_message}\"\n      end\n    end\n\n### Setting a config value\n\nWe use builder to build XML blocks to send to the device.  This is very efficient since\nthe xml is being sent to the device (as opposed to being built in memory) as it is\nbeing built.  It is very easy to send config in an \"edit-config\" operation using builder,\nsimply supply a block to the edit_config method.  When called, the block will be passed an\ninstance of the builder object.\n\n    begin\n      n = Netconf::Factory.create(\n        :transport =\u003e 'ssh',\n        :login =\u003e 'username',\n        :password =\u003e 'password',\n        :hostname =\u003e 'host.example.com',\n        :port =\u003e 830\n      )\n      n.edit_config('running') do |xml|\n        xml.top( 'xmlns' =\u003e 'http://example.com/schema/1.2/config') do\n          xml.interface do\n            xml.name 'Ethernet0/0'\n            xml.mtu '1500'\n          end\n        end\n      end\n    rescue Netconf::RPCException =\u003e e\n      puts \"RPCException received:\"\n      e.errors.each do |error|\n        puts \"\\t#{error.error_message}\"\n      end\n    end\n\n\n### Adding new capabilities\n\nIt is also very easy to add new capabilities.  Capabilities are added in the form of\nRuby modules.  Any module that implements a set of capabilities need only have a\nhas_capability? method that will return true for a matching capability in the \nNetconf hello received for the device.  The Ruby Netconf API will iterate all the\nmodules in the capabilities directory and will include them in the Device class if\nthe has_capability? returns true.\n\n    module MyCapabilities\n\n      def self.has_capability? capability\n        capability =~ /http:\\/\\/example.net\\/router\\/2.3\\/myfeature/\n      end\n\n      def myfeature\n        # do whatever you need to do here\n      end\n    end\n\nFor more detailed use please see the existing capabilities in lib/netconf/capabilities/\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabates%2Fnetconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabates%2Fnetconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabates%2Fnetconf/lists"}