Current fronthaul and backhaul networks require innovative technologies to support the key 5G performance indicators such as high bandwidth and sub-millisecond latency. In order to find optimal paths in a multitenant network architecture, we have proposed and applied a mixed linear programming formulation (MILP) to a resilient time-shared optical network (TSON) with multi-level programmability. The goal is to provide an analytical formulation which considers two different objective functions over a physical network substrate taking into account multi-fiber routing and cost constraints. We have run the model for an operational TSON node in a simulated metro-network with six nodes, cross-conectors and different physical capabilities between them. The correlation between minimizing the maximum number of ports/fibers used for node and the total number of fibers for the bundles was tested and the strategy can optimize the network design according to the designer's resource availability or network requirements.