Flexible integration of optical switch with optical power splitting and attenuating functions for optical fiber-based networking applications