| usage="""Usage: generate_mesh num_nodes [template_file] |
| Generates template_file with a full mesh topology with num_nodes |
| If no template_file is given, will write to default |
| file miniccnx.conf in the current directory. |
| parser = optparse.OptionParser(usage) |
| _, arg = parser.parse_args() |
| num_nodes = int(parser.parse_args()[1][0]) |
| print parser.parse_args() |
| num_nodes,temp_file = int(parser.parse_args()[1][0]), parser.parse_args()[1][1] |
| return num_nodes, temp_file |
| if __name__ == '__main__': |
| n_nodes, t_file = parse_args() |
| temp_file = open(t_file,'w') |
| temp_file.write('[hosts]\n') |
| temp_file.write('[routers]\n') |
| temp_file.write('s' + str(i) + ':\n') |
| temp_file.write('[links]\n') |
| for j in range(peer,n_nodes): |
| temp_file.write('s' + str(i) + ':s' + str(j) + '\n') |