Implemented MPLS FWD
diff --git a/accton/accton_util.py b/accton/accton_util.py
index 2f0cd35..d38bb78 100755
--- a/accton/accton_util.py
+++ b/accton/accton_util.py
@@ -779,7 +779,43 @@
return request
-def add_mpls_flow(ctrl, action_group_id, label=100 ,ethertype=0x0800, bos=1, vrf=1, send_barrier=False):
+def add_mpls(ctrl, action_group_id, label=100 ,ethertype=0x0800, bos=1, vrf=1, send_barrier=False):
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.eth_type(0x8847))
+ match.oxm_list.append(ofp.oxm.mpls_label(label))
+ match.oxm_list.append(ofp.oxm.mpls_bos(bos))
+ actions = [ofp.action.dec_mpls_ttl(),
+ #ofp.action.copy_ttl_in(),
+ ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf)),
+ ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=23, value=32)),
+ ofp.action.group(action_group_id)]
+ #ofp.action.pop_mpls(ethertype)]
+
+ request = ofp.message.flow_add(
+ table_id=24,
+ cookie=43,
+ match=match,
+ instructions=[
+ ofp.instruction.apply_actions(
+ actions=actions
+ ),
+ #ofp.instruction.write_actions(
+ ofp.instruction.goto_table(29)
+ ],
+ buffer_id=ofp.OFP_NO_BUFFER,
+ priority=1)
+
+ logging.info("Inserting MPLS flow , label %ld", label)
+ ctrl.message_send(request)
+
+ if send_barrier:
+ do_barrier(ctrl)
+
+ return request
+
+
+
+def add_mpls_flow(ctrl, action_group_id=0x0, label=100 ,ethertype=0x0800, bos=1, vrf=1, send_barrier=False):
match = ofp.match()
match.oxm_list.append(ofp.oxm.eth_type(0x8847))
match.oxm_list.append(ofp.oxm.mpls_label(label))
@@ -787,8 +823,9 @@
actions = [ofp.action.dec_mpls_ttl(),
ofp.action.copy_ttl_in(),
ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf)),
- ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=23, value=8)),
- ofp.action.pop_mpls(ethertype)]
+ ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=23, value=32))]
+ #ofp.action.group(action_group_id)]
+ #ofp.action.pop_mpls(ethertype)]
request = ofp.message.flow_add(
table_id=24,