Bases: object
Top-level abstract class for policies. All Pyretic policies have methods for
evaluate this policy on a single packet
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
The parallel composition operator.
Parameters: | pol (Policy) – the Policy to the right of the operator |
---|---|
Return type: | Parallel |
The sequential composition operator.
Parameters: | pol (Policy) – the Policy to the right of the operator |
---|---|
Return type: | Sequential |
Syntactic equality.
Syntactic inequality.
list of weak references to the object (if defined)
Bases: pyretic.core.language.Policy
Abstact class for filter policies. A filter Policy will always either
No packets will ever be modified by a Filter.
evaluate this policy on a single packet
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
The Boolean OR operator.
Parameters: | pol (Filter) – the filter Policy to the right of the operator |
---|---|
Return type: | Union |
The Boolean AND operator.
Parameters: | pol (Filter) – the filter Policy to the right of the operator |
---|---|
Return type: | Intersection |
The Boolean subtraction operator.
Parameters: | pol (Filter) – the filter Policy to the right of the operator |
---|---|
Return type: | Difference |
The Boolean negation operator.
Parameters: | pol (Filter) – the filter Policy to the right of the operator |
---|---|
Return type: | negate |
Bases: pyretic.core.language.Filter
Match on all specified fields. Matched packets are kept, non-matched packets are dropped.
Parameters: |
|
---|
evaluate this policy on a single packet
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
Bases: pyretic.core.language.Policy
Modify on all specified fields to specified values.
Parameters: |
|
---|
evaluate this policy on a single packet
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
Bases: pyretic.core.language.Filter
Abstract class representing a data structure into which packets (conceptually) go and with which callbacks can register.
evaluate this policy on a single packet
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Bases: pyretic.core.language.Query
Class for registering callbacks on individual packets sent to the controller.
Produce a Classifier for this policy
Return type: | Classifier |
---|
Bases: pyretic.core.language.Query
Class for registering callbacks on counts of packets sent to the controller.
evaluate this policy on a single packet
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
Use a condition variable to mediate access to bucket state as it is being updated.
Why condition variables and not locks? The main reason is that the state update doesn’t happen in just a single function call here, since the runtime processes the classifier rule by rule and buckets may be touched in arbitrary order depending on the policy. They’re not all updated in a single function call. In that case,
(1) Holding locks across function calls seems dangerous and non-modular (in my opinion), since we need to be aware of this across a large function, and acquiring locks in different orders at different points in the code can result in tricky deadlocks (there is another lock involved in protecting bucket updates in runtime).
(2) The “with” semantics in python is clean, and splitting that into lock.acquire() and lock.release() calls results in possibly replicated failure handling code that is boilerplate.
Add a match m to list of classifier rules to be queried for counts.
Point to function that issues stats queries in the runtime.
Issue stats queries from the runtime
Given a flow_stats_reply from switch s, collect only those counts which are relevant to this bucket.
Very simple processing for now: just collect all packet and byte counts from rules that have a match that is in the set of matches this bucket is interested in.
Bases: pyretic.core.language.Policy
Abstract class for policy combinators.
Parameters: | policies (list Policy) – the policies to be combined. |
---|
Bases: pyretic.core.language.CombinatorPolicy, pyretic.core.language.Filter
Combinator that negates the input policy.
Parameters: | policies (list Filter) – the policies to be negated. |
---|
evaluate this policy on a single packet
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
Bases: pyretic.core.language.CombinatorPolicy
Combinator for several policies in parallel.
Parameters: | policies (list Policy) – the policies to be combined. |
---|
evaluates to the set union of the evaluation of self.policies on pkt
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
Bases: pyretic.core.language.parallel, pyretic.core.language.Filter
Combinator for several filter policies in parallel.
Parameters: | policies (list Filter) – the policies to be combined. |
---|
Bases: pyretic.core.language.CombinatorPolicy
Combinator for several policies in sequence.
Parameters: | policies (list Policy) – the policies to be combined. |
---|
evaluates to the set union of each policy in self.policies on each packet in the output of the previous. The first policy in self.policies is evaled on pkt.
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
Bases: pyretic.core.language.sequential, pyretic.core.language.Filter
Combinator for several filter policies in sequence.
Parameters: | policies (list Filter) – the policies to be combined. |
---|
Bases: pyretic.core.language.Policy
Abstract class for a policy derived from another policy.
Parameters: | policy (Policy) – the internal policy (assigned to self.policy) |
---|
evaluates to the output of self.policy.
Parameters: | pkt (Packet) – the packet on which to be evaluated |
---|---|
Return type: | set Packet |
Produce a Classifier for this policy
Return type: | Classifier |
---|
Bases: pyretic.core.language.DerivedPolicy, pyretic.core.language.Filter
The difference between two filter policies..
Parameters: |
|
---|
Bases: pyretic.core.language.DerivedPolicy
if pred holds, t_branch, otherwise f_branch.
Parameters: |
|
---|
Bases: pyretic.core.language.DerivedPolicy
fwd out a specified port.
Parameters: | outport (int) – the port on which to forward. |
---|
Bases: pyretic.core.language.DerivedPolicy
fwd out a specified port, unless the packet came in on that same port. (Semantically equivalent to OpenFlow’s forward action
Parameters: | outport (int) – the port on which to forward. |
---|
Bases: pyretic.core.language.DerivedPolicy
Abstact class for dynamic policies. The behavior of a dynamic policy changes each time self.policy is reassigned.
Bases: pyretic.core.language.DynamicPolicy, pyretic.core.language.Filter
Abstact class for dynamic filter policies. The behavior of a dynamic filter policy changes each time self.policy is reassigned.
Bases: pyretic.core.language.DynamicPolicy
Policy that floods packets on a minimum spanning tree, recalculated every time the network is updated (set_network).
Bases: pyretic.core.language.DynamicFilter
Returns True if a packet is located at a (switch,inport) pair entering the network, False otherwise.
Bases: pyretic.core.language.DynamicFilter
Returns True if a packet is located at a (switch,outport) pair leaving the network, False otherwise.
Bases: object
A rule contains a filter and the parallel composition of zero or more Pyretic actions.
Based on syntactic equality of policies.
Based on syntactic equality of policies.
If this rule matches the packet, then return the union of the sets of packets produced by the actions. Otherwise, return None.
list of weak references to the object (if defined)
Bases: object
A classifier contains a list of rules, where the order of the list implies the relative priorities of the rules. Semantically, classifiers are functions from packets to sets of packets, similar to OpenFlow flow tables.
Based on syntactic equality of policies.
Based on syntactic equality of policies.
list of weak references to the object (if defined)
Evaluate against each rule in the classifier, starting with the highest priority. Return the set of packets resulting from applying the actions of the first rule that matches.
Bases: pyretic.core.language.DynamicFilter
A DynamicFilter that matches the first limit packets in a specified grouping.
Parameters: |
|
---|
Bases: pyretic.core.language.DerivedPolicy
A FwdBucket preceeded by a LimitFilter.
Parameters: |
|
---|
Bases: pyretic.core.language.FwdBucket
An abstract FwdBucket which calls back all registered routines every interval seconds (can take positive fractional values) with an aggregate value/dict. If group_by is empty, registered routines are called back with a single aggregate value. Otherwise, group_by defines the set of headers used to group counts which are then returned as a dictionary.
Bases: pyretic.lib.query.AggregateFwdBucket
AggregateFwdBucket that calls back with aggregate count of packets.
Bases: pyretic.lib.query.AggregateFwdBucket
AggregateFwdBucket that calls back with aggregate bytesize of packets.
Bases: object
The Runtime system. Includes packet handling, compilation to OF switches, topology maintenance, dynamic update of policies, querying support, etc.
Parameters: |
---|
The packet interpreter.
Parameters: | concrete_packet – the packet to be interpreted. |
---|
Updates runtime behavior (both interpreter and switch classifiers) some sub-policy in self.policy changes.
Updates runtime behavior (both interpreter and switch classifiers) when the concrete network topology changes.
Updates switch tables based on input classifier
Parameters: | classifier (Classifier) – the input classifier |
---|
Updates the set of active dynamic sub-policies in self.policy
Reactively installs switch table entries based on a given policy evaluation.
Parameters: |
|
---|
Produces a concrete predicate exactly matching a given packet.
Parameters: | pkt (Packet) – the packet to match |
---|---|
Returns: | an exact-match predicate |
Return type: | dict of strings to values |
Produces a rule tuple exactly matching a given packet and outputing a given set of packets..
Parameters: |
|
---|---|
Returns: | an exact-match (microflow) rule |
Return type: | (dict of strings to values, int, list int) |
Proactively installs switch table entries based on the input classifier
Parameters: | classifier (Classifier) – the input classifer |
---|
Returns a function that can be used by counting buckets to issue queries from the runtime.