You can't get the quantity for Configurable Product. It's a parent product you can only get it's stock status i.e "in_stock" or "out_of_stock".
Simple products are the ones having actual quantities e.g no of Small Product, no of Medium Products, etc
To check if a configurable is in stock or not, use this code.
if($_product->isAvailable()) {
// in stock
} else {
// out of stock
}
To get the sum of all simple products
$simpleSum = 0;
foreach ($_product->getTypeInstance(true)->getUsedProducts ( null, $_product) as $simple) {
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$StockState = $objectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');
$simpleSum = $simpleSum + floatVal($StockState->getStockQty($simple->getId(), $simple->getStore()->getWebsiteId()));
}
echo $simpleSum;