@Override
    public Iterable<Link> getLinks() {
        return manager.getVirtualLinks(this.networkId())
                .stream().collect(Collectors.toSet());
    }
@Test
    public void testGetLinks() {

        manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
        VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
        VirtualDevice srcVirtualDevice =
                manager.createVirtualDevice(virtualNetwork.id(), DID1);
        VirtualDevice dstVirtualDevice =
                manager.createVirtualDevice(virtualNetwork.id(), DID2);
        ConnectPoint src = new ConnectPoint(srcVirtualDevice.id(), PortNumber.portNumber(1));
        manager.createVirtualPort(virtualNetwork.id(), src.deviceId(), src.port(),
                                  new ConnectPoint(srcVirtualDevice.id(), src.port()));

        ConnectPoint dst = new ConnectPoint(dstVirtualDevice.id(), PortNumber.portNumber(2));
        manager.createVirtualPort(virtualNetwork.id(), dst.deviceId(), dst.port(),
                                  new ConnectPoint(dstVirtualDevice.id(), dst.port()));

        VirtualLink link1 = manager.createVirtualLink(virtualNetwork.id(), src, dst);
        VirtualLink link2 = manager.createVirtualLink(virtualNetwork.id(), dst, src);

        LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);

        // test the getLinks() method
        Iterator<Link> it = linkService.getLinks().iterator();
        assertEquals("The link set size did not match.", 2, Iterators.size(it));

        // test the getActiveLinks() method where all links are INACTIVE
        Iterator<Link> it2 = linkService.getActiveLinks().iterator();
        assertEquals("The link set size did not match.", 0, Iterators.size(it2));

        // test the getActiveLinks() method where one link is ACTIVE
        virtualNetworkManagerStore.updateLink(link1, link1.tunnelId(), Link.State.ACTIVE);
        Iterator<Link> it3 = linkService.getActiveLinks().iterator();
        assertEquals("The link set size did not match.", 1, Iterators.size(it3));

        // test the getLinkCount() method
        assertEquals("The link set size did not match.", 2, linkService.getLinkCount());

        // test the getLink() method
        assertEquals("The expect link did not match.", link1,
                     linkService.getLink(src, dst));
        assertEquals("The expect link did not match.", link2,
                     linkService.getLink(dst, src));
        assertNotEquals("The expect link should not have matched.", link1,
                        linkService.getLink(dst, src));

        // test the getLinks(ConnectPoint) method
        assertEquals("The link set size did not match.", 2, linkService.getLinks(src).size());
        assertEquals("The link set size did not match.", 2, linkService.getLinks(dst).size());
        ConnectPoint connectPoint = new ConnectPoint(dstVirtualDevice.id(), PortNumber.portNumber(3));
        assertEquals("The link set size did not match.", 0, linkService.getLinks(connectPoint).size());

        // test the getDeviceLinks() method
        assertEquals("The link set size did not match.", 2,
                     linkService.getDeviceLinks(DID1).size());
        assertEquals("The link set size did not match.", 2,
                     linkService.getDeviceLinks(DID2).size());
        assertEquals("The link set size did not match.", 0,
                     linkService.getDeviceLinks(DID3).size());

        // test the getDeviceEgressLinks() method
        assertEquals("The link set size did not match.", 1,
                     linkService.getDeviceEgressLinks(DID1).size());
        assertEquals("The link set size did not match.", 1,
                     linkService.getDeviceEgressLinks(DID2).size());
        assertEquals("The link set size did not match.", 0,
                     linkService.getDeviceEgressLinks(DID3).size());

        // test the getDeviceIngressLinks() method
        assertEquals("The link set size did not match.", 1,
                     linkService.getDeviceIngressLinks(DID1).size());
        assertEquals("The link set size did not match.", 1,
                     linkService.getDeviceIngressLinks(DID2).size());
        assertEquals("The link set size did not match.", 0,
                     linkService.getDeviceIngressLinks(DID3).size());

        // test the getEgressLinks() method
        assertEquals("The link set size did not match.", 1,
                     linkService.getEgressLinks(src).size());
        assertEquals("The link set size did not match.", 1,
                     linkService.getEgressLinks(dst).size());
        assertEquals("The link set size did not match.", 0,
                     linkService.getEgressLinks(connectPoint).size());

        // test the getIngressLinks() method
        assertEquals("The link set size did not match.", 1,
                     linkService.getIngressLinks(src).size());
        assertEquals("The link set size did not match.", 1,
                     linkService.getIngressLinks(dst).size());
        assertEquals("The link set size did not match.", 0,
                     linkService.getIngressLinks(connectPoint).size());
    }