Пример #1
0
def main():
    logging.basicConfig(filename='activities.log',
                        level=logging.DEBUG,
                        filemode='w')

    logging.info("---- %s ----" % time.strftime("%d/%m/%Y - %H:%M:%S"))

    env = simpy.Environment()

    topologyMaker = TopologyMaker(env, None, applications)

    datacentres, links, leafnodes = topologyMaker.GenerateTreeFromParameters(
        childStruct=[3, 3, 1],
        sizeStruct=[
            Datacentre.RESOURCE_TYPES['S'], Datacentre.RESOURCE_TYPES['L'],
            Datacentre.RESOURCE_TYPES['S']
        ],
        uplinkStruct=[100, 100, 100],
        downlinkStruct=[100, 100, 100],
        latencyStruct=[0, 0, 0])

    logging.info('Topology generated, with %i datacentres' % len(datacentres))

    topology = Topology(env, datacentres, links, leafnodes)

    l = topology.findNeighbours('DC1', 3)
    print l