Search in sources :

Example 31 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project openflowplugin by opendaylight.

the class MeterForwarder method add.

@Override
public Future<RpcResult<AddMeterOutput>> add(final InstanceIdentifier<Meter> identifier, final Meter addDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.trace("Received the Meter ADD request [Tbl id, node Id {} {} {}", identifier, nodeIdent, addDataObj);
    final AddMeterInputBuilder builder = new AddMeterInputBuilder(addDataObj);
    builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
    builder.setMeterRef(new MeterRef(identifier));
    return salMeterService.addMeter(builder.build());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) AddMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef)

Example 32 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project openflowplugin by opendaylight.

the class DataTreeChangeListenerBase method setupDataTreeChange.

protected <T extends DataObject> DataTreeModification setupDataTreeChange(final ModificationType type, final InstanceIdentifier<T> ii) {
    final DataTreeModification dataTreeModification = mock(DataTreeModification.class);
    final DataTreeIdentifier identifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, ii);
    when(dataTreeModification.getRootNode()).thenReturn(mock(DataObjectModification.class));
    when(dataTreeModification.getRootNode().getModificationType()).thenReturn(type);
    when(dataTreeModification.getRootPath()).thenReturn(identifier);
    when(dataTreeModification.getRootNode().getDataAfter()).thenReturn(mock(FlowCapableNodeConnector.class));
    return dataTreeModification;
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) DataObjectModification(org.opendaylight.controller.md.sal.binding.api.DataObjectModification) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)

Example 33 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.

the class RMCaptureOutInterceptor method handle.

protected void handle(Message msg) throws SequenceFault, RMException {
    AddressingProperties maps = ContextUtils.retrieveMAPs(msg, false, true, false);
    if (null == maps) {
        LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG");
        return;
    }
    if (Boolean.TRUE.equals(msg.get(RMMessageConstants.RM_RETRANSMISSION))) {
        return;
    }
    if (isRuntimeFault(msg)) {
        LogUtils.log(LOG, Level.WARNING, "RUNTIME_FAULT_MSG");
        // in case of a SequenceFault or other WS-RM related fault, set action appropriately.
        // the received inbound maps is available to extract some values in case if needed.
        Throwable cause = msg.getContent(Exception.class).getCause();
        if (cause instanceof SequenceFault || cause instanceof RMException) {
            maps.getAction().setValue(getAddressingNamespace(maps) + "/fault");
        }
        return;
    }
    Source source = getManager().getSource(msg);
    RMConfiguration config = getManager().getEffectiveConfiguration(msg);
    String wsaNamespace = config.getAddressingNamespace();
    String rmNamespace = config.getRMNamespace();
    ProtocolVariation protocol = ProtocolVariation.findVariant(rmNamespace, wsaNamespace);
    RMContextUtils.setProtocolVariation(msg, protocol);
    maps.exposeAs(wsaNamespace);
    String action = null;
    if (null != maps.getAction()) {
        action = maps.getAction().getValue();
    }
    // make sure we use the appropriate namespace
    maps.exposeAs(wsaNamespace);
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Action: " + action);
    }
    boolean isApplicationMessage = !RMContextUtils.isRMProtocolMessage(action);
    boolean isPartialResponse = MessageUtils.isPartialResponse(msg);
    RMConstants constants = protocol.getConstants();
    boolean isLastMessage = RM10Constants.CLOSE_SEQUENCE_ACTION.equals(action);
    RMProperties rmpsOut = RMContextUtils.retrieveRMProperties(msg, true);
    if (null == rmpsOut) {
        rmpsOut = new RMProperties();
        rmpsOut.exposeAs(protocol.getWSRMNamespace());
        RMContextUtils.storeRMProperties(msg, rmpsOut, true);
    }
    // Activate process response for oneWay
    if (msg.getExchange().isOneWay()) {
        msg.getExchange().put(Message.PROCESS_ONEWAY_RESPONSE, true);
    }
    RMProperties rmpsIn = null;
    Identifier inSeqId = null;
    long inMessageNumber = 0;
    if (isApplicationMessage) {
        rmpsIn = RMContextUtils.retrieveRMProperties(msg, false);
        if (null != rmpsIn && null != rmpsIn.getSequence()) {
            inSeqId = rmpsIn.getSequence().getIdentifier();
            inMessageNumber = rmpsIn.getSequence().getMessageNumber();
        }
        ContextUtils.storeDeferUncorrelatedMessageAbort(msg);
    }
    Map<?, ?> invocationContext = (Map<?, ?>) msg.get(Message.INVOCATION_CONTEXT);
    if ((isApplicationMessage || (isLastMessage && invocationContext != null)) && !isPartialResponse) {
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("inbound sequence: " + (null == inSeqId ? "null" : inSeqId.getValue()));
        }
        // get the current sequence, requesting the creation of a new one if necessary
        synchronized (source) {
            final SourceSequence seq;
            if (isLastMessage) {
                seq = (SourceSequence) invocationContext.get(SourceSequence.class.getName());
            } else {
                seq = getManager().getSequence(inSeqId, msg, maps);
            }
            assert null != seq;
            // increase message number and store a sequence type object in
            // context
            seq.nextMessageNumber(inSeqId, inMessageNumber, isLastMessage);
            if (Boolean.TRUE.equals(msg.getContextualProperty(RMManager.WSRM_LAST_MESSAGE_PROPERTY))) {
                // mark the message as the last one
                seq.setLastMessage(true);
            }
            rmpsOut.setSequence(seq);
            if (seq.isLastMessage()) {
                source.setCurrent(null);
            }
        }
    } else if (!MessageUtils.isRequestor(msg) && constants.getCreateSequenceAction().equals(action)) {
        maps.getAction().setValue(constants.getCreateSequenceResponseAction());
    } else if (isPartialResponse && action == null && isResponseToAction(msg, constants.getSequenceAckAction())) {
        Collection<SequenceAcknowledgement> acks = rmpsIn != null ? rmpsIn.getAcks() : null;
        if (acks != null && acks.size() == 1) {
            SourceSequence ss = source.getSequence(acks.iterator().next().getIdentifier());
            if (ss != null && ss.allAcknowledged()) {
                setAction(maps, constants.getTerminateSequenceAction());
                setTerminateSequence(msg, ss.getIdentifier(), protocol);
                msg.remove(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE);
                // removing this sequence now. See the comment in SourceSequence.setAcknowledged()
                source.removeSequence(ss);
            }
        }
    }
    // capture message if retransmission possible
    if (isApplicationMessage && !isPartialResponse) {
        OutputStream os = msg.getContent(OutputStream.class);
        // message until connection is setup
        if (!(os instanceof WriteOnCloseOutputStream)) {
            msg.setContent(OutputStream.class, new WriteOnCloseOutputStream(os));
        }
        getManager().initializeInterceptorChain(msg);
        // doneCaptureMessage(msg);
        captureMessage(msg);
    } else if (isLastMessage) {
        // got either the rm11 CS or the rm10 empty LM
        RMStore store = getManager().getStore();
        if (null != store) {
            store.persistOutgoing(rmpsOut.getSourceSequence(), null);
        }
    }
}
Also used : WriteOnCloseOutputStream(org.apache.cxf.io.WriteOnCloseOutputStream) WriteOnCloseOutputStream(org.apache.cxf.io.WriteOnCloseOutputStream) OutputStream(java.io.OutputStream) CachedOutputStream(org.apache.cxf.io.CachedOutputStream) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) Map(java.util.Map)

