diff --git a/api/src/main/java/org/opencord/olt/AccessDeviceService.java b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
index 8731d7c..361a30d 100644
--- a/api/src/main/java/org/opencord/olt/AccessDeviceService.java
+++ b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
@@ -20,9 +20,9 @@
 import org.onosproject.event.ListenerService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
-import org.opencord.cordconfig.access.AccessDeviceData;
 
 import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -35,9 +35,8 @@
      * Provisions connectivity for a subscriber on an access device.
      *
      * @param port subscriber's connection point
-     * @param vlan VLAN ID to provision for subscriber
      */
-    void provisionSubscriber(ConnectPoint port, VlanId vlan);
+    void provisionSubscriber(ConnectPoint port);
 
     /**
      * Removes provisioned connectivity for a subscriber from an access device.
@@ -54,10 +53,10 @@
     Collection<Map.Entry<ConnectPoint, VlanId>> getSubscribers();
 
     /**
-     * Returns the map of configured OLTs.
+     * Returns the list of active OLTs.
      *
-     * @return a map
+     * @return a List
      */
-    Map<DeviceId, AccessDeviceData> fetchOlts();
+    List<DeviceId> fetchOlts();
 
 }
diff --git a/app/app.xml b/app/app.xml
index 3d9b8fe..86dbff8 100644
--- a/app/app.xml
+++ b/app/app.xml
@@ -17,7 +17,7 @@
 <app name="org.opencord.olt" origin="ON.Lab" version="${project.version}"
      category="Traffic Steering" url="http://onosproject.org" title="Optical Line Terminal App"
      featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
-     features="${project.artifactId}" apps="org.opencord.config">
+     features="${project.artifactId}" apps="org.opencord.config,org.opencord.sadis">
     <description>${project.description}</description>
     <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
     <artifact>mvn:${project.groupId}/olt-api/${project.version}</artifact>
diff --git a/app/pom.xml b/app/pom.xml
index 4db6b3e..0c895fe 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -45,6 +45,7 @@
         <onos.app.readme>CORD OLT Access management application</onos.app.readme>
         <api.package>org.opencord.olt.rest</api.package>
         <olt.api.version>${project.version}</olt.api.version>
+        <sadis.api.version>2.1.0</sadis.api.version>
     </properties>
 
     <dependencies>
@@ -61,6 +62,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.opencord</groupId>
+            <artifactId>sadis-api</artifactId>
+	        <version>${sadis.api.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-cli</artifactId>
             <version>${onos.version}</version>
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
index 0d07683..a256ccd 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
@@ -16,44 +16,23 @@
 
 package org.opencord.olt.cli;
 
-import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.opencord.cordconfig.access.AccessDeviceData;
-import org.opencord.olt.AccessDeviceService;
 
-import java.util.Map;
+import org.opencord.olt.AccessDeviceService;
 
 /**
  * Shows configured OLTs.
  */
 @Command(scope = "onos", name = "olts",
-        description = "Shows configured OLTs")
+        description = "Shows OLTs connected to ONOS")
 public class ShowOltCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "deviceId", description = "Access device ID",
-            required = false, multiValued = false)
-    private String strDeviceId = null;
-
     @Override
     protected void execute() {
         AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
-        Map<DeviceId, AccessDeviceData> data = service.fetchOlts();
-        if (strDeviceId != null) {
-            DeviceId deviceId = DeviceId.deviceId(strDeviceId);
-            print("OLT %s:", deviceId);
-            display(data.get(deviceId));
-        } else {
-            data.keySet().forEach(did -> {
-                print("OLT %s:", did);
-                display(data.get(did));
-            });
-        }
-    }
-
-    private void display(AccessDeviceData accessDeviceData) {
-        print("\tvlan : %s", accessDeviceData.vlan());
-        print("\tuplink : %s", accessDeviceData.uplink());
+        service.fetchOlts().forEach(did -> {
+            print("OLT %s", did);
+        });
     }
 }
