GithubHelp home page GithubHelp logo

frenetic-lang / pyretic Goto Github PK

View Code? Open in Web Editor NEW
157.0 62.0 99.0 52.16 MB

The Pyretic language and runtime system

Home Page: http://frenetic-lang.org/pyretic/

Makefile 0.33% Python 58.99% Shell 1.38% Ruby 0.07% HCL 2.59% Apex 33.16% C 3.33% TeX 0.01% C++ 0.15%

pyretic's Introduction

======= Pyretic

THIS PROJECT IS NO LONGER SUPPORTED. THE PYRETIC REPO HAS BEEN MADE AVAILABLE FOR ARCHIVAL PURPOSES. USE OF CODE IS AT YOUR OWN RISK.

The Pyretic platform - language & runtime system. See http://frenetic-lang.org/pyretic/ for more info.

top-level structure:

  • of_client: Clients that run on a traditional OpenFlow controller effectively serving as a backend for Pyretic
  • mininet: Slightly modified version of mininet mn and extra topologies used by Pyretic
  • mininet.sh: A wrapper that starts up mininet for use w/ Pyretic
  • pyretic: Pyretic system proper
  • pyretic.py: A wrapper that starts up Pyretic and optionally an OpenFlow client (see above)

pyretic's People

Contributors

anshumanmohan avatar etanzapinsky avatar jamesguthrie avatar lvanbever avatar mgree avatar minmit avatar monsanto avatar ngsrinivas avatar nkatta avatar reitblatt avatar sige avatar xinjin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyretic's Issues

pyretic without mininet

Hey everyone,

I was trying to run pyretic without mininet. I am under the impression that the backend is automatically initialized in the mininet setup you have, so how can i do it manually?
Is there a default ip address for the backend that i can use?

Let's say i want to start POX backend with ip address 10.1.1.1 on ubuntu.

Of cource is see:
Connected to pyretic frontend.
INFO:core:POX 0.2.0 (carp) is up.
when i run a test but i can't use pyretic for my network.

Thanks in advance,
Harris.

Python3 Strategy

I am working on a port of pyretic to python3 for my own needs. Things are looking good so far, I am just wondering what your approach to supporting py2 and py3 is.

I guess there's not much demand yet from pyretic users for py3 compatibility, so having py2 support may be a desired feature. It would probably be too much maintenance effort to develop simultaneously on py2 and py3 branches. I would suggest there are a two options to maintaining py2 and py3:

  • One codebase which is py2 and py3 compatible (using something like six)
  • Move forwards with master py3-only, tag current release as py2 and move forward with py3, backporting important changes if necessary.

The porting that I have done for myself does not support py2 and py3 compatibility, but it would probably be possible to make it work. Py3 is not going anywhere and py2 will not progress past 2.7.x, so developing for py3 on master sort of matches current python development.

My question is: is there any reason why moving forward with the master branch being py3 and having a py2 tag for "backwards compatibility" is a terrible idea? If so, it might be worth investing the effort in having a single py2 and py3 compatible codebase, otherwise I would prepare a pull request with the python3 changes.

Port to Python 3

Python 2 is a sinking ship. This won't be very hard, the only thing that stands in the way is POX. Perhaps this gives motivation to increase the separation from POX.

Inport error in Pyretic

I got an error saying this :
2:e7:90:2e:a8:23 ff:ff:ff:ff:ff:ff 1 error: uncaptured python exception, closing channel <pyretic.backend.backend.BackendChannel connected 127.0.0.1:57348 at 0x7f263a67ca28> (<type 'exceptions.KeyError'>:'inport' [/usr/lib/python2.7/asyncore.py|read|83] [/usr/lib/python2.7/asyncore.py|handle_read_event|449] [/usr/lib/python2.7/asynchat.py|handle_read|167] [/root/pyretic/pyretic/backend/backend.py|found_terminator|111] [/root/pyretic/pyretic/core/runtime.py|handle_packet_in|365] [/root/pyretic/pyretic/core/language.py|apply|770] [/root/pyretic/pyretic/tutorial/yen_ksp.py|mymac_learner|251] [/root/pyretic/pyretic/core/packet.py|getitem|530] [/root/pyretic/pyretic/core/util.py|getitem|127])

I have tried everything i can and I'm struck . Can anyone please help me out ?

Issue 1 - no 'dstport=80' match entry in flows table

