use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method setUp.
@Before
public void setUp() throws Exception {
aclStatsService = new AclLiveStatisticsRpcServiceImpl(config, dataBroker, odlDirectStatsService);
singleTransactionDataBroker = new SingleTransactionDataBroker(dataBroker);
LOG.info("Acl mode: {}", config.getSecurityGroupMode());
newElan(ELAN, ELAN_TAG);
newElanInterface(ELAN, PORT_1, true);
Pair<DataTreeIdentifier<Interface>, Interface> port1 = new IdentifiedInterfaceWithAclBuilder().interfaceName(PORT_1).portSecurity(true).build();
dataBrokerUtil.put(port1);
testInterfaceManager.addInterface(port1.getValue());
putNewStateInterface(dataBroker, "port1", PORT_MAC_1);
asyncEventsWaiter.awaitEventsConsumption();
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class LLDPPacketPuntEnforcer method start.
@SuppressWarnings("IllegalCatch")
public void start() {
final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> identifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, path);
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
try {
listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(identifier, LLDPPacketPuntEnforcer.this));
} catch (Exception e) {
throw new IllegalStateException("registerDataTreeChangeListener failed", e);
}
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class DeviceMastershipManager method registerNodeListener.
@SuppressWarnings("IllegalCatch")
private void registerNodeListener() {
final InstanceIdentifier<FlowCapableNode> flowNodeWildCardIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, flowNodeWildCardIdentifier);
try {
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK, ForwardingRulesManagerImpl.STARTUP_LOOP_MAX_RETRIES);
listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(treeId, DeviceMastershipManager.this));
} catch (Exception e) {
LOG.warn("Data listener registration failed: {}", e.getMessage());
LOG.debug("Data listener registration failed ", e);
throw new IllegalStateException("Node listener registration failed!", e);
}
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class SimplifiedConfigListenerTest method setUp.
@Before
public void setUp() throws Exception {
final DataBroker db = Mockito.mock(DataBroker.class);
final FlowCapableNodeSnapshotDao configSnapshot = new FlowCapableNodeSnapshotDao();
final FlowCapableNodeSnapshotDao operationalSnapshot = new FlowCapableNodeSnapshotDao();
final FlowCapableNodeDao operationalDao = new FlowCapableNodeCachedDao(operationalSnapshot, new FlowCapableNodeOdlDao(db, LogicalDatastoreType.OPERATIONAL));
nodeListenerConfig = new SimplifiedConfigListener(reactor, configSnapshot, operationalDao);
fcNodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID)).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, fcNodePath);
Mockito.when(db.newReadOnlyTransaction()).thenReturn(roTx);
Mockito.when(dataTreeModification.getRootPath()).thenReturn(dataTreeIdentifier);
Mockito.when(dataTreeModification.getRootNode()).thenReturn(configModification);
}
use of org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier in project openflowplugin by opendaylight.
the class DefaultConfigPusher method start.
@SuppressWarnings("checkstyle:IllegalCatch")
public void start() {
try {
final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> identifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, path);
final SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(identifier, DefaultConfigPusher.this));
} catch (Exception e) {
LOG.error("DataTreeChangeListener registration failed: {}", e);
throw new IllegalStateException("DefaultConfigPusher startup failed!", e);
}
LOG.info("DefaultConfigPusher has started.");
}
Aggregations