{ "info": { "author": "Mihai Catalin Teodosiu", "author_email": "teodosiu_mc@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "Intended Audience :: Telecommunications Industry", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2 :: Only", "Topic :: Education", "Topic :: Education :: Computer Aided Instruction (CAI)", "Topic :: Education :: Testing", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Networking", "Topic :: Terminals :: Telnet", "Topic :: Text Editors :: Documentation" ], "description": "AvayaERSConnect.py Documentation\r\n\r\n\r\nThe AvayaERSConnect Python module is build using Python 2.7.3, on top of the telnetlib library and it works with any version of Python >= 2.7.x. Other versions below 2.7.x were not tested.\r\n\r\nAvayaERSConnect is published under the MIT License.\r\n\r\nThe official documentation of telnetlib is accessible here:\r\nhttps://docs.python.org/2/library/telnetlib.html\r\n\r\n\r\nAvayaERSConnect\u2019s main purpose is to connect to any Avaya ERS Device via Telnet and perform various administration operations easily, without the need to write any Python code at all. \r\n\r\nThe main prerequisites when using this module are:\r\n\r\nRunning it inside a Linux host / virtual machine is highly recommended.\r\nRunning it inside the Python interpreter, after importing it: import AvayaERSConnect\r\nIP connectivity from the host / virtual machine to the Avaya ERS device(s)\r\nMandatory: Telnet connectivity should be enabled on each device, using the \u201ccli password telnet local\u201d command, in the Global Configuration mode. Default Avaya credentials for read and write via Telnet are: username: RW , password: securepasswd\r\n\r\n\r\nSupported Avaya ERS platforms:\r\n\r\nAvaya ERS 25xx (all models)\r\nAvaya ERS 35xx (all models)\r\nAvaya ERS 45xx (all models)\r\nAvaya ERS 48xx (all models)\r\nAvaya ERS 55xx (all models)\r\nAvaya ERS 56xx (all models)\r\nAvaya ERS 59xx (all models)\r\n\r\n\r\nAvayaERSConnect usable functions:\r\n\r\nReadConfig(ip, username, password, show_command, to_file = True, to_screen = False)\r\nSendConfig(ip, cmd_file, username, password, save_config = True)\r\nSendConfigToMultiDev(username, password, save_config = True)\r\nReadConfig()\r\nThe ReadConfig() function in AvayaERSConnect is responsible for connecting to an Avaya device via Telnet, sending a \u201cshow\u201d command that the user specifies as an argument and capturing and storing the output of that command. This command should be invoked in the Python interpreter, after importing the AvayaERSConfig module.\r\n\r\n\r\nThe format:\r\n\r\nReadConfig(ip, username, password, show_command, to_file = True, to_screen = False)\r\n\r\nNote: Please follow the exact order of arguments (as shown above) when calling the function!\r\n\r\n\r\nExample:\r\n\r\n>>> import AvayaERSConnect\r\n>>> AvayaERSConnect.ReadConfig(\"172.16.1.1\", \"RW\", \"securepasswd\", \"show vlan\", to_file = True, to_screen = False)\r\n\r\nOutput was written to SwitchOne_show_vlan.txt.\r\n\r\n\r\nMain features and requirements for ReadConfig():\r\n\r\nPrepend the function name with \u201cAvayaERSConnect.\u201d when calling it.\r\nThe first argument is the IP address of the device you want to read from, in between double quotes.\r\nThe second argument is the Telnet username for logging into the device. This will be \u201cRW\u201d if you leave it at default. \u201ccli password telnet local\u201d should be configured on the device, prior to running the ReadConfig() function.\r\nThe third argument is the Telnet password for logging into the device. This will be \u201csecurepasswd\u201d if you leave it at default. \u201ccli password telnet local\u201d should be configured on the device, prior to running the ReadConfig() function.\r\nThe fourth argument is the \u201cshow\u201d command you want to send to the device.\r\nThe \u201cto_file\u201d argument can be set to either True or False.\r\nThe \u201cto_screen\u201d argument can be set to either True or False. When set to True, the command output is printed on the screen, in the Python interpreter.\r\nIf both \u201cto_file\u201d and \u201cto_screen\u201d are set to True, the output will be both stored in an external file and printed to the screen. If both are set to False, nothing happens.\r\n\r\nWriting the output to a file using the to_file argument:\r\n\r\nIf you set to_file = False, the output is not saved to a file.\r\nIf you set to_file = True, then the output of the \u201cshow\u201d command is stored inside a file in the current directory, which is going to be automatically named following this format: Hostname_Command.txt. This is useful when querying multiple devices, one by one.\r\n\r\n\r\nExample:\r\n\r\nSwitchOne(config)#cli password telnet local\r\n\r\n>>> import AvayaERSConnect\r\n>>> AvayaERSConnect.ReadConfig(\"172.16.1.1\", \"RW\", \"securepasswd\", \"show vlan\", to_file = True, to_screen = False)\r\n\r\nOutput was written to SwitchOne_show_vlan.txt.\r\n\r\nroot@kali:/home# cat SwitchOne_show_vlan.txt \r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n\tPort Members: ALL\r\n2 VLAN #2 Port None 0x0000 Yes IVL No\r\n\tPort Members: NONE\r\n3 VLAN #3 Port None 0x0000 Yes IVL No\r\n\tPort Members: NONE\r\n4 VLAN #4 Protocol Ipv6 Ether2 0x86dd Yes IVL No\r\n\tPort Members: NONE\r\n55 VLAN #55 Port None 0x0000 Yes IVL No\r\n\tPort Members: NONE\r\n77 VLAN #77 Port None 0x0000 Yes IVL No\r\n\tPort Members: NONE\r\n\r\n\r\nThe ReadConfig() function returns a customized error message and quits execution if:\r\n\r\nInvalid commands are sent to the device\r\nIncorrect device IP address, username or password are used\r\nThe device IP address is unreachable\r\nThe user types the Ctrl+C sequence\r\n\r\n\r\nSendConfig()\r\nThe SendConfig() function in AvayaERSConnect is responsible for connecting to an Avaya device via Telnet, sending configuration commands stored in an external text file, each specified one per line. In the function call, you can also specify whether you want the configuration you just made to be saved to the device\u2019s NVRAM. This command should be invoked in the Python interpreter, after importing the AvayaERSConfig module.\r\n\r\n\r\n\r\nThe format:\r\n\r\nSendConfig(ip, cmd_file, username, password, save_config = True)\r\n\r\nNote: Please follow the exact order of arguments (as shown above) when calling the function!\r\n\r\n\r\n\r\nExample:\r\n\r\nSwitchOne(config)#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: ALL\r\nTotal VLANs: 1\r\n\r\nroot@kali:/home# cat avayatestcmd.txt \r\nvlan create 100 type port\r\nvlan create 101 type proto\r\nvlan create 102 type port\r\n\r\n>>> import AvayaERSConnect\r\n>>> AvayaERSConnect.SendConfig(\"172.16.1.1\", \"avayatestcmd.txt\", \"RW\", \"securepasswd\", save_config = True)\r\n\r\nConfiguration was saved to NVRAM.\r\n\r\nSwitchOne(config)#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: ALL\r\n100 VLAN #100 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\n101 VLAN #101 Protocol Ipv6 Ether2 0x86dd Yes IVL No\r\n Port Members: NONE\r\n102 VLAN #102 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\nTotal VLANs: 4\r\n\r\n\r\nMain features and requirements for SendConfig():\r\n\r\nPrepend the function name with \u201cAvayaERSConnect.\u201d when calling it.\r\nThe first argument is the IP address of the device you want to write commands to, in between double quotes.\r\nThe second argument is the filename (+ extension) in which the configuration commands are stored, in between double quotes.\r\nThe third argument is the Telnet username for logging into the device. This will be \u201cRW\u201d if you leave it at default. \u201ccli password telnet local\u201d should be configured on the device, prior to running the SendConfig() function.\r\nThe fourth argument is the Telnet password for logging into the device. This will be \u201csecurepasswd\u201d if you leave it at default. \u201ccli password telnet local\u201d should be configured on the device, prior to running the SendConfig() function.\r\nThe \u201csave_config\u201d argument can be set to either True or False.\r\n\r\n\r\n\r\nSaving the configuration to NVRAM (configuration is kept across reboot, when autosave is disabled on the device) using the save_config argument:\r\n\r\nIf you set save_config = False, the configuration is not saved to NVRAM (the configuration may be lost across reboot, if autosave is disabled on the device).\r\nIf you set save_config = True, the configuration is saved to NVRAM.\r\n\r\n\r\n\r\nThe SendConfig() function returns a customized error message and quits execution if:\r\n\r\nTelnet login timeout expires (connectivity / network lag / delay issues)\r\nIncorrect device IP addresses, username or password are used\r\nInvalid filename or inexistent file containing the commands\r\nThe device IP address is unreachable\r\nThe user types the Ctrl+C sequence\r\nSendConfigToMultiDev()\r\n\r\nThe SendConfigToMultiDev() function in AvayaERSConnect is responsible for connecting to multiple Avaya devices simultaneously via Telnet, sending configuration commands stored in an external text file, specified one per line. In the function call, you can also specify whether you want the configuration you just made to be saved to the device\u2019s NVRAM or not. This command should be invoked in the Python interpreter, after importing the AvayaERSConfig module.\r\n\r\nThis function uses threading for initiating multiple concurrent sessions to multiple Avaya ERS IP addresses, specified inside an external, dedicated file.\r\n\r\n\r\n\r\nThe format:\r\n\r\nSendConfigToMultiDev(username, password, save_config = True)\r\n\r\nNote: Please follow the exact order of arguments (as shown above) when calling the function!\r\n\r\n\r\n\r\nExample:\r\n\r\nLet\u2019s consider three Avaya ERS 35xx switches [IPs: 10.105.62.23, 10.105.62.24, 10.105.62.25]:\r\n\r\n\r\n2.3#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: 1/ALL,2/ALL\r\nTotal VLANs: 1\r\n\r\n2.4#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: ALL\r\nTotal VLANs: 1\r\n\r\n\r\n2.5#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: ALL\r\nTotal VLANs: 1\r\n\r\n\r\nLet\u2019s create the files we need: one holding the IP addresses and one holding the commands.\r\n\r\nroot@kali:/home# cat avayamultiip.txt \r\n10.105.62.23\r\n10.105.62.24\r\n10.105.62.25\r\n\r\nroot@kali-teo:/home# cat avayamulticmd.txt \r\nvlan create 77 type port\r\nvlan create 88 type port\r\nvlan create 99 type port\r\n\r\n\r\nLet\u2019s run the function in the Python interpreter.\r\n\r\n>>> import AvayaERSConnect\r\n>>> AvayaERSConnect.SendConfigToMultiDev(\"RW\", \"securepasswd\", save_config = True)\r\nEnter IP file name and extension: avayamultiip.txt\r\n\r\nChecking IP reachability...\r\n\r\nAll devices are reachable. Waiting for command file...\r\n\r\nEnter command file name and extension: avayamulticmd.txt\r\n\r\nCommands file was found.\r\n\r\n\r\nConfiguration was saved to NVRAM.\r\n\r\n\r\nConfiguration was saved to NVRAM.\r\n\r\n\r\nConfiguration was saved to NVRAM.\r\nLet\u2019s verify the configuration on the three switches - vlans 77, 88, 99 should have been configured.\r\n\r\n2.3#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: 1/ALL,2/ALL\r\n77 VLAN #77 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\n88 VLAN #88 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\n99 VLAN #99 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\nTotal VLANs: 4\r\n\r\n\r\n2.4#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: ALL\r\n77 VLAN #77 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\n88 VLAN #88 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\n99 VLAN #99 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\nTotal VLANs: 4\r\n\r\n\r\n2.5#show vlan\r\nId Name Type Protocol PID Active IVL/SVL Mgmt\r\n---- -------------------- -------- ---------------- ------- ------ ------- ----\r\n1 VLAN #1 Port None 0x0000 Yes IVL Yes\r\n Port Members: ALL\r\n77 VLAN #77 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\n88 VLAN #88 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\n99 VLAN #99 Port None 0x0000 Yes IVL No\r\n Port Members: NONE\r\nTotal VLANs: 4\r\n\r\nMain features and requirements for SendConfigToMultiDev():\r\n\r\nPrepend the function name with \u201cAvayaERSConnect.\u201d when calling it.\r\nThe first argument is the Telnet username for logging into the device. This will be \u201cRW\u201d if you leave it at default. \u201ccli password telnet local\u201d should be configured on the device, prior to running the SendConfigToMultiDev() function.\r\nThe second argument is the Telnet password for logging into the device. This will be \u201csecurepasswd\u201d if you leave it at default. \u201ccli password telnet local\u201d should be configured on the device, prior to running the SendConfigToMultiDev() function.\r\nThe \u201csave_config\u201d argument can be set to either True or False.\r\nOther necessary arguments are automatically picked up by calling the SendConfig() function from within the SaveConfigToMultiDev() function.\r\n\r\n\r\n\r\n\r\nSaving the configuration to NVRAM (configuration is kept across reboot, when autosave is disabled on the device) using the save_config argument:\r\n\r\nIf you set save_config = False, the configuration is not saved to NVRAM (the configuration may be lost across reboot, if autosave is disabled on the device).\r\nIf you set save_config = True, the configuration is saved to NVRAM.\r\n\r\n\r\n\r\n\r\nThe SendConfigToMultiDev() function returns a customized error message and quits execution if:\r\n\r\nTelnet login timeout expires (connectivity issue)\r\nIncorrect device IP addresses, username or password are used\r\nInvalid filename or inexistent file containing the commands\r\nThe device IP address is unreachable\r\nThe user types the Ctrl+C sequence\r\n\r\n\r\n\r\nNote: Other functions in the AvayaERSConnect.py file take care of checking IP format validity, IP reachability and commands file path corectness. These functions are not to be used directly in the Python interpreter.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://trendelearning.com", "keywords": "python avaya, avaya python, avaya programming", "license": "MIT License", "maintainer": "Mihai Catalin Teodosiu", "maintainer_email": "teodosiu_mc@yahoo.com", "name": "AvayaERSConnect", "package_url": "https://pypi.org/project/AvayaERSConnect/", "platform": "Linux", "project_url": "https://pypi.org/project/AvayaERSConnect/", "project_urls": { "Homepage": "http://trendelearning.com" }, "release_url": "https://pypi.org/project/AvayaERSConnect/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "AvayaERSConnect\u2019s main purpose is to connect to any Avaya ERS Device via Telnet and perform various administration operations easily, without the need to write any Python code at all.", "version": "1.0.0" }, "last_serial": 1927417, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f3036274e90257bf2fbbd100dafe8ab3", "sha256": "b37e06c998468158487c425362c33e4d86383072c48b73cb33f29314aec397a2" }, "downloads": -1, "filename": "AvayaERSConnect.tar.gz", "has_sig": false, "md5_digest": "f3036274e90257bf2fbbd100dafe8ab3", "packagetype": "bdist_rpm", "python_version": "2.7", "requires_python": null, "size": 3007, "upload_time": "2016-01-28T14:31:49", "url": "https://files.pythonhosted.org/packages/0a/28/7770a524498f1f799cec326b7348c2f142229805cef497616f6136d22a4a/AvayaERSConnect.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f3036274e90257bf2fbbd100dafe8ab3", "sha256": "b37e06c998468158487c425362c33e4d86383072c48b73cb33f29314aec397a2" }, "downloads": -1, "filename": "AvayaERSConnect.tar.gz", "has_sig": false, "md5_digest": "f3036274e90257bf2fbbd100dafe8ab3", "packagetype": "bdist_rpm", "python_version": "2.7", "requires_python": null, "size": 3007, "upload_time": "2016-01-28T14:31:49", "url": "https://files.pythonhosted.org/packages/0a/28/7770a524498f1f799cec326b7348c2f142229805cef497616f6136d22a4a/AvayaERSConnect.tar.gz" } ] }