当前位置: 首页>>代码示例>>Java>>正文


Java ModificationType类代码示例

本文整理汇总了Java中org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType的典型用法代码示例。如果您正苦于以下问题:Java ModificationType类的具体用法?Java ModificationType怎么用?Java ModificationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModificationType类属于org.opendaylight.controller.md.sal.binding.api.DataObjectModification包,在下文中一共展示了ModificationType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDataTreeChanged

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeModification<Descriptors>> changes) {
    for (DataTreeModification<Descriptors> descModification : changes) {
        LOG.info("Descriptor Change has occured for Tenant-Id {} / Descriptor-Id {}",tenantId,
                descModification.getRootPath().toString());
        if (descModification.getRootNode().getModificationType() == ModificationType.DELETE) {
            removeDescriptor(descModification.getRootNode().getDataBefore());
        } else {
            try {
               addDescriptor(descModification.getRootNode().getDataAfter());
           } catch (Exception e) {
               ErrorLog.logError("DescriptorChangeManager - Error occured during Descriptor Create/Write - " + e.getLocalizedMessage(), e.getStackTrace());
           }
        }

    }
}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:18,代码来源:PolicyManager.java

示例2: onDataTreeChanged

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeModification<Contexts>> changes) {
    for (DataTreeModification<Contexts> cntxModification : changes) {
        LOG.info("Descriptor Change has occured for Tenant-Id {} / Descriptor-Id {}",tenantId,
                cntxModification.getRootPath().toString());
        if (cntxModification.getRootNode().getModificationType() == ModificationType.DELETE) {
            removeContext(cntxModification.getRootNode().getDataBefore());
        } else {
            try {
               addContext(cntxModification.getRootNode().getDataAfter());
           } catch (Exception e) {
               ErrorLog.logError("DescriptorChangeManager - Error occured during Descriptor Create/Write - " + e.getLocalizedMessage(), e.getStackTrace());
           }
        }

    }
}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:18,代码来源:PortManager.java

示例3: onDataTreeChanged

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeModification<DpnGroups>> changes) {
    for (DataTreeModification<DpnGroups> dpnGroupModification : changes) {
        LOG.info("Dpn Groups Change has occured for " + dpnGroupModification.getRootPath().toString());
        if (dpnGroupModification.getRootNode().getModificationType() == ModificationType.DELETE) {
            removeDpnGroup(dpnGroupModification.getRootNode().getDataBefore());
        } else {
            try {
                loadDpnGroup(dpnGroupModification.getRootNode().getDataAfter());
           } catch (Exception e) {
               ErrorLog.logError("DpnChangeManager - Error occured during DPN Create/Write - " + e.getLocalizedMessage(), e.getStackTrace());
           }
        }

    }
}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:17,代码来源:DpnAssignmentMgr.java

