Search in sources :

Example 36 with DataTreeModification

use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.

the class NodeConnectorStatNotificationSupplierImplTest method testCreateChangeEvent.

@Test
public void testCreateChangeEvent() {
    final TestData testData = new TestData(createTestConnectorStatPath(), null, createTestConnectorStat(), DataObjectModification.ModificationType.WRITE);
    Collection<DataTreeModification<FlowCapableNodeConnectorStatistics>> collection = new ArrayList<>();
    collection.add(testData);
    notifSupplierImpl.onDataTreeChanged(collection);
    verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorStatisticsUpdate.class));
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) TestData(org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData) ArrayList(java.util.ArrayList) NodeConnectorStatisticsUpdate(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate) Test(org.junit.Test)

Example 37 with DataTreeModification

use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.

the class NodeConnectorNotificationSupplierImplTest method testDeleteChangeEvent.

@Test
public void testDeleteChangeEvent() {
    final TestData testData = new TestData(createTestFlowCapableConnectorNodePath(), createTestFlowCapableNodeConnecor(), null, DataObjectModification.ModificationType.DELETE);
    Collection<DataTreeModification<FlowCapableNodeConnector>> collection = new ArrayList<>();
    collection.add(testData);
    notifSupplierImpl.onDataTreeChanged(collection);
    verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorRemoved.class));
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) NodeConnectorRemoved(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved) TestData(org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 38 with DataTreeModification

use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.

the class NodeNotificationSupplierImplTest method testDeleteChangeEvent.

@Test
public void testDeleteChangeEvent() {
    final TestData testData = new TestData(createTestFlowCapableNodePath(), createTestFlowCapableNode(), null, DataObjectModification.ModificationType.DELETE);
    Collection<DataTreeModification<FlowCapableNode>> collection = new ArrayList<>();
    collection.add(testData);
    notifSupplierImpl.onDataTreeChanged(collection);
    verify(notifProviderService, times(1)).publish(Matchers.any(NodeRemoved.class));
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) TestData(org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData) ArrayList(java.util.ArrayList) NodeRemoved(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved) Test(org.junit.Test)

Example 39 with DataTreeModification

use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.

the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorUpdateToUp.

/**
 * Test that checks if {@link NodeConnectorEventsObserver#nodeConnectorAdded} is called
 * for each FlowCapableNodeConnector item with administrative up and link up state added in
 * {@link org.opendaylight.controller.md.sal.binding.api.DataTreeModification}.
 */
@Test
public void testNodeConnectorUpdateToUp() {
    DataTreeModification dataTreeModification = setupDataTreeChange(SUBTREE_MODIFIED, NODE_CONNECTOR_INSTANCE_IDENTIFIER, FLOW_CAPABLE_NODE_CONNECTOR);
    translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
    verify(eventsObserver).nodeConnectorAdded(ID, FLOW_CAPABLE_NODE_CONNECTOR);
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) Test(org.junit.Test)

Example 40 with DataTreeModification

use of org.opendaylight.controller.md.sal.binding.api.DataTreeModification in project openflowplugin by opendaylight.

the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorRemoval.

/**
 * Test that checks if {@link NodeConnectorEventsObserver#nodeConnectorRemoved} is called
 * for each FlowCapableNodeConnector path that
 * {@link org.opendaylight.controller.md.sal.binding.api.DataTreeModification} return.
 */
@Test
public void testNodeConnectorRemoval() {
    DataTreeModification dataTreeModification = setupDataTreeChange(DELETE, NODE_CONNECTOR_INSTANCE_IDENTIFIER, null);
    // Invoke NodeConnectorInventoryEventTranslator and check result
    translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
    verify(eventsObserver).nodeConnectorRemoved(ID);
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) Test(org.junit.Test)

Aggregations

DataTreeModification (org.opendaylight.controller.md.sal.binding.api.DataTreeModification)42 Test (org.junit.Test)38 ArrayList (java.util.ArrayList)20 TestData (org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData)19 CountDownLatch (java.util.concurrent.CountDownLatch)8 Mockito.doReturn (org.mockito.Mockito.doReturn)8 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)8 TestUtils.newInvNodeKey (org.opendaylight.openflowplugin.applications.topology.manager.TestUtils.newInvNodeKey)8 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)8 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)8 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)8 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)7 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)5 TpId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId)5 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)5 TerminationPointKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey)5 Optional (com.google.common.base.Optional)4 DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)4 TestUtils.newLink (org.opendaylight.openflowplugin.applications.topology.manager.TestUtils.newLink)4 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)4