import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
import java.util.stream.Collectors;
-
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.BucketInfo;
import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionResubmitRpcAddGroupCase;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.Uint64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @param dpnId
* DPN on which group flow to be installed
*/
- public static FlowEntity getArpResponderTableMissFlow(BigInteger dpnId) {
+ public static FlowEntity getArpResponderTableMissFlow(Uint64 dpnId) {
return MDSALUtil.buildFlowEntity(dpnId, NwConstants.ARP_RESPONDER_TABLE,
String.valueOf(NwConstants.ARP_RESPONDER_TABLE), NwConstants.TABLE_MISS_PRIORITY,
ArpResponderConstant.DROP_FLOW_NAME.value(), 0, 0, NwConstants.COOKIE_ARP_RESPONDER,
public static List<MatchInfo> getMatchCriteria(int lportTag, ElanInstance elanInstance,
String ipAddress) {
- BigInteger metadata = ElanHelper.getElanMetadataLabel(elanInstance.getElanTag(), lportTag);
- BigInteger metadataMask = ElanHelper.getElanMetadataMask();
+ Uint64 metadata = ElanHelper.getElanMetadataLabel(elanInstance.getElanTag().toJava(), lportTag);
+ Uint64 metadataMask = ElanHelper.getElanMetadataMask();
return Arrays.asList(MatchEthernetType.ARP, MatchArpOp.REQUEST, new MatchArpTpa(ipAddress, "32"),
new MatchMetadata(metadata, metadataMask));
new ActionMoveSpaToTpa().buildAction(actionCounter.getAndIncrement()),
new ActionLoadMacToSha(new MacAddress(mac)).buildAction(actionCounter.getAndIncrement()),
new ActionLoadIpToSpa(ip).buildAction(actionCounter.getAndIncrement()),
- new ActionNxLoadInPort(BigInteger.ZERO).buildAction(actionCounter.getAndIncrement()));
+ new ActionNxLoadInPort(Uint64.valueOf(BigInteger.ZERO)).buildAction(actionCounter.getAndIncrement()));
return actions;
};
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = v
.getAction();
if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
- tableId.set(((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable());
+ tableId.set(((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable().toJava());
return true;
} else {
return false;
* Gateway IP for which ARP Response flow to be installed
* @return Cookie
*/
- public static BigInteger generateCookie(int lportTag, String ipAddress) {
+ public static Uint64 generateCookie(int lportTag, String ipAddress) {
LOG.trace("IPAddress in long {}", ipAddress);
- BigInteger cookie = NwConstants.COOKIE_ARP_RESPONDER.add(BigInteger.valueOf(255))
- .add(BigInteger.valueOf(ipTolong(ipAddress)));
- return cookie.add(BigInteger.valueOf(lportTag));
+ return Uint64.fromLongBits(NwConstants.COOKIE_ARP_RESPONDER.longValue()
+ + 255 + ipTolong(ipAddress) + lportTag);
}
- private static BigInteger buildCookie(short tableId, int arpOpType) {
- return NwConstants.COOKIE_ARP_RESPONDER.add(BigInteger.ONE).add(
- BigInteger.valueOf(tableId).add(BigInteger.valueOf(arpOpType)));
+ private static Uint64 buildCookie(short tableId, int arpOpType) {
+ return Uint64.fromLongBits(NwConstants.COOKIE_ARP_RESPONDER.longValue()
+ + 1 + tableId + arpOpType);
}
private static String buildFlowRef(short tableId, int arpOpType) {
+ (arpOpType == NwConstants.ARP_REQUEST ? "arp.request" : "arp.replay");
}
- public static FlowEntity createArpDefaultFlow(BigInteger dpId, short tableId, int arpOpType,
+ public static FlowEntity createArpDefaultFlow(Uint64 dpId, short tableId, int arpOpType,
Supplier<List<MatchInfo>> matches, Supplier<List<ActionInfo>> actions) {
List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actions.get()));
try {
RpcResult result = itmRpcService.getEgressActionsForTunnel(new GetEgressActionsForTunnelInputBuilder()
.setIntfName(ifName).build()).get();
- List<Action> listActions = new ArrayList<>();
+ Map<ActionKey, Action> listActions = new HashMap<ActionKey, Action>();
if (!result.isSuccessful()) {
LOG.error("getEgressActionsForInterface: RPC Call to Get egress actions for interface {} "
+ "returned with Errors {}", ifName, result.getErrors());
} else {
listActions = ((GetEgressActionsForTunnelOutput) result.getResult()).getAction();
}
- return listActions;
+ return new ArrayList<Action>(listActions.values());
} catch (InterruptedException | ExecutionException e) {
LOG.error("getEgressActionsForInterface: Exception when egress actions for interface {}", ifName, e);
}
RpcResult<AllocateIdOutput> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
LOG.trace("Retrieved Group Id is {}", rpcResult.getResult().getIdValue());
- return rpcResult.getResult().getIdValue();
+ return rpcResult.getResult().getIdValue().toJava();
} else {
LOG.warn("RPC Call to Allocate Id returned with Errors {}", rpcResult.getErrors());
}