def virtual_nw():
    g = nx.Graph()
    g.add_node("Node_0", cores=3, memory=3000)
    g.add_node("Node_1", cores=3, memory=3000)
    g.add_edge("Node_0", "Node_1", rate=20000)

    yield VirtualNetwork(g)
Example #2
0
            self.status = Infeasible
            return Infeasible


if __name__ == "__main__":
    from distriopt.embedding import PhysicalNetwork
    from distriopt import VirtualNetwork

    import networkx as nx

    g = nx.Graph()
    g.add_node("Node_0", cores=3, memory=3000)
    g.add_node("Node_1", cores=3, memory=3000)
    g.add_edge("Node_0", "Node_1", rate=20000)

    virtual_topo = VirtualNetwork(g)

    # unfeasible, not enough rate
    physical_topo = PhysicalNetwork.create_test_nw(cores=4,
                                                   memory=4000,
                                                   rate=10000,
                                                   group_interfaces=False)

    prob = EmbedPartition(virtual_topo, physical_topo)
    time_solution, status = prob.solve()
    print(status)

    exit(1)

    physical_topo = PhysicalNetwork.from_files("grisou",
                                               group_interfaces=False)