Network-on-and-off-chip architecture on demand for flexible optical intra-datacenter networks