These instance identifiers are expected to be short-lived, so use the
appropriate utility child() method instead.
Change-Id: I23a6e6d33fec7b904794ac38ff153b4d46063858
Signed-off-by: Robert Varga <rovarga@cisco.com>
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
* Creates an Instance Identifier (path) for node with specified id
/**
* Creates an Instance Identifier (path) for node with specified id
* @param nodeId
* @return
*/
* @param nodeId
* @return
*/
- public static final InstanceIdentifier<Node> createNodePath(NodeId nodeId) {
+ public static final InstanceIdentifier<Node> createNodePath(final NodeId nodeId) {
return InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(nodeId))
.build();
return InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(nodeId))
.build();
/**
* Shorten's node child path to node path.
/**
* Shorten's node child path to node path.
* @param nodeChild child of node, from which we want node path.
* @return
*/
* @param nodeChild child of node, from which we want node path.
* @return
*/
- public static final InstanceIdentifier<Node> getNodePath(InstanceIdentifier<?> nodeChild) {
+ public static final InstanceIdentifier<Node> getNodePath(final InstanceIdentifier<?> nodeChild) {
return nodeChild.firstIdentifierOf(Node.class);
}
return nodeChild.firstIdentifierOf(Node.class);
}
/**
* Creates a table path by appending table specific location to node path
/**
* Creates a table path by appending table specific location to node path
* @param nodePath
* @param tableKey
* @return
*/
* @param nodePath
* @param tableKey
* @return
*/
- public static final InstanceIdentifier<Table> createTablePath(InstanceIdentifier<Node> nodePath,TableKey tableKey) {
- return InstanceIdentifier.builder(nodePath)
- .augmentation(FlowCapableNode.class)
- .child(Table.class, tableKey)
- .build();
+ public static final InstanceIdentifier<Table> createTablePath(final InstanceIdentifier<Node> nodePath,final TableKey tableKey) {
+ return nodePath.augmentation(FlowCapableNode.class).child(Table.class, tableKey);
}
/**
* Creates a path for particular flow, by appending flow-specific information
* to table path.
}
/**
* Creates a path for particular flow, by appending flow-specific information
* to table path.
* @param tablePath
* @param flowKey
* @return path to flow
*/
* @param tablePath
* @param flowKey
* @return path to flow
*/
- public static InstanceIdentifier<Flow> createFlowPath(InstanceIdentifier<Table> tablePath, FlowKey flowKey) {
- return InstanceIdentifier.builder(tablePath)
- .child(Flow.class, flowKey)
- .build();
+ public static InstanceIdentifier<Flow> createFlowPath(final InstanceIdentifier<Table> tablePath, final FlowKey flowKey) {
+ return tablePath.child(Flow.class, flowKey);
}
/**
* Extract table id from table path.
}
/**
* Extract table id from table path.
* @param tablePath
* @return
*/
* @param tablePath
* @return
*/
- public static Short getTableId(InstanceIdentifier<Table> tablePath) {
+ public static Short getTableId(final InstanceIdentifier<Table> tablePath) {
return tablePath.firstKeyOf(Table.class, TableKey.class).getId();
}
return tablePath.firstKeyOf(Table.class, TableKey.class).getId();
}
/**
* Extracts NodeConnectorKey from node connector path.
/**
* Extracts NodeConnectorKey from node connector path.
- public static NodeConnectorKey getNodeConnectorKey(InstanceIdentifier<?> nodeConnectorPath) {
+ public static NodeConnectorKey getNodeConnectorKey(final InstanceIdentifier<?> nodeConnectorPath) {
return nodeConnectorPath.firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
}
return nodeConnectorPath.firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
}
- public static final InstanceIdentifier<NodeConnector> createNodeConnectorPath(InstanceIdentifier<Node> nodeKey,NodeConnectorKey nodeConnectorKey) {
- return InstanceIdentifier.builder(nodeKey)
- .child(NodeConnector.class,nodeConnectorKey)
- .build();
+ public static final InstanceIdentifier<NodeConnector> createNodeConnectorPath(final InstanceIdentifier<Node> nodeKey,final NodeConnectorKey nodeConnectorKey) {
+ return nodeKey.child(NodeConnector.class,nodeConnectorKey);
* @param payload
* @return destination MAC address
*/
* @param payload
* @return destination MAC address
*/
- public static byte[] extractDstMac(byte[] payload) {
+ public static byte[] extractDstMac(final byte[] payload) {
return Arrays.copyOfRange(payload, DST_MAC_START_POSITION, DST_MAC_END_POSITION);
}
return Arrays.copyOfRange(payload, DST_MAC_START_POSITION, DST_MAC_END_POSITION);
}
* @param payload
* @return source MAC address
*/
* @param payload
* @return source MAC address
*/
- public static byte[] extractSrcMac(byte[] payload) {
+ public static byte[] extractSrcMac(final byte[] payload) {
return Arrays.copyOfRange(payload, SRC_MAC_START_POSITION, SRC_MAC_END_POSITION);
}
return Arrays.copyOfRange(payload, SRC_MAC_START_POSITION, SRC_MAC_END_POSITION);
}
* @param payload
* @return source MAC address
*/
* @param payload
* @return source MAC address
*/
- public static byte[] extractEtherType(byte[] payload) {
+ public static byte[] extractEtherType(final byte[] payload) {
return Arrays.copyOfRange(payload, ETHER_TYPE_START_POSITION, ETHER_TYPE_END_POSITION);
}
return Arrays.copyOfRange(payload, ETHER_TYPE_START_POSITION, ETHER_TYPE_END_POSITION);
}
* @return {@link MacAddress} wrapping string value, baked upon binary MAC
* address
*/
* @return {@link MacAddress} wrapping string value, baked upon binary MAC
* address
*/
- public static MacAddress rawMacToMac(byte[] rawMac) {
+ public static MacAddress rawMacToMac(final byte[] rawMac) {
MacAddress mac = null;
if (rawMac != null && rawMac.length == MAC_ADDRESS_SIZE) {
StringBuilder sb = new StringBuilder();
MacAddress mac = null;
if (rawMac != null && rawMac.length == MAC_ADDRESS_SIZE) {
StringBuilder sb = new StringBuilder();
* @param port
* @return port wrapped into {@link NodeConnectorRef}
*/
* @param port
* @return port wrapped into {@link NodeConnectorRef}
*/
- public static NodeConnectorRef createNodeConnRef(InstanceIdentifier<Node> nodeInstId, NodeKey nodeKey, String port) {
- StringBuilder sBuild = new StringBuilder(nodeKey.getId().getValue()).append(":").append(port);
+ public static NodeConnectorRef createNodeConnRef(final InstanceIdentifier<Node> nodeInstId, final NodeKey nodeKey, final String port) {
+ StringBuilder sBuild = new StringBuilder(nodeKey.getId().getValue()).append(':').append(port);
NodeConnectorKey nConKey = new NodeConnectorKey(new NodeConnectorId(sBuild.toString()));
NodeConnectorKey nConKey = new NodeConnectorKey(new NodeConnectorId(sBuild.toString()));
- InstanceIdentifier<NodeConnector> portPath = InstanceIdentifier.builder(nodeInstId)
- .child(NodeConnector.class, nConKey).build();
+ InstanceIdentifier<NodeConnector> portPath = nodeInstId.child(NodeConnector.class, nConKey);
return new NodeConnectorRef(portPath);
}
}
return new NodeConnectorRef(portPath);
}
}