示例4: logDataTreeChangeEvent

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
private static synchronized void logDataTreeChangeEvent(final int eventNum,
        final Collection<DataTreeModification<TestExec>> changes) {
    LOG.debug("DsbenchmarkListener-onDataTreeChanged: Event {}", eventNum);

    for (DataTreeModification<TestExec> change : changes) {
        final DataObjectModification<TestExec> rootNode = change.getRootNode();
        final ModificationType modType = rootNode.getModificationType();
        final PathArgument changeId = rootNode.getIdentifier();
        final Collection<DataObjectModification<? extends DataObject>> modifications =
                rootNode.getModifiedChildren();

        LOG.debug("    changeId {}, modType {}, mods: {}", changeId, modType, modifications.size());

        for (DataObjectModification<? extends DataObject> mod : modifications) {
            LOG.debug("      mod-getDataAfter: {}", mod.getDataAfter());
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:DsbenchmarkListener.java

示例5: testTopLevelListener

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
@Test
public void testTopLevelListener() throws Exception {
    final EventCapturingListener<Top> listener = new EventCapturingListener<>();
    dataBrokerImpl.registerDataTreeChangeListener(TOP_IDENTIFIER, listener);

    createAndVerifyTop(listener);

    putTx(BAR_PATH, BAR_DATA).submit().checkedGet();
    final DataObjectModification<Top> afterBarPutEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
    verifyModification(afterBarPutEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
    final DataObjectModification<TopLevelList> barPutMod = afterBarPutEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
    assertNotNull(barPutMod);
    verifyModification(barPutMod, BAR_ARGUMENT, ModificationType.WRITE);

    deleteTx(BAR_PATH).submit().checkedGet();
    final DataObjectModification<Top> afterBarDeleteEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
    verifyModification(afterBarDeleteEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
    final DataObjectModification<TopLevelList> barDeleteMod = afterBarDeleteEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
    verifyModification(barDeleteMod, BAR_ARGUMENT, ModificationType.DELETE);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:DataTreeChangeListenerTest.java

示例6: testWildcardedListListener

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
@Test
public void testWildcardedListListener() throws Exception {
    final EventCapturingListener<TopLevelList> listener = new EventCapturingListener<>();
    final DataTreeIdentifier<TopLevelList> wildcard = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, TOP_PATH.child(TopLevelList.class));
    dataBrokerImpl.registerDataTreeChangeListener(wildcard, listener);

    putTx(TOP_PATH, TOP_INITIAL_DATA).submit().checkedGet();

    final DataTreeModification<TopLevelList> fooWriteEvent = Iterables.getOnlyElement(listener.nextEvent());
    assertEquals(FOO_PATH, fooWriteEvent.getRootPath().getRootIdentifier());
    verifyModification(fooWriteEvent.getRootNode(), FOO_ARGUMENT, ModificationType.WRITE);

    putTx(BAR_PATH, BAR_DATA).submit().checkedGet();
    final DataTreeModification<TopLevelList> barWriteEvent = Iterables.getOnlyElement(listener.nextEvent());
    assertEquals(BAR_PATH, barWriteEvent.getRootPath().getRootIdentifier());
    verifyModification(barWriteEvent.getRootNode(), BAR_ARGUMENT, ModificationType.WRITE);

    deleteTx(BAR_PATH).submit().checkedGet();
    final DataTreeModification<TopLevelList> barDeleteEvent = Iterables.getOnlyElement(listener.nextEvent());
    assertEquals(BAR_PATH, barDeleteEvent.getRootPath().getRootIdentifier());
    verifyModification(barDeleteEvent.getRootNode(), BAR_ARGUMENT, ModificationType.DELETE);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:DataTreeChangeListenerTest.java

示例7: ouputChanges

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
private static void ouputChanges(final DataTreeModification<Cars> change) {
    final DataObjectModification<Cars> rootNode = change.getRootNode();
    final ModificationType modificationType = rootNode.getModificationType();
    final InstanceIdentifier<Cars> rootIdentifier = change.getRootPath().getRootIdentifier();
    switch (modificationType) {
        case WRITE:
        case SUBTREE_MODIFIED: {
            final Cars dataBefore = rootNode.getDataBefore();
            final Cars dataAfter = rootNode.getDataAfter();
            LOG.trace("onDataTreeChanged - Cars config with path {} was added or changed from {} to {}",
                    rootIdentifier, dataBefore, dataAfter);
            break;
        }
        case DELETE: {
            LOG.trace("onDataTreeChanged - Cars config with path {} was deleted", rootIdentifier);
            break;
        }
        default: {
            LOG.trace("onDataTreeChanged called with unknown modificationType: {}", modificationType);
            break;
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:CarDataTreeChangeListener.java

示例8: testIpv4RouteAdd

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
/**
 * Tests adding a IPv4 route entry.
 */
@Test
public void testIpv4RouteAdd() {
	String nextHopIp = "192.168.10.1";
	String prefix = "1.1.1.0/24";

	AtriumIpPrefix ipv4Prefix = AtriumIpPrefix.valueOf(prefix);
	AtriumIpAddress ipv4Address = AtriumIpAddress.valueOf(nextHopIp);
	RouteEntry routeEntry = new RouteEntry(ipv4Prefix, ipv4Address);

	DataTreeModification routeUpdate = getRouteUpdate(prefix, nextHopIp, ModificationType.WRITE);

	ribManager.processRouteUpdates(routeUpdate);

	assertEquals(1, ribManager.getRoutes4().size());
	assertTrue(ribManager.getRoutes4().contains(routeEntry));
	verify(fibListener, times(1)).update(anyObject(), anyObject());
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:21,代码来源:RibManagerTest.java

示例9: testIpv4RouteUpdate

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
/**
 * Tests updating a IPv4 route entry.
 */
@Test
public void testIpv4RouteUpdate() {
	// Firstly add a route
	testIpv4RouteAdd();

	String nextHopIp = "192.168.20.1";
	String prefix = "1.1.1.0/24";

	AtriumIpPrefix ipv4Prefix = AtriumIpPrefix.valueOf(prefix);
	AtriumIpAddress ipv4Address = AtriumIpAddress.valueOf(nextHopIp);
	RouteEntry routeEntry = new RouteEntry(ipv4Prefix, ipv4Address);

	DataTreeModification routeUpdate = getRouteUpdate(prefix, nextHopIp, ModificationType.SUBTREE_MODIFIED);

	ribManager.processRouteUpdates(routeUpdate);

	assertEquals(1, ribManager.getRoutes4().size());
	assertTrue(ribManager.getRoutes4().contains(routeEntry));
	verify(fibListener, atLeast(1)).update(anyObject(), anyObject());
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:24,代码来源:RibManagerTest.java

示例10: testIpv4RouteDelete

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
/**
 * Tests deleting a IPv4 route entry.
 */
@Test
public void testIpv4RouteDelete() {
	testIpv4RouteAdd();
	testIpv4RouteUpdate();

	String nextHopIp = "192.168.10.1";
	String prefix = "1.1.1.0/24";

	AtriumIpPrefix ipv4Prefix = AtriumIpPrefix.valueOf(prefix);
	AtriumIpAddress ipv4Address = AtriumIpAddress.valueOf(nextHopIp);
	RouteEntry routeEntry = new RouteEntry(ipv4Prefix, ipv4Address);

	DataTreeModification routeUpdate = getRouteUpdate(prefix, nextHopIp, ModificationType.DELETE);

	ribManager.processRouteUpdates(routeUpdate);

	assertFalse(ribManager.getRoutes4().contains(routeEntry));
	verify(fibListener, atLeast(1)).update(anyObject(), anyObject());
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:23,代码来源:RibManagerTest.java

示例11: testIpv4LocalRouteAdd

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
/**
 * Tests adding a IPv4 route whose next hop is the local BGP speaker.
 */
@Test
public void testIpv4LocalRouteAdd() {
	String nextHopIp = "192.168.30.1";
	String prefix = "1.1.1.0/24";

	AtriumIpPrefix ipv4Prefix = AtriumIpPrefix.valueOf(prefix);
	AtriumIpAddress ipv4Address = AtriumIpAddress.valueOf(nextHopIp);
	RouteEntry routeEntry = new RouteEntry(ipv4Prefix, ipv4Address);

	DataTreeModification routeUpdate = getRouteUpdate(prefix, nextHopIp, ModificationType.WRITE);
	
	ribManager.processRouteUpdates(routeUpdate);

	assertEquals(1, ribManager.getRoutes4().size());
	assertTrue(ribManager.getRoutes4().contains(routeEntry));
	verify(fibListener, never()).update(anyObject(), anyObject());
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:21,代码来源:RibManagerTest.java

示例12: onDataTreeChanged

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeModification<Hostconfig>> hostConfigDtm) {
    for (DataTreeModification<Hostconfig> dtm : hostConfigDtm) {
        ModificationType mod = dtm.getRootNode().getModificationType();
        switch (mod) {
            case WRITE: {
                sf.set(1);
                break;
            }
            case DELETE: {
                sf.set(2);
                break;
            }
            default:
        }
    }
}
 
开发者ID:opendaylight,项目名称:neutron,代码行数:18,代码来源:NeutronHostconfigVppListenerTest.java

示例13: updateDeviceOpData

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
private void updateDeviceOpData(InstanceIdentifier<Node> key, DataObjectModification<? extends DataObject> mod) {
    ModificationType type = getModificationType(mod);
    if (type == null) {
        return;
    }
    Class<? extends Identifiable> childClass = (Class<? extends Identifiable>) mod.getDataType();
    InstanceIdentifier instanceIdentifier = getKey(key, mod, mod.getDataAfter());
    switch(type) {
        case WRITE:
            connectionInstance.getDeviceInfo().updateDeviceOperData(childClass, instanceIdentifier,
                    new UUID("uuid"), mod.getDataAfter());
            break;
        case DELETE:
            connectionInstance.getDeviceInfo().clearDeviceOperData(childClass, instanceIdentifier);
            break;
        case SUBTREE_MODIFIED:
    }
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:19,代码来源:HwvtepOperationalDataChangeListener.java

示例14: onAppConfigChanged

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
private void onAppConfigChanged(final Collection<DataTreeModification<DataObject>> changes) {
    for (DataTreeModification<DataObject> change: changes) {
        DataObjectModification<DataObject> changeRoot = change.getRootNode();
        ModificationType type = changeRoot.getModificationType();

        LOG.debug("{}: onAppConfigChanged: {}, {}", logName(), type, change.getRootPath());

        if (type == ModificationType.SUBTREE_MODIFIED || type == ModificationType.WRITE) {
            DataObject newAppConfig = changeRoot.getDataAfter();

            LOG.debug("New app config instance: {}, previous: {}", newAppConfig, currentAppConfig);

            if (!setInitialAppConfig(Optional.of(newAppConfig))
                    && !Objects.equals(currentAppConfig, newAppConfig)) {
                LOG.debug("App config was updated");

                if (appConfigUpdateStrategy == UpdateStrategy.RELOAD) {
                    restartContainer();
                }
            }
        } else if (type == ModificationType.DELETE) {
            LOG.debug("App config was deleted");

            if (appConfigUpdateStrategy == UpdateStrategy.RELOAD) {
                restartContainer();
            }
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:30,代码来源:DataStoreAppConfigMetadata.java

示例15: createAndVerifyTop

import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType; //导入依赖的package包/类
private void createAndVerifyTop(final EventCapturingListener<Top> listener) throws Exception {
    putTx(TOP_PATH,TOP_INITIAL_DATA).submit().checkedGet();
    final Collection<DataTreeModification<Top>> events = listener.nextEvent();

    assertFalse("Non empty collection should be received.",events.isEmpty());
    final DataTreeModification<Top> initialWrite = Iterables.getOnlyElement(events);
    final DataObjectModification<? extends DataObject> initialNode = initialWrite.getRootNode();
    verifyModification(initialNode,TOP_PATH.getPathArguments().iterator().next(),ModificationType.WRITE);
    assertEquals(TOP_INITIAL_DATA, initialNode.getDataAfter());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:DataTreeChangeListenerTest.java


注:本文中的org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。