Hello everyone,
I am Daniele De Cicco, master student of Computer Engineering at University of Naples (Italy). Since November I have been working on my master thesis at the Catholic University of Louvain (Belgium).
I am developing my project with Pyretic and recently I have run into three different anomalies:

  • ISSUE 1

If I try to run the following function

def action():
    q=count_packets(interval=10,group_by=['srcip','dstip']) 
    q.register_callback(count_packets_printer)
    return (match(dstport=80,switch=2) >> q)

no entry that matches on dst port 80 is installed in the flow table at switch 2. I tested it with the mininet command "dpctl dump-flows".
This is what the command returns before installing the rule

*** s2 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=8.247s, table=0, n_packets=11, n_bytes=790, priority=59999,vlan_tci=0x0000 actions=drop
cookie=0x0, duration=8.247s, table=0, n_packets=0, n_bytes=0, priority=60000,vlan_tci=0x0000,dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x0, duration=8.247s, table=0, n_packets=0, n_bytes=0, priority=0 actions=CONTROLLER:65535

and this is what it returns after

*** s2 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=2.016s, table=0, n_packets=0, n_bytes=0, priority=59999,vlan_tci=0x0000 actions=CONTROLLER:65535
cookie=0x0, duration=2.016s, table=0, n_packets=0, n_bytes=0, priority=59998,vlan_tci=0x0000 actions=drop
cookie=0x0, duration=2.016s, table=0, n_packets=0, n_bytes=0, priority=60000,vlan_tci=0x0000,dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x0, duration=2.016s, table=0, n_packets=0, n_bytes=0, priority=0 actions=CONTROLLER:65535

It looks very strange to me, mostly because if I use a different field to match, for instance the destination mac address, I find the corresponding match in the entry in the flow table of switch 2.
As a result, it seems that the function does not actually filter on the port 80 but it just forwards every incoming packet.

I hope I was clear enough.
Thanks in advance,
Daniele

Proactive compilation bug

Pyretic is not installing the rules expected (and installing unexpected rule) for this policy. In particular, it's not installing the "h2 -> h1" rules:

from pyretic.lib.corelib import *

def main():
    h1 = EthAddr('00:00:00:00:00:01') 
    h2 = EthAddr('00:00:00:00:00:02')

    return (match(srcmac=h1,dstmac=h2) >> (match(switch=1) >> fwd(2)
                                           + (match(switch=2) >> fwd(2)))
            + (match(srcmac=h2,dstmac=h1) >> (match(switch=1) >> fwd(1)
                                              + (match(switch=2) >> fwd(1)))))

Rules installed for 1.0 user switch:

S1:

mininet> s1 dpctl dump-flows tcp:localhost:6634
stats_reply (xid=0x9961a7d7): flags=none type=1(flow)
  cookie=0, duration_sec=14s, duration_nsec=376000000s, table_id=1, priority=59996, n_packets=5, n_bytes=390, idle_timeout=0,hard_timeout=0,dl_vlan=0xffff,dl_vlan_pcp=0x00,actions=
  cookie=0, duration_sec=14s, duration_nsec=376000000s, table_id=1, priority=59997, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,dl_vlan=0xffff,dl_vlan_pcp=0x00,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,actions=
  cookie=0, duration_sec=14s, duration_nsec=376000000s, table_id=1, priority=59998, n_packets=1, n_bytes=98, idle_timeout=0,hard_timeout=0,dl_vlan=0xffff,dl_vlan_pcp=0x00,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,actions=output:2
  cookie=0, duration_sec=14s, duration_nsec=376000000s, table_id=1, priority=59999, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,in_port=2,dl_vlan=0xffff,dl_vlan_pcp=0x00,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,actions=IN_PORT
  cookie=0, duration_sec=14s, duration_nsec=376000000s, table_id=1, priority=60000, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,dl_vlan=0xffff,dl_vlan_pcp=0x00,dl_type=0x88cc,nw_src=0.0.0.0,nw_dst=0.0.0.0,nw_tos=0x00,nw_proto=0,tp_src=0,tp_dst=0,actions=CONTROLLER:65535
  cookie=0, duration_sec=14s, duration_nsec=376000000s, table_id=1, priority=0, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,actions=CONTROLLER:65535

S2:

