use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project bgpcep by opendaylight.
the class PCEPSessionImpl method close.
/**
* Closes PCEP session, cancels all timers, returns to state Idle, sends the Close Message. KeepAlive and DeadTimer
* are cancelled if the state of the session changes to IDLE. This method is used to close the PCEP session from
* inside the session or from the listener, therefore the parent of this session should be informed.
*/
@Override
public synchronized void close(final TerminationReason reason) {
if (this.closed.getAndSet(true)) {
LOG.debug("Session is already closed.");
return;
}
// only send close message when the reason is provided
if (reason != null) {
LOG.info("Closing PCEP session with reason {}: {}", reason, this);
sendMessage(new CloseBuilder().setCCloseMessage(new CCloseMessageBuilder().setCClose(new CCloseBuilder().setReason(reason.getShortValue()).build()).build()).build());
} else {
LOG.info("Closing PCEP session: {}", this);
}
closeChannel();
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslator method processUpdatedConnector.
private void processUpdatedConnector(final DataTreeModification<T> modification) {
final InstanceIdentifier<T> identifier = modification.getRootPath().getRootIdentifier();
InstanceIdentifier<NodeConnector> nodeConnectorInstanceId = identifier.firstIdentifierOf(NodeConnector.class);
if (compareIITail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
FlowCapableNodeConnector flowConnector = (FlowCapableNodeConnector) modification.getRootNode().getDataAfter();
if (isPortDown(flowConnector)) {
notifyNodeConnectorDisappeared(nodeConnectorInstanceId);
} else {
notifyNodeConnectorAppeared(nodeConnectorInstanceId, flowConnector);
}
} else if (compareIITail(identifier, II_TO_STATE)) {
FlowCapableNodeConnector flowNodeConnector = iiToDownFlowCapableNodeConnectors.get(nodeConnectorInstanceId);
if (flowNodeConnector != null) {
State state = (State) modification.getRootNode().getDataAfter();
if (!state.isLinkDown()) {
FlowCapableNodeConnectorBuilder flowCapableNodeConnectorBuilder = new FlowCapableNodeConnectorBuilder(flowNodeConnector);
flowCapableNodeConnectorBuilder.setState(state);
notifyNodeConnectorAppeared(nodeConnectorInstanceId, flowCapableNodeConnectorBuilder.build());
iiToDownFlowCapableNodeConnectors.remove(nodeConnectorInstanceId);
}
}
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorUpdateToLinkDown.
/**
* Test that checks if {@link NodeConnectorEventsObserver#nodeConnectorRemoved} is called
* for each FlowCapableNodeConnector item that have link down state removed in
* {@link org.opendaylight.controller.md.sal.binding.api.DataTreeModification}.
*/
@Test
public void testNodeConnectorUpdateToLinkDown() {
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(true, false).build();
DataTreeModification dataTreeModification = setupDataTreeChange(SUBTREE_MODIFIED, NODE_CONNECTOR_INSTANCE_IDENTIFIER, fcnc);
translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
verify(eventsObserver).nodeConnectorRemoved(ID);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorCreationLinkDown.
/**
* Test that checks that nothing is called when port appeared in inventory in link down state.
*/
@Test
public void testNodeConnectorCreationLinkDown() {
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(true, false).build();
DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, ID, fcnc);
translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
verifyZeroInteractions(eventsObserver);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorCreationAdminDown.
/**
* Test that checks that nothing is called when port appeared in inventory in admin down state.
*/
@Test
public void testNodeConnectorCreationAdminDown() {
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(false, true).build();
DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, ID, fcnc);
translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
verifyZeroInteractions(eventsObserver);
}
Aggregations