org.onosproject.net.link.LinkService Java Examples

The following examples show how to use org.onosproject.net.link.LinkService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Topo2Jsonifier.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an instance with a reference to the services directory, so that
 * additional information about network elements may be looked up on
 * on the fly.
 *
 * @param directory service directory
 * @param userName  logged in user name
 */
public Topo2Jsonifier(ServiceDirectory directory, String userName) {
    this.directory = checkNotNull(directory, "Directory cannot be null");
    this.userName = checkNotNull(userName, "User name cannot be null");

    clusterService = directory.get(ClusterService.class);
    deviceService = directory.get(DeviceService.class);
    linkService = directory.get(LinkService.class);
    hostService = directory.get(HostService.class);
    mastershipService = directory.get(MastershipService.class);
    intentService = directory.get(IntentService.class);
    flowService = directory.get(FlowRuleService.class);
    flowStatsService = directory.get(StatisticService.class);
    portStatsService = directory.get(PortStatisticsService.class);
    topologyService = directory.get(TopologyService.class);
    uiextService = directory.get(UiExtensionService.class);
    prefService = directory.get(UiPreferencesService.class);
}
 
Example #2
Source File: LinkSrcCompleter.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
    // Delegate string completer
    StringsCompleter delegate = new StringsCompleter();

    // Fetch our service and feed it's offerings to the string completer
    LinkService service = AbstractShellCommand.get(LinkService.class);

    // Generate the device ID/port number identifiers
    SortedSet<String> strings = delegate.getStrings();
    service.getLinks()
            .forEach(link -> strings.add(link.src().elementId().toString() +
                                                 "/" + link.src().port()));

    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(session, commandLine, candidates);
}
 
Example #3
Source File: LinkDstCompleter.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
    // Delegate string completer
    StringsCompleter delegate = new StringsCompleter();

    // Fetch our service and feed it's offerings to the string completer
    LinkService service = AbstractShellCommand.get(LinkService.class);

    // Link source the previous argument.
    String srcArg = commandLine.getArguments()[commandLine.getCursorArgumentIndex() - 1];

    // Generate the device ID/port number identifiers
    SortedSet<String> strings = delegate.getStrings();
    try {
        ConnectPoint src = ConnectPoint.deviceConnectPoint(srcArg);
        service.getEgressLinks(src)
                .forEach(link -> strings.add(link.dst().elementId().toString() +
                                                     "/" + link.dst().port()));
    } catch (NumberFormatException e) {
        System.err.println("Invalid connect-point");
    }

    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(session, commandLine, candidates);
}
 
Example #4
Source File: AnnotateLinkCommand.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
protected void doExecute() {
    LinkService service = get(LinkService.class);
    ConnectPoint src = deviceConnectPoint(srcCp);
    ConnectPoint dst = deviceConnectPoint(dstCp);

    LinkProviderRegistry registry = get(LinkProviderRegistry.class);
    CliLinkProvider provider = new CliLinkProvider();
    LinkProviderService providerService = registry.register(provider);
    try {
        providerService.linkDetected(description(service.getLink(src, dst),
                                                 key, value));
        if (both) {
            providerService.linkDetected(description(service.getLink(dst, src),
                                                     key, value));
        }
    } finally {
        registry.unregister(provider);
    }
}
 
Example #5
Source File: TopologyMutationDriver.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the mutation process.
 *
 * @param mutationRate          link events per second
 * @param linkService           link service
 * @param deviceService         device service
 * @param linkProviderService   link provider service
 * @param deviceProviderService device provider service
 * @param simulator             topology simulator
 */
void start(double mutationRate,
           LinkService linkService, DeviceService deviceService,
           LinkProviderService linkProviderService,
           DeviceProviderService deviceProviderService,
           TopologySimulator simulator) {
    savedLinks.clear();
    stopped = false;
    this.linkService = linkService;
    this.deviceService = deviceService;
    this.linkProviderService = linkProviderService;
    this.deviceProviderService = deviceProviderService;
    this.simulator = simulator;
    activeLinks = reduceLinks();
    inactiveLinks = Lists.newArrayList();
    adjustRate(mutationRate);
    executor.execute(this);
}
 
