This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from jsonrpclib import Server | |
switches = ["bleaf1", "bleaf2", "bleaf3", "bleaf5"] | |
username = "admin" | |
password = "admin" | |
for switch in switches: | |
urlString = "https://{}:{}@{}/command-api".format(username, password, switch) | |
switchReq = Server( urlString ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from jsonrpclib import Server | |
username = "admin" | |
password = "admin" | |
urlString = "https://{}:{}@{}/command-api".format(username, password, "bleaf1") | |
switchReq = Server( urlString ) | |
response = switchReq.runCmds( 1, ["enable", "show running-config"], "text" ) | |
print response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/fredhsu/go-eapi" | |
) | |
func configFetcher(url string, cmds []string, format string, c chan eapi.JsonRpcResponse) { | |
response := eapi.Call(url, cmds, format) | |
c <- response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/fredhsu/go-eapi" | |
) | |
func main() { | |
cmds2 := []string{"enable", "show running-config"} | |
url1 := "https://admin:admin@bleaf1/command-api/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/fredhsu/go-eapi" | |
) | |
func main() { | |
cmds2 := []string{"enable", "show running-config"} | |
url1 := "https://admin:admin@bleaf1/command-api/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/fredhsu/go-eapi" | |
//"time" | |
) | |
func main() { | |
cmds2 := []string{"enable", "show running-config"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jsonrpclib import Server | |
switch = Server( "https://admin:admin@leaf1/command-api" ) | |
response = switch.runCmds( 1, ["show vrf"], "text" ) | |
lines = response[0]['output'].splitlines() | |
for line in lines: | |
print line | |
for i in range(2, len(lines) - 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jsonrpclib | |
import time | |
name = "demo1" | |
switchReq = jsonrpclib.Server("http://admin:admin@" + name + | |
"/command-api") | |
for i in range(3,2545: | |
ipaddr = "ip address 2.2.2.{}/24".format(i) | |
response = switchReq.runCmds(1, ["enable", "configure", "interface ethernet 52", ipaddr]) | |
print "trying " + ipaddr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[general] | |
# Path to a Public key to install on servers. If a usable key has not | |
# been installed on the remote servers the user will be prompted for a | |
# password and this key will be installed so the password will not be | |
# required again | |
CONFIG_SSH_KEY=/root/.ssh/id_rsa.pub | |
# Set to 'y' if you would like Packstack to install MySQL | |
CONFIG_MYSQL_INSTALL=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$username = "admin" | |
$password = "admin" | |
$switchIp = "172.22.28.157" | |
#URL | |
$eApiUrl = "https://$switchIp/command-api" | |
# Command(s) we want to send | |
$cmds = @('show version') |