use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project openflowplugin by opendaylight.
the class LearningSwitchHandlerSimpleImpl method onSwitchAppeared.
@Override
public synchronized void onSwitchAppeared(InstanceIdentifier<Table> appearedTablePath) {
if (isLearning) {
LOG.debug("already learning a node, skipping {}", nodeId.getValue());
return;
}
LOG.debug("expected table acquired, learning ..");
// disable listening - simple learning handles only one node (switch)
if (registrationPublisher != null) {
LOG.debug("closing dataTreeChangeListenerRegistration");
registrationPublisher.getDataTreeChangeListenerRegistration().close();
}
isLearning = true;
tablePath = appearedTablePath;
nodePath = tablePath.firstIdentifierOf(Node.class);
nodeId = nodePath.firstKeyOf(Node.class, NodeKey.class).getId();
mac2portMapping = new HashMap<>();
// start forwarding all packages to controller
FlowId flowId = new FlowId(String.valueOf(flowIdInc.getAndIncrement()));
FlowKey flowKey = new FlowKey(flowId);
InstanceIdentifier<Flow> flowPath = InstanceIdentifierUtils.createFlowPath(tablePath, flowKey);
int priority = 0;
// create flow in table with id = 0, priority = 4 (other params are
// defaulted in OFDataStoreUtil)
FlowBuilder allToCtrlFlow = FlowUtils.createFwdAllToControllerFlow(InstanceIdentifierUtils.getTableId(tablePath), priority, flowId);
LOG.debug("writing packetForwardToController flow");
dataStoreAccessor.writeFlowToConfig(flowPath, allToCtrlFlow.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project controller by opendaylight.
the class EventSourceTopologyTest method closeTest.
@Test
public void closeTest() throws Exception {
constructorTestHelper();
topicTestHelper();
Map<TopicId, EventSourceTopic> localMap = getEventSourceTopicMap();
TopicId topicIdMock = mock(TopicId.class);
EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"), "pattern", eventSourceTopology);
localMap.put(topicIdMock, eventSourceTopic);
eventSourceTopology.close();
verify(aggregatorRpcReg, times(1)).close();
verify(listenerRegistrationMock, times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project controller by opendaylight.
the class EventSourceTopologyTest method unregisterTest.
@Test
public void unregisterTest() throws Exception {
topicTestHelper();
EventSource eventSourceMock = mock(EventSource.class);
NodeId nodeId = new NodeId("nodeIdValue1");
nodeKey = new NodeKey(nodeId);
Map<NodeKey, BindingAwareBroker.RoutedRpcRegistration<EventSourceService>> localMap = getRoutedRpcRegistrations();
NodeKey nodeKeyMock = mock(NodeKey.class);
doReturn(nodeKeyMock).when(eventSourceMock).getSourceNodeKey();
BindingAwareBroker.RoutedRpcRegistration<EventSourceService> routedRpcRegistrationMock = mock(BindingAwareBroker.RoutedRpcRegistration.class);
localMap.put(nodeKeyMock, routedRpcRegistrationMock);
eventSourceTopology.unRegister(eventSourceMock);
verify(routedRpcRegistrationMock, times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project controller by opendaylight.
the class EventSourceTopologyTest method destroyTopicTest.
@Test
public void destroyTopicTest() throws Exception {
topicTestHelper();
TopicId topicId = new TopicId("topic-id-007");
Map<TopicId, EventSourceTopic> localMap = getEventSourceTopicMap();
EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"), "pattern", eventSourceTopology);
localMap.put(topicId, eventSourceTopic);
DestroyTopicInput input = new DestroyTopicInputBuilder().setTopicId(topicId).build();
eventSourceTopology.destroyTopic(input);
verify(listenerRegistrationMock, times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project controller by opendaylight.
the class TxchainBaWrite method executeList.
@Override
public void executeList() {
final BindingTransactionChain chain = bindingDataBroker.createTransactionChain(this);
final LogicalDatastoreType dsType = getDataStoreType();
WriteTransaction tx = chain.newWriteOnlyTransaction();
int txSubmitted = 0;
int writeCnt = 0;
for (OuterList element : this.list) {
InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class).child(OuterList.class, element.getKey());
if (oper == StartTestInput.Operation.PUT) {
tx.put(dsType, iid, element);
} else {
tx.merge(dsType, iid, element);
}
writeCnt++;
if (writeCnt == writesPerTx) {
txSubmitted++;
Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
txOk++;
}
@Override
public void onFailure(final Throwable t) {
LOG.error("Transaction failed, {}", t);
txError++;
}
});
tx = chain.newWriteOnlyTransaction();
writeCnt = 0;
}
}
// We need to empty the transaction chain before closing it
try {
txSubmitted++;
tx.submit().checkedGet();
txOk++;
} catch (final TransactionCommitFailedException e) {
LOG.error("Transaction failed", e);
txError++;
}
try {
chain.close();
} catch (final IllegalStateException e) {
LOG.error("Transaction close failed,", e);
}
LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
}
Aggregations