tc_policy module

This module is part of the nmeta suite running on top of Ryu SDN controller to provide network identity and flow (Traffic Classification - TC) metadata. It expects a file called “main_policy.yaml” to be in the config subdirectory containing properly formed YAML that conforms the the particular specifications that this program expects. See constant tuples at start of program for valid attributes to use.

class tc_policy.TrafficClassificationPolicy(config, pol_dir='config', pol_file='main_policy.yaml')

Bases: baseclass.BaseClass

This class is instantiated by nmeta.py and provides methods to ingest the policy file main_policy.yaml and check flows against policy to see if actions exist

class Condition

Bases: object

An object that represents a traffic classification condition, including any decision collateral on match test

to_dict()

Return a dictionary object of the condition object

class TrafficClassificationPolicy.Conditions

Bases: object

An object that represents traffic classification conditions, including any decision collateral on matches and actions

to_dict()

Return a dictionary object of the condition object

class TrafficClassificationPolicy.Rule

Bases: object

An object that represents a traffic classification rule (a set of conditions), including any decision collateral on matches and actions

to_dict()

Return a dictionary object of the condition object

TrafficClassificationPolicy.check_policy(flow, ident)

Passed a flows object, set in context of current packet-in event, and an identities object. Check if packet matches against any policy rules and if it does, update the classifications portion of the flows object to reflect details of the classification.

TrafficClassificationPolicy.qos(qos_treatment)

Passed a QoS treatment string and return the relevant QoS queue number to use, otherwise 0. Works by lookup on qos_treatment section of main_policy

TrafficClassificationPolicy.validate_policy()

Check main policy to ensure that it is in correct format so that it won’t cause unexpected errors during packet checks.