diff --git a/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java b/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java
index 3677188..d5fa0da 100644
--- a/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java
@@ -18,7 +18,6 @@
 
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
-import org.onlab.packet.VlanId;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
@@ -40,20 +39,14 @@
             required = true, multiValued = false)
     private String strPort = null;
 
-    @Argument(index = 2, name = "vlanId",
-            description = "VLAN ID to add",
-            required = true, multiValued = false)
-    private String strVlanId = null;
-
     @Override
     protected void execute() {
         AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
 
         DeviceId deviceId = DeviceId.deviceId(strDeviceId);
         PortNumber port = PortNumber.portNumber(strPort);
-        VlanId vlan = VlanId.vlanId(Short.parseShort(strVlanId));
         ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
 
-        service.provisionSubscriber(connectPoint, vlan);
+        service.provisionSubscriber(connectPoint);
     }
 }
diff --git a/app/src/main/java/org/opencord/olt/impl/Olt.java b/app/src/main/java/org/opencord/olt/impl/Olt.java
index 9717bad..a81ac75 100644
--- a/app/src/main/java/org/opencord/olt/impl/Olt.java
+++ b/app/src/main/java/org/opencord/olt/impl/Olt.java
@@ -15,7 +15,6 @@
  */
 package org.opencord.olt.impl;
 
-import com.google.common.collect.Maps;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -34,7 +33,9 @@
 import org.onosproject.core.CoreService;
 import org.onosproject.event.AbstractListenerManager;
 import org.onosproject.mastership.MastershipService;
+import org.onosproject.net.AnnotationKeys;
 import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Device;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.Port;
 import org.onosproject.net.PortNumber;
@@ -59,17 +60,17 @@
 import org.onosproject.net.flowobjective.Objective;
 import org.onosproject.net.flowobjective.ObjectiveContext;
 import org.onosproject.net.flowobjective.ObjectiveError;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
 import org.opencord.cordconfig.access.AccessDeviceConfig;
-import org.opencord.cordconfig.access.AccessDeviceData;
 import org.opencord.olt.AccessDeviceEvent;
 import org.opencord.olt.AccessDeviceListener;
 import org.opencord.olt.AccessDeviceService;
+import org.opencord.sadis.SubscriberAndDeviceInformation;
+import org.opencord.sadis.SubscriberAndDeviceInformationService;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 
+import java.util.AbstractMap;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Dictionary;
 import java.util.List;
@@ -77,7 +78,6 @@
 import java.util.Optional;
 import java.util.Properties;
 import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -98,7 +98,6 @@
     private static final String APP_NAME = "org.opencord.olt";
 
     private static final short DEFAULT_VLAN = 0;
-    private static final String SUBSCRIBERS = "existing-subscribers";
 
     private final Logger log = getLogger(getClass());
 
@@ -121,7 +120,7 @@
     protected ComponentConfigService componentConfigService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected StorageService storageService;
+    protected SubscriberAndDeviceInformationService subsService;
 
     @Property(name = "defaultVlan", intValue = DEFAULT_VLAN,
             label = "Default VLAN RG<->ONU traffic")
@@ -142,11 +141,6 @@
     private ExecutorService oltInstallers = Executors.newFixedThreadPool(4,
                                                                          groupedThreads("onos/olt-service",
                                                                                         "olt-installer-%d"));
-
-    private Map<DeviceId, AccessDeviceData> oltData = new ConcurrentHashMap<>();
-
-    private Map<ConnectPoint, VlanId> subscribers;
-
     private InternalNetworkConfigListener configListener =
             new InternalNetworkConfigListener();
     private static final Class<AccessDeviceConfig> CONFIG_CLASS =
@@ -173,26 +167,12 @@
         networkConfig.registerConfigFactory(configFactory);
         networkConfig.addListener(configListener);
 
