diff --git a/src/main/java/net/floodlightcontroller/devicemanager/IDevice.java b/src/main/java/net/floodlightcontroller/devicemanager/IDevice.java
index dd54638212c9fdc8dcb746375a7cb936ecf1f25c..95969f8c859299fabd53d5a0d917db3ff90230fe 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/IDevice.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/IDevice.java
@@ -73,6 +73,14 @@ public interface IDevice {
      * @return an array containing all unique attachment points for the device
      */
     public SwitchPort[] getAttachmentPoints(boolean includeError);
+
+    /**
+     * Returns all unique VLAN IDs for the device that were observed on 
+     * the given switch port
+     * @param swp the switch port to query
+     * @return an array containing the unique VLAN IDs
+     */
+    public Short[] getSwitchPortVlanIds(SwitchPort swp);
     
     /**
      * Get the most recent timestamp for this device
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
index dc7c0da7bf897cccbfc6e09a21762a3fddc25358..333777e731ac505dae9f31b3d886dce9de017cca 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
@@ -33,6 +33,7 @@ import net.floodlightcontroller.devicemanager.IDevice;
 import net.floodlightcontroller.devicemanager.IEntityClass;
 import net.floodlightcontroller.devicemanager.SwitchPort;
 import static net.floodlightcontroller.devicemanager.SwitchPort.ErrorStatus.*;
+import net.floodlightcontroller.packet.Ethernet;
 import net.floodlightcontroller.topology.ITopologyService;
 
 /**
@@ -342,6 +343,21 @@ public class Device implements IDevice {
 
         return vals.toArray(new SwitchPort[vals.size()]);
     }
+    
+    @Override
+    public Short[] getSwitchPortVlanIds(SwitchPort swp) {
+        TreeSet<Short> vals = new TreeSet<Short>();
+        for (Entity e : entities) {
+            if (e.switchDPID == swp.getSwitchDPID() 
+                    && e.switchPort == swp.getPort()) {
+                if (e.getVlan() == null)
+                    vals.add(Ethernet.VLAN_UNTAGGED);
+                else
+                    vals.add(e.getVlan());
+            }
+        }
+        return vals.toArray(new Short[vals.size()]);
+    }
 
     @Override
     public Date getLastSeen() {
diff --git a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
index f0bc0cdbde2db152c04be08504a4019ebeea6001..2d86734d465e6d436e55b8a1f049faa02522fd6b 100644
--- a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
+++ b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
@@ -1380,4 +1380,30 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
         Arrays.sort(ips);
         assertArrayEquals(new Integer[] { 2, 42, 4242 }, ips);
     }
+    
+    // TODO: this test should really go into a separate class that collects
+    // unit tests for Device
+    @Test
+    public void testGetSwitchPortVlanId() {
+            Entity entity1 = new Entity(1L, (short)1, null, 10L, 1, new Date());
+            Entity entity2 = new Entity(1L, null, null, 10L, 1, new Date());
+            Entity entity3 = new Entity(1L, (short)3, null,  1L, 1, new Date());
+            Entity entity4 = new Entity(1L, (short)42, null,  1L, 1, new Date());
+            Entity[] entities = new Entity[] { entity1, entity2, 
+                                               entity3, entity4
+                                             };
+            Device d = new Device(null,1L, Arrays.asList(entities), null);
+            SwitchPort swp1x1 = new SwitchPort(1L, 1);
+            SwitchPort swp1x2 = new SwitchPort(1L, 2);
+            SwitchPort swp2x1 = new SwitchPort(2L, 1);
+            SwitchPort swp10x1 = new SwitchPort(10L, 1);
+            assertArrayEquals(new Short[] { -1, 1}, 
+                              d.getSwitchPortVlanIds(swp10x1));
+            assertArrayEquals(new Short[] { 3, 42}, 
+                              d.getSwitchPortVlanIds(swp1x1));
+            assertArrayEquals(new Short[0],
+                              d.getSwitchPortVlanIds(swp1x2));
+            assertArrayEquals(new Short[0],
+                              d.getSwitchPortVlanIds(swp2x1));
+    }
 }