Adding lots of new test cases for IGMP
diff --git a/src/test/igmp/igmpTest.py b/src/test/igmp/igmpTest.py
index 1670c62..3a0ad15 100644
--- a/src/test/igmp/igmpTest.py
+++ b/src/test/igmp/igmpTest.py
@@ -12,6 +12,7 @@
from McastTraffic import *
from Stats import Stats
from OnosCtrl import OnosCtrl
+from OltConfig import OltConfig
from Channels import IgmpChannel
log.setLevel('INFO')
@@ -42,24 +43,34 @@
V_INF2 = 'veth1'
MGROUP1 = '239.1.2.3'
MGROUP2 = '239.2.2.3'
+ MINVALIDGROUP1 = '255.255.255.255'
+ MINVALIDGROUP2 = '239.255.255.255'
MMACGROUP1 = "01:00:5e:01:02:03"
MMACGROUP2 = "01:00:5e:02:02:03"
- MINVALIDGROUP1 = "255.255.255.255"
- MINVALIDGROUP2 = "255.255.255.255"
IGMP_DST_MAC = "01:00:5e:00:01:01"
IGMP_SRC_MAC = "5a:e1:ac:ec:4d:a1"
IP_SRC = '1.2.3.4'
IP_DST = '224.0.1.1'
+ NEGATIVE_TRAFFIC_STATUS = 1
igmp_eth = Ether(dst = IGMP_DST_MAC, src = IGMP_SRC_MAC, type = ETH_P_IP)
igmp_ip = IP(dst = IP_DST, src = IP_SRC)
IGMP_TEST_TIMEOUT = 5
- IGMP_QUERY_TIMEOUT = 30
+ IGMP_QUERY_TIMEOUT = 60
MCAST_TRAFFIC_TIMEOUT = 10
PORT_TX_DEFAULT = 2
PORT_RX_DEFAULT = 1
max_packets = 100
app = 'org.onosproject.igmp'
+ olt_conf_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json')
+ @classmethod
+ def setUpClass(cls):
+ cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
+ OnosCtrl.cord_olt_config(cls.olt.olt_device_data())
+
+ @classmethod
+ def tearDownClass(cls): pass
+
def setUp(self):
''' Activate the dhcp app'''
self.onos_ctrl = OnosCtrl(self.app)
@@ -159,6 +170,31 @@
if delay != 0:
time.sleep(delay)
+ def send_igmp_join_recvQuery(self, groups, rec_queryCount = None, src_list = ['1.2.3.4'], ip_pkt = None, iface = 'veth0', delay = 2):
+ self.onos_ssm_table_load(groups, src_list)
+ igmp = IGMPv3(type = IGMP_TYPE_V3_MEMBERSHIP_REPORT, max_resp_code=30,
+ gaddr=self.IP_DST)
+ for g in groups:
+ gr = IGMPv3gr(rtype=IGMP_V3_GR_TYPE_EXCLUDE, mcaddr=g)
+ gr.sources = src_list
+ gr.sources = src_list
+ igmp.grps.append(gr)
+ if ip_pkt is None:
+ ip_pkt = self.igmp_eth/self.igmp_ip
+ pkt = ip_pkt/igmp
+ IGMPv3.fixup(pkt)
+ if rec_queryCount == None:
+ log.info('Sending IGMP join for group %s and waiting for one query packet and printing the packet' %groups)
+ resp = srp1(pkt, iface=iface)
+ else:
+ log.info('Sending IGMP join for group %s and waiting for periodic query packets and printing one packet' %groups)
+ resp = srp3(pkt, iface=iface)
+# resp = srp1(pkt, iface=iface) if rec_queryCount else srp3(pkt, iface=iface)
+ resp[0].summary()
+ log.info('Sent IGMP join for group %s and received a query packet and printing packet' %groups)
+ if delay != 0:
+ time.sleep(delay)
+
def send_igmp_leave(self, groups, src_list = ['1.2.3.4'], ip_pkt = None, iface = 'veth0', delay = 2):
igmp = IGMPv3(type = IGMP_TYPE_V3_MEMBERSHIP_REPORT, max_resp_code=30,
gaddr=self.IP_DST)
@@ -174,6 +210,24 @@
if delay != 0:
time.sleep(delay)
+ def send_igmp_leave_listening_group_specific_query(self, groups, src_list = ['1.2.3.4'], ip_pkt = None, iface = 'veth0', delay = 2):
+ igmp = IGMPv3(type = IGMP_TYPE_V3_MEMBERSHIP_REPORT, max_resp_code=30,
+ gaddr=self.IP_DST)
+ for g in groups:
+ gr = IGMPv3gr(rtype=IGMP_V3_GR_TYPE_INCLUDE, mcaddr=g)
+ gr.sources = src_list
+ igmp.grps.append(gr)
+ if ip_pkt is None:
+ ip_pkt = self.igmp_eth/self.igmp_ip
+ pkt = ip_pkt/igmp
+ IGMPv3.fixup(pkt)
+ log.info('Sending IGMP leave for group %s and waiting for one group specific query packet and printing the packet' %groups)
+ resp = srp1(pkt, iface=iface)
+ resp[0].summary()
+ log.info('Sent IGMP leave for group %s and received a group specific query packet and printing packet' %groups)
+ if delay != 0:
+ time.sleep(delay)
+
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+10)
def test_igmp_join_verify_traffic(self):
groups = ['224.0.1.1', '225.0.0.1']
@@ -290,6 +344,7 @@
for g in groups:
group_map[g] = [0,0]
+ log.info('Verifying join interface should receive multicast data')
while True:
p = recv_socket.recv()
if p.dst in groups and group_map[p.dst][0] == 0:
@@ -311,20 +366,22 @@
log.debug('Returning from recv task')
def igmp_not_recv_task(self, intf, groups, join_state):
+ global NEGATIVE_TRAFFIC_STATUS
recv_socket = L2Socket(iface = intf, type = ETH_P_IP)
group_map = {}
for g in groups:
group_map[g] = [0,0]
- log.info('Should not receive any multicast data')
- status = 1
+ log.info('Verifying join interface should not receive any multicast data')
+ NEGATIVE_TRAFFIC_STATUS = 1
def igmp_recv_cb(pkt):
log.info('Multicast packet %s received for left groups %s' %(pkt[IP].dst, groups))
- status = 2
+ global NEGATIVE_TRAFFIC_STATUS
+ NEGATIVE_TRAFFIC_STATUS = 2
sniff(prn = igmp_recv_cb, count = 1, lfilter = lambda p: p[IP].dst in groups,
timeout = 3, opened_socket = recv_socket)
recv_socket.close()
- return status
+ return NEGATIVE_TRAFFIC_STATUS
def group_latency_check(self, groups):
tasks = []
@@ -381,7 +438,7 @@
log.info('Got IGMP query packet from %s for %s' %(pkt[IP].src, pkt[IP].dst))
assert_equal(pkt[IP].dst, '224.0.0.1')
- sniff(prn = igmp_query_cb, count=1, lfilter = lambda p: p[IP].dst in groups,
+ sniff(prn = igmp_query_cb, count=1, lfilter = lambda p: IP in p and p[IP].dst in groups,
opened_socket = self.recv_socket)
self.recv_socket.close()
self.df.callback(0)
@@ -405,6 +462,29 @@
log.info('Sending join message for group %s' %g2)
self.send_igmp_join((g2,), src_list = sourcelist2, ip_pkt = eth/ip, iface = intf, delay = 2)
+ def igmp_send_joins_different_groups_srclist_wait_query_packets(self, groups, sources, intf = V_INF1, delay = 2, ip_src = None, query_group1 = None, query_group2 = None):
+ g1 = groups[0]
+ g2 = groups[1]
+ sourcelist1 = sources[0]
+ sourcelist2 = sources[1]
+ eth = Ether(dst = self.MMACGROUP1, src = self.IGMP_SRC_MAC, type = ETH_P_IP)
+ src_ip = ip_src or self.IP_SRC
+ ip = IP(dst = g1, src = src_ip)
+ if query_group1 is 'group1':
+ log.info('Sending join message for the group %s and waiting for a query packet on join interface' %g1)
+ self.send_igmp_join_recvQuery((g1,), None, src_list = sourcelist1, ip_pkt = eth/ip, iface = intf, delay = 2)
+ else:
+ log.info('Sending join message for the group %s' %g1)
+ self.send_igmp_join((g1,), src_list = sourcelist1, ip_pkt = eth/ip, iface = intf, delay = 2)
+ eth = Ether(dst = self.MMACGROUP2, src = self.IGMP_SRC_MAC, type = ETH_P_IP)
+ ip = IP(dst = g2, src = src_ip)
+ if query_group2 is 'group2':
+ log.info('Sending join message for the group %s and waiting for a query packet on join interface' %g2)
+ self.send_igmp_join_recvQuery((g2,), None, src_list = sourcelist2, ip_pkt = eth/ip, iface = intf, delay = 2)
+ else:
+ log.info('Sending join message for group %s' %g2)
+ self.send_igmp_join((g2,), src_list = sourcelist2, ip_pkt = eth/ip, iface = intf, delay = 2)
+
def igmp_joins_leave_functionality(self, again_join = False, df = None):
groups1 = (self.MGROUP1,)
groups2 = (self.MGROUP2,)
@@ -461,7 +541,7 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
def test_igmp_2joins_1leave_functionality(self):
- '''This test is subscribing to two channels and sending leave for one channel'''
+ ## '''This test is subscribing to two channels and sending leave for one channel'''
df = defer.Deferred()
def test_igmp_2joins_1leave():
self.igmp_joins_leave_functionality(again_join = False, df = df)
@@ -471,7 +551,7 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+25)
def test_igmp_2joins_1leave_again_joins_functionality(self):
- '''This test is subscribing to two channels and sending leave for one channel,again join to the same group'''
+ ## '''This test is subscribing to two channels and sending leave for one channel,again join to the same group'''
df = defer.Deferred()
def test_igmp_2joins_1leave_join_again():
self.igmp_joins_leave_functionality(again_join = True, df = df)
@@ -479,7 +559,8 @@
reactor.callLater(0, test_igmp_2joins_1leave_join_again)
return df
- def igmp_not_src_list_functionality(self, df = None):
+ def igmp_not_in_src_list_functionality(self, df = None):
+ ## '''This test is sending multicast data from source 6.6.6.6 which is not in joins report '''
groups1 = (self.MGROUP1,)
groups2 = (self.MGROUP2,)
self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
@@ -495,20 +576,21 @@
src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
mcastTraffic1.start()
join_state1 = IGMPTestState(groups = groups1)
+ log.info('Interface should not receive from multicast groups %s from an interface, which is expected' %groups1)
target1 = self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
assert target1 == 1, 'EXPECTED FAILURE'
- log.info('Interface is not receiving from multicast groups %s' %groups1)
+ log.info('Interface is not receiving from multicast groups %s, working as expected' %groups1)
mcastTraffic1.stop()
self.onos_ctrl.deactivate()
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
- def test_igmp_not_src_list_functionality(self):
- '''This test is sending join with source list A,B,C and exclude A,D'''
+ def test_igmp_not_in_src_list_functionality(self):
+ ## '''This test is sending multicast data from source 6.6.6.6 which is not in joins report '''
df = defer.Deferred()
- def igmp_not_src_list_functionality():
- self.igmp_not_src_list_functionality(df = df)
+ def igmp_not_in_src_list_functionality():
+ self.igmp_not_in_src_list_functionality(df = df)
df.callback(0)
- reactor.callLater(0, igmp_not_src_list_functionality)
+ reactor.callLater(0, igmp_not_in_src_list_functionality)
return df
def igmp_change_to_exclude_src_list_functionality(self, df = None):
@@ -537,7 +619,7 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+10)
def test_igmp_change_to_exclude_src_list_functionality(self):
- '''This test is sending join with source list A,B,C and exclude A,D'''
+ ## '''This test is checking that change to exclude source list functionality '''
df = defer.Deferred()
def igmp_change_to_exclude_src_list_functionality():
self.igmp_change_to_exclude_src_list_functionality(df = df)
@@ -545,14 +627,81 @@
reactor.callLater(0, igmp_change_to_exclude_src_list_functionality)
return df
+ def igmp_include_to_allow_src_list_functionality(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4', '6.6.6.6'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+30)
+ def test_igmp_include_to_allow_src_list_functionality(self):
+ '''Verify join INCLUDE (A) and Allow(B) from both A and B source list should receive multicast traffic. '''
+ df = defer.Deferred()
+ def igmp_include_to_allow_src_list_functionality():
+ self.igmp_include_to_allow_src_list_functionality(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_include_to_allow_src_list_functionality)
+ return df
+
+ def igmp_include_to_block_src_list_functionality(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ self.send_igmp_leave(groups = groups1, src_list = ['6.6.6.6','7.7.7.7'],
+ iface = self.V_INF1, delay = 2)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ log.info('Interface is still receiving from old multicast group data %s even after we send bolck list' %groups1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+30)
+ def test_igmp_include_to_block_src_list_functionality(self):
+ '''Verify join INCLUDE (A) and Block(B) from A source list, should receive multicast traffic.'''
+ df = defer.Deferred()
+ def igmp_include_to_block_src_list_functionality():
+ self.igmp_include_to_block_src_list_functionality(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_include_to_block_src_list_functionality)
+ return df
+
+
def igmp_change_to_include_src_list_functionality(self, df = None):
groups1 = (self.MGROUP1,)
groups2 = (self.MGROUP2,)
self.send_igmp_leave(groups = groups1, src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4'],
iface = self.V_INF1, delay = 2)
- self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
- (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['6.6.6.6', '5.5.5.5']),
- intf = self.V_INF1, delay = 2)
+
dst_mac = '01:00:5e:01:02:03'
src_ip = '2.2.2.2'
if df is None:
@@ -576,7 +725,7 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+10)
def test_igmp_change_to_include_src_list_functionality(self):
- '''This test is sending join with source list A,B,C and exclude D,E'''
+ ## '''This test is checking that change to include source list functionality '''
df = defer.Deferred()
def igmp_change_to_include_src_list_functionality():
self.igmp_change_to_include_src_list_functionality(df = df)
@@ -584,6 +733,81 @@
reactor.callLater(0, igmp_change_to_include_src_list_functionality)
return df
+ def igmp_exclude_to_allow_src_list_functionality(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.send_igmp_leave(groups = groups1, src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4'],
+ iface = self.V_INF1, delay = 2)
+
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
+ (['6.6.6.6', '7.7.7.7', '8.8.8.8'], ['6.6.6.6', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+10)
+ def test_igmp_exclude_to_allow_src_list_functionality(self):
+ '''Verify join EXCLUDE(A) and Allow(B) from both A and B source list, should receive multicast traffic. '''
+ df = defer.Deferred()
+ def igmp_exclude_to_allow_src_list_functionality():
+ self.igmp_exclude_to_allow_src_list_functionality(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_exclude_to_allow_src_list_functionality)
+ return df
+
+ def igmp_exclude_to_block_src_list_functionality(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.send_igmp_leave(groups = groups1, src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4'],
+ iface = self.V_INF1, delay = 2)
+
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ self.send_igmp_leave(groups = groups1, src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4', '5.5.5.5', '7.7.7.7'],
+ iface = self.V_INF1, delay = 2)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+10)
+ def test_igmp_exclude_to_block_src_list_functionality(self):
+ ''' Verify join EXCLUDE (A) and Block(B) from A source list, should receive multicast traffic. '''
+ df = defer.Deferred()
+ def igmp_exclude_to_block_src_list_functionality():
+ self.igmp_exclude_to_block_src_list_functionality(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_exclude_to_block_src_list_functionality)
+ return df
+
def igmp_new_src_list_functionality(self, df = None):
groups1 = (self.MGROUP1,)
groups2 = (self.MGROUP2,)
@@ -604,7 +828,7 @@
assert target1 == 1, 'EXPECTED FAILURE'
log.info('Interface is not receiving from multicast groups %s' %groups1)
self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
- (['6.6.6.6', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ (['2.2.2.2', '6.6.6.6', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
intf = self.V_INF1, delay = 2)
target2 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
log.info('Interface is receiving from multicast groups %s after sending join with new source list' %groups1)
@@ -613,7 +837,7 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+10)
def test_igmp_new_src_list_functionality(self):
- '''This test is sending join with source list A,B,C and exclude A,D'''
+ ## '''This test is checking that adding new source list to existing source list functionality '''
df = defer.Deferred()
def igmp_new_src_list_functionality():
self.igmp_new_src_list_functionality(df = df)
@@ -651,7 +875,7 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
def test_igmp_block_old_src_list_functionality(self):
- '''This test is sending join with source list A,B,C and exclude A,D'''
+ ## '''This test is checking that block old source list from existing source list functionality '''
df = defer.Deferred()
def igmp_block_old_src_list_functionality():
self.igmp_block_old_src_list_functionality(df = df)
@@ -660,7 +884,6 @@
return df
def igmp_include_empty_src_list_functionality(self, df = None):
- print'This test is sending join with source list A,B,C and exclude D,F,G'
groups1 = (self.MGROUP1,)
groups2 = (self.MGROUP2,)
groups = groups1 + groups2
@@ -685,8 +908,8 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
def ztest_igmp_include_empty_src_list_functionality(self):
- '''This test is sending join with source list A,B,C and exclude D,F,G'''
- '''Disabling this test as scapy IGMP doesn't work with empty source lists'''
+ ## '''This test is checking that multicast functionality by sending empty source list to include '''
+ ## '''Disabling this test as scapy IGMP doesn't work with empty source lists'''
df = defer.Deferred()
def igmp_include_empty_src_list_functionality():
self.igmp_include_empty_src_list_functionality(df = df)
@@ -716,8 +939,8 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
def ztest_igmp_exclude_empty_src_list_functionality(self):
- '''This test is sending join with source list A,B,C and exclude D,F,G'''
- '''Disabling this test case since scapy IGMP doesn't work with empty src list'''
+ ## '''This test is checking that multicast functionality by sending empty source list to exclude '''
+ ## '''Disabling this test case since scapy IGMP doesn't work with empty src list'''
df = defer.Deferred()
def igmp_exclude_empty_src_list_functionality():
self.igmp_exclude_empty_src_list_functionality()
@@ -751,7 +974,7 @@
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
def test_igmp_join_sourceip_0_0_0_0_functionality(self):
- '''This test is sending join with source list A,B,C and exclude D,F,G with source IP as 0.0.0.0'''
+ ## '''This test is sending join with source list A,B,C and exclude D,F,G with source IP as 0.0.0.0'''
df = defer.Deferred()
def igmp_join_sourceip_0_0_0_0_functionality():
self.igmp_join_sourceip_0_0_0_0_functionality(df = df)
@@ -759,6 +982,7 @@
reactor.callLater(0, igmp_join_sourceip_0_0_0_0_functionality)
return df
+
def igmp_invalid_join_packet_functionality(self, df = None):
groups1 = (self.MGROUP1,)
groups2 = (self.MINVALIDGROUP1,)
@@ -780,13 +1004,13 @@
join_state1 = IGMPTestState(groups = groups2)
target1 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
assert target1==1, 'EXPECTED FAILURE'
- log.info('Interface is not receiving data from multicast groups %s when we sent invalid join packet ' %groups2)
+ log.info('Interface is not receiving from multicast groups %s when we sent invalid join packet ' %groups2)
mcastTraffic1.stop()
self.onos_ctrl.deactivate()
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
def test_igmp_invalid_join_packet_functionality(self):
- '''This test is sending invalid join with source list A,B,C and exclude D,F,G with multicast group as 255.255.255.255'''
+ ## '''This test is sending invalid join with source list A,B,C and exclude D,F,G with multicast group as 255.255.255.255'''
df = defer.Deferred()
def igmp_invalid_join_packet_functionality():
self.igmp_invalid_join_packet_functionality(df = df)
@@ -814,38 +1038,95 @@
mcastTraffic1.start()
join_state1 = IGMPTestState(groups = groups2)
target1 = self.igmp_recv_task(self.V_INF1, groups2, join_state1)
- log.info('Interface is receiving data from multicast groups, before bringing it down self.V_INF1=%s ' %self.V_INF1)
+ log.info('Interface is receiving from multicast groups, before bring down the self.V_INF1=%s ' %self.V_INF1)
os.system('ifconfig '+self.V_INF1+' down')
log.info(' the self.V_INF1 %s is down now ' %self.V_INF1)
os.system('ifconfig '+self.V_INF1)
time.sleep(10)
- #target1 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
- #assert target1==1, 'EXPECTED FAILURE'
- #log.info('Interface is not receiving from multicast groups %s when we shutdown the subscriber interface ' %groups2)
os.system('ifconfig '+self.V_INF1+' up')
os.system('ifconfig '+self.V_INF1)
log.info(' the self.V_INF1 %s is up now ' %self.V_INF1)
- #target1 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
- #assert target1==0, 'EXPECTED FAILURE'
- #log.info('Interface is not receiving from multicast groups %s when we shutdown the subscriber interface ' %groups2)
target1 = self.igmp_recv_task(self.V_INF1, groups2, join_state1)
- log.info('Interface is receiving data from multicast groups %s when we bring up interface ' %groups2)
+ log.info('Interface is receiving from multicast groups %s when we bringup interface up after down ' %groups2)
mcastTraffic1.stop()
self.onos_ctrl.deactivate()
-
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
- def test_igmp_join_data_receiving_during_subscriber_link_down_up_functionality(self):
- '''This test is sending join with source list A,B,C and exclude D,F,G with valid multicast group during receiving data, shutdown the data receiving port '''
+ def test_igmp_join_data_receiving_during_subscriber_link_up_down_functionality(self):
+ ## '''This test is sending join with source list A,B,C and exclude D,F,G with valid multicast group during receiving data, shutdown on data receiving port'''
df = defer.Deferred()
- def igmp_join_data_receiving_during_subscriber_link_down_up_functionality():
- self.igmp_join_data_receiving_during_subscriber_link_down_up_functionality(df = df)
- df.callback(0)
+ def igmp_join_data_receiving_during_subscriber_link_up_down_functionality():
+ self.igmp_join_data_receiving_during_subscriber_link_down_up_functionality(df = df)
+ df.callback(0)
reactor.callLater(0, igmp_join_data_receiving_during_subscriber_link_down_up_functionality)
return df
+ def igmp_join_data_receiving_during_channel_distributor_link_up_down_functionality(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ groups = groups1 + groups2
+ ip_src = '1.1.1.1'
+ self.igmp_send_joins_different_groups_srclist(groups,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['5.5.5.5', '6.6.6.6']),
+ intf = self.V_INF1, delay = 2, ip_src = ip_src)
+ ip_src = self.IP_SRC
+ dst_mac1 = '01:00:5e:01:02:03'
+ dst_mac2 = '01:00:5e:02:02:03'
+ src_ip2 = '5.5.5.5'
+ src_ip1 = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpState2 = IGMPTestState(groups = groups2, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv2 = IGMPTestState(groups = groups2, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac1,
+ src_ip = src_ip1, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic2 = McastTraffic(groups2, iface= 'veth3', dst_mac = dst_mac2,
+ src_ip = src_ip2, cb = self.send_mcast_cb, arg = igmpState2)
+ mcastTraffic1.start()
+ mcastTraffic2.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ join_state2 = IGMPTestState(groups = groups2)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ target2 = self.igmp_recv_task(self.V_INF1, groups2, join_state2)
+ log.info('Interface is receiving from multicast groups, before bring down the veth2 and subscriber link is self.V_INF1=%s up ' %self.V_INF1)
+ mcastTraffic1.stop()
+ os.system('ifconfig '+'veth2'+' down')
+ log.info(' the channel distributor interface veth2 is down now ' )
+ os.system('ifconfig '+'veth2')
+ time.sleep(10)
+ log.info('Verifying interface is still receiving a multicast groups2 %s traffic even though other group traffic sending interface goes down' %groups2)
+ target2 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
+ log.info('Verified that interface is still receiving a multicast groups2 %s traffic even though other group traffic sending interface goes down' %groups2)
+ target1 = self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1==1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups1 %s when we shutdown the subscriber interface ' %groups1)
+ os.system('ifconfig '+'veth2'+' up')
+ os.system('ifconfig '+'veth2')
+ log.info(' the channel distributor interface veth2 is up now ')
+ time.sleep(10)
+ mcastTraffic1.start()
+ log.info('Verifying interface is receiving from both multicast groups data %s when we bringup interface up after down ' %groups2)
+ target1 = self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ target2 = self.igmp_recv_task(self.V_INF1, groups2, join_state2)
+ target2 = self.igmp_recv_task(self.V_INF1, groups2, join_state2)
+ log.info('Interface is receiving from multicast groups %s when we bringup interface up after down ' %groups2)
+ mcastTraffic2.stop()
+ self.onos_ctrl.deactivate()
+ ## This test case is failing to receive traffic from multicast data from defferent channel interfaces TO-DO
+ ###### TO DO scenario #######
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+60)
+ def ztest_igmp_join_data_receiving_during_channel_distributor_link_down_up_functionality(self):
+ ## '''This test is sending join with source list A,B,C with valid multicast group during receiving data, shutdown the data sending port'''
+ df = defer.Deferred()
+ def igmp_join_data_receiving_during_channel_distributor_link_down_up_functionality():
+ self.igmp_join_data_receiving_during_channel_distributor_link_down_up_functionality(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_join_data_receiving_during_channel_distributor_link_down_up_functionality)
+ return df
- def igmp_invalidClassDIP_join_packet_functionality(self, df = None):
+ def igmp_invalidClassD_IP_join_packet_functionality(self, df = None):
groups1 = (self.MGROUP1,)
groups2 = (self.MINVALIDGROUP2,)
groups = groups1 + groups2
@@ -866,21 +1147,21 @@
join_state1 = IGMPTestState(groups = groups2)
target1 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
assert target1==1, 'EXPECTED FAILURE'
- log.info('Interface is not receiving data from multicast groups %s when we send invalid join packet ' %groups2)
+ log.info('Interface is not receiving from multicast groups %s when we sent invalid join packet ' %groups2)
mcastTraffic1.stop()
self.onos_ctrl.deactivate()
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
- def test_igmp_invalidClassDIP_join_packet_functionality(self):
- '''This test is sending invalid join with source list A,B,C and exclude D,F,G with multicast group as 239.255.255.255'''
+ def test_igmp_invalidClassD_IP_join_packet_functionality(self):
+ ## '''This test is sending invalid join with source list A,B,C with multicast group as 239.255.255.255'''
df = defer.Deferred()
- def igmp_invalidClassDIP_join_packet_functionality():
- self.igmp_invalidClassDIP_join_packet_functionality(df = df)
+ def igmp_invalidClass_D_IP_join_packet_functionality():
+ self.igmp_invalidClass_D_IP_join_packet_functionality(df = df)
df.callback(0)
- reactor.callLater(0, igmp_invalidClassDIP_join_packet_functionality)
+ reactor.callLater(0, igmp_invalidClassD_IP_join_packet_functionality)
return df
- def igmp_invalidClassDIP_as_srclistIP_join_packet_functionality(self, df = None):
+ def igmp_invalidClassD_IP_as_srclistIP_join_packet_functionality(self, df = None):
groups1 = (self.MGROUP1,)
groups2 = (self.MGROUP2,)
groups = groups1 + groups2
@@ -901,34 +1182,522 @@
join_state1 = IGMPTestState(groups = groups2)
target1 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
assert target1==1, 'EXPECTED FAILURE'
- log.info('Interface is not receiving data from multicast groups %s when we send invalid join packet ' %groups2)
+ log.info('Interface is not receiving from multicast groups %s when we sent invalid join packet ' %groups2)
mcastTraffic1.stop()
self.onos_ctrl.deactivate()
@deferred(timeout=MCAST_TRAFFIC_TIMEOUT+20)
- def test_igmp_invalidClassDIP_as_srclistIP_join_packet_functionality(self):
- '''This test is sending invalid join with source list A,B,C and exclude D,F,G with source list as 239.5.5.5'''
+ def test_igmp_invalidClassD_IP_as_srclistIP_join_packet_functionality(self):
+ ## '''This test is sending invalid join with source list A,B,C and exclude D,F,G with source list as 239.5.5.5'''
df = defer.Deferred()
- def igmp_invalidClassDIP_as_srclistIP_join_packet_functionality():
- self.igmp_invalidClassDIP_as_srclistIP_join_packet_functionality(df = df)
- df.callback(0)
- reactor.callLater(0, igmp_invalidClassDIP_as_srclistIP_join_packet_functionality)
- return df
+ def igmp_invalidClassD_IP_as_srclistIP_join_packet_functionality():
+ self.igmp_invalidClassD_IP_as_srclistIP_join_packet_functionality(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_invalidClassD_IP_as_srclistIP_join_packet_functionality)
+ return df
- def send_igmp_join_listeningQuery(self, groups, src_list = ['1.2.3.4'], ip_pkt = None, iface = 'veth0', delay = 2):
- self.onos_ssm_table_load(groups, src_list)
- igmp = IGMPv3(type = IGMP_TYPE_V3_MEMBERSHIP_REPORT,
- max_resp_code=30,
- gaddr=self.IP_DST)
- for g in groups:
- gr = IGMPv3gr(rtype=IGMP_V3_GR_TYPE_EXCLUDE, mcaddr=g)
- gr.sources = src_list
- igmp.grps.append(gr)
- if ip_pkt is None:
- ip_pkt = self.igmp_eth/self.igmp_ip
- pkt = ip_pkt/igmp
- IGMPv3.fixup(pkt)
- resp = srp1(pkt, iface=iface)
- resp[0].summary()
- if delay != 0:
- time.sleep(delay)
+
+ def igmp_general_query_recv_packet_functionality(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ groups = groups1 + groups2
+ ip_src = '1.1.1.1'
+ self.igmp_send_joins_different_groups_srclist(groups,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['5.5.5.5']),
+ intf = self.V_INF1, delay = 2, ip_src = ip_src)
+ ip_src = self.IP_SRC
+ dst_mac = '01:00:5e:02:02:03'
+ src_ip = '5.5.5.5'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups2, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups2, df = df)
+ mcastTraffic1 = McastTraffic(groups2, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups2)
+ log.info('Started delay to verify multicast data taraffic for group %s is received or not for 180 sec ' %groups2)
+ time.sleep(100)
+ target2 = self.igmp_recv_task(self.V_INF1, groups2, join_state1)
+ log.info('Verified that multicast data for group %s is received after 100 sec ' %groups2)
+ time.sleep(50)
+ target2 = self.igmp_recv_task(self.V_INF1, groups2, join_state1)
+ log.info('Verified that multicast data for group %s is received after 150 sec ' %groups2)
+ time.sleep(30)
+ target2 = self.igmp_recv_task(self.V_INF1, groups2, join_state1)
+ log.info('Verified that multicast data for group %s is received after 180 sec ' %groups2)
+ time.sleep(10)
+ target2 = self.igmp_recv_task(self.V_INF1, groups2, join_state1)
+ log.info('Verified that multicast data for group %s is received after 190 sec ' %groups2)
+ target3 = mcastTraffic1.isRecvStopped()
+ assert target3==False, 'EXPECTED FAILURE'
+ log.info('Verified that multicast data for a group %s is still transmitting from a data interface' %groups2)
+ log.info('Now checking joining interface is receiving a multicast data for group %s after 190 sec' %groups2)
+ target1 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
+ assert target1==1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving multicast data for group %s' %groups2)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+250)
+ def test_igmp_general_query_recv_packet_traffic_functionality(self):
+ ## '''This test is verifying whether multicast data is stopped after 180 sec time if we dont respond to query packet which will generated by a querier router'''
+ df = defer.Deferred()
+ def igmp_general_query_recv_packet_functionality():
+ self.igmp_general_query_recv_packet_functionality(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_general_query_recv_packet_functionality)
+ return df
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+80)
+ def test_igmp_query_packet_received_on_joining_interface(self):
+ ## '''This test is verifying whether joining interface is receiving general membership query packet from querier router '''
+ groups = ['224.0.1.10', '225.0.0.10']
+ leave_groups = ['224.0.1.10']
+ df = defer.Deferred()
+ igmpState = IGMPTestState(groups = groups, df = df)
+ igmpStateRecv = IGMPTestState(groups = groups, df = df)
+ igmpStateList = (igmpState, igmpStateRecv)
+ mcastTraffic = McastTraffic(groups, iface= 'veth2', cb = self.send_mcast_cb,
+ arg = igmpState)
+ self.df = df
+ self.mcastTraffic = mcastTraffic
+ self.recv_socket = L3PacketSocket(iface = 'veth0', type = ETH_P_IP)
+
+ def igmp_srp_task(stateList):
+ igmpSendState, igmpRecvState = stateList
+ if not mcastTraffic.isRecvStopped():
+ result = self.igmp_recv(igmpRecvState)
+ reactor.callLater(0, igmp_srp_task, stateList)
+ else:
+ self.mcastTraffic.stop()
+ self.recv_socket.close()
+ self.igmp_verify_leave(stateList, leave_groups)
+ self.df.callback(0)
+
+ log.info('Sending join packet and expected to receive on egeneral query packet after 60 sec for multicast %s ' %groups)
+ self.send_igmp_join_recvQuery(groups)
+ log.info('Received a egeneral query packet for multicast %s group on joing interface and sending traffic' %groups)
+ mcastTraffic.start()
+ self.test_timer = reactor.callLater(self.MCAST_TRAFFIC_TIMEOUT, self.mcast_traffic_timer)
+ reactor.callLater(0, igmp_srp_task, igmpStateList)
+ return df
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+190)
+ def test_igmp_periodic_query_packet_received_on_joining_interface(self):
+ ## '''This test is verifying whether joining interface is receiving periodic general membership query packets from querier router '''
+ groups = ['224.0.1.10', '225.0.0.10']
+ leave_groups = ['224.0.1.10']
+ df = defer.Deferred()
+ igmpState = IGMPTestState(groups = groups, df = df)
+ igmpStateRecv = IGMPTestState(groups = groups, df = df)
+ igmpStateList = (igmpState, igmpStateRecv)
+ mcastTraffic = McastTraffic(groups, iface= 'veth2', cb = self.send_mcast_cb,
+ arg = igmpState)
+ self.df = df
+ self.mcastTraffic = mcastTraffic
+ self.recv_socket = L3PacketSocket(iface = 'veth0', type = ETH_P_IP)
+
+ def igmp_srp_task(stateList):
+ igmpSendState, igmpRecvState = stateList
+ if not mcastTraffic.isRecvStopped():
+ result = self.igmp_recv(igmpRecvState)
+ reactor.callLater(0, igmp_srp_task, stateList)
+ else:
+ self.mcastTraffic.stop()
+ self.recv_socket.close()
+ self.igmp_verify_leave(stateList, leave_groups)
+ self.df.callback(0)
+
+ self.send_igmp_join_recvQuery(groups,3)
+ return df
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+190)
+ def test_igmp_periodic_query_packet_received_and_checking_entry_deleted(self):
+ ## '''This test is verifying whether joining interface is receiving periodic general membership query packets from querier router, checking expire membership interval and traffic should not receive'''
+ groups = ['224.0.1.10', '225.0.0.10']
+ leave_groups = ['224.0.1.10']
+ df = defer.Deferred()
+ igmpState = IGMPTestState(groups = groups, df = df)
+ igmpStateRecv = IGMPTestState(groups = groups, df = df)
+ igmpStateList = (igmpState, igmpStateRecv)
+ mcastTraffic = McastTraffic(groups, iface= 'veth2', cb = self.send_mcast_cb,
+ arg = igmpState)
+ self.df = df
+ self.mcastTraffic = mcastTraffic
+ self.recv_socket = L3PacketSocket(iface = 'veth0', type = ETH_P_IP)
+
+ def igmp_srp_task(stateList):
+ igmpSendState, igmpRecvState = stateList
+ if not mcastTraffic.isRecvStopped():
+ result = self.igmp_recv(igmpRecvState)
+ reactor.callLater(0, igmp_srp_task, stateList)
+ else:
+ self.mcastTraffic.stop()
+ self.recv_socket.close()
+ self.igmp_verify_leave(stateList, leave_groups)
+ self.df.callback(0)
+
+ self.send_igmp_join_recvQuery(groups,3)
+ log.info('Received periodic egeneral query packets for multicast %s, now checking entry is deleted from tabel by sending traffic for that group' %groups)
+ mcastTraffic.start()
+ self.test_timer = reactor.callLater(self.MCAST_TRAFFIC_TIMEOUT, self.mcast_traffic_timer)
+ reactor.callLater(0, igmp_srp_task, igmpStateList)
+ return df
+
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+190)
+ def test_igmp_member_query_interval_expire_re_joining_interface(self):
+ ## '''This test is verifying whether joining interface is receiving multicast data even after group menership interval expire by sending again joining to that multicast data group'''
+ groups = ['224.0.1.10', '225.0.0.10']
+ leave_groups = ['224.0.1.10']
+ df = defer.Deferred()
+ igmpState = IGMPTestState(groups = groups, df = df)
+ igmpStateRecv = IGMPTestState(groups = groups, df = df)
+ igmpStateList = (igmpState, igmpStateRecv)
+ mcastTraffic = McastTraffic(groups, iface= 'veth2', cb = self.send_mcast_cb,
+ arg = igmpState)
+ self.df = df
+ self.mcastTraffic = mcastTraffic
+ self.recv_socket = L3PacketSocket(iface = 'veth0', type = ETH_P_IP)
+
+ def igmp_srp_task(stateList):
+ igmpSendState, igmpRecvState = stateList
+ if not mcastTraffic.isRecvStopped():
+ result = self.igmp_recv(igmpRecvState)
+ reactor.callLater(0, igmp_srp_task, stateList)
+ else:
+ self.mcastTraffic.stop()
+ self.recv_socket.close()
+ self.igmp_verify_leave(stateList, leave_groups)
+ self.df.callback(0)
+
+ self.send_igmp_join_recvQuery(groups,3)
+ log.info('Received periodic egeneral query packets for multicast %s, now sending join packet again and verifying traffic for that group is received or not on joining interface' %groups)
+ self.send_igmp_join(groups)
+ mcastTraffic.start()
+ self.test_timer = reactor.callLater(self.MCAST_TRAFFIC_TIMEOUT, self.mcast_traffic_timer)
+ reactor.callLater(0, igmp_srp_task, igmpStateList)
+ return df
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+50)
+ def test_igmp_leave_verify_received_group_source_specific_query(self):
+ ## '''This test is verfying when we send leave message we should get group-source specific query '''
+ groups = ['224.0.1.10', '225.0.0.10']
+ leave_groups = ['224.0.1.10']
+ df = defer.Deferred()
+ igmpState = IGMPTestState(groups = groups, df = df)
+ igmpStateRecv = IGMPTestState(groups = groups, df = df)
+ igmpStateList = (igmpState, igmpStateRecv)
+ mcastTraffic = McastTraffic(groups, iface= 'veth2', cb = self.send_mcast_cb,
+ arg = igmpState)
+ self.df = df
+ self.mcastTraffic = mcastTraffic
+ self.recv_socket = L3PacketSocket(iface = 'veth0', type = ETH_P_IP)
+
+ def igmp_srp_task(stateList):
+ igmpSendState, igmpRecvState = stateList
+ if not mcastTraffic.isRecvStopped():
+ result = self.igmp_recv(igmpRecvState)
+ reactor.callLater(0, igmp_srp_task, stateList)
+ else:
+ self.mcastTraffic.stop()
+ self.recv_socket.close()
+ self.igmp_verify_leave(stateList, leave_groups)
+ self.df.callback(0)
+
+ self.send_igmp_join(groups)
+ self.send_igmp_leave_listening_group_specific_query(leave_groups, delay = 3)
+ return df
+
+ def igmp_change_to_exclude_src_list_check_for_group_source_specific_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ self.send_igmp_leave_listening_group_specific_query(groups = groups1, src_list = ['2.2.2.2'], iface = self.V_INF1, delay =2)
+ time.sleep(10)
+ target2 = self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target2 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s after sending CHANGE_TO_EXCLUDE' %groups2)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+60)
+ def test_igmp_change_to_exclude_src_list_check_for_group_source_specific_query(self):
+ '''Verify join INCLUDE (A) and TO_EX(B) for a multicast group,
+ we should receive group source specific membership query packet to A*B source list interface'''
+ df = defer.Deferred()
+ def igmp_change_to_exclude_src_list_check_for_group_source_specific_query():
+ self.igmp_change_to_exclude_src_list_check_for_group_source_specific_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_change_to_exclude_src_list_check_for_group_source_specific_query)
+ return df
+
+ def igmp_change_to_include_src_list_check_for_general_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.send_igmp_leave(groups = groups1, src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4'],
+ iface = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ self.igmp_send_joins_different_groups_srclist_wait_query_packets(groups1 + groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['6.6.6.6', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2,query_group1 = 'group1', query_group2 = None)
+ time.sleep(10)
+ target2 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ log.info('Interface is receiving from multicast groups %s after send Change to include message' %groups1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+80)
+ def test_igmp_change_to_include_src_list_check_for_general_query(self):
+ '''Verify join EXCLUDE (A) and TO_IN(B) for a multicast group,
+ we should receive general membership query packet. '''
+ df = defer.Deferred()
+ def igmp_change_to_include_src_list_check_for_general_query():
+ self.igmp_change_to_include_src_list_check_for_general_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_change_to_include_src_list_check_for_general_query)
+ return df
+
+ def igmp_allow_new_src_list_check_for_general_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.igmp_send_joins_different_groups_srclist(groups1+groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '6.6.6.6'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1 = self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ #assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ self.igmp_send_joins_different_groups_srclist_wait_query_packets(groups1 + groups2, (['2.2.2.2', '6.6.6.6', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2, query_group1 = 'group1', query_group2 = None)
+ target2 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ log.info('Interface is receiving from multicast groups %s after sending join with new source list' %groups1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+80)
+ def test_igmp_allow_new_src_list_check_for_general_query(self):
+ '''Verify join INCLUDE (A) and ALLOW(B) for a multicast group, we
+ should receive general membership query packet. '''
+ df = defer.Deferred()
+ def igmp_allow_new_src_list_check_for_general_query():
+ self.igmp_allow_new_src_list_check_for_general_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_allow_new_src_list_check_for_general_query)
+ return df
+
+ def igmp_block_old_src_list_check_for_group_source_specific_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ groups = groups1 + groups2
+ self.igmp_send_joins_different_groups_srclist(groups,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:02:02:03'
+ src_ip = '5.5.5.5'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups2, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups2, df = df)
+ mcastTraffic1 = McastTraffic(groups2, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups2)
+ target1 = self.igmp_recv_task(self.V_INF1, groups2, join_state1)
+ log.info('Interface is receiving from multicast groups %s' %groups2)
+ self.igmp_send_joins_different_groups_srclist_wait_query_packets(groups,
+ (['6.6.6.6', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '7.7.7.7']),
+ intf = self.V_INF1, delay = 2, query_group1 = 'group1', query_group2 = None)
+ target2 = self.igmp_not_recv_task(self.V_INF1, groups2, join_state1)
+ assert target2 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s after sending join with block old source list' %groups2)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+90)
+ def test_igmp_block_old_src_list_check_for_group_source_specific_query(self):
+ """ Verify when we send join INCLUDE (A) and BLOCK(B) for a multicast group, we should receive
+ group source specific membership query packet to A*B source list interface"""
+ df = defer.Deferred()
+ def igmp_block_old_src_list_check_for_group_source_specific_query():
+ self.igmp_block_old_src_list_check_for_group_source_specific_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_block_old_src_list_check_for_group_source_specific_query)
+ return df
+
+ def igmp_include_to_allow_src_list_check_for_general_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ self.igmp_send_joins_different_groups_srclist_wait_query_packets(groups1 + groups2,(['2.2.2.2', '3.3.3.3', '4.4.4.4', '6.6.6.6'], ['2.2.2.2', '5.5.5.5']), intf = self.V_INF1, delay = 2, query_group1 = 'group1', query_group2 = None)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+40)
+ def test_igmp_include_to_allow_src_list_check_for_general_query(self):
+ '''Verify join INCLUDE (A) and Allow(B) ,should receive general membership query packet '''
+ df = defer.Deferred()
+ def igmp_include_to_allow_src_list_check_for_general_query():
+ self.igmp_include_to_allow_src_list_check_for_general_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_include_to_allow_src_list_check_for_general_query)
+ return df
+
+ def igmp_include_to_block_src_list_check_for_group_source_specific_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.igmp_send_joins_different_groups_srclist(groups1 + groups2,
+ (['2.2.2.2', '3.3.3.3', '4.4.4.4'], ['2.2.2.2', '5.5.5.5']),
+ intf = self.V_INF1, delay = 2)
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ self.send_igmp_leave_listening_group_specific_query(groups = groups1, src_list = ['6.6.6.6','7.7.7.7'],
+ iface = self.V_INF1, delay = 2)
+ target1 = self.igmp_recv_task(self.V_INF1, groups1, join_state1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+40)
+ def test_igmp_include_to_block_src_list_check_for_group_source_specific_query(self):
+ '''Verify join INCLUDE (A) and Block(B) ,should receive group source specific membership query packet. '''
+ df = defer.Deferred()
+ def igmp_include_to_block_src_list_check_for_group_source_specific_query():
+ self.igmp_include_to_block_src_list_check_for_group_source_specific_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_include_to_block_src_list_check_for_group_source_specific_query)
+ return df
+
+ def igmp_exclude_to_allow_src_list_check_for_general_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.send_igmp_leave(groups = groups1, src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4'],
+ iface = self.V_INF1, delay = 2)
+
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ self.igmp_send_joins_different_groups_srclist_wait_query_packets(groups1 + groups2,
+ (['6.6.6.6', '7.7.7.7', '8.8.8.8'], ['6.6.6.6', '5.5.5.5']), intf = self.V_INF1, delay = 2, query_group1 = 'group1', query_group2 = None)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+90)
+ def test_igmp_exclude_to_allow_src_list_check_for_general_query(self):
+ '''Verify join EXCLUDE(A) and Allow(B) ,should receive general membership query packet. '''
+ df = defer.Deferred()
+ def igmp_exclude_to_allow_src_list_check_for_general_query():
+ self.igmp_exclude_to_allow_src_list_check_for_general_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_exclude_to_allow_src_list_check_for_general_query)
+ return df
+
+ def igmp_exclude_to_block_src_list_check_for_group_source_specific_query(self, df = None):
+ groups1 = (self.MGROUP1,)
+ groups2 = (self.MGROUP2,)
+ self.send_igmp_leave(groups = groups1, src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4'],
+ iface = self.V_INF1, delay = 2)
+
+ dst_mac = '01:00:5e:01:02:03'
+ src_ip = '2.2.2.2'
+ if df is None:
+ df = defer.Deferred()
+ igmpState1 = IGMPTestState(groups = groups1, df = df)
+ igmpStateRecv1 = IGMPTestState(groups = groups1, df = df)
+ mcastTraffic1 = McastTraffic(groups1, iface= 'veth2', dst_mac = dst_mac,
+ src_ip = src_ip, cb = self.send_mcast_cb, arg = igmpState1)
+ mcastTraffic1.start()
+ join_state1 = IGMPTestState(groups = groups1)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ self.send_igmp_leave_listening_group_specific_query(groups = groups1,
+ src_list = ['2.2.2.2', '3.3.3.3', '4.4.4.4', '5.5.5.5', '7.7.7.7'],
+ iface = self.V_INF1, delay = 2)
+ target1= self.igmp_not_recv_task(self.V_INF1, groups1, join_state1)
+ assert target1 == 1, 'EXPECTED FAILURE'
+ log.info('Interface is not receiving from multicast groups %s' %groups1)
+ mcastTraffic1.stop()
+ self.onos_ctrl.deactivate()
+
+ @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+40)
+ def test_igmp_exclude_to_block_src_list_check_for_group_source_specific_query(self):
+ '''Verify join EXCLUDE (A) and Block(B) ,should receive group source specific membership query packet.'''
+ df = defer.Deferred()
+ def igmp_exclude_to_block_src_list_check_for_group_source_specific_query():
+ self.igmp_exclude_to_block_src_list_check_for_group_source_specific_query(df = df)
+ df.callback(0)
+ reactor.callLater(0, igmp_exclude_to_block_src_list_check_for_group_source_specific_query)
+ return df
+
+