Merge pull request #19 from cgaonker/master

Adding more DHCP test cases and adding TLS to Subscriber.
diff --git a/src/test/dhcp/dhcpTest.py b/src/test/dhcp/dhcpTest.py
index 5bab4db..430b123 100644
--- a/src/test/dhcp/dhcpTest.py
+++ b/src/test/dhcp/dhcpTest.py
@@ -536,3 +536,34 @@
 
 			log.info("Got DHCP NAK.Lease not Renewed.")
 
+
+    def test_dhcp_client_expected_subnet_mask(self, iface = 'veth0'):
+	
+	config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', 
+                 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
+                 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
+        self.onos_dhcp_table_load(config)
+        self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
+	expected_subnet = '255.255.255.0'
+	self.dhcp.return_subnet = True
+	
+	cip, sip, mac, subnet_value = self.dhcp.only_discover()
+	log.info('Got dhcp client IP %s from server %s for mac %s .' %  
+		  (cip, sip, mac) )
+
+	log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
+	if (cip == None and mac != None):
+		log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
+		assert_not_equal(cip, None) 
+	
+	elif cip and sip and mac:
+		
+		if expected_subnet == subnet_value:
+			log.info("Got same subnet as passed in DHCP server configuration.")
+	
+		elif expected_subnet != subnet_value:
+			log.info("Not got same subnet as passed in DHCP server configuration.")
+			assert_equal(expected_subnet, subnet_value)
+
+
+
diff --git a/src/test/igmp/igmpTest.py b/src/test/igmp/igmpTest.py
index d8281d2..011d562 100644
--- a/src/test/igmp/igmpTest.py
+++ b/src/test/igmp/igmpTest.py
@@ -682,7 +682,7 @@
         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)
+        log.info('Interface is still receiving from old multicast group data %s even after we send block list' %groups1)
         mcastTraffic1.stop()
         
     @deferred(timeout=MCAST_TRAFFIC_TIMEOUT+30)
diff --git a/src/test/subscriber/subscriberDb.py b/src/test/subscriber/subscriberDb.py
index 6cbd984..9f689e4 100644
--- a/src/test/subscriber/subscriberDb.py
+++ b/src/test/subscriber/subscriberDb.py
@@ -22,7 +22,7 @@
         self.con = sqlite3.connect(db)
         self.con.row_factory = sqlite3.Row
         self.cur = self.con.cursor()
-        self.services = [ 'DHCP', 'IGMP' ]
+        self.services = [ 'TLS', 'DHCP', 'IGMP' ]
         self.create = create
         if create == True:
             self.cur.execute("DROP TABLE IF EXISTS Subscriber")
diff --git a/src/test/subscriber/subscriberTest.py b/src/test/subscriber/subscriberTest.py
index 45c86fc..220b73c 100644
--- a/src/test/subscriber/subscriberTest.py
+++ b/src/test/subscriber/subscriberTest.py
@@ -389,7 +389,7 @@
 
       def test_subscriber_join_recv(self):
           """Test subscriber join and receive"""
-          num_subscribers = 50
+          num_subscribers = 10
           num_channels = 1
           test_status = self.subscriber_join_verify(num_subscribers = num_subscribers, 
                                                     num_channels = num_channels,
diff --git a/src/test/utils/DHCP.py b/src/test/utils/DHCP.py
index 8a36efd..c940aa3 100644
--- a/src/test/utils/DHCP.py
+++ b/src/test/utils/DHCP.py
@@ -30,7 +30,8 @@
 	self.dhcpresp = None
 	self.servermac = None
 	self.after_T2 = False
-	
+	self.return_lease = False
+	self.return_subnet = False
 
     def is_mcast(self, ip):
         mcast_octet = (atol(ip) >> 24) & 0xff
@@ -122,6 +123,21 @@
            			print "In Attribute error."
             		 	print("Failed to acquire IP via DHCP for %s on interface %s" %(mac, self.iface))
             		 	return (None, None, None)
+			if self.return_lease or self.return_subnet:
+				for x in resp.lastlayer().options:
+        	    			if(x == 'end'):
+                				break
+	            			op,val = x
+		
+	        	    		if op == "lease_time":
+						if self.return_lease:
+							return (srcIP, serverIP, mac, val)
+
+	        	    		elif op == "subnet_mask":
+						log.info("Got Field Subnet mask.")
+						if self.return_subnet:
+							log.info("Subnet Mask Returned.")
+							return (srcIP, serverIP, mac, val)		
 
 				
 			return (srcIP, serverIP, mac)