Exemple #1
0
def AddEthernetEntries(sw, helper, local_mac, ingress_port):
    table_entry = helper.buildTableEntry(
            table_name = "cis553Ingress.tiHandleEthernet",
            match_fields = { "hdr.ethernet.dstAddr": local_mac,
                             "standard_metadata.ingress_port" :  ingress_port},
            action_name = "cis553Ingress.aiForMe")
    sw.WriteTableEntry(table_entry);

    table_entry = helper.buildTableEntry(
            table_name = "cis553Ingress.tiHandleEthernet",
            match_fields = { "hdr.ethernet.dstAddr": "ff:ff:ff:ff:ff:ff",
                             "standard_metadata.ingress_port" :  ingress_port},
            action_name = "cis553Ingress.aiForMe")
    sw.WriteTableEntry(table_entry);
def addPathToJondo(sw, helper, p, j):
    table_entry = helper.buildTableEntry(
        table_name="jondoIngress.pathIDToJondoID",
        match_fields={"hdr.jondo.path_id": p},
        action_name="jondoIngress.setPathID",
        action_params={"next_id": j})
    sw.WriteTableEntry(table_entry)
Exemple #3
0
def AddARPResponse(sw, helper, target_pa, mac_sa, oper = 1):
    table_entry = helper.buildTableEntry(
            table_name = "cis553Ingress.tiArpResponse",
            match_fields = { "hdr.arp.oper": oper,
                             "hdr.arp.targetPA" : target_pa },
            action_name = "cis553Ingress.aiArpResponse",
            action_params = { "mac_sa": mac_sa } )
    sw.WriteTableEntry(table_entry);
Exemple #4
0
def AddRoutingEntry(sw, helper, ip, mac_sa, mac_da, egress_port, prefix_len = 32):
    table_entry = helper.buildTableEntry(
            table_name = "cis553Ingress.tiIpv4Lpm",
            match_fields = { "hdr.ipv4.dstAddr": [ ip, prefix_len ] },
            action_name = "cis553Ingress.aiForward",
            action_params = { "mac_sa": mac_sa,
                              "mac_da": mac_da,
                              "egress_port": egress_port } )
    sw.WriteTableEntry(table_entry);
def add_ethernet(router, helper, mac, ingress):
    # add entry to tiHandleEthernet
    table_entry = helper.buildTableEntry(
        table_name="cis553Ingress.tiHandleEthernet",
        match_fields={
            "hdr.ethernet.dstAddr": mac,
            "standard_metadata.ingress_port":  ingress},
        action_name="cis553Ingress.aiForMe")
    router.WriteTableEntry(table_entry)

    # broadcast, set aiForMe
    table_entry = helper.buildTableEntry(
        table_name="cis553Ingress.tiHandleEthernet",
        match_fields={
            "hdr.ethernet.dstAddr": "ff:ff:ff:ff:ff:ff",
            "standard_metadata.ingress_port":  ingress},
        action_name="cis553Ingress.aiForMe")
    router.WriteTableEntry(table_entry)
def addPrevToNext(sw, helper, n, p, is_submit):
    table_entry = helper.buildTableEntry(
        table_name="jondoIngress.prevToNextPI",
        match_fields={"hdr.jondo.path_id": p},
        action_name="jondoIngress.setPathID",
        action_params={
            "path_id": n,
            "is_submit": is_submit
        })
    sw.WriteTableEntry(table_entry)
def add_arp(router, helper, tpa, src_mac):
    # add entry to arp table, combining the
    # tiArpLoopup & tiArpResponse, oper is always 1
    table_entry = helper.buildTableEntry(
        table_name="cis553Ingress.tiArpResponse",
        match_fields={
            "hdr.arp.tpa": tpa,
            "hdr.arp.oper": 1},
        action_name="cis553Ingress.aiArpResponse",
        action_params={"src_mac": src_mac})
    router.WriteTableEntry(table_entry)
def add_routing_lookup(router, helper, src_mac, dst_mac, ip_add, egress):
    # entry for arp lookup, similar to ipv4 forward
    table_entry = helper.buildTableEntry(
        table_name="cis553Ingress.tiArpLookup",
        match_fields={"hdr.ipv4.dstAddr": [ip_add, 32]},
        action_name="cis553Ingress.aiForward",
        action_params={
            "src_mac": src_mac,
            "dst_mac": dst_mac,
            "egress_port": egress})
    router.WriteTableEntry(table_entry)
def add_routing_ipv4(router, helper, src_mac, dst_mac, ip_add, egress):
    # add lpm for ipv4 forwarding, prefix_length is always 32
    table_entry = helper.buildTableEntry(
        table_name="cis553Ingress.tiIpv4Lpm",
        match_fields={"hdr.ipv4.dstAddr": [ip_add, 32]},
        action_name="cis553Ingress.aiForward",
        action_params={
            "src_mac": src_mac,
            "dst_mac": dst_mac,
            "egress_port": egress})
    router.WriteTableEntry(table_entry)