Exemple #1
0
def main():
    bfs1 = [1, 2, 3]
    bfs2 = [1, 4]
    pol = if_(ARP, arp(), mac_learner())
    #    pol = mac_learner()
    return virtualize(virtualize(pol, merge(from_switches=[1, 4])),
                      merge(from_switches=[1, 2, 3]))
Exemple #2
0
def main():
    bfs1  = [1,2,3]
    bfs2  = [1,4]
    pol = if_(ARP,arp(),mac_learner())
#    pol = mac_learner()
    return virtualize(
        virtualize(pol,
                   BFS_vdef(from_switches=[1,4])),
        BFS_vdef(from_switches=[1,2,3]))
Exemple #3
0
def gateway_forwarder(subnet1, subnet2, host_macs):
    gw_mac = MAC('AA:AA:AA:AA:AA:AA')
    gw_mapping = {gateway_addr(subnet1): gw_mac, gateway_addr(subnet2): gw_mac}
    print gw_mapping
    subnet1_to_subnet2 = match(inport=1) & match(dstip=subnet2)
    subnet2_to_subnet1 = match(inport=2) & match(dstip=subnet1)
    subnet_forwarder = (subnet1_to_subnet2 >> fwd(2)) + (
        subnet2_to_subnet1 >> fwd(1))
    return if_(ARP, arp(gw_mapping), translate(host_macs) >> subnet_forwarder)
def gateway_forwarder(subnet1,subnet2,host_macs):
    gw_mac = MAC('AA:AA:AA:AA:AA:AA')
    gw_mapping = {gateway_addr(subnet1) : gw_mac, 
                  gateway_addr(subnet2) : gw_mac}
    print gw_mapping
    subnet1_to_subnet2 = match(inport=1) & match(dstip=subnet2)
    subnet2_to_subnet1 = match(inport=2) & match(dstip=subnet1)
    subnet_forwarder = (subnet1_to_subnet2 >> fwd(2)) + (subnet2_to_subnet1 >> fwd(1))
    return if_(ARP,
               arp(gw_mapping),
               translate(host_macs) >> subnet_forwarder)