Example 34 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.

the class RMOutInterceptor method addAckRequest.

/**
 * Add AcknowledgementRequested to message if needed. The AckRequest mode set either in the message
 * properties or in the source policy is used to determine whether AcknowledgementRequested is always
 * added, never added, or added only when we're waiting for the acknowledgement to a previously-sent
 * message.
 *
 * @param msg
 * @param rmpsIn
 * @param seq
 * @param sequence
 */
protected void addAckRequest(Message msg, RMProperties rmpsIn, SourceSequence seq, SequenceType sequence) {
    AckRequestModeType mode = (AckRequestModeType) msg.get(RMMessageConstants.ACK_REQUEST_MODE);
    if (mode == null) {
        mode = AckRequestModeType.PENDING;
        SourcePolicyType policy = getManager().getSourcePolicy();
        if (policy.isSetAckRequestMode()) {
            mode = policy.getAckRequestMode();
        }
    }
    if (AckRequestModeType.ALWAYS == mode || (mode == AckRequestModeType.PENDING && seq.needAcknowledge(rmpsIn.getMessageNumber()))) {
        Collection<AckRequestedType> reqs = rmpsIn.getAcksRequested();
        if (reqs == null) {
            reqs = new ArrayList<>();
        }
        Identifier identifier = new Identifier();
        identifier.setValue(sequence.getIdentifier().getValue());
        AckRequestedType ackRequest = new AckRequestedType();
        ackRequest.setIdentifier(identifier);
        reqs.add(ackRequest);
        rmpsIn.setAcksRequested(reqs);
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) AckRequestModeType(org.apache.cxf.ws.rm.manager.AckRequestModeType) SourcePolicyType(org.apache.cxf.ws.rm.manager.SourcePolicyType) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType)

Example 35 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project cxf by apache.

the class Servant method clearUnattachedIdentifier.

Identifier clearUnattachedIdentifier() {
    Identifier ret = unattachedIdentifier;
    unattachedIdentifier = null;
    return ret;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 ArrayList (java.util.ArrayList)71 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)59 Test (org.junit.Test)52 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)50 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)50 ExecutionException (java.util.concurrent.ExecutionException)38 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)37 Logger (org.slf4j.Logger)35 LoggerFactory (org.slf4j.LoggerFactory)35 Inject (javax.inject.Inject)32 Singleton (javax.inject.Singleton)32 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)32 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)32 PreDestroy (javax.annotation.PreDestroy)30 ManagedNewTransactionRunner (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner)30 ManagedNewTransactionRunnerImpl (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl)30 Executors (org.opendaylight.infrautils.utils.concurrent.Executors)28 CONFIGURATION (org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION)27 AbstractAsyncDataTreeChangeListener (org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener)26