Example #6
Source File: TopologySimulator.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes a new topology simulator with access to the specified service
 * directory and various provider services.
 *
 * @param topoShape             topology shape specifier
 * @param deviceCount           number of devices in the topology
 * @param hostCount             number of hosts per device
 * @param directory             service directory
 * @param deviceProviderService device provider service
 * @param hostProviderService   host provider service
 * @param linkProviderService   link provider service
 */
protected void init(String topoShape, int deviceCount, int hostCount,
                    ServiceDirectory directory,
                    DeviceProviderService deviceProviderService,
                    HostProviderService hostProviderService,
                    LinkProviderService linkProviderService) {
    this.deviceCount = deviceCount;
    this.hostCount = hostCount;
    this.directory = directory;

    this.clusterService = directory.get(ClusterService.class);
    this.mastershipService = directory.get(MastershipService.class);
    this.mastershipAdminService = directory.get(MastershipAdminService.class);

    this.deviceService = directory.get(DeviceAdminService.class);
    this.hostService = directory.get(HostService.class);
    this.linkService = directory.get(LinkService.class);
    this.deviceProviderService = deviceProviderService;
    this.hostProviderService = hostProviderService;
    this.linkProviderService = linkProviderService;

    localNode = clusterService.getLocalNode().id();

    processTopoShape(topoShape);
}
 
Example #7
Source File: FlowRuleJuniperImpl.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method to find the next hop IP address.
 * The logic is to check if the destination ports have an IP address
 * by checking the logical interface (e.g., for port physical ge-2/0/1,
 * a logical interface may be ge-2/0/1.0
 *
 * @param deviceId the device id of the flow rule to be installed
 * @param port     output port of the flow rule treatment
 * @return optional IPv4 address of a next hop
 */
private Optional<Ip4Address> findIpDst(DeviceId deviceId, Port port) {
    LinkService linkService = this.handler().get(LinkService.class);
    Set<Link> links = linkService.getEgressLinks(new ConnectPoint(deviceId, port.number()));
    DeviceService deviceService = this.handler().get(DeviceService.class);
    //Using only links with adjacency discovered by the LLDP protocol (see LinkDiscoveryJuniperImpl)
    Map<DeviceId, Port> dstPorts = links.stream().filter(l ->
            JuniperUtils.AK_IP.toUpperCase().equals(l.annotations().value(AnnotationKeys.LAYER)))
            .collect(Collectors.toMap(
                    l -> l.dst().deviceId(),
                    l -> deviceService.getPort(l.dst().deviceId(), l.dst().port())));
    for (Map.Entry<DeviceId, Port> entry : dstPorts.entrySet()) {
        String portName = entry.getValue().annotations().value(AnnotationKeys.PORT_NAME);

        Optional<Port> childPort = deviceService.getPorts(entry.getKey()).stream()
                .filter(p -> Strings.nullToEmpty(
                        p.annotations().value(AnnotationKeys.PORT_NAME)).contains(portName.trim()))
                .filter(this::isIp)
                .findAny();
        if (childPort.isPresent()) {
            return Optional.ofNullable(Ip4Address.valueOf(childPort.get().annotations().value(JuniperUtils.AK_IP)));
        }
    }

    return Optional.empty();
}
 
Example #8
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #9
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #10
Source File: ServicesBundle.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the services bundle, from the given directly.
 *
 * @param directory service directory
 */
public ServicesBundle(ServiceDirectory directory) {
    checkNotNull(directory, "Directory cannot be null");

    clusterService = directory.get(ClusterService.class);

    topologyService = directory.get(TopologyService.class);
    deviceService = directory.get(DeviceService.class);
    driverService = directory.get(DriverService.class);
    hostService = directory.get(HostService.class);
    linkService = directory.get(LinkService.class);

    mastershipService = directory.get(MastershipService.class);
    mastershipAdminService = directory.get(MastershipAdminService.class);
    intentService = directory.get(IntentService.class);
    flowService = directory.get(FlowRuleService.class);
    flowStatsService = directory.get(StatisticService.class);
    portStatsService = directory.get(PortStatisticsService.class);
}
 
Example #11
Source File: LinksWebResource.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Gets infrastructure links.
 * Returns array of all links, or links for the specified device or port.
 * @onos.rsModel LinksGet
 * @param deviceId  (optional) device identifier
 * @param port      (optional) port number
 * @param direction (optional) direction qualifier
 * @return 200 OK with array of all links, or links for the specified device or port
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getLinks(@QueryParam("device") String deviceId,
                         @QueryParam("port") String port,
                         @QueryParam("direction") String direction) {
    LinkService service = get(LinkService.class);
    Iterable<Link> links;

    if (deviceId != null && port != null) {
        links = getConnectPointLinks(new ConnectPoint(deviceId(deviceId),
                                                      portNumber(port)),
                                     direction, service);
    } else if (deviceId != null) {
        links = getDeviceLinks(deviceId(deviceId), direction, service);
    } else {
        links = service.getLinks();
    }
    return ok(encodeArray(Link.class, "links", links)).build();
}
 
Example #12
Source File: DefaultCheckLoopTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    ds = EasyMock.createMock(DeviceService.class);
    hs = EasyMock.createMock(HostService.class);
    frs = EasyMock.createMock(FlowRuleService.class);
    ls = EasyMock.createMock(LinkService.class);

    defaultCheckLoop = new DefaultCheckLoop(ds, hs, frs, ls);
}
 
