Search in sources :

Example 11 with NodeConnectorId

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();
}
Also used : GetNodeconnectorIdFromInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceInputBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) GetNodeconnectorIdFromInterfaceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceInput) ExecutionException(java.util.concurrent.ExecutionException) GetNodeconnectorIdFromInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutput)

Example 12 with NodeConnectorId

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;
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)

Example 13 with NodeConnectorId

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);
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 14 with NodeConnectorId

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());
            }
        });
    }
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 15 with NodeConnectorId

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());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) TransmitPacketInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) TimeUnit(java.util.concurrent.TimeUnit) Before(org.junit.Before)

Aggregations

NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)86 BigInteger (java.math.BigInteger)31 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)19 NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)17 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)16 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)15 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)12 Test (org.junit.Test)11 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)11 ArrayList (java.util.ArrayList)10 Collections (java.util.Collections)10 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)9 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)9 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)8 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)8 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)7 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)7 List (java.util.List)6 ExecutionException (java.util.concurrent.ExecutionException)6 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)5