Example #1
0
cli = controller.cli()
rest = controller.restGet
cli2 = env.node2().cli()

log("Restarting Floodlight with Quantum config")
floodlightLoadQuantumConfig(cli)

cli.gotoBashMode()
cli.runCmd("sudo mn -c")

cli2.gotoBashMode()
cli2.gotoMininetMode("--controller=remote --ip=%s --mac --topo=linear,5" % controller.ipAddress())

hostmacs = ["00:00:00:00:00:%02x" % x  for x in xrange(6,11)]
switches = ["00:00:00:00:00:00:00:%02x" % x for x in xrange(1,6)]
controller.waitForSwitches(switches)
createVirtualNetwork(controller, "ten1", "net1", "guid1", "10.0.0.10")
addHostToVirtualNetwork(controller, "ten1", "guid1", "port1", "attach1", hostmacs[0])
addHostToVirtualNetwork(controller, "ten1", "guid1", "port2", "attach2", hostmacs[1])
createVirtualNetwork(controller, "ten2", "net2", "guid2", "10.0.0.10")
addHostToVirtualNetwork(controller, "ten2", "guid2", "port3", "attach3", hostmacs[2])
addHostToVirtualNetwork(controller, "ten2", "guid2", "port4", "attach4", hostmacs[3])
verifyPing(cli2, 'h6', 'h7')
verifyPing(cli2, 'h8', 'h9')
verifyNoPing(cli2, 'h6', 'h8')
verifyNoPing(cli2, 'h7', 'h9')
# verify default gateway works
verifyPing(cli2, 'h10', 'h8')
verifyPing(cli2, 'h6', 'h10')
verifyPing(cli2, 'h8', 'h10')
    ['output=controller', "{u'length': 8, u'type': u'OUTPUT', u'port': -3, u'lengthU': 8, u'maxLength': 32767}" ],
    ['enqueue=0:3', "{u'queueId': 3, u'length': 16, u'type': u'OPAQUE_ENQUEUE', u'port': 0, u'lengthU': 16}"],
    ['set-vlan-id=200', "{u'length': 8, u'virtualLanIdentifier': 200, u'type': u'SET_VLAN_ID', u'lengthU': 8}" ],
    ['set-vlan-priority=5', "{u'length': 8, u'type': u'SET_VLAN_PCP', u'lengthU': 8, u'virtualLanPriorityCodePoint': 5}" ],
    ['strip-vlan', "{u'length': 8, u'type': u'STRIP_VLAN', u'lengthU': 8}" ],
    ['set-src-mac=00:11:22:33:44:55', "{u'dataLayerAddress': u'00:11:22:33:44:55', u'length': 16, u'type': u'SET_DL_SRC', u'lengthU': 16}" ],
    ['set-dst-mac=ff:ee:dd:cc:bb:aa', "{u'dataLayerAddress': u'ff:ee:dd:cc:bb:aa', u'length': 16, u'type': u'SET_DL_DST', u'lengthU': 16}" ],
    ['set-src-ip=1.2.3.4', "{u'type': u'SET_NW_SRC', u'length': 8, u'networkAddress': 16909060, u'lengthU': 8}" ],
    ['set-dst-ip=254.253.255.0', "{u'type': u'SET_NW_DST', u'length': 8, u'networkAddress': -16908544, u'lengthU': 8}" ],
    ['set-tos-bits=0x07', "{u'networkTypeOfService': 7, u'type': u'SET_NW_TOS', u'length': 8, u'lengthU': 8}" ],
    ['set-src-port=100', "{u'length': 8, u'type': u'SET_TP_SRC', u'lengthU': 8, u'transportPort': 100}" ],
    ['set-dst-port=0x100', "{u'length': 8, u'type': u'SET_TP_DST', u'lengthU': 8, u'transportPort': 256}" ],
]

log("Verify that the switch exists and is active")
controller.waitForSwitches([dpid])

# pushes a string representation of a flow the the static flow pusher Rest API
def push_flow(sFlow):
        controller.urlPost('/wm/staticflowentrypusher/json', sFlow)
        
# creates a static flow string with a single action to be pushed to the static flow pusher REST API
def create_single_action_static_flow_post_data(action):
    return '{"switch": "%s", "name":"flow-mod-1", "cookie":"0", "priority":"32768", "ingress-port":"1","active":"true", "actions":"%s"}' % (dpid, action)

# creates a static flow string with all actions to be pushed to the static flow pusher REST API
def create_all_action_static_flow_post_data():
    actionList = []
    for i in range(0,len(actions)):
        if(i > 0):
            actionList.append(',')
Example #3
0
    [
        'set-tos-bits=0x07',
        "{u'networkTypeOfService': 7, u'type': u'SET_NW_TOS', u'length': 8, u'lengthU': 8}"
    ],
    [
        'set-src-port=100',
        "{u'length': 8, u'type': u'SET_TP_SRC', u'lengthU': 8, u'transportPort': 100}"
    ],
    [
        'set-dst-port=0x100',
        "{u'length': 8, u'type': u'SET_TP_DST', u'lengthU': 8, u'transportPort': 256}"
    ],
]

log("Verify that the switch exists and is active")
controller.waitForSwitches([dpid])


# pushes a string representation of a flow the the static flow pusher Rest API
def push_flow(sFlow):
    controller.urlPost('/wm/staticflowentrypusher/json', sFlow)


# creates a static flow string with a single action to be pushed to the static flow pusher REST API
def create_single_action_static_flow_post_data(action):
    return '{"switch": "%s", "name":"flow-mod-1", "cookie":"0", "priority":"32768", "ingress-port":"1","active":"true", "actions":"%s"}' % (
        dpid, action)


# creates a static flow string with all actions to be pushed to the static flow pusher REST API
def create_all_action_static_flow_post_data():