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

Commit b9c71f8

Browse files
author
Joshua Reich
committed
a simple topology printing example
1 parent f4648f6 commit b9c71f8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
################################################################################
2+
# The Pyretic Project #
3+
# frenetic-lang.org/pyretic #
4+
# author: Joshua Reich ([email protected]) #
5+
################################################################################
6+
7+
from multiprocessing import Lock
8+
9+
from pyretic.lib.corelib import *
10+
from pyretic.lib.std import *
11+
12+
class topology_printer(DynamicPolicy):
13+
14+
def __init__(self):
15+
self.topology = None
16+
self.lock = Lock()
17+
super(topology_printer,self).__init__()
18+
19+
def set_network(self, network):
20+
with self.lock:
21+
if self.topology and (self.topology == network.topology):
22+
pass
23+
else:
24+
print self.topology
25+
print network.topology
26+
self.topology = network.topology
27+
print self.topology
28+
29+
30+
def main ():
31+
return topology_printer()

0 commit comments

Comments
 (0)