Esempio n. 1
0
def launch():
    """
  Starts the Controller:

      - topo is a string with comma-separated arguments specifying what
        topology to build.
          e.g.: 'jellyfish,4'

      - routing is a string indicating what routing mechanism to use:
          e.g.: 'ecmp8', 'kshort'
  """

    # NOTE: currently only support jellyfish topology.

    log.info("Launching Jellyfish controller")
    # Read out configuration from file.

    # NOTE: assumes jellyfish has been installed in the home directory.
    config_loc = 'pox/ext/__jellyconfig'
    with open(config_loc, 'r', os.O_NONBLOCK) as config_file:
        log.info("inside")
        n = int(config_file.readline().split('=')[1])
        k = int(config_file.readline().split('=')[1])
        r = int(config_file.readline().split('=')[1])
        seed = int(config_file.readline().split('=')[1])
        routing = config_file.readline().split('=')[1].strip()

    jelly_topology = topologies["jelly"](random_seed=seed, n=n, k=k, r=r)
    my_routing = Routing(jelly_topology, routing, log, seed=seed)
    my_routing.generate_rtable()
    core.registerNew(JellyfishController, jelly_topology, my_routing)
Esempio n. 2
0
  """

    # NOTE: currently only support jellyfish topology.

    log.info("Launching Jellyfish controller")
    # Read out configuration from file.

    # NOTE: assumes jellyfish has been installed in the home directory.
    config_loc = 'pox/ext/__jellyconfig'
    with open(config_loc, 'r', os.O_NONBLOCK) as config_file:
        log.info("inside")
        n = int(config_file.readline().split('=')[1])
        k = int(config_file.readline().split('=')[1])
        r = int(config_file.readline().split('=')[1])
        seed = int(config_file.readline().split('=')[1])
        routing = config_file.readline().split('=')[1].strip()

    jelly_topology = topologies["jelly"](random_seed=seed, n=n, k=k, r=r)
    my_routing = Routing(jelly_topology, routing, log, seed=seed)
    my_routing.generate_rtable()
    core.registerNew(JellyfishController, jelly_topology, my_routing)


# for debugging
if __name__ == '__main__':
    topo = 'dummy'
    routing = 'ecmp'
    my_topology = build_topology(topo)
    my_routing = Routing(my_topology, routing, log)
    my_routing.generate_rtable()