mininet> s1 dpctl dump-flows tcp:localhost:6635
stats_reply (xid=0x9d200f23): flags=none type=1(flow)
  cookie=0, duration_sec=50s, duration_nsec=668000000s, table_id=1, priority=59998, n_packets=5, n_bytes=390, idle_timeout=0,hard_timeout=0,dl_vlan=0xffff,dl_vlan_pcp=0x00,actions=
  cookie=0, duration_sec=50s, duration_nsec=668000000s, table_id=1, priority=59999, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,dl_vlan=0xffff,dl_vlan_pcp=0x00,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,actions=
  cookie=0, duration_sec=50s, duration_nsec=668000000s, table_id=1, priority=60000, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,dl_vlan=0xffff,dl_vlan_pcp=0x00,dl_type=0x88cc,nw_src=0.0.0.0,nw_dst=0.0.0.0,nw_tos=0x00,nw_proto=0,tp_src=0,tp_dst=0,actions=CONTROLLER:65535
  cookie=0, duration_sec=50s, duration_nsec=668000000s, table_id=1, priority=0, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,actions=CONTROLLER:65535

NameError: name 'dynamic' is not defined

hi:
I am a newer in SDN.I get a trouble about pyretic.The following is pyretic_switcher.py.

from pyretic.lib.corelib import *
from pyretic.lib.std import *

@dynamic
def act_like_switch(self):
"""
Implement switch-like behavior.
"""

self.forward = flood()
self.query = packets(limit=1,group_by=['srcmac','switch'])
self.policy = self.forward + self.query
def learn_from_a_packet(pkt):

    self.forward = if_(match(dstmac=pkt['srcmac'],
                             switch=pkt['switch']), fwd(pkt['inport']),
                       self.policy) 

    self.policy = self.forward + self.query # hint you've already written this
    print self.policy 

self.query.register_callback(learn_from_a_packet)

def main():
return act_like_switch()

But when I input pyretic.py –v high pyretic.examples.pyretic_switch,I get these information:

Traceback (most recent call last):
File "/root/pyretic/pyretic.py", line 211, in
main()
File "/root/pyretic/pyretic.py", line 124, in main
module = import_module(module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/root/pyretic/pyretic/examples/pyretic_switch.py", line 7, in
@dynamic
NameError: name 'dynamic' is not defined

what should I do?
thanks

error in the first time running pyretic.py

I have followed the intruction in https://github.com/frenetic-lang/pyretic/wiki/Building-the-Pyretic-VM, and then i tried to run 'pyretic.py -v high pyretic.modules.mac_learner' in my VM terminal but i got this error:
Traceback (most recent call last):
File "/root/pyretic/pyretic.py", line 192, in
main()
File "/root/pyretic/pyretic.py", line 163, in main
runtime = Runtime(Backend(),main,kwargs,options.mode,options.verbosity)
File "/root/pyretic/pyretic/core/runtime.py", line 75, in init
self.update_dynamic_sub_pols()
File "/root/pyretic/pyretic/core/runtime.py", line 228, in update_dynamic_sub_pols
p.set_network(self.network)
File "/root/pyretic/pyretic/core/language.py", line 1113, in set_network
in self.mst.switches(with_ports=True)])
AttributeError: 'Topology' object has no attribute 'switches'

am i missing something...??
please, help me.

Issue 3 - dynamic policy does not destroy previous versions of policy

Hello everyone,
I am Daniele De Cicco, master student of Computer Engineering at University of Naples (Italy). Since November I have been working on my master thesis at the Catholic University of Louvain (Belgium).
I am developing my project with Pyretic and recently I have run into three different anomalies:

  • ISSUE 3

In case I create a dynamic policy that changes periodically, and each time installs a new query, the thread associated with the previous version of the policy is not destroyed but keeps on running.

This code exposes clearly the problem:

from pyretic.lib.corelib import *
from pyretic.lib.std import *
from pyretic.lib.query import *
from threading import Thread, current_thread
from time import sleep

def count_packets_printer(counts):
    print '\n'
    print current_thread()
    print '----SWITCH MONITOR------'
    print counts

def port_monitoring(dst_port,time_interval):
    q=count_packets(interval=time_interval,group_by=['srcip','dstip']) 
    q.register_callback(count_packets_printer)
    return (match(dstport=dst_port) >> q)

class test(DynamicPolicy):
    def __init__(self):
        super(test,self).__init__(false)
        self.start()

    def start(self):
        x=75
        while(True):
             self.policy = port_monitoring(x,5)
             x +=1
             sleep(4)

