use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class CreateNullDevice method doExecute.
@Override
protected void doExecute() {
NullProviders service = get(NullProviders.class);
NetworkConfigService cfgService = get(NetworkConfigService.class);
TopologySimulator simulator = service.currentSimulator();
if (!validateSimulator(simulator) || !validateLocType(locType)) {
return;
}
CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
DeviceId deviceId = id == null ? sim.nextDeviceId() : DeviceId.deviceId(id);
BasicDeviceConfig cfg = cfgService.addConfig(deviceId, BasicDeviceConfig.class);
cfg.name(name);
setUiCoordinates(cfg, locType, latOrY, longOrX);
Tools.delay(10);
sim.createDevice(deviceId, name, Device.Type.valueOf(type.toUpperCase()), hw, sw, portCount);
}
use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class CreateNullLink method doExecute.
@Override
protected void doExecute() {
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);
if (one == null) {
error("\u001B[1;31mLink not created - no location (free port) available on src %s\u001B[0m", src);
return;
} else if (two == null) {
error("\u001B[1;31mLink not created - no location (free port) available on dst %s\u001B[0m", dst);
return;
}
sim.createLink(one, two, Link.Type.valueOf(type.toUpperCase()), !unidirectional);
}
use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class NullControlCommand method doExecute.
@Override
protected void doExecute() {
ComponentConfigService service = get(ComponentConfigService.class);
// If there is an existing topology; make sure it's stopped before restarting
if (cmd.equals(START)) {
NullProviders npService = get(NullProviders.class);
TopologySimulator simulator = npService.currentSimulator();
if (simulator != null) {
simulator.tearDownTopology();
}
}
if (topoShape != null) {
service.setProperty(NullProviders.class.getName(), "topoShape", topoShape);
}
service.setProperty(NullProviders.class.getName(), "enabled", cmd.equals(START) ? "true" : "false");
}
Aggregations