Pavlin Radoslavov | 6fbf119 | 2013-04-02 19:02:41 +0000 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | import itertools |
| 3 | import sys |
| 4 | |
| 5 | src_port=1 |
| 6 | dst_port=1 |
| 7 | |
| 8 | n=int(sys.argv[1]) |
| 9 | a=range(2,n+1) |
| 10 | nflow=int(sys.argv[2]) |
| 11 | |
| 12 | print "# For %d nodes cluster, %d flows per network pair, total %d flows" % (n, nflow, (n-1)*(n-2)/2 * nflow * 2) |
| 13 | |
| 14 | flow_id=1 |
| 15 | pair_id=1 |
| 16 | for i in itertools.combinations(a,2): |
| 17 | for f in range(2, nflow+2): |
| 18 | snet_id=int(i[0]) |
| 19 | dnet_id=int(i[1]) |
| 20 | term_id=f |
| 21 | print "%d ps_%d_1 00:00:00:00:00:00:%02x:%02x %d 00:00:00:00:00:00:%02x:%02x %d matchSrcMac 00:00:c0:a8:%02x:%02x matchDstMac 00:00:c0:a8:%02x:%02x" % (flow_id,pair_id,snet_id,term_id,src_port,dnet_id,term_id,dst_port,snet_id,term_id,dnet_id,term_id) |
| 22 | flow_id = flow_id + 1 |
| 23 | print "%d ps_%d_2 00:00:00:00:00:00:%02x:%02x %d 00:00:00:00:00:00:%02x:%02x %d matchSrcMac 00:00:c0:a8:%02x:%02x matchDstMac 00:00:c0:a8:%02x:%02x" % (flow_id,pair_id,dnet_id,term_id,dst_port,snet_id,term_id,src_port,dnet_id,term_id,snet_id,term_id) |
| 24 | flow_id = flow_id + 1 |
| 25 | pair_id = pair_id + 1 |