use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.
the class MatchInPort method setMatch.
@Override
public void setMatch(MatchBuilder matchBuilder, Map<Class<?>, Object> mapMatchBuilder) {
String nodeConnectorId = "openflow:" + dpId + ":" + portNumber;
matchBuilder.setInPort(new NodeConnectorId(nodeConnectorId));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.
the class MDSALUtil method getMacAddressForNodeConnector.
// "Consider returning a zero length array rather than null" - too late to change behavior plus it's deprecated.
@Deprecated
@SuppressFBWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS")
public static byte[] getMacAddressForNodeConnector(DataBroker broker, InstanceIdentifier<NodeConnector> nodeConnectorId) throws ReadFailedException {
Optional<NodeConnector> optNc = SingleTransactionDataBroker.syncReadOptional(broker, LogicalDatastoreType.OPERATIONAL, nodeConnectorId);
if (optNc.isPresent()) {
NodeConnector nc = optNc.get();
FlowCapableNodeConnector fcnc = nc.getAugmentation(FlowCapableNodeConnector.class);
MacAddress macAddress = fcnc.getHardwareAddress();
return HexEncode.bytesFromHexString(macAddress.getValue());
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.
the class MDSALUtil method getInterfaceName.
public static String getInterfaceName(NodeConnectorRef ref, DataBroker dataBroker) {
NodeConnectorId nodeConnectorId = getNodeConnectorId(dataBroker, ref);
NodeId nodeId = getNodeIdFromNodeConnectorId(nodeConnectorId);
InstanceIdentifier<NodeConnector> ncIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(nodeId)).child(NodeConnector.class, new NodeConnectorKey(nodeConnectorId)).build();
return read(dataBroker, LogicalDatastoreType.OPERATIONAL, ncIdentifier).toJavaUtil().map(nc -> nc.getAugmentation(FlowCapableNodeConnector.class)).map(FlowCapableNodeConnector::getName).orElse(null);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.
the class MDSALManager method getNodeConnRef.
protected static NodeConnectorRef getNodeConnRef(final String nodeId, final String port) {
StringBuilder stringBuilder = new StringBuilder(nodeId);
StringBuilder append = stringBuilder.append(":");
StringBuilder build = append.append(port);
String string = build.toString();
NodeConnectorId nodeConnectorId = new NodeConnectorId(string);
NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(nodeConnectorId);
NodeConnectorKey connectorKey = nodeConnectorKey;
InstanceIdentifierBuilder<Nodes> builder = InstanceIdentifier.builder(Nodes.class);
NodeKey nodeKey = new NodeKey(new NodeId(nodeId));
InstanceIdentifierBuilder<Node> child = builder.child(Node.class, nodeKey);
InstanceIdentifierBuilder<NodeConnector> anotherChild = child.child(NodeConnector.class, connectorKey);
InstanceIdentifier<NodeConnector> path = anotherChild.toInstance();
NodeConnectorRef nodeConnectorRef = new NodeConnectorRef(path);
return nodeConnectorRef;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project genius by opendaylight.
the class DirectTunnelUtils method isNodePresent.
public boolean isNodePresent(NodeConnectorId nodeConnectorId) throws ReadFailedException {
NodeId nodeID = getNodeIdFromNodeConnectorId(nodeConnectorId);
InstanceIdentifier<Node> nodeInstanceIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(nodeID)).build();
return SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, nodeInstanceIdentifier).isPresent();
}
Aggregations