本文整理匯總了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);
}
}
示例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();
}
}
}
示例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");
}
示例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);
}
}
示例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);
}
示例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));
}
示例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);
}