{ "info": { "author": "Jeremy Schulman", "author_email": "jschulman@juniper.net", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Outbound SSH Server for use with Junos PyEZ\n\nProvides the server for use with the Junos outbound ssh feature.\n\n# About Outbound SSH\n\nJunos based networking systems support a feature called \"outbound ssh\". This feature instructs\nthe Junos device to create an SSH session to a remote server. For example, the following Junos\nconfiguration will instruct the Junos device to create an outbound SSH connection to a server\nat IP address 192.168.229.1 on port 9000\n\n````\nsystem {\n services {\n outbound-ssh {\n client netnoob {\n device-id netnoob;\n services netconf;\n 192.168.229.1 port 9000;\n }\n }\n}\n````\n\nThe purpose of the OSSH server is to accept this outbound connection and allow then perform\nNETCONF commands.\n\n# Example Usage\n\n## Create the Server\n\nThe following creates a server that listens to any IP interface on the host (0.0.0.0) on port 9000.\nWhen the inbound connection is made, the server will then establish a NETCONF session with the\ndevice using the login user 'admin' and the password 'juniper123'. \n\n````python\nfrom junospyez_ossh_server import OutboundSSHServer\n\nserver = OutboundSSHServer('0.0.0.0', port=9000, login_user='admin', login_password='juniper123')\n````\n\n## Starting the Server\n\nWhen the server establishes the NETCONF session a user-provided callback will be invoked with\nthe Junos PyEZ device object and a dictionary of basic facts. For example:\n\n````python\n\nimport json\n\ndef dump_device_facts(device, facts):\n print(\"GOT FACTS: \", json.dumps(facts, indent=3))\n\n\nserver.start(on_device=dump_device_facts)\n````\n\nThe following is example output to illustrate the facts that are gathered as part of the server\nfunctionality.\n\n```text\nGOT FACTS: {\n \"os_version\": \"15.1X53-D59.3\",\n \"hostname\": \"JX0218140351\",\n \"device_sn\": \"JX0218140351\",\n \"device_model\": \"EX2300-48T\",\n \"mgmt_interface\": \"vme\",\n \"mgmt_ipaddr\": \"192.168.230.13\",\n \"mgmt_macaddr\": \"f0:4b:3a:fe:4a:22\"\n}\n```\n\nAs a developer, you can create an `on_device` callback function that performs any NETCONF RPC that\nthe login_user is allowed to do.\n\n## Logging\n\nThe server package includes a `log` module so you can easily control the aspects of logging. The\nlogger is a property of the server instance. For example, you could output all INFO level\nlogs to stdout using the following:\n\n```python\nimport logging\n\nserver.logger.setLevel(logging.INFO)\nserver.logger.addHandler(logging.StreamHandler())\n\nserver.start(on_device=dump_device_facts)\n```\n\nWould result in the following stdout:\n\n```text\noutbound-ssh-server: starting on 0.0.0.0:9000\noutbound-ssh-server: started\noutbound-ssh-server: accepted connection from 192.168.230.13:62572\nestablishing netconf to device via: 192.168.230.13:62572\ngathering basic facts from device via: 192.168.230.13:62572\n{\n \"os_version\": \"15.1X53-D59.3\",\n \"hostname\": \"JX0218140351\",\n \"device_sn\": \"JX0218140351\",\n \"device_model\": \"EX2300-48T\",\n \"mgmt_interface\": \"vme\",\n \"mgmt_ipaddr\": \"192.168.230.13\",\n \"mgmt_macaddr\": \"f0:4b:3a:fe:4a:22\"\n}\ncompleted device with management IP address: 192.168.230.13\nGOT FACTS: {\n \"os_version\": \"15.1X53-D59.3\",\n \"hostname\": \"JX0218140351\",\n \"device_sn\": \"JX0218140351\",\n \"device_model\": \"EX2300-48T\",\n \"mgmt_interface\": \"vme\",\n \"mgmt_ipaddr\": \"192.168.230.13\",\n \"mgmt_macaddr\": \"f0:4b:3a:fe:4a:22\"\n}\n```\n\n## Stopping the Server\n\nTo shutdown the server use the `stop` method:\n\n````python\nserver.stop()\n````\n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jeremyschulman/junospyez-ossh-server", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "junospyez-ossh-server", "package_url": "https://pypi.org/project/junospyez-ossh-server/", "platform": "", "project_url": "https://pypi.org/project/junospyez-ossh-server/", "project_urls": { "Homepage": "https://github.com/jeremyschulman/junospyez-ossh-server" }, "release_url": "https://pypi.org/project/junospyez-ossh-server/0.1.2/", "requires_dist": [ "junos-eznc (>=2.2.0)" ], "requires_python": "", "summary": "Outbound SSH for use with Junos systems", "version": "0.1.2" }, "last_serial": 4394317, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "7cf7e13e54527012b341077d1b6a61ee", "sha256": "d283907d1966466047c81af1dc3f0911c4d5742a1a58edc1d801aa6b31093b24" }, "downloads": -1, "filename": "junospyez_ossh_server-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7cf7e13e54527012b341077d1b6a61ee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8603, "upload_time": "2018-10-19T14:05:19", "url": "https://files.pythonhosted.org/packages/14/26/ce6df301260aa36f4af4a743eab9b56b9ccf1c345fa1f1862b86ba2de0aa/junospyez_ossh_server-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cc6256e7aaf969edca2cb48158c4eebc", "sha256": "88ef201fa7b77177a6cc99076c2bf91cc8574924becc00afc0fbb8694768ec24" }, "downloads": -1, "filename": "junospyez-ossh-server-0.1.2.tar.gz", "has_sig": false, "md5_digest": "cc6256e7aaf969edca2cb48158c4eebc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6635, "upload_time": "2018-10-19T14:05:20", "url": "https://files.pythonhosted.org/packages/ad/3a/9daadb2d7ff4bd7b4799e7f4281d74a21fe1a9b1b91b8edd86d51f7b4330/junospyez-ossh-server-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7cf7e13e54527012b341077d1b6a61ee", "sha256": "d283907d1966466047c81af1dc3f0911c4d5742a1a58edc1d801aa6b31093b24" }, "downloads": -1, "filename": "junospyez_ossh_server-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7cf7e13e54527012b341077d1b6a61ee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8603, "upload_time": "2018-10-19T14:05:19", "url": "https://files.pythonhosted.org/packages/14/26/ce6df301260aa36f4af4a743eab9b56b9ccf1c345fa1f1862b86ba2de0aa/junospyez_ossh_server-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cc6256e7aaf969edca2cb48158c4eebc", "sha256": "88ef201fa7b77177a6cc99076c2bf91cc8574924becc00afc0fbb8694768ec24" }, "downloads": -1, "filename": "junospyez-ossh-server-0.1.2.tar.gz", "has_sig": false, "md5_digest": "cc6256e7aaf969edca2cb48158c4eebc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6635, "upload_time": "2018-10-19T14:05:20", "url": "https://files.pythonhosted.org/packages/ad/3a/9daadb2d7ff4bd7b4799e7f4281d74a21fe1a9b1b91b8edd86d51f7b4330/junospyez-ossh-server-0.1.2.tar.gz" } ] }