{"id":20074254,"url":"https://github.com/juniper/py-jnpr-wlc","last_synced_at":"2025-05-05T21:31:29.660Z","repository":{"id":137208888,"uuid":"13133350","full_name":"Juniper/py-jnpr-wlc","owner":"Juniper","description":"EXPERIMENTAL: Python library for Juniper Wireless Lan Controller (WLC) product","archived":false,"fork":false,"pushed_at":"2018-08-16T07:10:44.000Z","size":141,"stargazers_count":10,"open_issues_count":6,"forks_count":3,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-09T04:26:58.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Juniper.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-09-26T20:19:11.000Z","updated_at":"2019-02-08T13:15:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"81e95a3b-6ed3-400b-8076-80416c2271e5","html_url":"https://github.com/Juniper/py-jnpr-wlc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fpy-jnpr-wlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fpy-jnpr-wlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fpy-jnpr-wlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fpy-jnpr-wlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Juniper","download_url":"https://codeload.github.com/Juniper/py-jnpr-wlc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252580032,"owners_count":21771253,"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-13T14:50:05.321Z","updated_at":"2025-05-05T21:31:29.653Z","avatar_url":"https://github.com/Juniper.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ABOUT\n\n  Python module for Juniper Wireless LAN Controller (WLC)\n\n**STATUS**: Experimental, under active development.  \nThe WLC XML API is not public, but can be made available to existing customers.\n\n# OVERVIEW\n\n  The Juniper Wireless LAN Controller products implement a comprehensive XML-RPC API over HTTP/s.  This module provides a *metaprogramming* set of capabilities to fully utilize the API in any easy and consumable manner.  To proficiently use this API, you should be familiar with [XML](http://www.w3schools.com/xml/) and [XPath](http://www.w3schools.com/xpath/) expressions.  \n  \nThis module uses [lxml](http://lxml.de/index.html) for XML processing.  This module uses [Jinja2](http://jinja.pocoo.org/docs) for template processing.\n\n  \nThis module is developed and tested with Python 2.7.  If you are using another version and it works, please notify the maintainer.  If you are using another version and it does **not** work, please open an issue.\n\n## EXAMPLE\n\n````python\nfrom jnpr.wlc import WirelessLanController as WLC\n\nwlc = WLC( user='jeremy', host='192.168.10.27', password='logmeIn' )\n\n# auth/login to WLC device\nwlc.open()\n\n# -----------------------------------------------------\n# Get all VLANS\n# -----------------------------------------------------\n# Retrieve the current VLANs and display them.  The RPC\n# invocation here is metaprogramming.  The `rpc` object\n# metraprograms whatever comes after.  The response is \n# an lxml Element\n\nvlans = wlc.rpc.get_vlan()\n\nfor vlan in vlans.xpath('VLAN'):\n  v_num = vlan.attrib['number']\n  v_name = vlan.attrib['name']\n  print \"VLAN(%s) is named: %s\" % (v_num, v_name)\n\n# -----------------------------------------------------\n# Get only one VLAN\n# -----------------------------------------------------\n\nresp = wlc.rpc.get_vlan( name=\"VoIP\" )\nvlan = resp.find('VLAN')\nprint \"VoIP vlan number is %s\" % vlan.attrib['number']\n\n\n# cleanup/close\nwlc.close()\n````\n  For more examples, see the [example](https://github.com/jeremyschulman/py-jnprwlc/tree/master/examples) directory.\n  \n## \"FACTS\"\n\n  When you make a call to `open()` the method will retrieve bits of data about the WLC and store them\n  into a dictionary called `facts`.  You can access this data as property, as illustrated:\n\n````python\n\u003e\u003e\u003e pprint( wlc.facts )\n{'auto-config': 'NO',\n 'backup-config-location': '',\n 'booted-config-location': 'configuration',\n 'booted-image-location': 'boot0:WC075106.8XX',\n 'booted-version': '7.5.1.6.0',\n 'bootflags': '',\n 'cluster-active-seed': 'NO',\n 'console-timeout': '0',\n 'domainsecurity': 'NONE',\n 'enablepw': 'b5bacf1baa8e028e858c134e3fd2d306cc3b',\n 'fips': 'NO',\n 'idle-timeout': '3600',\n 'ip-addr': '66.129.246.74',\n 'macaddress': '78:19:F7:70:96:76',\n 'model': 'WLC880R',\n 'mx-secret': '',\n 'name': 'WLC880R',\n 'next-config-location': 'configuration',\n 'next-image-location': 'boot0:WC075106.8XX',\n 'next-image-version': '7.5.1.6.0',\n 'objectid': '1.3.6.1.4.1.14525.3.3.1',\n 'platform': '802',\n 'serialnumber': 'JJ0211401124',\n 'tunnelsecurity': 'NONE',\n 'type': 'DP',\n 'uptime': '0'}\n \n\n\u003e\u003e\u003e wlc.facts['serialnumber']\n'JJ0211401124'\n\n\u003e\u003e\u003e wlc.facts['macaddress']\n'78:19:F7:70:96:76'\n\n````\n\n## RPC METAPROGRAMMING\n\nYou can issue WLC XML RPCs in a few different ways.  These methods use Python metaprogramming techniques.  \nMetapgramming means the this module automatically generates the XML RPC commands on-the-fly without\nhaving to maintain a static set of function bound to a specifc WLC release of code.\n\nFor details on issuing [RPCs](docs/wlc_class.md) and [metaprogramming](docs/metaprogramming.md), refer to the embbedded links.  \n\n## \"EZ\" MICROFRAMEWORK\n\nEach WLC object has an `ez` attribute that can be used to attach helper functions or packages.  The purpose of these functions is provide natural Python language bindings around the WLC XML API so that the results are not XML, but native types, like dictionaries.\n\nThere are a few _builtin_ helper functions that are autoinstalled as part of every WLC object.  For details, refer to the [helpers](lib/jnprwlc/helpers) directory.\n\nHere is an example using the builin helper to save the configuration:\n````python\nwlc.ez.save_config()\n````\n\nFor more details on using the \"EZ\" framework, see [here](docs/ez_framework.md).\n## LOGGING\n\nEach WLC instance can support transaction logging.  You can use this facility by assigning an open file to the WLC instance, for example:\n````python\nwlc.logfile = open(r'/var/tmp/'+wlc.hostname+'.xml', \"w+\")\n````\nThe contents of the log file are the XML commands and assocaited responses.  Each transaction will flush the results to the file.  You are required to perform any file close/cleanup.\n\n## TEMPLATING\n\nThis module supports using Jinja2 templates in conjunction with the creation of complex RPCs.  Template files can be located in either the program's current working directory, or template directory for this module.  A configurable search-path option will be added as an enhancement. \n\nThere are a few options for using templates.  These are described in detail [here]().\n\nThe following uses a template file [vlan_set_ports.xml](https://github.com/jeremyschulman/py-jnprwlc/blob/master/lib/jnprwlc/templates/vlan_set_ports.xml) that happens to be stored in the module template directory.\n````python\nvlan_vars = dict(\n  number = 100,\n  ports = [\n    dict(port=2, tag=50),\n    dict(port=3)\n  ]\n)\n\nrpc = wlc.RpcMaker('set', Template='vlan_set_ports', TemplateVars=vlan_vars )\n\nprint \"Settting ports on VLAN ...\"\nrsp = rpc()\n````\n\n\n## EXCEPTIONS\n\n  This module provides an `RpcError` exception, which inherits from StandardError.  This exception will be raised if the RPC response is an `ERROR-RESP`.\n  The `RpcError` encapsulates both the RPC command and RPC response attributes; both stored as lxml Element.  For \n  example usage, see [this](https://github.com/jeremyschulman/py-jnprwlc/blob/master/examples/try_except.py).\n  \n  \n## DEPENDENCIES\n\n  * [Python 2.7](http://www.python.org/)\n  * [lxml](http://lxml.de/index.html)\n  * [jinja2](http://jinja.pocoo.org/docs)\n\n## LICENSE\n  Apache 2.0\n\n## CONTRIBUTORS\n\n  * Jeremy Schulman, @nwkautomaniac\n  * Tim McCarthy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniper%2Fpy-jnpr-wlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuniper%2Fpy-jnpr-wlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniper%2Fpy-jnpr-wlc/lists"}