use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector 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.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector 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.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector 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.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorUpdateToAdminDown.
/**
* Test that checks if {@link NodeConnectorEventsObserver#nodeConnectorRemoved} is called
* for each FlowCapableNodeConnector item with administrative down state removed in
* {@link org.opendaylight.controller.md.sal.binding.api.DataTreeModification}.
*/
@Test
public void testNodeConnectorUpdateToAdminDown() {
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(false, true).build();
DataTreeModification dataTreeModification = setupDataTreeChange(SUBTREE_MODIFIED, NODE_CONNECTOR_INSTANCE_IDENTIFIER, fcnc);
translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
verify(eventsObserver).nodeConnectorRemoved(ID);
}
Aggregations