~ubuntu-branches/ubuntu/utopic/exabgp/utopic

« back to all changes in this revision

Viewing changes to dev/runtest/api-flow.run

  • Committer: Package Import Robot
  • Author(s): Henry-Nicolas Tourneur
  • Date: 2014-03-08 19:07:00 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20140308190700-xjbibpg1g6001c9x
Tags: 3.3.1-1
* New upstream release
* Bump python minimal required version (2.7)
* Closes: #726066 Debian packaging improvements proposed by Vincent Bernat
* Closes: #703774 not existent rundir (/var/run/exabgp) after reboot

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
import sys
 
4
import time
 
5
 
 
6
announce_flow_1 = '''\
 
7
announce flow route {
 
8
        match {
 
9
                source 10.0.0.2/32;
 
10
                destination 10.0.0.3/32;
 
11
                destination-port =3128;
 
12
                protocol tcp;
 
13
        }
 
14
        then {
 
15
                rate-limit 9600;
 
16
        }
 
17
}'''.replace('\n','\\n')
 
18
 
 
19
 
 
20
withdraw_flow_1 = '''\
 
21
withdraw flow route {
 
22
        match {
 
23
                source 10.0.0.2/32;
 
24
                destination 10.0.0.3/32;
 
25
                destination-port =3128;
 
26
                protocol tcp;
 
27
        }
 
28
        then {
 
29
                rate-limit 9600;
 
30
        }
 
31
}'''.replace('\n','\\n')
 
32
 
 
33
 
 
34
announce_flow_2 = '''\
 
35
announce flow route {
 
36
        match {
 
37
                source 10.0.0.1/32;
 
38
                destination 192.168.0.1/32;
 
39
                port =80 =8080;
 
40
                destination-port >8080&<8088 =3128;
 
41
                source-port >1024;
 
42
                protocol [ udp tcp ];
 
43
        }
 
44
        then {
 
45
                rate-limit 9600;
 
46
        }
 
47
}'''.replace('\n','\\n')
 
48
 
 
49
 
 
50
messages = [
 
51
'sleep',
 
52
announce_flow_1,
 
53
withdraw_flow_1,
 
54
announce_flow_2,
 
55
'sleep',
 
56
announce_flow_1,
 
57
'sleep',
 
58
withdraw_flow_1,
 
59
]
 
60
 
 
61
while messages:
 
62
        message = messages.pop(0)
 
63
        if message == 'sleep':
 
64
                time.sleep(3)
 
65
        else:
 
66
                sys.stdout.write( message + '\n')
 
67
                sys.stdout.flush()
 
68
 
 
69
while True:
 
70
        time.sleep(1)
 
71