Adding subscriber test to use sqlite database for subscriber info before running the join tests.
diff --git a/src/test/subscriber/subscriberDb.py b/src/test/subscriber/subscriberDb.py
new file mode 100644
index 0000000..d6b3f75
--- /dev/null
+++ b/src/test/subscriber/subscriberDb.py
@@ -0,0 +1,61 @@
+import sqlite3
+import sys
+
+class SubscriberDB:
+    def __init__(self, db = 'subscriber.db', create = False):
+        self.db = db
+        self.con = sqlite3.connect(db)
+        self.con.row_factory = sqlite3.Row
+        self.cur = self.con.cursor()
+        self.services = [ 'DHCP', 'IGMP' ]
+        self.create = create
+        if create == True:
+            self.cur.execute("DROP TABLE IF EXISTS Subscriber")
+            self.cur.execute("CREATE TABLE Subscriber(Id INTEGER PRIMARY KEY, Name TEXT, Service TEXT);")
+
+    def load(self, name, service):
+        self.cur.execute("INSERT INTO Subscriber(Name, Service) VALUES (?, ?);", (name, service))
+
+    def commit(self):
+        self.con.commit()
+
+    def generate(self, num = 100):
+        #create db if not created
+        if self.create is False:
+            self.cur.execute("DROP TABLE IF EXISTS Subscriber")
+            self.cur.execute("CREATE TABLE Subscriber(Id INTEGER PRIMARY KEY, Name TEXT, Service TEXT);")
+            self.create = True
+        service = ' '.join(self.services)
+        for i in xrange(num):
+            name = "sub%d" %self.lastrowid()
+            self.load(name, service)
+        self.commit()
+
+    def read(self, num = 1000000, debug = False):
+        self.cur.execute("SELECT * FROM Subscriber LIMIT ?;", (num,))
+        rows = self.cur.fetchall()
+        if debug is True:
+            for row in rows:
+                print('Id %d, Name %s, Service %s' %(row['Id'], row['Name'], row['Service']))
+        return rows
+
+    def lastrowid(self):
+        return 0 if self.cur.lastrowid == None else self.cur.lastrowid
+
+if __name__ == "__main__":
+    create = False
+    if len(sys.argv) > 1:
+        try:
+            num_subscribers = int(sys.argv[1])
+        except:
+            num_subscribers = 100
+        print('Creating %d subscriber records' %num_subscribers)
+        create = True
+    sub = SubscriberDB(create = create)
+    if create == True:
+        sub.generate(num_subscribers)
+    else:
+        num_subscribers = 10
+    subscribers = sub.read(num_subscribers)
+    for s in subscribers:
+        print('Name %s, Service %s' %(s['Name'], s['Service']))
diff --git a/src/test/subscriber/subscriberTest.py b/src/test/subscriber/subscriberTest.py
index abc4cc8..b4a26ab 100644
--- a/src/test/subscriber/subscriberTest.py
+++ b/src/test/subscriber/subscriberTest.py
@@ -13,6 +13,7 @@
 from DHCP import DHCPTest
 from EapTLS import TLSAuthTest
 from Channels import Channels
+from subscriberDb import SubscriberDB
 log.setLevel('INFO')
 
 class Subscriber(Channels):
@@ -21,17 +22,29 @@
       STATS_TX = 1
       STATS_JOIN = 2
       STATS_LEAVE = 3
-
-      def __init__(self, num = 1, iface = 'veth0', userId = 'sub1', iface_mcast = 'veth2', 
+      SUBSCRIBER_SERVICES = 'DHCP IGMP TLS'
+      def __init__(self, name = 'sub', service = SUBSCRIBER_SERVICES, num = 1, iface = 'veth0', iface_mcast = 'veth2', 
                    mcast_cb = None, loginType = 'wireless'):
             Channels.__init__(self, num, iface = iface, iface_mcast = iface_mcast, mcast_cb = mcast_cb)
-            self.userId = userId
+            self.name = name
+            self.service = service
+            self.service_map = {}
+            services = self.service.strip().split(' ')
+            for s in services:
+                  self.service_map[s] = True
             self.loginType = loginType
             ##start streaming channels
             self.join_map = {}
             ##accumulated join recv stats
             self.join_rx_stats = Stats()
 
+      def has_service(self, service):
+            if self.service_map.has_key(service):
+                  return self.service_map[service]
+            if self.service_map.has_key(service.upper()):
+                  return self.service_map[service.upper()]
+            return False
+
       def channel_join_update(self, chan, join_time):
             self.join_map[chan] = ( Stats(), Stats(), Stats(), Stats() )
             self.channel_update(chan, self.STATS_JOIN, 1, t = join_time)
@@ -118,6 +131,11 @@
                                                                        'radiusIp': '172.17.0.2' } } } }
             radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
             aaa_dict['apps']['org.onosproject.aaa']['AAA']['radiusIp'] = radius_ip
