use of org.onosproject.portloadbalancer.api.PortLoadBalancerAdminService in project onos by opennetworkinglab.
the class PortLoadBalancerRemoveCommand method doExecute.
@Override
protected void doExecute() {
DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
int portLoadBalancerKey = Integer.parseInt(keyStr);
PortLoadBalancerAdminService portLoadBalancerAdminService = get(PortLoadBalancerAdminService.class);
PortLoadBalancerId portLoadBalancerId = new PortLoadBalancerId(deviceId, portLoadBalancerKey);
PortLoadBalancer portLoadBalancer = portLoadBalancerAdminService.remove(portLoadBalancerId);
print("Removal of %s %s", portLoadBalancerId, portLoadBalancer != null ? EXECUTED : FAILED);
}
use of org.onosproject.portloadbalancer.api.PortLoadBalancerAdminService in project onos by opennetworkinglab.
the class PortLoadBalancerAddCommand method doExecute.
@Override
protected void doExecute() {
DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
int portLoadBalancerKey = Integer.parseInt(keyStr);
PortLoadBalancerMode mode = PortLoadBalancerMode.valueOf(modeStr.toUpperCase());
Set<PortNumber> ports = Sets.newHashSet(portsStr).stream().map(PortNumber::fromString).collect(Collectors.toSet());
PortLoadBalancerAdminService portLoadBalancerAdminService = get(PortLoadBalancerAdminService.class);
PortLoadBalancerId portLoadBalancerId = new PortLoadBalancerId(deviceId, portLoadBalancerKey);
PortLoadBalancer portLoadBalancer = portLoadBalancerAdminService.createOrUpdate(portLoadBalancerId, ports, mode);
print("%s of %s executed", portLoadBalancer == null ? CREATE : UPDATE, portLoadBalancerId);
}
Aggregations