Software Defined Networking (SDN) decouples the control plane from the data plane, thereby enhancing flexibility in network management. Earlier works on SDN modeling only focused on packet-level arrivals without considering flow-level arrivals. However, a model without considering flow-level arrivals cannot correctly reflect the probability of sending packets to the controller. In this paper, we propose an analytical model of SDN considering flow-level (TCP connection) arrivals and packet-level arrivals simultaneously. We use an analytical method termed as 4D state model, which uses four-dimensional states. We have derived the state transition rates of the model and also the packet delay and packet loss probability. We have conducted numerical analysis and extensive simulations. Our results show good matches, which verify the suitability and correctness of our analysis. Error ratios of the analytical results for 4D state model and M/M/1 model against simulation results are also given. Results show that for data packet delays, 4D state can achieve error ratios of 1.16-3.30%, which is much better than 8.57-35.7% attained by M/M/1 model, which only considers packet-level arrivals.