{"id":18103138,"url":"https://github.com/juniper/ruby-junos-ez-stdlib","last_synced_at":"2025-03-17T09:08:51.075Z","repository":{"id":7721248,"uuid":"9087120","full_name":"Juniper/ruby-junos-ez-stdlib","owner":"Juniper","description":"A collection of Ruby classes to make Junos automation Easy.  This is the \"standard library\" supported on all devices.","archived":true,"fork":false,"pushed_at":"2023-06-14T13:37:38.000Z","size":694,"stargazers_count":37,"open_issues_count":11,"forks_count":35,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-17T09:08:46.005Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Juniper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-03-28T21:50:27.000Z","updated_at":"2025-03-13T10:02:44.000Z","dependencies_parsed_at":"2024-06-20T23:25:46.691Z","dependency_job_id":"a7b4bcbf-57ef-4d09-bbb1-df3bf0dc7846","html_url":"https://github.com/Juniper/ruby-junos-ez-stdlib","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fruby-junos-ez-stdlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fruby-junos-ez-stdlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fruby-junos-ez-stdlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fruby-junos-ez-stdlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Juniper","download_url":"https://codeload.github.com/Juniper/ruby-junos-ez-stdlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244006278,"owners_count":20382444,"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":["ruby"],"created_at":"2024-10-31T22:10:27.923Z","updated_at":"2025-03-17T09:08:51.052Z","avatar_url":"https://github.com/Juniper.png","language":"Ruby","readme":"[![Gem Version](https://badge.fury.io/rb/junos-ez-stdlib.svg)](https://badge.fury.io/rb/junos-ez-stdlib)[![Dependency Status](https://gemnasium.com/badges/github.com/Juniper/ruby-junos-ez-stdlib.svg)](https://gemnasium.com/github.com/Juniper/ruby-junos-ez-stdlib)\n[![Build Status](https://travis-ci.org/Juniper/ruby-junos-ez-stdlib.svg?branch=master)](https://travis-ci.org/Juniper/ruby-junos-ez-stdlib)\n\n# OVERVIEW\n\nRuby framework to support Junos OS based device management automation.  \n\nThis is the \"standard library\" or \"core\" set of functionality that should work on most/all Junos OS based devices.  \n\nThis framework is build on top of the NETCONF gem which uses XML as the fundamental data-exchange.  So no\n\"automating the CLI\" or using SNMP.  The purpose of this framework is to **enable automation development\nwithout requiring specific Junos XML knowledge**.\n\nFurther documentation can be found in the *docs* subdirectory.\n\n# FRAMEWORK\n\nThe framework is comprised of these basic eloements:\n\n  - Facts:\n\n    A Hash of name/value pairs of information auto-collected.  Fact values can be Hash structures as well\n    so you can have deeply nested fact data.  You can also define your own facts in addition to the \"stdlib\" facts.\n    The facts are used by the framework to create a platform indepent layer of abstraction.  This means\n    that managing a VLAN, for example, is the same regardless of the underlying hardware platofrm (EX, QFX,\n    MX, SRX, ...)\n\n  - Resources:\n\n    Resources allow you to easily configure and perform operational functions on specific items within Junos,\n    for example VLANs, or switch ports.  A resource has *properties* that you manipuate as Hash.  You can\n    interact with Junos using resource methods like `read!`, `write!`, `delete!`, `activate!`, `deactivate!`, etc.\n    For a complete listing of resource methods, refer to the *docs* directory\n\n  - Providers:\n\n    Providers allow you to manage a collection of resource, and most commonly, select a resource.  \n    The purpose of a provider/resource is to automate the life-cycle of common changes, like adding\n    VLANs, or ports to a VLAN.  A provider also allows you to obtain a `list` of resources\n    (Array of *names*) or a `catalog` (Hash of resource properties).  Providers may include resource\n    specific functionality, like using complex YAML/Hash data for easy import/export and provisioning\n    with Junos.  If you need the ability to simply apply config-snippets that you do not need to model\n    as resources (as you might for initial device commissioning), the Utilities library is where you\n    want to start.\n\n  - Utilities:\n\n    Utilities are simply collections of functions.  The **configuration** utilities, for example, will\n    allow you to easily push config snippets in \"curly-brace\", \"set\", or XML formats.  Very useful\n    for unmanaged provider/resources (like initial configuration of the device).  The\n    **routing-engine** utilities, for example, will allow you to easily upgrade software, check\n    memory usage, and do `ping` operations.\n\n# EXAMPLE USAGE\n\n```ruby\nrequire 'pp'\nrequire 'net/netconf/jnpr'\nrequire 'junos-ez/stdlib'\n\nunless ARGV[0]\n   puts \"You must specify a target\"\n   exit 1\nend\n\n# login information for NETCONF session\nlogin = { :target =\u003e ARGV[0], :username =\u003e 'jeremy',  :password =\u003e 'jeremy1',  }\n\n## create a NETCONF object to manage the device and open the connection ...\n\nndev = Netconf::SSH.new( login )\nprint \"Connecting to device #{login[:target]} ... \"\nndev.open\nputs \"OK!\"\n\n## Now bind providers to the device object. The 'Junos::Ez::Provider' must be first.\n## This will retrieve the device 'facts'.  The other providers allow you to define the\n## provider variables; so this example is using 'l1_ports' and 'ip_ports', but you could name\n## them what you like, yo!\n\nJunos::Ez::Provider( ndev )\nJunos::Ez::L1ports::Provider( ndev, :l1_ports )\nJunos::Ez::IPports::Provider( ndev, :ip_ports )\nJunos::Ez::Config::Utils( ndev, :cu )\n\n# -----------------------------------------------------------\n# Facts ...\n# -----------------------------------------------------------\n\n# show the device softare version fact\npp ndev.fact :version\n\n# show the device serial-number face\npp ndev.fact :serialnumber\n\n# get a list of all available facts (Array)\npp ndev.facts.list\n\n# get a hash of all facts and their associated values\npp ndev.facts.catalog\n\n# -----------------------------------------------------------\n# Layer 1 (physical ports) Resources ...\n# -----------------------------------------------------------\n\npp ndev.l1_ports.list\npp ndev.l1_ports.catalog\n\n# select port 'ge-0/0/0' and display the contents\n# of the properties (like port, speed, description)\n\nge_0 = ndev.l1_ports['ge-0/0/0']\npp ge_0.to_h\n\n# change port to disable, this will write the change\n# but not commit it.\n\nge_0[:admin] = :down\nge_0.write!\n\n# show the diff of the change to the screen\n\nputs ndev.cu.diff?\n\n# now rollback the change, since we don't want to save it.\n\nndev.cu.rollback!\n\nndev.close\n```\n\n# PROVIDERS\n\nProviders manage access to individual resources and their associated properties.  Providers/resources exists\nfor managing life-cycle common changes that you generally need as part of a larger workflow process.  For more\ndocumentation on Providers/Resources, see the *docs* directory.\n\n  - L1ports: Physical port management\n  - L2ports: Ethernet port (VLAN) management\n  - Vlans: VLAN resource management\n  - IPports: IP v4 port management\n  - StaticHosts: Static Hosts [system static-host-mapping ...]  \n  - StaticRoutes: Static Routes [routing-options static ...]\n  - Group: JUNOS groups management\n\n# UTILITIES\n\n  - Config:\n\n    These functions allow you to load config snippets, do commit checks, look at config diffs, etc.\n    Generally speaking, you would want to use the Providers/Resources framework to manage specific\n    items in the config.  This utility library is very useful when doing the initial commissioning\n    process, where you do not (cannot) model every aspect of Junos.  These utilities can also be\n    used in conjunction with Providers/Resources, specifically around locking/unlocking and committing\n    the configuration.\n\n  - Filesystem:\n\n    These functions provide you \"unix-like\" commands that return data in Hash forms rather than\n    as string output you'd normally have to screen-scraps.  These methods include `ls`, `df`, `pwd`,\n    `cwd`, `cleanup`, and `cleanup!`\n\n  - Routing-Engine:\n\n    These functions provide a general collection to information and functioanlity for handling\n    routing-engine (RE) processes.  These functions `reboot!`, `shutdown!`, `install_software!`,\n    `ping`.  Information gathering such as memory-usage, current users, and RE status information\n    is also made available through this collection.\n\n# DEPENDENCIES\n\n  * gem netconf\n  * Junos OS based products\n\n# INSTALLATION\n\n  * gem install junos-ez-stdlib\n\n# CONTRIBUTORS\n  Juniper Networks is actively contributing to and maintaining this repo. Please contact jnpr-community-netdev@juniper.net\n  for any queries.\n\n  Contributors:\n  [John Deatherage](https://github.com/routelastresort), [Nitin Kumar](https://github.com/vnitinv),\n  [Priyal Jain](https://github.com/jainpriyal), [Ganesh Nalawade](https://github.com/ganeshrn)\n\n  Former Contributors:  \n  [Jeremy Schulman](https://github.com/jeremyschulman)\n\n# LICENSES\n\n   BSD-2, See LICENSE file\n\n# SUPPORT\n\nSupport for this software is made available exclusively through Github repo issue tracking.  You are also welcome to contact the CONTRIBUTORS directly via their provided contact information.  \n\nIf you find a bug, please open an issue against this repo.\n\nIf you have suggestions or ideas, please write them up and add them to the \"SUGGESTION-BOX\" folder of this repo (via pull request).  This way we can share the ideas with the community and crowdsource for feature delivery.\n\nThank you!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniper%2Fruby-junos-ez-stdlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuniper%2Fruby-junos-ez-stdlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniper%2Fruby-junos-ez-stdlib/lists"}