本文整理汇总了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);
}