Search in sources :

Example 11 with DataTreeModification

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

the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorCreationLinkDown.

/**
 * Test that checks that nothing is called when port appeared in inventory in link down state.
 */
@Test
public void testNodeConnectorCreationLinkDown() {
    FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(true, false).build();
    DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, ID, fcnc);
    translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
    verifyZeroInteractions(eventsObserver);
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Test(org.junit.Test)

Example 12 with DataTreeModification

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

the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorCreationAdminDown.

/**
 * Test that checks that nothing is called when port appeared in inventory in admin down state.
 */
@Test
public void testNodeConnectorCreationAdminDown() {
    FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(false, true).build();
    DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, ID, fcnc);
    translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
    verifyZeroInteractions(eventsObserver);
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Test(org.junit.Test)

Example 13 with DataTreeModification

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

the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorCreation.

/**
 * Test that checks if {@link NodeConnectorEventsObserver#nodeConnectorAdded} is called
 * for each FlowCapableNodeConnector item added in
 * {@link org.opendaylight.controller.md.sal.binding.api.DataTreeModification}.
 */
@Test
public void testNodeConnectorCreation() {
    DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, 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 14 with DataTreeModification

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

the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorUpdateToAdminDown.

/**
 * Test that checks if {@link NodeConnectorEventsObserver#nodeConnectorRemoved} is called
 * for each FlowCapableNodeConnector item with administrative down state removed in
 * {@link org.opendaylight.controller.md.sal.binding.api.DataTreeModification}.
 */
@Test
public void testNodeConnectorUpdateToAdminDown() {
    FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(false, true).build();
    DataTreeModification dataTreeModification = setupDataTreeChange(SUBTREE_MODIFIED, NODE_CONNECTOR_INSTANCE_IDENTIFIER, fcnc);
    translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
    verify(eventsObserver).nodeConnectorRemoved(ID);
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Test(org.junit.Test)

Example 15 with DataTreeModification

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

the class NodeConnectorNotificationSupplierImplTest method testCreateChangeEvent.

@Test
public void testCreateChangeEvent() {
    final TestData testData = new TestData(createTestFlowCapableConnectorNodePath(), null, createTestFlowCapableNodeConnecor(), DataObjectModification.ModificationType.WRITE);
    Collection<DataTreeModification<FlowCapableNodeConnector>> collection = new ArrayList<>();
    collection.add(testData);
    notifSupplierImpl.onDataTreeChanged(collection);
    verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorUpdated.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) NodeConnectorUpdated(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated) 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