use of org.onosproject.scalablegateway.api.GatewayNode in project onos by opennetworkinglab.
the class ScalableGatewayDeleteCommand method doExecute.
@Override
protected void doExecute() {
ScalableGatewayService service = get(ScalableGatewayService.class);
GatewayNode gatewayNode = service.getGatewayNode(DeviceId.deviceId(deviceId));
if (gatewayNode == null) {
print(UNKNOWN);
return;
}
if (service.deleteGatewayNode(gatewayNode)) {
print(SUCCESS);
} else {
print(FAIL);
}
}
use of org.onosproject.scalablegateway.api.GatewayNode in project onos by opennetworkinglab.
the class ScalableGatewayAddCommand method doExecute.
@Override
protected void doExecute() {
ScalableGatewayService service = get(ScalableGatewayService.class);
GatewayNode gatewayNode = GatewayNode.builder().gatewayDeviceId(DeviceId.deviceId(deviceId)).dataIpAddress(Ip4Address.valueOf(ipAddress)).uplinkIntf(interfaceName).build();
if (service.addGatewayNode(gatewayNode)) {
print(SUCCESS);
} else {
print(FAIL);
}
}
use of org.onosproject.scalablegateway.api.GatewayNode in project onos by opennetworkinglab.
the class ScalableGatewayManager method getUplinkPort.
@Override
public PortNumber getUplinkPort(DeviceId deviceId) {
GatewayNode gatewayNode = gatewayNodeMap.get(deviceId).value();
if (gatewayNode == null) {
log.warn("Gateway with device ID {} does not exist");
return null;
}
Optional<Port> port = deviceService.getPorts(deviceId).stream().filter(p -> Objects.equals(p.annotations().value(PORT_NAME), gatewayNode.getUplinkIntf())).findFirst();
if (!port.isPresent()) {
log.warn("Cannot find uplink interface from gateway {}", deviceId);
return null;
}
return port.get().number();
}
Aggregations