partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
VSCtlContext.parse_column_key_value
Parses 'setting_string' as str formatted in <column>[:<key>]=<value> and returns str type 'column' and json formatted 'value'
ryu/lib/ovs/vsctl.py
def parse_column_key_value(table_schema, setting_string): """ Parses 'setting_string' as str formatted in <column>[:<key>]=<value> and returns str type 'column' and json formatted 'value' """ if ':' in setting_string: # splits <column>:<key>=<value> into <column> and ...
def parse_column_key_value(table_schema, setting_string): """ Parses 'setting_string' as str formatted in <column>[:<key>]=<value> and returns str type 'column' and json formatted 'value' """ if ':' in setting_string: # splits <column>:<key>=<value> into <column> and ...
[ "Parses", "setting_string", "as", "str", "formatted", "in", "<column", ">", "[", ":", "<key", ">", "]", "=", "<value", ">", "and", "returns", "str", "type", "column", "and", "json", "formatted", "value" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L775-L795
[ "def", "parse_column_key_value", "(", "table_schema", ",", "setting_string", ")", ":", "if", "':'", "in", "setting_string", ":", "# splits <column>:<key>=<value> into <column> and <key>=<value>", "column", ",", "value", "=", "setting_string", ".", "split", "(", "':'", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl._do_main
:type commands: list of VSCtlCommand
ryu/lib/ovs/vsctl.py
def _do_main(self, commands): """ :type commands: list of VSCtlCommand """ self._reset() self._init_schema_helper() self._run_prerequisites(commands) idl_ = idl.Idl(self.remote, self.schema_helper) seqno = idl_.change_seqno while True: ...
def _do_main(self, commands): """ :type commands: list of VSCtlCommand """ self._reset() self._init_schema_helper() self._run_prerequisites(commands) idl_ = idl.Idl(self.remote, self.schema_helper) seqno = idl_.change_seqno while True: ...
[ ":", "type", "commands", ":", "list", "of", "VSCtlCommand" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L1167-L1190
[ "def", "_do_main", "(", "self", ",", "commands", ")", ":", "self", ".", "_reset", "(", ")", "self", ".", "_init_schema_helper", "(", ")", "self", ".", "_run_prerequisites", "(", "commands", ")", "idl_", "=", "idl", ".", "Idl", "(", "self", ".", "remote...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl._run_command
:type commands: list of VSCtlCommand
ryu/lib/ovs/vsctl.py
def _run_command(self, commands): """ :type commands: list of VSCtlCommand """ all_commands = { # Open vSwitch commands. 'init': (None, self._cmd_init), 'show': (self._pre_cmd_show, self._cmd_show), # 'emer-reset': # Bridge com...
def _run_command(self, commands): """ :type commands: list of VSCtlCommand """ all_commands = { # Open vSwitch commands. 'init': (None, self._cmd_init), 'show': (self._pre_cmd_show, self._cmd_show), # 'emer-reset': # Bridge com...
[ ":", "type", "commands", ":", "list", "of", "VSCtlCommand" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L1192-L1275
[ "def", "_run_command", "(", "self", ",", "commands", ")", ":", "all_commands", "=", "{", "# Open vSwitch commands.", "'init'", ":", "(", "None", ",", "self", ".", "_cmd_init", ")", ",", "'show'", ":", "(", "self", ".", "_pre_cmd_show", ",", "self", ".", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl.run_command
Executes the given commands and sends OVSDB messages. ``commands`` must be a list of :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`. If ``timeout_sec`` is specified, raises exception after the given timeout [sec]. Additionally, if ``exception`` is specified, this function will wraps ...
ryu/lib/ovs/vsctl.py
def run_command(self, commands, timeout_sec=None, exception=None): """ Executes the given commands and sends OVSDB messages. ``commands`` must be a list of :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`. If ``timeout_sec`` is specified, raises exception after the given timeou...
def run_command(self, commands, timeout_sec=None, exception=None): """ Executes the given commands and sends OVSDB messages. ``commands`` must be a list of :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`. If ``timeout_sec`` is specified, raises exception after the given timeou...
[ "Executes", "the", "given", "commands", "and", "sends", "OVSDB", "messages", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L1277-L1295
[ "def", "run_command", "(", "self", ",", "commands", ",", "timeout_sec", "=", "None", ",", "exception", "=", "None", ")", ":", "if", "timeout_sec", "is", "None", ":", "self", ".", "_run_command", "(", "commands", ")", "else", ":", "with", "hub", ".", "T...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl._check_value
:type column_value: tuple of column and value_json
ryu/lib/ovs/vsctl.py
def _check_value(self, ovsrec_row, column_value): """ :type column_value: tuple of column and value_json """ column, value_json = column_value column_schema = ovsrec_row._table.columns[column] value = ovs.db.data.Datum.from_json( column_schema.type, value_json...
def _check_value(self, ovsrec_row, column_value): """ :type column_value: tuple of column and value_json """ column, value_json = column_value column_schema = ovsrec_row._table.columns[column] value = ovs.db.data.Datum.from_json( column_schema.type, value_json...
[ ":", "type", "column_value", ":", "tuple", "of", "column", "and", "value_json" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L2142-L2158
[ "def", "_check_value", "(", "self", ",", "ovsrec_row", ",", "column_value", ")", ":", "column", ",", "value_json", "=", "column_value", "column_schema", "=", "ovsrec_row", ".", "_table", ".", "columns", "[", "column", "]", "value", "=", "ovs", ".", "db", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl._find
:type column_values: list of (column, value_json)
ryu/lib/ovs/vsctl.py
def _find(self, ctx, table_name, column_values): """ :type column_values: list of (column, value_json) """ result = [] for ovsrec_row in ctx.idl.tables[table_name].rows.values(): LOG.debug('ovsrec_row %s', ovsrec_row_to_string(ovsrec_row)) if all(self._che...
def _find(self, ctx, table_name, column_values): """ :type column_values: list of (column, value_json) """ result = [] for ovsrec_row in ctx.idl.tables[table_name].rows.values(): LOG.debug('ovsrec_row %s', ovsrec_row_to_string(ovsrec_row)) if all(self._che...
[ ":", "type", "column_values", ":", "list", "of", "(", "column", "value_json", ")" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L2160-L2171
[ "def", "_find", "(", "self", ",", "ctx", ",", "table_name", ",", "column_values", ")", ":", "result", "=", "[", "]", "for", "ovsrec_row", "in", "ctx", ".", "idl", ".", "tables", "[", "table_name", "]", ".", "rows", ".", "values", "(", ")", ":", "LO...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl._set
:type column_values: list of (column, value_json)
ryu/lib/ovs/vsctl.py
def _set(self, ctx, table_name, record_id, column_values): """ :type column_values: list of (column, value_json) """ vsctl_table = self._get_table(table_name) ovsrec_row = ctx.must_get_row(vsctl_table, record_id) for column, value in column_values: ctx.set_col...
def _set(self, ctx, table_name, record_id, column_values): """ :type column_values: list of (column, value_json) """ vsctl_table = self._get_table(table_name) ovsrec_row = ctx.must_get_row(vsctl_table, record_id) for column, value in column_values: ctx.set_col...
[ ":", "type", "column_values", ":", "list", "of", "(", "column", "value_json", ")" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L2243-L2251
[ "def", "_set", "(", "self", ",", "ctx", ",", "table_name", ",", "record_id", ",", "column_values", ")", ":", "vsctl_table", "=", "self", ".", "_get_table", "(", "table_name", ")", "ovsrec_row", "=", "ctx", ".", "must_get_row", "(", "vsctl_table", ",", "rec...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl._add
:type column_values: list of (column, value_json)
ryu/lib/ovs/vsctl.py
def _add(self, ctx, table_name, record_id, column_values): """ :type column_values: list of (column, value_json) """ vsctl_table = self._get_table(table_name) ovsrec_row = ctx.must_get_row(vsctl_table, record_id) for column, value in column_values: ctx.add_col...
def _add(self, ctx, table_name, record_id, column_values): """ :type column_values: list of (column, value_json) """ vsctl_table = self._get_table(table_name) ovsrec_row = ctx.must_get_row(vsctl_table, record_id) for column, value in column_values: ctx.add_col...
[ ":", "type", "column_values", ":", "list", "of", "(", "column", "value_json", ")" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L2271-L2279
[ "def", "_add", "(", "self", ",", "ctx", ",", "table_name", ",", "record_id", ",", "column_values", ")", ":", "vsctl_table", "=", "self", ".", "_get_table", "(", "table_name", ")", "ovsrec_row", "=", "ctx", ".", "must_get_row", "(", "vsctl_table", ",", "rec...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtl._remove
:type column_values: list of (column, value_json)
ryu/lib/ovs/vsctl.py
def _remove(self, ctx, table_name, record_id, column_values): """ :type column_values: list of (column, value_json) """ vsctl_table = self._get_table(table_name) ovsrec_row = ctx.must_get_row(vsctl_table, record_id) for column, value in column_values: ctx.remo...
def _remove(self, ctx, table_name, record_id, column_values): """ :type column_values: list of (column, value_json) """ vsctl_table = self._get_table(table_name) ovsrec_row = ctx.must_get_row(vsctl_table, record_id) for column, value in column_values: ctx.remo...
[ ":", "type", "column_values", ":", "list", "of", "(", "column", "value_json", ")" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L2308-L2316
[ "def", "_remove", "(", "self", ",", "ctx", ",", "table_name", ",", "record_id", ",", "column_values", ")", ":", "vsctl_table", "=", "self", ".", "_get_table", "(", "table_name", ")", "ovsrec_row", "=", "ctx", ".", "must_get_row", "(", "vsctl_table", ",", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
add_bgp_error_metadata
Decorator for all exceptions that want to set exception class meta-data.
ryu/services/protocols/bgp/base.py
def add_bgp_error_metadata(code, sub_code, def_desc='unknown'): """Decorator for all exceptions that want to set exception class meta-data. """ # Check registry if we already have an exception with same code/sub-code if _EXCEPTION_REGISTRY.get((code, sub_code)) is not None: raise ValueError('BGP...
def add_bgp_error_metadata(code, sub_code, def_desc='unknown'): """Decorator for all exceptions that want to set exception class meta-data. """ # Check registry if we already have an exception with same code/sub-code if _EXCEPTION_REGISTRY.get((code, sub_code)) is not None: raise ValueError('BGP...
[ "Decorator", "for", "all", "exceptions", "that", "want", "to", "set", "exception", "class", "meta", "-", "data", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/base.py#L112-L131
[ "def", "add_bgp_error_metadata", "(", "code", ",", "sub_code", ",", "def_desc", "=", "'unknown'", ")", ":", "# Check registry if we already have an exception with same code/sub-code", "if", "_EXCEPTION_REGISTRY", ".", "get", "(", "(", "code", ",", "sub_code", ")", ")", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
validate
Defines a decorator to register a validator with a name for look-up. If name is not provided we use function name as name of the validator.
ryu/services/protocols/bgp/base.py
def validate(**kwargs): """Defines a decorator to register a validator with a name for look-up. If name is not provided we use function name as name of the validator. """ def decorator(func): _VALIDATORS[kwargs.pop('name', func.__name__)] = func return func return decorator
def validate(**kwargs): """Defines a decorator to register a validator with a name for look-up. If name is not provided we use function name as name of the validator. """ def decorator(func): _VALIDATORS[kwargs.pop('name', func.__name__)] = func return func return decorator
[ "Defines", "a", "decorator", "to", "register", "a", "validator", "with", "a", "name", "for", "look", "-", "up", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/base.py#L542-L551
[ "def", "validate", "(", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "func", ")", ":", "_VALIDATORS", "[", "kwargs", ".", "pop", "(", "'name'", ",", "func", ".", "__name__", ")", "]", "=", "func", "return", "func", "return", "decorator" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Sink.next
Pops and returns the first outgoing message from the list. If message list currently has no messages, the calling thread will be put to sleep until we have at-least one message in the list that can be popped and returned.
ryu/services/protocols/bgp/base.py
def next(self): """Pops and returns the first outgoing message from the list. If message list currently has no messages, the calling thread will be put to sleep until we have at-least one message in the list that can be popped and returned. """ # We pick the first outgoi...
def next(self): """Pops and returns the first outgoing message from the list. If message list currently has no messages, the calling thread will be put to sleep until we have at-least one message in the list that can be popped and returned. """ # We pick the first outgoi...
[ "Pops", "and", "returns", "the", "first", "outgoing", "message", "from", "the", "list", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/base.py#L495-L510
[ "def", "next", "(", "self", ")", ":", "# We pick the first outgoing available and send it.", "outgoing_msg", "=", "self", ".", "outgoing_msg_list", ".", "pop_first", "(", ")", "# If we do not have any outgoing msg., we wait.", "if", "outgoing_msg", "is", "None", ":", "sel...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.run_command
Executes the given commands and sends OVSDB messages. ``commands`` must be a list of :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`. The given ``timeout`` and ``exception`` when instantiation will be used to call :py:mod:`ryu.lib.ovs.vsctl.VSCtl.run_command`.
ryu/lib/ovs/bridge.py
def run_command(self, commands): """ Executes the given commands and sends OVSDB messages. ``commands`` must be a list of :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`. The given ``timeout`` and ``exception`` when instantiation will be used to call :py:mod:`ryu.lib.ovs.vsctl...
def run_command(self, commands): """ Executes the given commands and sends OVSDB messages. ``commands`` must be a list of :py:mod:`ryu.lib.ovs.vsctl.VSCtlCommand`. The given ``timeout`` and ``exception`` when instantiation will be used to call :py:mod:`ryu.lib.ovs.vsctl...
[ "Executes", "the", "given", "commands", "and", "sends", "OVSDB", "messages", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L127-L137
[ "def", "run_command", "(", "self", ",", "commands", ")", ":", "self", ".", "vsctl", ".", "run_command", "(", "commands", ",", "self", ".", "timeout", ",", "self", ".", "exception", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.init
Validates the given ``ovsdb_addr`` and connects to OVS instance. If failed to connect to OVS instance or the given ``datapath_id`` does not match with the Datapath ID of the connected OVS instance, raises :py:mod:`ryu.lib.ovs.bridge.OVSBridgeNotFound` exception.
ryu/lib/ovs/bridge.py
def init(self): """ Validates the given ``ovsdb_addr`` and connects to OVS instance. If failed to connect to OVS instance or the given ``datapath_id`` does not match with the Datapath ID of the connected OVS instance, raises :py:mod:`ryu.lib.ovs.bridge.OVSBridgeNotFound` excepti...
def init(self): """ Validates the given ``ovsdb_addr`` and connects to OVS instance. If failed to connect to OVS instance or the given ``datapath_id`` does not match with the Datapath ID of the connected OVS instance, raises :py:mod:`ryu.lib.ovs.bridge.OVSBridgeNotFound` excepti...
[ "Validates", "the", "given", "ovsdb_addr", "and", "connects", "to", "OVS", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L139-L150
[ "def", "init", "(", "self", ")", ":", "if", "not", "valid_ovsdb_addr", "(", "self", ".", "ovsdb_addr", ")", ":", "raise", "ValueError", "(", "'Invalid OVSDB address: %s'", "%", "self", ".", "ovsdb_addr", ")", "if", "self", ".", "br_name", "is", "None", ":"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge._get_bridge_name
get Bridge name of a given 'datapath_id'
ryu/lib/ovs/bridge.py
def _get_bridge_name(self): """ get Bridge name of a given 'datapath_id' """ command = ovs_vsctl.VSCtlCommand( 'find', ('Bridge', 'datapath_id=%s' % dpid_lib.dpid_to_str(self.datapath_id))) self.run_command([command]) if not isinstance(command.result,...
def _get_bridge_name(self): """ get Bridge name of a given 'datapath_id' """ command = ovs_vsctl.VSCtlCommand( 'find', ('Bridge', 'datapath_id=%s' % dpid_lib.dpid_to_str(self.datapath_id))) self.run_command([command]) if not isinstance(command.result,...
[ "get", "Bridge", "name", "of", "a", "given", "datapath_id" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L152-L162
[ "def", "_get_bridge_name", "(", "self", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'find'", ",", "(", "'Bridge'", ",", "'datapath_id=%s'", "%", "dpid_lib", ".", "dpid_to_str", "(", "self", ".", "datapath_id", ")", ")", ")", "self", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.get_controller
Gets the configured OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get-controller <bridge>
ryu/lib/ovs/bridge.py
def get_controller(self): """ Gets the configured OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get-controller <bridge> """ command = ovs_vsctl.VSCtlCommand('get-controller', [self.br_name]) self.r...
def get_controller(self): """ Gets the configured OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get-controller <bridge> """ command = ovs_vsctl.VSCtlCommand('get-controller', [self.br_name]) self.r...
[ "Gets", "the", "configured", "OpenFlow", "controller", "address", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L164-L175
[ "def", "get_controller", "(", "self", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'get-controller'", ",", "[", "self", ".", "br_name", "]", ")", "self", ".", "run_command", "(", "[", "command", "]", ")", "result", "=", "command", "....
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.set_controller
Sets the OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl set-controller <bridge> <target>...
ryu/lib/ovs/bridge.py
def set_controller(self, controllers): """ Sets the OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl set-controller <bridge> <target>... """ command = ovs_vsctl.VSCtlCommand('set-controller', [self.br_name]) ...
def set_controller(self, controllers): """ Sets the OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl set-controller <bridge> <target>... """ command = ovs_vsctl.VSCtlCommand('set-controller', [self.br_name]) ...
[ "Sets", "the", "OpenFlow", "controller", "address", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L177-L187
[ "def", "set_controller", "(", "self", ",", "controllers", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'set-controller'", ",", "[", "self", ".", "br_name", "]", ")", "command", ".", "args", ".", "extend", "(", "controllers", ")", "self...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.del_controller
Deletes the configured OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl del-controller <bridge>
ryu/lib/ovs/bridge.py
def del_controller(self): """ Deletes the configured OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl del-controller <bridge> """ command = ovs_vsctl.VSCtlCommand('del-controller', [self.br_name]) sel...
def del_controller(self): """ Deletes the configured OpenFlow controller address. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl del-controller <bridge> """ command = ovs_vsctl.VSCtlCommand('del-controller', [self.br_name]) sel...
[ "Deletes", "the", "configured", "OpenFlow", "controller", "address", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L189-L198
[ "def", "del_controller", "(", "self", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'del-controller'", ",", "[", "self", ".", "br_name", "]", ")", "self", ".", "run_command", "(", "[", "command", "]", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.list_db_attributes
Lists 'record' (or all records) in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl list TBL [REC]
ryu/lib/ovs/bridge.py
def list_db_attributes(self, table, record=None): """ Lists 'record' (or all records) in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl list TBL [REC] """ command = ovs_vsctl.VSCtlCommand('list', (table, record)) self....
def list_db_attributes(self, table, record=None): """ Lists 'record' (or all records) in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl list TBL [REC] """ command = ovs_vsctl.VSCtlCommand('list', (table, record)) self....
[ "Lists", "record", "(", "or", "all", "records", ")", "in", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L200-L212
[ "def", "list_db_attributes", "(", "self", ",", "table", ",", "record", "=", "None", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'list'", ",", "(", "table", ",", "record", ")", ")", "self", ".", "run_command", "(", "[", "command", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.find_db_attributes
Lists records satisfying 'conditions' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl find TBL CONDITION... .. Note:: Currently, only '=' condition is supported. To support other condition is TODO.
ryu/lib/ovs/bridge.py
def find_db_attributes(self, table, *conditions): """ Lists records satisfying 'conditions' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl find TBL CONDITION... .. Note:: Currently, only '=' condition is supported. ...
def find_db_attributes(self, table, *conditions): """ Lists records satisfying 'conditions' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl find TBL CONDITION... .. Note:: Currently, only '=' condition is supported. ...
[ "Lists", "records", "satisfying", "conditions", "in", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L214-L233
[ "def", "find_db_attributes", "(", "self", ",", "table", ",", "*", "conditions", ")", ":", "args", "=", "[", "table", "]", "args", ".", "extend", "(", "conditions", ")", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'find'", ",", "args", ")", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.get_db_attribute
Gets values of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL[:KEY]
ryu/lib/ovs/bridge.py
def get_db_attribute(self, table, record, column, key=None): """ Gets values of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL[:KEY] """ if key is not None: column = '%s:%s' ...
def get_db_attribute(self, table, record, column, key=None): """ Gets values of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL[:KEY] """ if key is not None: column = '%s:%s' ...
[ "Gets", "values", "of", "column", "in", "record", "in", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L235-L250
[ "def", "get_db_attribute", "(", "self", ",", "table", ",", "record", ",", "column", ",", "key", "=", "None", ")", ":", "if", "key", "is", "not", "None", ":", "column", "=", "'%s:%s'", "%", "(", "column", ",", "key", ")", "command", "=", "ovs_vsctl", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.set_db_attribute
Sets 'value' into 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl set TBL REC COL[:KEY]=VALUE
ryu/lib/ovs/bridge.py
def set_db_attribute(self, table, record, column, value, key=None): """ Sets 'value' into 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl set TBL REC COL[:KEY]=VALUE """ if key is not None: c...
def set_db_attribute(self, table, record, column, value, key=None): """ Sets 'value' into 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl set TBL REC COL[:KEY]=VALUE """ if key is not None: c...
[ "Sets", "value", "into", "column", "in", "record", "in", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L252-L264
[ "def", "set_db_attribute", "(", "self", ",", "table", ",", "record", ",", "column", ",", "value", ",", "key", "=", "None", ")", ":", "if", "key", "is", "not", "None", ":", "column", "=", "'%s:%s'", "%", "(", "column", ",", "key", ")", "command", "=...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.clear_db_attribute
Clears values from 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl clear TBL REC COL
ryu/lib/ovs/bridge.py
def clear_db_attribute(self, table, record, column): """ Clears values from 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl clear TBL REC COL """ command = ovs_vsctl.VSCtlCommand('clear', (table, record,...
def clear_db_attribute(self, table, record, column): """ Clears values from 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl clear TBL REC COL """ command = ovs_vsctl.VSCtlCommand('clear', (table, record,...
[ "Clears", "values", "from", "column", "in", "record", "in", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L294-L303
[ "def", "clear_db_attribute", "(", "self", ",", "table", ",", "record", ",", "column", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'clear'", ",", "(", "table", ",", "record", ",", "column", ")", ")", "self", ".", "run_command", "(", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.db_get_val
Gets values of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL
ryu/lib/ovs/bridge.py
def db_get_val(self, table, record, column): """ Gets values of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL """ command = ovs_vsctl.VSCtlCommand('get', (table, record, column)) ...
def db_get_val(self, table, record, column): """ Gets values of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL """ command = ovs_vsctl.VSCtlCommand('get', (table, record, column)) ...
[ "Gets", "values", "of", "column", "in", "record", "in", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L305-L316
[ "def", "db_get_val", "(", "self", ",", "table", ",", "record", ",", "column", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'get'", ",", "(", "table", ",", "record", ",", "column", ")", ")", "self", ".", "run_command", "(", "[", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.db_get_map
Gets dict type value of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL
ryu/lib/ovs/bridge.py
def db_get_map(self, table, record, column): """ Gets dict type value of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL """ val = self.db_get_val(table, record, column) assert is...
def db_get_map(self, table, record, column): """ Gets dict type value of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL """ val = self.db_get_val(table, record, column) assert is...
[ "Gets", "dict", "type", "value", "of", "column", "in", "record", "in", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L318-L328
[ "def", "db_get_map", "(", "self", ",", "table", ",", "record", ",", "column", ")", ":", "val", "=", "self", ".", "db_get_val", "(", "table", ",", "record", ",", "column", ")", "assert", "isinstance", "(", "val", ",", "dict", ")", "return", "val" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.delete_port
Deletes a port on the OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl --if-exists del-port <bridge> <port>
ryu/lib/ovs/bridge.py
def delete_port(self, port_name): """ Deletes a port on the OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl --if-exists del-port <bridge> <port> """ command = ovs_vsctl.VSCtlCommand( 'del-port', (self.br_name, ...
def delete_port(self, port_name): """ Deletes a port on the OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl --if-exists del-port <bridge> <port> """ command = ovs_vsctl.VSCtlCommand( 'del-port', (self.br_name, ...
[ "Deletes", "a", "port", "on", "the", "OVS", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L340-L350
[ "def", "delete_port", "(", "self", ",", "port_name", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'del-port'", ",", "(", "self", ".", "br_name", ",", "port_name", ")", ",", "'--if-exists'", ")", "self", ".", "run_command", "(", "[", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.get_ofport
Gets the OpenFlow port number. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get Interface <port> ofport
ryu/lib/ovs/bridge.py
def get_ofport(self, port_name): """ Gets the OpenFlow port number. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get Interface <port> ofport """ ofport_list = self.db_get_val('Interface', port_name, 'ofport') assert len(ofpor...
def get_ofport(self, port_name): """ Gets the OpenFlow port number. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get Interface <port> ofport """ ofport_list = self.db_get_val('Interface', port_name, 'ofport') assert len(ofpor...
[ "Gets", "the", "OpenFlow", "port", "number", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L352-L362
[ "def", "get_ofport", "(", "self", ",", "port_name", ")", ":", "ofport_list", "=", "self", ".", "db_get_val", "(", "'Interface'", ",", "port_name", ",", "'ofport'", ")", "assert", "len", "(", "ofport_list", ")", "==", "1", "return", "int", "(", "ofport_list...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.get_port_name_list
Gets a list of all ports on OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl list-ports <bridge>
ryu/lib/ovs/bridge.py
def get_port_name_list(self): """ Gets a list of all ports on OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl list-ports <bridge> """ command = ovs_vsctl.VSCtlCommand('list-ports', (self.br_name, )) self.run_comman...
def get_port_name_list(self): """ Gets a list of all ports on OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl list-ports <bridge> """ command = ovs_vsctl.VSCtlCommand('list-ports', (self.br_name, )) self.run_comman...
[ "Gets", "a", "list", "of", "all", "ports", "on", "OVS", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L364-L374
[ "def", "get_port_name_list", "(", "self", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'list-ports'", ",", "(", "self", ".", "br_name", ",", ")", ")", "self", ".", "run_command", "(", "[", "command", "]", ")", "return", "command", "....
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.add_bond
Creates a bonded port. :param name: Port name to be created :param ifaces: List of interfaces containing at least 2 interfaces :param bond_mode: Bonding mode (active-backup, balance-tcp or balance-slb) :param lacp: LACP mode (active, passive or off)
ryu/lib/ovs/bridge.py
def add_bond(self, name, ifaces, bond_mode=None, lacp=None): """ Creates a bonded port. :param name: Port name to be created :param ifaces: List of interfaces containing at least 2 interfaces :param bond_mode: Bonding mode (active-backup, balance-tcp or...
def add_bond(self, name, ifaces, bond_mode=None, lacp=None): """ Creates a bonded port. :param name: Port name to be created :param ifaces: List of interfaces containing at least 2 interfaces :param bond_mode: Bonding mode (active-backup, balance-tcp or...
[ "Creates", "a", "bonded", "port", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L376-L396
[ "def", "add_bond", "(", "self", ",", "name", ",", "ifaces", ",", "bond_mode", "=", "None", ",", "lacp", "=", "None", ")", ":", "assert", "len", "(", "ifaces", ")", ">=", "2", "options", "=", "''", "if", "bond_mode", ":", "options", "+=", "'bond_mode=...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.add_tunnel_port
Creates a tunnel port. :param name: Port name to be created :param tunnel_type: Type of tunnel (gre or vxlan) :param remote_ip: Remote IP address of tunnel :param local_ip: Local IP address of tunnel :param key: Key of GRE or VNI of VxLAN :param ofport: Requested OpenFlo...
ryu/lib/ovs/bridge.py
def add_tunnel_port(self, name, tunnel_type, remote_ip, local_ip=None, key=None, ofport=None): """ Creates a tunnel port. :param name: Port name to be created :param tunnel_type: Type of tunnel (gre or vxlan) :param remote_ip: Remote IP address of tunnel ...
def add_tunnel_port(self, name, tunnel_type, remote_ip, local_ip=None, key=None, ofport=None): """ Creates a tunnel port. :param name: Port name to be created :param tunnel_type: Type of tunnel (gre or vxlan) :param remote_ip: Remote IP address of tunnel ...
[ "Creates", "a", "tunnel", "port", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L398-L423
[ "def", "add_tunnel_port", "(", "self", ",", "name", ",", "tunnel_type", ",", "remote_ip", ",", "local_ip", "=", "None", ",", "key", "=", "None", ",", "ofport", "=", "None", ")", ":", "options", "=", "'remote_ip=%(remote_ip)s'", "%", "locals", "(", ")", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.add_gre_port
Creates a GRE tunnel port. See the description of ``add_tunnel_port()``.
ryu/lib/ovs/bridge.py
def add_gre_port(self, name, remote_ip, local_ip=None, key=None, ofport=None): """ Creates a GRE tunnel port. See the description of ``add_tunnel_port()``. """ self.add_tunnel_port(name, 'gre', remote_ip, local_ip=local_ip, key=k...
def add_gre_port(self, name, remote_ip, local_ip=None, key=None, ofport=None): """ Creates a GRE tunnel port. See the description of ``add_tunnel_port()``. """ self.add_tunnel_port(name, 'gre', remote_ip, local_ip=local_ip, key=k...
[ "Creates", "a", "GRE", "tunnel", "port", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L425-L433
[ "def", "add_gre_port", "(", "self", ",", "name", ",", "remote_ip", ",", "local_ip", "=", "None", ",", "key", "=", "None", ",", "ofport", "=", "None", ")", ":", "self", ".", "add_tunnel_port", "(", "name", ",", "'gre'", ",", "remote_ip", ",", "local_ip"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.add_vxlan_port
Creates a VxLAN tunnel port. See the description of ``add_tunnel_port()``.
ryu/lib/ovs/bridge.py
def add_vxlan_port(self, name, remote_ip, local_ip=None, key=None, ofport=None): """ Creates a VxLAN tunnel port. See the description of ``add_tunnel_port()``. """ self.add_tunnel_port(name, 'vxlan', remote_ip, local_ip=local_i...
def add_vxlan_port(self, name, remote_ip, local_ip=None, key=None, ofport=None): """ Creates a VxLAN tunnel port. See the description of ``add_tunnel_port()``. """ self.add_tunnel_port(name, 'vxlan', remote_ip, local_ip=local_i...
[ "Creates", "a", "VxLAN", "tunnel", "port", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L435-L443
[ "def", "add_vxlan_port", "(", "self", ",", "name", ",", "remote_ip", ",", "local_ip", "=", "None", ",", "key", "=", "None", ",", "ofport", "=", "None", ")", ":", "self", ".", "add_tunnel_port", "(", "name", ",", "'vxlan'", ",", "remote_ip", ",", "local...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.del_port
Deletes a port on OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl del-port <bridge> <port>
ryu/lib/ovs/bridge.py
def del_port(self, port_name): """ Deletes a port on OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl del-port <bridge> <port> """ command = ovs_vsctl.VSCtlCommand('del-port', (self.br_name, port_name)) self.run_com...
def del_port(self, port_name): """ Deletes a port on OVS instance. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl del-port <bridge> <port> """ command = ovs_vsctl.VSCtlCommand('del-port', (self.br_name, port_name)) self.run_com...
[ "Deletes", "a", "port", "on", "OVS", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L445-L454
[ "def", "del_port", "(", "self", ",", "port_name", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'del-port'", ",", "(", "self", ".", "br_name", ",", "port_name", ")", ")", "self", ".", "run_command", "(", "[", "command", "]", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.set_qos
Sets a Qos rule and creates Queues on the given port.
ryu/lib/ovs/bridge.py
def set_qos(self, port_name, type='linux-htb', max_rate=None, queues=None): """ Sets a Qos rule and creates Queues on the given port. """ queues = queues if queues else [] command_qos = ovs_vsctl.VSCtlCommand( 'set-qos', [port_name, type, max_rate]) ...
def set_qos(self, port_name, type='linux-htb', max_rate=None, queues=None): """ Sets a Qos rule and creates Queues on the given port. """ queues = queues if queues else [] command_qos = ovs_vsctl.VSCtlCommand( 'set-qos', [port_name, type, max_rate]) ...
[ "Sets", "a", "Qos", "rule", "and", "creates", "Queues", "on", "the", "given", "port", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L525-L539
[ "def", "set_qos", "(", "self", ",", "port_name", ",", "type", "=", "'linux-htb'", ",", "max_rate", "=", "None", ",", "queues", "=", "None", ")", ":", "queues", "=", "queues", "if", "queues", "else", "[", "]", "command_qos", "=", "ovs_vsctl", ".", "VSCt...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OVSBridge.del_qos
Deletes the Qos rule on the given port.
ryu/lib/ovs/bridge.py
def del_qos(self, port_name): """ Deletes the Qos rule on the given port. """ command = ovs_vsctl.VSCtlCommand( 'del-qos', [port_name]) self.run_command([command])
def del_qos(self, port_name): """ Deletes the Qos rule on the given port. """ command = ovs_vsctl.VSCtlCommand( 'del-qos', [port_name]) self.run_command([command])
[ "Deletes", "the", "Qos", "rule", "on", "the", "given", "port", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L541-L548
[ "def", "del_qos", "(", "self", ",", "port_name", ")", ":", "command", "=", "ovs_vsctl", ".", "VSCtlCommand", "(", "'del-qos'", ",", "[", "port_name", "]", ")", "self", ".", "run_command", "(", "[", "command", "]", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
checksum_ip
calculate checksum of IP pseudo header IPv4 pseudo header UDP RFC768 TCP RFC793 3.1 0 7 8 15 16 23 24 31 +--------+--------+--------+--------+ | source address | +--------+--------+--------+--------+ | destination address | +--------...
ryu/lib/packet/packet_utils.py
def checksum_ip(ipvx, length, payload): """ calculate checksum of IP pseudo header IPv4 pseudo header UDP RFC768 TCP RFC793 3.1 0 7 8 15 16 23 24 31 +--------+--------+--------+--------+ | source address | +--------+--------+--------+--------+ ...
def checksum_ip(ipvx, length, payload): """ calculate checksum of IP pseudo header IPv4 pseudo header UDP RFC768 TCP RFC793 3.1 0 7 8 15 16 23 24 31 +--------+--------+--------+--------+ | source address | +--------+--------+--------+--------+ ...
[ "calculate", "checksum", "of", "IP", "pseudo", "header" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/packet_utils.py#L44-L100
[ "def", "checksum_ip", "(", "ipvx", ",", "length", ",", "payload", ")", ":", "if", "ipvx", ".", "version", "==", "4", ":", "header", "=", "struct", ".", "pack", "(", "_IPV4_PSEUDO_HEADER_PACK_STR", ",", "addrconv", ".", "ipv4", ".", "text_to_bin", "(", "i...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
fletcher_checksum
Fletcher Checksum -- Refer to RFC1008 calling with offset == _FLETCHER_CHECKSUM_VALIDATE will validate the checksum without modifying the buffer; a valid checksum returns 0.
ryu/lib/packet/packet_utils.py
def fletcher_checksum(data, offset): """ Fletcher Checksum -- Refer to RFC1008 calling with offset == _FLETCHER_CHECKSUM_VALIDATE will validate the checksum without modifying the buffer; a valid checksum returns 0. """ c0 = 0 c1 = 0 pos = 0 length = len(data) data = bytearray(da...
def fletcher_checksum(data, offset): """ Fletcher Checksum -- Refer to RFC1008 calling with offset == _FLETCHER_CHECKSUM_VALIDATE will validate the checksum without modifying the buffer; a valid checksum returns 0. """ c0 = 0 c1 = 0 pos = 0 length = len(data) data = bytearray(da...
[ "Fletcher", "Checksum", "--", "Refer", "to", "RFC1008" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/packet_utils.py#L106-L138
[ "def", "fletcher_checksum", "(", "data", ",", "offset", ")", ":", "c0", "=", "0", "c1", "=", "0", "pos", "=", "0", "length", "=", "len", "(", "data", ")", "data", "=", "bytearray", "(", "data", ")", "data", "[", "offset", ":", "offset", "+", "2",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
vrrp_config
create an instance. returns EventVRRPConfigReply(instance.name, interface, config) on success. returns EventVRRPConfigReply(None, interface, config) on failure.
ryu/services/protocols/vrrp/api.py
def vrrp_config(app, interface, config): """create an instance. returns EventVRRPConfigReply(instance.name, interface, config) on success. returns EventVRRPConfigReply(None, interface, config) on failure. """ config_request = vrrp_event.EventVRRPConfigRequest(interface, config) config_re...
def vrrp_config(app, interface, config): """create an instance. returns EventVRRPConfigReply(instance.name, interface, config) on success. returns EventVRRPConfigReply(None, interface, config) on failure. """ config_request = vrrp_event.EventVRRPConfigRequest(interface, config) config_re...
[ "create", "an", "instance", ".", "returns", "EventVRRPConfigReply", "(", "instance", ".", "name", "interface", "config", ")", "on", "success", ".", "returns", "EventVRRPConfigReply", "(", "None", "interface", "config", ")", "on", "failure", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/api.py#L21-L30
[ "def", "vrrp_config", "(", "app", ",", "interface", ",", "config", ")", ":", "config_request", "=", "vrrp_event", ".", "EventVRRPConfigRequest", "(", "interface", ",", "config", ")", "config_request", ".", "sync", "=", "True", "return", "app", ".", "send_reque...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
vrrp_shutdown
shutdown the instance.
ryu/services/protocols/vrrp/api.py
def vrrp_shutdown(app, instance_name): """shutdown the instance. """ shutdown_request = vrrp_event.EventVRRPShutdownRequest(instance_name) app.send_event(vrrp_event.VRRP_MANAGER_NAME, shutdown_request)
def vrrp_shutdown(app, instance_name): """shutdown the instance. """ shutdown_request = vrrp_event.EventVRRPShutdownRequest(instance_name) app.send_event(vrrp_event.VRRP_MANAGER_NAME, shutdown_request)
[ "shutdown", "the", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/api.py#L33-L37
[ "def", "vrrp_shutdown", "(", "app", ",", "instance_name", ")", ":", "shutdown_request", "=", "vrrp_event", ".", "EventVRRPShutdownRequest", "(", "instance_name", ")", "app", ".", "send_event", "(", "vrrp_event", ".", "VRRP_MANAGER_NAME", ",", "shutdown_request", ")"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
vrrp_transmit
transmit a packet from the switch. this is internal use only. data is str-like, a packet to send.
ryu/services/protocols/vrrp/api.py
def vrrp_transmit(app, monitor_name, data): """transmit a packet from the switch. this is internal use only. data is str-like, a packet to send. """ transmit_request = vrrp_event.EventVRRPTransmitRequest(data) app.send_event(monitor_name, transmit_request)
def vrrp_transmit(app, monitor_name, data): """transmit a packet from the switch. this is internal use only. data is str-like, a packet to send. """ transmit_request = vrrp_event.EventVRRPTransmitRequest(data) app.send_event(monitor_name, transmit_request)
[ "transmit", "a", "packet", "from", "the", "switch", ".", "this", "is", "internal", "use", "only", ".", "data", "is", "str", "-", "like", "a", "packet", "to", "send", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/api.py#L40-L45
[ "def", "vrrp_transmit", "(", "app", ",", "monitor_name", ",", "data", ")", ":", "transmit_request", "=", "vrrp_event", ".", "EventVRRPTransmitRequest", "(", "data", ")", "app", ".", "send_event", "(", "monitor_name", ",", "transmit_request", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
vrrp_list
list instances. returns EventVRRPListReply([VRRPInstance]).
ryu/services/protocols/vrrp/api.py
def vrrp_list(app, instance_name=None): """list instances. returns EventVRRPListReply([VRRPInstance]). """ list_request = vrrp_event.EventVRRPListRequest(instance_name) list_request.dst = vrrp_event.VRRP_MANAGER_NAME return app.send_request(list_request)
def vrrp_list(app, instance_name=None): """list instances. returns EventVRRPListReply([VRRPInstance]). """ list_request = vrrp_event.EventVRRPListRequest(instance_name) list_request.dst = vrrp_event.VRRP_MANAGER_NAME return app.send_request(list_request)
[ "list", "instances", ".", "returns", "EventVRRPListReply", "(", "[", "VRRPInstance", "]", ")", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/api.py#L48-L54
[ "def", "vrrp_list", "(", "app", ",", "instance_name", "=", "None", ")", ":", "list_request", "=", "vrrp_event", ".", "EventVRRPListRequest", "(", "instance_name", ")", "list_request", ".", "dst", "=", "vrrp_event", ".", "VRRP_MANAGER_NAME", "return", "app", ".",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
vrrp_config_change
change configuration of an instance. None means no change.
ryu/services/protocols/vrrp/api.py
def vrrp_config_change(app, instance_name, priority=None, advertisement_interval=None, preempt_mode=None, accept_mode=None): """change configuration of an instance. None means no change. """ config_change = vrrp_event.EventVRRPConfigChangeRequest( in...
def vrrp_config_change(app, instance_name, priority=None, advertisement_interval=None, preempt_mode=None, accept_mode=None): """change configuration of an instance. None means no change. """ config_change = vrrp_event.EventVRRPConfigChangeRequest( in...
[ "change", "configuration", "of", "an", "instance", ".", "None", "means", "no", "change", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/api.py#L57-L66
[ "def", "vrrp_config_change", "(", "app", ",", "instance_name", ",", "priority", "=", "None", ",", "advertisement_interval", "=", "None", ",", "preempt_mode", "=", "None", ",", "accept_mode", "=", "None", ")", ":", "config_change", "=", "vrrp_event", ".", "Even...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPMatch.parser
Returns an object which is generated from a buffer including the expression of the wire protocol of the flow match.
ryu/ofproto/ofproto_v1_5_parser.py
def parser(cls, buf, offset): """ Returns an object which is generated from a buffer including the expression of the wire protocol of the flow match. """ match = OFPMatch() type_, length = struct.unpack_from('!HH', buf, offset) match.type = type_ match.le...
def parser(cls, buf, offset): """ Returns an object which is generated from a buffer including the expression of the wire protocol of the flow match. """ match = OFPMatch() type_, length = struct.unpack_from('!HH', buf, offset) match.type = type_ match.le...
[ "Returns", "an", "object", "which", "is", "generated", "from", "a", "buffer", "including", "the", "expression", "of", "the", "wire", "protocol", "of", "the", "flow", "match", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L769-L792
[ "def", "parser", "(", "cls", ",", "buf", ",", "offset", ")", ":", "match", "=", "OFPMatch", "(", ")", "type_", ",", "length", "=", "struct", ".", "unpack_from", "(", "'!HH'", ",", "buf", ",", "offset", ")", "match", ".", "type", "=", "type_", "matc...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPMatch.serialize
Outputs the expression of the wire protocol of the flow match into the buf. Returns the output length.
ryu/ofproto/ofproto_v1_5_parser.py
def serialize(self, buf, offset): """ Outputs the expression of the wire protocol of the flow match into the buf. Returns the output length. """ fields = [ofproto.oxm_from_user(k, uv) for (k, uv) in self._fields2] hdr_pack_str = '!HH' fi...
def serialize(self, buf, offset): """ Outputs the expression of the wire protocol of the flow match into the buf. Returns the output length. """ fields = [ofproto.oxm_from_user(k, uv) for (k, uv) in self._fields2] hdr_pack_str = '!HH' fi...
[ "Outputs", "the", "expression", "of", "the", "wire", "protocol", "of", "the", "flow", "match", "into", "the", "buf", ".", "Returns", "the", "output", "length", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L794-L816
[ "def", "serialize", "(", "self", ",", "buf", ",", "offset", ")", ":", "fields", "=", "[", "ofproto", ".", "oxm_from_user", "(", "k", ",", "uv", ")", "for", "(", "k", ",", "uv", ")", "in", "self", ".", "_fields2", "]", "hdr_pack_str", "=", "'!HH'", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPMatch.to_jsondict
Returns a dict expressing the flow match.
ryu/ofproto/ofproto_v1_5_parser.py
def to_jsondict(self): """ Returns a dict expressing the flow match. """ body = {"oxm_fields": [ofproto.oxm_to_jsondict(k, uv) for k, uv in self._fields2], "length": self.length, "type": self.type} return {self.__clas...
def to_jsondict(self): """ Returns a dict expressing the flow match. """ body = {"oxm_fields": [ofproto.oxm_to_jsondict(k, uv) for k, uv in self._fields2], "length": self.length, "type": self.type} return {self.__clas...
[ "Returns", "a", "dict", "expressing", "the", "flow", "match", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L836-L844
[ "def", "to_jsondict", "(", "self", ")", ":", "body", "=", "{", "\"oxm_fields\"", ":", "[", "ofproto", ".", "oxm_to_jsondict", "(", "k", ",", "uv", ")", "for", "k", ",", "uv", "in", "self", ".", "_fields2", "]", ",", "\"length\"", ":", "self", ".", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPMatch.from_jsondict
Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown match field is defined in dict
ryu/ofproto/ofproto_v1_5_parser.py
def from_jsondict(cls, dict_): """ Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown match field is defined in dict """ fields = [ofproto.oxm_from_jsondict(f) for f in dict_['oxm_fields']] return OFPMatch(_o...
def from_jsondict(cls, dict_): """ Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown match field is defined in dict """ fields = [ofproto.oxm_from_jsondict(f) for f in dict_['oxm_fields']] return OFPMatch(_o...
[ "Returns", "an", "object", "which", "is", "generated", "from", "a", "dict", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L847-L856
[ "def", "from_jsondict", "(", "cls", ",", "dict_", ")", ":", "fields", "=", "[", "ofproto", ".", "oxm_from_jsondict", "(", "f", ")", "for", "f", "in", "dict_", "[", "'oxm_fields'", "]", "]", "return", "OFPMatch", "(", "_ordered_fields", "=", "fields", ")"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPStats.parser
Returns an object which is generated from a buffer including the expression of the wire protocol of the flow stats.
ryu/ofproto/ofproto_v1_5_parser.py
def parser(cls, buf, offset): """ Returns an object which is generated from a buffer including the expression of the wire protocol of the flow stats. """ stats = OFPStats() reserved, length = struct.unpack_from('!HH', buf, offset) stats.length = length #...
def parser(cls, buf, offset): """ Returns an object which is generated from a buffer including the expression of the wire protocol of the flow stats. """ stats = OFPStats() reserved, length = struct.unpack_from('!HH', buf, offset) stats.length = length #...
[ "Returns", "an", "object", "which", "is", "generated", "from", "a", "buffer", "including", "the", "expression", "of", "the", "wire", "protocol", "of", "the", "flow", "stats", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L913-L935
[ "def", "parser", "(", "cls", ",", "buf", ",", "offset", ")", ":", "stats", "=", "OFPStats", "(", ")", "reserved", ",", "length", "=", "struct", ".", "unpack_from", "(", "'!HH'", ",", "buf", ",", "offset", ")", "stats", ".", "length", "=", "length", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPStats.serialize
Outputs the expression of the wire protocol of the flow stats into the buf. Returns the output length.
ryu/ofproto/ofproto_v1_5_parser.py
def serialize(self, buf, offset): """ Outputs the expression of the wire protocol of the flow stats into the buf. Returns the output length. """ fields = [ofproto.oxs_from_user(k, uv) for (k, uv) in self.fields] hdr_pack_str = '!HH' fiel...
def serialize(self, buf, offset): """ Outputs the expression of the wire protocol of the flow stats into the buf. Returns the output length. """ fields = [ofproto.oxs_from_user(k, uv) for (k, uv) in self.fields] hdr_pack_str = '!HH' fiel...
[ "Outputs", "the", "expression", "of", "the", "wire", "protocol", "of", "the", "flow", "stats", "into", "the", "buf", ".", "Returns", "the", "output", "length", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L937-L961
[ "def", "serialize", "(", "self", ",", "buf", ",", "offset", ")", ":", "fields", "=", "[", "ofproto", ".", "oxs_from_user", "(", "k", ",", "uv", ")", "for", "(", "k", ",", "uv", ")", "in", "self", ".", "fields", "]", "hdr_pack_str", "=", "'!HH'", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPStats.to_jsondict
Returns a dict expressing the flow stats.
ryu/ofproto/ofproto_v1_5_parser.py
def to_jsondict(self): """ Returns a dict expressing the flow stats. """ body = {"oxs_fields": [ofproto.oxs_to_jsondict(k, uv) for k, uv in self.fields], "length": self.length} return {self.__class__.__name__: body}
def to_jsondict(self): """ Returns a dict expressing the flow stats. """ body = {"oxs_fields": [ofproto.oxs_to_jsondict(k, uv) for k, uv in self.fields], "length": self.length} return {self.__class__.__name__: body}
[ "Returns", "a", "dict", "expressing", "the", "flow", "stats", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L981-L988
[ "def", "to_jsondict", "(", "self", ")", ":", "body", "=", "{", "\"oxs_fields\"", ":", "[", "ofproto", ".", "oxs_to_jsondict", "(", "k", ",", "uv", ")", "for", "k", ",", "uv", "in", "self", ".", "fields", "]", ",", "\"length\"", ":", "self", ".", "l...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPStats.from_jsondict
Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown stats field is defined in dict
ryu/ofproto/ofproto_v1_5_parser.py
def from_jsondict(cls, dict_): """ Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown stats field is defined in dict """ fields = [ofproto.oxs_from_jsondict(f) for f in dict_['oxs_fields']] return OFPStats(_o...
def from_jsondict(cls, dict_): """ Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown stats field is defined in dict """ fields = [ofproto.oxs_from_jsondict(f) for f in dict_['oxs_fields']] return OFPStats(_o...
[ "Returns", "an", "object", "which", "is", "generated", "from", "a", "dict", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_5_parser.py#L991-L1000
[ "def", "from_jsondict", "(", "cls", ",", "dict_", ")", ":", "fields", "=", "[", "ofproto", ".", "oxs_from_jsondict", "(", "f", ")", "for", "f", "in", "dict_", "[", "'oxs_fields'", "]", "]", "return", "OFPStats", "(", "_ordered_fields", "=", "fields", ")"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ofp_instruction_from_str
Parse an ovs-ofctl style action string and return a list of jsondict representations of OFPInstructionActions, which can then be passed to ofproto_parser.ofp_instruction_from_jsondict. Please note that this is for making transition from ovs-ofctl easier. Please consider using OFPAction constructors whe...
ryu/lib/ofctl_string.py
def ofp_instruction_from_str(ofproto, action_str): """ Parse an ovs-ofctl style action string and return a list of jsondict representations of OFPInstructionActions, which can then be passed to ofproto_parser.ofp_instruction_from_jsondict. Please note that this is for making transition from ovs-ofc...
def ofp_instruction_from_str(ofproto, action_str): """ Parse an ovs-ofctl style action string and return a list of jsondict representations of OFPInstructionActions, which can then be passed to ofproto_parser.ofp_instruction_from_jsondict. Please note that this is for making transition from ovs-ofc...
[ "Parse", "an", "ovs", "-", "ofctl", "style", "action", "string", "and", "return", "a", "list", "of", "jsondict", "representations", "of", "OFPInstructionActions", "which", "can", "then", "be", "passed", "to", "ofproto_parser", ".", "ofp_instruction_from_jsondict", ...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ofctl_string.py#L23-L73
[ "def", "ofp_instruction_from_str", "(", "ofproto", ",", "action_str", ")", ":", "action_re", "=", "re", ".", "compile", "(", "r\"([a-z_]+)(\\([^)]*\\)|[^a-z_,()][^,()]*)*\"", ")", "result", "=", "[", "]", "while", "len", "(", "action_str", ")", ":", "m", "=", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
tokenize_ofp_instruction_arg
Tokenize an argument portion of ovs-ofctl style action string.
ryu/lib/ofctl_string.py
def tokenize_ofp_instruction_arg(arg): """ Tokenize an argument portion of ovs-ofctl style action string. """ arg_re = re.compile("[^,()]*") try: rest = arg result = [] while len(rest): m = arg_re.match(rest) if m.end(0) == len(rest): r...
def tokenize_ofp_instruction_arg(arg): """ Tokenize an argument portion of ovs-ofctl style action string. """ arg_re = re.compile("[^,()]*") try: rest = arg result = [] while len(rest): m = arg_re.match(rest) if m.end(0) == len(rest): r...
[ "Tokenize", "an", "argument", "portion", "of", "ovs", "-", "ofctl", "style", "action", "string", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ofctl_string.py#L89-L116
[ "def", "tokenize_ofp_instruction_arg", "(", "arg", ")", ":", "arg_re", "=", "re", ".", "compile", "(", "\"[^,()]*\"", ")", "try", ":", "rest", "=", "arg", "result", "=", "[", "]", "while", "len", "(", "rest", ")", ":", "m", "=", "arg_re", ".", "match...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ofp_ofctl_field_name_to_ryu
Convert an ovs-ofctl field name to ryu equivalent.
ryu/lib/ofctl_string.py
def ofp_ofctl_field_name_to_ryu(field): """Convert an ovs-ofctl field name to ryu equivalent.""" mapped = _OXM_FIELD_OFCTL_ALIASES.get(field) if mapped: return mapped if field.endswith("_dst"): mapped = _OXM_FIELD_OFCTL_ALIASES.get(field[:-3] + "src") if mapped: retur...
def ofp_ofctl_field_name_to_ryu(field): """Convert an ovs-ofctl field name to ryu equivalent.""" mapped = _OXM_FIELD_OFCTL_ALIASES.get(field) if mapped: return mapped if field.endswith("_dst"): mapped = _OXM_FIELD_OFCTL_ALIASES.get(field[:-3] + "src") if mapped: retur...
[ "Convert", "an", "ovs", "-", "ofctl", "field", "name", "to", "ryu", "equivalent", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ofctl_string.py#L140-L149
[ "def", "ofp_ofctl_field_name_to_ryu", "(", "field", ")", ":", "mapped", "=", "_OXM_FIELD_OFCTL_ALIASES", ".", "get", "(", "field", ")", "if", "mapped", ":", "return", "mapped", "if", "field", ".", "endswith", "(", "\"_dst\"", ")", ":", "mapped", "=", "_OXM_F...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
nxm_field_name_to_ryu
Convert an ovs-ofctl style NXM_/OXM_ field name to a ryu match field name.
ryu/lib/ofctl_string.py
def nxm_field_name_to_ryu(field): """ Convert an ovs-ofctl style NXM_/OXM_ field name to a ryu match field name. """ if field.endswith("_W"): field = field[:-2] prefix = field[:7] field = field[7:].lower() mapped_result = None if prefix == 'NXM_NX_': mapped_result = ...
def nxm_field_name_to_ryu(field): """ Convert an ovs-ofctl style NXM_/OXM_ field name to a ryu match field name. """ if field.endswith("_W"): field = field[:-2] prefix = field[:7] field = field[7:].lower() mapped_result = None if prefix == 'NXM_NX_': mapped_result = ...
[ "Convert", "an", "ovs", "-", "ofctl", "style", "NXM_", "/", "OXM_", "field", "name", "to", "a", "ryu", "match", "field", "name", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ofctl_string.py#L167-L189
[ "def", "nxm_field_name_to_ryu", "(", "field", ")", ":", "if", "field", ".", "endswith", "(", "\"_W\"", ")", ":", "field", "=", "field", "[", ":", "-", "2", "]", "prefix", "=", "field", "[", ":", "7", "]", "field", "=", "field", "[", "7", ":", "]"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
message_to_event
Converts Zebra protocol message instance to Zebra protocol service event instance. If corresponding event class is not defined, returns None. :param zclient: Zebra client instance. :param msg: Zebra protocol message. :return: Zebra protocol service event.
ryu/services/protocols/zebra/event.py
def message_to_event(zclient, msg): """ Converts Zebra protocol message instance to Zebra protocol service event instance. If corresponding event class is not defined, returns None. :param zclient: Zebra client instance. :param msg: Zebra protocol message. :return: Zebra protocol service e...
def message_to_event(zclient, msg): """ Converts Zebra protocol message instance to Zebra protocol service event instance. If corresponding event class is not defined, returns None. :param zclient: Zebra client instance. :param msg: Zebra protocol message. :return: Zebra protocol service e...
[ "Converts", "Zebra", "protocol", "message", "instance", "to", "Zebra", "protocol", "service", "event", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/event.py#L79-L98
[ "def", "message_to_event", "(", "zclient", ",", "msg", ")", ":", "if", "not", "isinstance", "(", "msg", ",", "zebra", ".", "ZebraMessage", ")", ":", "return", "None", "body_cls", "=", "msg", ".", "get_body_class", "(", "msg", ".", "version", ",", "msg", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CircularListType.node_del_attrs
Remove all attributes that are used for putting this node on this type of list.
ryu/services/protocols/bgp/utils/circlist.py
def node_del_attrs(self, node): """Remove all attributes that are used for putting this node on this type of list. """ try: delattr(node, self.next_name) delattr(node, self.prev_name) except AttributeError: pass
def node_del_attrs(self, node): """Remove all attributes that are used for putting this node on this type of list. """ try: delattr(node, self.next_name) delattr(node, self.prev_name) except AttributeError: pass
[ "Remove", "all", "attributes", "that", "are", "used", "for", "putting", "this", "node", "on", "this", "type", "of", "list", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/circlist.py#L206-L214
[ "def", "node_del_attrs", "(", "self", ",", "node", ")", ":", "try", ":", "delattr", "(", "node", ",", "self", ".", "next_name", ")", "delattr", "(", "node", ",", "self", ".", "prev_name", ")", "except", "AttributeError", ":", "pass" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CircularListType.node_is_on_list
Returns True if this node is on *some* list. A node is not on any list if it is linked to itself, or if it does not have the next and/prev attributes at all.
ryu/services/protocols/bgp/utils/circlist.py
def node_is_on_list(self, node): """Returns True if this node is on *some* list. A node is not on any list if it is linked to itself, or if it does not have the next and/prev attributes at all. """ next = self.node_next(node) if next == node or next is None: ...
def node_is_on_list(self, node): """Returns True if this node is on *some* list. A node is not on any list if it is linked to itself, or if it does not have the next and/prev attributes at all. """ next = self.node_next(node) if next == node or next is None: ...
[ "Returns", "True", "if", "this", "node", "is", "on", "*", "some", "*", "list", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/circlist.py#L216-L227
[ "def", "node_is_on_list", "(", "self", ",", "node", ")", ":", "next", "=", "self", ".", "node_next", "(", "node", ")", "if", "next", "==", "node", "or", "next", "is", "None", ":", "assert", "(", "self", ".", "node_prev", "(", "node", ")", "is", "ne...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CircularListType.node_insert_after
Insert the new node after node.
ryu/services/protocols/bgp/utils/circlist.py
def node_insert_after(self, node, new_node): """Insert the new node after node.""" assert(not self.node_is_on_list(new_node)) assert(node is not new_node) next = self.node_next(node) assert(next is not None) self.node_set_next(node, new_node) self.node_set_prev(...
def node_insert_after(self, node, new_node): """Insert the new node after node.""" assert(not self.node_is_on_list(new_node)) assert(node is not new_node) next = self.node_next(node) assert(next is not None) self.node_set_next(node, new_node) self.node_set_prev(...
[ "Insert", "the", "new", "node", "after", "node", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/circlist.py#L229-L241
[ "def", "node_insert_after", "(", "self", ",", "node", ",", "new_node", ")", ":", "assert", "(", "not", "self", ".", "node_is_on_list", "(", "new_node", ")", ")", "assert", "(", "node", "is", "not", "new_node", ")", "next", "=", "self", ".", "node_next", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CircularListType.node_insert_before
Insert the new node before node.
ryu/services/protocols/bgp/utils/circlist.py
def node_insert_before(self, node, new_node): """Insert the new node before node.""" assert(not self.node_is_on_list(new_node)) assert(node is not new_node) prev = self.node_prev(node) assert(prev is not None) self.node_set_prev(node, new_node) self.node_set_nex...
def node_insert_before(self, node, new_node): """Insert the new node before node.""" assert(not self.node_is_on_list(new_node)) assert(node is not new_node) prev = self.node_prev(node) assert(prev is not None) self.node_set_prev(node, new_node) self.node_set_nex...
[ "Insert", "the", "new", "node", "before", "node", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/circlist.py#L243-L255
[ "def", "node_insert_before", "(", "self", ",", "node", ",", "new_node", ")", ":", "assert", "(", "not", "self", ".", "node_is_on_list", "(", "new_node", ")", ")", "assert", "(", "node", "is", "not", "new_node", ")", "prev", "=", "self", ".", "node_prev",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CoreService.update_rtfilters
Updates RT filters for each peer. Should be called if a new RT Nlri's have changed based on the setting. Currently only used by `Processor` to update the RT filters after it has processed a RT destination. If RT filter has changed for a peer we call RT filter change handler.
ryu/services/protocols/bgp/core.py
def update_rtfilters(self): """Updates RT filters for each peer. Should be called if a new RT Nlri's have changed based on the setting. Currently only used by `Processor` to update the RT filters after it has processed a RT destination. If RT filter has changed for a peer we cal...
def update_rtfilters(self): """Updates RT filters for each peer. Should be called if a new RT Nlri's have changed based on the setting. Currently only used by `Processor` to update the RT filters after it has processed a RT destination. If RT filter has changed for a peer we cal...
[ "Updates", "RT", "filters", "for", "each", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core.py#L245-L278
[ "def", "update_rtfilters", "(", "self", ")", ":", "# Update RT filter for all peers", "# TODO(PH): Check if getting this map can be optimized (if expensive)", "new_peer_to_rtfilter_map", "=", "self", ".", "_compute_rtfilter_map", "(", ")", "# If we have new best path for RT NLRI, we ha...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CoreService._on_update_rt_filter
Handles update of peer RT filter. Parameters: - `peer`: (Peer) whose RT filter has changed. - `new_rts`: (set) of new RTs that peer is interested in. - `old_rts`: (set) of RTs that peers is no longer interested in.
ryu/services/protocols/bgp/core.py
def _on_update_rt_filter(self, peer, new_rts, old_rts): """Handles update of peer RT filter. Parameters: - `peer`: (Peer) whose RT filter has changed. - `new_rts`: (set) of new RTs that peer is interested in. - `old_rts`: (set) of RTs that peers is no longer interest...
def _on_update_rt_filter(self, peer, new_rts, old_rts): """Handles update of peer RT filter. Parameters: - `peer`: (Peer) whose RT filter has changed. - `new_rts`: (set) of new RTs that peer is interested in. - `old_rts`: (set) of RTs that peers is no longer interest...
[ "Handles", "update", "of", "peer", "RT", "filter", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core.py#L280-L295
[ "def", "_on_update_rt_filter", "(", "self", ",", "peer", ",", "new_rts", ",", "old_rts", ")", ":", "for", "table", "in", "self", ".", "_table_manager", ".", "_global_tables", ".", "values", "(", ")", ":", "if", "table", ".", "route_family", "==", "RF_RTC_U...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CoreService._compute_rtfilter_map
Returns neighbor's RT filter (permit/allow filter based on RT). Walks RT filter tree and computes current RT filters for each peer that have advertised RT NLRIs. Returns: dict of peer, and `set` of rts that a particular neighbor is interested in.
ryu/services/protocols/bgp/core.py
def _compute_rtfilter_map(self): """Returns neighbor's RT filter (permit/allow filter based on RT). Walks RT filter tree and computes current RT filters for each peer that have advertised RT NLRIs. Returns: dict of peer, and `set` of rts that a particular neighbor is ...
def _compute_rtfilter_map(self): """Returns neighbor's RT filter (permit/allow filter based on RT). Walks RT filter tree and computes current RT filters for each peer that have advertised RT NLRIs. Returns: dict of peer, and `set` of rts that a particular neighbor is ...
[ "Returns", "neighbor", "s", "RT", "filter", "(", "permit", "/", "allow", "filter", "based", "on", "RT", ")", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core.py#L297-L356
[ "def", "_compute_rtfilter_map", "(", "self", ")", ":", "rtfilter_map", "=", "{", "}", "def", "get_neigh_filter", "(", "neigh", ")", ":", "neigh_filter", "=", "rtfilter_map", ".", "get", "(", "neigh", ")", "# Lazy creation of neighbor RT filter", "if", "neigh_filte...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
CoreService.start_protocol
Handler of new connection requests on bgp server port. Checks if new connection request is valid and starts new instance of protocol.
ryu/services/protocols/bgp/core.py
def start_protocol(self, socket): """Handler of new connection requests on bgp server port. Checks if new connection request is valid and starts new instance of protocol. """ assert socket peer_addr, peer_port = self.get_remotename(socket) peer = self._peer_manag...
def start_protocol(self, socket): """Handler of new connection requests on bgp server port. Checks if new connection request is valid and starts new instance of protocol. """ assert socket peer_addr, peer_port = self.get_remotename(socket) peer = self._peer_manag...
[ "Handler", "of", "new", "connection", "requests", "on", "bgp", "server", "port", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core.py#L426-L470
[ "def", "start_protocol", "(", "self", ",", "socket", ")", ":", "assert", "socket", "peer_addr", ",", "peer_port", "=", "self", ".", "get_remotename", "(", "socket", ")", "peer", "=", "self", ".", "_peer_manager", ".", "get_by_addr", "(", "peer_addr", ")", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Stp.compare_root_path
Decide the port of the side near a root bridge. It is compared by the following priorities. 1. root path cost 2. designated bridge ID value 3. designated port ID value
ryu/lib/stplib.py
def compare_root_path(path_cost1, path_cost2, bridge_id1, bridge_id2, port_id1, port_id2): """ Decide the port of the side near a root bridge. It is compared by the following priorities. 1. root path cost 2. designated bridge ID value ...
def compare_root_path(path_cost1, path_cost2, bridge_id1, bridge_id2, port_id1, port_id2): """ Decide the port of the side near a root bridge. It is compared by the following priorities. 1. root path cost 2. designated bridge ID value ...
[ "Decide", "the", "port", "of", "the", "side", "near", "a", "root", "bridge", ".", "It", "is", "compared", "by", "the", "following", "priorities", ".", "1", ".", "root", "path", "cost", "2", ".", "designated", "bridge", "ID", "value", "3", ".", "designa...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L316-L328
[ "def", "compare_root_path", "(", "path_cost1", ",", "path_cost2", ",", "bridge_id1", ",", "bridge_id2", ",", "port_id1", ",", "port_id2", ")", ":", "result", "=", "Stp", ".", "_cmp_value", "(", "path_cost1", ",", "path_cost2", ")", "if", "not", "result", ":"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Stp.compare_bpdu_info
Check received BPDU is superior to currently held BPDU by the following comparison. - root bridge ID value - root path cost - designated bridge ID value - designated port ID value - times
ryu/lib/stplib.py
def compare_bpdu_info(my_priority, my_times, rcv_priority, rcv_times): """ Check received BPDU is superior to currently held BPDU by the following comparison. - root bridge ID value - root path cost - designated bridge ID value - designated port I...
def compare_bpdu_info(my_priority, my_times, rcv_priority, rcv_times): """ Check received BPDU is superior to currently held BPDU by the following comparison. - root bridge ID value - root path cost - designated bridge ID value - designated port I...
[ "Check", "received", "BPDU", "is", "superior", "to", "currently", "held", "BPDU", "by", "the", "following", "comparison", ".", "-", "root", "bridge", "ID", "value", "-", "root", "path", "cost", "-", "designated", "bridge", "ID", "value", "-", "designated", ...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L331-L364
[ "def", "compare_bpdu_info", "(", "my_priority", ",", "my_times", ",", "rcv_priority", ",", "rcv_times", ")", ":", "if", "my_priority", "is", "None", ":", "result", "=", "SUPERIOR", "else", ":", "result", "=", "Stp", ".", "_cmp_value", "(", "rcv_priority", "....
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Bridge.link_down
DESIGNATED_PORT/NON_DESIGNATED_PORT: change status to DISABLE. ROOT_PORT: change status to DISABLE and recalculate STP.
ryu/lib/stplib.py
def link_down(self, ofp_port): """ DESIGNATED_PORT/NON_DESIGNATED_PORT: change status to DISABLE. ROOT_PORT: change status to DISABLE and recalculate STP. """ port = self.ports[ofp_port.port_no] init_stp_flg = bool(port.role is ROOT_PORT) port.down(PORT_STATE_DISABLE, msg_in...
def link_down(self, ofp_port): """ DESIGNATED_PORT/NON_DESIGNATED_PORT: change status to DISABLE. ROOT_PORT: change status to DISABLE and recalculate STP. """ port = self.ports[ofp_port.port_no] init_stp_flg = bool(port.role is ROOT_PORT) port.down(PORT_STATE_DISABLE, msg_in...
[ "DESIGNATED_PORT", "/", "NON_DESIGNATED_PORT", ":", "change", "status", "to", "DISABLE", ".", "ROOT_PORT", ":", "change", "status", "to", "DISABLE", "and", "recalculate", "STP", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L459-L468
[ "def", "link_down", "(", "self", ",", "ofp_port", ")", ":", "port", "=", "self", ".", "ports", "[", "ofp_port", ".", "port_no", "]", "init_stp_flg", "=", "bool", "(", "port", ".", "role", "is", "ROOT_PORT", ")", "port", ".", "down", "(", "PORT_STATE_DI...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Bridge.recalculate_spanning_tree
Re-calculation of spanning tree.
ryu/lib/stplib.py
def recalculate_spanning_tree(self, init=True): """ Re-calculation of spanning tree. """ # All port down. for port in self.ports.values(): if port.state is not PORT_STATE_DISABLE: port.down(PORT_STATE_BLOCK, msg_init=init) # Send topology change event. ...
def recalculate_spanning_tree(self, init=True): """ Re-calculation of spanning tree. """ # All port down. for port in self.ports.values(): if port.state is not PORT_STATE_DISABLE: port.down(PORT_STATE_BLOCK, msg_init=init) # Send topology change event. ...
[ "Re", "-", "calculation", "of", "spanning", "tree", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L535-L564
[ "def", "recalculate_spanning_tree", "(", "self", ",", "init", "=", "True", ")", ":", "# All port down.", "for", "port", "in", "self", ".", "ports", ".", "values", "(", ")", ":", "if", "port", ".", "state", "is", "not", "PORT_STATE_DISABLE", ":", "port", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Bridge._spanning_tree_algorithm
Update tree roles. - Root bridge: all port is DESIGNATED_PORT. - Non root bridge: select one ROOT_PORT and some DESIGNATED_PORT, and the other port is set to NON_DESIGNATED_PORT.
ryu/lib/stplib.py
def _spanning_tree_algorithm(self): """ Update tree roles. - Root bridge: all port is DESIGNATED_PORT. - Non root bridge: select one ROOT_PORT and some DESIGNATED_PORT, and the other port is set to NON_DESIGNATED_PORT.""" port_rol...
def _spanning_tree_algorithm(self): """ Update tree roles. - Root bridge: all port is DESIGNATED_PORT. - Non root bridge: select one ROOT_PORT and some DESIGNATED_PORT, and the other port is set to NON_DESIGNATED_PORT.""" port_rol...
[ "Update", "tree", "roles", ".", "-", "Root", "bridge", ":", "all", "port", "is", "DESIGNATED_PORT", ".", "-", "Non", "root", "bridge", ":", "select", "one", "ROOT_PORT", "and", "some", "DESIGNATED_PORT", "and", "the", "other", "port", "is", "set", "to", ...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L566-L603
[ "def", "_spanning_tree_algorithm", "(", "self", ")", ":", "port_roles", "=", "{", "}", "root_port", "=", "self", ".", "_select_root_port", "(", ")", "if", "root_port", "is", "None", ":", "# My bridge is a root bridge.", "self", ".", "logger", ".", "info", "(",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Bridge._select_root_port
ROOT_PORT is the nearest port to a root bridge. It is determined by the cost of path, etc.
ryu/lib/stplib.py
def _select_root_port(self): """ ROOT_PORT is the nearest port to a root bridge. It is determined by the cost of path, etc. """ root_port = None for port in self.ports.values(): root_msg = (self.root_priority if root_port is None else root_port.de...
def _select_root_port(self): """ ROOT_PORT is the nearest port to a root bridge. It is determined by the cost of path, etc. """ root_port = None for port in self.ports.values(): root_msg = (self.root_priority if root_port is None else root_port.de...
[ "ROOT_PORT", "is", "the", "nearest", "port", "to", "a", "root", "bridge", ".", "It", "is", "determined", "by", "the", "cost", "of", "path", "etc", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L605-L635
[ "def", "_select_root_port", "(", "self", ")", ":", "root_port", "=", "None", "for", "port", "in", "self", ".", "ports", ".", "values", "(", ")", ":", "root_msg", "=", "(", "self", ".", "root_priority", "if", "root_port", "is", "None", "else", "root_port"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Bridge._select_designated_port
DESIGNATED_PORT is a port of the side near the root bridge of each link. It is determined by the cost of each path, etc same as ROOT_PORT.
ryu/lib/stplib.py
def _select_designated_port(self, root_port): """ DESIGNATED_PORT is a port of the side near the root bridge of each link. It is determined by the cost of each path, etc same as ROOT_PORT. """ d_ports = [] root_msg = root_port.designated_priority for port in self...
def _select_designated_port(self, root_port): """ DESIGNATED_PORT is a port of the side near the root bridge of each link. It is determined by the cost of each path, etc same as ROOT_PORT. """ d_ports = [] root_msg = root_port.designated_priority for port in self...
[ "DESIGNATED_PORT", "is", "a", "port", "of", "the", "side", "near", "the", "root", "bridge", "of", "each", "link", ".", "It", "is", "determined", "by", "the", "cost", "of", "each", "path", "etc", "same", "as", "ROOT_PORT", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L637-L663
[ "def", "_select_designated_port", "(", "self", ",", "root_port", ")", ":", "d_ports", "=", "[", "]", "root_msg", "=", "root_port", ".", "designated_priority", "for", "port", "in", "self", ".", "ports", ".", "values", "(", ")", ":", "port_msg", "=", "port",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Port.up
A port is started in the state of LISTEN.
ryu/lib/stplib.py
def up(self, role, root_priority, root_times): """ A port is started in the state of LISTEN. """ self.port_priority = root_priority self.port_times = root_times state = (PORT_STATE_LISTEN if self.config_enable else PORT_STATE_DISABLE) self._change_role(role) ...
def up(self, role, root_priority, root_times): """ A port is started in the state of LISTEN. """ self.port_priority = root_priority self.port_times = root_times state = (PORT_STATE_LISTEN if self.config_enable else PORT_STATE_DISABLE) self._change_role(role) ...
[ "A", "port", "is", "started", "in", "the", "state", "of", "LISTEN", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L780-L788
[ "def", "up", "(", "self", ",", "role", ",", "root_priority", ",", "root_times", ")", ":", "self", ".", "port_priority", "=", "root_priority", "self", ".", "port_times", "=", "root_times", "state", "=", "(", "PORT_STATE_LISTEN", "if", "self", ".", "config_ena...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Port.down
A port will be in the state of DISABLE or BLOCK, and be stopped.
ryu/lib/stplib.py
def down(self, state, msg_init=False): """ A port will be in the state of DISABLE or BLOCK, and be stopped. """ assert (state is PORT_STATE_DISABLE or state is PORT_STATE_BLOCK) if not self.config_enable: return if msg_init: self.des...
def down(self, state, msg_init=False): """ A port will be in the state of DISABLE or BLOCK, and be stopped. """ assert (state is PORT_STATE_DISABLE or state is PORT_STATE_BLOCK) if not self.config_enable: return if msg_init: self.des...
[ "A", "port", "will", "be", "in", "the", "state", "of", "DISABLE", "or", "BLOCK", "and", "be", "stopped", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L790-L803
[ "def", "down", "(", "self", ",", "state", ",", "msg_init", "=", "False", ")", ":", "assert", "(", "state", "is", "PORT_STATE_DISABLE", "or", "state", "is", "PORT_STATE_BLOCK", ")", "if", "not", "self", ".", "config_enable", ":", "return", "if", "msg_init",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Port._state_machine
Port state machine. Change next status when timer is exceeded or _change_status() method is called.
ryu/lib/stplib.py
def _state_machine(self): """ Port state machine. Change next status when timer is exceeded or _change_status() method is called.""" role_str = {ROOT_PORT: 'ROOT_PORT ', DESIGNATED_PORT: 'DESIGNATED_PORT ', NON_DESIGNATED_PORT...
def _state_machine(self): """ Port state machine. Change next status when timer is exceeded or _change_status() method is called.""" role_str = {ROOT_PORT: 'ROOT_PORT ', DESIGNATED_PORT: 'DESIGNATED_PORT ', NON_DESIGNATED_PORT...
[ "Port", "state", "machine", ".", "Change", "next", "status", "when", "timer", "is", "exceeded", "or", "_change_status", "()", "method", "is", "called", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L805-L843
[ "def", "_state_machine", "(", "self", ")", ":", "role_str", "=", "{", "ROOT_PORT", ":", "'ROOT_PORT '", ",", "DESIGNATED_PORT", ":", "'DESIGNATED_PORT '", ",", "NON_DESIGNATED_PORT", ":", "'NON_DESIGNATED_PORT'", "}", "state_str", "=", "{", "PORT_STATE_DIS...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Port.transmit_tc_bpdu
Set send_tc_flg to send Topology Change BPDU.
ryu/lib/stplib.py
def transmit_tc_bpdu(self): """ Set send_tc_flg to send Topology Change BPDU. """ if not self.send_tc_flg: timer = datetime.timedelta(seconds=self.port_times.max_age + self.port_times.forward_delay) self.send_tc_timer = datetime.datetime.tod...
def transmit_tc_bpdu(self): """ Set send_tc_flg to send Topology Change BPDU. """ if not self.send_tc_flg: timer = datetime.timedelta(seconds=self.port_times.max_age + self.port_times.forward_delay) self.send_tc_timer = datetime.datetime.tod...
[ "Set", "send_tc_flg", "to", "send", "Topology", "Change", "BPDU", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L1021-L1027
[ "def", "transmit_tc_bpdu", "(", "self", ")", ":", "if", "not", "self", ".", "send_tc_flg", ":", "timer", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "self", ".", "port_times", ".", "max_age", "+", "self", ".", "port_times", ".", "forward_delay"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Port.transmit_ack_bpdu
Send Topology Change Ack BPDU.
ryu/lib/stplib.py
def transmit_ack_bpdu(self): """ Send Topology Change Ack BPDU. """ ack_flags = 0b10000001 bpdu_data = self._generate_config_bpdu(ack_flags) self.ofctl.send_packet_out(self.ofport.port_no, bpdu_data)
def transmit_ack_bpdu(self): """ Send Topology Change Ack BPDU. """ ack_flags = 0b10000001 bpdu_data = self._generate_config_bpdu(ack_flags) self.ofctl.send_packet_out(self.ofport.port_no, bpdu_data)
[ "Send", "Topology", "Change", "Ack", "BPDU", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stplib.py#L1029-L1033
[ "def", "transmit_ack_bpdu", "(", "self", ")", ":", "ack_flags", "=", "0b10000001", "bpdu_data", "=", "self", ".", "_generate_config_bpdu", "(", "ack_flags", ")", "self", ".", "ofctl", ".", "send_packet_out", "(", "self", ".", "ofport", ".", "port_no", ",", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
tcp.has_flags
Check if flags are set on this packet. returns boolean if all passed flags is set Example:: >>> pkt = tcp.tcp(bits=(tcp.TCP_SYN | tcp.TCP_ACK)) >>> pkt.has_flags(tcp.TCP_SYN, tcp.TCP_ACK) True
ryu/lib/packet/tcp.py
def has_flags(self, *flags): """Check if flags are set on this packet. returns boolean if all passed flags is set Example:: >>> pkt = tcp.tcp(bits=(tcp.TCP_SYN | tcp.TCP_ACK)) >>> pkt.has_flags(tcp.TCP_SYN, tcp.TCP_ACK) True """ mask = sum(...
def has_flags(self, *flags): """Check if flags are set on this packet. returns boolean if all passed flags is set Example:: >>> pkt = tcp.tcp(bits=(tcp.TCP_SYN | tcp.TCP_ACK)) >>> pkt.has_flags(tcp.TCP_SYN, tcp.TCP_ACK) True """ mask = sum(...
[ "Check", "if", "flags", "are", "set", "on", "this", "packet", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/tcp.py#L100-L113
[ "def", "has_flags", "(", "self", ",", "*", "flags", ")", ":", "mask", "=", "sum", "(", "flags", ")", "return", "(", "self", ".", "bits", "&", "mask", ")", "==", "mask" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
_parse_user_flags
Parses user-flags file and loads it to register user defined options.
ryu/cmd/manager.py
def _parse_user_flags(): """ Parses user-flags file and loads it to register user defined options. """ try: idx = list(sys.argv).index('--user-flags') user_flags_file = sys.argv[idx + 1] except (ValueError, IndexError): user_flags_file = '' if user_flags_file and os.path...
def _parse_user_flags(): """ Parses user-flags file and loads it to register user defined options. """ try: idx = list(sys.argv).index('--user-flags') user_flags_file = sys.argv[idx + 1] except (ValueError, IndexError): user_flags_file = '' if user_flags_file and os.path...
[ "Parses", "user", "-", "flags", "file", "and", "loads", "it", "to", "register", "user", "defined", "options", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/manager.py#L54-L66
[ "def", "_parse_user_flags", "(", ")", ":", "try", ":", "idx", "=", "list", "(", "sys", ".", "argv", ")", ".", "index", "(", "'--user-flags'", ")", "user_flags_file", "=", "sys", ".", "argv", "[", "idx", "+", "1", "]", "except", "(", "ValueError", ","...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
nvgre
Generate instance of GRE class with information for NVGRE (RFC7637). :param version: Version. :param vsid: Virtual Subnet ID. :param flow_id: FlowID. :return: Instance of GRE class with information for NVGRE.
ryu/lib/packet/gre.py
def nvgre(version=0, vsid=0, flow_id=0): """ Generate instance of GRE class with information for NVGRE (RFC7637). :param version: Version. :param vsid: Virtual Subnet ID. :param flow_id: FlowID. :return: Instance of GRE class with information for NVGRE. """ # NVGRE header # 0 1 2 ...
def nvgre(version=0, vsid=0, flow_id=0): """ Generate instance of GRE class with information for NVGRE (RFC7637). :param version: Version. :param vsid: Virtual Subnet ID. :param flow_id: FlowID. :return: Instance of GRE class with information for NVGRE. """ # NVGRE header # 0 1 2 ...
[ "Generate", "instance", "of", "GRE", "class", "with", "information", "for", "NVGRE", "(", "RFC7637", ")", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/gre.py#L199-L217
[ "def", "nvgre", "(", "version", "=", "0", ",", "vsid", "=", "0", ",", "flow_id", "=", "0", ")", ":", "# NVGRE header", "# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1", "# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+", "# |0| |1|0| Res...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ofp_msg_from_jsondict
This function instanticates an appropriate OpenFlow message class from the given JSON style dictionary. The objects created by following two code fragments are equivalent. Code A:: jsonstr = '{ "OFPSetConfig": { "flags": 0, "miss_send_len": 128 } }' jsondict = json.loads(jsonstr) o...
ryu/ofproto/ofproto_parser.py
def ofp_msg_from_jsondict(dp, jsondict): """ This function instanticates an appropriate OpenFlow message class from the given JSON style dictionary. The objects created by following two code fragments are equivalent. Code A:: jsonstr = '{ "OFPSetConfig": { "flags": 0, "miss_send_len": 128 ...
def ofp_msg_from_jsondict(dp, jsondict): """ This function instanticates an appropriate OpenFlow message class from the given JSON style dictionary. The objects created by following two code fragments are equivalent. Code A:: jsonstr = '{ "OFPSetConfig": { "flags": 0, "miss_send_len": 128 ...
[ "This", "function", "instanticates", "an", "appropriate", "OpenFlow", "message", "class", "from", "the", "given", "JSON", "style", "dictionary", ".", "The", "objects", "created", "by", "following", "two", "code", "fragments", "are", "equivalent", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_parser.py#L95-L125
[ "def", "ofp_msg_from_jsondict", "(", "dp", ",", "jsondict", ")", ":", "parser", "=", "dp", ".", "ofproto_parser", "assert", "len", "(", "jsondict", ")", "==", "1", "for", "k", ",", "v", "in", "jsondict", ".", "items", "(", ")", ":", "cls", "=", "geta...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ofp_instruction_from_jsondict
This function is intended to be used with ryu.lib.ofctl_string.ofp_instruction_from_str. It is very similar to ofp_msg_from_jsondict, but works on a list of OFPInstructions/OFPActions. It also encapsulates OFPAction into OFPInstructionActions, as >OF1.0 OFPFlowMod requires that. This function t...
ryu/ofproto/ofproto_parser.py
def ofp_instruction_from_jsondict(dp, jsonlist, encap=True): """ This function is intended to be used with ryu.lib.ofctl_string.ofp_instruction_from_str. It is very similar to ofp_msg_from_jsondict, but works on a list of OFPInstructions/OFPActions. It also encapsulates OFPAction into OFPInstruc...
def ofp_instruction_from_jsondict(dp, jsonlist, encap=True): """ This function is intended to be used with ryu.lib.ofctl_string.ofp_instruction_from_str. It is very similar to ofp_msg_from_jsondict, but works on a list of OFPInstructions/OFPActions. It also encapsulates OFPAction into OFPInstruc...
[ "This", "function", "is", "intended", "to", "be", "used", "with", "ryu", ".", "lib", ".", "ofctl_string", ".", "ofp_instruction_from_str", ".", "It", "is", "very", "similar", "to", "ofp_msg_from_jsondict", "but", "works", "on", "a", "list", "of", "OFPInstructi...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_parser.py#L128-L175
[ "def", "ofp_instruction_from_jsondict", "(", "dp", ",", "jsonlist", ",", "encap", "=", "True", ")", ":", "proto", "=", "dp", ".", "ofproto", "parser", "=", "dp", ".", "ofproto_parser", "actions", "=", "[", "]", "result", "=", "[", "]", "for", "jsondict",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
set_tcp_md5sig
Enable TCP-MD5 on the given socket. :param s: Socket :param addr: Associated address. On some platforms, this has no effect. :param key: Key. On some platforms, this has no effect.
ryu/lib/sockopt.py
def set_tcp_md5sig(s, addr, key): """Enable TCP-MD5 on the given socket. :param s: Socket :param addr: Associated address. On some platforms, this has no effect. :param key: Key. On some platforms, this has no effect. """ impls = { 'FreeBSD': _set_tcp_md5sig_bsd, 'Linux': _set...
def set_tcp_md5sig(s, addr, key): """Enable TCP-MD5 on the given socket. :param s: Socket :param addr: Associated address. On some platforms, this has no effect. :param key: Key. On some platforms, this has no effect. """ impls = { 'FreeBSD': _set_tcp_md5sig_bsd, 'Linux': _set...
[ "Enable", "TCP", "-", "MD5", "on", "the", "given", "socket", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/sockopt.py#L54-L71
[ "def", "set_tcp_md5sig", "(", "s", ",", "addr", ",", "key", ")", ":", "impls", "=", "{", "'FreeBSD'", ":", "_set_tcp_md5sig_bsd", ",", "'Linux'", ":", "_set_tcp_md5sig_linux", ",", "'NetBSD'", ":", "_set_tcp_md5sig_bsd", ",", "}", "system", "=", "platform", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
register_switch_address
Registers a new address to initiate connection to switch. Registers a new IP address and port pair of switch to let ryu.controller.controller.OpenFlowController to try to initiate connection to switch. :param addr: A tuple of (host, port) pair of switch. :param interval: Interval in seconds to try...
ryu/controller/ofp_api.py
def register_switch_address(addr, interval=None): """ Registers a new address to initiate connection to switch. Registers a new IP address and port pair of switch to let ryu.controller.controller.OpenFlowController to try to initiate connection to switch. :param addr: A tuple of (host, port) p...
def register_switch_address(addr, interval=None): """ Registers a new address to initiate connection to switch. Registers a new IP address and port pair of switch to let ryu.controller.controller.OpenFlowController to try to initiate connection to switch. :param addr: A tuple of (host, port) p...
[ "Registers", "a", "new", "address", "to", "initiate", "connection", "to", "switch", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/controller/ofp_api.py#L31-L57
[ "def", "register_switch_address", "(", "addr", ",", "interval", "=", "None", ")", ":", "assert", "len", "(", "addr", ")", "==", "2", "assert", "ip", ".", "valid_ipv4", "(", "addr", "[", "0", "]", ")", "or", "ip", ".", "valid_ipv6", "(", "addr", "[", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
unregister_switch_address
Unregister the given switch address. Unregisters the given switch address to let ryu.controller.controller.OpenFlowController stop trying to initiate connection to switch. :param addr: A tuple of (host, port) pair of switch.
ryu/controller/ofp_api.py
def unregister_switch_address(addr): """ Unregister the given switch address. Unregisters the given switch address to let ryu.controller.controller.OpenFlowController stop trying to initiate connection to switch. :param addr: A tuple of (host, port) pair of switch. """ ofp_handler = ap...
def unregister_switch_address(addr): """ Unregister the given switch address. Unregisters the given switch address to let ryu.controller.controller.OpenFlowController stop trying to initiate connection to switch. :param addr: A tuple of (host, port) pair of switch. """ ofp_handler = ap...
[ "Unregister", "the", "given", "switch", "address", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/controller/ofp_api.py#L60-L74
[ "def", "unregister_switch_address", "(", "addr", ")", ":", "ofp_handler", "=", "app_manager", ".", "lookup_service_brick", "(", "ofp_event", ".", "NAME", ")", "# Do nothing if ofp_handler is not started yet", "if", "ofp_handler", ".", "controller", "is", "None", ":", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
default_help_formatter
Apply default formatting for help messages :param quick_helps: list of tuples containing help info
ryu/services/protocols/bgp/operator/command.py
def default_help_formatter(quick_helps): """Apply default formatting for help messages :param quick_helps: list of tuples containing help info """ ret = '' for line in quick_helps: cmd_path, param_hlp, cmd_hlp = line ret += ' '.join(cmd_path) + ' ' if param_hlp: ...
def default_help_formatter(quick_helps): """Apply default formatting for help messages :param quick_helps: list of tuples containing help info """ ret = '' for line in quick_helps: cmd_path, param_hlp, cmd_hlp = line ret += ' '.join(cmd_path) + ' ' if param_hlp: ...
[ "Apply", "default", "formatting", "for", "help", "messages" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/operator/command.py#L15-L27
[ "def", "default_help_formatter", "(", "quick_helps", ")", ":", "ret", "=", "''", "for", "line", "in", "quick_helps", ":", "cmd_path", ",", "param_hlp", ",", "cmd_hlp", "=", "line", "ret", "+=", "' '", ".", "join", "(", "cmd_path", ")", "+", "' '", "if", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Command.cli_resp_formatter
Override this method to provide custom formatting of cli response.
ryu/services/protocols/bgp/operator/command.py
def cli_resp_formatter(cls, resp): """Override this method to provide custom formatting of cli response. """ if not resp.value: return '' if resp.status == STATUS_OK: if type(resp.value) in (str, bool, int, float, six.text_type): return str(resp....
def cli_resp_formatter(cls, resp): """Override this method to provide custom formatting of cli response. """ if not resp.value: return '' if resp.status == STATUS_OK: if type(resp.value) in (str, bool, int, float, six.text_type): return str(resp....
[ "Override", "this", "method", "to", "provide", "custom", "formatting", "of", "cli", "response", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/operator/command.py#L105-L130
[ "def", "cli_resp_formatter", "(", "cls", ",", "resp", ")", ":", "if", "not", "resp", ".", "value", ":", "return", "''", "if", "resp", ".", "status", "==", "STATUS_OK", ":", "if", "type", "(", "resp", ".", "value", ")", "in", "(", "str", ",", "bool"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Command.filter_resp
Filter response of action. Used to make printed results more specific :param action_resp: named tuple (CommandsResponse) containing response from action. :param filter_params: params used after '|' specific for given filter :return: filtered response.
ryu/services/protocols/bgp/operator/command.py
def filter_resp(self, action_resp, filter_params): """Filter response of action. Used to make printed results more specific :param action_resp: named tuple (CommandsResponse) containing response from action. :param filter_params: params used after '|' specific for given filt...
def filter_resp(self, action_resp, filter_params): """Filter response of action. Used to make printed results more specific :param action_resp: named tuple (CommandsResponse) containing response from action. :param filter_params: params used after '|' specific for given filt...
[ "Filter", "response", "of", "action", ".", "Used", "to", "make", "printed", "results", "more", "specific" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/operator/command.py#L170-L188
[ "def", "filter_resp", "(", "self", ",", "action_resp", ",", "filter_params", ")", ":", "if", "action_resp", ".", "status", "==", "STATUS_OK", ":", "try", ":", "return", "CommandsResponse", "(", "STATUS_OK", ",", "TextFilter", ".", "filter", "(", "action_resp",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Command.question_mark
Shows help for this command and it's sub-commands.
ryu/services/protocols/bgp/operator/command.py
def question_mark(self): """Shows help for this command and it's sub-commands. """ ret = [] if self.param_help_msg or len(self.subcommands) == 0: ret.append(self._quick_help()) if len(self.subcommands) > 0: for k, _ in sorted(self.subcommands.items()): ...
def question_mark(self): """Shows help for this command and it's sub-commands. """ ret = [] if self.param_help_msg or len(self.subcommands) == 0: ret.append(self._quick_help()) if len(self.subcommands) > 0: for k, _ in sorted(self.subcommands.items()): ...
[ "Shows", "help", "for", "this", "command", "and", "it", "s", "sub", "-", "commands", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/operator/command.py#L190-L207
[ "def", "question_mark", "(", "self", ")", ":", "ret", "=", "[", "]", "if", "self", ".", "param_help_msg", "or", "len", "(", "self", ".", "subcommands", ")", "==", "0", ":", "ret", ".", "append", "(", "self", ".", "_quick_help", "(", ")", ")", "if",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Command._quick_help
:param nested: True if help is requested directly for this command and False when help is requested for a list of possible completions.
ryu/services/protocols/bgp/operator/command.py
def _quick_help(self, nested=False): """:param nested: True if help is requested directly for this command and False when help is requested for a list of possible completions. """ if nested: return self.command_path(), None, self.help_msg ...
def _quick_help(self, nested=False): """:param nested: True if help is requested directly for this command and False when help is requested for a list of possible completions. """ if nested: return self.command_path(), None, self.help_msg ...
[ ":", "param", "nested", ":", "True", "if", "help", "is", "requested", "directly", "for", "this", "command", "and", "False", "when", "help", "is", "requested", "for", "a", "list", "of", "possible", "completions", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/operator/command.py#L209-L217
[ "def", "_quick_help", "(", "self", ",", "nested", "=", "False", ")", ":", "if", "nested", ":", "return", "self", ".", "command_path", "(", ")", ",", "None", ",", "self", ".", "help_msg", "else", ":", "return", "self", ".", "command_path", "(", ")", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ip_link_add
Adds an interface record into Zebra protocol service database. The arguments are similar to "ip link add" command of iproute2. :param session: Session instance connecting to database. :param name: Name of interface. :param type_: Type of interface. 'loopback' or 'ethernet'. :param lladdr: Link lay...
ryu/services/protocols/zebra/db/interface.py
def ip_link_add(session, name, type_='loopback', lladdr='00:00:00:00:00:00'): """ Adds an interface record into Zebra protocol service database. The arguments are similar to "ip link add" command of iproute2. :param session: Session instance connecting to database. :param name: Name of interface. ...
def ip_link_add(session, name, type_='loopback', lladdr='00:00:00:00:00:00'): """ Adds an interface record into Zebra protocol service database. The arguments are similar to "ip link add" command of iproute2. :param session: Session instance connecting to database. :param name: Name of interface. ...
[ "Adds", "an", "interface", "record", "into", "Zebra", "protocol", "service", "database", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/interface.py#L133-L165
[ "def", "ip_link_add", "(", "session", ",", "name", ",", "type_", "=", "'loopback'", ",", "lladdr", "=", "'00:00:00:00:00:00'", ")", ":", "intf", "=", "ip_link_show", "(", "session", ",", "ifname", "=", "name", ")", "if", "intf", ":", "LOG", ".", "debug",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ip_link_delete
Deletes an interface record from Zebra protocol service database. The arguments are similar to "ip link delete" command of iproute2. :param session: Session instance connecting to database. :param name: Name of interface. :return: Name of interface which was deleted. None if failed.
ryu/services/protocols/zebra/db/interface.py
def ip_link_delete(session, name): """ Deletes an interface record from Zebra protocol service database. The arguments are similar to "ip link delete" command of iproute2. :param session: Session instance connecting to database. :param name: Name of interface. :return: Name of interface which ...
def ip_link_delete(session, name): """ Deletes an interface record from Zebra protocol service database. The arguments are similar to "ip link delete" command of iproute2. :param session: Session instance connecting to database. :param name: Name of interface. :return: Name of interface which ...
[ "Deletes", "an", "interface", "record", "from", "Zebra", "protocol", "service", "database", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/interface.py#L169-L186
[ "def", "ip_link_delete", "(", "session", ",", "name", ")", ":", "intf", "=", "ip_link_show", "(", "session", ",", "ifname", "=", "name", ")", "if", "not", "intf", ":", "LOG", ".", "debug", "(", "'Interface \"%s\" does not exist'", ",", "name", ")", "return...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ip_address_add
Adds an IP address to interface record identified with the given "ifname". The arguments are similar to "ip address add" command of iproute2. :param session: Session instance connecting to database. :param ifname: Name of interface. :param ifaddr: IPv4 or IPv6 address. :return: Instance of record ...
ryu/services/protocols/zebra/db/interface.py
def ip_address_add(session, ifname, ifaddr): """ Adds an IP address to interface record identified with the given "ifname". The arguments are similar to "ip address add" command of iproute2. :param session: Session instance connecting to database. :param ifname: Name of interface. :param ifadd...
def ip_address_add(session, ifname, ifaddr): """ Adds an IP address to interface record identified with the given "ifname". The arguments are similar to "ip address add" command of iproute2. :param session: Session instance connecting to database. :param ifname: Name of interface. :param ifadd...
[ "Adds", "an", "IP", "address", "to", "interface", "record", "identified", "with", "the", "given", "ifname", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/interface.py#L196-L231
[ "def", "ip_address_add", "(", "session", ",", "ifname", ",", "ifaddr", ")", ":", "def", "_append_inet_addr", "(", "intf_inet", ",", "addr", ")", ":", "addr_list", "=", "intf_inet", ".", "split", "(", "','", ")", "if", "addr", "in", "addr_list", ":", "LOG...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ip_address_delete
Deletes an IP address from interface record identified with the given "ifname". The arguments are similar to "ip address delete" command of iproute2. :param session: Session instance connecting to database. :param ifname: Name of interface. :param ifaddr: IPv4 or IPv6 address. :return: Instanc...
ryu/services/protocols/zebra/db/interface.py
def ip_address_delete(session, ifname, ifaddr): """ Deletes an IP address from interface record identified with the given "ifname". The arguments are similar to "ip address delete" command of iproute2. :param session: Session instance connecting to database. :param ifname: Name of interface. ...
def ip_address_delete(session, ifname, ifaddr): """ Deletes an IP address from interface record identified with the given "ifname". The arguments are similar to "ip address delete" command of iproute2. :param session: Session instance connecting to database. :param ifname: Name of interface. ...
[ "Deletes", "an", "IP", "address", "from", "interface", "record", "identified", "with", "the", "given", "ifname", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/interface.py#L235-L271
[ "def", "ip_address_delete", "(", "session", ",", "ifname", ",", "ifaddr", ")", ":", "def", "_remove_inet_addr", "(", "intf_inet", ",", "addr", ")", ":", "addr_list", "=", "intf_inet", ".", "split", "(", "','", ")", "if", "addr", "not", "in", "addr_list", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
_split_str
split string into list of strings by specified number.
ryu/lib/type_desc.py
def _split_str(s, n): """ split string into list of strings by specified number. """ length = len(s) return [s[i:i + n] for i in range(0, length, n)]
def _split_str(s, n): """ split string into list of strings by specified number. """ length = len(s) return [s[i:i + n] for i in range(0, length, n)]
[ "split", "string", "into", "list", "of", "strings", "by", "specified", "number", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/type_desc.py#L57-L62
[ "def", "_split_str", "(", "s", ",", "n", ")", ":", "length", "=", "len", "(", "s", ")", "return", "[", "s", "[", "i", ":", "i", "+", "n", "]", "for", "i", "in", "range", "(", "0", ",", "length", ",", "n", ")", "]" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
systemdef
Generates a dict of system parameters used throughout a simulation. Parameters ---------- meta : dict meta dict either generated from a TMY file using readtmy2 or readtmy3, or a dict containing at least the following fields: =============== ====== ==================== ...
pvlib/pvsystem.py
def systemdef(meta, surface_tilt, surface_azimuth, albedo, modules_per_string, strings_per_inverter): ''' Generates a dict of system parameters used throughout a simulation. Parameters ---------- meta : dict meta dict either generated from a TMY file using readtmy2 or ...
def systemdef(meta, surface_tilt, surface_azimuth, albedo, modules_per_string, strings_per_inverter): ''' Generates a dict of system parameters used throughout a simulation. Parameters ---------- meta : dict meta dict either generated from a TMY file using readtmy2 or ...
[ "Generates", "a", "dict", "of", "system", "parameters", "used", "throughout", "a", "simulation", "." ]
pvlib/pvlib-python
python
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L806-L890
[ "def", "systemdef", "(", "meta", ",", "surface_tilt", ",", "surface_azimuth", ",", "albedo", ",", "modules_per_string", ",", "strings_per_inverter", ")", ":", "try", ":", "name", "=", "meta", "[", "'Name'", "]", "except", "KeyError", ":", "name", "=", "meta"...
2e844a595b820b43d1170269781fa66bd0ccc8a3
train
ashraeiam
Determine the incidence angle modifier using the ASHRAE transmission model. ashraeiam calculates the incidence angle modifier as developed in [1], and adopted by ASHRAE (American Society of Heating, Refrigeration, and Air Conditioning Engineers) [2]. The model has been used by model programs such a...
pvlib/pvsystem.py
def ashraeiam(aoi, b=0.05): ''' Determine the incidence angle modifier using the ASHRAE transmission model. ashraeiam calculates the incidence angle modifier as developed in [1], and adopted by ASHRAE (American Society of Heating, Refrigeration, and Air Conditioning Engineers) [2]. The model ha...
def ashraeiam(aoi, b=0.05): ''' Determine the incidence angle modifier using the ASHRAE transmission model. ashraeiam calculates the incidence angle modifier as developed in [1], and adopted by ASHRAE (American Society of Heating, Refrigeration, and Air Conditioning Engineers) [2]. The model ha...
[ "Determine", "the", "incidence", "angle", "modifier", "using", "the", "ASHRAE", "transmission", "model", "." ]
pvlib/pvlib-python
python
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L893-L952
[ "def", "ashraeiam", "(", "aoi", ",", "b", "=", "0.05", ")", ":", "iam", "=", "1", "-", "b", "*", "(", "(", "1", "/", "np", ".", "cos", "(", "np", ".", "radians", "(", "aoi", ")", ")", "-", "1", ")", ")", "aoi_gte_90", "=", "np", ".", "ful...
2e844a595b820b43d1170269781fa66bd0ccc8a3
train
physicaliam
Determine the incidence angle modifier using refractive index, extinction coefficient, and glazing thickness. physicaliam calculates the incidence angle modifier as described in De Soto et al. "Improvement and validation of a model for photovoltaic array performance", section 3. The calculation is base...
pvlib/pvsystem.py
def physicaliam(aoi, n=1.526, K=4., L=0.002): ''' Determine the incidence angle modifier using refractive index, extinction coefficient, and glazing thickness. physicaliam calculates the incidence angle modifier as described in De Soto et al. "Improvement and validation of a model for photovolt...
def physicaliam(aoi, n=1.526, K=4., L=0.002): ''' Determine the incidence angle modifier using refractive index, extinction coefficient, and glazing thickness. physicaliam calculates the incidence angle modifier as described in De Soto et al. "Improvement and validation of a model for photovolt...
[ "Determine", "the", "incidence", "angle", "modifier", "using", "refractive", "index", "extinction", "coefficient", "and", "glazing", "thickness", "." ]
pvlib/pvlib-python
python
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L955-L1064
[ "def", "physicaliam", "(", "aoi", ",", "n", "=", "1.526", ",", "K", "=", "4.", ",", "L", "=", "0.002", ")", ":", "zeroang", "=", "1e-06", "# hold a new reference to the input aoi object since we're going to", "# overwrite the aoi reference below, but we'll need it for the...
2e844a595b820b43d1170269781fa66bd0ccc8a3
train
calcparams_desoto
Calculates five parameter values for the single diode equation at effective irradiance and cell temperature using the De Soto et al. model described in [1]. The five values returned by calcparams_desoto can be used by singlediode to calculate an IV curve. Parameters ---------- effective_irradia...
pvlib/pvsystem.py
def calcparams_desoto(effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, EgRef=1.121, dEgdT=-0.0002677, irrad_ref=1000, temp_ref=25): ''' Calculates five parameter values for the single diode equation at effect...
def calcparams_desoto(effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, EgRef=1.121, dEgdT=-0.0002677, irrad_ref=1000, temp_ref=25): ''' Calculates five parameter values for the single diode equation at effect...
[ "Calculates", "five", "parameter", "values", "for", "the", "single", "diode", "equation", "at", "effective", "irradiance", "and", "cell", "temperature", "using", "the", "De", "Soto", "et", "al", ".", "model", "described", "in", "[", "1", "]", ".", "The", "...
pvlib/pvlib-python
python
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L1067-L1282
[ "def", "calcparams_desoto", "(", "effective_irradiance", ",", "temp_cell", ",", "alpha_sc", ",", "a_ref", ",", "I_L_ref", ",", "I_o_ref", ",", "R_sh_ref", ",", "R_s", ",", "EgRef", "=", "1.121", ",", "dEgdT", "=", "-", "0.0002677", ",", "irrad_ref", "=", "...
2e844a595b820b43d1170269781fa66bd0ccc8a3
train
calcparams_cec
Calculates five parameter values for the single diode equation at effective irradiance and cell temperature using the CEC model described in [1]. The CEC model differs from the De soto et al. model [3] by the parameter Adjust. The five values returned by calcparams_cec can be used by singlediode to calc...
pvlib/pvsystem.py
def calcparams_cec(effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, Adjust, EgRef=1.121, dEgdT=-0.0002677, irrad_ref=1000, temp_ref=25): ''' Calculates five parameter values for the single diode equation at effective ...
def calcparams_cec(effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, Adjust, EgRef=1.121, dEgdT=-0.0002677, irrad_ref=1000, temp_ref=25): ''' Calculates five parameter values for the single diode equation at effective ...
[ "Calculates", "five", "parameter", "values", "for", "the", "single", "diode", "equation", "at", "effective", "irradiance", "and", "cell", "temperature", "using", "the", "CEC", "model", "described", "in", "[", "1", "]", ".", "The", "CEC", "model", "differs", ...
pvlib/pvlib-python
python
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L1285-L1398
[ "def", "calcparams_cec", "(", "effective_irradiance", ",", "temp_cell", ",", "alpha_sc", ",", "a_ref", ",", "I_L_ref", ",", "I_o_ref", ",", "R_sh_ref", ",", "R_s", ",", "Adjust", ",", "EgRef", "=", "1.121", ",", "dEgdT", "=", "-", "0.0002677", ",", "irrad_...
2e844a595b820b43d1170269781fa66bd0ccc8a3
train
calcparams_pvsyst
Calculates five parameter values for the single diode equation at effective irradiance and cell temperature using the PVsyst v6 model described in [1,2,3]. The five values returned by calcparams_pvsyst can be used by singlediode to calculate an IV curve. Parameters ---------- effective_irradian...
pvlib/pvsystem.py
def calcparams_pvsyst(effective_irradiance, temp_cell, alpha_sc, gamma_ref, mu_gamma, I_L_ref, I_o_ref, R_sh_ref, R_sh_0, R_s, cells_in_series, R_sh_exp=5.5, EgRef=1.121, ...
def calcparams_pvsyst(effective_irradiance, temp_cell, alpha_sc, gamma_ref, mu_gamma, I_L_ref, I_o_ref, R_sh_ref, R_sh_0, R_s, cells_in_series, R_sh_exp=5.5, EgRef=1.121, ...
[ "Calculates", "five", "parameter", "values", "for", "the", "single", "diode", "equation", "at", "effective", "irradiance", "and", "cell", "temperature", "using", "the", "PVsyst", "v6", "model", "described", "in", "[", "1", "2", "3", "]", ".", "The", "five", ...
pvlib/pvlib-python
python
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L1401-L1536
[ "def", "calcparams_pvsyst", "(", "effective_irradiance", ",", "temp_cell", ",", "alpha_sc", ",", "gamma_ref", ",", "mu_gamma", ",", "I_L_ref", ",", "I_o_ref", ",", "R_sh_ref", ",", "R_sh_0", ",", "R_s", ",", "cells_in_series", ",", "R_sh_exp", "=", "5.5", ",",...
2e844a595b820b43d1170269781fa66bd0ccc8a3
train
retrieve_sam
Retrieve latest module and inverter info from a local file or the SAM website. This function will retrieve either: * CEC module database * Sandia Module database * CEC Inverter database * Anton Driesse Inverter database and return it as a pandas DataFrame. Parameters ...
pvlib/pvsystem.py
def retrieve_sam(name=None, path=None): ''' Retrieve latest module and inverter info from a local file or the SAM website. This function will retrieve either: * CEC module database * Sandia Module database * CEC Inverter database * Anton Driesse Inverter database a...
def retrieve_sam(name=None, path=None): ''' Retrieve latest module and inverter info from a local file or the SAM website. This function will retrieve either: * CEC module database * Sandia Module database * CEC Inverter database * Anton Driesse Inverter database a...
[ "Retrieve", "latest", "module", "and", "inverter", "info", "from", "a", "local", "file", "or", "the", "SAM", "website", "." ]
pvlib/pvlib-python
python
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L1539-L1645
[ "def", "retrieve_sam", "(", "name", "=", "None", ",", "path", "=", "None", ")", ":", "if", "name", "is", "not", "None", ":", "name", "=", "name", ".", "lower", "(", ")", "data_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ...
2e844a595b820b43d1170269781fa66bd0ccc8a3