Example #13
Source File: TunnelHandler.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs tunnel handler.
 *
 * @param linkService link service
 * @param deviceConfiguration device configuration
 * @param groupHandlerMap group handler map
 * @param tunnelStore tunnel store
 */
public TunnelHandler(LinkService linkService,
                     DeviceConfiguration deviceConfiguration,
                     Map<DeviceId, DefaultGroupHandler> groupHandlerMap,
                     EventuallyConsistentMap<String, Tunnel> tunnelStore) {
    this.linkService = linkService;
    this.config = deviceConfiguration;
    this.groupHandlerMap = groupHandlerMap;
    this.tunnelStore = tunnelStore;
}
 
Example #14
Source File: SfcwebUiTopovMessageHandler.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void init(UiConnection connection, ServiceDirectory directory) {
    super.init(connection, directory);
    hostService = directory.get(HostService.class);
    linkService = directory.get(LinkService.class);
    portChainService = directory.get(PortChainService.class);
    portPairService = directory.get(PortPairService.class);
    portPairGroupService = directory.get(PortPairGroupService.class);
}
 
Example #15
Source File: TroubleshootLoadSnapshotCommand.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void loadLinkNib() {
    LinkService linkService = get(LinkService.class);
    Set<Link> links = new HashSet<>();

    links.addAll(Lists.newArrayList(linkService.getLinks()));

    LinkNib linkNib = LinkNib.getInstance();
    linkNib.setLinks(links);
}
 
Example #16
Source File: TsCheckLoop.java    From onos with Apache License 2.0 5 votes vote down vote up
@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()));
}
 
Example #17
Source File: DefaultCheckLoop.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and returns an instance of Loop Checking algorithm module.
 *
 * @param ds reference of DeviceService
 * @param hs reference of HostService
 * @param frs reference of FlowRuleService
 * @param ls reference of LinkService
 */
public DefaultCheckLoop(DeviceService ds,
                        HostService hs,
                        FlowRuleService frs,
                        LinkService ls) {
    checkNotNull(ds, "DeviceService cannot be null");
    checkNotNull(hs, "HostService cannot be null");
    checkNotNull(frs, "FlowRuleService cannot be null");
    checkNotNull(ls, "LinkService  cannot be null");

    deviceService = ds;
    hostService = hs;
    flowRuleService = frs;
    linkService = ls;
}
 
Example #18
Source File: LinkPropsTopovMessageHandler.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void init(UiConnection connection, ServiceDirectory directory) {
    super.init(connection, directory);
    deviceService = directory.get(DeviceService.class);
    hostService = directory.get(HostService.class);
    linkService = directory.get(LinkService.class);
    portStatisticsService = directory.get(PortStatisticsService.class);
    resourceQueryService = directory.get(ResourceQueryService.class);
}
 
