Tested GA release for some new features
diff --git a/accton/accton_util.py b/accton/accton_util.py
index e12cc63..659c3a0 100755
--- a/accton/accton_util.py
+++ b/accton/accton_util.py
@@ -122,12 +122,40 @@
def encode_l3_ecmp_group_id(id):
return id + (7 << OFDPA_GROUP_TYPE_SHIFT)
+def encode_l2_unfiltered_group_id(id):
+ return id + (11 << OFDPA_GROUP_TYPE_SHIFT)
+
def encode_l2_overlay_group_id(tunnel_id, subtype, index):
tunnel_id=tunnel_id&0xffff #16 bits
subtype = subtype&3 #2 bits
index = index & 0x3f #10 bits
return index + (tunnel_id << OFDPA_TUNNEL_ID_SHIFT)+ (subtype<<OFDPA_TUNNEL_SUBTYPE_SHIFT)+(8 << OFDPA_GROUP_TYPE_SHIFT)
+def add_l2_unfiltered_group(ctrl, ports, send_barrier=False):
+ # group table
+ # set up untag groups for each port
+ group_id_list=[]
+ msgs=[]
+ for of_port in ports:
+ # do stuff
+ group_id = encode_l2_unfiltered_group_id(of_port)
+ group_id_list.append(group_id)
+ actions = [ofp.action.output(of_port)]
+ actions.append(ofp.action.set_field(ofp.oxm.exp1ByteValue(exp_type=24, value=1)))
+
+ buckets = [ofp.bucket(actions=actions)]
+ request = ofp.message.group_add(group_type=ofp.OFPGT_INDIRECT,
+ group_id=group_id,
+ buckets=buckets
+ )
+ ctrl.message_send(request)
+ msgs.append(request)
+
+ if send_barrier:
+ do_barrier(ctrl)
+
+ return group_id_list, msgs
+
def add_l2_interface_group(ctrl, ports, vlan_id=1, is_tagged=False, send_barrier=False):
# group table
# set up untag groups for each port
@@ -233,7 +261,7 @@
if dst_mac is not None:
action.append(ofp.action.set_field(ofp.oxm.eth_dst(dst_mac)))
- action.append(ofp.action.set_field(ofp.oxm.vlan_vid(vlanid)))
+ action.append(ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vlanid)))
action.append(ofp.action.group(group_id))
@@ -606,7 +634,7 @@
if vrf!=0:
actions.append(ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf)))
- actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(vlan_id)))
+ actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vlan_id)))
request = ofp.message.flow_add(
table_id=10,
@@ -631,7 +659,7 @@
if vrf!=0:
actions.append(ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf)))
- actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(value=vlan_id)))
+ actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vlan_id)))
request = ofp.message.flow_add(
table_id=10,
@@ -756,7 +784,7 @@
instructions = []
instructions.append(ofp.instruction.goto_table(60))
if send_ctrl:
- instructions.append(ofp.instruction.apply_actions(
+ instructions.append(ofp.instruction.write_actions(
actions=[ofp.action.output( port=ofp.OFPP_CONTROLLER,
max_len=ofp.OFPCML_NO_BUFFER)]))
else:
@@ -1339,7 +1367,7 @@
group_type = ofp.OFPGT_INDIRECT
action=[]
if set_vid!=None:
- action.append(ofp.action.set_field(ofp.oxm.vlan_vid(set_vid)))
+ action.append(ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+set_vid)))
if push_vlan!=None:
action.append(ofp.action.push_vlan(push_vlan))
if pop_vlan!=None:
diff --git a/accton/flow_test.py b/accton/flow_test.py
index c9d2609..1f286d2 100755
--- a/accton/flow_test.py
+++ b/accton/flow_test.py
@@ -74,13 +74,14 @@
delete_all_groups(self.controller)
# table 10: vlan
# send to table 20
- add_vlan_table_flow(self.controller, config["port_map"].keys())
+ #add_vlan_table_flow(self.controller, config["port_map"].keys(),1)
# group table
# set up tag groups for each port
- add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, True, 1)
+ add_l2_interface_group(self.controller, config["port_map"].keys(), 1, True, 1)
for port in ports:
+ add_one_vlan_table_flow(self.controller, port, 1)
group_id = encode_l2_interface_group_id(1, port)
add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True)
do_barrier(self.controller)
@@ -93,7 +94,7 @@
if in_port == out_port:
continue
# change source based on port number to avoid packet-ins from learning
- mac_src= '00:12:34:56:78:%02X' % in_port
+ mac_src= '00:12:34:56:79:%02X' % in_port
parsed_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=1, eth_dst=mac_dst, eth_src=mac_src)
pkt = str(parsed_pkt)
logging.info("OutputExact test, ports %d to %d", in_port, out_port)