diff --git a/README.md b/README.md index 7804f85..92acbf1 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # Conn -Conn is a ssh and telnet connection manager and automation module +Connpy is a ssh and telnet connection manager and automation module ## Installation -pip install conn +pip install connpy + ## Automation module usage ### Standalone module ``` -import conn -router = conn.node("unique name","ip/hostname", user="username", password="password") +import connpy +router = connpy.node("unique name","ip/hostname", user="username", password="password") router.run(["term len 0","show run"]) print(router.output) hasip = router.test("show ip int brief","1.1.1.1") @@ -21,17 +22,17 @@ else: ### Using manager configuration ``` -import conn -conf = conn.configfile() +import connpy +conf = connpy.configfile() device = conf.getitem("router@office") -router = conn.node("unique name", **device, config=conf) +router = connpy.node("unique name", **device, config=conf) result = router.run("show ip int brief") print(result) ``` ### Running parallel tasks on multiple devices ``` -import conn -conf = conn.configfile() +import connpy +conf = connpy.configfile() #You can get the nodes from the config from a folder and fitlering in it nodes = conf.getitem("@office", ["router1", "router2", "router3"]) #You can also get each node individually: @@ -45,7 +46,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user": "username", "password": "password nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "password2"} nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "password3"} #Finally you run some tasks on the nodes -mynodes = conn.nodes(nodes, config = conf) +mynodes = connpy.nodes(nodes, config = conf) result = mynodes.test(["show ip int br"], "1.1.1.2") for i in result: print("---" + i + "---") diff --git a/conn/__init__.py b/connpy/__init__.py similarity index 90% rename from conn/__init__.py rename to connpy/__init__.py index 340b57e..ae08321 100644 --- a/conn/__init__.py +++ b/connpy/__init__.py @@ -2,7 +2,7 @@ ''' ## Connection manager -conn is a connection manager that allows you to store nodes to connect them fast and password free. +Connpy is a connection manager that allows you to store nodes to connect them fast and password free. ### Features - You can generate profiles and reference them from nodes using @profilename @@ -71,8 +71,8 @@ the automation module ### Standalone module ``` -import conn -router = conn.node("unique name","ip/hostname", user="username", password="pass") +import connpy +router = connpy.node("unique name","ip/hostname", user="username", password="pass") router.run(["term len 0","show run"]) print(router.output) hasip = router.test("show ip int brief","1.1.1.1") @@ -84,17 +84,17 @@ else: ### Using manager configuration ``` -import conn -conf = conn.configfile() +import connpy +conf = connpy.configfile() device = conf.getitem("server@office") -server = conn.node("unique name", **device, config=conf) +server = connpy.node("unique name", **device, config=conf) result = server.run(["cd /", "ls -la"]) print(result) ``` ### Running parallel tasks ``` -import conn -conf = conn.configfile() +import connpy +conf = connpy.configfile() #You can get the nodes from the config from a folder and fitlering in it nodes = conf.getitem("@office", ["router1", "router2", "router3"]) #You can also get each node individually: @@ -108,7 +108,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user": "username", "password": "pass1"} nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "pass2"} nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "pass3"} #Finally you run some tasks on the nodes -mynodes = conn.nodes(nodes, config = conf) +mynodes = connpy.nodes(nodes, config = conf) result = mynodes.test(["show ip int br"], "1.1.1.2") for i in result: print("---" + i + "---") diff --git a/conn/__main__.py b/connpy/__main__.py similarity index 86% rename from conn/__main__.py rename to connpy/__main__.py index 25717ad..4d6f390 100644 --- a/conn/__main__.py +++ b/connpy/__main__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import sys -from conn import * +from connpy import * def main(): conf = configfile() diff --git a/conn/configfile.py b/connpy/configfile.py similarity index 100% rename from conn/configfile.py rename to connpy/configfile.py diff --git a/conn/connapp.py b/connpy/connapp.py similarity index 100% rename from conn/connapp.py rename to connpy/connapp.py diff --git a/conn/core.py b/connpy/core.py similarity index 100% rename from conn/core.py rename to connpy/core.py diff --git a/docs/conn/index.html b/docs/connpy/index.html similarity index 97% rename from docs/conn/index.html rename to docs/connpy/index.html index 345d3e4..cdb2eb1 100644 --- a/docs/conn/index.html +++ b/docs/connpy/index.html @@ -4,7 +4,7 @@ -conn API documentation +connpy API documentation @@ -19,11 +19,11 @@
-

Package conn

+

Package connpy

Connection manager

-

conn is a connection manager that allows you to store nodes to connect them fast and password free.

+

Connpy is a connection manager that allows you to store nodes to connect them fast and password free.

Features

- You can generate profiles and reference them from nodes using @profilename 
   so you dont need to edit multiple nodes when changing password or other 
@@ -83,8 +83,8 @@ options:
 

Automation module

the automation module

Standalone module

-
import conn
-router = conn.node("unique name","ip/hostname", user="username", password="pass")
+
import connpy
+router = connpy.node("unique name","ip/hostname", user="username", password="pass")
 router.run(["term len 0","show run"])
 print(router.output)
 hasip = router.test("show ip int brief","1.1.1.1")
@@ -94,16 +94,16 @@ else:
     print("router don't has ip 1.1.1.1")
 

Using manager configuration

-
import conn
-conf = conn.configfile()
+
import connpy
+conf = connpy.configfile()
 device = conf.getitem("server@office")
