1. A method comprising: at a management entity in communication with a plurality of network devices: uploading from a network that includes the plurality of network devices, data representing policy rules configured on the plurality of network devices obtained from configuration files for the plurality of network devices; comparing the data representing the policy rules for similarities in order to group together policy rules based on their similarities, wherein comparing comprises comparing pairs of policy rules across configuration files for the plurality of network devices to generate a similarity score indicating similarity between two rules of a given pair of policy rules, the comparing further including generating a plurality of sub-classifications, each containing a set of policy rule statements from a first configuration file and a set of policy rule statements from a second configuration file whose similarity score is above a threshold; storing data representing a plurality of clusters, each cluster representing a group of policy rules that have been grouped together; generating one or more configuration policies to be applied across the plurality of network devices using the data representing each of the plurality of clusters, while maintaining context of policy rule processing; and sending data to the network to deploy the one or more configuration policies on the plurality of network devices.