bool SubnetTopology::evaluateNextPath(EngineOperations& engineOperations, Path& path) {
    LOG_DEBUG("evaluateNextPath - " << path);

    if (getNode(path.getSource()).getNodeType() != NodeType::NODE && getNode(path.getDestination()).getNodeType()
                != NodeType::NODE) {
        return true;
    }

    path.updateLastEvalTime();

    if (path.getType() == RoutingTypes::SOURCE_ROUTING) {
        AddressList addressList;
        DijkstraSearch::searchDijkstra(path.getSource(), path.getDestination(), nodes, addressList);

        if (addressList.size() == 0) {
            LOG_DEBUG("recreatePath: There is no path between the " << ToStr(path.getSource()) << " and " << ToStr(
                        path.getDestination()));
            return false;
        } else if (path.getMaxHops() <= addressList.size()) {
            LOG_DEBUG("recreatePath: There path is too long for (" << ToStr(path.getSource()) << " -> " << ToStr(
                        path.getDestination()) << " ), hops: " << (int) addressList.size() << " > "
                        << (int) path.getMaxHops());
        } else {
            path.setSourcePath(addressList);
            return true;
        }
    } else if (path.getType() == RoutingTypes::GRAPH_ROUTING || path.getType() == RoutingTypes::GRAPH_ROUTING_WITH_MIN_PATH_SELECTION) {
        return graphRoutingAlgorithm->evaluateGraphPath(engineOperations, path);
    }

    return false;
}
Uint16 SubnetTopology::createSourcePath(Address32 source, Address32 destination, Uint16 traffic, bool managementPath,
            Uint8 maxHops) {

    LOG_DEBUG("createSourcePath(" << ToStr(source) << ", " << ToStr(destination) << ", traffic = " << traffic
                << ", maxHops = " << (int) maxHops << ")");

    AddressList addressList;

    DijkstraSearch::searchDijkstra(source, destination, nodes, addressList);

    if (addressList.size() == 0) {
        LOG_DEBUG("createPath: There is no path between the " << ToStr(source) << " and " << ToStr(destination));
    } else {
        //LOG_DEBUG("createPath() : the path is : " << NE::Model::Topology::nodesToString(sourcePath));
    }

    Path path(getNextPathId(), source, destination, RoutingTypes::SOURCE_ROUTING, traffic);

    path.setSourcePath(addressList);

    paths[path.getGraphId()] = path;

    LOG_TRACE("createSourcePath end");

    return path.getGraphId();
}
Example #3
0
const IpAddress& NetworkInterfaceImpl::get_dest_address(AddressList::size_type index) const {
    if (!is_p2p()) {
        throw NetException("Unsupported operation");
    } else if (index < m_address_list.size()) {
        return std::get<NetworkInterface::BROADCAST_ADDRESS>(m_address_list[index]);
    }
    throw NetException("IpAddress of NetworkInterface not found");
}
Example #4
0
const IpAddress& NetworkInterfaceImpl::get_broadcast_address(AddressList::size_type index) const {
    if (index < m_address_list.size()) {
        return std::get<NetworkInterface::BROADCAST_ADDRESS>(m_address_list[index]);
    }
    throw NetException("IpAddress of NetworkInterface not found");
}
Example #5
0
const IpAddress& NetworkInterfaceImpl::get_subnet_mask(AddressList::size_type index) const {
    if (index < m_address_list.size()) {
        return std::get<NetworkInterface::SUBNET_MASK>(m_address_list[index]);
    }
    throw NetException("IpAddress of NetworkInterface not found");
}
Example #6
0
const IpAddress& NetworkInterfaceImpl::get_address(AddressList::size_type address_index) const {
    if (address_index < m_address_list.size()) {
        return std::get<NetworkInterface::IP_ADDRESS>(m_address_list[address_index]);
    }
    throw NetException("IpAddress of NetworkInterface not found");
}