import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
+ // Wrap our Apply Action in an Instruction
+ ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
return ib;
}
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
+ // Wrap our Apply Action in an Instruction
+ ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
return ib;
}
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
+ // Wrap our Apply Action in an Instruction
+ ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
return ib;
}
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
+ // Wrap our Apply Action in an Instruction
+ ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
return ib;
}
+ /**
+ * Set the Tunnel EndpointIPv4 Source Address
+ * @param ib Map InstructionBuilder
+ * @param srcIp Ipv4Prefix source IP for the tunnel endpoint (TEP)
+ * @return instructionbuilder with new attributes
+ */
public static InstructionBuilder createTunnelIpv4SrcInstructions(InstructionBuilder ib, Ipv4Prefix srcIp) {
List<Action> actionList = new ArrayList<Action>();
// Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_src)
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
+ // Wrap our Apply Action in an Instruction
+ ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
return ib;
}
- public static InstructionBuilder createTunnelIpv4DstInstructions(InstructionBuilder ib, Ipv4Prefix srcIp) {
+ /**
+ * Set the Tunnel EndpointIPv4 Destination Address
+ * @param ib Map InstructionBuilder
+ * @param dstIp Ipv4Prefix destination IP for the tunnel endpoint (TEP)
+ * @return instructionbuilder with new attributes
+ */
+ public static InstructionBuilder createTunnelIpv4DstInstructions(InstructionBuilder ib, Ipv4Prefix dstIp) {
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
// Add the new IPv4 object as the tunnel destination
TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = new TunnelIpv4MatchBuilder();
- tunnelIpv4MatchBuilder.setTunnelIpv4Destination(srcIp);
+ tunnelIpv4MatchBuilder.setTunnelIpv4Destination(dstIp);
setFieldBuilder.setLayer3Match(tunnelIpv4MatchBuilder.build());
// Add the IPv4 tunnel src to the set_field value
// Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_src)
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
+ // Wrap our Apply Action in an Instruction
+ ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+ return ib;
+ }
+
+ /**
+ * Set IPv4 Source Address Instructions
+ * @param ib Map InstructionBuilder
+ * @param metaData BigInteger representing the OpenFlow metadata
+ * @param metaDataMask BigInteger representing the OpenFlow metadata mask
+ * @return instructionbuilder with new attributes
+ */
+ public static InstructionBuilder createMetadataInstructions(InstructionBuilder ib, BigInteger metaData, BigInteger metaDataMask) {
+
+ WriteMetadataBuilder aab = new WriteMetadataBuilder();
+ aab.setMetadata(metaData);
+ aab.setMetadataMask(metaDataMask);
+ ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
+
+ /**
+ *
+ * TODO Determine why the following fails serialization
+ * with a null value. Per the spec it is optional.
+ * The metadata match, the Flowmod works w/o an accompanying mask.
+ *
+ * if (metaDataMask != null) {
+ * aab.setMetadataMask(metaDataMask);
+ * }
+ *
+ */
return ib;
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
return matchBuilder;
}
+ /**
+ * @return MatchBuilder containing the metadata match values
+ */
+ public static MatchBuilder createMetadataMatch(MatchBuilder matchBuilder, BigInteger metaData, BigInteger metaDataMask) {
+
+ // metadata matchbuilder
+ MetadataBuilder metadata = new MetadataBuilder();
+ metadata.setMetadata(metaData);
+ // Optional metadata mask
+ if (metaDataMask != null) {
+ metadata.setMetadataMask(metaDataMask);
+ }
+ matchBuilder.setMetadata(metadata.build());
+
+ return matchBuilder;
+ }
public static class RegMatch {
final Class<? extends NxmNxReg> reg;