Search in sources :

Example 1 with HostAdminService

use of org.onosproject.net.host.HostAdminService in project onos by opennetworkinglab.

the class WipeOutCommand method wipeOutHosts.

private void wipeOutHosts() {
    print("Wiping hosts");
    HostAdminService hostAdminService = get(HostAdminService.class);
    while (hostAdminService.getHostCount() > 0) {
        try {
            for (Host host : hostAdminService.getHosts()) {
                hostAdminService.removeHost(host.id());
            }
        } catch (Exception e) {
            log.info("Unable to wipe-out hosts", e);
        }
    }
}
Also used : HostAdminService(org.onosproject.net.host.HostAdminService) Host(org.onosproject.net.Host) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 Host (org.onosproject.net.Host)1 HostAdminService (org.onosproject.net.host.HostAdminService)1