def main():
     return test()

I hope I was clear enough.
Thanks in advance,
Daniele

pop and push are not in language.py anymore

It seems that the "pop" and "push" operations that are called within the virt.py are not defined anymore in the imported modules. I looked in the deprecated branch and they were defined as classes there (in language.py), but in the master branch these definitions are gone. For example, if you call a pyretic script (in this case it is just a simple script developed for a school exercise) that imports from virt.py you get the following error:
mininet@mininet-vm:~/pyretic$ ./pyretic.py pyretic.examples.ex2_pyretic_main
Traceback (most recent call last):
File "./pyretic.py", line 192, in
main()
File "./pyretic.py", line 112, in main
module = import_module(module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/mininet/pyretic/pyretic/examples/ex2_pyretic_main.py", line 3, in
from pyretic.lib.virt import *
File "/home/mininet/pyretic/pyretic/lib/virt.py", line 70, in
class lift_packet(DerivedPolicy):
File "/home/mininet/pyretic/pyretic/core/util.py", line 42, in singleton
return f()
File "/home/mininet/pyretic/pyretic/lib/virt.py", line 74, in init
pop("vtag") >>
NameError: global name 'pop' is not defined

It seems that the problem is that the operations needed to "lift" the packet are not there anymore. Hope that the description is helpful. Regarding the script there is nothing really important about it, only that it imports virt.py to use the virtualization functions of pyretic.

wildcards in pyretic...

Is there a way to specify wildcards in pyretic for mac addresses when matching policies something like below.

match(srcmac=, dstmac=)

Thanks,
-Tejas

RunTime Error when traffic increased

Hi, I'm having some troubles trying to use the methods count_packets and count_bytes. I'm implementing a module that prints networks stats every second. When I test the module with low traffic (ping tests) it works just fine, but when I increased the traffic using a script, the next error arise:

error: uncaptured python exception, closing channel <pyretic.backend.backend.BackendChannel connected 127.0.0.1:38907 at 0x8eccf6c> (<type 'exceptions.RuntimeError'>:BAD MSG IN!!!! [/usr/lib/python2.7/asyncore.py|read|83] [/usr/lib/python2.7/asyncore.py|handle_read_event|444] [/usr/lib/python2.7/asynchat.py|handle_read|158] [/home/mininet/pyretic/pyretic/backend/backend.py|found_terminator|81] [/home/mininet/pyretic/pyretic/backend/comm.py|deserialize|67])

I don't really know what could be wrong with my module since I'm just using those methods and printing the result. I hope you can help me.

Thanks

policy_changes generator bug

policy_changes generator in network.py does not appear to work.
made several attempts to fix, but no luck. If the code seems straightforward to Nate, he should take a stab, otherwise this need Chris. Also while fixing, adding inline comments on how generator code works would be extremely helpful.
see examples/monitor_policy.py to see failure in action

pingall failing on medium-sized virtualized topologies

./pyretic/mininet.sh --switch ovsk --topo=clique,5,5
pox.py --no-cli pyretic/examples/virtualize.py --program=pyretic/examples/learning_switch.py --virttopo=pyretic/virttopos/bfs.py

pingall fails. likely related are link timeout/link detected messages

virtualization code bug #2

the setup is exactly the same as from the original virtualization code bug report. again when the first packet it sent everything breaks. this time w/
TypeError("'module' object is not callable",)

/home/mininet/pyretic/frenetic/netcore.py(402)eval()
401 def eval(self, packet):
--> 402 return all(predicate.eval(packet) for predicate in self.predicates)
please fix this bug, and verify that example runs properly before closing.

Issue 2 - duplicate entries in the flows table

Hello everyone,
I am Daniele De Cicco, master student of Computer Engineering at University of Naples (Italy). Since November I have been working on my master thesis at the Catholic University of Louvain (Belgium).
I am developing my project with Pyretic and recently I have run into three different anomalies:

  • ISSUE 2

When I run the following code

def main():
    return (match(dstmac="00:00:00:00:00:02")>>match(switch=2,dstmac="00:00:00:00:00:02")>>fwd(2))

this is what I find in the flows table of switch 2

*** s2 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=3.131s, table=0, n_packets=0, n_bytes=0, priority=59999,in_port=2,vlan_tci=0x0000,dl_dst=00:00:00:00:00:02 actions=IN_PORT
cookie=0x0, duration=3.131s, table=0, n_packets=0, n_bytes=0, priority=59996,vlan_tci=0x0000 actions=drop
cookie=0x0, duration=3.131s, table=0, n_packets=0, n_bytes=0, priority=59998,vlan_tci=0x0000,dl_dst=00:00:00:00:00:02 actions=output:2
cookie=0x0, duration=3.131s, table=0, n_packets=0, n_bytes=0, priority=59997,vlan_tci=0x0000,dl_dst=00:00:00:00:00:02 actions=drop
cookie=0x0, duration=3.131s, table=0, n_packets=0, n_bytes=0, priority=60000,vlan_tci=0x0000,dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x0, duration=3.131s, table=0, n_packets=0, n_bytes=0, priority=0 actions=CONTROLLER:65535

Although the two sequenced policies are the same, there are actually two different entries installed in the flow table. Is it normal?

I hope I was clear enough.
Thanks in advance,
Daniele

hub module creates loops upon link failure / recovery

Hey,

We found what appears to be a bug in pyretic's hub module (proactive0 mode) while running some experiments.

We discovered a loop in the network while fuzz testing pyretic's pyretic.modules.hub module using STS on a 3-switch mesh topology.

After minimizing the trace generated from fuzz testing, we found that the events that triggered the loop were a link failure followed by a link recovery.

We took a brief look at pyretic's code, and we believe the root cause is related to the invocation at line 450 of pyretic/core/network.py:

self.reconcile_attributes(topology) # Root Cause?

Our understanding of this bug is that reconcile_attributes is neglecting to filter out down links, which is ultimately causing the MST to be computed improperly. So for example, on a 3-switch mesh, suppose pyretic initially computes the MST s1 <-> s2 <-> s3. Then, link s1 <-> s2 goes down, so pyretic recomputes a new MST s1 <-> s3 <-> s2. Then, the link goes back up. reconconcile_attributes neglects to account for the failed/recovered link, so we end up with flow entries in the network s1 <-> s3 <-> s2 <-> s1, which forms a loop. The loop seems to stay around for some time, until other events in the network cause pyretic to correct its mistake, or until pyretic periodically flushes all flow entries.

Can you verify that this is indeed a bug?

Steps for reproducing:

First, we need to fix a minor issue. Unfortunately, STS depends on a different version of POX than pyretic, both of which will be in PYTHONPATH. In pyretic.py, hardcode poxpath rather than searching PYTHONPATH, e.g.:

171         poxpath = '/home/mininet/pox'
172         #for p in output.split(':'):
173         #     if re.match('.*pox/?$',p):
174         #         poxpath = os.path.abspath(p)
175         #         break

Then clone STS and replay the minimized trace:

$ git clone git://github.com/ucb-sts/sts.git
$ cd sts
$ git clone -b frenetic_test git://github.com/ucb-sts/pox.git
$ (git submodule init && git submodule update && cd sts/hassel/hsa-python && source setup.sh)
$ git clone git://github.com/ucb-sts/experiments.git
# Assumes pyretic is at ../pyretic/
$ ./simulator.py -c experiments/new_pyretic_loop_mcs/replay_config.py

Throughout the replay you can see both STS's and pyretic's console output (pyretic's is in orange). You can also view the console output offline at experiments/new_pyretic_loop_mcs_replay/simulator.out

At the end of the replay you can examine the flow entries to see the loop:

STS [next] >show_flows 1
--------------------------------------------------------------------------------------------------------------------------------
|  Prio | in_port | dl_type | dl_src | dl_dst | nw_proto | nw_src | nw_dst | tp_src | tp_dst |                         actions |
--------------------------------------------------------------------------------------------------------------------------------
...
| 59995 |       2 |    None |   None |   None |     None |   None |   None |   None |   None |   output(1), IN_PORT, output(3) |
--------------------------------------------------------------------------------------------------------------------------------
STS [next] >show_flows 2
--------------------------------------------------------------------------------------------------------------------------------
|  Prio | in_port | dl_type | dl_src | dl_dst | nw_proto | nw_src | nw_dst | tp_src | tp_dst |                         actions |
--------------------------------------------------------------------------------------------------------------------------------
...
| 59999 |       1 |    None |   None |   None |     None |   None |   None |   None |   None |            output(2), output(3) |
--------------------------------------------------------------------------------------------------------------------------------
STS [next] >show_flows 3
---------------------------------------------------------------------------------------------------------------------
|  Prio | in_port | dl_type | dl_src | dl_dst | nw_proto | nw_src | nw_dst | tp_src | tp_dst |              actions |
---------------------------------------------------------------------------------------------------------------------
| 59995 |    None |    None |   None |   None |     None |   None |   None |   None |   None | output(1), output(3) |
---------------------------------------------------------------------------------------------------------------------

You can also see examine the network topology:

STS [next] > topology.network_links
[(1:1) -> (3:2), (1:2) -> (2:2), (3:2) -> (1:1), (2:2) -> (1:2), (2:1) -> (3:1), (3:1) -> (2:1)]

And verify that the invariant violation is there:

STS [next] > inv loops

Thanks!

Compilable action check too strict?

I'm currently coming up against an error in Pyretic in the "check_OF_rule_has_compilable_action_list" method here: https://github.com/frenetic-lang/pyretic/blob/master/pyretic/core/runtime.py#L772

I commented out the check and the resulting actions could be compiled and installed to an Open vSwitch, so it seems as though this check is too strict. In my case I have two actions with different sets of modifications, one just sets the output port, the other modifies the vlan id and sets a different output port. This appears to be supported by the OpenFlow specification, so I'm not sure what the purpose of this check was in the first place.

spanning tree virtualization example broken

pingall fails even on simple topologies

./pyretic/mininet.sh --switch ovsk --topo=single,2
pox.py --no-cli pyretic/examples/virtualize.py --program=pyretic/examples/hub.py --virttopo=pyretic/virttopos/anning_tree.py

using MPLS headr fields in pyretic

Hi
we have a research project working on MPLS networks and we are going to use pyretic. but we need to have access to MPLS header and it seems that this field is not supported by pyretic. I want to know that is there any way that I define MPLS field (as a field like VLAN) in pyretic and use it for policies like matching and modifying?

No of_client to kill in "frontend-only" mode

Hello to everyone,
if I start Pyretic with the "frontend-only" option, like this:

pyretic.py -f -m p0 pyretic.TEST.test

when I shut it down, the following error is raised up:

----starting pyretic shutdown------
attempting to kill of_client
Traceback (most recent call last):
  File "/home/daniele/pyretic/pyretic.py", line 192, in <module>
    main()
  File "/home/daniele/pyretic/pyretic.py", line 189, in main
    signal.pause()
  File "/home/daniele/pyretic/pyretic.py", line 52, in signal_handler
    of_client.kill()
AttributeError: 'NoneType' object has no attribute 'kill'

Obviously it's not a big problem, but I thought it was helpful to point it out anyway.
Regards,
Daniele

Install policies depending on fields of the packet

First of all say that I am new with Pyretic and OpenFlow, I am starting with my Master Thesis and it is about DDoS defense mechanisms with OpenFlow. One of the cases that I have to develop is TCP SYN defense, in which I control the TCP connection and when it is done then I install flow entries with the client and the server. Anyway, my question is, can I install new policies in the callback function? For example:

def newRule(pkt):
   new flow policie with fields in pkt 

def dpi():
   q = packets()
   q.register_callback(newRule)
   return q

def main():
   return (dpi())

Broken controller/switch connections when using sending TCP SYNs on port 80

pox.py --no-cli pyretic/examples/hub.py
sudo ./pyretic/tests/connectivity_test.py -v verbose --topo linear,8 -c 3 -p TCP80SYN

e.g.,
INFO:openflow.discovery:link detected: 00-00-00-00-00-08.2 -> 00-00-00-00-00-07.3
DEBUG:openflow.of_01:[Con 23/2] Socket error: Broken pipe
DEBUG:openflow.of_01:[Con 23/2] disconnecting
ERROR:send_packet: Broken pipe to switch 2
ERROR:send_packet: No connection to switch 2 available

arp.py reply SENDER and TARGET mac address filled as broadcast

Hello,

I´ve noticed in arp.py that when arp reply packet is generated SENDER and TARGET mac address of ARP Header are filled as broadcast (FF:FF:FF:FF:FF:FF):

  • Inside ARP Header sender and target IP´s are filled OK with expected values
  • In Ethernet Headers the MAC src and dst are expected ones (Not broadcast).

Is there a way to fix that (or explain me how pyretic fill this arp Header in order to try to force it myself) in order that mac addresses inside of arp Header are the same as the ones in Ethernet Headers ??. Current behaviour leads to an ip-mac bind in end hosts with mac as broadcast, not the espected one from my side.

Thanks.

Concurrent field modification in parallel composition

Let

p1 = match(inport=1) >> modify(outport=2, dstip='1.2.3.4')
p2 = match(inport=1) >> modify(outport=3)
p3 = match(inport=1) >> modify(outport=4, dstmac='11:22:33:44:55:66')

According to parallel composition semantics (p1 + p2) should produce two packets: one on port 3 with unmodified fields and one on port 2 with dstip='1.2.3.4'. It's implementable with this openflow 1.0 rule:

in_port=1 actions=output:3,mod_nw_dst:1.2.3.4,output:2

However, Pyretic-generated rule will send modified packet to both ports:

in_port=1 actions=mod_nw_dst:1.2.3.4,output:2,output:3

Second problem is: what we should generate for (p1 + p3)? Seems it isn't implementable with openflow 1.0-1.4. We need to save/restore packet fields or dup entire packet.

Document how to run tests

There are a lot of tests for pyretic but it's unclear how they should be run. Using a test runner like nosetests fails and there is no clear tests.py file which can be run (and executes tests). Could you please document how the tests are to be run? Additionally, it might be cool to have a travis automatic build which can be used to evaluate pull requests.

maximum recursion depth when hashing frozendict

low priority
seen when running learning_switch when pyretic/tests/connectivity_test.py has been called repeatedly (10~ times)

RuntimeError('maximum recursion depth exceeded',)

/home/mininet/pyretic/frenetic/util.py(173)hash()
172 except AttributeError:
--> 173 h = self._cached_hash = hash(frozenset(self._dict.items()))
174 return h

Barrier request error using pox

Hi,

I'm trying to track the source of this bug.

When using an HP switch, my application (sdx) is not being able to install flow rules in the switch. The standard mac_learning application works fine. I think there's something related to the use of barrier request before installing the flows. We might be triggering it in our code somewhere.

I'm not really proficient with pyretic, has anyone ever had problems with barrier requests before?

util.frozendict issues

hash function doesn't appear to hash consistently (frozendicts with identical entries hash to different values)
equality operators use those provided by the dict class - I recall Chris saying that these were incorrectly implemented in python. If so, these need to be fixed.

Flow setup latency issue

Hi,
I was testing the impact over the flow setup latency when the channel between the OVS and the controller is congested. I have defined three time intervals: the time that a PKT_IN takes to arrive at the controller (B1), the time to process the PKT_IN and send a FLOW_MOD (B2), and the time that the FLOW_MOD takes to arrive at the OVS (B3). When the channel is congested, a new iperf connection is started to measure the latency. Whereas the congestion is greater, the value of B1 is greater too, but B2 must be the same, i.e. the time to process a PKT_IN must not be modified by the congestion. Strangely, Pyretic increments the time to process a PKT_IN when the congestion is greater. Apparently there is a dependency between the channel's congestion and the PKT_IN's processing time.
I'm not sure if this is a expected behaviour, because this same test using another controller shows a constant values of B2, which is a correct expected behavior.
Thanks in advance for your help.
Ricardo.

IOError: No such file or directory: ids.smv

when I type "python pyretic.py pyretic.kinetic.apps.ids"
will show the below error message
"IOError: No such file or directory: '/root/pyretic/pyretic/kinetic/smv/smv_files/ids.smv"

what can I do to save it?

virtualization code bug

(As summarized by Nate)
Here's what you can do to tickle the bug:

  1. Boot up Mininet in a simple non-trivial topology

sudo mn --controller=remote --topo=tree,2 --mac --switch=ovsk

  1. Start POX running the Pyretic code

export PATH=$PATH:/home/mininet/pox
export PYTHONPATH=/home/mininet/pox:/home/mininet/pyretic
pox.py pyretic/examples/virtualize.py
--virttopo=pyretic/virttopos/bfs.py
--program=pyretic/examples/hub.py

  1. Ping between hosts h1 and h3.

You should see the following error:

RuntimeError('maximum recursion depth exceeded while getting the str of an object',)
/home/mininet/pyretic/frenetic/util.py(84)new()
83 def new(cls, _args, *_kwargs):
85 return cls.real_base.new(cls, _args, *_kwargs)

I'm not a reflection expert, but it looks to me that this may be
trying to invoke the same constructor that it was just called with? I
added some debugging code and cls is frenetic.netcore.restrict, and
cls.__real__Base is "Record_restrict" and

Get the variable value

I got a packet variable whose type is <class 'pyretic.core.network.Packet'>.
screen shot 2016-04-27 at 1 11 43 pm
How to get each field value.

multiswitchs problem

Hi everybody, i am new learning Pyretic. But i have found a problem. When i use a linear topology with Mininet by '' sudo mn --topo linear,3,3 --controller remote ", Pyretic can not detect my correct topology. Hub module doesn't work properly because of this problem. The problem is the same with tree topology.

Anybody know what's wrong?

Thank you

Packet losses when pinging on larger topologies

pox.py --no-cli pyretic/examples/hub.py
sudo ./pyretic/tests/connectivity_test.py -v verbose --topo linear,10 -c 3 -p ICMP

possibly related to link timeouts...
INFO:openflow.discovery:link timeout: 00-00-00-00-00-06.2 -> 00-00-00-00-00-05.3
INFO:openflow.discovery:link timeout: 00-00-00-00-00-08.3 -> 00-00-00-00-00-09.2
INFO:openflow.discovery:link timeout: 00-00-00-00-00-07.2 -> 00-00-00-00-00-06.3
INFO:openflow.discovery:link timeout: 00-00-00-00-00-06.3 -> 00-00-00-00-00-07.2
INFO:openflow.discovery:link timeout: 00-00-00-00-00-07.3 -> 00-00-00-00-00-08.2

frenetic not found

running
pyretic.py -m p0 pyretic.modules.mac_learner
in the tutorial gives the following errors
./frenetic: No such file or directory.
ERROR:pyretic.core.netkat.netkat:2015-12-07 10:32:03,111: Compiling with the netkat compilation server failed. ([Errno 97] Address family not supported by protocol)

Tried working cloning and running frenetic by
frenetic compile-server --verbosity=error
gives the following error when mininet boots up.

Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(_self.__args, *_self.__kwargs)
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/runtime.py", line 2194, in f
self.runtime.handle_network_change()
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/runtime.py", line 402, in handle_network_change
self.update_switch_classifiers()
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/runtime.py", line 462, in update_switch_classifiers
classifier = self.whole_policy_compile()
File "/home/bovenyan/Documents/src/pyretic/pyretic/evaluations/stat.py", line 158, in profiled_func
res = func(_args, *_kwargs)
File "/home/bovenyan/Documents/src/pyretic/pyretic/evaluations/stat.py", line 109, in profiled_func
res = func(_args, *_kwargs)
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/runtime.py", line 424, in whole_policy_compile
p = self.policy.netkat_compile(self.sw_cnt())[0] # directly compile with netkat
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/language.py", line 174, in netkat_compile
print_json)
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/netkat.py", line 137, in generate_classifier
return httplib_channel_compilation(pol, qdict)
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/netkat.py", line 131, in httplib_channel_compilation
classifier = json_to_classifier(netkat_out, qdict, multistage)
File "/home/bovenyan/Documents/src/pyretic/pyretic/core/netkat.py", line 464, in json_to_classifier
queries = get_queries_from_names(rule['queries'], qdict)
KeyError: 'queries'

QoS plans

Hello all.

I was wondering if there is a plan for QoS (Quality of Service) support? if there is a plan, will there be a preview of the design??

Thanks for your time and help. Keep up the fantastic work

monitor_packets.py

Traceback (most recent call last):
  File "/media/sf_pox/pox/lib/revent/revent.py", line 233, in raiseEventNoErrors
    return self.raiseEvent(event, *args, **kw)
  File "/media/sf_pox/pox/lib/revent/revent.py", line 280, in raiseEvent
    rv = event._invoke(handler, *args, **kw)
  File "/media/sf_pox/pox/lib/revent/revent.py", line 158, in _invoke
    return handler(self, *args, **kw)
  File "/home/mininet/pyretic/frenetic/pox_backend.py", line 209, in _handle_PacketIn
    bucket.signal(pkt)
  File "/home/mininet/pyretic/frenetic/generators.py", line 49, in signal
    listener(item)
  File "/home/mininet/pyretic/frenetic/network.py", line 629, in inc
    pred = match([(field,pkt[field]) for field in self.group_by])
  File "/home/mininet/pyretic/frenetic/network.py", line 215, in __getitem__
    raise KeyError
KeyError

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.