There are a large number of castles and citadels in Iran, for example look at this one which is said to be built in the Sassanid period and was inhabited until 150 years ago:
http://en.wikipedia.org/wiki/Rayen_Castle
Rayn Citadel in Kerman
It has all characteristics of a medieval Persian city, there are residental houses, stores, bazaar, military units, squares, fortress, religious buildings, Zurkhaneh (traditional Persian gymnasium), stables, schools, ... It also consists of the public quarter and the aristocratic zone.