Beispiel #1
0
 def test_new(self):
     match = pb.MPLSFlow.Match(bos=1, label=10017)
     actions = [
         pb.MPLSFlow.Action(name="POP_LABEL", value=0)
     ]
     flow = pb.MPLSFlow(match=match, actions=actions, goto_table=60, g_type=pb.GroupMod.MPLS_INTERFACE, g_id=1)
     mod = pb.FlowMod(cmd="ADD", table="MPLS1", mpls1=flow)
Beispiel #2
0
    def _mod_flow_mpls1(self, msg):
        re_id = msg["re_id"]
        cmd = msg["cmd"]
        for arg in msg["args"]:
            match = pb.MPLSFlow.Match(bos=arg["bos"], label=arg["label"])
            actions = []
            for name in ("SET_VRF", "POP_LABEL"):
                if name in arg:
                    actions.append(pb.MPLSFlow.Action(name=name, value=arg[name]))
            flow = pb.MPLSFlow(match=match,
                               actions=actions,
                               g_type=arg.get("g_type", "UNSPEC"),
                               g_id=arg.get("g_id", 0),
                               goto_table=arg["goto"])
            mod = pb.FlowMod(cmd=cmd, re_id=re_id, table="MPLS1", mpls1=flow)
            evt = fibcevt.EventFIBCFlowMod(mod)

            self.app.send_event_to_observers(evt)