use of org.onosproject.ofagent.api.OFAgentAdminService in project onos by opennetworkinglab.
the class OFAgentStartCommand method doExecute.
@Override
protected void doExecute() {
OFAgentAdminService adminService = get(OFAgentAdminService.class);
adminService.startAgent(NetworkId.networkId(networkId));
print("Successfully started OFAgent for network %s", networkId);
}
use of org.onosproject.ofagent.api.OFAgentAdminService in project onos by opennetworkinglab.
the class OFAgentAddControllerCommand method doExecute.
@Override
protected void doExecute() {
if (!isValidController(strCtrl)) {
error("Invalid controller string %s, must be IP:PORT", strCtrl);
return;
}
OFAgentService service = get(OFAgentService.class);
OFAgentAdminService adminService = get(OFAgentAdminService.class);
OFAgent existing = service.agent(NetworkId.networkId(networkId));
if (existing == null) {
error("OFAgent for network %s does not exist", networkId);
return;
}
String[] temp = strCtrl.split(":");
OFAgent updated = DefaultOFAgent.builder().from(existing).addController(DefaultOFController.of(IpAddress.valueOf(temp[0]), TpPort.tpPort(Integer.valueOf(temp[1])))).build();
adminService.updateAgent(updated);
}
use of org.onosproject.ofagent.api.OFAgentAdminService in project onos by opennetworkinglab.
the class OFAgentDeleteControllerCommand method doExecute.
@Override
protected void doExecute() {
if (!isValidController(strCtrl)) {
error("Invalid controller string %s, must be IP:PORT", strCtrl);
return;
}
OFAgentService service = get(OFAgentService.class);
OFAgentAdminService adminService = get(OFAgentAdminService.class);
OFAgent existing = service.agent(NetworkId.networkId(networkId));
if (existing == null) {
error("OFAgent for network %s does not exist", networkId);
return;
}
String[] temp = strCtrl.split(":");
OFAgent updated = DefaultOFAgent.builder().from(existing).deleteController(DefaultOFController.of(IpAddress.valueOf(temp[0]), TpPort.tpPort(Integer.valueOf(temp[1])))).build();
adminService.updateAgent(updated);
}
use of org.onosproject.ofagent.api.OFAgentAdminService in project onos by opennetworkinglab.
the class OFAgentRemoveCommand method doExecute.
@Override
protected void doExecute() {
OFAgentAdminService adminService = get(OFAgentAdminService.class);
OFAgent removed = adminService.removeAgent(NetworkId.networkId(networkId));
if (removed != null) {
print("Successfully removed OFAgent for network %s", networkId);
} else {
print("Failed to remove OFAgent for network %s", networkId);
}
}
use of org.onosproject.ofagent.api.OFAgentAdminService in project onos by opennetworkinglab.
the class OFAgentStopCommand method doExecute.
@Override
protected void doExecute() {
OFAgentAdminService adminService = get(OFAgentAdminService.class);
adminService.stopAgent(NetworkId.networkId(networkId));
print("Successfully stopped OFAgent for network %s", networkId);
}
Aggregations