Update Match and Action sub-classes for SDN-IP.

- Added ModifyDstMacAction class to modify destination MAC address on the packet
- Added PacketMatchBuilder class to instantiate PacketMatch class
- Updated PacketMatch class to be able to handle IP prefix, src/dst TCP port and ether type
- Added simple unit tests
- This task is a part of ONOS-1879

Change-Id: Ib26f117076dceac3f58b4911fbb936752e719a4a
diff --git a/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java b/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java
index 2ff3299..b1d224e 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java
@@ -1,68 +1,41 @@
 package net.onrc.onos.core.matchaction;
 
-import java.util.Arrays;
 import java.util.List;
 
-import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.api.batchoperation.BatchOperationTarget;
 import net.onrc.onos.core.matchaction.action.Action;
-import net.onrc.onos.core.matchaction.action.OutputAction;
 import net.onrc.onos.core.matchaction.match.Match;
-import net.onrc.onos.core.matchaction.match.PacketMatch;
-import net.onrc.onos.core.util.Dpid;
-import net.onrc.onos.core.util.IPv4;
-import net.onrc.onos.core.util.PortNumber;
 import net.onrc.onos.core.util.SwitchPort;
 
 /**
  * A filter and actions for traffic.
  */
 public class MatchAction implements BatchOperationTarget {
-    protected final MatchActionId id;
-    protected SwitchPort port;
-    protected List<Match> matches;
-    protected List<Action> actions;
+    private final MatchActionId id;
+    private final SwitchPort port;
+    private final Match match;
+    private final List<Action> actions;
 
     /**
      * Constructor.
      *
-     * @param id ID for this MatchAction object.
-     * @param port Switch DPID
-     * @param matches The list of Match objects as match condition on the port.
-     * @param actions The list of Action objects as actions on the switch.
+     * @param id ID for this MatchAction object
+     * @param port switch DPID
+     * @param match the Match object as match condition on the port
+     * @param actions the list of Action objects as actions on the switch
      */
-    public MatchAction(String id, SwitchPort port, List<Match> matches,
-            List<Action> actions) {
+    public MatchAction(String id, SwitchPort port, Match match, List<Action> actions) {
         this.id = new MatchActionId(id);
         this.port = port;
-        this.matches = matches;
+        this.match = match;
         this.actions = actions;
     }
 
     /**
-     * Constructor.
-     * <p>
-     * MEMO: This is a sample constructor to create a packet layer match action.
+     * Gets ID for this object.
      *
-     * @param id ID for this MatchAction object.
-     * @param dpid Switch DPID
-     * @param srcPort Source Port
-     * @param srcMac Source Host MAC Address
-     * @param dstMac Destination Host MAC Address
-     * @param srcIp Source IP Address
-     * @param dstIp Destination IP Address
-     * @param dstPort Destination Port
+     * @return the ID for this object
      */
-    // CHECKSTYLE:OFF suppress the warning about too many parameters
-    public MatchAction(String id, Dpid dpid, PortNumber srcPort,
-            MACAddress srcMac, MACAddress dstMac,
-            IPv4 srcIp, IPv4 dstIp, PortNumber dstPort) {
-        // CHECKSTYLE:ON
-        this(id, new SwitchPort(dpid, srcPort),
-                Arrays.asList((Match) new PacketMatch(srcMac, dstMac, srcIp, dstIp)),
-                Arrays.asList((Action) new OutputAction(dstPort)));
-    }
-
     public MatchActionId getId() {
         return id;
     }
@@ -70,7 +43,7 @@
     /**
      * Gets the switch-port which is the target of this match-action.
      *
-     * @return The target switch-port of this match-action.
+     * @return the target switch-port of this match-action
      */
     public SwitchPort getSwitchPort() {
         return port;
@@ -79,16 +52,16 @@
     /**
      * Gets the traffic filter of the match-action.
      *
-     * @return The traffic filter.
+     * @return the traffic filter
      */
-    public List<Match> getMatches() {
-        return matches;
+    public Match getMatch() {
+        return match;
     }
 
     /**
      * Gets the list of actions of the match-action.
      *
-     * @return The list of actions.
+     * @return the list of actions
      */
     public List<Action> getActions() {
         return actions;