@ -4,7 +4,7 @@
< meta charset = "utf-8" >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1, minimum-scale=1" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1, minimum-scale=1" / >
< meta name = "generator" content = "pdoc 0.10.0" / >
< meta name = "generator" content = "pdoc 0.10.0" / >
< title > conn API documentation< / title >
< title > connpy API documentation< / title >
< meta name = "description" content = "Connection manager …" / >
< meta name = "description" content = "Connection manager …" / >
< link rel = "preload stylesheet" as = "style" href = "https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity = "sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin >
< link rel = "preload stylesheet" as = "style" href = "https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity = "sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin >
< link rel = "preload stylesheet" as = "style" href = "https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity = "sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin >
< link rel = "preload stylesheet" as = "style" href = "https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity = "sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin >
@ -19,11 +19,11 @@
< main >
< main >
< article id = "content" >
< article id = "content" >
< header >
< header >
< h1 class = "title" > Package < code > conn< / code > < / h1 >
< h1 class = "title" > Package < code > connpy < / code > < / h1 >
< / header >
< / header >
< section id = "section-intro" >
< section id = "section-intro" >
< h2 id = "connection-manager" > Connection manager< / h2 >
< h2 id = "connection-manager" > Connection manager< / h2 >
< p > c onn is a connection manager that allows you to store nodes to connect them fast and password free.< / p >
< p > C onnpy is a connection manager that allows you to store nodes to connect them fast and password free.< / p >
< h3 id = "features" > Features< / h3 >
< h3 id = "features" > Features< / h3 >
< pre > < code > - You can generate profiles and reference them from nodes using @profilename
< pre > < code > - You can generate profiles and reference them from nodes using @profilename
so you dont need to edit multiple nodes when changing password or other
so you dont need to edit multiple nodes when changing password or other
@ -83,8 +83,8 @@ options:
< h2 id = "automation-module" > Automation module< / h2 >
< h2 id = "automation-module" > Automation module< / h2 >
< p > the automation module< / p >
< p > the automation module< / p >
< h3 id = "standalone-module" > Standalone module< / h3 >
< h3 id = "standalone-module" > Standalone module< / h3 >
< pre > < code > import conn
< pre > < code > import connpy
router = conn.node(" unique name" ," ip/hostname" , user=" username" , password=" pass" )
router = connpy .node(" unique name" ," ip/hostname" , user=" username" , password=" pass" )
router.run([" term len 0" ," show run" ])
router.run([" term len 0" ," show run" ])
print(router.output)
print(router.output)
hasip = router.test(" show ip int brief" ," 1.1.1.1" )
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" )
print(" router don't has ip 1.1.1.1" )
< / code > < / pre >
< / code > < / pre >
< h3 id = "using-manager-configuration" > Using manager configuration< / h3 >
< h3 id = "using-manager-configuration" > Using manager configuration< / h3 >
< pre > < code > import conn
< pre > < code > import connpy
conf = conn.configfile()
conf = connpy .configfile()
device = conf.getitem(" server@office" )
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" ])
result = server.run([" cd /" , " ls -la" ])
print(result)
print(result)
< / code > < / pre >
< / code > < / pre >
< h3 id = "running-parallel-tasks" > Running parallel tasks< / h3 >
< h3 id = "running-parallel-tasks" > Running parallel tasks< / h3 >
< pre > < code > import conn
< pre > < code > import connpy
conf = conn.configfile()
conf = connpy .configfile()
#You can get the nodes from the config from a folder and fitlering in it
#You can get the nodes from the config from a folder and fitlering in it
nodes = conf.getitem(" @office" , [" router1" , " router2" , " router3" ])
nodes = conf.getitem(" @office" , [" router1" , " router2" , " router3" ])
#You can also get each node individually:
#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[" router2" ] = {" host" : " 1.1.1.2" , " user" : " username" , " password" : " pass2" }
nodes[" router3" ] = {" host" : " 1.1.1.2" , " user" : " username" , " password" : " pass3" }
nodes[" router3" ] = {" host" : " 1.1.1.2" , " user" : " username" , " password" : " pass3" }
#Finally you run some tasks on the nodes
#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" )
result = mynodes.test([" show ip int br" ], " 1.1.1.2" )
for i in result:
for i in result:
print(" ---" + i + " ---" )
print(" ---" + i + " ---" )
@ -134,7 +134,7 @@ mynodes.router1.run(["term len 0". "show run"], folder = &qu
' ' '
' ' '
## Connection manager
## Connection manager
c onn is a connection manager that allows you to store nodes to connect them fast and password free.
C onnpy is a connection manager that allows you to store nodes to connect them fast and password free.
### Features
### Features
- You can generate profiles and reference them from nodes using @profilename
- You can generate profiles and reference them from nodes using @profilename
@ -203,8 +203,8 @@ the automation module
### Standalone module
### Standalone module
```
```
import conn
import connpy
router = conn.node(" unique name" ," ip/hostname" , user=" username" , password=" pass" )
router = connpy .node(" unique name" ," ip/hostname" , user=" username" , password=" pass" )
router.run([" term len 0" ," show run" ])
router.run([" term len 0" ," show run" ])
print(router.output)
print(router.output)
hasip = router.test(" show ip int brief" ," 1.1.1.1" )
hasip = router.test(" show ip int brief" ," 1.1.1.1" )
@ -216,17 +216,17 @@ else:
### Using manager configuration
### Using manager configuration
```
```
import conn
import connpy
conf = conn.configfile()
conf = connpy .configfile()
device = conf.getitem(" server@office" )
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" ])
result = server.run([" cd /" , " ls -la" ])
print(result)
print(result)
```
```
### Running parallel tasks
### Running parallel tasks
```
```
import conn
import connpy
conf = conn.configfile()
conf = connpy .configfile()
#You can get the nodes from the config from a folder and fitlering in it
#You can get the nodes from the config from a folder and fitlering in it
nodes = conf.getitem(" @office" , [" router1" , " router2" , " router3" ])
nodes = conf.getitem(" @office" , [" router1" , " router2" , " router3" ])
#You can also get each node individually:
#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[" router2" ] = {" host" : " 1.1.1.2" , " user" : " username" , " password" : " pass2" }
nodes[" router3" ] = {" host" : " 1.1.1.2" , " user" : " username" , " password" : " pass3" }
nodes[" router3" ] = {" host" : " 1.1.1.2" , " user" : " username" , " password" : " pass3" }
#Finally you run some tasks on the nodes
#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" )
result = mynodes.test([" show ip int br" ], " 1.1.1.2" )
for i in result:
for i in result:
print(" ---" + i + " ---" )
print(" ---" + i + " ---" )
@ -273,7 +273,7 @@ __pdoc__ = {
< section >
< section >
< h2 class = "section-title" id = "header-classes" > Classes< / h2 >
< h2 class = "section-title" id = "header-classes" > Classes< / h2 >
< dl >
< dl >
< dt id = "conn.configfile" > < code class = "flex name class" >
< dt id = "connpy .configfile" > < code class = "flex name class" >
< span > class < span class = "ident" > configfile< / span > < / span >
< span > class < span class = "ident" > configfile< / span > < / span >
< span > (< / span > < span > conf=None, key=None)< / span >
< span > (< / span > < span > conf=None, key=None)< / span >
< / code > < / dt >
< / code > < / dt >
@ -522,7 +522,7 @@ __pdoc__ = {
< / details >
< / details >
< h3 > Methods< / h3 >
< h3 > Methods< / h3 >
< dl >
< dl >
< dt id = "conn.configfile.getitem" > < code class = "name flex" >
< dt id = "connpy .configfile.getitem" > < code class = "name flex" >
< span > def < span class = "ident" > getitem< / span > < / span > (< span > self, unique, keys=None)< / span >
< span > def < span class = "ident" > getitem< / span > < / span > (< span > self, unique, keys=None)< / span >
< / code > < / dt >
< / code > < / dt >
< dd >
< dd >
@ -595,7 +595,7 @@ __pdoc__ = {
< / dd >
< / dd >
< / dl >
< / dl >
< / dd >
< / dd >
< dt id = "conn.connapp" > < code class = "flex name class" >
< dt id = "connpy .connapp" > < code class = "flex name class" >
< span > class < span class = "ident" > connapp< / span > < / span >
< span > class < span class = "ident" > connapp< / span > < / span >
< span > (< / span > < span > config)< / span >
< span > (< / span > < span > config)< / span >
< / code > < / dt >
< / code > < / dt >
@ -1392,7 +1392,7 @@ complete -o nosort -F _conn conn
< / details >
< / details >
< h3 > Methods< / h3 >
< h3 > Methods< / h3 >
< dl >
< dl >
< dt id = "conn.connapp.encrypt" > < code class = "name flex" >
< dt id = "connpy .connapp.encrypt" > < code class = "name flex" >
< span > def < span class = "ident" > encrypt< / span > < / span > (< span > self, password, keyfile=None)< / span >
< span > def < span class = "ident" > encrypt< / span > < / span > (< span > self, password, keyfile=None)< / span >
< / code > < / dt >
< / code > < / dt >
< dd >
< dd >
@ -1439,7 +1439,7 @@ complete -o nosort -F _conn conn
< / dd >
< / dd >
< / dl >
< / dl >
< / dd >
< / dd >
< dt id = "conn.node" > < code class = "flex name class" >
< dt id = "connpy .node" > < code class = "flex name class" >
< span > class < span class = "ident" > node< / span > < / span >
< span > class < span class = "ident" > node< / span > < / span >
< span > (< / span > < span > unique, host, options='', logs='', password='', port='', protocol='', user='', config='')< / span >
< span > (< / span > < span > unique, host, options='', logs='', password='', port='', protocol='', user='', config='')< / span >
< / code > < / dt >
< / code > < / dt >
@ -1852,7 +1852,7 @@ complete -o nosort -F _conn conn
< / details >
< / details >
< h3 > Methods< / h3 >
< h3 > Methods< / h3 >
< dl >
< dl >
< dt id = "conn.node.interact" > < code class = "name flex" >
< dt id = "connpy .node.interact" > < code class = "name flex" >
< span > def < span class = "ident" > interact< / span > < / span > (< span > self, debug=False)< / span >
< span > def < span class = "ident" > interact< / span > < / span > (< span > self, debug=False)< / span >
< / code > < / dt >
< / code > < / dt >
< dd >
< dd >
@ -1893,7 +1893,7 @@ complete -o nosort -F _conn conn
exit(1)< / code > < / pre >
exit(1)< / code > < / pre >
< / details >
< / details >
< / dd >
< / dd >
< dt id = "conn.node.run" > < code class = "name flex" >
< dt id = "connpy .node.run" > < code class = "name flex" >
< span > def < span class = "ident" > run< / span > < / span > (< span > self, commands, *, folder='', prompt=' > $|#$|\\$$|> .$|#.$|\\$.$' , stdout=False)< / span >
< span > def < span class = "ident" > run< / span > < / span > (< span > self, commands, *, folder='', prompt=' > $|#$|\\$$|> .$|#.$|\\$.$' , stdout=False)< / span >
< / code > < / dt >
< / code > < / dt >
< dd >
< dd >
@ -1990,7 +1990,7 @@ complete -o nosort -F _conn conn
return connect< / code > < / pre >
return connect< / code > < / pre >
< / details >
< / details >
< / dd >
< / dd >
< dt id = "conn.node.test" > < code class = "name flex" >
< dt id = "connpy .node.test" > < code class = "name flex" >
< span > def < span class = "ident" > test< / span > < / span > (< span > self, commands, expected, *, prompt=' > $|#$|\\$$|> .$|#.$|\\$.$' )< / span >
< span > def < span class = "ident" > test< / span > < / span > (< span > self, commands, expected, *, prompt=' > $|#$|\\$$|> .$|#.$|\\$.$' )< / span >
< / code > < / dt >
< / code > < / dt >
< dd >
< dd >
@ -2085,7 +2085,7 @@ complete -o nosort -F _conn conn
< / dd >
< / dd >
< / dl >
< / dl >
< / dd >
< / dd >
< dt id = "conn.nodes" > < code class = "flex name class" >
< dt id = "connpy .nodes" > < code class = "flex name class" >
< span > class < span class = "ident" > nodes< / span > < / span >
< span > class < span class = "ident" > nodes< / span > < / span >
< span > (< / span > < span > nodes: dict, config='')< / span >
< span > (< / span > < span > nodes: dict, config='')< / span >
< / code > < / dt >
< / code > < / dt >
@ -2285,7 +2285,7 @@ complete -o nosort -F _conn conn
< / details >
< / details >
< h3 > Methods< / h3 >
< h3 > Methods< / h3 >
< dl >
< dl >
< dt id = "conn.nodes.run" > < code class = "name flex" >
< dt id = "connpy .nodes.run" > < code class = "name flex" >
< span > def < span class = "ident" > run< / span > < / span > (< span > self, commands, *, folder=None, prompt=None, stdout=None, parallel=10)< / span >
< span > def < span class = "ident" > run< / span > < / span > (< span > self, commands, *, folder=None, prompt=None, stdout=None, parallel=10)< / span >
< / code > < / dt >
< / code > < / dt >
< dd >
< dd >
@ -2378,7 +2378,7 @@ parallel (int): Number of nodes to run the commands simultaneously.
return output< / code > < / pre >
return output< / code > < / pre >
< / details >
< / details >
< / dd >
< / dd >
< dt id = "conn.nodes.test" > < code class = "name flex" >
< dt id = "connpy .nodes.test" > < code class = "name flex" >
< span > def < span class = "ident" > test< / span > < / span > (< span > self, commands, expected, *, prompt=None, parallel=10)< / span >
< span > def < span class = "ident" > test< / span > < / span > (< span > self, commands, expected, *, prompt=None, parallel=10)< / span >
< / code > < / dt >
< / code > < / dt >
< dd >
< dd >
@ -2485,30 +2485,30 @@ expected (str) : Expected text to appear after running all the
< li > < h3 > < a href = "#header-classes" > Classes< / a > < / h3 >
< li > < h3 > < a href = "#header-classes" > Classes< / a > < / h3 >
< ul >
< ul >
< li >
< li >
< h4 > < code > < a title = "conn.configfile" href = "#conn.configfile" > configfile< / a > < / code > < / h4 >
< h4 > < code > < a title = "connpy .configfile" href = "#connpy .configfile" > configfile< / a > < / code > < / h4 >
< ul class = "" >
< ul class = "" >
< li > < code > < a title = "conn.configfile.getitem" href = "#conn.configfile.getitem" > getitem< / a > < / code > < / li >
< li > < code > < a title = "connpy .configfile.getitem" href = "#connpy .configfile.getitem" > getitem< / a > < / code > < / li >
< / ul >
< / ul >
< / li >
< / li >
< li >
< li >
< h4 > < code > < a title = "conn.connapp" href = "#conn.connapp" > connapp< / a > < / code > < / h4 >
< h4 > < code > < a title = "connpy .connapp" href = "#connpy .connapp" > connapp< / a > < / code > < / h4 >
< ul class = "" >
< ul class = "" >
< li > < code > < a title = "conn.connapp.encrypt" href = "#conn.connapp.encrypt" > encrypt< / a > < / code > < / li >
< li > < code > < a title = "connpy .connapp.encrypt" href = "#connpy .connapp.encrypt" > encrypt< / a > < / code > < / li >
< / ul >
< / ul >
< / li >
< / li >
< li >
< li >
< h4 > < code > < a title = "conn.node" href = "#conn.node" > node< / a > < / code > < / h4 >
< h4 > < code > < a title = "connpy .node" href = "#connpy .node" > node< / a > < / code > < / h4 >
< ul class = "" >
< ul class = "" >
< li > < code > < a title = "conn.node.interact" href = "#conn.node.interact" > interact< / a > < / code > < / li >
< li > < code > < a title = "connpy .node.interact" href = "#connpy .node.interact" > interact< / a > < / code > < / li >
< li > < code > < a title = "conn.node.run" href = "#conn.node.run" > run< / a > < / code > < / li >
< li > < code > < a title = "connpy .node.run" href = "#connpy .node.run" > run< / a > < / code > < / li >
< li > < code > < a title = "conn.node.test" href = "#conn.node.test" > test< / a > < / code > < / li >
< li > < code > < a title = "connpy .node.test" href = "#connpy .node.test" > test< / a > < / code > < / li >
< / ul >
< / ul >
< / li >
< / li >
< li >
< li >
< h4 > < code > < a title = "conn.nodes" href = "#conn.nodes" > nodes< / a > < / code > < / h4 >
< h4 > < code > < a title = "connpy .nodes" href = "#connpy .nodes" > nodes< / a > < / code > < / h4 >
< ul class = "" >
< ul class = "" >
< li > < code > < a title = "conn.nodes.run" href = "#conn.nodes.run" > run< / a > < / code > < / li >
< li > < code > < a title = "connpy .nodes.run" href = "#connpy .nodes.run" > run< / a > < / code > < / li >
< li > < code > < a title = "conn.nodes.test" href = "#conn.nodes.test" > test< / a > < / code > < / li >
< li > < code > < a title = "connpy .nodes.test" href = "#connpy .nodes.test" > test< / a > < / code > < / li >
< / ul >
< / ul >
< / li >
< / li >
< / ul >
< / ul >