Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 7a1475b

Browse files
committed
consistent naming convention for forwarding policies between bucket and path_query
1 parent 6dafbd0 commit 7a1475b

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

pyretic/examples/bucket.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,21 @@
4949
ip2 = IPAddr('10.0.0.2')
5050
ip3 = IPAddr('10.0.0.3')
5151

52-
fwding_single_3 = ( (match(dstip=ip1) >> fwd(1)) +
53-
(match(dstip=ip2) >> fwd(2)) +
54-
(match(dstip=ip3) >> fwd(3)) )
55-
fwding_cycle_3_3 = ( (match(dstip=ip1) >> match(switch=1) >> fwd(3)) +
56-
(match(dstip=ip1) >> match(switch=2) >> fwd(1)) +
57-
(match(dstip=ip1) >> match(switch=3) >> fwd(2)) +
58-
(match(dstip=ip2) >> match(switch=1) >> fwd(1)) +
59-
(match(dstip=ip2) >> match(switch=2) >> fwd(3)) +
60-
(match(dstip=ip2) >> match(switch=3) >> fwd(2)) +
61-
(match(dstip=ip3) >> match(switch=1) >> fwd(2)) +
62-
(match(dstip=ip3) >> match(switch=2) >> fwd(1)) +
63-
(match(dstip=ip3) >> match(switch=3) >> fwd(3)) )
64-
65-
def static_fwding_single():
66-
return fwding_single_3
67-
68-
def static_fwding_cycle():
69-
return fwding_cycle_3_3
52+
def static_fwding_single_3():
53+
return ( (match(dstip=ip1) >> fwd(1)) +
54+
(match(dstip=ip2) >> fwd(2)) +
55+
(match(dstip=ip3) >> fwd(3)) )
56+
57+
def static_fwding_cycle_3_3():
58+
return ( (match(dstip=ip1) >> match(switch=1) >> fwd(3)) +
59+
(match(dstip=ip1) >> match(switch=2) >> fwd(1)) +
60+
(match(dstip=ip1) >> match(switch=3) >> fwd(2)) +
61+
(match(dstip=ip2) >> match(switch=1) >> fwd(1)) +
62+
(match(dstip=ip2) >> match(switch=2) >> fwd(3)) +
63+
(match(dstip=ip2) >> match(switch=3) >> fwd(2)) +
64+
(match(dstip=ip3) >> match(switch=1) >> fwd(2)) +
65+
(match(dstip=ip3) >> match(switch=2) >> fwd(1)) +
66+
(match(dstip=ip3) >> match(switch=3) >> fwd(3)) )
7067

7168
class QueryTest(CountBucket):
7269

pyretic/tests/all_bucket_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ def generic_topo_tests(topo_name, topo_args, fwding_pols):
8989
def single_switch_topo_tests():
9090
topo_name = 'SingleSwitchTopo'
9191
topo_args = '3'
92-
fwding_pols = ['static_fwding_single', 'mac_learner']
92+
fwding_pols = ['static_fwding_single_3', 'mac_learner']
9393
generic_topo_tests(topo_name, topo_args, fwding_pols)
9494

9595
def cycle_topo_tests():
9696
topo_name = 'CycleTopo'
9797
topo_args = '3,3'
98-
fwding_pols = ['static_fwding_cycle', 'mac_learner']
98+
fwding_pols = ['static_fwding_cycle_3_3', 'mac_learner']
9999
generic_topo_tests(topo_name, topo_args, fwding_pols)
100100

101101
def print_failed_tests():

0 commit comments

Comments
 (0)