+            onos_ctrl = OnosCtrl('org.onosproject.aaa')
+            onos_ctrl.deactivate()
+            time.sleep(2)
+            onos_ctrl.activate()
+            time.sleep(2)
             self.onos_load_config('org.onosproject.aaa', aaa_dict)
 
       def onos_dhcp_table_load(self, config = None):
@@ -166,30 +184,46 @@
             log.info('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
             self.test_status = True
 
+      def subscriber_load(self, create = True, num = 10):
+            '''Load the subscriber from the database'''
+            self.subscriber_db = SubscriberDB(create = create)
+            if create is True:
+                  self.subscriber_db.generate(num)
+            self.subscriber_info = self.subscriber_db.read(num)
+            self.subscriber_list = []
+            for info in self.subscriber_info:
+                  self.subscriber_list.append(Subscriber(info['Name'], info['Service']))
+
       def test_subscriber_join_recv( self, chan = 0):
           """Test 1 subscriber join and receive""" 
           self.test_status = False
-          self.subscriber = Subscriber()
-          self.subscriber.start()
-          self.onos_aaa_load()
-
-          #tls = TLSAuthTest()
-          #tls.runTest()
-
-          ##Next get dhcp
-          cip, sip = self.dhcp_request(iface = self.subscriber.iface)
-          log.info('Got client ip %s from server %s' %(cip, sip))
-          self.subscriber.src_list = [cip]
-          for i in range(5):
-                log.info('Joining channel %d' %chan)
-                self.subscriber.channel_join(chan, delay = 0)
-                self.subscriber.channel_receive(chan, cb = self.recv_channel_cb, count = 1)
-                log.info('Leaving channel %d' %chan)
-                self.subscriber.channel_leave(chan)
-                time.sleep(3)
-
-          log.info('Join RX stats %s' %self.subscriber.join_rx_stats)
-          self.subscriber.stop()
+          self.num_subscribers = 2
+          self.subscriber_load(create = True, num = self.num_subscribers)
+          for subscriber in self.subscriber_list:
+                self.subscriber = subscriber
+                self.subscriber.start()
+                log.info('Testing subscriber %s for %s' %(subscriber.name, subscriber.service))
+                if self.subscriber.has_service('TLS'):
+                      self.onos_aaa_load()
+                      time.sleep(2)
+                      tls = TLSAuthTest()
+                      tls.runTest()
+                      self.test_status = True
+                if self.subscriber.has_service('DHCP'):
+                      cip, sip = self.dhcp_request(iface = self.subscriber.iface)
+                      log.info('Got client ip %s from server %s' %(cip, sip))
+                      self.subscriber.src_list = [cip]
+                      self.test_status = True
+                if self.subscriber.has_service('IGMP'):
+                      for i in range(5):
+                            log.info('Joining channel %d' %chan)
+                            self.subscriber.channel_join(chan, delay = 0)
+                            self.subscriber.channel_receive(chan, cb = self.recv_channel_cb, count = 1)
+                            log.info('Leaving channel %d' %chan)
+                            self.subscriber.channel_leave(chan)
+                            time.sleep(3)
+                      log.info('Join RX stats %s' %self.subscriber.join_rx_stats)
+                self.subscriber.stop()
           ##Terminate the tests on success
           assert_equal(self.test_status, True)
 
diff --git a/src/test/tls/tlsAuthTest.py b/src/test/tls/tlsAuthTest.py
index bc764af..c239f38 100644
--- a/src/test/tls/tlsAuthTest.py
+++ b/src/test/tls/tlsAuthTest.py
@@ -11,6 +11,8 @@
 
       def setUp(self):
             self.onos_ctrl = OnosCtrl(self.app)
+            self.onos_ctrl.deactivate()
+            time.sleep(2)
             self.onos_aaa_config()
 
       def onos_aaa_config(self):
@@ -18,8 +20,8 @@
                                                                    'radiusIp': '172.17.0.2' } } } }
             radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
             aaa_dict['apps']['org.onosproject.aaa']['AAA']['radiusIp'] = radius_ip
-            #self.onos_ctrl.activate()
-            #time.sleep(2)
+            self.onos_ctrl.activate()
+            time.sleep(2)
             self.onos_load_config(aaa_dict)
 
       def onos_load_config(self, config):
@@ -27,7 +29,7 @@
             if status is False:
                   log.info('Configure request for AAA returned status %d' %code)
                   assert_equal(status, True)
-            time.sleep(4)
+            time.sleep(3)
             
       def test_eap_tls(self):
           tls = TLSAuthTest()