2 * Copyright © 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.elanmanager.tests.utils;
10 import static org.opendaylight.yangtools.testutils.mockito.MoreAnswers.realOrException;
12 import java.util.List;
13 import java.util.concurrent.Future;
15 import org.mockito.Mockito;
16 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
17 import org.opendaylight.genius.infra.FutureRpcResults;
18 import org.opendaylight.genius.interfacemanager.IfmUtil;
19 import org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutputBuilder;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
25 import org.opendaylight.yangtools.yang.common.RpcResult;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
31 public abstract class ElanEgressActionsHelper implements OdlInterfaceRpcService {
32 private static final Logger LOG = LoggerFactory.getLogger(ElanEgressActionsHelper.class);
33 private InterfaceManagerCommonUtils interfaceManagerCommonUtils;
35 public static ElanEgressActionsHelper newInstance(DataBroker dataBroker,
36 InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
37 ElanEgressActionsHelper instance = Mockito.mock(ElanEgressActionsHelper.class, realOrException());
38 instance.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
43 public Future<RpcResult<GetEgressActionsForInterfaceOutput>> getEgressActionsForInterface(
44 GetEgressActionsForInterfaceInput input) {
45 return FutureRpcResults.fromBuilder(LOG, input, () -> {
46 List<Action> actionsList = IfmUtil.getEgressActionsForInterface(input.getIntfName(), input.getTunnelKey(),
47 input.getActionKey(), interfaceManagerCommonUtils, false);
48 return new GetEgressActionsForInterfaceOutputBuilder().setAction(actionsList);