add multicast test
diff --git a/olt.py b/olt.py
index 2fd7be1..3cbc96a 100644
--- a/olt.py
+++ b/olt.py
@@ -11,8 +11,9 @@
from oftest.testutils import *
-from IGMP import IGMPv3, IGMPv3gr, IGMP_TYPE_V3_MEMBERSHIP_REPORT, IGMP_V3_GR_TYPE_INCLUDE
-
+from IGMP import IGMPv3, IGMPv3gr, IGMP_TYPE_V3_MEMBERSHIP_REPORT,\
+ IGMP_V3_GR_TYPE_INCLUDE,\
+ IGMP_V3_GR_TYPE_EXCLUDE
from oltconstants import *
@@ -57,7 +58,7 @@
match.oxm_list.append(ofp.oxm.ip_proto(2))
igmp = IGMPv3(type=IGMP_TYPE_V3_MEMBERSHIP_REPORT, max_resp_code=30, gaddr="224.0.0.1")
- igmp.grps = [IGMPv3gr(rtype=IGMP_V3_GR_TYPE_INCLUDE, mcaddr="229.10.20.30")]
+ igmp.grps = [IGMPv3gr(rtype=IGMP_V3_GR_TYPE_EXCLUDE, mcaddr="229.10.20.30")]
pkt = IGMPv3.fixup( scapy.Ether(src='00:00:00:00:be:ef') / scapy.IP() / igmp )
pkt = pkt / ("0" * (100 - len(pkt)))
@@ -666,6 +667,57 @@
do_barrier(self.controller)
verify_no_errors(self.controller)
+class TestMulticastForwarding(IGMPPacketIn):
+
+ def runTest(self):
+ delete_all_groups(self.controller)
+ # send igmp join packet
+ super(TestMulticastForwarding, self).runTest()
+
+ vlan_id = 201
+
+ group = createAllGroupAdd(1, onu_port)
+
+ self.controller.message_send(group_add)
+ do_barrier(self.controller)
+ verify_no_errors(self.controller)
+
+ # Create a flow rule matching olt port and vlan id
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(olt_port))
+ match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | vlan_id))
+
+ request = ofp.message.flow_add(
+ table_id=test_param_get("table", 0),
+ cookie=43,
+ match=match,
+ instructions=[
+ ofp.instruction.apply_actions(
+ actions=[ofp.action.group(group_id=1)]),
+ ],
+ buffer_id=ofp.OFP_NO_BUFFER, priority=1000)
+
+ self.controller.message_send(request)
+ do_barrier(self.controller)
+ verify_no_errors(self.controller)
+
+ # It takes some time for flows to propagate down to the data plane
+ time.sleep(5)
+
+ pkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0, \
+ eth_dst = "01:00:5E:00:00:01", ip_dst = "229.10.20.30")
+
+ # downstream
+ self.dataplane.send(olt_port, str(pkt))
+ verify_packet(self, pkt, onu_port)
+
+ # clean up the test
+ delete_all_flows(self.controller)
+ do_barrier(self.controller)
+ verify_no_errors(self.controller)
+ delete_all_groups(self.controller)
+
+
class RemoveRuleTest(OltBaseTest):
def runTest(self):