-
-        networkConfig.getSubjects(DeviceId.class, AccessDeviceConfig.class).forEach(
-                subject -> {
-                    AccessDeviceConfig config = networkConfig.getConfig(subject, AccessDeviceConfig.class);
-                    if (config != null) {
-                        AccessDeviceData data = config.getOlt();
-                        oltData.put(data.deviceId(), data);
-                    }
-                }
-        );
-
-        oltData.keySet().stream()
-                .flatMap(did -> deviceService.getPorts(did).stream())
-                .filter(this::isUni)
-                .forEach(this::initializeUni);
-
-        subscribers = storageService.<ConnectPoint, VlanId>consistentMapBuilder()
-                .withName(SUBSCRIBERS)
-                .withSerializer(Serializer.using(KryoNamespaces.API))
-                .build().asJavaMap();
+        // look for all provisioned devices in Sadis and create EAPOL flows for the
+        // UNI ports
+        Iterable<Device> devices = deviceService.getDevices();
+        for (Device d : devices) {
+            checkAndCreateEapolFlows(d);
+        }
 
         deviceService.addListener(deviceListener);
 
@@ -233,65 +213,103 @@
     }
 
     @Override
-    public void provisionSubscriber(ConnectPoint port, VlanId vlan) {
+    public void provisionSubscriber(ConnectPoint port) {
         checkNotNull(deviceService.getPort(port.deviceId(), port.port()),
                 "Invalid connect point");
-        AccessDeviceData olt = oltData.get(port.deviceId());
+        // Find the subscriber on this connect point
+        SubscriberAndDeviceInformation sub = getSubscriber(port);
+        if (sub == null) {
+            log.warn("No subscriber found for {}", port);
+            return;
+        }
 
-        if (olt == null) {
-            log.warn("No data found for OLT device {}", port.deviceId());
-            throw new IllegalArgumentException("Missing OLT configuration for device");
+        // Get the uplink port
+        Port uplinkPort = getUplinkPort(deviceService.getDevice(port.deviceId()));
+        if (uplinkPort == null) {
+            log.warn("No uplink port found for OLT device {}", port.deviceId());
+            return;
         }
 
         if (enableDhcpOnProvisioning) {
-            processDhcpFilteringObjectives(olt.deviceId(), port.port(), true);
+            processDhcpFilteringObjectives(port.deviceId(), port.port(), true);
         }
 
-        provisionVlans(olt.deviceId(), olt.uplink(), port.port(), vlan, olt.vlan(),
-                olt.defaultVlan());
+        Optional<VlanId> defaultVlan = Optional.empty();
+        provisionVlans(port.deviceId(), uplinkPort.number(), port.port(), sub.cTag(), sub.sTag(),
+                defaultVlan);
 
         if (enableIgmpOnProvisioning) {
-            processIgmpFilteringObjectives(olt.deviceId(), port.port(), true);
+            processIgmpFilteringObjectives(port.deviceId(), port.port(), true);
         }
     }
 
     @Override
     public void removeSubscriber(ConnectPoint port) {
-        AccessDeviceData olt = oltData.get(port.deviceId());
-
-        if (olt == null) {
-            log.warn("No data found for OLT device {}", port.deviceId());
+        // Get the subscriber connected to this port from Sadis
+        SubscriberAndDeviceInformation subscriber = getSubscriber(port);
+        if (subscriber == null) {
+            log.warn("Subscriber on port {} not found", port);
             return;
         }
 
-        VlanId subscriberVlan = subscribers.remove(port);
-
-        if (subscriberVlan == null) {
-            log.warn("Unknown subscriber at location {}", port);
+        // Get the uplink port
+        Port uplinkPort = getUplinkPort(deviceService.getDevice(port.deviceId()));
+        if (uplinkPort == null) {
+            log.warn("No uplink port found for OLT device {}", port.deviceId());
             return;
         }
 
         if (enableDhcpOnProvisioning) {
-            processDhcpFilteringObjectives(olt.deviceId(), port.port(), false);
+            processDhcpFilteringObjectives(port.deviceId(), port.port(), false);
         }
 
-        unprovisionSubscriber(olt.deviceId(), olt.uplink(), port.port(), subscriberVlan,
-                              olt.vlan(), olt.defaultVlan());
+        Optional<VlanId> defaultVlan = Optional.empty();
+        unprovisionSubscriber(port.deviceId(), uplinkPort.number(), port.port(), subscriber.cTag(),
+                              subscriber.sTag(), defaultVlan);
 
         if (enableIgmpOnProvisioning) {
-            processIgmpFilteringObjectives(olt.deviceId(), port.port(), false);
+            processIgmpFilteringObjectives(port.deviceId(), port.port(), false);
         }
     }
 
 
     @Override
     public Collection<Map.Entry<ConnectPoint, VlanId>> getSubscribers() {
-        return subscribers.entrySet();
+        ArrayList<Map.Entry<ConnectPoint, VlanId>> subs = new ArrayList<>();
+
+        // Get the subscribers for all the devices
+        // If the port is UNI, is enabled and exists in Sadis then copy it
+        for (Device d : deviceService.getDevices()) {
+            for (Port p: deviceService.getPorts(d.id())) {
+                if (isUniPort(d, p) && p.isEnabled()) {
+                    ConnectPoint cp = new ConnectPoint(d.id(), p.number());
+
+                    SubscriberAndDeviceInformation sub = getSubscriber(cp);
+                    if (sub != null) {
+                        subs.add(new AbstractMap.SimpleEntry(cp, sub.cTag()));
+                    }
+                }
+            }
+        }
+
+        return subs;
     }
 
     @Override
-    public Map<DeviceId, AccessDeviceData> fetchOlts() {
-        return Maps.newHashMap(oltData);
+    public List<DeviceId> fetchOlts() {
+        // look through all the devices and find the ones that are OLTs as per Sadis
+        List<DeviceId> olts = new ArrayList<>();
+        Iterable<Device> devices = deviceService.getDevices();
+        for (Device d : devices) {
+            String devSerialNo = d.serialNumber();
+            SubscriberAndDeviceInformation deviceInfo = subsService.get(devSerialNo);
+
+            if (deviceInfo != null) {
+                // So this is indeed a OLT device
+                olts.add(d.id());
+            }
+        }
+        return olts;
     }
 
     private void initializeUni(Port port) {
@@ -379,9 +397,6 @@
                                                           subscriberVlan, deviceVlan,
                                                           defaultVlan);
 
-        ConnectPoint cp = new ConnectPoint(deviceId, subscriberPort);
-        subscribers.put(cp, subscriberVlan);
-
         flowObjectiveService.forward(deviceId, upFwd.add(new ObjectiveContext() {
             @Override
             public void onSuccess(Objective objective) {
@@ -578,17 +593,88 @@
         flowObjectiveService.filter(devId, igmp);
     }
 
-    private boolean isUni(Port port) {
-        return !oltData.get(port.element().id()).uplink().equals(port.number());
+    /**
+     * Creates EAPOL flows on the UNIs, if device is
+     * present in Sadis config.
+     *
+     * @param dev Device to look for
+     */
+    private void checkAndCreateEapolFlows(Device dev) {
+        // we create only for the ones we are master of
+        if (!mastershipService.isLocalMaster(dev.id())) {
+                return;
+        }
+        // check if this device is provisioned in Sadis
+        String devSerialNo = dev.serialNumber();
+        SubscriberAndDeviceInformation deviceInfo = subsService.get(devSerialNo);
+        log.debug("checkAndCreateEapolFlows: deviceInfo {}", deviceInfo);
+
+        if (deviceInfo != null) {
+            // This is an OLT device as per Sadis, we need to create EAPOL flows
+            // on all it's UNIs
+            for (Port p : deviceService.getPorts(dev.id())) {
+                if (isUniPort(dev, p)) {
+                    processFilteringObjectives(dev.id(), p.number(), true);
+                }
+            }
+        }
+    }
+
+    /**
+     * Get the uplink for of the OLT device.
+     *
+     * This assumes that the OLT has a single uplink port. When more uplink ports need to be supported
+     * this logic needs to be changed
+     *
+     * @param dev Device to look for
+     * @return The uplink Port of the OLT
+     */
+    private Port getUplinkPort(Device dev) {
+        // check if this device is provisioned in Sadis
+        String devSerialNo = dev.serialNumber();
+        SubscriberAndDeviceInformation deviceInfo = subsService.get(devSerialNo);
+        log.debug("getUplinkPort: deviceInfo {}", deviceInfo);
+
+        if (deviceInfo != null) {
+            // Return the port that has been configured as the uplink port of this OLT in Sadis
+            for (Port p: deviceService.getPorts(dev.id())) {
+                if (p.number().toLong() == deviceInfo.uplinkPort()) {
+                    log.debug("getUplinkPort: Found port {}", p);
+                    return p;
+                }
+            }
+        }
+
+        log.debug("getUplinkPort: No uplink port found for OLT {}", dev);
+        return null;
+    }
+
+    /**
+     * Return the subscriber on a port.
+     *
+     * @param port On which to find the subscriber
+     * @return subscriber if found else null
+     */
+    private SubscriberAndDeviceInformation getSubscriber(ConnectPoint port) {
+        String portName = deviceService.getPort(port).annotations()
+                .value(AnnotationKeys.PORT_NAME);
+
+        return subsService.get(portName);
+    }
+
+    private boolean isUniPort(Device d, Port p) {
+        Port ulPort = getUplinkPort(d);
+        if (ulPort != null) {
+            return (ulPort.number().toLong() != p.number().toLong());
+        }
+        return false;
     }
 
     private class InternalDeviceListener implements DeviceListener {
         @Override
         public void event(DeviceEvent event) {
             DeviceId devId = event.subject().id();
-            if (!oltData.containsKey(devId)) {
-                return;
-            }
+            Device dev = event.subject();
             if (event.type() != DeviceEvent.Type.PORT_STATS_UPDATED) {
                 log.debug("Olt got {} event for {}", event.type(), event.subject());
             }
@@ -596,7 +682,7 @@
                 //TODO: Port handling and bookkeeping should be improved once
                 // olt firmware handles correct behaviour.
                 case PORT_ADDED:
-                    if (!oltData.get(devId).uplink().equals(event.port().number())) {
+                    if (isUniPort(dev, event.port())) {
                         post(new AccessDeviceEvent(AccessDeviceEvent.Type.UNI_ADDED, devId, event.port()));
 
                         if (event.port().isEnabled()) {
@@ -605,15 +691,25 @@
                     }
                     break;
                 case PORT_REMOVED:
-                    AccessDeviceData olt = oltData.get(devId);
-                    VlanId vlan = subscribers.get(new ConnectPoint(devId,
-                                                                   event.port().number()));
-                    if (vlan != null) {
-                        unprovisionSubscriber(devId, olt.uplink(),
-                                event.port().number(),
-                                vlan, olt.vlan(), olt.defaultVlan());
+                    String portName = event.port().annotations().value(AnnotationKeys.PORT_NAME);
+                    SubscriberAndDeviceInformation subscriber = subsService.get(portName);
+                    if (subscriber == null) {
+                        log.warn("Subscriber {} not found", portName);
+                        break;
                     }
-                    if (!oltData.get(devId).uplink().equals(event.port().number())) {
+
+                    Port uplinkPort = getUplinkPort(dev);
+                    if (uplinkPort == null) {
+                        log.warn("No uplink port found for device {}", dev);
+                        break;
+                    }
+
+                    Optional<VlanId> defaultVlan = Optional.empty();
+                    unprovisionSubscriber(devId, uplinkPort.number(),
+                            event.port().number(),
+                            subscriber.cTag(), subscriber.sTag(), defaultVlan);
+
+                    if (isUniPort(dev, event.port())) {
                         if (event.port().isEnabled()) {
                             processFilteringObjectives(devId, event.port().number(), false);
                         }
@@ -623,9 +719,10 @@
 
                     break;
                 case PORT_UPDATED:
-                    if (oltData.get(devId).uplink().equals(event.port().number())) {
+                    if (!isUniPort(dev, event.port())) {
                         break;
                     }
+
                     if (event.port().isEnabled()) {
                         processFilteringObjectives(devId, event.port().number(), true);
                         post(new AccessDeviceEvent(AccessDeviceEvent.Type.UNI_ADDED, devId, event.port()));
@@ -640,16 +737,16 @@
 
                     // Send UNI_ADDED events for all existing ports
                     deviceService.getPorts(devId).stream()
-                            .filter(Olt.this::isUni)
+                            .filter(p -> isUniPort(dev, p))
                             .filter(Port::isEnabled)
                             .forEach(p -> post(new AccessDeviceEvent(
                                     AccessDeviceEvent.Type.UNI_ADDED, devId, p)));
 
-                    provisionDefaultFlows(devId);
+                    checkAndCreateEapolFlows(dev);
                     break;
                 case DEVICE_REMOVED:
                     deviceService.getPorts(devId).stream()
-                            .filter(Olt.this::isUni)
+                            .filter(p -> isUniPort(dev, p))
                             .forEach(p -> post(new AccessDeviceEvent(
                                     AccessDeviceEvent.Type.UNI_REMOVED, devId, p)));
 
@@ -685,19 +782,11 @@
                 case CONFIG_ADDED:
                 case CONFIG_UPDATED:
 
-                    AccessDeviceConfig config =
-                            networkConfig.getConfig((DeviceId) event.subject(), CONFIG_CLASS);
-                    if (config != null) {
-                        oltData.put(config.getOlt().deviceId(), config.getOlt());
-                        provisionDefaultFlows((DeviceId) event.subject());
-                    }
-
                     break;
                 case CONFIG_REGISTERED:
                 case CONFIG_UNREGISTERED:
                     break;
                 case CONFIG_REMOVED:
-                    oltData.remove(event.subject());
                 default:
                     break;
             }
@@ -708,19 +797,4 @@
             return event.configClass().equals(CONFIG_CLASS);
         }
     }
-
-    private void provisionDefaultFlows(DeviceId deviceId) {
-        if (!mastershipService.isLocalMaster(deviceId)) {
-            return;
-        }
-        List<Port> ports = deviceService.getPorts(deviceId);
-
-        ports.stream()
-                .filter(p -> !oltData.get(p.element().id()).uplink().equals(p.number()))
-                .filter(p -> p.isEnabled())
-                .forEach(p -> processFilteringObjectives((DeviceId) p.element().id(),
-                                                         p.number(), true));
-
-    }
-
 }
diff --git a/app/src/main/java/org/opencord/olt/rest/OltWebResource.java b/app/src/main/java/org/opencord/olt/rest/OltWebResource.java
index c11c1bd..cc75b27 100644
--- a/app/src/main/java/org/opencord/olt/rest/OltWebResource.java
+++ b/app/src/main/java/org/opencord/olt/rest/OltWebResource.java
@@ -15,6 +15,12 @@
  */
 package org.opencord.olt.rest;
 
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.olt.AccessDeviceService;
+
 import javax.ws.rs.DELETE;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
@@ -23,13 +29,6 @@
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.opencord.olt.AccessDeviceService;
-import org.onosproject.rest.AbstractWebResource;
-
 /**
  * OLT REST APIs.
  */
@@ -42,22 +41,19 @@
      *
      * @param device device id
      * @param port port number
-     * @param vlan vlan id
      * @return 200 OK
      */
     @POST
     @Produces(MediaType.APPLICATION_JSON)
-    @Path("{device}/{port}/{vlan}")
+    @Path("{device}/{port}")
     public Response provisionSubscriber(
             @PathParam("device")String device,
-            @PathParam("port")long port,
-            @PathParam("vlan")short vlan) {
+            @PathParam("port")long port) {
         AccessDeviceService service = get(AccessDeviceService.class);
         DeviceId deviceId = DeviceId.deviceId(device);
         PortNumber portNumber = PortNumber.portNumber(port);
-        VlanId vlanId = VlanId.vlanId(vlan);
         ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber);
-        service.provisionSubscriber(connectPoint, vlanId);
+        service.provisionSubscriber(connectPoint);
         return ok("").build();
     }
 
