use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project netvirt by opendaylight.
the class Ipv6NodeListener method add.
@Override
protected void add(InstanceIdentifier<FlowCapableNode> key, FlowCapableNode dataObjectModification) {
LOG.trace("FlowCapableNode Added: key: {}", key);
NodeKey nodeKey = key.firstKeyOf(Node.class);
BigInteger dpnId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
createTableMissEntry(dpnId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project netvirt by opendaylight.
the class AclNodeListener method add.
@Override
protected void add(InstanceIdentifier<FlowCapableNode> key, FlowCapableNode dataObjectModification) {
NodeKey nodeKey = key.firstKeyOf(Node.class);
BigInteger dpId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
LOG.info("Received ACL node [{}] add event", dpId);
if (securityGroupMode != null && securityGroupMode != SecurityGroupMode.Stateful) {
LOG.error("Invalid security group mode ({}) obtained from AclserviceConfig. dpId={}", securityGroupMode, dpId);
return;
}
jobCoordinator.enqueueJob(String.valueOf(dpId), () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
new AclNodeDefaultFlowsTxBuilder(dpId, mdsalManager, config, tx).build();
LOG.info("Adding default ACL flows for dpId={}", dpId);
})), AclConstants.JOB_MAX_RETRIES);
LOG.trace("FlowCapableNode (dpid: {}) add event is processed.", dpId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project netvirt by opendaylight.
the class QosNodeListener method add.
@Override
protected void add(InstanceIdentifier<FlowCapableNode> key, FlowCapableNode dataObjectModification) {
NodeKey nodeKey = key.firstKeyOf(Node.class);
BigInteger dpId = MDSALUtil.getDpnIdFromNodeName(nodeKey.getId());
createTableMissEntry(dpId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project openflowplugin by opendaylight.
the class ShellUtil method getNodeInfo.
public static OFNode getNodeInfo(final Long nodeId, final DataBroker broker) {
OFNode ofNode = null;
ReadOnlyTransaction tx = broker.newReadOnlyTransaction();
InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_PREFIX + nodeId))).build();
Optional<Node> result;
try {
CheckedFuture<Optional<Node>, ReadFailedException> checkedFuture = tx.read(LogicalDatastoreType.OPERATIONAL, path);
result = checkedFuture.get();
if (result.isPresent()) {
Node node = result.get();
String name = null;
List<NodeConnector> nodeConnectors = null;
List<String> portList = new ArrayList<>();
FlowCapableNode flowCapableNode = node.<FlowCapableNode>getAugmentation(FlowCapableNode.class);
if (flowCapableNode != null) {
name = node.<FlowCapableNode>getAugmentation(FlowCapableNode.class).getDescription();
} else {
LOG.error("Error while converting OFNode:{} to FlowCapableNode: {}", node.getId());
return null;
}
nodeConnectors = node.getNodeConnector();
for (NodeConnector nodeConnector : nodeConnectors) {
FlowCapableNodeConnector flowCapableNodeConnector = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);
if (flowCapableNodeConnector == null) {
LOG.error("Error for OFNode:{} while reading nodeConnectors {}", node.getId());
return null;
} else {
String portName = flowCapableNodeConnector.getName();
portList.add(portName);
}
}
ofNode = new OFNode(nodeId, name, portList);
} else {
LOG.error("OFNode with nodeId {} not present Inventory DS: {}", nodeId);
return null;
}
} catch (ExecutionException | InterruptedException e) {
LOG.error("Error reading node {} from Inventory DS: {}", nodeId, e);
}
return ofNode;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project openflowplugin by opendaylight.
the class ShellUtil method getAllNodes.
@Nonnull
public static List<OFNode> getAllNodes(final DataBroker broker) {
List<Node> nodes = null;
ReadOnlyTransaction tx = broker.newReadOnlyTransaction();
InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).build();
try {
CheckedFuture<Optional<Nodes>, ReadFailedException> checkedFuture = tx.read(LogicalDatastoreType.OPERATIONAL, path);
Optional<Nodes> result = checkedFuture.get();
if (result.isPresent()) {
nodes = result.get().getNode();
}
} catch (ExecutionException | InterruptedException | NullPointerException e) {
LOG.error("Error reading nodes from Inventory DS", e);
}
if (nodes != null) {
List<OFNode> nodeList = new ArrayList<>();
for (Node node : nodes) {
String[] nodeId = node.getId().getValue().split(":");
String name = null;
FlowCapableNode flowCapableNode = node.<FlowCapableNode>getAugmentation(FlowCapableNode.class);
if (flowCapableNode != null) {
name = node.<FlowCapableNode>getAugmentation(FlowCapableNode.class).getDescription();
} else {
LOG.error("Error while converting OFNode: {} to FlowCapableNode", node.getId());
return Collections.emptyList();
}
OFNode ofNode = new OFNode(Long.parseLong(nodeId[1]), name);
LOG.trace("Added OFNode: {} to the list", ofNode.getNodeId());
nodeList.add(ofNode);
}
Collections.sort(nodeList);
return nodeList;
}
return Collections.emptyList();
}
Aggregations