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


Java DataBroker类代码示例

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


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

示例1: onSessionInitiated

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@Override
public void onSessionInitiated(ProviderContext session) {
    LOG.info("HelloProvider Session Initiated");
    db = session.getSALService(DataBroker.class);
    helloService = session.addRpcImplementation(HelloService.class, this);

    initializeDataTree(db);
}
 
开发者ID:lrodrin,项目名称:opendaylight,代码行数:9,代码来源:HelloProvider.java

示例2: init

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
/**
 * Initialization function.
 * @param db - Data Broker
 * @param tenant - Tenant
 */
protected void init(DataBroker db, Tenant tenant) {
    this.db = db;
    this.tenantId = tenant.getTenantId();
    FpcMobility mobility = tenant.getFpcMobility();
    if (mobility != null){
    	for(Contexts cntx : (mobility.getContexts() == null) ? Collections.<Contexts>emptyList() : mobility.getContexts()){
    		try{
    			LOG.info("Loading Context {} from Storage for Tenant {}", mobility.getContexts(), tenantId);
    			addContext(cntx);
    		} catch (Exception e){
    			LOG.error("PortManager - Error during Context load for Tenant {} / Mobility {}", mobility.getContexts(), tenantId);
    			ErrorLog.logError(e.getStackTrace());
    		}
    	}
    }
}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:22,代码来源:PortManager.java

示例3: init

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
/**
 * Initialization function.
 * @param db - Data Broker
 * @param tenant - Tenant
 */
protected void init(DataBroker db, Tenant tenant) {
    this.db = db;
    this.tenantId = tenant.getTenantId();

    // Load Stored DPNs from the Tenant
    FpcTopology topo = tenant.getFpcTopology();
    if (topo != null) {
         for (Dpns dpns : (topo.getDpns() == null) ? Collections.<Dpns>emptyList() : topo.getDpns()) {
            try {
                LOG.info("Loading DPN {} from Storage for Tenant {}", tenantId, dpns.getDpnId());
                addDpn(dpns);
            } catch (Exception e) {
                LOG.error("DpnResourceManager - Error during DPN load for Tenant {} / DPN {} ", tenantId,
                        dpns.getDpnId());
                ErrorLog.logError(e.getStackTrace());
            }
        }
    }
}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:25,代码来源:DpnResourceManager.java

示例4: init

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
/**
 * Initialization function.
 * @param db - Data Broker
 * @param tenantMgr - Tenant Manager the Assignment Manager is bound to
 */
public void init(DataBroker db,
                TenantManager tenantMgr) {
    accessAndRoleToDpnGroups = new HashMap<PeerIpAcessRoleKey, Set<String>>();
    dpnGroupsToDpns = new HashMap<String, Set<String>>();
    remoteIpAddressToDpnGroups = new HashMap<PeerIpAcessRoleKey, Set<String>>();
    super.init(db, tenantMgr.getTenant());

    // Load Stored DPNs
    if (tenantMgr.getTenant().getFpcTopology() != null) {
        for (DpnGroups group : (tenantMgr.getTenant().getFpcTopology().getDpnGroups() == null) ?
                Collections.<DpnGroups>emptyList() : tenantMgr.getTenant().getFpcTopology().getDpnGroups()) {
            try {
                loadDpnGroup(group);
            } catch (Exception e) {
                LOG.error("DpnAssignmentMgr - Error during DPN load for " + group.getDpnGroupId());
                ErrorLog.logError(e.getStackTrace());
            }
        }
    }
}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:26,代码来源:DpnAssignmentMgr.java

示例5: retrieveInitialAppConfig

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
private void retrieveInitialAppConfig(final DataBroker dataBroker) {
    LOG.debug("{}: Got DataBroker instance - reading app config {}", logName(), bindingContext.appConfigPath);

    setDependencyDesc("Initial app config " + bindingContext.appConfigBindingClass.getSimpleName());

    // We register a DTCL to get updates and also read the app config data from the data store. If
    // the app config data is present then both the read and initial DTCN update will return it. If the
    // the data isn't present, we won't get an initial DTCN update so the read will indicate the data
    // isn't present.

    DataTreeIdentifier<DataObject> dataTreeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION,
            bindingContext.appConfigPath);
    appConfigChangeListenerReg = dataBroker.registerDataTreeChangeListener(dataTreeId,
            (ClusteredDataTreeChangeListener<DataObject>) this::onAppConfigChanged);

    readInitialAppConfig(dataBroker);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DataStoreAppConfigMetadata.java

示例6: testSeparateWrites

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@Test
public void testSeparateWrites() throws InterruptedException, TimeoutException, ExecutionException {

    DataBroker dataBroker = testContext.getDataBroker();

    final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject>> eventFuture =
            SettableFuture.create();
    dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, DEEP_WILDCARDED_PATH,
        dataChangeEvent -> eventFuture.set(dataChangeEvent), DataChangeScope.SUBTREE);

    final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_0_CWU_PATH, CWU, true);
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_0_LVU_PATH, LVU, true);
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_1_LVU_PATH, LVU, true);
    transaction.submit().get(5, TimeUnit.SECONDS);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = eventFuture.get(1000, TimeUnit.MILLISECONDS);

    validateEvent(event);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:WildcardedDataChangeListenerTest.java

