Ejemplo n.º 1
0
 def _writes():
     if not offlow.is_action_needed(dpath, cmd):
         return []
     if entry.g_type == pb.GroupMod.MPLS_INTERFACE:
         return [
             ofaction.group(fibcapi.mpls_interface_group_id(entry.g_id))
         ]
     if entry.g_type == pb.GroupMod.MPLS_SWAP:
         return [ofaction.group(fibcapi.mpls_label_group_id(5, entry.g_id))]
     if entry.g_type == pb.GroupMod.MPLS_FF:
         return [ofaction.group(fibcapi.mpls_ff_group_id(entry.g_id))]
     if entry.g_type == pb.GroupMod.MPLS_ECMP:
         return [ofaction.group(fibcapi.mpls_ecmp_group_id(entry.g_id))]
     return []
Ejemplo n.º 2
0
    def _writes():
        if not offlow.is_action_needed(dpath, cmd):
            return []

        writes = [ofaction.dec_nw_ttl()]
        if entry.g_type == pb.GroupMod.L3_UNICAST:
            writes.append(
                ofaction.group(fibcapi.l3_unicast_group_id(entry.g_id)))
        elif entry.g_type == pb.GroupMod.L3_ECMP:
            writes.append(ofaction.group(fibcapi.l3_ecmp_group_id(entry.g_id)))
        elif entry.g_type == pb.GroupMod.MPLS_L3_VPN:
            writes.append(
                ofaction.group(fibcapi.mpls_label_group_id(2, entry.g_id)))
        else:
            pass

        return writes
Ejemplo n.º 3
0
    def _buckets():
        if not ofgroup.is_bucket_needed(dpath, cmd):
            return []

        next_gid = fibcapi.mpls_interface_group_id(entry.ne_id)
        actions = [
            ofaction.set_field("mpls_label", entry.new_label),
            ofaction.group(next_gid),
        ]
        return [dict(actions=actions)]
Ejemplo n.º 4
0
    def _buckets():
        if not ofgroup.is_bucket_needed(dpath, cmd):
            return []

        next_gid = fibcapi.l2_interface_group_id(entry.port_id, entry.vlan_vid)
        vlan_vid = fibcapi.adjust_vlan_vid(
            entry.vlan_vid) | fibcapi.OFPVID_PRESENT
        actions = [
            ofaction.set_field("eth_src", entry.eth_src),
            ofaction.set_field("eth_dst", entry.eth_dst),
            ofaction.set_field("vlan_vid", vlan_vid),
            ofaction.group(next_gid),
        ]
        return [dict(actions=actions)]
Ejemplo n.º 5
0
    def _buckets():
        if not ofgroup.is_bucket_needed(dpath, cmd):
            return []

        next_gid = get_next_gid(entry)
        actions = [
            ofaction.push_mpls(fibcapi.ETHTYPE_MPLS),
            ofaction.set_field("mpls_label", entry.new_label),
        ]

        if mpls_bos:
            actions.append(ofaction.set_field("mpls_bos", 1))

        actions.append(ofaction.set_mpls_ttl(64))
        actions.append(ofaction.group(next_gid))

        return [dict(actions=actions)]