Example #19
Source File: VirtualNetworkManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that the get() method returns saved service instances.
 */
@Test
public void testServiceGetReturnsSavedInstance() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork =
            manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));

    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), DeviceService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), LinkService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), TopologyService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), HostService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), PathService.class);

    // extra setup needed for FlowRuleService, PacketService, GroupService, and IntentService
    VirtualProviderManager virtualProviderManager = new VirtualProviderManager();
    virtualProviderManager.registerProvider(new DefaultVirtualFlowRuleProvider());
    virtualProviderManager.registerProvider(new DefaultVirtualPacketProvider());
    virtualProviderManager.registerProvider(new DefaultVirtualGroupProvider());
    testDirectory.add(CoreService.class, coreService)
            .add(VirtualProviderRegistryService.class, virtualProviderManager)
            .add(EventDeliveryService.class, new TestEventDispatcher())
            .add(ClusterService.class, new ClusterServiceAdapter())
            .add(VirtualNetworkFlowRuleStore.class, new SimpleVirtualFlowRuleStore())
            .add(VirtualNetworkPacketStore.class, new SimpleVirtualPacketStore())
            .add(VirtualNetworkGroupStore.class, new SimpleVirtualGroupStore())
            .add(VirtualNetworkIntentStore.class, new SimpleVirtualIntentStore())
            .add(VirtualNetworkFlowObjectiveStore.class, new SimpleVirtualFlowObjectiveStore());

    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), FlowRuleService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), FlowObjectiveService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), PacketService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), GroupService.class);
    validateServiceGetReturnsSavedInstance(virtualNetwork.id(), IntentService.class);
}
 
Example #20
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Tests querying for links using a null connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetLinksByNullId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);

    // test the getLinks() method with a null connect point.
    linkService.getLinks(null);
}
 
Example #21
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #22
Source File: VirtualNetworkManager.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new vnet service instance.
 *
 * @param serviceKey service key
 * @return vnet service
 */
private VnetService create(ServiceKey serviceKey) {
    VirtualNetwork network = getVirtualNetwork(serviceKey.networkId());
    checkNotNull(network, NETWORK_NULL);

    VnetService service;
    if (serviceKey.serviceClass.equals(DeviceService.class)) {
        service = new VirtualNetworkDeviceManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(LinkService.class)) {
        service = new VirtualNetworkLinkManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(TopologyService.class)) {
        service = new VirtualNetworkTopologyManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(IntentService.class)) {
        service = new VirtualNetworkIntentManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(HostService.class)) {
        service = new VirtualNetworkHostManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(PathService.class)) {
        service = new VirtualNetworkPathManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(FlowRuleService.class)) {
        service = new VirtualNetworkFlowRuleManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(PacketService.class)) {
        service = new VirtualNetworkPacketManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(GroupService.class)) {
        service = new VirtualNetworkGroupManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(MeterService.class)) {
        service = new VirtualNetworkMeterManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(FlowObjectiveService.class)) {
        service = new VirtualNetworkFlowObjectiveManager(this, network.id());
    } else if (serviceKey.serviceClass.equals(MastershipService.class) ||
            serviceKey.serviceClass.equals(MastershipAdminService.class) ||
            serviceKey.serviceClass.equals(MastershipTermService.class)) {
        service = new VirtualNetworkMastershipManager(this, network.id());
    } else {
        return null;
    }
    networkServices.put(serviceKey, service);
    return service;
}
 
Example #23
Source File: DefaultGroupHandler.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a group handler object.
 *
 * @param deviceId device identifier
 * @param appId application identifier
 * @param config interface to retrieve the device properties
 * @param linkService link service object
 * @param flowObjService flow objective service object
 * @param srManager segment routing manager
 * @throws DeviceConfigNotFoundException if the device configuration is not found
 * @return default group handler type
 */