示例7: deleteChildListenParent

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@Test
public void deleteChildListenParent() throws InterruptedException, ExecutionException, TimeoutException {
    DataBroker dataBroker = testContext.getDataBroker();
    final WriteTransaction initTx = dataBroker.newWriteOnlyTransaction();

    initTx.put(LogicalDatastoreType.OPERATIONAL, LIST11_PATH, createList11(), true);
    initTx.submit().get(5, TimeUnit.SECONDS);

    final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject>> event = SettableFuture.create();
    dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, LIST11_PATH,
        change -> event.set(change), DataChangeScope.SUBTREE);

    final WriteTransaction deleteTx = dataBroker.newWriteOnlyTransaction();
    deleteTx.delete(LogicalDatastoreType.OPERATIONAL, LIST11_PATH.augmentation(List11SimpleAugment.class));
    deleteTx.submit().get(5, TimeUnit.SECONDS);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> receivedEvent = event.get();
    assertFalse(receivedEvent.getRemovedPaths().contains(TLL_COMPLEX_AUGMENT_PATH));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:DeleteNestedAugmentationListenParentTest.java

示例8: setUp

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    NotificationPattern notificationPattern = new NotificationPattern("value1");
    eventSourceServiceMock = mock(EventSourceService.class);
    eventSourceTopologyMock = mock(EventSourceTopology.class);
    dataBrokerMock = mock(DataBroker.class);
    doReturn(eventSourceServiceMock).when(eventSourceTopologyMock).getEventSourceService();
    doReturn(dataBrokerMock).when(eventSourceTopologyMock).getDataBroker();

    WriteTransaction writeTransactionMock = mock(WriteTransaction.class);
    doReturn(writeTransactionMock).when(dataBrokerMock).newWriteOnlyTransaction();
    doNothing().when(writeTransactionMock).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(DataObject.class),eq(true));
    CheckedFuture checkedFutureWriteMock = mock(CheckedFuture.class);
    doReturn(checkedFutureWriteMock).when(writeTransactionMock).submit();

    ReadOnlyTransaction readOnlyTransactionMock = mock(ReadOnlyTransaction.class);
    doReturn(readOnlyTransactionMock).when(dataBrokerMock).newReadOnlyTransaction();
    CheckedFuture checkedFutureReadMock = mock(CheckedFuture.class);
    doReturn(checkedFutureReadMock).when(readOnlyTransactionMock).read(LogicalDatastoreType.OPERATIONAL, EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH);
    eventSourceTopic = EventSourceTopic.create(notificationPattern, "nodeIdPattern1", eventSourceTopologyMock);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:22,代码来源:EventSourceTopicTest.java

示例9: testDataTreeChangeListener

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataTreeChangeListener() throws Exception {
    DataBroker dataBroker = getDataBroker();

    DataTreeChangeListener<ListItem> listener = mock(DataTreeChangeListener.class);
    InstanceIdentifier<ListItem> wildCard = InstanceIdentifier.builder(ListenerTest.class)
            .child(ListItem.class).build();
    ListenerRegistration<DataTreeChangeListener<ListItem>> reg = dataBroker.registerDataTreeChangeListener(
            new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, wildCard), listener);

    final ListItem item = writeListItem();

    ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);

    verify(listener, timeout(100)).onDataTreeChanged(captor.capture());

    Collection<DataTreeModification<ListItem>> mods = captor.getValue();
    assertEquals("ListItem", item, mods.iterator().next().getRootNode().getDataAfter());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:Bug4513Test.java

