當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。