Search in sources :

Example 21 with DataTreeIdentifier

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

the class OFPluginFlowTest method testFlowMod.

/**
 * test basic integration with OFLib running the handshake
 * @throws Exception
 */
@Test
public void testFlowMod() throws Exception {
    LOG.debug("testFlowMod integration test");
    TriggerTestListener brmListener = new TriggerTestListener();
    final DataTreeIdentifier<FlowCapableNode> dataTreeIdentifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, getWildcardPath());
    dataBroker.registerDataTreeChangeListener(dataTreeIdentifier, brmListener);
    switchSim = createSimpleClient();
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenarioVBM(ScenarioFactory.VERSION_BITMAP_13, (short) 0, ScenarioFactory.VERSION_BITMAP_10_13, false);
    handshakeScenario.addFirst(new SleepEvent(6000L));
    ScenarioFactory.appendPostHandshakeScenario(handshakeScenario, true);
    WaitForMessageEvent flowModEvent = new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 0e 00 58 00 00 00 03 00 00 00 00 00 00 00 0a " + "00 00 00 00 00 00 00 0a 00 00 00 00 00 00 80 00 " + "ff ff ff ff ff ff ff ff ff ff ff ff 00 01 00 00 " + "00 01 00 16 80 00 0a 02 08 00 80 00 19 08 0a 00 " + "00 01 ff ff ff 00 00 00 00 04 00 10 00 00 00 00 " + "00 18 00 08 00 00 00 00"));
    handshakeScenario.addFirst(flowModEvent);
    ScenarioHandler scenario = new ScenarioHandler(handshakeScenario);
    switchSim.setScenarioHandler(scenario);
    scenarioPool.execute(switchSim);
    LOG.info("finishing testFlowMod");
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) WaitForMessageEvent(org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) SleepEvent(org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent) Test(org.junit.Test)

Example 22 with DataTreeIdentifier

use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project genius by opendaylight.

the class DataObjectCacheTest method setup.

@Before
public void setup() {
    doReturn(mockReadTx).when(mockDataBroker).newReadOnlyTransaction();
    doReturn(mockListenerReg).when(mockDataBroker).registerDataTreeChangeListener(eq(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, PATH)), any());
    cache = new InstanceIdDataObjectCache<>(Config.class, mockDataBroker, LogicalDatastoreType.OPERATIONAL, PATH, new GuavaCacheProvider(new CacheManagersRegistryImpl()));
    verify(mockDataBroker).registerDataTreeChangeListener(eq(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, PATH)), listenerCapture.capture());
    doReturn(mockModification).when(mockDataTreeModification).getRootNode();
    doReturn(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, PATH)).when(mockDataTreeModification).getRootPath();
    doReturn(CONFIG_OBJ).when(mockModification).getDataAfter();
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) Config(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsalutil.rev170830.Config) CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) GuavaCacheProvider(org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider) Before(org.junit.Before)

Aggregations

DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)22 Before (org.junit.Before)7 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)7 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)5 DataTreeModification (org.opendaylight.controller.md.sal.binding.api.DataTreeModification)5 DataObjectModification (org.opendaylight.controller.md.sal.binding.api.DataObjectModification)4 SimpleTaskRetryLooper (org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper)4 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)4 Test (org.junit.Test)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)3 IMappingSystem (org.opendaylight.lispflowmapping.interfaces.mapcache.IMappingSystem)2 FlowCapableNodeCachedDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeCachedDao)2 FlowCapableNodeDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeDao)2 FlowCapableNodeOdlDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao)2 FlowCapableNodeSnapshotDao (org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeSnapshotDao)2 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)2 Tables (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables)2 TopologyBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder)2 Collection (java.util.Collection)1