Search in sources :

Example 1 with OperationalStatus

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.OperationalStatus in project bgpcep by opendaylight.

the class Stateful07TopologySessionListener method ensureLspOperational.

@Override
public synchronized ListenableFuture<OperationResult> ensureLspOperational(@Nonnull final EnsureLspOperationalInput input) {
    Preconditions.checkArgument(input != null && input.getName() != null && input.getNode() != null && input.getArguments() != null, MISSING_XML_TAG);
    final OperationalStatus op;
    final Arguments1 aa = input.getArguments().getAugmentation(Arguments1.class);
    if (aa != null) {
        op = aa.getOperational();
    } else {
        op = null;
    }
    // Make sure the LSP exists
    final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
    LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
    final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
    if (f == null) {
        return OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future();
    }
    return listenableFuture(f, input, op);
}
Also used : ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) Optional(com.google.common.base.Optional) OperationalStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.OperationalStatus) Arguments1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments1)

Example 2 with OperationalStatus

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.OperationalStatus 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)

Aggregations

Optional (com.google.common.base.Optional)1 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)1 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)1 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)1 Arguments1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments1)1 OperationalStatus (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.OperationalStatus)1 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp)1