public static DefaultGroupHandler createGroupHandler(
                                                     DeviceId deviceId,
                                                     ApplicationId appId,
                                                     DeviceProperties config,
                                                     LinkService linkService,
                                                     FlowObjectiveService flowObjService,
                                                     SegmentRoutingManager srManager)
                                                             throws DeviceConfigNotFoundException {
    return new DefaultGroupHandler(deviceId, appId, config,
                                   linkService,
                                   flowObjService,
                                   srManager);
}
 
Example #24
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Tests querying for egress links using a null connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetEgressLinksByNullId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);

    // test the getEgressLinks() method with a null connect point.
    linkService.getEgressLinks(null);
}
 
Example #25
Source File: DefaultGroupHandler.java    From onos with Apache License 2.0 5 votes vote down vote up
protected DefaultGroupHandler(DeviceId deviceId, ApplicationId appId,
                              DeviceProperties config,
                              LinkService linkService,
                              FlowObjectiveService flowObjService,
                              SegmentRoutingManager srManager) {
    this.deviceId = checkNotNull(deviceId);
    this.appId = checkNotNull(appId);
    this.deviceConfig = checkNotNull(config);
    this.linkService = checkNotNull(linkService);
    this.allSegmentIds = checkNotNull(config.getAllDeviceSegmentIds());
    try {
        this.ipv4NodeSegmentId = config.getIPv4SegmentId(deviceId);
        this.ipv6NodeSegmentId = config.getIPv6SegmentId(deviceId);
        this.isEdgeRouter = config.isEdgeDevice(deviceId);
        this.nodeMacAddr = checkNotNull(config.getDeviceMac(deviceId));
    } catch (DeviceConfigNotFoundException e) {
        log.warn(e.getMessage()
                + " Skipping value assignment in DefaultGroupHandler");
    }
    this.flowObjectiveService = flowObjService;
    this.dsNextObjStore = srManager.dsNextObjStore();
    this.vlanNextObjStore = srManager.vlanNextObjStore();
    this.portNextObjStore = srManager.portNextObjStore();
    this.macVlanNextObjStore = srManager.macVlanNextObjStore();
    this.srManager = srManager;
    executorService.scheduleWithFixedDelay(new BucketCorrector(), 10,
                                           VERIFY_INTERVAL,
                                           TimeUnit.SECONDS);
    populateNeighborMaps();
}
 
Example #26
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Tests querying for device ingress links using a null device identifier.
 */
@Test(expected = NullPointerException.class)
public void testGetDeviceIngressLinksByNullId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);

    // test the getDeviceIngressLinks() method with a null device identifier.
    linkService.getDeviceIngressLinks(null);
}
 
Example #27
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Tests querying for device egress links using a null device identifier.
 */
@Test(expected = NullPointerException.class)
public void testGetDeviceEgressLinksByNullId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);

    // test the getDeviceEgressLinks() method with a null device identifier.
    linkService.getDeviceEgressLinks(null);
}
 
Example #28
Source File: VirtualNetworkLinkManagerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Tests querying for links using a null device identifier.
 */
@Test(expected = NullPointerException.class)
public void testGetDeviceLinksByNullId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);

    // test the getDeviceLinks() method with a null device identifier.
    linkService.getDeviceLinks(null);
}
 
Example #29
Source File: LayoutAlgorithm.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes layout algorithm for operating on device and host inventory.
 *
 * @param deviceService        device service
 * @param hostService          host service
 * @param linkService          link service
 * @param networkConfigService net config service
 */
protected void init(DeviceService deviceService,
                    HostService hostService,
                    LinkService linkService,
                    NetworkConfigService networkConfigService) {
    this.deviceService = deviceService;
    this.hostService = hostService;
    this.linkService = linkService;
    this.netConfigService = networkConfigService;
}
 
Example #30
Source File: LinksWebResource.java    From onos with Apache License 2.0 5 votes vote down vote up
private Iterable<Link> getConnectPointLinks(ConnectPoint point,
                                            String direction,
                                            LinkService service) {
    Direction dir = direction != null ?
            Direction.valueOf(direction.toUpperCase()) : Direction.ALL;
    switch (dir) {
        case INGRESS:
            return service.getIngressLinks(point);
        case EGRESS:
            return service.getEgressLinks(point);
        default:
            return service.getLinks(point);
    }
}