Search in sources :

Example 1 with LinkService

use of org.onosproject.net.link.LinkService in project onos by opennetworkinglab.

the class TsCheckLoop method doExecute.

@Override
protected void doExecute() {
    NetworkDiagnosticService service = getService(NetworkDiagnosticService.class);
    DeviceService ds = getService(DeviceService.class);
    HostService hs = getService(HostService.class);
    FlowRuleService frs = getService(FlowRuleService.class);
    LinkService ls = getService(LinkService.class);
    service.findAnomalies(NetworkDiagnostic.Type.LOOP).forEach(loop -> print(loop.toString()));
}
Also used : HostService(org.onosproject.net.host.HostService) DeviceService(org.onosproject.net.device.DeviceService) FlowRuleService(org.onosproject.net.flow.FlowRuleService) LinkService(org.onosproject.net.link.LinkService) NetworkDiagnosticService(org.onosproject.fnl.intf.NetworkDiagnosticService)

Example 2 with LinkService

use of org.onosproject.net.link.LinkService in project onos by opennetworkinglab.

the class OFSwitchManager method neighbour.

@Override
public ConnectPoint neighbour(NetworkId networkId, DeviceId deviceId, PortNumber portNumber) {
    ConnectPoint cp = new ConnectPoint(deviceId, portNumber);
    LinkService linkService = virtualNetService.get(networkId, LinkService.class);
    Set<Link> links = linkService.getEgressLinks(cp);
    log.trace("neighbour cp {} egressLinks {}", cp, links);
    if (links != null && links.size() > 0) {
        Link link = links.iterator().next();
        return link.src();
    }
    return null;
}
Also used : ConnectPoint(org.onosproject.net.ConnectPoint) LinkService(org.onosproject.net.link.LinkService) Link(org.onosproject.net.Link)

Example 3 with LinkService

use of org.onosproject.net.link.LinkService in project onos by opennetworkinglab.

the class VirtualNetworkLinkManagerTest method testGetLinkByNullDst.

/**
 * Tests the getLink() method using a null dst connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetLinkByNullDst() {
    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));
    ConnectPoint dst = new ConnectPoint(dstVirtualDevice.id(), PortNumber.portNumber(2));
    manager.createVirtualLink(virtualNetwork.id(), src, dst);
    manager.createVirtualLink(virtualNetwork.id(), dst, src);
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);
    // test the getLink() method with a null dst connect point.
    linkService.getLink(src, null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) ConnectPoint(org.onosproject.net.ConnectPoint) LinkService(org.onosproject.net.link.LinkService) Test(org.junit.Test)

Example 4 with LinkService

use of org.onosproject.net.link.LinkService in project onos by opennetworkinglab.

the class VirtualNetworkLinkManagerTest method testGetIngressLinksByNullId.

/**
 * Tests querying for ingress links using a null connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetIngressLinksByNullId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);
    // test the getIngressLinks() method with a null connect point.
    linkService.getIngressLinks(null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) LinkService(org.onosproject.net.link.LinkService) Test(org.junit.Test)

Example 5 with LinkService

use of org.onosproject.net.link.LinkService in project onos by opennetworkinglab.

the class VirtualNetworkLinkManagerTest method testGetLinkByNullSrc.

/**
 * Tests the getLink() method using a null src connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetLinkByNullSrc() {
    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));
    ConnectPoint dst = new ConnectPoint(dstVirtualDevice.id(), PortNumber.portNumber(2));
    manager.createVirtualLink(virtualNetwork.id(), src, dst);
    manager.createVirtualLink(virtualNetwork.id(), dst, src);
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);
    // test the getLink() method with a null src connect point.
    linkService.getLink(null, dst);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) ConnectPoint(org.onosproject.net.ConnectPoint) LinkService(org.onosproject.net.link.LinkService) Test(org.junit.Test)

Aggregations

LinkService (org.onosproject.net.link.LinkService)21 ConnectPoint (org.onosproject.net.ConnectPoint)11 Test (org.junit.Test)9 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)9 Link (org.onosproject.net.Link)8 DeviceService (org.onosproject.net.device.DeviceService)5 Collections (java.util.Collections)3 Collectors (java.util.stream.Collectors)3 VirtualDevice (org.onosproject.incubator.net.virtual.VirtualDevice)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2 StringsCompleter (org.apache.karaf.shell.support.completers.StringsCompleter)2 ConnectPoint.deviceConnectPoint (org.onosproject.net.ConnectPoint.deviceConnectPoint)2 DeviceId (org.onosproject.net.DeviceId)2 FlowRuleService (org.onosproject.net.flow.FlowRuleService)2 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)2