On-line routing and wavelength assignment for dynamic traffic in WDM ring and torus networks