-server = conn.node("unique name", **device, config=conf)
+server = connpy.node("unique name", **device, config=conf)
 result = server.run(["cd /", "ls -la"])
 print(result)
 

Running parallel tasks

-
import conn
-conf = conn.configfile()
+
import connpy
+conf = connpy.configfile()
 #You can get the nodes from the config from a folder and fitlering in it
 nodes = conf.getitem("@office", ["router1", "router2", "router3"])
 #You can also get each node individually:
@@ -117,7 +117,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user&
 nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "pass2"}
 nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "pass3"}
 #Finally you run some tasks on the nodes
-mynodes = conn.nodes(nodes, config = conf)
+mynodes = connpy.nodes(nodes, config = conf)
 result = mynodes.test(["show ip int br"], "1.1.1.2")
 for i in result:
     print("---" + i + "---")
@@ -134,7 +134,7 @@ mynodes.router1.run(["term len 0". "show run"], folder = &qu
 '''
 ## Connection manager
 
-conn is a connection manager that allows you to store nodes to connect them fast and password free.
+Connpy is a connection manager that allows you to store nodes to connect them fast and password free.
 
 ### Features
     - You can generate profiles and reference them from nodes using @profilename 
@@ -203,8 +203,8 @@ the automation module
 
 ### Standalone module
 ```
-import conn
-router = conn.node("unique name","ip/hostname", user="username", password="pass")
+import connpy
+router = connpy.node("unique name","ip/hostname", user="username", password="pass")
 router.run(["term len 0","show run"])
 print(router.output)
 hasip = router.test("show ip int brief","1.1.1.1")
@@ -216,17 +216,17 @@ else:
 
 ### Using manager configuration
 ```
-import conn
-conf = conn.configfile()
+import connpy
+conf = connpy.configfile()
 device = conf.getitem("server@office")
-server = conn.node("unique name", **device, config=conf)
+server = connpy.node("unique name", **device, config=conf)
 result = server.run(["cd /", "ls -la"])
 print(result)
 ```
 ### Running parallel tasks 
 ```
-import conn
-conf = conn.configfile()
+import connpy
+conf = connpy.configfile()
 #You can get the nodes from the config from a folder and fitlering in it
 nodes = conf.getitem("@office", ["router1", "router2", "router3"])
 #You can also get each node individually:
@@ -240,7 +240,7 @@ nodes["router1"] = {"host": "1.1.1.1", "user": &
 nodes["router2"] = {"host": "1.1.1.2", "user": "username", "password": "pass2"}
 nodes["router3"] = {"host": "1.1.1.2", "user": "username", "password": "pass3"}
 #Finally you run some tasks on the nodes
-mynodes = conn.nodes(nodes, config = conf)
+mynodes = connpy.nodes(nodes, config = conf)
 result = mynodes.test(["show ip int br"], "1.1.1.2")
 for i in result:
     print("---" + i + "---")
@@ -273,7 +273,7 @@ __pdoc__ = {
 

Classes

-
+
class configfile (conf=None, key=None)
@@ -522,7 +522,7 @@ __pdoc__ = {

Methods

-
+
def getitem(self, unique, keys=None)
@@ -595,7 +595,7 @@ __pdoc__ = {
-
+
class connapp (config)
@@ -1392,7 +1392,7 @@ complete -o nosort -F _conn conn

Methods

-
+
def encrypt(self, password, keyfile=None)
@@ -1439,7 +1439,7 @@ complete -o nosort -F _conn conn
-
+
class node (unique, host, options='', logs='', password='', port='', protocol='', user='', config='')
@@ -1852,7 +1852,7 @@ complete -o nosort -F _conn conn

Methods

-
+
def interact(self, debug=False)
@@ -1893,7 +1893,7 @@ complete -o nosort -F _conn conn exit(1)
-
+
def run(self, commands, *, folder='', prompt='>$|#$|\\$$|>.$|#.$|\\$.$', stdout=False)
@@ -1990,7 +1990,7 @@ complete -o nosort -F _conn conn return connect
-
+
def test(self, commands, expected, *, prompt='>$|#$|\\$$|>.$|#.$|\\$.$')
@@ -2085,7 +2085,7 @@ complete -o nosort -F _conn conn
-
+
class nodes (nodes: dict, config='')
@@ -2285,7 +2285,7 @@ complete -o nosort -F _conn conn

Methods

-
+
def run(self, commands, *, folder=None, prompt=None, stdout=None, parallel=10)
@@ -2378,7 +2378,7 @@ parallel (int): Number of nodes to run the commands simultaneously. return output
-
+
def test(self, commands, expected, *, prompt=None, parallel=10)
@@ -2485,30 +2485,30 @@ expected (str) : Expected text to appear after running all the
  • Classes

    diff --git a/docs/index.html b/docs/index.html index c5730e4..ab5bc4a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@ - + diff --git a/setup.cfg b/setup.cfg index f2e45cd..1c25717 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] -name = conn -version = attr: conn.__version__ -description = Conn is a SSH/Telnet connection manager and automation module +name = connpy +version = attr: connpy.__version__ +description = Connpy is a SSH/Telnet connection manager and automation module long_description = file: README.md long_description_content_type = text/markdown keywords = networking, automation, ssh, telnet, connection manager @@ -31,4 +31,5 @@ install_requires = [options.entry_points] console_scripts = - conn = conn.__main__:main + conn = connpy.__main__:main + connpy = connpy.__main__:main