ovs_dbg package¶
Submodules¶
ovs_dbg.flows module¶
Common helper classes for flow (ofproto/dpif) parsing
- class ovs_dbg.flows.KVDecoders(decoders=None, default=None, default_free=None)[source]¶
Bases:
objectKVDecoders class is used by KVParser to select how to decoode the value of a specific keyword.
A decoder is simply a function that accepts the keyword and value strings and returns the keyword and value objects to be stored. The returned keyword must be a string but may not be the same as the given keyword. The returned value may be of any type.
- Parameters
decoders (dict) – Optional; A dictionary of decoders indexed by keyword.
default (callable) – Optional; A decoder used if a match is not found in configured decoders. If not provided, the default behavior is to try to decode the value into an integer and, if that fails, just return the string as-is.
default_free (callable) – Optional; A decoder used if a match is not found in configured decoders and it’s a free value (e.g: a keyword without a value). Defaults to returning the free value as keyword and “True” as value.
- class ovs_dbg.flows.KVParser(decoders=None)[source]¶
Bases:
objectKVParser parses a string looking for key-value pairs.
- Parameters
decoders (KVDecoders) – Optional; the KVDecoders instance to use.
- class ovs_dbg.flows.KeyMetadata(kpos, vpos, kstring, vstring, end_del)[source]¶
Bases:
objectClass for keeping key metadata.
- kpos¶
The position of the keyword in the parent string.
- Type
int
- vpos¶
The position of the value in the parent string.
- Type
int
- kstring¶
The keyword string as found in the flow string.
- Type
string
- vstring¶
The value as found in the flow string.
- Type
string
- end_del¶
Whether the key has end delimiter.
- Type
bool
- class ovs_dbg.flows.KeyValue(key, value, meta=None)[source]¶
Bases:
objectClass for keeping key-value data
- key¶
The key string.
- Type
str
- value¶
The value data.
- Type
any
- meta¶
The key metadata.
- Type
- exception ovs_dbg.flows.ParseError[source]¶
Bases:
RuntimeErrorException raised when an error occurs during parsing.
- ovs_dbg.flows.default_kv_decoder(key, value)¶
A key-value decoder that extracts nested key-value pairs and returns them in a dictionary
- Parameters
decoders (KVDecoders) – the KVDecoders to use.
key (str) – the keyword we’re decoding.
value (str) – the value string to decode.