Smart grids depend on a solid foundation of communications. Although standards like IEC 61850 proposes interoperability, autoconfiguration, and autonomous control solutions for the communication network, there are still open problems on how to efficiently forward high priority sensitive data. This work proposes a complete architecture for autonomic management and control of communication networks for substations based on IEC 61850. The proposed solution, called SMARTFlow, uses OpenFlow in order to achieve granularity and flexibility in the treatment of data flows. SMARTFlow proactively calculates Layer 2 multicast trees to forward the high priorities GOOSE and Sampled Values messages and reconfigures all flow entries in case of network failures. Also, the proposed system monitors the network and defines the configuration of client-server flows on-demand. The proposal was implemented and tested using Mininet and showed a total load up to 44 % lower than the load using typical switches.