At least 17 people have been killed in two separate mass shootings near Pretoria and Pietermaritzburg as South African police investigate the attacks and pursue suspects.