/**
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
+ * <p/>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.api.openflow.device.exception.DeviceDataException;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowHash;
import org.opendaylight.openflowplugin.impl.registry.flow.FlowDescriptorFactory;
final SettableFuture<RpcResult<T>> finalFuture = SettableFuture.create();
Futures.addCallback(allFutures, new FutureCallback<List<RpcResult<T>>>() {
@Override
- public void onSuccess(List<RpcResult<T>> result) {
- LOG.warn("Positive confirmation of flow push is not supported by OF-spec");
- for (FlowModInputBuilder ofFlowModInput : ofFlowModInputs) {
- LOG.warn("flow future result was successful [{}] = this should have never happen",
- ofFlowModInput.getXid());
+ public void onSuccess(List<RpcResult<T>> results) {
+ Iterator<FlowModInputBuilder> flowModInputBldIterator = ofFlowModInputs.iterator();
+ List<RpcError> rpcErrorLot = new ArrayList<>();
+ for (RpcResult<T> rpcResult : results) {
+ FlowModInputBuilder flowModInputBld = flowModInputBldIterator.next();
+ if (rpcResult.isSuccessful()) {
+ Long xid = flowModInputBld.getXid();
+ LOG.warn("Positive confirmation of flow push is not supported by OF-spec");
+ LOG.warn("flow future result was successful [{}] = this should have never happen",
+ xid);
+ rpcErrorLot.add(RpcResultBuilder.newError(ErrorType.APPLICATION, "",
+ "flow future result was successful ["+xid+"] = this should have never happen"));
+ } else {
+ rpcErrorLot.addAll(rpcResult.getErrors());
+ }
}
- finalFuture.setException(new DeviceDataException("positive confirmation of flow occurred"));
+ finalFuture.set(RpcResultBuilder.<T>failed().withRpcErrors(rpcErrorLot).build());
}
@Override
/**
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
+ * <p/>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
// extract the port number
Long port = null;
- if(input.getVersion() == OFConstants.OFP_VERSION_1_0 && input.getInPort() != null) {
+ if (input.getVersion() == OFConstants.OFP_VERSION_1_0 && input.getInPort() != null) {
port = input.getInPort().longValue();
} else if (input.getVersion() == OFConstants.OFP_VERSION_1_3) {
if (input.getMatch() != null && input.getMatch().getMatchEntry() != null) {
if (input.getCookie() != null) {
packetReceivedBuilder.setFlowCookie(new FlowCookie(input.getCookie()));
}
- if(port != null) {
+ if (port != null) {
packetReceivedBuilder.setIngress(InventoryDataServiceUtil.nodeConnectorRefFromDatapathIdPortno(datapathId, port, OpenflowVersion.get(input.getVersion())));
}
packetReceivedBuilder.setPacketInReason(PacketInUtil.getMdSalPacketInReason(input.getReason()));
- if(input.getTableId() != null) {
+ if (input.getTableId() != null) {
packetReceivedBuilder.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId(input.getTableId().getValue().shortValue()));
}
- if(input.getMatch() != null) {
+ if (input.getMatch() != null) {
org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match packetInMatch = getPacketInMatch(input, datapathId);
packetReceivedBuilder.setMatch(packetInMatch);
}
private Long getPortNumberFromMatch(List<MatchEntry> entries) {
Long port = null;
for (MatchEntry entry : entries) {
- InPortCase inPortCase = ((InPortCase) entry.getMatchEntryValue());
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPort inPort = inPortCase.getInPort();
- if (inPort != null) {
-
- if (port == null) {
+ if (InPortCase.class.equals(entry.getMatchEntryValue().getImplementedInterface())) {
+ InPortCase inPortCase = ((InPortCase) entry.getMatchEntryValue());
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPort inPort = inPortCase.getInPort();
+ if (inPort != null) {
port = inPort.getPortNumber().getValue();
- } else {
-// LOG.warn("Multiple input ports discovered when walking through match entries (at least {} and {})",
-// port, inPort.getPortNumber().getValue());
+ break;
}
}
}
*/
package org.opendaylight.openflowplugin.openflow.md.queue;
+import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.ImmutableMap;
-
/**
* OfHeader to DataObject implementation
*/
public void setTicketFinisher(TicketFinisher<DataObject> ticketFinisher) {
this.ticketFinisher = ticketFinisher;
}
-
+
/**
* @param ticket
* @return runnable ticket processor
}
}
} catch (Exception e) {
- LOG.error("translation problem: {}", e.getMessage());
+ LOG.warn("translation problem: {}", e.getMessage());
ticket.getResult().setException(e);
}
LOG.debug("message processing done (type: {}, ticket: {})",
return ticketProcessor;
}
-
+
/**
* @param ticket
* @return runnable ticket processor
return ticketProcessor;
}
-
-
+
+
/**
- * @param ticket
+ * @param ticket
*
*/
@Override
} else {
LOG.warn("No translators for this message Type: {}", messageType);
}
-
+
return result;
}
}