use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.DeleteEVPNInput in project netvirt by opendaylight.
the class NeutronEvpnManager method deleteEVPN.
public ListenableFuture<RpcResult<DeleteEVPNOutput>> deleteEVPN(DeleteEVPNInput input) {
List<RpcError> errorList = new ArrayList<>();
if (input.getId() != null) {
for (Uuid vpn : input.getId()) {
VpnInstance vpnInstance = VpnHelper.getVpnInstance(dataBroker, vpn.getValue());
if (vpnInstance != null) {
neutronvpnManager.removeVpn(vpn);
} else {
errorList.add(RpcResultBuilder.newWarning(RpcError.ErrorType.PROTOCOL, "invalid-value", formatAndLog(LOG::warn, "EVPN with vpnid: {} does not exist", vpn.getValue())));
}
}
}
List<String> errorResponseList = new ArrayList<>();
if (!errorList.isEmpty()) {
for (RpcError rpcError : errorList) {
errorResponseList.add("ErrorType: " + rpcError.getErrorType() + ", ErrorTag: " + rpcError.getTag() + ", ErrorMessage: " + rpcError.getMessage());
}
} else {
errorResponseList.add("Deletion of EVPN operation successful");
}
DeleteEVPNOutputBuilder opBuilder = new DeleteEVPNOutputBuilder();
opBuilder.setResponse(errorResponseList);
SettableFuture<RpcResult<DeleteEVPNOutput>> result = SettableFuture.create();
result.set(RpcResultBuilder.success(opBuilder.build()).build());
return result;
}
Aggregations