Search in sources :

Example 1 with DeleteEVPNInput

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;
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) VpnInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstance) RpcError(org.opendaylight.yangtools.yang.common.RpcError) ArrayList(java.util.ArrayList) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) DeleteEVPNOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.DeleteEVPNOutputBuilder)

Aggregations

ArrayList (java.util.ArrayList)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 VpnInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstance)1 DeleteEVPNOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.DeleteEVPNOutputBuilder)1 RpcError (org.opendaylight.yangtools.yang.common.RpcError)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1