- # All topologies NICs
- available=$(grep -hoPR "model: \K.*" "${TOPOLOGIES_DIR}"/* | sort -u)
- # Selected topology NICs
- reserved=$(grep -hoPR "model: \K.*" "${WORKING_TOPOLOGY}" | sort -u)
- # All topologies NICs - Selected topology NICs
+ start_pattern='^ TG:'
+ end_pattern='^ \? \?[A-Za-z0-9]\+:'
+ # Remove the TG section from topology file
+ sed_command="/${start_pattern}/,/${end_pattern}/d"
+ # All topologies DUT NICs
+ available=$(sed "${sed_command}" "${TOPOLOGIES_DIR}"/* \
+ | grep -hoP "model: \K.*" | sort -u)
+ # Selected topology DUT NICs
+ reserved=$(sed "${sed_command}" "${WORKING_TOPOLOGY}" \
+ | grep -hoP "model: \K.*" | sort -u)
+ # All topologies DUT NICs - Selected topology DUT NICs