Created
February 13, 2014 22:10
-
-
Save fredhsu/8984952 to your computer and use it in GitHub Desktop.
DirectFlow example that matches on destination IP and sets the output port
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 | |
username = "admin" | |
password = "admin" | |
host = "172.22.28.156" | |
dip = "10.1.1.1" | |
outport = "Port-Channel 100" | |
urlString = "https://{}:{}@{}/command-api".format(username, password, switch) | |
switchReq = Server( urlString ) | |
# The following rpc request will match on the source IP, then change both source and dest mac | |
response = switchReq.runCmds( 1, ["enable", "configure", "openflow", "flow a10", "persistent", "match destination ip {}".format(dip), "action set output interface {}".format(outport)] ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment