@Override
    public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher) {
        checkNotNull(src, ELEMENT_ID_NULL);
        checkNotNull(dst, ELEMENT_ID_NULL);

        LinkWeigher internalWeigher = weigher != null ? weigher : DEFAULT_WEIGHER;

        // Get the source and destination edge locations
        EdgeLink srcEdge = getEdgeLink(src, true);
        EdgeLink dstEdge = getEdgeLink(dst, false);

        // If either edge is null, bail with no paths.
        if (srcEdge == null || dstEdge == null) {
            return ImmutableSet.of();
        }

        DeviceId srcDevice = srcEdge != NOT_HOST ? srcEdge.dst().deviceId() : (DeviceId) src;
        DeviceId dstDevice = dstEdge != NOT_HOST ? dstEdge.src().deviceId() : (DeviceId) dst;

        // If the source and destination are on the same edge device, there
        // is just one path, so build it and return it.
        if (srcDevice.equals(dstDevice)) {
            return edgeToEdgePaths(srcEdge, dstEdge, internalWeigher);
        }

        // Otherwise get all paths between the source and destination edge
        // devices.
        Topology topology = topologyService.currentTopology();
        Set<Path> paths = topologyService.getPaths(topology, srcDevice,
                dstDevice, internalWeigher);

        return edgeToEdgePaths(srcEdge, dstEdge, paths, internalWeigher);
    }
@Test
    public void testSelfPaths() {
        HostId host = hid("12:34:56:78:90:ab/1");
        Set<Path> paths = service.getPaths(host, host, new TestWeigher());
        assertThat(paths, hasSize(1));
        Path path = paths.iterator().next();
        assertThat(path, not(nullValue()));
        assertThat(path.links(), hasSize(2));
        Link link1 = path.links().get(0);
        Link link2 = path.links().get(1);
        assertThat(link1.src(), is(link2.dst()));
        assertThat(link2.src(), is(link1.dst()));
        assertThat(link1.src().hostId(), is(host));
        assertThat(link2.dst().hostId(), is(host));
    }