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


Java NullProviders类代码示例

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


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

示例1: execute

import org.onosproject.provider.nil.NullProviders; //导入依赖的package包/类
@Override
protected void execute() {
    NullProviders service = get(NullProviders.class);

    try {
        ConnectPoint onePoint = ConnectPoint.deviceConnectPoint(one);
        ConnectPoint twoPoint = ConnectPoint.deviceConnectPoint(two);

        if (cmd.equals(UP)) {
            service.repairLink(onePoint, twoPoint);
        } else if (cmd.equals(DOWN)) {
            service.severLink(onePoint, twoPoint);
        } else {
            error("Illegal command %s; must be up or down", cmd);
        }
    } catch (NumberFormatException e) {
        error("Invalid port number specified", e);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:NullLinkCommand.java

示例2: execute

import org.onosproject.provider.nil.NullProviders; //导入依赖的package包/类
@Override
protected void execute() {
    ComponentConfigService service = get(ComponentConfigService.class);
    if (topoShape != null) {
        service.setProperty(NullProviders.class.getName(), "topoShape", topoShape);
    }
    service.setProperty(NullProviders.class.getName(), "enabled",
                        cmd.equals(START) ? "true" : "false");

    // If we are re-starting the "custom" topology, reset the counts
    //  on the auto-assigned IDs for null-devices and null-hosts, so that
    //  scripts can rely on consistent assignment of IDs to nodes.
    if (CUSTOM.equals(topoShape) && START.equals(cmd)) {
        NullProviders npService = get(NullProviders.class);
        TopologySimulator simulator = npService.currentSimulator();
        if (simulator instanceof CustomTopologySimulator) {
            CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
            sim.resetIdSeeds();
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:NullControlCommand.java

示例3: execute

import org.onosproject.provider.nil.NullProviders; //导入依赖的package包/类
@Override
protected void execute() {
    ComponentConfigService service = get(ComponentConfigService.class);
    if (topoShape != null) {
        service.setProperty(NullProviders.class.getName(), "topoShape", topoShape);
    }
    service.setProperty(NullProviders.class.getName(), "enabled",
                        cmd.equals(START) ? "true" : "false");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:NullControlCommand.java

示例4: execute

import org.onosproject.provider.nil.NullProviders; //导入依赖的package包/类
@Override
protected void execute() {
    NullProviders service = get(NullProviders.class);
    DeviceId deviceId = DeviceId.deviceId(id);

    if (cmd.equals(UP)) {
        service.repairDevice(deviceId);
    } else if (cmd.equals(DOWN)) {
        service.failDevice(deviceId);
    } else {
        error("Illegal command %s; must be up or down", cmd);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:NullDeviceCommand.java

示例5: execute

import org.onosproject.provider.nil.NullProviders; //导入依赖的package包/类
@Override
protected void execute() {
    NullProviders service = get(NullProviders.class);
    NetworkConfigService cfgService = get(NetworkConfigService.class);

    TopologySimulator simulator = service.currentSimulator();
    if (!(simulator instanceof CustomTopologySimulator)) {
        error("Custom topology simulator is not active.");
        return;
    }

    if (!(GEO.equals(locType) || GRID.equals(locType))) {
        error("locType must be 'geo' or 'grid'.");
        return;
    }

    CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
    DeviceId deviceId = sim.nextDeviceId();
    BasicDeviceConfig cfg = cfgService.addConfig(deviceId, BasicDeviceConfig.class);
    cfg.name(name)
            .locType(locType);

    if (GEO.equals(locType)) {
        cfg.latitude(latOrY).longitude(longOrX);
    } else {
        cfg.gridX(longOrX).gridY(latOrY);
    }
    cfg.apply();

    sim.createDevice(deviceId, name, Device.Type.valueOf(type.toUpperCase()), portCount);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:32,代码来源:CreateNullDevice.java

示例6: execute

import org.onosproject.provider.nil.NullProviders; //导入依赖的package包/类
@Override
protected void execute() {
    NullProviders service = get(NullProviders.class);
    NetworkConfigService cfgService = get(NetworkConfigService.class);

    TopologySimulator simulator = service.currentSimulator();
    if (!(simulator instanceof CustomTopologySimulator)) {
        error("Custom topology simulator is not active.");
        return;
    }

    if (!(GEO.equals(locType) || GRID.equals(locType))) {
        error("locType must be 'geo' or 'grid'.");
        return;
    }

    CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
    DeviceId deviceId = sim.deviceId(deviceName);
    HostId id = sim.nextHostId();
    HostLocation location = findAvailablePort(deviceId);
    BasicHostConfig cfg = cfgService.addConfig(id, BasicHostConfig.class);

    cfg.locType(locType);
    cfg.setLocations(new HashSet<HostLocation>() {{ add(location); }});

    if (GEO.equals(locType)) {
        cfg.latitude(latOrY).longitude(longOrX);
    } else {
        cfg.gridX(longOrX).gridY(latOrY);
    }
    cfg.apply();

    sim.createHost(id, location, IpAddress.valueOf(hostIp));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:35,代码来源:CreateNullHost.java

示例7: execute

import org.onosproject.provider.nil.NullProviders; //导入依赖的package包/类
@Override
protected void execute() {
    NullProviders service = get(NullProviders.class);

    TopologySimulator simulator = service.currentSimulator();
    if (!(simulator instanceof CustomTopologySimulator)) {
        error("Custom topology simulator is not active.");
        return;
    }

    CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
    ConnectPoint one = findAvailablePort(sim.deviceId(src), null);
    ConnectPoint two = findAvailablePort(sim.deviceId(dst), one);
    sim.createLink(one, two, Link.Type.valueOf(type.toUpperCase()), !unidirectional);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:16,代码来源:CreateNullLink.java


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