A Learning Methodology for Line-rate Ransomware Mitigation with P4 Switches