use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class CreateNullHosts method doExecute.
@Override
protected void doExecute() {
NullProviders service = get(NullProviders.class);
NetworkConfigService cfgService = get(NetworkConfigService.class);
TopologySimulator simulator = service.currentSimulator();
if (!validateSimulator(simulator)) {
return;
}
CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
List<ConnectPoint> points = findAvailablePorts(sim.deviceId(deviceName));
String pattern = hostIpPattern.replace("*", "%d");
double yStep = rowGap / hostsPerRow;
double y = gridY;
double x = gridX - (colGap * (hostsPerRow - 1)) / 2;
for (int h = 0; h < hostCount; h++) {
HostLocation location = new HostLocation(points.get(h), System.currentTimeMillis());
IpAddress ip = IpAddress.valueOf(String.format(pattern, h));
HostId id = sim.nextHostId();
if (gridY != NONE) {
BasicHostConfig cfg = cfgService.addConfig(id, BasicHostConfig.class);
setUiCoordinates(cfg, GRID, y, x);
if (((h + 1) % hostsPerRow) == 0) {
x = gridX - (colGap * (hostsPerRow - 1)) / 2;
} else {
x += colGap;
y += yStep;
}
}
Tools.delay(10);
sim.createHost(id, location, ip);
}
}
use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class NullDeviceCommand method doExecute.
@Override
protected void doExecute() {
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);
}
}
use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class CreateNullHost 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;
HostId id = sim.nextHostId();
Set<HostLocation> locations;
try {
locations = getLocations(sim, deviceNames);
} catch (NoLocationException e) {
error("\u001B[1;31mHost not created - no location (free port) available on %s\u001B[0m", e.getMessage());
return;
}
Set<IpAddress> ips = getIps(hostIps);
BasicHostConfig cfg = cfgService.addConfig(id, BasicHostConfig.class);
setUiCoordinates(cfg, locType, latOrY, longOrX);
Tools.delay(10);
sim.createHost(id, locations, ips);
}
use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class NullLinkCommand method doExecute.
@Override
protected void doExecute() {
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);
}
}
use of org.onosproject.provider.nil.NullProviders in project onos by opennetworkinglab.
the class NullPortStatsControlCommand method doExecute.
@Override
protected void doExecute() {
ComponentConfigService service = get(ComponentConfigService.class);
NullProviders npService = get(NullProviders.class);
npService.enablePortStats(cmd.equals(START));
}
Aggregations