Created
February 13, 2014 21:24
-
-
Save fredhsu/8984144 to your computer and use it in GitHub Desktop.
Example of rewriting source and destination mac with DirectFlow via eAPI
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" | |
sip = "10.1.1.1" | |
smac = "0000.aaaa.bbbb" | |
dmac = "1111.aaaa.bbbb" | |
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 source ip {}".format(sip), "action set source mac ".format(smac), "action set destination mac".format(dmac)] ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment