Search in sources :

Example 1 with PortLoadBalancerService

use of org.onosproject.portloadbalancer.api.PortLoadBalancerService in project onos by opennetworkinglab.

the class PortLoadBalancerListCommand method doExecute.

@Override
public void doExecute() {
    PortLoadBalancerService service = get(PortLoadBalancerService.class);
    // Get port load balancers and reservations
    Map<PortLoadBalancerId, PortLoadBalancer> portLoadBalancerStore = service.getPortLoadBalancers();
    Map<PortLoadBalancerId, ApplicationId> portLoadBalancerResStore = service.getReservations();
    // Print id -> ports, mode, reservation
    portLoadBalancerStore.forEach((portLoadBalancerId, portLoadBalancer) -> print("%s -> %s, %s, %s", portLoadBalancerId, portLoadBalancer.ports(), portLoadBalancer.mode(), portLoadBalancerResStore.get(portLoadBalancerId) == null ? AVAILABLE : portLoadBalancerResStore.get(portLoadBalancerId).name()));
}
Also used : PortLoadBalancerService(org.onosproject.portloadbalancer.api.PortLoadBalancerService) PortLoadBalancerId(org.onosproject.portloadbalancer.api.PortLoadBalancerId) ApplicationId(org.onosproject.core.ApplicationId) PortLoadBalancer(org.onosproject.portloadbalancer.api.PortLoadBalancer)

Aggregations

ApplicationId (org.onosproject.core.ApplicationId)1 PortLoadBalancer (org.onosproject.portloadbalancer.api.PortLoadBalancer)1 PortLoadBalancerId (org.onosproject.portloadbalancer.api.PortLoadBalancerId)1 PortLoadBalancerService (org.onosproject.portloadbalancer.api.PortLoadBalancerService)1