/**
- * Copyright (c) 2013 Ericsson. and others. All rights reserved.
+ * Copyright (c) 2013-2014 Ericsson. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
private static final Logger logger = LoggerFactory.getLogger(FlowConvertor.class);
// Default values for when things are null
- private static final BigInteger DEFAULT_COOKIE = BigInteger.ZERO;
- private static final BigInteger DEFAULT_COOKIE_MASK = BigInteger.ZERO;
private static final TableId DEFAULT_TABLE_ID = new TableId(0L);
- private static final Integer DEFAULT_IDLE_TIMEOUT = 5 * 60;
- private static final Integer DEFAULT_HARD_TIMEOUT = 10 * 60;
- private static final Integer DEFAULT_PRIORITY = Integer.parseInt("8000", 16);
+ /** Default idle timeout */
+ public static final Integer DEFAULT_IDLE_TIMEOUT = 5 * 60;
+ /** Default hard timeout */
+ public static final Integer DEFAULT_HARD_TIMEOUT = 10 * 60;
+ /** Default priority */
+ public static final Integer DEFAULT_PRIORITY = Integer.parseInt("8000", 16);
private static final Long DEFAULT_BUFFER_ID = Long.parseLong("ffffffff", 16);
private static final Long OFPP_ANY = Long.parseLong("ffffffff", 16);
private static final Long DEFAULT_OUT_PORT = OFPP_ANY;
if (flow.getCookie() != null) {
flowMod.setCookie(flow.getCookie().getValue());
} else {
- flowMod.setCookie(DEFAULT_COOKIE);
+ flowMod.setCookie(OFConstants.DEFAULT_COOKIE);
}
if (flow.getCookieMask() != null) {
flowMod.setCookieMask(flow.getCookieMask().getValue());
} else {
- flowMod.setCookieMask(DEFAULT_COOKIE_MASK);
+ flowMod.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
}
if (flow.getTableId() != null) {
MatchReactor.getInstance().convert(flow.getMatch(), version, flowMod,datapathid);
if (flow.getInstructions() != null) {
- flowMod.setInstruction(toInstructions(flow.getInstructions(), version,datapathid));
- flowMod.setAction(getActions(flow.getInstructions(), version,datapathid));
+ flowMod.setInstruction(toInstructions(flow, version,datapathid));
+ flowMod.setAction(getActions(version,datapathid, flow));
}
flowMod.setVersion(version);
}
private static List<Instruction> toInstructions(
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions instructions,
+ Flow flow,
short version,BigInteger datapathid) {
List<Instruction> instructionsList = new ArrayList<>();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions instructions = flow.getInstructions();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : instructions
.getInstruction()) {
InstructionBuilder instructionBuilder = new InstructionBuilder();
.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions.class);
ActionsInstructionBuilder actionsInstructionBuilder = new ActionsInstructionBuilder();
actionsInstructionBuilder.setAction(ActionConvertor.getActions(writeActions.getAction(),
- version,datapathid));
+ version,datapathid, flow));
instructionBuilder.addAugmentation(ActionsInstruction.class, actionsInstructionBuilder.build());
instructionsList.add(instructionBuilder.build());
}
.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions.class);
ActionsInstructionBuilder actionsInstructionBuilder = new ActionsInstructionBuilder();
actionsInstructionBuilder.setAction(ActionConvertor.getActions(applyActions.getAction(),
- version,datapathid));
+ version,datapathid, flow));
instructionBuilder.addAugmentation(ActionsInstruction.class, actionsInstructionBuilder.build());
instructionsList.add(instructionBuilder.build());
}
return instructionsList;
}
- private static List<Action> getActions(
+ /*private static List<Action> getActions(
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions instructions,
- short version,BigInteger datapathid) {
-
+ short version,BigInteger datapathid) {*/
+ private static List<Action> getActions(short version,BigInteger datapathid, Flow flow) {
+
+ org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions instructions = flow.getInstructions();
List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction> sortedInstructions =
Ordering.from(OrderComparator.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>toInstance())
.sortedCopy(instructions.getInstruction());
if (curInstruction instanceof ApplyActionsCase) {
ApplyActionsCase applyActionscase = (ApplyActionsCase) curInstruction;
ApplyActions applyActions = applyActionscase.getApplyActions();
- return ActionConvertor.getActions(applyActions.getAction(), version,datapathid);
+ return ActionConvertor.getActions(applyActions.getAction(), version,datapathid, flow);
}
}
return null;