Put the beans in a very large bowl. Pour over 3 times their volume of water so they are well covered, as they will soak up a lot. Cover with cling film and leave to soak overnight.
Tip the beans into a large colander to drain, discarding the water. Put them in a large, deep saucepan and cover with fresh cold water (about 2 litres), so it is about 3cm above the beans. Add 3 of the garlic cloves, 2 thyme sprigs and 1 rosemary sprig. Bring to the boil, half cover the pan with its lid and keep on a very gentle simmer for 1 ½ hrs, checking the water level occasionally. Cut the gammon into lardon-sized pieces. Put the lardons in with the beans, checking there is still enough water to cover everything. Simmer for a further 30 mins.
Wrap the remaining thyme and rosemary sprigs in the bay leaf and tie with string to make a bouquet garni. Heat the oil in a large, deep ovenproof sauté pan or flameproof casserole dish. Put the onion and carrot in the pan and fry gently on a medium heat for 5 mins, stirring occasionally. Finely chop the remaining 4 garlic cloves. Melt the butter in the pan, add the garlic and fry for 2 mins. Increase the heat, add the pork shoulder and fry for 2-3 mins until it is no longer pink. Pour in the wine and let it bubble for 1 min until slightly reduced. Stir in the tomatoes, tuck in the bouquet garni and simmer for 3 mins until saucy. Season well with pepper and 2 pinches of salt. Remove and set aside.
Heat oven to 180C/160C fan/gas 4. Drain the beans in a large colander set over a large bowl so you can reserve the cooking liquid (you should have about 850ml). Remove and discard the herb stems. Squash the softened garlic cloves with a spoon, then stir through the beans and lardons. Tip this mixture into the pan with the pork shoulder, then pour in 600ml of the reserved cooking liquid. Simmer gently, uncovered, for 30 mins until you have a moist, soupy consistency.
Meanwhile, lay the sausages on a small non-stick baking tray and roast for 20 mins, turning halfway through, until brown. Remove, cut into 1cm-thick diagonal slices and lower the oven to 160C/140C fan/gas 3.
Tuck the sausage slices into the beans, transfer the cassoulet to the oven and bake for 11/2 hrs, uncovered. Meanwhile, mix together the panko crumbs, garlic, lemon zest, oil and some pepper. By now the meat should be almost tender and the cassoulet moist and juicy, not dry. (If necessary, pour in some of the reserved cooking liquid.) Scatter the crumb mix over and return to the oven for 20-25 mins until the topping is golden.