Inflammation of the testicles is a serious condition and very painful for the animal... He should have been taken to a vet when the symptoms first appeared. There are several possibilities... But my guess is brucellosis. When you take him to the vet, have him test for 'Canine Brucellosis' (Brucella canis).
With brucellosis, there can be inflammation of the prostate gland as well as swelling of the testicles... In some cases there can be atrophy (shrinking) of the testicles after the initial swelling occurs... And lesions can also occur due to the dog licking the painful areas.
It's a sexually transmitted disease... in male dogs, infection of the testicles can lead to infertility.. If females the infection leads to abortion or early death of infected puppies... Infected animals should be neutered or spayed to prevent sexually related transmission. The disease can be very resistant to treatment... And all infected animals should be considered to be lifelong carriers of the disease, even if treated. It's rare, but the disease can be passed to humans.