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 | MessageEncoder.get_and_dispatch_messages | dissect messages from a raw stream data.
disp_table[type] should be a callable for the corresponding
MessageType. | ryu/lib/rpc.py | def get_and_dispatch_messages(self, data, disp_table):
"""dissect messages from a raw stream data.
disp_table[type] should be a callable for the corresponding
MessageType.
"""
self._unpacker.feed(data)
for m in self._unpacker:
self._dispatch_message(m, disp_ta... | def get_and_dispatch_messages(self, data, disp_table):
"""dissect messages from a raw stream data.
disp_table[type] should be a callable for the corresponding
MessageType.
"""
self._unpacker.feed(data)
for m in self._unpacker:
self._dispatch_message(m, disp_ta... | [
"dissect",
"messages",
"from",
"a",
"raw",
"stream",
"data",
".",
"disp_table",
"[",
"type",
"]",
"should",
"be",
"a",
"callable",
"for",
"the",
"corresponding",
"MessageType",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/rpc.py#L70-L77 | [
"def",
"get_and_dispatch_messages",
"(",
"self",
",",
"data",
",",
"disp_table",
")",
":",
"self",
".",
"_unpacker",
".",
"feed",
"(",
"data",
")",
"for",
"m",
"in",
"self",
".",
"_unpacker",
":",
"self",
".",
"_dispatch_message",
"(",
"m",
",",
"disp_ta... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | EndPoint.send_request | Send a request | ryu/lib/rpc.py | def send_request(self, method, params):
"""Send a request
"""
msg, msgid = self._encoder.create_request(method, params)
self._send_message(msg)
self._pending_requests.add(msgid)
return msgid | def send_request(self, method, params):
"""Send a request
"""
msg, msgid = self._encoder.create_request(method, params)
self._send_message(msg)
self._pending_requests.add(msgid)
return msgid | [
"Send",
"a",
"request"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/rpc.py#L153-L159 | [
"def",
"send_request",
"(",
"self",
",",
"method",
",",
"params",
")",
":",
"msg",
",",
"msgid",
"=",
"self",
".",
"_encoder",
".",
"create_request",
"(",
"method",
",",
"params",
")",
"self",
".",
"_send_message",
"(",
"msg",
")",
"self",
".",
"_pendi... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | EndPoint.send_response | Send a response | ryu/lib/rpc.py | def send_response(self, msgid, error=None, result=None):
"""Send a response
"""
msg = self._encoder.create_response(msgid, error, result)
self._send_message(msg) | def send_response(self, msgid, error=None, result=None):
"""Send a response
"""
msg = self._encoder.create_response(msgid, error, result)
self._send_message(msg) | [
"Send",
"a",
"response"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/rpc.py#L161-L165 | [
"def",
"send_response",
"(",
"self",
",",
"msgid",
",",
"error",
"=",
"None",
",",
"result",
"=",
"None",
")",
":",
"msg",
"=",
"self",
".",
"_encoder",
".",
"create_response",
"(",
"msgid",
",",
"error",
",",
"result",
")",
"self",
".",
"_send_message... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | EndPoint.send_notification | Send a notification | ryu/lib/rpc.py | def send_notification(self, method, params):
"""Send a notification
"""
msg = self._encoder.create_notification(method, params)
self._send_message(msg) | def send_notification(self, method, params):
"""Send a notification
"""
msg = self._encoder.create_notification(method, params)
self._send_message(msg) | [
"Send",
"a",
"notification"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/rpc.py#L167-L171 | [
"def",
"send_notification",
"(",
"self",
",",
"method",
",",
"params",
")",
":",
"msg",
"=",
"self",
".",
"_encoder",
".",
"create_notification",
"(",
"method",
",",
"params",
")",
"self",
".",
"_send_message",
"(",
"msg",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | EndPoint.receive_messages | Try to receive some messages.
Received messages are put on the internal queues.
They can be retrieved using get_xxx() methods.
Returns True if there's something queued for get_xxx() methods. | ryu/lib/rpc.py | def receive_messages(self, all=False):
"""Try to receive some messages.
Received messages are put on the internal queues.
They can be retrieved using get_xxx() methods.
Returns True if there's something queued for get_xxx() methods.
"""
while all or self._incoming == 0:
... | def receive_messages(self, all=False):
"""Try to receive some messages.
Received messages are put on the internal queues.
They can be retrieved using get_xxx() methods.
Returns True if there's something queued for get_xxx() methods.
"""
while all or self._incoming == 0:
... | [
"Try",
"to",
"receive",
"some",
"messages",
".",
"Received",
"messages",
"are",
"put",
"on",
"the",
"internal",
"queues",
".",
"They",
"can",
"be",
"retrieved",
"using",
"get_xxx",
"()",
"methods",
".",
"Returns",
"True",
"if",
"there",
"s",
"something",
"... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/rpc.py#L173-L190 | [
"def",
"receive_messages",
"(",
"self",
",",
"all",
"=",
"False",
")",
":",
"while",
"all",
"or",
"self",
".",
"_incoming",
"==",
"0",
":",
"try",
":",
"packet",
"=",
"self",
".",
"_sock",
".",
"recv",
"(",
"4096",
")",
"# XXX the size is arbitrary",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Client.call | synchronous call.
send a request and wait for a response.
return a result. or raise RPCError exception if the peer
sends us an error. | ryu/lib/rpc.py | def call(self, method, params):
"""synchronous call.
send a request and wait for a response.
return a result. or raise RPCError exception if the peer
sends us an error.
"""
msgid = self._endpoint.send_request(method, params)
while True:
if not self._e... | def call(self, method, params):
"""synchronous call.
send a request and wait for a response.
return a result. or raise RPCError exception if the peer
sends us an error.
"""
msgid = self._endpoint.send_request(method, params)
while True:
if not self._e... | [
"synchronous",
"call",
".",
"send",
"a",
"request",
"and",
"wait",
"for",
"a",
"response",
".",
"return",
"a",
"result",
".",
"or",
"raise",
"RPCError",
"exception",
"if",
"the",
"peer",
"sends",
"us",
"an",
"error",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/rpc.py#L276-L293 | [
"def",
"call",
"(",
"self",
",",
"method",
",",
"params",
")",
":",
"msgid",
"=",
"self",
".",
"_endpoint",
".",
"send_request",
"(",
"method",
",",
"params",
")",
"while",
"True",
":",
"if",
"not",
"self",
".",
"_endpoint",
".",
"receive_messages",
"(... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Client.receive_notification | wait for the next incoming message.
intended to be used when we have nothing to send but want to receive
notifications. | ryu/lib/rpc.py | def receive_notification(self):
"""wait for the next incoming message.
intended to be used when we have nothing to send but want to receive
notifications.
"""
if not self._endpoint.receive_messages():
raise EOFError("EOF")
self._process_input_notification()
... | def receive_notification(self):
"""wait for the next incoming message.
intended to be used when we have nothing to send but want to receive
notifications.
"""
if not self._endpoint.receive_messages():
raise EOFError("EOF")
self._process_input_notification()
... | [
"wait",
"for",
"the",
"next",
"incoming",
"message",
".",
"intended",
"to",
"be",
"used",
"when",
"we",
"have",
"nothing",
"to",
"send",
"but",
"want",
"to",
"receive",
"notifications",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/rpc.py#L300-L308 | [
"def",
"receive_notification",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_endpoint",
".",
"receive_messages",
"(",
")",
":",
"raise",
"EOFError",
"(",
"\"EOF\"",
")",
"self",
".",
"_process_input_notification",
"(",
")",
"self",
".",
"_process_input_re... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LoopingCall.start | Start running pre-set function every interval seconds. | ryu/services/protocols/bgp/utils/evtlet.py | def start(self, interval, now=True):
"""Start running pre-set function every interval seconds.
"""
if interval < 0:
raise ValueError('interval must be >= 0')
if self._running:
self.stop()
self._running = True
self._interval = interval
if ... | def start(self, interval, now=True):
"""Start running pre-set function every interval seconds.
"""
if interval < 0:
raise ValueError('interval must be >= 0')
if self._running:
self.stop()
self._running = True
self._interval = interval
if ... | [
"Start",
"running",
"pre",
"-",
"set",
"function",
"every",
"interval",
"seconds",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/evtlet.py#L65-L79 | [
"def",
"start",
"(",
"self",
",",
"interval",
",",
"now",
"=",
"True",
")",
":",
"if",
"interval",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'interval must be >= 0'",
")",
"if",
"self",
".",
"_running",
":",
"self",
".",
"stop",
"(",
")",
"self",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LoopingCall.stop | Stop running scheduled function. | ryu/services/protocols/bgp/utils/evtlet.py | def stop(self):
"""Stop running scheduled function.
"""
self._running = False
if self._self_thread is not None:
self._self_thread.cancel()
self._self_thread = None | def stop(self):
"""Stop running scheduled function.
"""
self._running = False
if self._self_thread is not None:
self._self_thread.cancel()
self._self_thread = None | [
"Stop",
"running",
"scheduled",
"function",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/evtlet.py#L81-L87 | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"_running",
"=",
"False",
"if",
"self",
".",
"_self_thread",
"is",
"not",
"None",
":",
"self",
".",
"_self_thread",
".",
"cancel",
"(",
")",
"self",
".",
"_self_thread",
"=",
"None"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LoopingCall.reset | Skip the next iteration and reset timer. | ryu/services/protocols/bgp/utils/evtlet.py | def reset(self):
"""Skip the next iteration and reset timer.
"""
if self._self_thread is not None:
# Cancel currently scheduled call
self._self_thread.cancel()
self._self_thread = None
# Schedule a new call
self._self_thread = hub.spawn_after(s... | def reset(self):
"""Skip the next iteration and reset timer.
"""
if self._self_thread is not None:
# Cancel currently scheduled call
self._self_thread.cancel()
self._self_thread = None
# Schedule a new call
self._self_thread = hub.spawn_after(s... | [
"Skip",
"the",
"next",
"iteration",
"and",
"reset",
"timer",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/evtlet.py#L89-L97 | [
"def",
"reset",
"(",
"self",
")",
":",
"if",
"self",
".",
"_self_thread",
"is",
"not",
"None",
":",
"# Cancel currently scheduled call",
"self",
".",
"_self_thread",
".",
"cancel",
"(",
")",
"self",
".",
"_self_thread",
"=",
"None",
"# Schedule a new call",
"s... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | compute_optional_conf | Returns *conf_name* settings if provided in *all_config*, else returns
*default_value*.
Validates *conf_name* value if provided. | ryu/services/protocols/bgp/rtconf/base.py | def compute_optional_conf(conf_name, default_value, **all_config):
"""Returns *conf_name* settings if provided in *all_config*, else returns
*default_value*.
Validates *conf_name* value if provided.
"""
conf_value = all_config.get(conf_name)
if conf_value is not None:
# Validate config... | def compute_optional_conf(conf_name, default_value, **all_config):
"""Returns *conf_name* settings if provided in *all_config*, else returns
*default_value*.
Validates *conf_name* value if provided.
"""
conf_value = all_config.get(conf_name)
if conf_value is not None:
# Validate config... | [
"Returns",
"*",
"conf_name",
"*",
"settings",
"if",
"provided",
"in",
"*",
"all_config",
"*",
"else",
"returns",
"*",
"default_value",
"*",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/rtconf/base.py#L781-L793 | [
"def",
"compute_optional_conf",
"(",
"conf_name",
",",
"default_value",
",",
"*",
"*",
"all_config",
")",
":",
"conf_value",
"=",
"all_config",
".",
"get",
"(",
"conf_name",
")",
"if",
"conf_value",
"is",
"not",
"None",
":",
"# Validate configuration value.",
"c... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | bfd.pack | Encode a BFD Control packet without authentication section. | ryu/lib/packet/bfd.py | def pack(self):
"""
Encode a BFD Control packet without authentication section.
"""
diag = (self.ver << 5) + self.diag
flags = (self.state << 6) + self.flags
length = len(self)
return struct.pack(self._PACK_STR, diag, flags, self.detect_mult,
... | def pack(self):
"""
Encode a BFD Control packet without authentication section.
"""
diag = (self.ver << 5) + self.diag
flags = (self.state << 6) + self.flags
length = len(self)
return struct.pack(self._PACK_STR, diag, flags, self.detect_mult,
... | [
"Encode",
"a",
"BFD",
"Control",
"packet",
"without",
"authentication",
"section",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/bfd.py#L262-L274 | [
"def",
"pack",
"(",
"self",
")",
":",
"diag",
"=",
"(",
"self",
".",
"ver",
"<<",
"5",
")",
"+",
"self",
".",
"diag",
"flags",
"=",
"(",
"self",
".",
"state",
"<<",
"6",
")",
"+",
"self",
".",
"flags",
"length",
"=",
"len",
"(",
"self",
")",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | bfd.authenticate | Authenticate this packet.
Returns a boolean indicates whether the packet can be authenticated
or not.
Returns ``False`` if the Authentication Present (A) is not set in the
flag of this packet.
Returns ``False`` if the Authentication Section for this packet is not
prese... | ryu/lib/packet/bfd.py | def authenticate(self, *args, **kwargs):
"""Authenticate this packet.
Returns a boolean indicates whether the packet can be authenticated
or not.
Returns ``False`` if the Authentication Present (A) is not set in the
flag of this packet.
Returns ``False`` if the Authent... | def authenticate(self, *args, **kwargs):
"""Authenticate this packet.
Returns a boolean indicates whether the packet can be authenticated
or not.
Returns ``False`` if the Authentication Present (A) is not set in the
flag of this packet.
Returns ``False`` if the Authent... | [
"Authenticate",
"this",
"packet",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/bfd.py#L276-L295 | [
"def",
"authenticate",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"flags",
"&",
"BFD_FLAG_AUTH_PRESENT",
"or",
"not",
"issubclass",
"(",
"self",
".",
"auth_cls",
".",
"__class__",
",",
"BFDAuth",
")",
":... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDAuth.parser_hdr | Parser for common part of authentication section. | ryu/lib/packet/bfd.py | def parser_hdr(cls, buf):
"""
Parser for common part of authentication section.
"""
return struct.unpack_from(cls._PACK_HDR_STR,
buf[:cls._PACK_HDR_STR_LEN]) | def parser_hdr(cls, buf):
"""
Parser for common part of authentication section.
"""
return struct.unpack_from(cls._PACK_HDR_STR,
buf[:cls._PACK_HDR_STR_LEN]) | [
"Parser",
"for",
"common",
"part",
"of",
"authentication",
"section",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/bfd.py#L345-L350 | [
"def",
"parser_hdr",
"(",
"cls",
",",
"buf",
")",
":",
"return",
"struct",
".",
"unpack_from",
"(",
"cls",
".",
"_PACK_HDR_STR",
",",
"buf",
"[",
":",
"cls",
".",
"_PACK_HDR_STR_LEN",
"]",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDAuth.serialize_hdr | Serialization function for common part of authentication section. | ryu/lib/packet/bfd.py | def serialize_hdr(self):
"""
Serialization function for common part of authentication section.
"""
return struct.pack(self._PACK_HDR_STR, self.auth_type, self.auth_len) | def serialize_hdr(self):
"""
Serialization function for common part of authentication section.
"""
return struct.pack(self._PACK_HDR_STR, self.auth_type, self.auth_len) | [
"Serialization",
"function",
"for",
"common",
"part",
"of",
"authentication",
"section",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/bfd.py#L352-L356 | [
"def",
"serialize_hdr",
"(",
"self",
")",
":",
"return",
"struct",
".",
"pack",
"(",
"self",
".",
"_PACK_HDR_STR",
",",
"self",
".",
"auth_type",
",",
"self",
".",
"auth_len",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _register_parser | class decorator to register msg parser | ryu/ofproto/ofproto_v1_0_parser.py | def _register_parser(cls):
'''class decorator to register msg parser'''
assert cls.cls_msg_type is not None
assert cls.cls_msg_type not in _MSG_PARSERS
_MSG_PARSERS[cls.cls_msg_type] = cls.parser
return cls | def _register_parser(cls):
'''class decorator to register msg parser'''
assert cls.cls_msg_type is not None
assert cls.cls_msg_type not in _MSG_PARSERS
_MSG_PARSERS[cls.cls_msg_type] = cls.parser
return cls | [
"class",
"decorator",
"to",
"register",
"msg",
"parser"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_0_parser.py#L54-L59 | [
"def",
"_register_parser",
"(",
"cls",
")",
":",
"assert",
"cls",
".",
"cls_msg_type",
"is",
"not",
"None",
"assert",
"cls",
".",
"cls_msg_type",
"not",
"in",
"_MSG_PARSERS",
"_MSG_PARSERS",
"[",
"cls",
".",
"cls_msg_type",
"]",
"=",
"cls",
".",
"parser",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | obj_python_attrs | iterate object attributes for stringify purposes | ryu/lib/stringify.py | def obj_python_attrs(msg_):
"""iterate object attributes for stringify purposes
"""
# a special case for namedtuple which seems widely used in
# ofp parser implementations.
if hasattr(msg_, '_fields'):
for k in msg_._fields:
yield(k, getattr(msg_, k))
return
base = g... | def obj_python_attrs(msg_):
"""iterate object attributes for stringify purposes
"""
# a special case for namedtuple which seems widely used in
# ofp parser implementations.
if hasattr(msg_, '_fields'):
for k in msg_._fields:
yield(k, getattr(msg_, k))
return
base = g... | [
"iterate",
"object",
"attributes",
"for",
"stringify",
"purposes"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stringify.py#L369-L392 | [
"def",
"obj_python_attrs",
"(",
"msg_",
")",
":",
"# a special case for namedtuple which seems widely used in",
"# ofp parser implementations.",
"if",
"hasattr",
"(",
"msg_",
",",
"'_fields'",
")",
":",
"for",
"k",
"in",
"msg_",
".",
"_fields",
":",
"yield",
"(",
"k... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | obj_attrs | similar to obj_python_attrs() but deals with python reserved keywords | ryu/lib/stringify.py | def obj_attrs(msg_):
"""similar to obj_python_attrs() but deals with python reserved keywords
"""
if isinstance(msg_, StringifyMixin):
itr = msg_.stringify_attrs()
else:
# probably called by msg_str_attr
itr = obj_python_attrs(msg_)
for k, v in itr:
if k.endswith('_'... | def obj_attrs(msg_):
"""similar to obj_python_attrs() but deals with python reserved keywords
"""
if isinstance(msg_, StringifyMixin):
itr = msg_.stringify_attrs()
else:
# probably called by msg_str_attr
itr = obj_python_attrs(msg_)
for k, v in itr:
if k.endswith('_'... | [
"similar",
"to",
"obj_python_attrs",
"()",
"but",
"deals",
"with",
"python",
"reserved",
"keywords"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stringify.py#L395-L409 | [
"def",
"obj_attrs",
"(",
"msg_",
")",
":",
"if",
"isinstance",
"(",
"msg_",
",",
"StringifyMixin",
")",
":",
"itr",
"=",
"msg_",
".",
"stringify_attrs",
"(",
")",
"else",
":",
"# probably called by msg_str_attr",
"itr",
"=",
"obj_python_attrs",
"(",
"msg_",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | StringifyMixin.to_jsondict | This method returns a JSON style dict to describe this object.
The returned dict is compatible with json.dumps() and json.loads().
Suppose ClassName object inherits StringifyMixin.
For an object like the following::
ClassName(Param1=100, Param2=200)
this method would prod... | ryu/lib/stringify.py | def to_jsondict(self, encode_string=base64.b64encode):
"""
This method returns a JSON style dict to describe this object.
The returned dict is compatible with json.dumps() and json.loads().
Suppose ClassName object inherits StringifyMixin.
For an object like the following::
... | def to_jsondict(self, encode_string=base64.b64encode):
"""
This method returns a JSON style dict to describe this object.
The returned dict is compatible with json.dumps() and json.loads().
Suppose ClassName object inherits StringifyMixin.
For an object like the following::
... | [
"This",
"method",
"returns",
"a",
"JSON",
"style",
"dict",
"to",
"describe",
"this",
"object",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stringify.py#L232-L265 | [
"def",
"to_jsondict",
"(",
"self",
",",
"encode_string",
"=",
"base64",
".",
"b64encode",
")",
":",
"dict_",
"=",
"{",
"}",
"encode",
"=",
"lambda",
"key",
",",
"val",
":",
"self",
".",
"_encode_value",
"(",
"key",
",",
"val",
",",
"encode_string",
")"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | StringifyMixin.from_jsondict | r"""Create an instance from a JSON style dict.
Instantiate this class with parameters specified by the dict.
This method takes the following arguments.
.. tabularcolumns:: |l|L|
=============== =====================================================
Argument Descrpition
... | ryu/lib/stringify.py | def from_jsondict(cls, dict_, decode_string=base64.b64decode,
**additional_args):
r"""Create an instance from a JSON style dict.
Instantiate this class with parameters specified by the dict.
This method takes the following arguments.
.. tabularcolumns:: |l|L|
... | def from_jsondict(cls, dict_, decode_string=base64.b64decode,
**additional_args):
r"""Create an instance from a JSON style dict.
Instantiate this class with parameters specified by the dict.
This method takes the following arguments.
.. tabularcolumns:: |l|L|
... | [
"r",
"Create",
"an",
"instance",
"from",
"a",
"JSON",
"style",
"dict",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/stringify.py#L328-L361 | [
"def",
"from_jsondict",
"(",
"cls",
",",
"dict_",
",",
"decode_string",
"=",
"base64",
".",
"b64decode",
",",
"*",
"*",
"additional_args",
")",
":",
"decode",
"=",
"lambda",
"k",
",",
"x",
":",
"cls",
".",
"_decode_value",
"(",
"k",
",",
"x",
",",
"d... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | transact_block | Emulate jsonrpc.Connection.transact_block without blocking eventlet. | ryu/services/protocols/ovsdb/client.py | def transact_block(request, connection):
"""Emulate jsonrpc.Connection.transact_block without blocking eventlet.
"""
error = connection.send(request)
reply = None
if error:
return error, reply
ovs_poller = poller.Poller()
while not error:
ovs_poller.immediate_wake()
... | def transact_block(request, connection):
"""Emulate jsonrpc.Connection.transact_block without blocking eventlet.
"""
error = connection.send(request)
reply = None
if error:
return error, reply
ovs_poller = poller.Poller()
while not error:
ovs_poller.immediate_wake()
... | [
"Emulate",
"jsonrpc",
".",
"Connection",
".",
"transact_block",
"without",
"blocking",
"eventlet",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/ovsdb/client.py#L62-L92 | [
"def",
"transact_block",
"(",
"request",
",",
"connection",
")",
":",
"error",
"=",
"connection",
".",
"send",
"(",
"request",
")",
"reply",
"=",
"None",
"if",
"error",
":",
"return",
"error",
",",
"reply",
"ovs_poller",
"=",
"poller",
".",
"Poller",
"("... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _filter_schemas | Wrapper method for _filter_schema to filter multiple schemas. | ryu/services/protocols/ovsdb/client.py | def _filter_schemas(schemas, schema_tables, exclude_table_columns):
"""Wrapper method for _filter_schema to filter multiple schemas."""
return [_filter_schema(s, schema_tables, exclude_table_columns)
for s in schemas] | def _filter_schemas(schemas, schema_tables, exclude_table_columns):
"""Wrapper method for _filter_schema to filter multiple schemas."""
return [_filter_schema(s, schema_tables, exclude_table_columns)
for s in schemas] | [
"Wrapper",
"method",
"for",
"_filter_schema",
"to",
"filter",
"multiple",
"schemas",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/ovsdb/client.py#L136-L139 | [
"def",
"_filter_schemas",
"(",
"schemas",
",",
"schema_tables",
",",
"exclude_table_columns",
")",
":",
"return",
"[",
"_filter_schema",
"(",
"s",
",",
"schema_tables",
",",
"exclude_table_columns",
")",
"for",
"s",
"in",
"schemas",
"]"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _filter_schema | Filters a schema to only include the specified tables in the
schema_tables parameter. This will also filter out any colums for
included tables that reference tables that are not included
in the schema_tables parameter
:param schema: Schema dict to be filtered
:param schema_tables: List of... | ryu/services/protocols/ovsdb/client.py | def _filter_schema(schema, schema_tables, exclude_table_columns):
"""Filters a schema to only include the specified tables in the
schema_tables parameter. This will also filter out any colums for
included tables that reference tables that are not included
in the schema_tables parameter
:p... | def _filter_schema(schema, schema_tables, exclude_table_columns):
"""Filters a schema to only include the specified tables in the
schema_tables parameter. This will also filter out any colums for
included tables that reference tables that are not included
in the schema_tables parameter
:p... | [
"Filters",
"a",
"schema",
"to",
"only",
"include",
"the",
"specified",
"tables",
"in",
"the",
"schema_tables",
"parameter",
".",
"This",
"will",
"also",
"filter",
"out",
"any",
"colums",
"for",
"included",
"tables",
"that",
"reference",
"tables",
"that",
"are"... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/ovsdb/client.py#L142-L195 | [
"def",
"_filter_schema",
"(",
"schema",
",",
"schema_tables",
",",
"exclude_table_columns",
")",
":",
"tables",
"=",
"{",
"}",
"for",
"tbl_name",
",",
"tbl_data",
"in",
"schema",
"[",
"'tables'",
"]",
".",
"items",
"(",
")",
":",
"if",
"not",
"schema_table... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ZClient.send_msg | Sends Zebra message.
:param msg: Instance of py:class: `ryu.lib.packet.zebra.ZebraMessage`.
:return: Serialized msg if succeeded, otherwise None. | ryu/services/protocols/zebra/server/zserver.py | def send_msg(self, msg):
"""
Sends Zebra message.
:param msg: Instance of py:class: `ryu.lib.packet.zebra.ZebraMessage`.
:return: Serialized msg if succeeded, otherwise None.
"""
if not self.is_active:
self.logger.debug(
'Cannot send message: ... | def send_msg(self, msg):
"""
Sends Zebra message.
:param msg: Instance of py:class: `ryu.lib.packet.zebra.ZebraMessage`.
:return: Serialized msg if succeeded, otherwise None.
"""
if not self.is_active:
self.logger.debug(
'Cannot send message: ... | [
"Sends",
"Zebra",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/server/zserver.py#L134-L156 | [
"def",
"send_msg",
"(",
"self",
",",
"msg",
")",
":",
"if",
"not",
"self",
".",
"is_active",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Cannot send message: Already deactivated: msg=%s'",
",",
"msg",
")",
"return",
"elif",
"not",
"self",
".",
"send_q",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.on_peer_down | Peer down handler.
Cleans up the paths in global tables that was received from this peer. | ryu/services/protocols/bgp/core_managers/peer_manager.py | def on_peer_down(self, peer):
"""Peer down handler.
Cleans up the paths in global tables that was received from this peer.
"""
LOG.debug('Cleaning obsolete paths whose source/version: %s/%s',
peer.ip_address, peer.version_num)
# Launch clean-up for each global ... | def on_peer_down(self, peer):
"""Peer down handler.
Cleans up the paths in global tables that was received from this peer.
"""
LOG.debug('Cleaning obsolete paths whose source/version: %s/%s',
peer.ip_address, peer.version_num)
# Launch clean-up for each global ... | [
"Peer",
"down",
"handler",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L56-L64 | [
"def",
"on_peer_down",
"(",
"self",
",",
"peer",
")",
":",
"LOG",
".",
"debug",
"(",
"'Cleaning obsolete paths whose source/version: %s/%s'",
",",
"peer",
".",
"ip_address",
",",
"peer",
".",
"version_num",
")",
"# Launch clean-up for each global tables.",
"self",
"."... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.get_peers_in_established | Returns list of peers in established state. | ryu/services/protocols/bgp/core_managers/peer_manager.py | def get_peers_in_established(self):
"""Returns list of peers in established state."""
est_peers = []
for peer in self._peers.values():
if peer.in_established:
est_peers.append(peer)
return est_peers | def get_peers_in_established(self):
"""Returns list of peers in established state."""
est_peers = []
for peer in self._peers.values():
if peer.in_established:
est_peers.append(peer)
return est_peers | [
"Returns",
"list",
"of",
"peers",
"in",
"established",
"state",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L77-L83 | [
"def",
"get_peers_in_established",
"(",
"self",
")",
":",
"est_peers",
"=",
"[",
"]",
"for",
"peer",
"in",
"self",
".",
"_peers",
".",
"values",
"(",
")",
":",
"if",
"peer",
".",
"in_established",
":",
"est_peers",
".",
"append",
"(",
"peer",
")",
"ret... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.resend_sent | For given `peer` re-send sent paths.
Parameters:
- `route-family`: (RouteFamily) of the sent paths to re-send
- `peer`: (Peer) peer for which we need to re-send sent paths | ryu/services/protocols/bgp/core_managers/peer_manager.py | def resend_sent(self, route_family, peer):
"""For given `peer` re-send sent paths.
Parameters:
- `route-family`: (RouteFamily) of the sent paths to re-send
- `peer`: (Peer) peer for which we need to re-send sent paths
"""
if peer not in self._peers.values():
... | def resend_sent(self, route_family, peer):
"""For given `peer` re-send sent paths.
Parameters:
- `route-family`: (RouteFamily) of the sent paths to re-send
- `peer`: (Peer) peer for which we need to re-send sent paths
"""
if peer not in self._peers.values():
... | [
"For",
"given",
"peer",
"re",
"-",
"send",
"sent",
"paths",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L85-L130 | [
"def",
"resend_sent",
"(",
"self",
",",
"route_family",
",",
"peer",
")",
":",
"if",
"peer",
"not",
"in",
"self",
".",
"_peers",
".",
"values",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'Could not find given peer (%s)'",
"%",
"peer",
")",
"if",
"route_fa... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.req_rr_to_non_rtc_peers | Makes refresh request to all peers for given address family.
Skips making request to peer that have valid RTC capability. | ryu/services/protocols/bgp/core_managers/peer_manager.py | def req_rr_to_non_rtc_peers(self, route_family):
"""Makes refresh request to all peers for given address family.
Skips making request to peer that have valid RTC capability.
"""
assert route_family != RF_RTC_UC
for peer in self._peers.values():
# First check if peer ... | def req_rr_to_non_rtc_peers(self, route_family):
"""Makes refresh request to all peers for given address family.
Skips making request to peer that have valid RTC capability.
"""
assert route_family != RF_RTC_UC
for peer in self._peers.values():
# First check if peer ... | [
"Makes",
"refresh",
"request",
"to",
"all",
"peers",
"for",
"given",
"address",
"family",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L132-L146 | [
"def",
"req_rr_to_non_rtc_peers",
"(",
"self",
",",
"route_family",
")",
":",
"assert",
"route_family",
"!=",
"RF_RTC_UC",
"for",
"peer",
"in",
"self",
".",
"_peers",
".",
"values",
"(",
")",
":",
"# First check if peer is in established state",
"if",
"(",
"peer",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.make_route_refresh_request | Request route-refresh for peer with `peer_ip` for given
`route_families`.
Will make route-refresh request for a given `route_family` only if such
capability is supported and if peer is in ESTABLISHED state. Else, such
requests are ignored. Raises appropriate error in other cases. If
... | ryu/services/protocols/bgp/core_managers/peer_manager.py | def make_route_refresh_request(self, peer_ip, *route_families):
"""Request route-refresh for peer with `peer_ip` for given
`route_families`.
Will make route-refresh request for a given `route_family` only if such
capability is supported and if peer is in ESTABLISHED state. Else, such
... | def make_route_refresh_request(self, peer_ip, *route_families):
"""Request route-refresh for peer with `peer_ip` for given
`route_families`.
Will make route-refresh request for a given `route_family` only if such
capability is supported and if peer is in ESTABLISHED state. Else, such
... | [
"Request",
"route",
"-",
"refresh",
"for",
"peer",
"with",
"peer_ip",
"for",
"given",
"route_families",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L148-L180 | [
"def",
"make_route_refresh_request",
"(",
"self",
",",
"peer_ip",
",",
"*",
"route_families",
")",
":",
"LOG",
".",
"debug",
"(",
"'Route refresh requested for peer %s and route families %s'",
",",
"peer_ip",
",",
"route_families",
")",
"if",
"not",
"SUPPORTED_GLOBAL_RF... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.comm_all_rt_nlris | Shares/communicates current best rt_nlri paths with this peers.
Can be used to send initial updates after we have established session
with `peer` with which RTC capability is valid. Takes into account
peers RTC_AS setting and filters all RT NLRIs whose origin AS do not
match this settin... | ryu/services/protocols/bgp/core_managers/peer_manager.py | def comm_all_rt_nlris(self, peer):
"""Shares/communicates current best rt_nlri paths with this peers.
Can be used to send initial updates after we have established session
with `peer` with which RTC capability is valid. Takes into account
peers RTC_AS setting and filters all RT NLRIs wh... | def comm_all_rt_nlris(self, peer):
"""Shares/communicates current best rt_nlri paths with this peers.
Can be used to send initial updates after we have established session
with `peer` with which RTC capability is valid. Takes into account
peers RTC_AS setting and filters all RT NLRIs wh... | [
"Shares",
"/",
"communicates",
"current",
"best",
"rt_nlri",
"paths",
"with",
"this",
"peers",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L182-L215 | [
"def",
"comm_all_rt_nlris",
"(",
"self",
",",
"peer",
")",
":",
"# First check if for this peer mpbgp-rtc is valid.",
"if",
"not",
"peer",
".",
"is_mbgp_cap_valid",
"(",
"RF_RTC_UC",
")",
":",
"return",
"neigh_conf",
"=",
"self",
".",
"_neighbors_conf",
".",
"get_ne... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.comm_all_best_paths | Shares/communicates current best paths with this peers.
Can be used to send initial updates after we have established session
with `peer`. | ryu/services/protocols/bgp/core_managers/peer_manager.py | def comm_all_best_paths(self, peer):
"""Shares/communicates current best paths with this peers.
Can be used to send initial updates after we have established session
with `peer`.
"""
LOG.debug('Communicating current best path for all afi/safi except'
' 1/132')
... | def comm_all_best_paths(self, peer):
"""Shares/communicates current best paths with this peers.
Can be used to send initial updates after we have established session
with `peer`.
"""
LOG.debug('Communicating current best path for all afi/safi except'
' 1/132')
... | [
"Shares",
"/",
"communicates",
"current",
"best",
"paths",
"with",
"this",
"peers",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L217-L232 | [
"def",
"comm_all_best_paths",
"(",
"self",
",",
"peer",
")",
":",
"LOG",
".",
"debug",
"(",
"'Communicating current best path for all afi/safi except'",
"' 1/132'",
")",
"# We will enqueue best path from all global destination.",
"for",
"route_family",
",",
"table",
"in",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager.comm_new_best_to_bgp_peers | Communicates/enqueues given best path to be sent to all qualifying
bgp peers.
If this path came from iBGP peers, it is not sent to other iBGP peers.
If this path has community-attribute, and if settings for recognize-
well-know attributes is set, we do as per [RFC1997], and queue outgoi... | ryu/services/protocols/bgp/core_managers/peer_manager.py | def comm_new_best_to_bgp_peers(self, new_best_path):
"""Communicates/enqueues given best path to be sent to all qualifying
bgp peers.
If this path came from iBGP peers, it is not sent to other iBGP peers.
If this path has community-attribute, and if settings for recognize-
well-... | def comm_new_best_to_bgp_peers(self, new_best_path):
"""Communicates/enqueues given best path to be sent to all qualifying
bgp peers.
If this path came from iBGP peers, it is not sent to other iBGP peers.
If this path has community-attribute, and if settings for recognize-
well-... | [
"Communicates",
"/",
"enqueues",
"given",
"best",
"path",
"to",
"be",
"sent",
"to",
"all",
"qualifying",
"bgp",
"peers",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L234-L264 | [
"def",
"comm_new_best_to_bgp_peers",
"(",
"self",
",",
"new_best_path",
")",
":",
"# Filter based on standard community",
"# If new best path has community attribute, it should be taken into",
"# account when sending UPDATE to peers.",
"comm_attr",
"=",
"new_best_path",
".",
"get_pattr... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | PeerManager._collect_peers_of_interest | Collect all peers that qualify for sharing a path with given RTs. | ryu/services/protocols/bgp/core_managers/peer_manager.py | def _collect_peers_of_interest(self, new_best_path):
"""Collect all peers that qualify for sharing a path with given RTs.
"""
path_rts = new_best_path.get_rts()
qualified_peers = set(self._peers.values())
# Filter out peers based on RTC_AS setting if path is for RT_NLRI
... | def _collect_peers_of_interest(self, new_best_path):
"""Collect all peers that qualify for sharing a path with given RTs.
"""
path_rts = new_best_path.get_rts()
qualified_peers = set(self._peers.values())
# Filter out peers based on RTC_AS setting if path is for RT_NLRI
... | [
"Collect",
"all",
"peers",
"that",
"qualify",
"for",
"sharing",
"a",
"path",
"with",
"given",
"RTs",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/peer_manager.py#L266-L299 | [
"def",
"_collect_peers_of_interest",
"(",
"self",
",",
"new_best_path",
")",
":",
"path_rts",
"=",
"new_best_path",
".",
"get_rts",
"(",
")",
"qualified_peers",
"=",
"set",
"(",
"self",
".",
"_peers",
".",
"values",
"(",
")",
")",
"# Filter out peers based on RT... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _flatten | Generator function going deep in tree-like structures
(i.e. dicts in dicts or lists in lists etc.) and returning all elements as
a flat list. It's flattening only lists and dicts which are subclasses of
RdyToFlattenCollection. Regular lists and dicts are treated as a
single items.
:param l: some it... | ryu/services/protocols/bgp/operator/views/base.py | def _flatten(l, max_level=10):
"""Generator function going deep in tree-like structures
(i.e. dicts in dicts or lists in lists etc.) and returning all elements as
a flat list. It's flattening only lists and dicts which are subclasses of
RdyToFlattenCollection. Regular lists and dicts are treated as a
... | def _flatten(l, max_level=10):
"""Generator function going deep in tree-like structures
(i.e. dicts in dicts or lists in lists etc.) and returning all elements as
a flat list. It's flattening only lists and dicts which are subclasses of
RdyToFlattenCollection. Regular lists and dicts are treated as a
... | [
"Generator",
"function",
"going",
"deep",
"in",
"tree",
"-",
"like",
"structures",
"(",
"i",
".",
"e",
".",
"dicts",
"in",
"dicts",
"or",
"lists",
"in",
"lists",
"etc",
".",
")",
"and",
"returning",
"all",
"elements",
"as",
"a",
"flat",
"list",
".",
... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/operator/views/base.py#L254-L273 | [
"def",
"_flatten",
"(",
"l",
",",
"max_level",
"=",
"10",
")",
":",
"if",
"max_level",
">=",
"0",
":",
"_iter",
"=",
"l",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"l",
",",
"dict",
")",
"else",
"l",
"for",
"el",
"in",
"_iter",
":",
"if... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _create_prefix_notification | Constructs prefix notification with data from given outgoing message.
Given RPC session is used to create RPC notification message. | ryu/services/protocols/bgp/net_ctrl.py | def _create_prefix_notification(outgoing_msg, rpc_session):
"""Constructs prefix notification with data from given outgoing message.
Given RPC session is used to create RPC notification message.
"""
assert outgoing_msg
path = outgoing_msg.path
assert path
vpn_nlri = path.nlri
assert pa... | def _create_prefix_notification(outgoing_msg, rpc_session):
"""Constructs prefix notification with data from given outgoing message.
Given RPC session is used to create RPC notification message.
"""
assert outgoing_msg
path = outgoing_msg.path
assert path
vpn_nlri = path.nlri
assert pa... | [
"Constructs",
"prefix",
"notification",
"with",
"data",
"from",
"given",
"outgoing",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/net_ctrl.py#L267-L312 | [
"def",
"_create_prefix_notification",
"(",
"outgoing_msg",
",",
"rpc_session",
")",
":",
"assert",
"outgoing_msg",
"path",
"=",
"outgoing_msg",
".",
"path",
"assert",
"path",
"vpn_nlri",
"=",
"path",
".",
"nlri",
"assert",
"path",
".",
"source",
"is",
"not",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _validate_rpc_port | Validates give port for use as rpc server port. | ryu/services/protocols/bgp/net_ctrl.py | def _validate_rpc_port(port):
"""Validates give port for use as rpc server port.
"""
if not port:
raise NetworkControllerError(desc='Invalid rpc port number.')
if isinstance(port, str):
port = int(port)
if port <= 0:
raise NetworkControllerError(desc='Invalid rpc port number... | def _validate_rpc_port(port):
"""Validates give port for use as rpc server port.
"""
if not port:
raise NetworkControllerError(desc='Invalid rpc port number.')
if isinstance(port, str):
port = int(port)
if port <= 0:
raise NetworkControllerError(desc='Invalid rpc port number... | [
"Validates",
"give",
"port",
"for",
"use",
"as",
"rpc",
"server",
"port",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/net_ctrl.py#L323-L333 | [
"def",
"_validate_rpc_port",
"(",
"port",
")",
":",
"if",
"not",
"port",
":",
"raise",
"NetworkControllerError",
"(",
"desc",
"=",
"'Invalid rpc port number.'",
")",
"if",
"isinstance",
"(",
"port",
",",
"str",
")",
":",
"port",
"=",
"int",
"(",
"port",
")... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RpcSession._process_outgoing_msg | For every message we construct a corresponding RPC message to be
sent over the given socket inside given RPC session.
This function should be launched in a new green thread as
it loops forever. | ryu/services/protocols/bgp/net_ctrl.py | def _process_outgoing_msg(self, sink_iter):
"""For every message we construct a corresponding RPC message to be
sent over the given socket inside given RPC session.
This function should be launched in a new green thread as
it loops forever.
"""
LOG.debug('NetworkControll... | def _process_outgoing_msg(self, sink_iter):
"""For every message we construct a corresponding RPC message to be
sent over the given socket inside given RPC session.
This function should be launched in a new green thread as
it loops forever.
"""
LOG.debug('NetworkControll... | [
"For",
"every",
"message",
"we",
"construct",
"a",
"corresponding",
"RPC",
"message",
"to",
"be",
"sent",
"over",
"the",
"given",
"socket",
"inside",
"given",
"RPC",
"session",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/net_ctrl.py#L211-L242 | [
"def",
"_process_outgoing_msg",
"(",
"self",
",",
"sink_iter",
")",
":",
"LOG",
".",
"debug",
"(",
"'NetworkController processing outgoing request list.'",
")",
"# TODO(PH): We should try not to sent routes from bgp peer that is not",
"# in established state.",
"from",
"ryu",
"."... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _NetworkController._run | Runs RPC server.
Wait for peer to connect and start rpc session with it.
For every connection we start and new rpc session. | ryu/services/protocols/bgp/net_ctrl.py | def _run(self, *args, **kwargs):
"""Runs RPC server.
Wait for peer to connect and start rpc session with it.
For every connection we start and new rpc session.
"""
apgw_rpc_bind_ip = _validate_rpc_ip(kwargs.pop(NC_RPC_BIND_IP))
apgw_rpc_bind_port = _validate_rpc_port(kwa... | def _run(self, *args, **kwargs):
"""Runs RPC server.
Wait for peer to connect and start rpc session with it.
For every connection we start and new rpc session.
"""
apgw_rpc_bind_ip = _validate_rpc_ip(kwargs.pop(NC_RPC_BIND_IP))
apgw_rpc_bind_port = _validate_rpc_port(kwa... | [
"Runs",
"RPC",
"server",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/net_ctrl.py#L353-L368 | [
"def",
"_run",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"apgw_rpc_bind_ip",
"=",
"_validate_rpc_ip",
"(",
"kwargs",
".",
"pop",
"(",
"NC_RPC_BIND_IP",
")",
")",
"apgw_rpc_bind_port",
"=",
"_validate_rpc_port",
"(",
"kwargs",
".",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _NetworkController._start_rpc_session | Starts a new RPC session with given connection. | ryu/services/protocols/bgp/net_ctrl.py | def _start_rpc_session(self, sock):
"""Starts a new RPC session with given connection.
"""
session_name = RpcSession.NAME_FMT % str(sock.getpeername())
self._stop_child_activities(session_name)
rpc_session = RpcSession(sock, self)
self._spawn_activity(rpc_session) | def _start_rpc_session(self, sock):
"""Starts a new RPC session with given connection.
"""
session_name = RpcSession.NAME_FMT % str(sock.getpeername())
self._stop_child_activities(session_name)
rpc_session = RpcSession(sock, self)
self._spawn_activity(rpc_session) | [
"Starts",
"a",
"new",
"RPC",
"session",
"with",
"given",
"connection",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/net_ctrl.py#L370-L377 | [
"def",
"_start_rpc_session",
"(",
"self",
",",
"sock",
")",
":",
"session_name",
"=",
"RpcSession",
".",
"NAME_FMT",
"%",
"str",
"(",
"sock",
".",
"getpeername",
"(",
")",
")",
"self",
".",
"_stop_child_activities",
"(",
"session_name",
")",
"rpc_session",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | notification_factory | Returns a `Notification` message corresponding to given codes.
Parameters:
- `code`: (int) BGP error code
- `subcode`: (int) BGP error sub-code | ryu/services/protocols/bgp/speaker.py | def notification_factory(code, subcode):
"""Returns a `Notification` message corresponding to given codes.
Parameters:
- `code`: (int) BGP error code
- `subcode`: (int) BGP error sub-code
"""
notification = BGPNotification(code, subcode)
if not notification.reason:
raise ValueError(... | def notification_factory(code, subcode):
"""Returns a `Notification` message corresponding to given codes.
Parameters:
- `code`: (int) BGP error code
- `subcode`: (int) BGP error sub-code
"""
notification = BGPNotification(code, subcode)
if not notification.reason:
raise ValueError(... | [
"Returns",
"a",
"Notification",
"message",
"corresponding",
"to",
"given",
"codes",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L73-L84 | [
"def",
"notification_factory",
"(",
"code",
",",
"subcode",
")",
":",
"notification",
"=",
"BGPNotification",
"(",
"code",
",",
"subcode",
")",
"if",
"not",
"notification",
".",
"reason",
":",
"raise",
"ValueError",
"(",
"'Invalid code/sub-code.'",
")",
"return"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol.is_local_router_id_greater | Compares *True* if local router id is greater when compared to peer
bgp id.
Should only be called after protocol has reached OpenConfirm state. | ryu/services/protocols/bgp/speaker.py | def is_local_router_id_greater(self):
"""Compares *True* if local router id is greater when compared to peer
bgp id.
Should only be called after protocol has reached OpenConfirm state.
"""
from ryu.services.protocols.bgp.utils.bgp import from_inet_ptoi
if not self.state... | def is_local_router_id_greater(self):
"""Compares *True* if local router id is greater when compared to peer
bgp id.
Should only be called after protocol has reached OpenConfirm state.
"""
from ryu.services.protocols.bgp.utils.bgp import from_inet_ptoi
if not self.state... | [
"Compares",
"*",
"True",
"*",
"if",
"local",
"router",
"id",
"is",
"greater",
"when",
"compared",
"to",
"peer",
"bgp",
"id",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L150-L163 | [
"def",
"is_local_router_id_greater",
"(",
"self",
")",
":",
"from",
"ryu",
".",
"services",
".",
"protocols",
".",
"bgp",
".",
"utils",
".",
"bgp",
"import",
"from_inet_ptoi",
"if",
"not",
"self",
".",
"state",
"==",
"BGP_FSM_OPEN_CONFIRM",
":",
"raise",
"Bg... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol.is_enhanced_rr_cap_valid | Checks is enhanced route refresh capability is enabled/valid.
Checks sent and received `Open` messages to see if this session with
peer is capable of enhanced route refresh capability. | ryu/services/protocols/bgp/speaker.py | def is_enhanced_rr_cap_valid(self):
"""Checks is enhanced route refresh capability is enabled/valid.
Checks sent and received `Open` messages to see if this session with
peer is capable of enhanced route refresh capability.
"""
if not self.recv_open_msg:
raise ValueE... | def is_enhanced_rr_cap_valid(self):
"""Checks is enhanced route refresh capability is enabled/valid.
Checks sent and received `Open` messages to see if this session with
peer is capable of enhanced route refresh capability.
"""
if not self.recv_open_msg:
raise ValueE... | [
"Checks",
"is",
"enhanced",
"route",
"refresh",
"capability",
"is",
"enabled",
"/",
"valid",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L165-L188 | [
"def",
"is_enhanced_rr_cap_valid",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"recv_open_msg",
":",
"raise",
"ValueError",
"(",
"'Did not yet receive peers open message.'",
")",
"err_cap_enabled",
"=",
"False",
"local_caps",
"=",
"self",
".",
"sent_open_msg",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol._run | Sends open message to peer and handles received messages.
Parameters:
- `peer`: the peer to which this protocol instance is connected to. | ryu/services/protocols/bgp/speaker.py | def _run(self, peer):
"""Sends open message to peer and handles received messages.
Parameters:
- `peer`: the peer to which this protocol instance is connected to.
"""
# We know the peer we are connected to, we send open message.
self._peer = peer
self.connect... | def _run(self, peer):
"""Sends open message to peer and handles received messages.
Parameters:
- `peer`: the peer to which this protocol instance is connected to.
"""
# We know the peer we are connected to, we send open message.
self._peer = peer
self.connect... | [
"Sends",
"open",
"message",
"to",
"peer",
"and",
"handles",
"received",
"messages",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L264-L275 | [
"def",
"_run",
"(",
"self",
",",
"peer",
")",
":",
"# We know the peer we are connected to, we send open message.",
"self",
".",
"_peer",
"=",
"peer",
"self",
".",
"connection_made",
"(",
")",
"# We wait for peer to send messages.",
"self",
".",
"_recv_loop",
"(",
")"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol._data_received | Maintains buffer of bytes received from peer and extracts bgp
message from this buffer if enough data is received.
Validates bgp message marker, length, type and data and constructs
appropriate bgp message instance and calls handler.
:Parameters:
- `next_bytes`: next set of... | ryu/services/protocols/bgp/speaker.py | def _data_received(self, next_bytes):
"""Maintains buffer of bytes received from peer and extracts bgp
message from this buffer if enough data is received.
Validates bgp message marker, length, type and data and constructs
appropriate bgp message instance and calls handler.
:Pa... | def _data_received(self, next_bytes):
"""Maintains buffer of bytes received from peer and extracts bgp
message from this buffer if enough data is received.
Validates bgp message marker, length, type and data and constructs
appropriate bgp message instance and calls handler.
:Pa... | [
"Maintains",
"buffer",
"of",
"bytes",
"received",
"from",
"peer",
"and",
"extracts",
"bgp",
"message",
"from",
"this",
"buffer",
"if",
"enough",
"data",
"is",
"received",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L300-L357 | [
"def",
"_data_received",
"(",
"self",
",",
"next_bytes",
")",
":",
"# Append buffer with received bytes.",
"self",
".",
"_recv_buff",
"+=",
"next_bytes",
"while",
"True",
":",
"# If current buffer size is less then minimum bgp message size, we",
"# return as we do not have a comp... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol.send_notification | Utility to send notification message.
Closes the socket after sending the message.
:Parameters:
- `socket`: (socket) - socket over which to send notification
message.
- `code`: (int) - BGP Notification code
- `subcode`: (int) - BGP Notification sub-code
... | ryu/services/protocols/bgp/speaker.py | def send_notification(self, code, subcode):
"""Utility to send notification message.
Closes the socket after sending the message.
:Parameters:
- `socket`: (socket) - socket over which to send notification
message.
- `code`: (int) - BGP Notification code
... | def send_notification(self, code, subcode):
"""Utility to send notification message.
Closes the socket after sending the message.
:Parameters:
- `socket`: (socket) - socket over which to send notification
message.
- `code`: (int) - BGP Notification code
... | [
"Utility",
"to",
"send",
"notification",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L359-L379 | [
"def",
"send_notification",
"(",
"self",
",",
"code",
",",
"subcode",
")",
":",
"notification",
"=",
"BGPNotification",
"(",
"code",
",",
"subcode",
")",
"reason",
"=",
"notification",
".",
"reason",
"self",
".",
"_send_with_lock",
"(",
"notification",
")",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol._validate_open_msg | Validates BGP OPEN message according from application context.
Parsing modules takes care of validating OPEN message that need no
context. But here we validate it according to current application
settings. RTC or RR/ERR are MUST capability if peer does not support
either one of them we ... | ryu/services/protocols/bgp/speaker.py | def _validate_open_msg(self, open_msg):
"""Validates BGP OPEN message according from application context.
Parsing modules takes care of validating OPEN message that need no
context. But here we validate it according to current application
settings. RTC or RR/ERR are MUST capability if p... | def _validate_open_msg(self, open_msg):
"""Validates BGP OPEN message according from application context.
Parsing modules takes care of validating OPEN message that need no
context. But here we validate it according to current application
settings. RTC or RR/ERR are MUST capability if p... | [
"Validates",
"BGP",
"OPEN",
"message",
"according",
"from",
"application",
"context",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L407-L440 | [
"def",
"_validate_open_msg",
"(",
"self",
",",
"open_msg",
")",
":",
"assert",
"open_msg",
".",
"type",
"==",
"BGP_MSG_OPEN",
"opt_param_cap_map",
"=",
"open_msg",
".",
"opt_param_cap_map",
"# Validate remote AS number.",
"remote_as",
"=",
"open_msg",
".",
"my_as",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol._handle_msg | When a BGP message is received, send it to peer.
Open messages are validated here. Peer handler is called to handle each
message except for *Open* and *Notification* message. On receiving
*Notification* message we close connection with peer. | ryu/services/protocols/bgp/speaker.py | def _handle_msg(self, msg):
"""When a BGP message is received, send it to peer.
Open messages are validated here. Peer handler is called to handle each
message except for *Open* and *Notification* message. On receiving
*Notification* message we close connection with peer.
"""
... | def _handle_msg(self, msg):
"""When a BGP message is received, send it to peer.
Open messages are validated here. Peer handler is called to handle each
message except for *Open* and *Notification* message. On receiving
*Notification* message we close connection with peer.
"""
... | [
"When",
"a",
"BGP",
"message",
"is",
"received",
"send",
"it",
"to",
"peer",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L442-L512 | [
"def",
"_handle_msg",
"(",
"self",
",",
"msg",
")",
":",
"LOG",
".",
"debug",
"(",
"'Received msg from %s << %s'",
",",
"self",
".",
"_remotename",
",",
"msg",
")",
"# If we receive open message we try to bind to protocol",
"if",
"msg",
".",
"type",
"==",
"BGP_MSG... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol._start_timers | Starts keepalive and expire timers.
Hold time is set to min. of peer and configured/default hold time.
Starts keep alive timer and expire timer based on this value. | ryu/services/protocols/bgp/speaker.py | def _start_timers(self, peer_holdtime):
"""Starts keepalive and expire timers.
Hold time is set to min. of peer and configured/default hold time.
Starts keep alive timer and expire timer based on this value.
"""
neg_timer = min(self._holdtime, peer_holdtime)
if neg_timer... | def _start_timers(self, peer_holdtime):
"""Starts keepalive and expire timers.
Hold time is set to min. of peer and configured/default hold time.
Starts keep alive timer and expire timer based on this value.
"""
neg_timer = min(self._holdtime, peer_holdtime)
if neg_timer... | [
"Starts",
"keepalive",
"and",
"expire",
"timers",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L514-L534 | [
"def",
"_start_timers",
"(",
"self",
",",
"peer_holdtime",
")",
":",
"neg_timer",
"=",
"min",
"(",
"self",
".",
"_holdtime",
",",
"peer_holdtime",
")",
"if",
"neg_timer",
"<",
"self",
".",
"_holdtime",
":",
"LOG",
".",
"info",
"(",
"'Negotiated hold time (%s... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol._expired | Hold timer expired event handler. | ryu/services/protocols/bgp/speaker.py | def _expired(self):
"""Hold timer expired event handler.
"""
LOG.info('Negotiated hold time %s expired.', self._holdtime)
code = BGP_ERROR_HOLD_TIMER_EXPIRED
subcode = BGP_ERROR_SUB_HOLD_TIMER_EXPIRED
self.send_notification(code, subcode)
self.connection_lost('Neg... | def _expired(self):
"""Hold timer expired event handler.
"""
LOG.info('Negotiated hold time %s expired.', self._holdtime)
code = BGP_ERROR_HOLD_TIMER_EXPIRED
subcode = BGP_ERROR_SUB_HOLD_TIMER_EXPIRED
self.send_notification(code, subcode)
self.connection_lost('Neg... | [
"Hold",
"timer",
"expired",
"event",
"handler",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L536-L545 | [
"def",
"_expired",
"(",
"self",
")",
":",
"LOG",
".",
"info",
"(",
"'Negotiated hold time %s expired.'",
",",
"self",
".",
"_holdtime",
")",
"code",
"=",
"BGP_ERROR_HOLD_TIMER_EXPIRED",
"subcode",
"=",
"BGP_ERROR_SUB_HOLD_TIMER_EXPIRED",
"self",
".",
"send_notificatio... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol._recv_loop | Sits in tight loop collecting data received from peer and
processing it. | ryu/services/protocols/bgp/speaker.py | def _recv_loop(self):
"""Sits in tight loop collecting data received from peer and
processing it.
"""
required_len = BGP_MIN_MSG_LEN
conn_lost_reason = "Connection lost as protocol is no longer active"
try:
while True:
next_bytes = self._socket... | def _recv_loop(self):
"""Sits in tight loop collecting data received from peer and
processing it.
"""
required_len = BGP_MIN_MSG_LEN
conn_lost_reason = "Connection lost as protocol is no longer active"
try:
while True:
next_bytes = self._socket... | [
"Sits",
"in",
"tight",
"loop",
"collecting",
"data",
"received",
"from",
"peer",
"and",
"processing",
"it",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L550-L571 | [
"def",
"_recv_loop",
"(",
"self",
")",
":",
"required_len",
"=",
"BGP_MIN_MSG_LEN",
"conn_lost_reason",
"=",
"\"Connection lost as protocol is no longer active\"",
"try",
":",
"while",
"True",
":",
"next_bytes",
"=",
"self",
".",
"_socket",
".",
"recv",
"(",
"requir... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol.connection_made | Connection to peer handler.
We send bgp open message to peer and initialize related attributes. | ryu/services/protocols/bgp/speaker.py | def connection_made(self):
"""Connection to peer handler.
We send bgp open message to peer and initialize related attributes.
"""
assert self.state == BGP_FSM_CONNECT
# We have a connection with peer we send open message.
open_msg = self._peer.create_open_msg()
s... | def connection_made(self):
"""Connection to peer handler.
We send bgp open message to peer and initialize related attributes.
"""
assert self.state == BGP_FSM_CONNECT
# We have a connection with peer we send open message.
open_msg = self._peer.create_open_msg()
s... | [
"Connection",
"to",
"peer",
"handler",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L573-L587 | [
"def",
"connection_made",
"(",
"self",
")",
":",
"assert",
"self",
".",
"state",
"==",
"BGP_FSM_CONNECT",
"# We have a connection with peer we send open message.",
"open_msg",
"=",
"self",
".",
"_peer",
".",
"create_open_msg",
"(",
")",
"self",
".",
"_holdtime",
"="... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProtocol.connection_lost | Stops all timers and notifies peer that connection is lost. | ryu/services/protocols/bgp/speaker.py | def connection_lost(self, reason):
"""Stops all timers and notifies peer that connection is lost.
"""
if self._peer:
state = self._peer.state.bgp_state
if self._is_bound or state == BGP_FSM_OPEN_SENT:
self._peer.connection_lost(reason)
self._... | def connection_lost(self, reason):
"""Stops all timers and notifies peer that connection is lost.
"""
if self._peer:
state = self._peer.state.bgp_state
if self._is_bound or state == BGP_FSM_OPEN_SENT:
self._peer.connection_lost(reason)
self._... | [
"Stops",
"all",
"timers",
"and",
"notifies",
"peer",
"that",
"connection",
"is",
"lost",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/speaker.py#L589-L603 | [
"def",
"connection_lost",
"(",
"self",
",",
"reason",
")",
":",
"if",
"self",
".",
"_peer",
":",
"state",
"=",
"self",
".",
"_peer",
".",
"state",
".",
"bgp_state",
"if",
"self",
".",
"_is_bound",
"or",
"state",
"==",
"BGP_FSM_OPEN_SENT",
":",
"self",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Timer.start | interval is in seconds | ryu/services/protocols/vrrp/router.py | def start(self, interval):
"""interval is in seconds"""
if self._thread:
self.cancel()
self._event.clear()
self._thread = hub.spawn(self._timer, interval) | def start(self, interval):
"""interval is in seconds"""
if self._thread:
self.cancel()
self._event.clear()
self._thread = hub.spawn(self._timer, interval) | [
"interval",
"is",
"in",
"seconds"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/router.py#L45-L50 | [
"def",
"start",
"(",
"self",
",",
"interval",
")",
":",
"if",
"self",
".",
"_thread",
":",
"self",
".",
"cancel",
"(",
")",
"self",
".",
"_event",
".",
"clear",
"(",
")",
"self",
".",
"_thread",
"=",
"hub",
".",
"spawn",
"(",
"self",
".",
"_timer... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | NeighborConf.get_configured_capabilities | Returns configured capabilities. | ryu/services/protocols/bgp/rtconf/neighbors.py | def get_configured_capabilities(self):
"""Returns configured capabilities."""
capabilities = OrderedDict()
mbgp_caps = []
if self.cap_mbgp_ipv4:
mbgp_caps.append(
BGPOptParamCapabilityMultiprotocol(
RF_IPv4_UC.afi, RF_IPv4_UC.safi))
... | def get_configured_capabilities(self):
"""Returns configured capabilities."""
capabilities = OrderedDict()
mbgp_caps = []
if self.cap_mbgp_ipv4:
mbgp_caps.append(
BGPOptParamCapabilityMultiprotocol(
RF_IPv4_UC.afi, RF_IPv4_UC.safi))
... | [
"Returns",
"configured",
"capabilities",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/rtconf/neighbors.py#L678-L753 | [
"def",
"get_configured_capabilities",
"(",
"self",
")",
":",
"capabilities",
"=",
"OrderedDict",
"(",
")",
"mbgp_caps",
"=",
"[",
"]",
"if",
"self",
".",
"cap_mbgp_ipv4",
":",
"mbgp_caps",
".",
"append",
"(",
"BGPOptParamCapabilityMultiprotocol",
"(",
"RF_IPv4_UC"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | NeighborsConf.rtc_as_set | Returns current RTC AS configured for current neighbors. | ryu/services/protocols/bgp/rtconf/neighbors.py | def rtc_as_set(self):
"""Returns current RTC AS configured for current neighbors.
"""
rtc_as_set = set()
for neigh in self._neighbors.values():
rtc_as_set.add(neigh.rtc_as)
return rtc_as_set | def rtc_as_set(self):
"""Returns current RTC AS configured for current neighbors.
"""
rtc_as_set = set()
for neigh in self._neighbors.values():
rtc_as_set.add(neigh.rtc_as)
return rtc_as_set | [
"Returns",
"current",
"RTC",
"AS",
"configured",
"for",
"current",
"neighbors",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/rtconf/neighbors.py#L785-L791 | [
"def",
"rtc_as_set",
"(",
"self",
")",
":",
"rtc_as_set",
"=",
"set",
"(",
")",
"for",
"neigh",
"in",
"self",
".",
"_neighbors",
".",
"values",
"(",
")",
":",
"rtc_as_set",
".",
"add",
"(",
"neigh",
".",
"rtc_as",
")",
"return",
"rtc_as_set"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Packet.serialize | Encode a packet and store the resulted bytearray in self.data.
This method is legal only when encoding a packet. | ryu/lib/packet/packet.py | def serialize(self):
"""Encode a packet and store the resulted bytearray in self.data.
This method is legal only when encoding a packet.
"""
self.data = bytearray()
r = self.protocols[::-1]
for i, p in enumerate(r):
if isinstance(p, packet_base.PacketBase):
... | def serialize(self):
"""Encode a packet and store the resulted bytearray in self.data.
This method is legal only when encoding a packet.
"""
self.data = bytearray()
r = self.protocols[::-1]
for i, p in enumerate(r):
if isinstance(p, packet_base.PacketBase):
... | [
"Encode",
"a",
"packet",
"and",
"store",
"the",
"resulted",
"bytearray",
"in",
"self",
".",
"data",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/packet.py#L85-L102 | [
"def",
"serialize",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"bytearray",
"(",
")",
"r",
"=",
"self",
".",
"protocols",
"[",
":",
":",
"-",
"1",
"]",
"for",
"i",
",",
"p",
"in",
"enumerate",
"(",
"r",
")",
":",
"if",
"isinstance",
"(",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Packet.get_protocols | Returns a list of protocols that matches to the specified protocol. | ryu/lib/packet/packet.py | def get_protocols(self, protocol):
"""Returns a list of protocols that matches to the specified protocol.
"""
if isinstance(protocol, packet_base.PacketBase):
protocol = protocol.__class__
assert issubclass(protocol, packet_base.PacketBase)
return [p for p in self.pro... | def get_protocols(self, protocol):
"""Returns a list of protocols that matches to the specified protocol.
"""
if isinstance(protocol, packet_base.PacketBase):
protocol = protocol.__class__
assert issubclass(protocol, packet_base.PacketBase)
return [p for p in self.pro... | [
"Returns",
"a",
"list",
"of",
"protocols",
"that",
"matches",
"to",
"the",
"specified",
"protocol",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/packet.py#L131-L137 | [
"def",
"get_protocols",
"(",
"self",
",",
"protocol",
")",
":",
"if",
"isinstance",
"(",
"protocol",
",",
"packet_base",
".",
"PacketBase",
")",
":",
"protocol",
"=",
"protocol",
".",
"__class__",
"assert",
"issubclass",
"(",
"protocol",
",",
"packet_base",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Packet.get_protocol | Returns the firstly found protocol that matches to the
specified protocol. | ryu/lib/packet/packet.py | def get_protocol(self, protocol):
"""Returns the firstly found protocol that matches to the
specified protocol.
"""
result = self.get_protocols(protocol)
if len(result) > 0:
return result[0]
return None | def get_protocol(self, protocol):
"""Returns the firstly found protocol that matches to the
specified protocol.
"""
result = self.get_protocols(protocol)
if len(result) > 0:
return result[0]
return None | [
"Returns",
"the",
"firstly",
"found",
"protocol",
"that",
"matches",
"to",
"the",
"specified",
"protocol",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/packet.py#L139-L146 | [
"def",
"get_protocol",
"(",
"self",
",",
"protocol",
")",
":",
"result",
"=",
"self",
".",
"get_protocols",
"(",
"protocol",
")",
"if",
"len",
"(",
"result",
")",
">",
"0",
":",
"return",
"result",
"[",
"0",
"]",
"return",
"None"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib.add | add a setting of a bonding i/f.
'add' method takes the corresponding args in this order.
========= =====================================================
Attribute Description
========= =====================================================
dpid datapath id.
ports ... | ryu/lib/lacplib.py | def add(self, dpid, ports):
"""add a setting of a bonding i/f.
'add' method takes the corresponding args in this order.
========= =====================================================
Attribute Description
========= =====================================================
d... | def add(self, dpid, ports):
"""add a setting of a bonding i/f.
'add' method takes the corresponding args in this order.
========= =====================================================
Attribute Description
========= =====================================================
d... | [
"add",
"a",
"setting",
"of",
"a",
"bonding",
"i",
"/",
"f",
".",
"add",
"method",
"takes",
"the",
"corresponding",
"args",
"in",
"this",
"order",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L73-L94 | [
"def",
"add",
"(",
"self",
",",
"dpid",
",",
"ports",
")",
":",
"assert",
"isinstance",
"(",
"ports",
",",
"list",
")",
"assert",
"len",
"(",
"ports",
")",
">=",
"2",
"ifs",
"=",
"{",
"}",
"for",
"port",
"in",
"ports",
":",
"ifs",
"[",
"port",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib.packet_in_handler | PacketIn event handler. when the received packet was LACP,
proceed it. otherwise, send a event. | ryu/lib/lacplib.py | def packet_in_handler(self, evt):
"""PacketIn event handler. when the received packet was LACP,
proceed it. otherwise, send a event."""
req_pkt = packet.Packet(evt.msg.data)
if slow.lacp in req_pkt:
(req_lacp, ) = req_pkt.get_protocols(slow.lacp)
(req_eth, ) = req... | def packet_in_handler(self, evt):
"""PacketIn event handler. when the received packet was LACP,
proceed it. otherwise, send a event."""
req_pkt = packet.Packet(evt.msg.data)
if slow.lacp in req_pkt:
(req_lacp, ) = req_pkt.get_protocols(slow.lacp)
(req_eth, ) = req... | [
"PacketIn",
"event",
"handler",
".",
"when",
"the",
"received",
"packet",
"was",
"LACP",
"proceed",
"it",
".",
"otherwise",
"send",
"a",
"event",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L100-L109 | [
"def",
"packet_in_handler",
"(",
"self",
",",
"evt",
")",
":",
"req_pkt",
"=",
"packet",
".",
"Packet",
"(",
"evt",
".",
"msg",
".",
"data",
")",
"if",
"slow",
".",
"lacp",
"in",
"req_pkt",
":",
"(",
"req_lacp",
",",
")",
"=",
"req_pkt",
".",
"get_... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib.flow_removed_handler | FlowRemoved event handler. when the removed flow entry was
for LACP, set the status of the slave i/f to disabled, and
send a event. | ryu/lib/lacplib.py | def flow_removed_handler(self, evt):
"""FlowRemoved event handler. when the removed flow entry was
for LACP, set the status of the slave i/f to disabled, and
send a event."""
msg = evt.msg
datapath = msg.datapath
ofproto = datapath.ofproto
dpid = datapath.id
... | def flow_removed_handler(self, evt):
"""FlowRemoved event handler. when the removed flow entry was
for LACP, set the status of the slave i/f to disabled, and
send a event."""
msg = evt.msg
datapath = msg.datapath
ofproto = datapath.ofproto
dpid = datapath.id
... | [
"FlowRemoved",
"event",
"handler",
".",
"when",
"the",
"removed",
"flow",
"entry",
"was",
"for",
"LACP",
"set",
"the",
"status",
"of",
"the",
"slave",
"i",
"/",
"f",
"to",
"disabled",
"and",
"send",
"a",
"event",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L112-L135 | [
"def",
"flow_removed_handler",
"(",
"self",
",",
"evt",
")",
":",
"msg",
"=",
"evt",
".",
"msg",
"datapath",
"=",
"msg",
".",
"datapath",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"dpid",
"=",
"datapath",
".",
"id",
"match",
"=",
"msg",
".",
"match",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._do_lacp | packet-in process when the received packet is LACP. | ryu/lib/lacplib.py | def _do_lacp(self, req_lacp, src, msg):
"""packet-in process when the received packet is LACP."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
port = ... | def _do_lacp(self, req_lacp, src, msg):
"""packet-in process when the received packet is LACP."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
port = ... | [
"packet",
"-",
"in",
"process",
"when",
"the",
"received",
"packet",
"is",
"LACP",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L140-L194 | [
"def",
"_do_lacp",
"(",
"self",
",",
"req_lacp",
",",
"src",
",",
"msg",
")",
":",
"datapath",
"=",
"msg",
".",
"datapath",
"dpid",
"=",
"datapath",
".",
"id",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._create_response | create a packet including LACP. | ryu/lib/lacplib.py | def _create_response(self, datapath, port, req):
"""create a packet including LACP."""
src = datapath.ports[port].hw_addr
res_ether = ethernet.ethernet(
slow.SLOW_PROTOCOL_MULTICAST, src, ether.ETH_TYPE_SLOW)
res_lacp = self._create_lacp(datapath, port, req)
res_pkt =... | def _create_response(self, datapath, port, req):
"""create a packet including LACP."""
src = datapath.ports[port].hw_addr
res_ether = ethernet.ethernet(
slow.SLOW_PROTOCOL_MULTICAST, src, ether.ETH_TYPE_SLOW)
res_lacp = self._create_lacp(datapath, port, req)
res_pkt =... | [
"create",
"a",
"packet",
"including",
"LACP",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L196-L206 | [
"def",
"_create_response",
"(",
"self",
",",
"datapath",
",",
"port",
",",
"req",
")",
":",
"src",
"=",
"datapath",
".",
"ports",
"[",
"port",
"]",
".",
"hw_addr",
"res_ether",
"=",
"ethernet",
".",
"ethernet",
"(",
"slow",
".",
"SLOW_PROTOCOL_MULTICAST",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._create_lacp | create a LACP packet. | ryu/lib/lacplib.py | def _create_lacp(self, datapath, port, req):
"""create a LACP packet."""
actor_system = datapath.ports[datapath.ofproto.OFPP_LOCAL].hw_addr
res = slow.lacp(
actor_system_priority=0xffff,
actor_system=actor_system,
actor_key=req.actor_key,
actor_por... | def _create_lacp(self, datapath, port, req):
"""create a LACP packet."""
actor_system = datapath.ports[datapath.ofproto.OFPP_LOCAL].hw_addr
res = slow.lacp(
actor_system_priority=0xffff,
actor_system=actor_system,
actor_key=req.actor_key,
actor_por... | [
"create",
"a",
"LACP",
"packet",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L208-L242 | [
"def",
"_create_lacp",
"(",
"self",
",",
"datapath",
",",
"port",
",",
"req",
")",
":",
"actor_system",
"=",
"datapath",
".",
"ports",
"[",
"datapath",
".",
"ofproto",
".",
"OFPP_LOCAL",
"]",
".",
"hw_addr",
"res",
"=",
"slow",
".",
"lacp",
"(",
"actor... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._get_slave_enabled | get whether a slave i/f at some port of some datapath is
enable or not. | ryu/lib/lacplib.py | def _get_slave_enabled(self, dpid, port):
"""get whether a slave i/f at some port of some datapath is
enable or not."""
slave = self._get_slave(dpid, port)
if slave:
return slave['enabled']
else:
return False | def _get_slave_enabled(self, dpid, port):
"""get whether a slave i/f at some port of some datapath is
enable or not."""
slave = self._get_slave(dpid, port)
if slave:
return slave['enabled']
else:
return False | [
"get",
"whether",
"a",
"slave",
"i",
"/",
"f",
"at",
"some",
"port",
"of",
"some",
"datapath",
"is",
"enable",
"or",
"not",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L244-L251 | [
"def",
"_get_slave_enabled",
"(",
"self",
",",
"dpid",
",",
"port",
")",
":",
"slave",
"=",
"self",
".",
"_get_slave",
"(",
"dpid",
",",
"port",
")",
"if",
"slave",
":",
"return",
"slave",
"[",
"'enabled'",
"]",
"else",
":",
"return",
"False"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._set_slave_enabled | set whether a slave i/f at some port of some datapath is
enable or not. | ryu/lib/lacplib.py | def _set_slave_enabled(self, dpid, port, enabled):
"""set whether a slave i/f at some port of some datapath is
enable or not."""
slave = self._get_slave(dpid, port)
if slave:
slave['enabled'] = enabled | def _set_slave_enabled(self, dpid, port, enabled):
"""set whether a slave i/f at some port of some datapath is
enable or not."""
slave = self._get_slave(dpid, port)
if slave:
slave['enabled'] = enabled | [
"set",
"whether",
"a",
"slave",
"i",
"/",
"f",
"at",
"some",
"port",
"of",
"some",
"datapath",
"is",
"enable",
"or",
"not",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L253-L258 | [
"def",
"_set_slave_enabled",
"(",
"self",
",",
"dpid",
",",
"port",
",",
"enabled",
")",
":",
"slave",
"=",
"self",
".",
"_get_slave",
"(",
"dpid",
",",
"port",
")",
"if",
"slave",
":",
"slave",
"[",
"'enabled'",
"]",
"=",
"enabled"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._get_slave_timeout | get the timeout time at some port of some datapath. | ryu/lib/lacplib.py | def _get_slave_timeout(self, dpid, port):
"""get the timeout time at some port of some datapath."""
slave = self._get_slave(dpid, port)
if slave:
return slave['timeout']
else:
return 0 | def _get_slave_timeout(self, dpid, port):
"""get the timeout time at some port of some datapath."""
slave = self._get_slave(dpid, port)
if slave:
return slave['timeout']
else:
return 0 | [
"get",
"the",
"timeout",
"time",
"at",
"some",
"port",
"of",
"some",
"datapath",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L260-L266 | [
"def",
"_get_slave_timeout",
"(",
"self",
",",
"dpid",
",",
"port",
")",
":",
"slave",
"=",
"self",
".",
"_get_slave",
"(",
"dpid",
",",
"port",
")",
"if",
"slave",
":",
"return",
"slave",
"[",
"'timeout'",
"]",
"else",
":",
"return",
"0"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._set_slave_timeout | set the timeout time at some port of some datapath. | ryu/lib/lacplib.py | def _set_slave_timeout(self, dpid, port, timeout):
"""set the timeout time at some port of some datapath."""
slave = self._get_slave(dpid, port)
if slave:
slave['timeout'] = timeout | def _set_slave_timeout(self, dpid, port, timeout):
"""set the timeout time at some port of some datapath."""
slave = self._get_slave(dpid, port)
if slave:
slave['timeout'] = timeout | [
"set",
"the",
"timeout",
"time",
"at",
"some",
"port",
"of",
"some",
"datapath",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L268-L272 | [
"def",
"_set_slave_timeout",
"(",
"self",
",",
"dpid",
",",
"port",
",",
"timeout",
")",
":",
"slave",
"=",
"self",
".",
"_get_slave",
"(",
"dpid",
",",
"port",
")",
"if",
"slave",
":",
"slave",
"[",
"'timeout'",
"]",
"=",
"timeout"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._get_slave | get slave i/f at some port of some datapath. | ryu/lib/lacplib.py | def _get_slave(self, dpid, port):
"""get slave i/f at some port of some datapath."""
result = None
for bond in self._bonds:
if dpid in bond:
if port in bond[dpid]:
result = bond[dpid][port]
break
return result | def _get_slave(self, dpid, port):
"""get slave i/f at some port of some datapath."""
result = None
for bond in self._bonds:
if dpid in bond:
if port in bond[dpid]:
result = bond[dpid][port]
break
return result | [
"get",
"slave",
"i",
"/",
"f",
"at",
"some",
"port",
"of",
"some",
"datapath",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L274-L282 | [
"def",
"_get_slave",
"(",
"self",
",",
"dpid",
",",
"port",
")",
":",
"result",
"=",
"None",
"for",
"bond",
"in",
"self",
".",
"_bonds",
":",
"if",
"dpid",
"in",
"bond",
":",
"if",
"port",
"in",
"bond",
"[",
"dpid",
"]",
":",
"result",
"=",
"bond... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._add_flow_v1_0 | enter a flow entry for the packet from the slave i/f
with idle_timeout. for OpenFlow ver1.0. | ryu/lib/lacplib.py | def _add_flow_v1_0(self, src, port, timeout, datapath):
"""enter a flow entry for the packet from the slave i/f
with idle_timeout. for OpenFlow ver1.0."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
match = parser.OFPMatch(
in_port=port, dl_src=addrco... | def _add_flow_v1_0(self, src, port, timeout, datapath):
"""enter a flow entry for the packet from the slave i/f
with idle_timeout. for OpenFlow ver1.0."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
match = parser.OFPMatch(
in_port=port, dl_src=addrco... | [
"enter",
"a",
"flow",
"entry",
"for",
"the",
"packet",
"from",
"the",
"slave",
"i",
"/",
"f",
"with",
"idle_timeout",
".",
"for",
"OpenFlow",
"ver1",
".",
"0",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L287-L303 | [
"def",
"_add_flow_v1_0",
"(",
"self",
",",
"src",
",",
"port",
",",
"timeout",
",",
"datapath",
")",
":",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"match",
"=",
"parser",
".",
"OFPMatch",
"(",
"in_port",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | LacpLib._add_flow_v1_2 | enter a flow entry for the packet from the slave i/f
with idle_timeout. for OpenFlow ver1.2 and ver1.3. | ryu/lib/lacplib.py | def _add_flow_v1_2(self, src, port, timeout, datapath):
"""enter a flow entry for the packet from the slave i/f
with idle_timeout. for OpenFlow ver1.2 and ver1.3."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
match = parser.OFPMatch(
in_port=port, et... | def _add_flow_v1_2(self, src, port, timeout, datapath):
"""enter a flow entry for the packet from the slave i/f
with idle_timeout. for OpenFlow ver1.2 and ver1.3."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
match = parser.OFPMatch(
in_port=port, et... | [
"enter",
"a",
"flow",
"entry",
"for",
"the",
"packet",
"from",
"the",
"slave",
"i",
"/",
"f",
"with",
"idle_timeout",
".",
"for",
"OpenFlow",
"ver1",
".",
"2",
"and",
"ver1",
".",
"3",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L305-L322 | [
"def",
"_add_flow_v1_2",
"(",
"self",
",",
"src",
",",
"port",
",",
"timeout",
",",
"datapath",
")",
":",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"match",
"=",
"parser",
".",
"OFPMatch",
"(",
"in_port",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ip_route_show | Returns a selected route record matching the given filtering rules.
The arguments are similar to "ip route showdump" command of iproute2.
:param session: Session instance connecting to database.
:param destination: Destination prefix.
:param device: Source device.
:param kwargs: Filtering rules to... | ryu/services/protocols/zebra/db/route.py | def ip_route_show(session, destination, device, **kwargs):
"""
Returns a selected route record matching the given filtering rules.
The arguments are similar to "ip route showdump" command of iproute2.
:param session: Session instance connecting to database.
:param destination: Destination prefix.
... | def ip_route_show(session, destination, device, **kwargs):
"""
Returns a selected route record matching the given filtering rules.
The arguments are similar to "ip route showdump" command of iproute2.
:param session: Session instance connecting to database.
:param destination: Destination prefix.
... | [
"Returns",
"a",
"selected",
"route",
"record",
"matching",
"the",
"given",
"filtering",
"rules",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/route.py#L77-L95 | [
"def",
"ip_route_show",
"(",
"session",
",",
"destination",
",",
"device",
",",
"*",
"*",
"kwargs",
")",
":",
"intf",
"=",
"interface",
".",
"ip_link_show",
"(",
"session",
",",
"ifname",
"=",
"device",
")",
"if",
"not",
"intf",
":",
"LOG",
".",
"debug... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ip_route_add | Adds a route record into Zebra protocol service database.
The arguments are similar to "ip route add" command of iproute2.
If "is_selected=True", disables the existing selected route for the
given destination.
:param session: Session instance connecting to database.
:param destination: Destinatio... | ryu/services/protocols/zebra/db/route.py | def ip_route_add(session, destination, device=None, gateway='', source='',
ifindex=0, route_type=zebra.ZEBRA_ROUTE_KERNEL,
is_selected=True):
"""
Adds a route record into Zebra protocol service database.
The arguments are similar to "ip route add" command of iproute2.
... | def ip_route_add(session, destination, device=None, gateway='', source='',
ifindex=0, route_type=zebra.ZEBRA_ROUTE_KERNEL,
is_selected=True):
"""
Adds a route record into Zebra protocol service database.
The arguments are similar to "ip route add" command of iproute2.
... | [
"Adds",
"a",
"route",
"record",
"into",
"Zebra",
"protocol",
"service",
"database",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/route.py#L116-L182 | [
"def",
"ip_route_add",
"(",
"session",
",",
"destination",
",",
"device",
"=",
"None",
",",
"gateway",
"=",
"''",
",",
"source",
"=",
"''",
",",
"ifindex",
"=",
"0",
",",
"route_type",
"=",
"zebra",
".",
"ZEBRA_ROUTE_KERNEL",
",",
"is_selected",
"=",
"Tr... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ip_route_delete | Deletes route record(s) from Zebra protocol service database.
The arguments are similar to "ip route delete" command of iproute2.
:param session: Session instance connecting to database.
:param destination: Destination prefix.
:param kwargs: Filtering rules to query.
:return: Records which are del... | ryu/services/protocols/zebra/db/route.py | def ip_route_delete(session, destination, **kwargs):
"""
Deletes route record(s) from Zebra protocol service database.
The arguments are similar to "ip route delete" command of iproute2.
:param session: Session instance connecting to database.
:param destination: Destination prefix.
:param kwa... | def ip_route_delete(session, destination, **kwargs):
"""
Deletes route record(s) from Zebra protocol service database.
The arguments are similar to "ip route delete" command of iproute2.
:param session: Session instance connecting to database.
:param destination: Destination prefix.
:param kwa... | [
"Deletes",
"route",
"record",
"(",
"s",
")",
"from",
"Zebra",
"protocol",
"service",
"database",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/route.py#L186-L201 | [
"def",
"ip_route_delete",
"(",
"session",
",",
"destination",
",",
"*",
"*",
"kwargs",
")",
":",
"routes",
"=",
"ip_route_show_all",
"(",
"session",
",",
"destination",
"=",
"destination",
",",
"*",
"*",
"kwargs",
")",
"for",
"route",
"in",
"routes",
":",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | setup_hook | Filter config parsed from a setup.cfg to inject our defaults. | ryu/hooks.py | def setup_hook(config):
"""Filter config parsed from a setup.cfg to inject our defaults."""
metadata = config['metadata']
if sys.platform == 'win32':
requires = metadata.get('requires_dist', '').split('\n')
metadata['requires_dist'] = "\n".join(requires)
config['metadata'] = metadata
... | def setup_hook(config):
"""Filter config parsed from a setup.cfg to inject our defaults."""
metadata = config['metadata']
if sys.platform == 'win32':
requires = metadata.get('requires_dist', '').split('\n')
metadata['requires_dist'] = "\n".join(requires)
config['metadata'] = metadata
... | [
"Filter",
"config",
"parsed",
"from",
"a",
"setup",
".",
"cfg",
"to",
"inject",
"our",
"defaults",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/hooks.py#L39-L70 | [
"def",
"setup_hook",
"(",
"config",
")",
":",
"metadata",
"=",
"config",
"[",
"'metadata'",
"]",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"requires",
"=",
"metadata",
".",
"get",
"(",
"'requires_dist'",
",",
"''",
")",
".",
"split",
"(",
"'\... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _compare_by_version | Returns the current/latest learned path.
Checks if given paths are from same source/peer and then compares their
version number to determine which path is received later. If paths are from
different source/peer return None. | ryu/services/protocols/bgp/processor.py | def _compare_by_version(path1, path2):
"""Returns the current/latest learned path.
Checks if given paths are from same source/peer and then compares their
version number to determine which path is received later. If paths are from
different source/peer return None.
"""
if path1.source == path2.... | def _compare_by_version(path1, path2):
"""Returns the current/latest learned path.
Checks if given paths are from same source/peer and then compares their
version number to determine which path is received later. If paths are from
different source/peer return None.
"""
if path1.source == path2.... | [
"Returns",
"the",
"current",
"/",
"latest",
"learned",
"path",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L178-L190 | [
"def",
"_compare_by_version",
"(",
"path1",
",",
"path2",
")",
":",
"if",
"path1",
".",
"source",
"==",
"path2",
".",
"source",
":",
"if",
"path1",
".",
"source_version_num",
">",
"path2",
".",
"source_version_num",
":",
"return",
"path1",
"else",
":",
"re... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | compute_best_path | Compares given paths and returns best path.
Parameters:
-`local_asn`: asn of local bgpspeaker
-`path1`: first path to compare
-`path2`: second path to compare
Best path processing will involve following steps:
1. Select a path with a reachable next hop.
2. Select the path wit... | ryu/services/protocols/bgp/processor.py | def compute_best_path(local_asn, path1, path2):
"""Compares given paths and returns best path.
Parameters:
-`local_asn`: asn of local bgpspeaker
-`path1`: first path to compare
-`path2`: second path to compare
Best path processing will involve following steps:
1. Select a path... | def compute_best_path(local_asn, path1, path2):
"""Compares given paths and returns best path.
Parameters:
-`local_asn`: asn of local bgpspeaker
-`path1`: first path to compare
-`path2`: second path to compare
Best path processing will involve following steps:
1. Select a path... | [
"Compares",
"given",
"paths",
"and",
"returns",
"best",
"path",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L193-L266 | [
"def",
"compute_best_path",
"(",
"local_asn",
",",
"path1",
",",
"path2",
")",
":",
"best_path",
"=",
"None",
"best_path_reason",
"=",
"BPR_UNKNOWN",
"# Follow best path calculation algorithm steps.",
"if",
"best_path",
"is",
"None",
":",
"best_path",
"=",
"_cmp_by_re... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_local_pref | Selects a path with highest local-preference.
Unlike the weight attribute, which is only relevant to the local
router, local preference is an attribute that routers exchange in the
same AS. Highest local-pref is preferred. If we cannot decide,
we return None. | ryu/services/protocols/bgp/processor.py | def _cmp_by_local_pref(path1, path2):
"""Selects a path with highest local-preference.
Unlike the weight attribute, which is only relevant to the local
router, local preference is an attribute that routers exchange in the
same AS. Highest local-pref is preferred. If we cannot decide,
we return None... | def _cmp_by_local_pref(path1, path2):
"""Selects a path with highest local-preference.
Unlike the weight attribute, which is only relevant to the local
router, local preference is an attribute that routers exchange in the
same AS. Highest local-pref is preferred. If we cannot decide,
we return None... | [
"Selects",
"a",
"path",
"with",
"highest",
"local",
"-",
"preference",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L292-L316 | [
"def",
"_cmp_by_local_pref",
"(",
"path1",
",",
"path2",
")",
":",
"# TODO(PH): Revisit this when BGPS has concept of policy to be applied to",
"# in-bound NLRIs.",
"# Default local-pref values is 100",
"lp1",
"=",
"path1",
".",
"get_pattr",
"(",
"BGP_ATTR_TYPE_LOCAL_PREF",
")",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_local_origin | Select locally originating path as best path.
Locally originating routes are network routes, redistributed routes,
or aggregated routes. For now we are going to prefer routes received
through a Flexinet-Peer as locally originating route compared to routes
received from a BGP peer.
Returns None if g... | ryu/services/protocols/bgp/processor.py | def _cmp_by_local_origin(path1, path2):
"""Select locally originating path as best path.
Locally originating routes are network routes, redistributed routes,
or aggregated routes. For now we are going to prefer routes received
through a Flexinet-Peer as locally originating route compared to routes
... | def _cmp_by_local_origin(path1, path2):
"""Select locally originating path as best path.
Locally originating routes are network routes, redistributed routes,
or aggregated routes. For now we are going to prefer routes received
through a Flexinet-Peer as locally originating route compared to routes
... | [
"Select",
"locally",
"originating",
"path",
"as",
"best",
"path",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L319-L340 | [
"def",
"_cmp_by_local_origin",
"(",
"path1",
",",
"path2",
")",
":",
"# If both paths are from same sources we cannot compare them here.",
"if",
"path1",
".",
"source",
"==",
"path2",
".",
"source",
":",
"return",
"None",
"# Here we consider prefix from NC as locally originat... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_aspath | Calculated the best-paths by comparing as-path lengths.
Shortest as-path length is preferred. If both path have same lengths,
we return None. | ryu/services/protocols/bgp/processor.py | def _cmp_by_aspath(path1, path2):
"""Calculated the best-paths by comparing as-path lengths.
Shortest as-path length is preferred. If both path have same lengths,
we return None.
"""
as_path1 = path1.get_pattr(BGP_ATTR_TYPE_AS_PATH)
as_path2 = path2.get_pattr(BGP_ATTR_TYPE_AS_PATH)
assert a... | def _cmp_by_aspath(path1, path2):
"""Calculated the best-paths by comparing as-path lengths.
Shortest as-path length is preferred. If both path have same lengths,
we return None.
"""
as_path1 = path1.get_pattr(BGP_ATTR_TYPE_AS_PATH)
as_path2 = path2.get_pattr(BGP_ATTR_TYPE_AS_PATH)
assert a... | [
"Calculated",
"the",
"best",
"-",
"paths",
"by",
"comparing",
"as",
"-",
"path",
"lengths",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L343-L360 | [
"def",
"_cmp_by_aspath",
"(",
"path1",
",",
"path2",
")",
":",
"as_path1",
"=",
"path1",
".",
"get_pattr",
"(",
"BGP_ATTR_TYPE_AS_PATH",
")",
"as_path2",
"=",
"path2",
".",
"get_pattr",
"(",
"BGP_ATTR_TYPE_AS_PATH",
")",
"assert",
"as_path1",
"and",
"as_path2",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_origin | Select the best path based on origin attribute.
IGP is preferred over EGP; EGP is preferred over Incomplete.
If both paths have same origin, we return None. | ryu/services/protocols/bgp/processor.py | def _cmp_by_origin(path1, path2):
"""Select the best path based on origin attribute.
IGP is preferred over EGP; EGP is preferred over Incomplete.
If both paths have same origin, we return None.
"""
def get_origin_pref(origin):
if origin.value == BGP_ATTR_ORIGIN_IGP:
return 3
... | def _cmp_by_origin(path1, path2):
"""Select the best path based on origin attribute.
IGP is preferred over EGP; EGP is preferred over Incomplete.
If both paths have same origin, we return None.
"""
def get_origin_pref(origin):
if origin.value == BGP_ATTR_ORIGIN_IGP:
return 3
... | [
"Select",
"the",
"best",
"path",
"based",
"on",
"origin",
"attribute",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L363-L396 | [
"def",
"_cmp_by_origin",
"(",
"path1",
",",
"path2",
")",
":",
"def",
"get_origin_pref",
"(",
"origin",
")",
":",
"if",
"origin",
".",
"value",
"==",
"BGP_ATTR_ORIGIN_IGP",
":",
"return",
"3",
"elif",
"origin",
".",
"value",
"==",
"BGP_ATTR_ORIGIN_EGP",
":",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_med | Select the path based with lowest MED value.
If both paths have same MED, return None.
By default, a route that arrives with no MED value is treated as if it
had a MED of 0, the most preferred value.
RFC says lower MED is preferred over higher MED value. | ryu/services/protocols/bgp/processor.py | def _cmp_by_med(path1, path2):
"""Select the path based with lowest MED value.
If both paths have same MED, return None.
By default, a route that arrives with no MED value is treated as if it
had a MED of 0, the most preferred value.
RFC says lower MED is preferred over higher MED value.
"""
... | def _cmp_by_med(path1, path2):
"""Select the path based with lowest MED value.
If both paths have same MED, return None.
By default, a route that arrives with no MED value is treated as if it
had a MED of 0, the most preferred value.
RFC says lower MED is preferred over higher MED value.
"""
... | [
"Select",
"the",
"path",
"based",
"with",
"lowest",
"MED",
"value",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L399-L420 | [
"def",
"_cmp_by_med",
"(",
"path1",
",",
"path2",
")",
":",
"def",
"get_path_med",
"(",
"path",
")",
":",
"med",
"=",
"path",
".",
"get_pattr",
"(",
"BGP_ATTR_TYPE_MULTI_EXIT_DISC",
")",
"if",
"not",
"med",
":",
"return",
"0",
"return",
"med",
".",
"valu... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_asn | Select the path based on source (iBGP/eBGP) peer.
eBGP path is preferred over iBGP. If both paths are from same kind of
peers, return None. | ryu/services/protocols/bgp/processor.py | def _cmp_by_asn(local_asn, path1, path2):
"""Select the path based on source (iBGP/eBGP) peer.
eBGP path is preferred over iBGP. If both paths are from same kind of
peers, return None.
"""
def get_path_source_asn(path):
asn = None
if path.source is None:
asn = local_asn
... | def _cmp_by_asn(local_asn, path1, path2):
"""Select the path based on source (iBGP/eBGP) peer.
eBGP path is preferred over iBGP. If both paths are from same kind of
peers, return None.
"""
def get_path_source_asn(path):
asn = None
if path.source is None:
asn = local_asn
... | [
"Select",
"the",
"path",
"based",
"on",
"source",
"(",
"iBGP",
"/",
"eBGP",
")",
"peer",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L423-L448 | [
"def",
"_cmp_by_asn",
"(",
"local_asn",
",",
"path1",
",",
"path2",
")",
":",
"def",
"get_path_source_asn",
"(",
"path",
")",
":",
"asn",
"=",
"None",
"if",
"path",
".",
"source",
"is",
"None",
":",
"asn",
"=",
"local_asn",
"else",
":",
"asn",
"=",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_router_id | Select the route received from the peer with the lowest BGP router ID.
If both paths are eBGP paths, then we do not do any tie breaking, i.e we do
not pick best-path based on this criteria.
RFC: http://tools.ietf.org/html/rfc5004
We pick best path between two iBGP paths as usual. | ryu/services/protocols/bgp/processor.py | def _cmp_by_router_id(local_asn, path1, path2):
"""Select the route received from the peer with the lowest BGP router ID.
If both paths are eBGP paths, then we do not do any tie breaking, i.e we do
not pick best-path based on this criteria.
RFC: http://tools.ietf.org/html/rfc5004
We pick best path ... | def _cmp_by_router_id(local_asn, path1, path2):
"""Select the route received from the peer with the lowest BGP router ID.
If both paths are eBGP paths, then we do not do any tie breaking, i.e we do
not pick best-path based on this criteria.
RFC: http://tools.ietf.org/html/rfc5004
We pick best path ... | [
"Select",
"the",
"route",
"received",
"from",
"the",
"peer",
"with",
"the",
"lowest",
"BGP",
"router",
"ID",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L460-L526 | [
"def",
"_cmp_by_router_id",
"(",
"local_asn",
",",
"path1",
",",
"path2",
")",
":",
"def",
"get_asn",
"(",
"path_source",
")",
":",
"if",
"path_source",
"is",
"None",
":",
"return",
"local_asn",
"else",
":",
"return",
"path_source",
".",
"remote_as",
"def",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _cmp_by_cluster_list | Selects the route received from the peer with the shorter
CLUSTER_LIST length. [RFC4456]
The CLUSTER_LIST length is evaluated as zero if a route does not
carry the CLUSTER_LIST attribute. | ryu/services/protocols/bgp/processor.py | def _cmp_by_cluster_list(path1, path2):
"""Selects the route received from the peer with the shorter
CLUSTER_LIST length. [RFC4456]
The CLUSTER_LIST length is evaluated as zero if a route does not
carry the CLUSTER_LIST attribute.
"""
def _get_cluster_list_len(path):
c_list = path.get_p... | def _cmp_by_cluster_list(path1, path2):
"""Selects the route received from the peer with the shorter
CLUSTER_LIST length. [RFC4456]
The CLUSTER_LIST length is evaluated as zero if a route does not
carry the CLUSTER_LIST attribute.
"""
def _get_cluster_list_len(path):
c_list = path.get_p... | [
"Selects",
"the",
"route",
"received",
"from",
"the",
"peer",
"with",
"the",
"shorter",
"CLUSTER_LIST",
"length",
".",
"[",
"RFC4456",
"]"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L529-L550 | [
"def",
"_cmp_by_cluster_list",
"(",
"path1",
",",
"path2",
")",
":",
"def",
"_get_cluster_list_len",
"(",
"path",
")",
":",
"c_list",
"=",
"path",
".",
"get_pattr",
"(",
"BGP_ATTR_TYPE_CLUSTER_LIST",
")",
"if",
"c_list",
"is",
"None",
":",
"return",
"0",
"el... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BgpProcessor.enqueue | Enqueues given destination for processing.
Given instance should be a valid destination. | ryu/services/protocols/bgp/processor.py | def enqueue(self, destination):
"""Enqueues given destination for processing.
Given instance should be a valid destination.
"""
if not destination:
raise BgpProcessorError('Invalid destination %s.' % destination)
dest_queue = self._dest_queue
# RtDest are qu... | def enqueue(self, destination):
"""Enqueues given destination for processing.
Given instance should be a valid destination.
"""
if not destination:
raise BgpProcessorError('Invalid destination %s.' % destination)
dest_queue = self._dest_queue
# RtDest are qu... | [
"Enqueues",
"given",
"destination",
"for",
"processing",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L136-L155 | [
"def",
"enqueue",
"(",
"self",
",",
"destination",
")",
":",
"if",
"not",
"destination",
":",
"raise",
"BgpProcessorError",
"(",
"'Invalid destination %s.'",
"%",
"destination",
")",
"dest_queue",
"=",
"self",
".",
"_dest_queue",
"# RtDest are queued in a separate que... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | log | Utility to log given stats to *stats* logger.
Stats to log are given by `stats_source` and in its absence we log
`kwargs`. *stats* logger is configured independently from any logger.
Only stats should be logged to this logger. Will add current timestamp
to the logged stats if not given.
Parameters... | ryu/services/protocols/bgp/utils/stats.py | def log(stats_resource=None, stats_source=None, log_level=DEFAULT_LOG_LEVEL,
**kwargs):
"""Utility to log given stats to *stats* logger.
Stats to log are given by `stats_source` and in its absence we log
`kwargs`. *stats* logger is configured independently from any logger.
Only stats should be ... | def log(stats_resource=None, stats_source=None, log_level=DEFAULT_LOG_LEVEL,
**kwargs):
"""Utility to log given stats to *stats* logger.
Stats to log are given by `stats_source` and in its absence we log
`kwargs`. *stats* logger is configured independently from any logger.
Only stats should be ... | [
"Utility",
"to",
"log",
"given",
"stats",
"to",
"*",
"stats",
"*",
"logger",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/stats.py#L53-L92 | [
"def",
"log",
"(",
"stats_resource",
"=",
"None",
",",
"stats_source",
"=",
"None",
",",
"log_level",
"=",
"DEFAULT_LOG_LEVEL",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get stats from source if given.",
"if",
"stats_source",
"is",
"not",
"None",
":",
"kwargs",
"=... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.neighbor_add | This method registers a new neighbor. The BGP speaker tries to
establish a bgp session with the peer (accepts a connection
from the peer and also tries to connect to it).
``address`` specifies the IP address of the peer. It must be
the string representation of an IP address. Only IPv4 i... | ryu/services/protocols/bgp/bgpspeaker.py | def neighbor_add(self, address, remote_as,
remote_port=DEFAULT_BGP_PORT,
enable_ipv4=DEFAULT_CAP_MBGP_IPV4,
enable_ipv6=DEFAULT_CAP_MBGP_IPV6,
enable_vpnv4=DEFAULT_CAP_MBGP_VPNV4,
enable_vpnv6=DEFAULT_CAP_MBGP_VPNV6... | def neighbor_add(self, address, remote_as,
remote_port=DEFAULT_BGP_PORT,
enable_ipv4=DEFAULT_CAP_MBGP_IPV4,
enable_ipv6=DEFAULT_CAP_MBGP_IPV6,
enable_vpnv4=DEFAULT_CAP_MBGP_VPNV4,
enable_vpnv6=DEFAULT_CAP_MBGP_VPNV6... | [
"This",
"method",
"registers",
"a",
"new",
"neighbor",
".",
"The",
"BGP",
"speaker",
"tries",
"to",
"establish",
"a",
"bgp",
"session",
"with",
"the",
"peer",
"(",
"accepts",
"a",
"connection",
"from",
"the",
"peer",
"and",
"also",
"tries",
"to",
"connect"... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L410-L557 | [
"def",
"neighbor_add",
"(",
"self",
",",
"address",
",",
"remote_as",
",",
"remote_port",
"=",
"DEFAULT_BGP_PORT",
",",
"enable_ipv4",
"=",
"DEFAULT_CAP_MBGP_IPV4",
",",
"enable_ipv6",
"=",
"DEFAULT_CAP_MBGP_IPV6",
",",
"enable_vpnv4",
"=",
"DEFAULT_CAP_MBGP_VPNV4",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.neighbor_update | This method changes the neighbor configuration.
``address`` specifies the IP address of the peer.
``conf_type`` specifies configuration type which you want to change.
Currently ryu.services.protocols.bgp.bgpspeaker.MULTI_EXIT_DISC
can be specified.
``conf_value`` specifies val... | ryu/services/protocols/bgp/bgpspeaker.py | def neighbor_update(self, address, conf_type, conf_value):
""" This method changes the neighbor configuration.
``address`` specifies the IP address of the peer.
``conf_type`` specifies configuration type which you want to change.
Currently ryu.services.protocols.bgp.bgpspeaker.MULTI_EX... | def neighbor_update(self, address, conf_type, conf_value):
""" This method changes the neighbor configuration.
``address`` specifies the IP address of the peer.
``conf_type`` specifies configuration type which you want to change.
Currently ryu.services.protocols.bgp.bgpspeaker.MULTI_EX... | [
"This",
"method",
"changes",
"the",
"neighbor",
"configuration",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L584-L608 | [
"def",
"neighbor_update",
"(",
"self",
",",
"address",
",",
"conf_type",
",",
"conf_value",
")",
":",
"assert",
"conf_type",
"==",
"MULTI_EXIT_DISC",
"or",
"conf_type",
"==",
"CONNECT_MODE",
"func_name",
"=",
"'neighbor.update'",
"attribute_param",
"=",
"{",
"}",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.neighbor_state_get | This method returns the state of peer(s) in a json
format.
``address`` specifies the address of a peer. If not given, the
state of all the peers return.
``format`` specifies the format of the response.
This parameter must be one of the following.
- 'json' (default)
... | ryu/services/protocols/bgp/bgpspeaker.py | def neighbor_state_get(self, address=None, format='json'):
""" This method returns the state of peer(s) in a json
format.
``address`` specifies the address of a peer. If not given, the
state of all the peers return.
``format`` specifies the format of the response.
This ... | def neighbor_state_get(self, address=None, format='json'):
""" This method returns the state of peer(s) in a json
format.
``address`` specifies the address of a peer. If not given, the
state of all the peers return.
``format`` specifies the format of the response.
This ... | [
"This",
"method",
"returns",
"the",
"state",
"of",
"peer",
"(",
"s",
")",
"in",
"a",
"json",
"format",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L610-L630 | [
"def",
"neighbor_state_get",
"(",
"self",
",",
"address",
"=",
"None",
",",
"format",
"=",
"'json'",
")",
":",
"show",
"=",
"{",
"'params'",
":",
"[",
"'neighbor'",
",",
"'summary'",
"]",
",",
"'format'",
":",
"format",
",",
"}",
"if",
"address",
":",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.prefix_add | This method adds a new prefix to be advertised.
``prefix`` must be the string representation of an IP network
(e.g., 10.1.1.0/24).
``next_hop`` specifies the next hop address for this
prefix. This parameter is necessary for only VPNv4 and VPNv6
address families.
``rout... | ryu/services/protocols/bgp/bgpspeaker.py | def prefix_add(self, prefix, next_hop=None, route_dist=None):
""" This method adds a new prefix to be advertised.
``prefix`` must be the string representation of an IP network
(e.g., 10.1.1.0/24).
``next_hop`` specifies the next hop address for this
prefix. This parameter is ne... | def prefix_add(self, prefix, next_hop=None, route_dist=None):
""" This method adds a new prefix to be advertised.
``prefix`` must be the string representation of an IP network
(e.g., 10.1.1.0/24).
``next_hop`` specifies the next hop address for this
prefix. This parameter is ne... | [
"This",
"method",
"adds",
"a",
"new",
"prefix",
"to",
"be",
"advertised",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L632-L665 | [
"def",
"prefix_add",
"(",
"self",
",",
"prefix",
",",
"next_hop",
"=",
"None",
",",
"route_dist",
"=",
"None",
")",
":",
"func_name",
"=",
"'network.add'",
"networks",
"=",
"{",
"PREFIX",
":",
"prefix",
",",
"}",
"if",
"next_hop",
":",
"networks",
"[",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.prefix_del | This method deletes a advertised prefix.
``prefix`` must be the string representation of an IP network.
``route_dist`` specifies a route distinguisher value. | ryu/services/protocols/bgp/bgpspeaker.py | def prefix_del(self, prefix, route_dist=None):
""" This method deletes a advertised prefix.
``prefix`` must be the string representation of an IP network.
``route_dist`` specifies a route distinguisher value.
"""
func_name = 'network.del'
networks = {
PREFIX... | def prefix_del(self, prefix, route_dist=None):
""" This method deletes a advertised prefix.
``prefix`` must be the string representation of an IP network.
``route_dist`` specifies a route distinguisher value.
"""
func_name = 'network.del'
networks = {
PREFIX... | [
"This",
"method",
"deletes",
"a",
"advertised",
"prefix",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L667-L686 | [
"def",
"prefix_del",
"(",
"self",
",",
"prefix",
",",
"route_dist",
"=",
"None",
")",
":",
"func_name",
"=",
"'network.del'",
"networks",
"=",
"{",
"PREFIX",
":",
"prefix",
",",
"}",
"if",
"route_dist",
":",
"func_name",
"=",
"'prefix.delete_local'",
"networ... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.evpn_prefix_add | This method adds a new EVPN route to be advertised.
``route_type`` specifies one of the EVPN route type name.
This parameter must be one of the following.
- EVPN_ETH_AUTO_DISCOVERY = 'eth_ad'
- EVPN_MAC_IP_ADV_ROUTE = 'mac_ip_adv'
- EVPN_MULTICAST_ETAG_ROUTE = 'multicast_... | ryu/services/protocols/bgp/bgpspeaker.py | def evpn_prefix_add(self, route_type, route_dist, esi=0,
ethernet_tag_id=None, mac_addr=None, ip_addr=None,
ip_prefix=None, gw_ip_addr=None, vni=None,
next_hop=None, tunnel_type=None, pmsi_tunnel_type=None,
redundancy_mode=N... | def evpn_prefix_add(self, route_type, route_dist, esi=0,
ethernet_tag_id=None, mac_addr=None, ip_addr=None,
ip_prefix=None, gw_ip_addr=None, vni=None,
next_hop=None, tunnel_type=None, pmsi_tunnel_type=None,
redundancy_mode=N... | [
"This",
"method",
"adds",
"a",
"new",
"EVPN",
"route",
"to",
"be",
"advertised",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L688-L836 | [
"def",
"evpn_prefix_add",
"(",
"self",
",",
"route_type",
",",
"route_dist",
",",
"esi",
"=",
"0",
",",
"ethernet_tag_id",
"=",
"None",
",",
"mac_addr",
"=",
"None",
",",
"ip_addr",
"=",
"None",
",",
"ip_prefix",
"=",
"None",
",",
"gw_ip_addr",
"=",
"Non... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.evpn_prefix_del | This method deletes an advertised EVPN route.
``route_type`` specifies one of the EVPN route type name.
``route_dist`` specifies a route distinguisher value.
``esi`` is an value to specify the Ethernet Segment Identifier.
``ethernet_tag_id`` specifies the Ethernet Tag ID.
``... | ryu/services/protocols/bgp/bgpspeaker.py | def evpn_prefix_del(self, route_type, route_dist, esi=0,
ethernet_tag_id=None, mac_addr=None, ip_addr=None,
ip_prefix=None):
""" This method deletes an advertised EVPN route.
``route_type`` specifies one of the EVPN route type name.
``route_dist`... | def evpn_prefix_del(self, route_type, route_dist, esi=0,
ethernet_tag_id=None, mac_addr=None, ip_addr=None,
ip_prefix=None):
""" This method deletes an advertised EVPN route.
``route_type`` specifies one of the EVPN route type name.
``route_dist`... | [
"This",
"method",
"deletes",
"an",
"advertised",
"EVPN",
"route",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L838-L893 | [
"def",
"evpn_prefix_del",
"(",
"self",
",",
"route_type",
",",
"route_dist",
",",
"esi",
"=",
"0",
",",
"ethernet_tag_id",
"=",
"None",
",",
"mac_addr",
"=",
"None",
",",
"ip_addr",
"=",
"None",
",",
"ip_prefix",
"=",
"None",
")",
":",
"func_name",
"=",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.flowspec_prefix_add | This method adds a new Flow Specification prefix to be advertised.
``flowspec_family`` specifies one of the flowspec family name.
This parameter must be one of the following.
- FLOWSPEC_FAMILY_IPV4 = 'ipv4fs'
- FLOWSPEC_FAMILY_IPV6 = 'ipv6fs'
- FLOWSPEC_FAMILY_VPNV4 = 'vpnv4f... | ryu/services/protocols/bgp/bgpspeaker.py | def flowspec_prefix_add(self, flowspec_family, rules, route_dist=None,
actions=None):
""" This method adds a new Flow Specification prefix to be advertised.
``flowspec_family`` specifies one of the flowspec family name.
This parameter must be one of the following.
... | def flowspec_prefix_add(self, flowspec_family, rules, route_dist=None,
actions=None):
""" This method adds a new Flow Specification prefix to be advertised.
``flowspec_family`` specifies one of the flowspec family name.
This parameter must be one of the following.
... | [
"This",
"method",
"adds",
"a",
"new",
"Flow",
"Specification",
"prefix",
"to",
"be",
"advertised",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L895-L1000 | [
"def",
"flowspec_prefix_add",
"(",
"self",
",",
"flowspec_family",
",",
"rules",
",",
"route_dist",
"=",
"None",
",",
"actions",
"=",
"None",
")",
":",
"func_name",
"=",
"'flowspec.add'",
"# Set required arguments",
"kwargs",
"=",
"{",
"FLOWSPEC_FAMILY",
":",
"f... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.flowspec_prefix_del | This method deletes an advertised Flow Specification route.
``flowspec_family`` specifies one of the flowspec family name.
``rules`` specifies NLRIs of Flow Specification as
a dictionary type value.
``route_dist`` specifies a route distinguisher value. | ryu/services/protocols/bgp/bgpspeaker.py | def flowspec_prefix_del(self, flowspec_family, rules, route_dist=None):
""" This method deletes an advertised Flow Specification route.
``flowspec_family`` specifies one of the flowspec family name.
``rules`` specifies NLRIs of Flow Specification as
a dictionary type value.
``... | def flowspec_prefix_del(self, flowspec_family, rules, route_dist=None):
""" This method deletes an advertised Flow Specification route.
``flowspec_family`` specifies one of the flowspec family name.
``rules`` specifies NLRIs of Flow Specification as
a dictionary type value.
``... | [
"This",
"method",
"deletes",
"an",
"advertised",
"Flow",
"Specification",
"route",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1002-L1025 | [
"def",
"flowspec_prefix_del",
"(",
"self",
",",
"flowspec_family",
",",
"rules",
",",
"route_dist",
"=",
"None",
")",
":",
"func_name",
"=",
"'flowspec.del'",
"# Set required arguments",
"kwargs",
"=",
"{",
"FLOWSPEC_FAMILY",
":",
"flowspec_family",
",",
"FLOWSPEC_R... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.vrf_add | This method adds a new vrf used for VPN.
``route_dist`` specifies a route distinguisher value.
``import_rts`` specifies a list of route targets to be imported.
``export_rts`` specifies a list of route targets to be exported.
``site_of_origins`` specifies site_of_origin values.
... | ryu/services/protocols/bgp/bgpspeaker.py | def vrf_add(self, route_dist, import_rts, export_rts, site_of_origins=None,
route_family=RF_VPN_V4, multi_exit_disc=None):
""" This method adds a new vrf used for VPN.
``route_dist`` specifies a route distinguisher value.
``import_rts`` specifies a list of route targets to be i... | def vrf_add(self, route_dist, import_rts, export_rts, site_of_origins=None,
route_family=RF_VPN_V4, multi_exit_disc=None):
""" This method adds a new vrf used for VPN.
``route_dist`` specifies a route distinguisher value.
``import_rts`` specifies a list of route targets to be i... | [
"This",
"method",
"adds",
"a",
"new",
"vrf",
"used",
"for",
"VPN",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1027-L1065 | [
"def",
"vrf_add",
"(",
"self",
",",
"route_dist",
",",
"import_rts",
",",
"export_rts",
",",
"site_of_origins",
"=",
"None",
",",
"route_family",
"=",
"RF_VPN_V4",
",",
"multi_exit_disc",
"=",
"None",
")",
":",
"if",
"route_family",
"not",
"in",
"SUPPORTED_VRF... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.vrfs_get | This method returns the existing vrfs.
``subcommand`` specifies one of the following.
- 'routes': shows routes present for vrf
- 'summary': shows configuration and summary of vrf
``route_dist`` specifies a route distinguisher value.
If route_family is not 'all', this value mus... | ryu/services/protocols/bgp/bgpspeaker.py | def vrfs_get(self, subcommand='routes', route_dist=None,
route_family='all', format='json'):
""" This method returns the existing vrfs.
``subcommand`` specifies one of the following.
- 'routes': shows routes present for vrf
- 'summary': shows configuration and summary ... | def vrfs_get(self, subcommand='routes', route_dist=None,
route_family='all', format='json'):
""" This method returns the existing vrfs.
``subcommand`` specifies one of the following.
- 'routes': shows routes present for vrf
- 'summary': shows configuration and summary ... | [
"This",
"method",
"returns",
"the",
"existing",
"vrfs",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1077-L1112 | [
"def",
"vrfs_get",
"(",
"self",
",",
"subcommand",
"=",
"'routes'",
",",
"route_dist",
"=",
"None",
",",
"route_family",
"=",
"'all'",
",",
"format",
"=",
"'json'",
")",
":",
"show",
"=",
"{",
"'format'",
":",
"format",
",",
"}",
"if",
"route_family",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.neighbor_get | This method returns the BGP adj-RIB-in/adj-RIB-out information
in a json format.
``route_type`` This parameter is necessary for only received-routes
and sent-routes.
- received-routes : paths received and not withdrawn by given peer
- sent-routes : paths sent and not withdrawn ... | ryu/services/protocols/bgp/bgpspeaker.py | def neighbor_get(self, route_type, address, format='json'):
""" This method returns the BGP adj-RIB-in/adj-RIB-out information
in a json format.
``route_type`` This parameter is necessary for only received-routes
and sent-routes.
- received-routes : paths received and not withd... | def neighbor_get(self, route_type, address, format='json'):
""" This method returns the BGP adj-RIB-in/adj-RIB-out information
in a json format.
``route_type`` This parameter is necessary for only received-routes
and sent-routes.
- received-routes : paths received and not withd... | [
"This",
"method",
"returns",
"the",
"BGP",
"adj",
"-",
"RIB",
"-",
"in",
"/",
"adj",
"-",
"RIB",
"-",
"out",
"information",
"in",
"a",
"json",
"format",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1133-L1160 | [
"def",
"neighbor_get",
"(",
"self",
",",
"route_type",
",",
"address",
",",
"format",
"=",
"'json'",
")",
":",
"show",
"=",
"{",
"'format'",
":",
"format",
",",
"}",
"if",
"route_type",
"==",
"'sent-routes'",
"or",
"route_type",
"==",
"'received-routes'",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.out_filter_get | This method gets out-filter setting from the specified neighbor.
``address`` specifies the IP address of the peer.
Returns a list object containing an instance of Filter sub-class | ryu/services/protocols/bgp/bgpspeaker.py | def out_filter_get(self, address):
""" This method gets out-filter setting from the specified neighbor.
``address`` specifies the IP address of the peer.
Returns a list object containing an instance of Filter sub-class
"""
func_name = 'neighbor.out_filter.get'
param = ... | def out_filter_get(self, address):
""" This method gets out-filter setting from the specified neighbor.
``address`` specifies the IP address of the peer.
Returns a list object containing an instance of Filter sub-class
"""
func_name = 'neighbor.out_filter.get'
param = ... | [
"This",
"method",
"gets",
"out",
"-",
"filter",
"setting",
"from",
"the",
"specified",
"neighbor",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1227-L1240 | [
"def",
"out_filter_get",
"(",
"self",
",",
"address",
")",
":",
"func_name",
"=",
"'neighbor.out_filter.get'",
"param",
"=",
"{",
"neighbors",
".",
"IP_ADDRESS",
":",
"address",
",",
"}",
"return",
"call",
"(",
"func_name",
",",
"*",
"*",
"param",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.