Software-defined defragmentation in space-division multiplexing with quasi-hitless fast core switching