add verf routing case
diff --git a/accton/accton_util.py b/accton/accton_util.py
index e20e0fd..1871849 100755
--- a/accton/accton_util.py
+++ b/accton/accton_util.py
@@ -377,19 +377,23 @@
return msgs
-def add_one_vlan_table_flow(ctrl, of_port, vlan_id=1, flag=VLAN_TABLE_FLAG_ONLY_BOTH, send_barrier=False):
+def add_one_vlan_table_flow(ctrl, of_port, vlan_id=1, vrf=0, flag=VLAN_TABLE_FLAG_ONLY_BOTH, send_barrier=False):
# table 10: vlan
# goto to table 20
if (flag == VLAN_TABLE_FLAG_ONLY_TAG) or (flag == VLAN_TABLE_FLAG_ONLY_BOTH):
match = ofp.match()
match.oxm_list.append(ofp.oxm.in_port(of_port))
match.oxm_list.append(ofp.oxm.vlan_vid(0x1000+vlan_id))
+
request = ofp.message.flow_add(
table_id=10,
cookie=42,
match=match,
instructions=[
- ofp.instruction.goto_table(20)
+ ofp.instruction.apply_actions(
+ actions=[ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf))]
+ ),
+ ofp.instruction.goto_table(20)
],
priority=0)
logging.info("Add vlan %d tagged packets on port %d and go to table 20" %( vlan_id, of_port))
@@ -399,6 +403,7 @@
match = ofp.match()
match.oxm_list.append(ofp.oxm.in_port(of_port))
match.oxm_list.append(ofp.oxm.vlan_vid(0))
+
request = ofp.message.flow_add(
table_id=10,
cookie=42,
@@ -486,7 +491,8 @@
match.oxm_list.append(ofp.oxm.eth_dst_masked(dst_mac, [0xff, 0xff, 0xff, 0x80, 0x00, 0x00]))
goto_table=40
else:
- match.oxm_list.append(ofp.oxm.in_port(in_port))
+ if in_port!=0:
+ match.oxm_list.append(ofp.oxm.in_port(in_port))
match.oxm_list.append(ofp.oxm.eth_dst(dst_mac))
match.oxm_list.append(ofp.oxm.vlan_vid(0x1000+vlanid))
goto_table=30
@@ -509,14 +515,18 @@
return request
-def add_unicast_routing_flow(ctrl, eth_type, dst_ip, mask, action_group_id, send_barrier=False):
+def add_unicast_routing_flow(ctrl, eth_type, dst_ip, mask, action_group_id, vrf=0, send_barrier=False):
match = ofp.match()
match.oxm_list.append(ofp.oxm.eth_type(eth_type))
+ if vrf != 0:
+ match.oxm_list.append(ofp.oxm.exp2ByteValue(ofp.oxm.OFDPA_EXP_TYPE_VRF, vrf))
+
if mask!=0:
match.oxm_list.append(ofp.oxm.ipv4_dst_masked(dst_ip, mask))
else:
match.oxm_list.append(ofp.oxm.ipv4_dst(dst_ip))
+
request = ofp.message.flow_add(
table_id=30,
cookie=42,