use of org.onosproject.ofagent.api.OFSwitchService in project onos by opennetworkinglab.
the class OFSwitchListCommand method doExecute.
@Override
protected void doExecute() {
OFSwitchService service = get(OFSwitchService.class);
Set<OFSwitch> ofSwitches;
if (networkId != NetworkId.NONE.id()) {
ofSwitches = service.ofSwitches(NetworkId.networkId(networkId));
} else {
ofSwitches = service.ofSwitches();
}
print(FORMAT, "DPID", "Connected controllers");
ofSwitches.forEach(ofSwitch -> {
Set<String> channels = ofSwitch.controllerChannels().stream().map(channel -> channel.remoteAddress().toString()).collect(Collectors.toSet());
print(FORMAT, ofSwitch.dpid(), channels);
});
}
Aggregations