loadbalancer.py 文件源码

python
阅读 95 收藏 0 点赞 0 评论 0

项目:sdn-loadbalancing 作者: nayanseth 项目源码 文件源码
def findSwitchRoute():
    pathKey = ""
    nodeList = []
    src = int(switch[h2].split(":",7)[7],16)
    dst = int(switch[h1].split(":",7)[7],16)
    print src
    print dst
    for currentPath in nx.all_shortest_paths(G, source=src, target=dst, weight=None):
        for node in currentPath:

            tmp = ""
            if node < 17:
                pathKey = pathKey + "0" + str(hex(node)).split("x",1)[1] + "::"
                tmp = "00:00:00:00:00:00:00:0" + str(hex(node)).split("x",1)[1]
            else:
                pathKey = pathKey + str(hex(node)).split("x",1)[1] + "::"
                tmp = "00:00:00:00:00:00:00:" + str(hex(node)).split("x",1)[1]
            nodeList.append(tmp)

        pathKey=pathKey.strip("::")
        path[pathKey] = nodeList
        pathKey = ""
        nodeList = []

    print path

# Computes Link TX
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号