当前位置: 首页>>代码示例>>Java>>正文


Java LinkService类代码示例

本文整理汇总了Java中org.onosproject.net.link.LinkService的典型用法代码示例。如果您正苦于以下问题:Java LinkService类的具体用法?Java LinkService怎么用?Java LinkService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LinkService类属于org.onosproject.net.link包,在下文中一共展示了LinkService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLinks

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:LinksWebResource.java

示例2: portData

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
private ObjectNode portData(Port p, DeviceId id) {
    ObjectNode port = objectNode();
    LinkService ls = get(LinkService.class);
    String name = p.annotations().value(AnnotationKeys.PORT_NAME);

    port.put(ID, capitalizeFully(p.number().toString()));
    port.put(TYPE, capitalizeFully(p.type().toString()));
    port.put(SPEED, p.portSpeed());
    port.put(ENABLED, p.isEnabled());
    port.put(NAME, name != null ? name : "");

    Set<Link> links = ls.getEgressLinks(new ConnectPoint(id, p.number()));
    if (!links.isEmpty()) {
        StringBuilder egressLinks = new StringBuilder();
        for (Link l : links) {
            ConnectPoint dest = l.dst();
            egressLinks.append(dest.elementId()).append("/")
                    .append(dest.port()).append(" ");
        }
        port.put(LINK_DEST, egressLinks.toString());
    }

    return port;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:DeviceViewMessageHandler.java

示例3: ServicesBundle

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
/**
 * Creates the services bundle.
 *
 * @param intentService     intent service reference
 * @param deviceService     device service reference
 * @param hostService       host service reference
 * @param linkService       link service reference
 * @param flowService       flow service reference
 * @param flowStatsService  flow statistics service reference
 * @param portStatsService  port statistics service reference
 */
public ServicesBundle(IntentService intentService,
                      DeviceService deviceService,
                      HostService hostService,
                      LinkService linkService,
                      FlowRuleService flowService,
                      StatisticService flowStatsService,
                      PortStatisticsService portStatsService) {
    this.intentService = checkNotNull(intentService);
    this.deviceService = checkNotNull(deviceService);
    this.hostService = checkNotNull(hostService);
    this.linkService = checkNotNull(linkService);
    this.flowService = checkNotNull(flowService);
    this.flowStatsService = checkNotNull(flowStatsService);
    this.portStatsService = checkNotNull(portStatsService);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:ServicesBundle.java

示例4: init

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
@Override
public void init(UiConnection connection, ServiceDirectory directory) {
    super.init(connection, directory);
    this.directory = checkNotNull(directory, "Directory 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);
    tunnelService = directory.get(TunnelService.class);

    servicesBundle = new ServicesBundle(intentService, deviceService,
                                        hostService, linkService,
                                        flowService,
                                        flowStatsService, portStatsService);

    String ver = directory.get(CoreService.class).version().toString();
    version = ver.replace(".SNAPSHOT", "*").replaceFirst("~.*$", "");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:TopologyViewMessageHandlerBase.java

示例5: init

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
/**
 * 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.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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:TopologySimulator.java

示例6: start

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:TopologyMutationDriver.java

示例7: complete

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
@Override
public int complete(String buffer, int cursor, 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.
    ArgumentCompleter.ArgumentList list = getArgumentList();
    String srcArg = list.getArguments()[list.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(buffer, cursor, candidates);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:LinkDstCompleter.java

示例8: complete

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
@Override
public int complete(String buffer, int cursor, 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(buffer, cursor, candidates);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:LinkSrcCompleter.java

示例9: DefaultGroupHandler

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
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.nodeSegmentId = config.getSegmentId(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.nsNextObjStore = srManager.nsNextObjStore;
    this.subnetNextObjStore = srManager.subnetNextObjStore;
    this.portNextObjStore = srManager.portNextObjStore;
    this.srManager = srManager;

    populateNeighborMaps();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:DefaultGroupHandler.java

示例10: createGroupHandler

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
/**
 * Creates a group handler object based on the type of device. If device is
 * of edge type it returns edge group handler, else it returns transit group
 * handler.
 *
 * @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 {
    // handle possible exception in the caller
    if (config.isEdgeDevice(deviceId)) {
        return new DefaultEdgeGroupHandler(deviceId, appId, config,
                                           linkService,
                                           flowObjService,
                                           srManager
                                           );
    } else {
        return new DefaultTransitGroupHandler(deviceId, appId, config,
                                              linkService,
                                              flowObjService,
                                              srManager);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:DefaultGroupHandler.java

示例11: getLinks

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
@GET
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();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:19,代码来源:LinksWebResource.java

示例12: TopologyViewMessages

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
/**
 * Creates a messaging facility for creating messages for topology viewer.
 *
 * @param directory service directory
 */
protected TopologyViewMessages(ServiceDirectory directory) {
    this.directory = checkNotNull(directory, "Directory 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);
    statService = directory.get(StatisticService.class);
    topologyService = directory.get(TopologyService.class);

    String ver = directory.get(CoreService.class).version().toString();
    version = ver.replace(".SNAPSHOT", "*").replaceFirst("~.*$", "");
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:21,代码来源:TopologyViewMessages.java

示例13: process

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
@Override
public void process(ObjectNode message) {
    ObjectNode payload = payload(message);
    String sortCol = string(payload, "sortCol", "id");
    String sortDir = string(payload, "sortDir", "asc");

    DeviceService service = get(DeviceService.class);
    MastershipService mastershipService = get(MastershipService.class);
    LinkService linkService = get(LinkService.class);
    TableRow[] rows = generateTableRows(service,
                                        mastershipService,
                                        linkService);
    RowComparator rc =
            new RowComparator(sortCol, RowComparator.direction(sortDir));
    Arrays.sort(rows, rc);
    ArrayNode devices = generateArrayNode(rows);
    ObjectNode rootNode = mapper.createObjectNode();
    rootNode.set("devices", devices);

    connection().sendMessage("deviceDataResponse", 0, rootNode);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:22,代码来源:DeviceViewMessageHandler.java

示例14: init

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
@Override
public void init(UiConnection connection, ServiceDirectory directory) {
    super.init(connection, directory);
    this.directory = checkNotNull(directory, "Directory 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);
    statService = directory.get(StatisticService.class);
    topologyService = directory.get(TopologyService.class);

    String ver = directory.get(CoreService.class).version().toString();
    version = ver.replace(".SNAPSHOT", "*").replaceFirst("~.*$", "");
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:18,代码来源:TopologyViewMessageHandlerBase.java

示例15: DefaultGroupHandler

import org.onosproject.net.link.LinkService; //导入依赖的package包/类
protected DefaultGroupHandler(DeviceId deviceId,
                           ApplicationId appId,
                           DeviceProperties config,
                           LinkService linkService,
                           GroupService groupService) {
    this.deviceId = checkNotNull(deviceId);
    this.appId = checkNotNull(appId);
    this.deviceConfig = checkNotNull(config);
    this.linkService = checkNotNull(linkService);
    this.groupService = checkNotNull(groupService);
    allSegmentIds = checkNotNull(config.getAllDeviceSegmentIds());
    nodeSegmentId = config.getSegmentId(deviceId);
    isEdgeRouter = config.isEdgeDevice(deviceId);
    nodeMacAddr = checkNotNull(config.getDeviceMac(deviceId));

    this.groupService.addListener(listener);

    populateNeighborMaps();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:20,代码来源:DefaultGroupHandler.java


注:本文中的org.onosproject.net.link.LinkService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。