diff --git a/classes/obmc-phosphor-discovery-service.bbclass b/classes/obmc-phosphor-discovery-service.bbclass
index 8dc6fdc..9b66e7e 100644
--- a/classes/obmc-phosphor-discovery-service.bbclass
+++ b/classes/obmc-phosphor-discovery-service.bbclass
@@ -4,17 +4,25 @@
 python() {
     avahi_enabled = bb.utils.contains(
             'DISTRO_FEATURES', 'avahi', 'true', 'false', d)
-    slp_enabled = False # later
+    slp_enabled = bb.utils.contains(
+            'DISTRO_FEATURES', 'slp', 'true', 'false', d)
+
 
     if not avahi_enabled and slp_enabled:
         return
 
     syscnfdir = d.getVar('sysconfdir', True)
     dest_dir = d.getVar('D', True)
+
     set_append(d, 'AVAHI_SERVICES_DIR', os.path.join(
         dest_dir+syscnfdir,
         'avahi',
         'services'))
+    set_append(d, 'SLP_SERVICES_DIR', os.path.join(
+        dest_dir+syscnfdir,
+        'slp',
+        'services'))
+
 
     for pkg in listvar_to_list(d, 'DISCOVERY_SVC_PACKAGES'):
         for service in listvar_to_list(d, 'REGISTERED_SERVICES_%s' % pkg):
@@ -26,24 +34,39 @@
                     'avahi',
                     'services',
                     '%s.service' % svc_name))
+
+            if slp_enabled:
+                set_append(d, 'RRECOMMENDS_%s' % pkg, 'slpd-lite')
+                svc_name, svc_type, svc_port = service.split(':')
+                set_append(d, 'FILES_%s' % pkg, os.path.join(
+                    syscnfdir,
+                    'slp',
+                    'services',
+                    '%s.service' % svc_name))
+
 }
 
 python discovery_services_postinstall() {
     avahi_enabled = bb.utils.contains(
             'DISTRO_FEATURES', 'avahi', 'true', 'false', d)
-    slp_enabled = False # later
+    slp_enabled = bb.utils.contains(
+            'DISTRO_FEATURES', 'slp', 'true', 'false', d)
 
     if not avahi_enabled and slp_enabled:
         return
 
-    service_dir = d.getVar('AVAHI_SERVICES_DIR', True)
+    avahi_service_dir = d.getVar('AVAHI_SERVICES_DIR', True)
+    slp_service_dir = d.getVar('SLP_SERVICES_DIR', True)
 
-    if not os.path.exists(service_dir):
-        os.makedirs(service_dir)
+    if not os.path.exists(avahi_service_dir):
+        os.makedirs(avahi_service_dir)
+
+    if not os.path.exists(slp_service_dir):
+        os.makedirs(slp_service_dir)
 
     def register_service_avahi(d, service_name, service_type, service_port):
         service_file = os.path.join(
-            service_dir,
+            avahi_service_dir,
             '%s.service' % service_name)
         with open(service_file, 'w') as fd:
             fd.write('<?xml version="1.0" ?>\n')
@@ -56,21 +79,29 @@
             fd.write('        </service>\n')
             fd.write('</service-group>\n')
 
+
+    def register_service_slp(d, service_name, service_type, service_port):
+        service_file = os.path.join(
+            slp_service_dir,
+            '%s.service' % service_name)
+        with open(service_file, 'w') as fd:
+            fd.write('%s %s %s' % (service_name, service_type, service_port))
+
     def register_services(d,pkg):
         for service in listvar_to_list(d, 'REGISTERED_SERVICES_%s' % pkg):
             svc_info = service.split(":")
             try:
                 svc_name, svc_type, svc_port = svc_info
-                svc_type = "_" + svc_name + "._" + svc_type
             except:
                 continue
             if avahi_enabled:
-                register_service_avahi(d, svc_name, svc_type, svc_port)
+                avahi_svc_type = "_" + svc_name + "._" + svc_type
+                register_service_avahi(d, svc_name, avahi_svc_type, svc_port)
+            if slp_enabled:
+                register_service_slp(d, svc_name, svc_type, svc_port)
 
     for pkg in listvar_to_list(d, 'DISCOVERY_SVC_PACKAGES'):
         register_services(d, pkg)
 
 }
 do_install[postfuncs] += "discovery_services_postinstall"
-
-