示例10: getDataBroker

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@SuppressWarnings({ "checkstyle:IllegalCatch", "checkstyle:IllegalThrows" })
public DataBroker getDataBroker() throws RuntimeException {
    try {
        // This is a little bit "upside down" - in the future,
        // we should probably put what is in AbstractDataBrokerTest
        // into this DataBrokerTestModule, and make AbstractDataBrokerTest
        // use it, instead of the way around it currently is (the opposite);
        // this is just for historical reasons... and works for now.
        ConstantSchemaAbstractDataBrokerTest dataBrokerTest
            = new ConstantSchemaAbstractDataBrokerTest(useMTDataTreeChangeListenerExecutor);
        dataBrokerTest.setup();
        return dataBrokerTest.getDataBroker();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:DataBrokerTestModule.java

示例11: testToasterInitOnStartUp

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@Test
public void testToasterInitOnStartUp() throws Exception {
    DataBroker broker = getDataBroker();

    ReadOnlyTransaction readTx = broker.newReadOnlyTransaction();
    Optional<Toaster> optional = readTx.read(LogicalDatastoreType.OPERATIONAL, TOASTER_IID).get();
    assertNotNull(optional);
    assertTrue("Operational toaster not present", optional.isPresent());

    Toaster toasterData = optional.get();

    assertEquals(Toaster.ToasterStatus.Up, toasterData.getToasterStatus());
    assertEquals(new DisplayString("Opendaylight"), toasterData.getToasterManufacturer());
    assertEquals(new DisplayString("Model 1 - Binding Aware"), toasterData.getToasterModelNumber());

    Optional<Toaster> configToaster = readTx.read(LogicalDatastoreType.CONFIGURATION, TOASTER_IID).get();
    assertFalse("Didn't expect config data for toaster.", configToaster.isPresent());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:OpenDaylightToasterTest.java

示例12: unbindService

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
static void unbindService(DataBroker dataBroker, final String vpnInterfaceName, boolean isInterfaceStateDown,
        JobCoordinator jobCoordinator) {
    if (!isInterfaceStateDown) {
        jobCoordinator.enqueueJob(vpnInterfaceName,
            () -> {
                WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
                writeTxn.delete(LogicalDatastoreType.CONFIGURATION,
                        InterfaceUtils.buildServiceId(vpnInterfaceName,
                                ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME,
                                        NwConstants.L3VPN_SERVICE_INDEX)));

                List<ListenableFuture<Void>> futures = new ArrayList<>();
                futures.add(writeTxn.submit());
                return futures;
            });
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:18,代码来源:VpnUtil.java

示例13: getDpnsForRouter

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@Nonnull
public static List<BigInteger> getDpnsForRouter(DataBroker dataBroker, String routerUuid) {
    InstanceIdentifier id = InstanceIdentifier.builder(NeutronRouterDpns.class)
        .child(RouterDpnList.class, new RouterDpnListKey(routerUuid)).build();
    Optional<RouterDpnList> routerDpnListData =
            SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
                    LogicalDatastoreType.OPERATIONAL, id);
    List<BigInteger> dpns = new ArrayList<>();
    if (routerDpnListData.isPresent()) {
        List<DpnVpninterfacesList> dpnVpninterfacesList = routerDpnListData.get().getDpnVpninterfacesList();
        for (DpnVpninterfacesList dpnVpnInterface : dpnVpninterfacesList) {
            dpns.add(dpnVpnInterface.getDpnId());
        }
    }
    return dpns;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:17,代码来源:NatUtil.java

示例14: QosAlertManager

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
@Inject
public QosAlertManager(final DataBroker dataBroker,
        final OpendaylightDirectStatisticsService odlDirectStatisticsService, final QosalertConfig defaultConfig,
        final QosNeutronUtils qosNeutronUtils, final QosEosHandler qosEosHandler,
        final INeutronVpnManager neutronVpnManager) {

    LOG.debug("{} created",  getClass().getSimpleName());
    this.dataBroker = dataBroker;
    this.odlDirectStatisticsService = odlDirectStatisticsService;
    this.defaultConfig = defaultConfig;
    this.qosNeutronUtils = qosNeutronUtils;
    this.qosEosHandler = qosEosHandler;
    this.neutronVpnManager = neutronVpnManager;
    LOG.debug("QosAlert default config poll alertEnabled:{} threshold:{} pollInterval:{}",
            defaultConfig.isQosAlertEnabled(), defaultConfig.getQosDropPacketThreshold(),
            defaultConfig.getQosAlertPollInterval());
    getDefaultConfig();
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:19,代码来源:QosAlertManager.java

示例15: createElanInstanceForTheFirstPodInTheNetwork

import org.opendaylight.controller.md.sal.binding.api.DataBroker; //导入依赖的package包/类
public static ElanInstance createElanInstanceForTheFirstPodInTheNetwork(String networkNS, String nodeIp,
                                             org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.pod
                                                     .rev170611.pod_attributes.Interface podInterface,
                                             WriteTransaction wrtConfigTxn, DataBroker dataBroker) {
    String elanInstanceName = buildElanInstanceName(nodeIp, networkNS);
    InstanceIdentifier<ElanInstance> id = createElanInstanceIdentifier(elanInstanceName);
    Optional<ElanInstance> existingElanInstance = MDSALUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION,
            id);
    if (existingElanInstance.isPresent()) {
        return existingElanInstance.get();
    }
    Class<? extends SegmentTypeBase> segmentType = getSegmentTypeFromNetwork(podInterface);
    String segmentationId = String.valueOf(podInterface.getSegmentationId());
    //FIXME String physicalNetworkName = ??
    // TODO external network support not added currently
    Boolean isExternal = false;
    ElanInstance elanInstance = CoeUtils.buildElanInstance(elanInstanceName, segmentType,
            segmentationId, isExternal);
    wrtConfigTxn.put(LogicalDatastoreType.CONFIGURATION, id, elanInstance);
    LOG.info("ELAN instance created for the first pod in the network {}", podInterface.getUid());
    return elanInstance;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:23,代码来源:CoeUtils.java


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