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)
 
