use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project netvirt by opendaylight.
the class GeniusProvider method getNodeConnectorIdFromInterfaceName.
public Optional<String> getNodeConnectorIdFromInterfaceName(String interfaceName) {
LOG.debug("getDpnIdFromInterfaceName: starting (logical interface={})", interfaceName);
GetNodeconnectorIdFromInterfaceInputBuilder builder = new GetNodeconnectorIdFromInterfaceInputBuilder();
builder.setIntfName(interfaceName);
GetNodeconnectorIdFromInterfaceInput input = builder.build();
if (interfaceManagerRpcService == null) {
LOG.error("getNodeConnectorIdFromInterfaceName({}) failed (service couldn't be retrieved)", input);
return Optional.empty();
}
try {
LOG.debug("getNodeConnectorIdFromInterfaceName: invoking rpc");
RpcResult<GetNodeconnectorIdFromInterfaceOutput> output = interfaceManagerRpcService.getNodeconnectorIdFromInterface(input).get();
if (!output.isSuccessful()) {
LOG.error("getNodeConnectorIdFromInterfaceName({}) failed: {}", input, output);
return Optional.empty();
}
NodeConnectorId nodeConnId = output.getResult().getNodeconnectorId();
if (nodeConnId == null) {
return Optional.empty();
}
LOG.debug("getNodeConnectorIdFromInterfaceName({}) succeeded: {}", input, output);
return Optional.ofNullable(nodeConnId.getValue());
} catch (InterruptedException | ExecutionException e) {
LOG.error("getNodeConnectorIdFromInterfaceName failed to retrieve target interface name: ", e);
}
return Optional.empty();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class OpenflowPluginBulkTransactionProvider method createInphyportMatch.
private static MatchBuilder createInphyportMatch(NodeId nodeId) {
MatchBuilder match = new MatchBuilder();
match.setInPort(new NodeConnectorId(nodeId + ":202"));
match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class LearningSwitchHandlerSimpleImpl method flood.
private void flood(byte[] payload, NodeConnectorRef ingress) {
NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(nodeConnectorId("0xfffffffb"));
InstanceIdentifier<?> nodeConnectorPath = InstanceIdentifierUtils.createNodeConnectorPath(nodePath, nodeConnectorKey);
NodeConnectorRef egressConnectorRef = new NodeConnectorRef(nodeConnectorPath);
sendPacketOut(payload, ingress, egressConnectorRef);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class LLDPSpeaker method run.
/**
* Send LLDPDU frames to all known openflow switch ports.
*/
@Override
public void run() {
if (OperStatus.RUN.equals(operationalStatus)) {
LOG.debug("Sending LLDP frames to nodes {}", Arrays.toString(deviceOwnershipStatusService.getOwnedNodes().toArray()));
LOG.debug("Sending LLDP frames to total {} ports", getOwnedPorts());
nodeConnectorMap.keySet().forEach(ncIID -> {
NodeConnectorId nodeConnectorId = InstanceIdentifier.keyOf(ncIID).getId();
NodeId nodeId = ncIID.firstKeyOf(Node.class, NodeKey.class).getId();
if (deviceOwnershipStatusService.isEntityOwned(nodeId.getValue())) {
LOG.debug("Node is owned by this controller, sending LLDP packet through port {}", nodeConnectorId.getValue());
packetProcessingService.transmitPacket(nodeConnectorMap.get(ncIID));
} else {
LOG.trace("Node {} is not owned by this controller, so skip sending LLDP packet on port {}", nodeId.getValue(), nodeConnectorId.getValue());
}
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class LLDPSpeakerTest method setUp.
@Before
public void setUp() throws NoSuchAlgorithmException, PacketException {
byte[] lldpFrame = LLDPUtil.buildLldpFrame(new NodeId("openflow:1"), new NodeConnectorId("openflow:1:1"), MAC_ADDRESS, 1L);
packetInput = new TransmitPacketInputBuilder().setEgress(new NodeConnectorRef(ID)).setNode(new NodeRef(ID.firstIdentifierOf(Node.class))).setPayload(lldpFrame).build();
when(scheduledExecutorService.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class))).thenReturn(scheduledSpeakerTask);
lldpSpeaker = new LLDPSpeaker(packetProcessingService, scheduledExecutorService, null, entityOwnershipService);
when(entityOwnershipService.getOwnershipState(any())).thenReturn(Optional.of(EntityOwnershipState.IS_OWNER));
lldpSpeaker.setOperationalStatus(OperStatus.RUN);
doReturn(RpcResultBuilder.success().buildFuture()).when(packetProcessingService).transmitPacket(any());
}
Aggregations