ONOS-5450 Initial implementation of OFAgent

- Refactored OFAgent immutable
- Added OFAgentStore and OFAgentEvent
- Implemented OFAgentManager and OFSwitchManager
- Added unit tests

Change-Id: Ie39ad2db9e6bd6259a062371b3ffe116b8c8cc52
diff --git a/apps/ofagent/src/main/java/org/onosproject/ofagent/api/OFSwitchOperationService.java b/apps/ofagent/src/main/java/org/onosproject/ofagent/api/OFSwitchOperationService.java
new file mode 100644
index 0000000..6413cba
--- /dev/null
+++ b/apps/ofagent/src/main/java/org/onosproject/ofagent/api/OFSwitchOperationService.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ofagent.api;
+
+import io.netty.channel.Channel;
+import org.onosproject.net.Port;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.packet.InboundPacket;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+
+/**
+ * Service for providing OpenFlow operations.
+ */
+public interface OFSwitchOperationService {
+
+    /**
+     * Processes a new port of the switch.
+     * It sends out FEATURE_REPLY message to the controllers.
+     *
+     * @param port virtual port
+     */
+    void processPortAdded(Port port);
+
+    /**
+     * Processes port link down.
+     * It sends out PORT_STATUS asynchronous message to the controllers.
+     *
+     * @param port virtual port
+     */
+    void processPortDown(Port port);
+
+    /**
+     * Processes port link down.
+     * It sends out PORT_STATUS asynchronous message to the controllers.
+     *
+     * @param port virtual port
+     */
+    void processPortUp(Port port);
+
+    /**
+     * Processes flow removed.
+     * It sends out FLOW_REMOVED asynchronous message to the controllers.
+     *
+     * @param flowRule removed flow rule
+     */
+    void processFlowRemoved(FlowRule flowRule);
+
+    /**
+     * Processes packet in.
+     * It sends out PACKET_IN asynchronous message to the controllers.
+     *
+     * @param packet inbound packet
+     */
+    void processPacketIn(InboundPacket packet);
+
+    /**
+     * Processes commands from the controllers that modify the state of the switch.
+     * Possible message types include PACKET_OUT, FLOW_MOD, GROUP_MOD,
+     * PORT_MOD, TABLE_MOD. These types of messages can be denied based on a
+     * role of the request controller.
+     *
+     * @param channel received channel
+     * @param msg     command message received
+     */
+    void processControllerCommand(Channel channel, OFMessage msg);
+
+    /**
+     * Processes a stats request from the controllers.
+     * Targeted message type is MULTIPART_REQUEST with FLOW, PORT, GROUP,
+     * GROUP_DESC subtypes.
+     *
+     * @param channel received channel
+     * @param msg     stats request message received
+     */
+    void processStatsRequest(Channel channel, OFMessage msg);
+
+    /**
+     * Processes a role request from the controllers.
+     * Targeted message type is ROLE_REQUEST.
+     *
+     * @param channel received channel
+     * @param msg     role request message received
+     */
+    void processRoleRequest(Channel channel, OFMessage msg);
+
+    /**
+     * Processes a features request from the controllers.
+     *
+     * @param channel received channel
+     * @param msg     received features request
+     */
+    void processFeaturesRequest(Channel channel, OFMessage msg);
+
+    /**
+     * Processes LLDP packets from the controller.
+     *
+     * @param channel received channel
+     * @param msg     packet out message with lldp
+     */
+    void processLldp(Channel channel, OFMessage msg);
+
+    /**
+     * Sends hello to the controller.
+     *
+     * @param channel received channel
+     */
+    void sendOfHello(Channel channel);
+
+    /**
+     * Processes echo request from the controllers.
+     *
+     * @param channel received channel
+     * @param msg     echo request message
+     */
+    void processEchoRequest(Channel channel, OFMessage msg);
+}