import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.openflowplugin.api.openflow.FlowGroupCacheManager;
-import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.DeviceMastershipManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl;
-import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
-import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
-import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
-import test.mock.util.FRMTest;
-import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.AbstractFRMTest;
import test.mock.util.SalFlowServiceMock;
@RunWith(MockitoJUnitRunner.class)
-public class FlowListenerTest extends FRMTest {
- private ForwardingRulesManagerImpl forwardingRulesManager;
+public class FlowListenerTest extends AbstractFRMTest {
private static final NodeId NODE_ID = new NodeId("testnode:1");
private static final NodeKey NODE_KEY = new NodeKey(NODE_ID);
- RpcProviderRegistryMock rpcProviderRegistryMock = new RpcProviderRegistryMock();
TableKey tableKey = new TableKey(Uint8.TWO);
- @Mock
- ClusterSingletonServiceProvider clusterSingletonService;
- @Mock
- DeviceMastershipManager deviceMastershipManager;
- @Mock
- private ReconciliationManager reconciliationManager;
- @Mock
- private OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
- @Mock
- private ServiceRecoveryRegistry serviceRecoveryRegistry;
- @Mock
- private MastershipChangeServiceManager mastershipChangeServiceManager;
- @Mock
- private FlowGroupCacheManager flowGroupCacheManager;
@Before
public void setUp() {
- forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock,
- rpcProviderRegistryMock, getConfig(), mastershipChangeServiceManager, clusterSingletonService,
- getConfigurationService(), reconciliationManager, openflowServiceRecoveryHandler,
- serviceRecoveryRegistry, flowGroupCacheManager, getRegistrationHelper());
- forwardingRulesManager.start();
- // TODO consider tests rewrite (added because of complicated access)
- forwardingRulesManager.setDeviceMastershipManager(deviceMastershipManager);
- Mockito.when(deviceMastershipManager.isDeviceMastered(NODE_ID)).thenReturn(true);
+ setUpForwardingRulesManager();
+ setDeviceMastership(NODE_ID);
}
@Test
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
assertCommit(writeTx.commit());
- SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+ SalFlowServiceMock salFlowService = (SalFlowServiceMock) getForwardingRulesManager().getSalFlowService();
await().atMost(10, SECONDS).until(() -> salFlowService.getAddFlowCalls().size() == 1);
List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
assertEquals(1, addFlowCalls.size());
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
assertCommit(writeTx.commit());
- final SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+ final SalFlowServiceMock salFlowService = (SalFlowServiceMock) getForwardingRulesManager().getSalFlowService();
await().atMost(10, SECONDS).until(() -> salFlowService.getAddFlowCalls().size() == 1);
List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
assertCommit(writeTx.commit());
- final SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+ final SalFlowServiceMock salFlowService = (SalFlowServiceMock) getForwardingRulesManager().getSalFlowService();
await().atMost(10, SECONDS).until(() -> salFlowService.getAddFlowCalls().size() == 1);
List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
assertEquals(1, addFlowCalls.size());
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
assertCommit(writeTx.commit());
- final SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+ final SalFlowServiceMock salFlowService =
+ (SalFlowServiceMock) getForwardingRulesManager().getSalFlowService();
await().atMost(10, SECONDS).until(() -> salFlowService.getAddFlowCalls().size() == 1);
List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
assertEquals(1, addFlowCalls.size());
@After
public void tearDown() throws Exception {
- forwardingRulesManager.close();
+ getForwardingRulesManager().close();
}
}
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.openflowplugin.api.openflow.FlowGroupCacheManager;
-import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.DeviceMastershipManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl;
-import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
-import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
-import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint32;
-import test.mock.util.FRMTest;
-import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.AbstractFRMTest;
import test.mock.util.SalGroupServiceMock;
@RunWith(MockitoJUnitRunner.class)
-public class GroupListenerTest extends FRMTest {
- private ForwardingRulesManagerImpl forwardingRulesManager;
+public class GroupListenerTest extends AbstractFRMTest {
private static final NodeId NODE_ID = new NodeId("testnode:1");
private static final NodeKey NODE_KEY = new NodeKey(NODE_ID);
- RpcProviderRegistryMock rpcProviderRegistryMock = new RpcProviderRegistryMock();
- @Mock
- ClusterSingletonServiceProvider clusterSingletonService;
- @Mock
- DeviceMastershipManager deviceMastershipManager;
- @Mock
- private ReconciliationManager reconciliationManager;
- @Mock
- private OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
- @Mock
- private ServiceRecoveryRegistry serviceRecoveryRegistry;
- @Mock
- private MastershipChangeServiceManager mastershipChangeServiceManager;
- @Mock
- private FlowGroupCacheManager flowGroupCacheManager;
-
@Before
public void setUp() {
- forwardingRulesManager = new ForwardingRulesManagerImpl(
- getDataBroker(),
- rpcProviderRegistryMock,
- rpcProviderRegistryMock,
- getConfig(),
- mastershipChangeServiceManager,
- clusterSingletonService,
- getConfigurationService(),
- reconciliationManager,
- openflowServiceRecoveryHandler,
- serviceRecoveryRegistry,
- flowGroupCacheManager,
- getRegistrationHelper()
- );
-
- forwardingRulesManager.start();
- // TODO consider tests rewrite (added because of complicated access)
- forwardingRulesManager.setDeviceMastershipManager(deviceMastershipManager);
- Mockito.when(deviceMastershipManager.isDeviceMastered(NODE_ID)).thenReturn(true);
+ setUpForwardingRulesManager();
+ setDeviceMastership(NODE_ID);
}
@Test
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
assertCommit(writeTx.commit());
- final SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+ final SalGroupServiceMock salGroupService =
+ (SalGroupServiceMock) getForwardingRulesManager().getSalGroupService();
await().atMost(10, SECONDS).until(() -> salGroupService.getAddGroupCalls().size() == 1);
List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
assertEquals(1, addGroupCalls.size());
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
assertCommit(writeTx.commit());
- final SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+ final SalGroupServiceMock salGroupService =
+ (SalGroupServiceMock) getForwardingRulesManager().getSalGroupService();
await().atMost(10, SECONDS).until(() -> salGroupService.getAddGroupCalls().size() == 1);
List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
assertEquals(1, addGroupCalls.size());
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
assertCommit(writeTx.commit());
- SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+ SalGroupServiceMock salGroupService = (SalGroupServiceMock) getForwardingRulesManager().getSalGroupService();
await().atMost(10, SECONDS).until(() -> salGroupService.getAddGroupCalls().size() == 1);
List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
assertEquals(1, addGroupCalls.size());
@After
public void tearDown() throws Exception {
- forwardingRulesManager.close();
+ getForwardingRulesManager().close();
}
}
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.openflowplugin.api.openflow.FlowGroupCacheManager;
-import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.DeviceMastershipManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl;
-import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
-import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
-import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint32;
-import test.mock.util.FRMTest;
-import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.AbstractFRMTest;
import test.mock.util.SalMeterServiceMock;
@RunWith(MockitoJUnitRunner.class)
-public class MeterListenerTest extends FRMTest {
- private ForwardingRulesManagerImpl forwardingRulesManager;
+public class MeterListenerTest extends AbstractFRMTest {
private static final NodeId NODE_ID = new NodeId("testnode:1");
private static final NodeKey NODE_KEY = new NodeKey(NODE_ID);
- RpcProviderRegistryMock rpcProviderRegistryMock = new RpcProviderRegistryMock();
- @Mock
- ClusterSingletonServiceProvider clusterSingletonService;
- @Mock
- DeviceMastershipManager deviceMastershipManager;
- @Mock
- private ReconciliationManager reconciliationManager;
- @Mock
- private OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
- @Mock
- private ServiceRecoveryRegistry serviceRecoveryRegistry;
- @Mock
- private MastershipChangeServiceManager mastershipChangeServiceManager;
- @Mock
- private FlowGroupCacheManager flowGroupCacheManager;
-
@Before
public void setUp() {
- forwardingRulesManager = new ForwardingRulesManagerImpl(
- getDataBroker(),
- rpcProviderRegistryMock,
- rpcProviderRegistryMock,
- getConfig(),
- mastershipChangeServiceManager,
- clusterSingletonService,
- getConfigurationService(),
- reconciliationManager,
- openflowServiceRecoveryHandler,
- serviceRecoveryRegistry,
- flowGroupCacheManager,
- getRegistrationHelper()
- );
-
- forwardingRulesManager.start();
- // TODO consider tests rewrite (added because of complicated access)
- forwardingRulesManager.setDeviceMastershipManager(deviceMastershipManager);
- Mockito.when(deviceMastershipManager.isDeviceMastered(NODE_ID)).thenReturn(true);
+ setUpForwardingRulesManager();
+ setDeviceMastership(NODE_ID);
}
@Test
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
assertCommit(writeTx.commit());
- SalMeterServiceMock salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+ SalMeterServiceMock salMeterService = (SalMeterServiceMock) getForwardingRulesManager().getSalMeterService();
await().atMost(10, SECONDS).until(() -> salMeterService.getAddMeterCalls().size() == 1);
List<AddMeterInput> addMeterCalls = salMeterService.getAddMeterCalls();
assertEquals(1, addMeterCalls.size());
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
assertCommit(writeTx.commit());
- SalMeterServiceMock salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+ SalMeterServiceMock salMeterService = (SalMeterServiceMock) getForwardingRulesManager().getSalMeterService();
await().atMost(10, SECONDS).until(() -> salMeterService.getAddMeterCalls().size() == 1);
List<AddMeterInput> addMeterCalls = salMeterService.getAddMeterCalls();
assertEquals(1, addMeterCalls.size());
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
assertCommit(writeTx.commit());
- SalMeterServiceMock salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+ SalMeterServiceMock salMeterService = (SalMeterServiceMock) getForwardingRulesManager().getSalMeterService();
await().atMost(10, SECONDS).until(() -> salMeterService.getAddMeterCalls().size() == 1);
List<AddMeterInput> addMeterCalls = salMeterService.getAddMeterCalls();
assertEquals(1, addMeterCalls.size());
@After
public void tearDown() throws Exception {
- forwardingRulesManager.close();
+ getForwardingRulesManager().close();
}
}
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.util.concurrent.ExecutionException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.openflowplugin.api.openflow.FlowGroupCacheManager;
-import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl;
-import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
-import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
-import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import test.mock.util.FRMTest;
-import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.AbstractFRMTest;
@RunWith(MockitoJUnitRunner.class)
-public class NodeListenerTest extends FRMTest {
- private ForwardingRulesManagerImpl forwardingRulesManager;
+public class NodeListenerTest extends AbstractFRMTest {
private static final NodeKey NODE_KEY = new NodeKey(new NodeId("testnode:1"));
- RpcProviderRegistryMock rpcProviderRegistryMock = new RpcProviderRegistryMock();
- @Mock
- ClusterSingletonServiceProvider clusterSingletonService;
- @Mock
- private ReconciliationManager reconciliationManager;
- @Mock
- private OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
- @Mock
- private ServiceRecoveryRegistry serviceRecoveryRegistry;
- @Mock
- private MastershipChangeServiceManager mastershipChangeServiceManager;
- @Mock
- private FlowGroupCacheManager flowGroupCacheManager;
-
@Before
public void setUp() {
- forwardingRulesManager = new ForwardingRulesManagerImpl(
- getDataBroker(),
- rpcProviderRegistryMock,
- rpcProviderRegistryMock,
- getConfig(),
- mastershipChangeServiceManager,
- clusterSingletonService,
- getConfigurationService(),
- reconciliationManager,
- openflowServiceRecoveryHandler,
- serviceRecoveryRegistry,
- flowGroupCacheManager,
- getRegistrationHelper());
-
- forwardingRulesManager.start();
+ setUpForwardingRulesManager();
}
@Test
InstanceIdentifier<FlowCapableNode> nodeII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY)
.augmentation(FlowCapableNode.class);
- boolean nodeActive = forwardingRulesManager.isNodeActive(nodeII);
+ boolean nodeActive = getForwardingRulesManager().isNodeActive(nodeII);
assertTrue(nodeActive);
- removeNode(NODE_KEY);
- nodeActive = forwardingRulesManager.isNodeActive(nodeII);
+ removeNode();
+ nodeActive = getForwardingRulesManager().isNodeActive(nodeII);
assertFalse(nodeActive);
}
@After
public void tearDown() throws Exception {
- forwardingRulesManager.close();
+ getForwardingRulesManager().close();
+ }
+
+ private void removeNode() throws ExecutionException, InterruptedException {
+ WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+ writeTx.delete(LogicalDatastoreType.OPERATIONAL,
+ InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY));
+ writeTx.commit().get();
}
}
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.openflowplugin.api.openflow.FlowGroupCacheManager;
-import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.DeviceMastershipManager;
-import org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl;
-import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
-import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
-import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint8;
-import test.mock.util.FRMTest;
-import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.AbstractFRMTest;
import test.mock.util.SalTableServiceMock;
@RunWith(MockitoJUnitRunner.class)
-public class TableFeaturesListenerTest extends FRMTest {
- private ForwardingRulesManagerImpl forwardingRulesManager;
+public class TableFeaturesListenerTest extends AbstractFRMTest {
private static final NodeId NODE_ID = new NodeId("testnode:1");
private static final NodeKey NODE_KEY = new NodeKey(NODE_ID);
- RpcProviderRegistryMock rpcProviderRegistryMock = new RpcProviderRegistryMock();
- @Mock
- ClusterSingletonServiceProvider clusterSingletonService;
- @Mock
- DeviceMastershipManager deviceMastershipManager;
- @Mock
- private ReconciliationManager reconciliationManager;
- @Mock
- private OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
- @Mock
- private ServiceRecoveryRegistry serviceRecoveryRegistry;
- @Mock
- private MastershipChangeServiceManager mastershipChangeServiceManager;
- @Mock
- private FlowGroupCacheManager flowGroupCacheManager;
@Before
public void setUp() {
- forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock,
- rpcProviderRegistryMock, getConfig(), mastershipChangeServiceManager, clusterSingletonService,
- getConfigurationService(), reconciliationManager, openflowServiceRecoveryHandler,
- serviceRecoveryRegistry, flowGroupCacheManager, getRegistrationHelper());
-
-
- forwardingRulesManager.start();
- // TODO consider tests rewrite (added because of complicated access)
- forwardingRulesManager.setDeviceMastershipManager(deviceMastershipManager);
- Mockito.when(deviceMastershipManager.isDeviceMastered(NODE_ID)).thenReturn(true);
+ setUpForwardingRulesManager();
+ setDeviceMastership(NODE_ID);
}
@Test
TableKey tableKey = new TableKey(Uint8.TWO);
TableFeaturesKey tableFeaturesKey = new TableFeaturesKey(tableKey.getId());
- addTable(tableKey, NODE_KEY);
+ addTable(tableKey);
TableFeatures tableFeaturesData = new TableFeaturesBuilder().withKey(tableFeaturesKey).build();
InstanceIdentifier<TableFeatures> tableFeaturesII = InstanceIdentifier.create(Nodes.class)
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableFeaturesII, tableFeaturesData);
assertCommit(writeTx.commit());
- SalTableServiceMock salTableServiceMock = (SalTableServiceMock) forwardingRulesManager.getSalTableService();
+ SalTableServiceMock salTableServiceMock =
+ (SalTableServiceMock) getForwardingRulesManager().getSalTableService();
await().atMost(10, SECONDS).until(() -> salTableServiceMock.getUpdateTableInput().size() == 1);
List<UpdateTableInput> updateTableInputs = salTableServiceMock.getUpdateTableInput();
assertEquals(1, updateTableInputs.size());
@After
public void tearDown() throws Exception {
- forwardingRulesManager.close();
+ getForwardingRulesManager().close();
+ }
+
+ private void addTable(final TableKey tableKey) {
+ addFlowCapableNode(NODE_KEY);
+ final Table table = new TableBuilder().withKey(tableKey).build();
+ WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+ InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY)
+ .augmentation(FlowCapableNode.class).child(Table.class, tableKey);
+ writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
+ assertCommit(writeTx.commit());
}
}
--- /dev/null
+/*
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package test.mock.util;
+
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.mockito.Mock;
+import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTest;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.openflowplugin.api.openflow.FlowGroupCacheManager;
+import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
+import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
+import org.opendaylight.openflowplugin.applications.frm.impl.DeviceMastershipManager;
+import org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl;
+import org.opendaylight.openflowplugin.applications.frm.impl.ListenerRegistrationHelper;
+import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
+import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
+import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.ArbitratorReconcileService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.forwardingrules.manager.config.rev160511.ForwardingRulesManagerConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.forwardingrules.manager.config.rev160511.ForwardingRulesManagerConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+
+public abstract class AbstractFRMTest extends AbstractDataBrokerTest {
+ private ForwardingRulesManagerImpl forwardingRulesManager;
+
+ @Mock
+ private RpcConsumerRegistry rpcConsumerRegistry;
+ @Mock
+ private RpcProviderService rpcProviderService;
+ @Mock
+ private ClusterSingletonServiceProvider clusterSingletonService;
+ @Mock
+ private DeviceMastershipManager deviceMastershipManager;
+ @Mock
+ private ReconciliationManager reconciliationManager;
+ @Mock
+ private OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
+ @Mock
+ private ServiceRecoveryRegistry serviceRecoveryRegistry;
+ @Mock
+ private MastershipChangeServiceManager mastershipChangeServiceManager;
+ @Mock
+ private FlowGroupCacheManager flowGroupCacheManager;
+
+ protected void setUpForwardingRulesManager() {
+ when(rpcConsumerRegistry.getRpcService(SalFlowService.class))
+ .thenReturn(new SalFlowServiceMock());
+ when(rpcConsumerRegistry.getRpcService(SalGroupService.class))
+ .thenReturn(new SalGroupServiceMock());
+ when(rpcConsumerRegistry.getRpcService(SalMeterService.class))
+ .thenReturn(new SalMeterServiceMock());
+ when(rpcConsumerRegistry.getRpcService(SalTableService.class))
+ .thenReturn(new SalTableServiceMock());
+ when(rpcConsumerRegistry.getRpcService(SalBundleService.class))
+ .thenReturn(new SalBundleServiceMock());
+ when(rpcConsumerRegistry.getRpcService(ArbitratorReconcileService.class))
+ .thenReturn(new ArbitratorReconcileServiceMock());
+
+ forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcConsumerRegistry,
+ rpcProviderService, getConfig(), mastershipChangeServiceManager, clusterSingletonService,
+ getConfigurationService(), reconciliationManager, openflowServiceRecoveryHandler,
+ serviceRecoveryRegistry, flowGroupCacheManager, getRegistrationHelper());
+ forwardingRulesManager.start();
+ }
+
+ protected void setDeviceMastership(final NodeId nodeId) {
+ // TODO consider tests rewrite (added because of complicated access)
+ forwardingRulesManager.setDeviceMastershipManager(deviceMastershipManager);
+ when(deviceMastershipManager.isDeviceMastered(nodeId)).thenReturn(true);
+ }
+
+ protected ForwardingRulesManagerImpl getForwardingRulesManager() {
+ return forwardingRulesManager;
+ }
+
+ protected void addFlowCapableNode(final NodeKey nodeKey) {
+ Nodes nodes = new NodesBuilder().build();
+
+ NodeBuilder nodeBuilder = new NodeBuilder();
+ nodeBuilder.withKey(nodeKey);
+ nodeBuilder.addAugmentation(new FlowCapableNodeBuilder().build());
+
+ WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+ writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
+
+ InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
+ writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
+ writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
+ writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
+ assertCommit(writeTx.commit());
+ }
+
+ private static ForwardingRulesManagerConfig getConfig() {
+ return new ForwardingRulesManagerConfigBuilder()
+ .setDisableReconciliation(false)
+ .setStaleMarkingEnabled(false)
+ .setReconciliationRetryCount(Uint16.ZERO)
+ .setBundleBasedReconciliationEnabled(false)
+ .build();
+ }
+
+ private static ConfigurationService getConfigurationService() {
+ final ConfigurationService configurationService = mock(ConfigurationService.class);
+ final ForwardingRulesManagerConfig config = getConfig();
+
+ when(configurationService.registerListener(any())).thenReturn(() -> {
+ });
+
+ lenient().when(configurationService.getProperty(eq("disable-reconciliation"), any()))
+ .thenReturn(config.getDisableReconciliation());
+
+ lenient().when(configurationService.getProperty(eq("stale-marking-enabled"), any()))
+ .thenReturn(config.getStaleMarkingEnabled());
+
+ lenient().when(configurationService.getProperty(eq("reconciliation-retry-count"),
+ any())).thenReturn(config.getReconciliationRetryCount());
+
+ lenient().when(configurationService.getProperty(eq("bundle-based-reconciliation-enabled"),
+ any())).thenReturn(config.getBundleBasedReconciliationEnabled());
+
+ return configurationService;
+ }
+
+ private ListenerRegistrationHelper getRegistrationHelper() {
+ return new ListenerRegistrationHelper(getDataBroker());
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package test.mock.util;
-
-import com.google.common.util.concurrent.FluentFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTest;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
-import org.opendaylight.openflowplugin.applications.frm.impl.ListenerRegistrationHelper;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.forwardingrules.manager.config.rev160511.ForwardingRulesManagerConfig;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.forwardingrules.manager.config.rev160511.ForwardingRulesManagerConfigBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.Uint16;
-
-public abstract class FRMTest extends AbstractDataBrokerTest {
-
- public void addFlowCapableNode(final NodeKey nodeKey) {
- Nodes nodes = new NodesBuilder().build();
-
- NodeBuilder nodeBuilder = new NodeBuilder();
- nodeBuilder.withKey(nodeKey);
- nodeBuilder.addAugmentation(new FlowCapableNodeBuilder().build());
-
- WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
- writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
-
- InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
- writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
- writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
- writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
- assertCommit(writeTx.commit());
- }
-
- // TODO: remove with mdsal-3.0.7 or later
- @SuppressWarnings("unchecked")
- protected static final void assertCommit(final FluentFuture<?> future) {
- assertCommit((ListenableFuture<Void>) future);
- }
-
- public void removeNode(final NodeKey nodeKey) throws ExecutionException, InterruptedException {
- WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
- writeTx.delete(LogicalDatastoreType.OPERATIONAL,
- InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey));
- writeTx.commit().get();
- }
-
- public void addTable(final TableKey tableKey, final NodeKey nodeKey) {
- addFlowCapableNode(nodeKey);
- final Table table = new TableBuilder().withKey(tableKey).build();
- WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
- InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey)
- .augmentation(FlowCapableNode.class).child(Table.class, tableKey);
- writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
- assertCommit(writeTx.commit());
- }
-
- public ForwardingRulesManagerConfig getConfig() {
- return new ForwardingRulesManagerConfigBuilder()
- .setDisableReconciliation(false)
- .setStaleMarkingEnabled(false)
- .setReconciliationRetryCount(Uint16.ZERO)
- .setBundleBasedReconciliationEnabled(false)
- .build();
- }
-
- public ConfigurationService getConfigurationService() {
- final ConfigurationService configurationService = Mockito.mock(ConfigurationService.class);
- final ForwardingRulesManagerConfig config = getConfig();
-
- Mockito.when(configurationService.registerListener(Mockito.any())).thenReturn(() -> {
- });
-
- Mockito.lenient().when(configurationService.getProperty(Mockito.eq("disable-reconciliation"), Mockito.any()))
- .thenReturn(config.getDisableReconciliation());
-
- Mockito.lenient().when(configurationService.getProperty(Mockito.eq("stale-marking-enabled"), Mockito.any()))
- .thenReturn(config.getStaleMarkingEnabled());
-
- Mockito.lenient().when(configurationService.getProperty(Mockito.eq("reconciliation-retry-count"),
- Mockito.any())).thenReturn(config.getReconciliationRetryCount());
-
- Mockito.lenient().when(configurationService.getProperty(Mockito.eq("bundle-based-reconciliation-enabled"),
- Mockito.any())).thenReturn(config.getBundleBasedReconciliationEnabled());
-
- return configurationService;
- }
-
- protected Callable<Integer> listSize(final List<?> list) {
- // The condition supplier part
- return list::size;
- }
-
- public ListenerRegistrationHelper getRegistrationHelper() {
- ListenerRegistrationHelper registrationHelper = new ListenerRegistrationHelper(getDataBroker());
- return registrationHelper;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package test.mock.util;
-
-import java.util.Set;
-import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.ArbitratorReconcileService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-
-public class RpcProviderRegistryMock implements RpcConsumerRegistry, RpcProviderService {
- @Override
- public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
- T implementation) {
- return null;
- }
-
- @Override
- public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
- T implementation, Set<InstanceIdentifier<?>> paths) {
- return null;
- }
-
- @Override
- public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
- if (serviceInterface.equals(SalFlowService.class)) {
- return (T) new SalFlowServiceMock();
- } else if (serviceInterface.equals(SalGroupService.class)) {
- return (T) new SalGroupServiceMock();
- } else if (serviceInterface.equals(SalMeterService.class)) {
- return (T) new SalMeterServiceMock();
- } else if (serviceInterface.equals(SalTableService.class)) {
- return (T) new SalTableServiceMock();
- } else if (serviceInterface.equals(SalBundleService.class)) {
- return (T) new SalBundleServiceMock();
- } else if (serviceInterface.equals(ArbitratorReconcileService.class)) {
- return (T) new ArbitratorReconcileServiceMock();
- } else {
- return null;
- }
- }
-
-
-}
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
public class SalBundleServiceMock implements SalBundleService {
@Override
public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(ControlBundleInput input) {
getControlBundleInput().add(input);
- return null;
+ return RpcResultBuilder.success(new ControlBundleOutputBuilder().build()).buildFuture();
}
@Override
public ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessages(AddBundleMessagesInput input) {
getAddBundleMessagesInput().add(input);
- return null;
+ return RpcResultBuilder.success(new AddBundleMessagesOutputBuilder().build()).buildFuture();
}
public List<ControlBundleInput> getControlBundleInput() {
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
public class SalFlowServiceMock implements SalFlowService {
private final List<AddFlowInput> addFlowCalls = new ArrayList<>();
@Override
public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
addFlowCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture();
}
@Override
public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
removeFlowCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new RemoveFlowOutputBuilder().build()).buildFuture();
}
@Override
public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
updateFlowCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new UpdateFlowOutputBuilder().build()).buildFuture();
}
public List<AddFlowInput> getAddFlowCalls() {
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutputBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
public class SalGroupServiceMock implements SalGroupService {
private final List<AddGroupInput> addGroupCalls = new ArrayList<>();
@Override
public ListenableFuture<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
addGroupCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new AddGroupOutputBuilder().build()).buildFuture();
}
@Override
public ListenableFuture<RpcResult<RemoveGroupOutput>> removeGroup(RemoveGroupInput input) {
removeGroupCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new RemoveGroupOutputBuilder().build()).buildFuture();
}
@Override
public ListenableFuture<RpcResult<UpdateGroupOutput>> updateGroup(UpdateGroupInput input) {
updateGroupCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new UpdateGroupOutputBuilder().build()).buildFuture();
}
public List<AddGroupInput> getAddGroupCalls() {
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutputBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
public class SalMeterServiceMock implements SalMeterService {
private final List<AddMeterInput> addMeterCalls = new ArrayList<>();
@Override
public ListenableFuture<RpcResult<AddMeterOutput>> addMeter(AddMeterInput input) {
addMeterCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new AddMeterOutputBuilder().build()).buildFuture();
}
@Override
public ListenableFuture<RpcResult<RemoveMeterOutput>> removeMeter(RemoveMeterInput input) {
removeMeterCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new RemoveMeterOutputBuilder().build()).buildFuture();
}
@Override
public ListenableFuture<RpcResult<UpdateMeterOutput>> updateMeter(UpdateMeterInput input) {
updateMeterCalls.add(input);
- return null;
+ return RpcResultBuilder.success(new UpdateMeterOutputBuilder().build()).buildFuture();
}
public List<AddMeterInput> getAddMeterCalls() {
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
public class SalTableServiceMock implements SalTableService {
private final List<UpdateTableInput> updateTableInput = new ArrayList<>();
@Override
public ListenableFuture<RpcResult<UpdateTableOutput>> updateTable(UpdateTableInput input) {
updateTableInput.add(input);
- return null;
+ return RpcResultBuilder.success(new UpdateTableOutputBuilder().build()).buildFuture();
}
}