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
Cmd.do_request
request <peer> <method> <params> send a msgpack-rpc request and print a response. <params> is a python code snippet, it should be eval'ed to a list.
ryu/cmd/rpc_cli.py
def do_request(self, line): """request <peer> <method> <params> send a msgpack-rpc request and print a response. <params> is a python code snippet, it should be eval'ed to a list. """ def f(p, method, params): result = p.call(method, params) print("RESULT...
def do_request(self, line): """request <peer> <method> <params> send a msgpack-rpc request and print a response. <params> is a python code snippet, it should be eval'ed to a list. """ def f(p, method, params): result = p.call(method, params) print("RESULT...
[ "request", "<peer", ">", "<method", ">", "<params", ">", "send", "a", "msgpack", "-", "rpc", "request", "and", "print", "a", "response", ".", "<params", ">", "is", "a", "python", "code", "snippet", "it", "should", "be", "eval", "ed", "to", "a", "list",...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/rpc_cli.py#L164-L174
[ "def", "do_request", "(", "self", ",", "line", ")", ":", "def", "f", "(", "p", ",", "method", ",", "params", ")", ":", "result", "=", "p", ".", "call", "(", "method", ",", "params", ")", "print", "(", "\"RESULT %s\"", "%", "result", ")", "self", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Cmd.do_notify
notify <peer> <method> <params> send a msgpack-rpc notification. <params> is a python code snippet, it should be eval'ed to a list.
ryu/cmd/rpc_cli.py
def do_notify(self, line): """notify <peer> <method> <params> send a msgpack-rpc notification. <params> is a python code snippet, it should be eval'ed to a list. """ def f(p, method, params): p.send_notification(method, params) self._request(line, f)
def do_notify(self, line): """notify <peer> <method> <params> send a msgpack-rpc notification. <params> is a python code snippet, it should be eval'ed to a list. """ def f(p, method, params): p.send_notification(method, params) self._request(line, f)
[ "notify", "<peer", ">", "<method", ">", "<params", ">", "send", "a", "msgpack", "-", "rpc", "notification", ".", "<params", ">", "is", "a", "python", "code", "snippet", "it", "should", "be", "eval", "ed", "to", "a", "list", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/rpc_cli.py#L176-L185
[ "def", "do_notify", "(", "self", ",", "line", ")", ":", "def", "f", "(", "p", ",", "method", ",", "params", ")", ":", "p", ".", "send_notification", "(", "method", ",", "params", ")", "self", ".", "_request", "(", "line", ",", "f", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPMatch.to_jsondict
Returns a dict expressing the flow match.
ryu/ofproto/ofproto_v1_3_parser.py
def to_jsondict(self): """ Returns a dict expressing the flow match. """ # XXX old api compat if self._composed_with_old_api(): # copy object first because serialize_old is destructive o2 = OFPMatch() o2.fields = self.fields[:] # se...
def to_jsondict(self): """ Returns a dict expressing the flow match. """ # XXX old api compat if self._composed_with_old_api(): # copy object first because serialize_old is destructive o2 = OFPMatch() o2.fields = self.fields[:] # se...
[ "Returns", "a", "dict", "expressing", "the", "flow", "match", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_3_parser.py#L921-L941
[ "def", "to_jsondict", "(", "self", ")", ":", "# XXX old api compat", "if", "self", ".", "_composed_with_old_api", "(", ")", ":", "# copy object first because serialize_old is destructive", "o2", "=", "OFPMatch", "(", ")", "o2", ".", "fields", "=", "self", ".", "fi...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPMatch.from_jsondict
Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown match field is defined in dict
ryu/ofproto/ofproto_v1_3_parser.py
def from_jsondict(cls, dict_): """ Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown match field is defined in dict """ fields = [ofproto.oxm_from_jsondict(f) for f in dict_['oxm_fields']] o = OFPMatch(_orde...
def from_jsondict(cls, dict_): """ Returns an object which is generated from a dict. Exception raises: KeyError -- Unknown match field is defined in dict """ fields = [ofproto.oxm_from_jsondict(f) for f in dict_['oxm_fields']] o = OFPMatch(_orde...
[ "Returns", "an", "object", "which", "is", "generated", "from", "a", "dict", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_3_parser.py#L944-L958
[ "def", "from_jsondict", "(", "cls", ",", "dict_", ")", ":", "fields", "=", "[", "ofproto", ".", "oxm_from_jsondict", "(", "f", ")", "for", "f", "in", "dict_", "[", "'oxm_fields'", "]", "]", "o", "=", "OFPMatch", "(", "_ordered_fields", "=", "fields", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
OFPMatch.append_field
Append a match field. ========= ======================================================= Argument Description ========= ======================================================= header match field header ID which is defined automatically in ``ofproto`` value ...
ryu/ofproto/ofproto_v1_3_parser.py
def append_field(self, header, value, mask=None): """ Append a match field. ========= ======================================================= Argument Description ========= ======================================================= header match field header ID which is ...
def append_field(self, header, value, mask=None): """ Append a match field. ========= ======================================================= Argument Description ========= ======================================================= header match field header ID which is ...
[ "Append", "a", "match", "field", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_v1_3_parser.py#L976-L1036
[ "def", "append_field", "(", "self", ",", "header", ",", "value", ",", "mask", "=", "None", ")", ":", "self", ".", "fields", ".", "append", "(", "OFPMatchField", ".", "make", "(", "header", ",", "value", ",", "mask", ")", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
AttributeMap.evaluate
This method evaluates attributes of the path. Returns the cause and result of matching. Both cause and result are returned from filters that this object contains. ``path`` specifies the path.
ryu/services/protocols/bgp/info_base/base.py
def evaluate(self, path): """ This method evaluates attributes of the path. Returns the cause and result of matching. Both cause and result are returned from filters that this object contains. ``path`` specifies the path. """ result = False cause = None ...
def evaluate(self, path): """ This method evaluates attributes of the path. Returns the cause and result of matching. Both cause and result are returned from filters that this object contains. ``path`` specifies the path. """ result = False cause = None ...
[ "This", "method", "evaluates", "attributes", "of", "the", "path", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/info_base/base.py#L1207-L1225
[ "def", "evaluate", "(", "self", ",", "path", ")", ":", "result", "=", "False", "cause", "=", "None", "for", "f", "in", "self", ".", "filters", ":", "cause", ",", "result", "=", "f", ".", "evaluate", "(", "path", ")", "if", "not", "result", ":", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
AttributeMap.clone
This method clones AttributeMap object. Returns AttributeMap object that has the same values with the original one.
ryu/services/protocols/bgp/info_base/base.py
def clone(self): """ This method clones AttributeMap object. Returns AttributeMap object that has the same values with the original one. """ cloned_filters = [f.clone() for f in self.filters] return self.__class__(cloned_filters, self.attr_type, self.attr_value)
def clone(self): """ This method clones AttributeMap object. Returns AttributeMap object that has the same values with the original one. """ cloned_filters = [f.clone() for f in self.filters] return self.__class__(cloned_filters, self.attr_type, self.attr_value)
[ "This", "method", "clones", "AttributeMap", "object", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/info_base/base.py#L1235-L1243
[ "def", "clone", "(", "self", ")", ":", "cloned_filters", "=", "[", "f", ".", "clone", "(", ")", "for", "f", "in", "self", ".", "filters", "]", "return", "self", ".", "__class__", "(", "cloned_filters", ",", "self", ".", "attr_type", ",", "self", ".",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
PeerState.total_msg_sent
Returns total number of UPDATE, NOTIFICATION and ROUTE_REFRESH message sent to this peer.
ryu/services/protocols/bgp/peer.py
def total_msg_sent(self): """Returns total number of UPDATE, NOTIFICATION and ROUTE_REFRESH message sent to this peer. """ return (self.get_count(PeerCounterNames.SENT_REFRESH) + self.get_count(PeerCounterNames.SENT_UPDATES))
def total_msg_sent(self): """Returns total number of UPDATE, NOTIFICATION and ROUTE_REFRESH message sent to this peer. """ return (self.get_count(PeerCounterNames.SENT_REFRESH) + self.get_count(PeerCounterNames.SENT_UPDATES))
[ "Returns", "total", "number", "of", "UPDATE", "NOTIFICATION", "and", "ROUTE_REFRESH", "message", "sent", "to", "this", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L252-L257
[ "def", "total_msg_sent", "(", "self", ")", ":", "return", "(", "self", ".", "get_count", "(", "PeerCounterNames", ".", "SENT_REFRESH", ")", "+", "self", ".", "get_count", "(", "PeerCounterNames", ".", "SENT_UPDATES", ")", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
PeerState.total_msg_recv
Returns total number of UPDATE, NOTIFICATION and ROUTE_REFRESH messages received from this peer.
ryu/services/protocols/bgp/peer.py
def total_msg_recv(self): """Returns total number of UPDATE, NOTIFICATION and ROUTE_REFRESH messages received from this peer. """ return (self.get_count(PeerCounterNames.RECV_UPDATES) + self.get_count(PeerCounterNames.RECV_REFRESH) + self.get_count(PeerCou...
def total_msg_recv(self): """Returns total number of UPDATE, NOTIFICATION and ROUTE_REFRESH messages received from this peer. """ return (self.get_count(PeerCounterNames.RECV_UPDATES) + self.get_count(PeerCounterNames.RECV_REFRESH) + self.get_count(PeerCou...
[ "Returns", "total", "number", "of", "UPDATE", "NOTIFICATION", "and", "ROUTE_REFRESH", "messages", "received", "from", "this", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L260-L266
[ "def", "total_msg_recv", "(", "self", ")", ":", "return", "(", "self", ".", "get_count", "(", "PeerCounterNames", ".", "RECV_UPDATES", ")", "+", "self", ".", "get_count", "(", "PeerCounterNames", ".", "RECV_REFRESH", ")", "+", "self", ".", "get_count", "(", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
PeerState.get_stats_summary_dict
Returns basic stats. Returns a `dict` with various counts and stats, see below.
ryu/services/protocols/bgp/peer.py
def get_stats_summary_dict(self): """Returns basic stats. Returns a `dict` with various counts and stats, see below. """ uptime = time.time() - self._established_time \ if self._established_time != 0 else -1 return { stats.UPDATE_MSG_IN: self.get_count(Pe...
def get_stats_summary_dict(self): """Returns basic stats. Returns a `dict` with various counts and stats, see below. """ uptime = time.time() - self._established_time \ if self._established_time != 0 else -1 return { stats.UPDATE_MSG_IN: self.get_count(Pe...
[ "Returns", "basic", "stats", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L268-L286
[ "def", "get_stats_summary_dict", "(", "self", ")", ":", "uptime", "=", "time", ".", "time", "(", ")", "-", "self", ".", "_established_time", "if", "self", ".", "_established_time", "!=", "0", "else", "-", "1", "return", "{", "stats", ".", "UPDATE_MSG_IN", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.on_update_enabled
Implements neighbor configuration change listener.
ryu/services/protocols/bgp/peer.py
def on_update_enabled(self, conf_evt): """Implements neighbor configuration change listener. """ enabled = conf_evt.value # If we do not have any protocol bound and configuration asks us to # enable this peer, we try to establish connection again. if enabled: ...
def on_update_enabled(self, conf_evt): """Implements neighbor configuration change listener. """ enabled = conf_evt.value # If we do not have any protocol bound and configuration asks us to # enable this peer, we try to establish connection again. if enabled: ...
[ "Implements", "neighbor", "configuration", "change", "listener", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L536-L570
[ "def", "on_update_enabled", "(", "self", ",", "conf_evt", ")", ":", "enabled", "=", "conf_evt", ".", "value", "# If we do not have any protocol bound and configuration asks us to", "# enable this peer, we try to establish connection again.", "if", "enabled", ":", "LOG", ".", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._send_outgoing_route_refresh_msg
Sends given message `rr_msg` to peer. Parameters: - rr_msg: (RouteRefresh) route refresh message to send to peer. Update appropriate counters and set appropriate timers.
ryu/services/protocols/bgp/peer.py
def _send_outgoing_route_refresh_msg(self, rr_msg): """Sends given message `rr_msg` to peer. Parameters: - rr_msg: (RouteRefresh) route refresh message to send to peer. Update appropriate counters and set appropriate timers. """ assert rr_msg.type == BGP_MSG_ROUTE_R...
def _send_outgoing_route_refresh_msg(self, rr_msg): """Sends given message `rr_msg` to peer. Parameters: - rr_msg: (RouteRefresh) route refresh message to send to peer. Update appropriate counters and set appropriate timers. """ assert rr_msg.type == BGP_MSG_ROUTE_R...
[ "Sends", "given", "message", "rr_msg", "to", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L685-L707
[ "def", "_send_outgoing_route_refresh_msg", "(", "self", ",", "rr_msg", ")", ":", "assert", "rr_msg", ".", "type", "==", "BGP_MSG_ROUTE_REFRESH", "self", ".", "_protocol", ".", "send", "(", "rr_msg", ")", "LOG", ".", "debug", "(", "'RouteRefresh %s>> %s'", ",", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._send_outgoing_route
Constructs `Update` message from given `outgoing_route` and sends it to peer. Also, checks if any policies prevent sending this message. Populates Adj-RIB-out with corresponding `SentRoute`.
ryu/services/protocols/bgp/peer.py
def _send_outgoing_route(self, outgoing_route): """Constructs `Update` message from given `outgoing_route` and sends it to peer. Also, checks if any policies prevent sending this message. Populates Adj-RIB-out with corresponding `SentRoute`. """ path = outgoing_route.pa...
def _send_outgoing_route(self, outgoing_route): """Constructs `Update` message from given `outgoing_route` and sends it to peer. Also, checks if any policies prevent sending this message. Populates Adj-RIB-out with corresponding `SentRoute`. """ path = outgoing_route.pa...
[ "Constructs", "Update", "message", "from", "given", "outgoing_route", "and", "sends", "it", "to", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L709-L742
[ "def", "_send_outgoing_route", "(", "self", ",", "outgoing_route", ")", ":", "path", "=", "outgoing_route", ".", "path", "block", ",", "blocked_cause", "=", "self", ".", "_apply_out_filter", "(", "path", ")", "nlri_str", "=", "outgoing_route", ".", "path", "."...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.request_route_refresh
Request route refresh to peer for given `route_families`. If no `route_families` are given, we make request for all supported route families with this peer. Parameters: - `route_families`: list of route families to request route refresh for. If this peer is cu...
ryu/services/protocols/bgp/peer.py
def request_route_refresh(self, *route_families): """Request route refresh to peer for given `route_families`. If no `route_families` are given, we make request for all supported route families with this peer. Parameters: - `route_families`: list of route families to reque...
def request_route_refresh(self, *route_families): """Request route refresh to peer for given `route_families`. If no `route_families` are given, we make request for all supported route families with this peer. Parameters: - `route_families`: list of route families to reque...
[ "Request", "route", "refresh", "to", "peer", "for", "given", "route_families", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L778-L816
[ "def", "request_route_refresh", "(", "self", ",", "*", "route_families", ")", ":", "# If this peer has not established session yet", "if", "not", "self", ".", "in_established", ":", "raise", "ValueError", "(", "'Peer not in established state to satisfy'", "' this request.'", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._session_next_hop
Returns nexthop address relevant to current session Nexthop used can depend on capabilities of the session. If VPNv6 capability is active and session is on IPv4 connection, we have to use IPv4 mapped IPv6 address. In other cases we can use connection end point/local ip address.
ryu/services/protocols/bgp/peer.py
def _session_next_hop(self, path): """Returns nexthop address relevant to current session Nexthop used can depend on capabilities of the session. If VPNv6 capability is active and session is on IPv4 connection, we have to use IPv4 mapped IPv6 address. In other cases we can use connectio...
def _session_next_hop(self, path): """Returns nexthop address relevant to current session Nexthop used can depend on capabilities of the session. If VPNv6 capability is active and session is on IPv4 connection, we have to use IPv4 mapped IPv6 address. In other cases we can use connectio...
[ "Returns", "nexthop", "address", "relevant", "to", "current", "session" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L826-L844
[ "def", "_session_next_hop", "(", "self", ",", "path", ")", ":", "route_family", "=", "path", ".", "route_family", "# By default we use BGPS's interface IP with this peer as next_hop.", "if", "self", ".", "_neigh_conf", ".", "next_hop", ":", "next_hop", "=", "self", "....
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._construct_as_path_attr
Marge AS_PATH and AS4_PATH attribute instances into a single AS_PATH instance.
ryu/services/protocols/bgp/peer.py
def _construct_as_path_attr(self, as_path_attr, as4_path_attr): """Marge AS_PATH and AS4_PATH attribute instances into a single AS_PATH instance.""" def _listify(li): """Reconstruct AS_PATH list. Example:: >>> _listify([[1, 2, 3], {4, 5}, [6, 7]]) ...
def _construct_as_path_attr(self, as_path_attr, as4_path_attr): """Marge AS_PATH and AS4_PATH attribute instances into a single AS_PATH instance.""" def _listify(li): """Reconstruct AS_PATH list. Example:: >>> _listify([[1, 2, 3], {4, 5}, [6, 7]]) ...
[ "Marge", "AS_PATH", "and", "AS4_PATH", "attribute", "instances", "into", "a", "single", "AS_PATH", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L852-L914
[ "def", "_construct_as_path_attr", "(", "self", ",", "as_path_attr", ",", "as4_path_attr", ")", ":", "def", "_listify", "(", "li", ")", ":", "\"\"\"Reconstruct AS_PATH list.\n\n Example::\n\n >>> _listify([[1, 2, 3], {4, 5}, [6, 7]])\n [1, 2, 3...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._trans_as_path
Translates Four-Octet AS number to AS_TRANS and separates AS_PATH list into AS_PATH and AS4_PATH lists if needed. If the neighbor does not support Four-Octet AS number, this method constructs AS4_PATH list from AS_PATH list and swaps non-mappable AS number in AS_PATH with AS_TRANS, then...
ryu/services/protocols/bgp/peer.py
def _trans_as_path(self, as_path_list): """Translates Four-Octet AS number to AS_TRANS and separates AS_PATH list into AS_PATH and AS4_PATH lists if needed. If the neighbor does not support Four-Octet AS number, this method constructs AS4_PATH list from AS_PATH list and swaps no...
def _trans_as_path(self, as_path_list): """Translates Four-Octet AS number to AS_TRANS and separates AS_PATH list into AS_PATH and AS4_PATH lists if needed. If the neighbor does not support Four-Octet AS number, this method constructs AS4_PATH list from AS_PATH list and swaps no...
[ "Translates", "Four", "-", "Octet", "AS", "number", "to", "AS_TRANS", "and", "separates", "AS_PATH", "list", "into", "AS_PATH", "and", "AS4_PATH", "lists", "if", "needed", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L916-L968
[ "def", "_trans_as_path", "(", "self", ",", "as_path_list", ")", ":", "def", "_swap", "(", "n", ")", ":", "if", "is_valid_old_asn", "(", "n", ")", ":", "# mappable", "return", "n", "else", ":", "# non-mappable", "return", "bgp", ".", "AS_TRANS", "# If the n...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._construct_update
Construct update message with Outgoing-routes path attribute appropriately cloned/copied/updated.
ryu/services/protocols/bgp/peer.py
def _construct_update(self, outgoing_route): """Construct update message with Outgoing-routes path attribute appropriately cloned/copied/updated. """ update = None path = outgoing_route.path # Get copy of path's path attributes. pathattr_map = path.pathattr_map ...
def _construct_update(self, outgoing_route): """Construct update message with Outgoing-routes path attribute appropriately cloned/copied/updated. """ update = None path = outgoing_route.path # Get copy of path's path attributes. pathattr_map = path.pathattr_map ...
[ "Construct", "update", "message", "with", "Outgoing", "-", "routes", "path", "attribute", "appropriately", "cloned", "/", "copied", "/", "updated", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L970-L1254
[ "def", "_construct_update", "(", "self", ",", "outgoing_route", ")", ":", "update", "=", "None", "path", "=", "outgoing_route", ".", "path", "# Get copy of path's path attributes.", "pathattr_map", "=", "path", ".", "pathattr_map", "new_pathattr", "=", "[", "]", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._connect_loop
In the current greenlet we try to establish connection with peer. This greenlet will spin another greenlet to handle incoming data from the peer once connection is established.
ryu/services/protocols/bgp/peer.py
def _connect_loop(self, client_factory): """In the current greenlet we try to establish connection with peer. This greenlet will spin another greenlet to handle incoming data from the peer once connection is established. """ # If current configuration allow, enable active sessio...
def _connect_loop(self, client_factory): """In the current greenlet we try to establish connection with peer. This greenlet will spin another greenlet to handle incoming data from the peer once connection is established. """ # If current configuration allow, enable active sessio...
[ "In", "the", "current", "greenlet", "we", "try", "to", "establish", "connection", "with", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1256-L1312
[ "def", "_connect_loop", "(", "self", ",", "client_factory", ")", ":", "# If current configuration allow, enable active session establishment.", "if", "self", ".", "_neigh_conf", ".", "enabled", ":", "self", ".", "_connect_retry_event", ".", "set", "(", ")", "while", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.bind_protocol
Tries to bind given protocol to this peer. Should only be called by `proto` trying to bind. Once bound this protocol instance will be used to communicate with peer. If another protocol is already bound, connection collision resolution takes place.
ryu/services/protocols/bgp/peer.py
def bind_protocol(self, proto): """Tries to bind given protocol to this peer. Should only be called by `proto` trying to bind. Once bound this protocol instance will be used to communicate with peer. If another protocol is already bound, connection collision resolution takes pla...
def bind_protocol(self, proto): """Tries to bind given protocol to this peer. Should only be called by `proto` trying to bind. Once bound this protocol instance will be used to communicate with peer. If another protocol is already bound, connection collision resolution takes pla...
[ "Tries", "to", "bind", "given", "protocol", "to", "this", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1338-L1411
[ "def", "bind_protocol", "(", "self", ",", "proto", ")", ":", "LOG", ".", "debug", "(", "'Trying to bind protocol %s to peer %s'", ",", "proto", ",", "self", ")", "# Validate input.", "if", "not", "isinstance", "(", "proto", ",", "BgpProtocol", ")", ":", "raise...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.create_open_msg
Create `Open` message using current settings. Current setting include capabilities, timers and ids.
ryu/services/protocols/bgp/peer.py
def create_open_msg(self): """Create `Open` message using current settings. Current setting include capabilities, timers and ids. """ asnum = self.local_as # If local AS number is not Two-Octet AS number, swaps with AS_TRANS. if not is_valid_old_asn(asnum): a...
def create_open_msg(self): """Create `Open` message using current settings. Current setting include capabilities, timers and ids. """ asnum = self.local_as # If local AS number is not Two-Octet AS number, swaps with AS_TRANS. if not is_valid_old_asn(asnum): a...
[ "Create", "Open", "message", "using", "current", "settings", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1413-L1441
[ "def", "create_open_msg", "(", "self", ")", ":", "asnum", "=", "self", ".", "local_as", "# If local AS number is not Two-Octet AS number, swaps with AS_TRANS.", "if", "not", "is_valid_old_asn", "(", "asnum", ")", ":", "asnum", "=", "bgp", ".", "AS_TRANS", "bgpid", "...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._validate_update_msg
Validate update message as per RFC. Here we validate the message after it has been parsed. Message has already been validated against some errors inside parsing library.
ryu/services/protocols/bgp/peer.py
def _validate_update_msg(self, update_msg): """Validate update message as per RFC. Here we validate the message after it has been parsed. Message has already been validated against some errors inside parsing library. """ # TODO(PH): finish providing implementation, curre...
def _validate_update_msg(self, update_msg): """Validate update message as per RFC. Here we validate the message after it has been parsed. Message has already been validated against some errors inside parsing library. """ # TODO(PH): finish providing implementation, curre...
[ "Validate", "update", "message", "as", "per", "RFC", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1443-L1541
[ "def", "_validate_update_msg", "(", "self", ",", "update_msg", ")", ":", "# TODO(PH): finish providing implementation, currently low priority", "assert", "update_msg", ".", "type", "==", "BGP_MSG_UPDATE", "# An UPDATE message may be received only in the Established state.", "# Receiv...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._handle_update_msg
Extracts and processes new paths or withdrawals in given `update_msg`. Parameter: - `update_msg`: update message to process. - `valid_rts`: current valid/interesting rts to the application according to configuration of all VRFs. Assumes Multiprotocol Extensi...
ryu/services/protocols/bgp/peer.py
def _handle_update_msg(self, update_msg): """Extracts and processes new paths or withdrawals in given `update_msg`. Parameter: - `update_msg`: update message to process. - `valid_rts`: current valid/interesting rts to the application according to configurati...
def _handle_update_msg(self, update_msg): """Extracts and processes new paths or withdrawals in given `update_msg`. Parameter: - `update_msg`: update message to process. - `valid_rts`: current valid/interesting rts to the application according to configurati...
[ "Extracts", "and", "processes", "new", "paths", "or", "withdrawals", "in", "given", "update_msg", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1543-L1590
[ "def", "_handle_update_msg", "(", "self", ",", "update_msg", ")", ":", "assert", "self", ".", "state", ".", "bgp_state", "==", "const", ".", "BGP_FSM_ESTABLISHED", "# Increment count of update received.", "self", ".", "state", ".", "incr", "(", "PeerCounterNames", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._extract_and_reconstruct_as_path
Extracts advertised AS path attributes in the given update message and reconstructs AS_PATH from AS_PATH and AS4_PATH if needed.
ryu/services/protocols/bgp/peer.py
def _extract_and_reconstruct_as_path(self, update_msg): """Extracts advertised AS path attributes in the given update message and reconstructs AS_PATH from AS_PATH and AS4_PATH if needed.""" umsg_pattrs = update_msg.pathattr_map as_aggregator = umsg_pattrs.get(BGP_ATTR_TYPE_AGGREGATOR, ...
def _extract_and_reconstruct_as_path(self, update_msg): """Extracts advertised AS path attributes in the given update message and reconstructs AS_PATH from AS_PATH and AS4_PATH if needed.""" umsg_pattrs = update_msg.pathattr_map as_aggregator = umsg_pattrs.get(BGP_ATTR_TYPE_AGGREGATOR, ...
[ "Extracts", "advertised", "AS", "path", "attributes", "in", "the", "given", "update", "message", "and", "reconstructs", "AS_PATH", "from", "AS_PATH", "and", "AS4_PATH", "if", "needed", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1592-L1652
[ "def", "_extract_and_reconstruct_as_path", "(", "self", ",", "update_msg", ")", ":", "umsg_pattrs", "=", "update_msg", ".", "pathattr_map", "as_aggregator", "=", "umsg_pattrs", ".", "get", "(", "BGP_ATTR_TYPE_AGGREGATOR", ",", "None", ")", "as4_aggregator", "=", "um...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._is_looped_path_attrs
Extracts path attributes from the given UPDATE message and checks if the given attributes have loops or not. :param update_msg: UPDATE message instance. :return: True if attributes have loops. Otherwise False.
ryu/services/protocols/bgp/peer.py
def _is_looped_path_attrs(self, update_msg): """ Extracts path attributes from the given UPDATE message and checks if the given attributes have loops or not. :param update_msg: UPDATE message instance. :return: True if attributes have loops. Otherwise False. """ ...
def _is_looped_path_attrs(self, update_msg): """ Extracts path attributes from the given UPDATE message and checks if the given attributes have loops or not. :param update_msg: UPDATE message instance. :return: True if attributes have loops. Otherwise False. """ ...
[ "Extracts", "path", "attributes", "from", "the", "given", "UPDATE", "message", "and", "checks", "if", "the", "given", "attributes", "have", "loops", "or", "not", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1654-L1694
[ "def", "_is_looped_path_attrs", "(", "self", ",", "update_msg", ")", ":", "umsg_pattrs", "=", "update_msg", ".", "pathattr_map", "recv_open_msg", "=", "self", ".", "protocol", ".", "recv_open_msg", "# Check if AS_PATH has loops.", "aspath", "=", "umsg_pattrs", ".", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._extract_and_handle_bgp4_new_paths
Extracts new paths advertised in the given update message's *MpReachNlri* attribute. Assumes MPBGP capability is enabled and message was validated. Parameters: - update_msg: (Update) is assumed to be checked for all bgp message errors. - valid_rts: (iterable...
ryu/services/protocols/bgp/peer.py
def _extract_and_handle_bgp4_new_paths(self, update_msg): """Extracts new paths advertised in the given update message's *MpReachNlri* attribute. Assumes MPBGP capability is enabled and message was validated. Parameters: - update_msg: (Update) is assumed to be checked for a...
def _extract_and_handle_bgp4_new_paths(self, update_msg): """Extracts new paths advertised in the given update message's *MpReachNlri* attribute. Assumes MPBGP capability is enabled and message was validated. Parameters: - update_msg: (Update) is assumed to be checked for a...
[ "Extracts", "new", "paths", "advertised", "in", "the", "given", "update", "message", "s", "*", "MpReachNlri", "*", "attribute", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1696-L1753
[ "def", "_extract_and_handle_bgp4_new_paths", "(", "self", ",", "update_msg", ")", ":", "umsg_pattrs", "=", "update_msg", ".", "pathattr_map", "next_hop", "=", "update_msg", ".", "get_path_attr", "(", "BGP_ATTR_TYPE_NEXT_HOP", ")", ".", "value", "# Nothing to do if we do...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._extract_and_handle_bgp4_withdraws
Extracts withdraws advertised in the given update message's *MpUnReachNlri* attribute. Assumes MPBGP capability is enabled. Parameters: - update_msg: (Update) is assumed to be checked for all bgp message errors. Extracted withdraws are added to appropriate *Des...
ryu/services/protocols/bgp/peer.py
def _extract_and_handle_bgp4_withdraws(self, withdraw_list): """Extracts withdraws advertised in the given update message's *MpUnReachNlri* attribute. Assumes MPBGP capability is enabled. Parameters: - update_msg: (Update) is assumed to be checked for all bgp me...
def _extract_and_handle_bgp4_withdraws(self, withdraw_list): """Extracts withdraws advertised in the given update message's *MpUnReachNlri* attribute. Assumes MPBGP capability is enabled. Parameters: - update_msg: (Update) is assumed to be checked for all bgp me...
[ "Extracts", "withdraws", "advertised", "in", "the", "given", "update", "message", "s", "*", "MpUnReachNlri", "*", "attribute", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1755-L1795
[ "def", "_extract_and_handle_bgp4_withdraws", "(", "self", ",", "withdraw_list", ")", ":", "msg_rf", "=", "RF_IPv4_UC", "w_nlris", "=", "withdraw_list", "if", "not", "w_nlris", ":", "# If this is EOR of some kind, handle it", "self", ".", "_handle_eor", "(", "msg_rf", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._extract_and_handle_mpbgp_new_paths
Extracts new paths advertised in the given update message's *MpReachNlri* attribute. Assumes MPBGP capability is enabled and message was validated. Parameters: - update_msg: (Update) is assumed to be checked for all bgp message errors. - valid_rts: (iterable...
ryu/services/protocols/bgp/peer.py
def _extract_and_handle_mpbgp_new_paths(self, update_msg): """Extracts new paths advertised in the given update message's *MpReachNlri* attribute. Assumes MPBGP capability is enabled and message was validated. Parameters: - update_msg: (Update) is assumed to be checked for ...
def _extract_and_handle_mpbgp_new_paths(self, update_msg): """Extracts new paths advertised in the given update message's *MpReachNlri* attribute. Assumes MPBGP capability is enabled and message was validated. Parameters: - update_msg: (Update) is assumed to be checked for ...
[ "Extracts", "new", "paths", "advertised", "in", "the", "given", "update", "message", "s", "*", "MpReachNlri", "*", "attribute", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1797-L1896
[ "def", "_extract_and_handle_mpbgp_new_paths", "(", "self", ",", "update_msg", ")", ":", "umsg_pattrs", "=", "update_msg", ".", "pathattr_map", "mpreach_nlri_attr", "=", "umsg_pattrs", ".", "get", "(", "BGP_ATTR_TYPE_MP_REACH_NLRI", ")", "assert", "mpreach_nlri_attr", "m...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._extract_and_handle_mpbgp_withdraws
Extracts withdraws advertised in the given update message's *MpUnReachNlri* attribute. Assumes MPBGP capability is enabled. Parameters: - update_msg: (Update) is assumed to be checked for all bgp message errors. Extracted withdraws are added to appropriate *Des...
ryu/services/protocols/bgp/peer.py
def _extract_and_handle_mpbgp_withdraws(self, mp_unreach_attr): """Extracts withdraws advertised in the given update message's *MpUnReachNlri* attribute. Assumes MPBGP capability is enabled. Parameters: - update_msg: (Update) is assumed to be checked for all bgp ...
def _extract_and_handle_mpbgp_withdraws(self, mp_unreach_attr): """Extracts withdraws advertised in the given update message's *MpUnReachNlri* attribute. Assumes MPBGP capability is enabled. Parameters: - update_msg: (Update) is assumed to be checked for all bgp ...
[ "Extracts", "withdraws", "advertised", "in", "the", "given", "update", "message", "s", "*", "MpUnReachNlri", "*", "attribute", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1898-L1945
[ "def", "_extract_and_handle_mpbgp_withdraws", "(", "self", ",", "mp_unreach_attr", ")", ":", "msg_rf", "=", "mp_unreach_attr", ".", "route_family", "# Check if this route family is among supported route families.", "if", "msg_rf", "not", "in", "SUPPORTED_GLOBAL_RF", ":", "LOG...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._handle_eor
Currently we only handle EOR for RTC address-family. We send non-rtc initial updates if not already sent.
ryu/services/protocols/bgp/peer.py
def _handle_eor(self, route_family): """Currently we only handle EOR for RTC address-family. We send non-rtc initial updates if not already sent. """ LOG.debug('Handling EOR for %s', route_family) # assert (route_family in SUPPORTED_GLOBAL_RF) # assert self.is_mbgp_cap_v...
def _handle_eor(self, route_family): """Currently we only handle EOR for RTC address-family. We send non-rtc initial updates if not already sent. """ LOG.debug('Handling EOR for %s', route_family) # assert (route_family in SUPPORTED_GLOBAL_RF) # assert self.is_mbgp_cap_v...
[ "Currently", "we", "only", "handle", "EOR", "for", "RTC", "address", "-", "family", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1947-L1972
[ "def", "_handle_eor", "(", "self", ",", "route_family", ")", ":", "LOG", ".", "debug", "(", "'Handling EOR for %s'", ",", "route_family", ")", "# assert (route_family in SUPPORTED_GLOBAL_RF)", "# assert self.is_mbgp_cap_valid(route_family)", "if", "route_family"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.handle_msg
BGP message handler. BGP message handling is shared between protocol instance and peer. Peer only handles limited messages under suitable state. Here we handle KEEPALIVE, UPDATE and ROUTE_REFRESH messages. UPDATE and ROUTE_REFRESH messages are handled only after session is established.
ryu/services/protocols/bgp/peer.py
def handle_msg(self, msg): """BGP message handler. BGP message handling is shared between protocol instance and peer. Peer only handles limited messages under suitable state. Here we handle KEEPALIVE, UPDATE and ROUTE_REFRESH messages. UPDATE and ROUTE_REFRESH messages are handl...
def handle_msg(self, msg): """BGP message handler. BGP message handling is shared between protocol instance and peer. Peer only handles limited messages under suitable state. Here we handle KEEPALIVE, UPDATE and ROUTE_REFRESH messages. UPDATE and ROUTE_REFRESH messages are handl...
[ "BGP", "message", "handler", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L1974-L2004
[ "def", "handle_msg", "(", "self", ",", "msg", ")", ":", "if", "msg", ".", "type", "==", "BGP_MSG_KEEPALIVE", ":", "# If we receive a Keep Alive message in open_confirm state, we", "# transition to established state.", "if", "self", ".", "state", ".", "bgp_state", "==", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._enqueue_eor_msg
Enqueues Enhanced RR EOR if for given SOR a EOR is not already sent.
ryu/services/protocols/bgp/peer.py
def _enqueue_eor_msg(self, sor): """Enqueues Enhanced RR EOR if for given SOR a EOR is not already sent. """ if self._protocol.is_enhanced_rr_cap_valid() and not sor.eor_sent: afi = sor.afi safi = sor.safi eor = BGPRouteRefresh(afi, safi, demarcation=2...
def _enqueue_eor_msg(self, sor): """Enqueues Enhanced RR EOR if for given SOR a EOR is not already sent. """ if self._protocol.is_enhanced_rr_cap_valid() and not sor.eor_sent: afi = sor.afi safi = sor.safi eor = BGPRouteRefresh(afi, safi, demarcation=2...
[ "Enqueues", "Enhanced", "RR", "EOR", "if", "for", "given", "SOR", "a", "EOR", "is", "not", "already", "sent", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2084-L2093
[ "def", "_enqueue_eor_msg", "(", "self", ",", "sor", ")", ":", "if", "self", ".", "_protocol", ".", "is_enhanced_rr_cap_valid", "(", ")", "and", "not", "sor", ".", "eor_sent", ":", "afi", "=", "sor", ".", "afi", "safi", "=", "sor", ".", "safi", "eor", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._schedule_sending_init_updates
Setup timer for sending best-paths for all other address-families that qualify. Setup timer for sending initial updates to peer.
ryu/services/protocols/bgp/peer.py
def _schedule_sending_init_updates(self): """Setup timer for sending best-paths for all other address-families that qualify. Setup timer for sending initial updates to peer. """ def _enqueue_non_rtc_init_updates(): LOG.debug('Scheduled queuing of initial Non-RTC UPD...
def _schedule_sending_init_updates(self): """Setup timer for sending best-paths for all other address-families that qualify. Setup timer for sending initial updates to peer. """ def _enqueue_non_rtc_init_updates(): LOG.debug('Scheduled queuing of initial Non-RTC UPD...
[ "Setup", "timer", "for", "sending", "best", "-", "paths", "for", "all", "other", "address", "-", "families", "that", "qualify", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2095-L2119
[ "def", "_schedule_sending_init_updates", "(", "self", ")", ":", "def", "_enqueue_non_rtc_init_updates", "(", ")", ":", "LOG", ".", "debug", "(", "'Scheduled queuing of initial Non-RTC UPDATEs'", ")", "tm", "=", "self", ".", "_core_service", ".", "table_manager", "self...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._unschedule_sending_init_updates
Un-schedules sending of initial updates Stops the timer if set for sending initial updates. Returns: - True if timer was stopped - False if timer was already stopped and nothing was done
ryu/services/protocols/bgp/peer.py
def _unschedule_sending_init_updates(self): """Un-schedules sending of initial updates Stops the timer if set for sending initial updates. Returns: - True if timer was stopped - False if timer was already stopped and nothing was done """ LOG.debug('Un-sch...
def _unschedule_sending_init_updates(self): """Un-schedules sending of initial updates Stops the timer if set for sending initial updates. Returns: - True if timer was stopped - False if timer was already stopped and nothing was done """ LOG.debug('Un-sch...
[ "Un", "-", "schedules", "sending", "of", "initial", "updates" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2121-L2136
[ "def", "_unschedule_sending_init_updates", "(", "self", ")", ":", "LOG", ".", "debug", "(", "'Un-scheduling sending of initial Non-RTC UPDATEs'", "' (init. UPDATEs already sent: %s)'", ",", "self", ".", "_sent_init_non_rtc_update", ")", "if", "self", ".", "_rtc_eor_timer", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer._enqueue_init_updates
Enqueues current routes to be shared with this peer.
ryu/services/protocols/bgp/peer.py
def _enqueue_init_updates(self): """Enqueues current routes to be shared with this peer.""" assert self.state.bgp_state == const.BGP_FSM_ESTABLISHED if self.is_mbgp_cap_valid(RF_RTC_UC): # Enqueues all best-RTC_NLRIs to be sent as initial update to this # peer. ...
def _enqueue_init_updates(self): """Enqueues current routes to be shared with this peer.""" assert self.state.bgp_state == const.BGP_FSM_ESTABLISHED if self.is_mbgp_cap_valid(RF_RTC_UC): # Enqueues all best-RTC_NLRIs to be sent as initial update to this # peer. ...
[ "Enqueues", "current", "routes", "to", "be", "shared", "with", "this", "peer", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2138-L2150
[ "def", "_enqueue_init_updates", "(", "self", ")", ":", "assert", "self", ".", "state", ".", "bgp_state", "==", "const", ".", "BGP_FSM_ESTABLISHED", "if", "self", ".", "is_mbgp_cap_valid", "(", "RF_RTC_UC", ")", ":", "# Enqueues all best-RTC_NLRIs to be sent as initial...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.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/peer.py
def comm_all_best_paths(self, global_tables): """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' '...
def comm_all_best_paths(self, global_tables): """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' '...
[ "Shares", "/", "communicates", "current", "best", "paths", "with", "this", "peers", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2152-L2167
[ "def", "comm_all_best_paths", "(", "self", ",", "global_tables", ")", ":", "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", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.communicate_path
Communicates `path` to this peer if it qualifies. Checks if `path` should be shared/communicated with this peer according to various conditions: like bgp state, transmit side loop, local and remote AS path, community attribute, etc.
ryu/services/protocols/bgp/peer.py
def communicate_path(self, path): """Communicates `path` to this peer if it qualifies. Checks if `path` should be shared/communicated with this peer according to various conditions: like bgp state, transmit side loop, local and remote AS path, community attribute, etc. """ ...
def communicate_path(self, path): """Communicates `path` to this peer if it qualifies. Checks if `path` should be shared/communicated with this peer according to various conditions: like bgp state, transmit side loop, local and remote AS path, community attribute, etc. """ ...
[ "Communicates", "path", "to", "this", "peer", "if", "it", "qualifies", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2169-L2294
[ "def", "communicate_path", "(", "self", ",", "path", ")", ":", "LOG", ".", "debug", "(", "'Peer %s asked to communicate path'", ",", "self", ")", "if", "not", "path", ":", "raise", "ValueError", "(", "'Invalid path %s given.'", "%", "path", ")", "# We do not sen...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.connection_made
Protocols connection established handler
ryu/services/protocols/bgp/peer.py
def connection_made(self): """Protocols connection established handler """ LOG.info( 'Connection to peer: %s established', self._neigh_conf.ip_address, extra={ 'resource_name': self._neigh_conf.name, 'resource_id': self._neigh_c...
def connection_made(self): """Protocols connection established handler """ LOG.info( 'Connection to peer: %s established', self._neigh_conf.ip_address, extra={ 'resource_name': self._neigh_conf.name, 'resource_id': self._neigh_c...
[ "Protocols", "connection", "established", "handler" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2296-L2306
[ "def", "connection_made", "(", "self", ")", ":", "LOG", ".", "info", "(", "'Connection to peer: %s established'", ",", "self", ".", "_neigh_conf", ".", "ip_address", ",", "extra", "=", "{", "'resource_name'", ":", "self", ".", "_neigh_conf", ".", "name", ",", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
Peer.connection_lost
Protocols connection lost handler.
ryu/services/protocols/bgp/peer.py
def connection_lost(self, reason): """Protocols connection lost handler. """ LOG.info( 'Connection to peer %s lost, reason: %s Resetting ' 'retry connect loop: %s' % (self._neigh_conf.ip_address, reason, self._connect_retry_event.is_set()), ...
def connection_lost(self, reason): """Protocols connection lost handler. """ LOG.info( 'Connection to peer %s lost, reason: %s Resetting ' 'retry connect loop: %s' % (self._neigh_conf.ip_address, reason, self._connect_retry_event.is_set()), ...
[ "Protocols", "connection", "lost", "handler", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/peer.py#L2308-L2341
[ "def", "connection_lost", "(", "self", ",", "reason", ")", ":", "LOG", ".", "info", "(", "'Connection to peer %s lost, reason: %s Resetting '", "'retry connect loop: %s'", "%", "(", "self", ".", "_neigh_conf", ".", "ip_address", ",", "reason", ",", "self", ".", "_...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
_BGPPathAttributeAsPathCommon.has_local_as
Check if *local_as* is already present on path list.
ryu/lib/packet/bgp.py
def has_local_as(self, local_as, max_count=0): """Check if *local_as* is already present on path list.""" _count = 0 for as_path_seg in self.value: _count += list(as_path_seg).count(local_as) return _count > max_count
def has_local_as(self, local_as, max_count=0): """Check if *local_as* is already present on path list.""" _count = 0 for as_path_seg in self.value: _count += list(as_path_seg).count(local_as) return _count > max_count
[ "Check", "if", "*", "local_as", "*", "is", "already", "present", "on", "path", "list", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/bgp.py#L3724-L3729
[ "def", "has_local_as", "(", "self", ",", "local_as", ",", "max_count", "=", "0", ")", ":", "_count", "=", "0", "for", "as_path_seg", "in", "self", ".", "value", ":", "_count", "+=", "list", "(", "as_path_seg", ")", ".", "count", "(", "local_as", ")", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
_BGPPathAttributeAsPathCommon.has_matching_leftmost
Check if leftmost AS matches *remote_as*.
ryu/lib/packet/bgp.py
def has_matching_leftmost(self, remote_as): """Check if leftmost AS matches *remote_as*.""" if not self.value or not remote_as: return False leftmost_seg = self.path_seg_list[0] if leftmost_seg and leftmost_seg[0] == remote_as: return True return False
def has_matching_leftmost(self, remote_as): """Check if leftmost AS matches *remote_as*.""" if not self.value or not remote_as: return False leftmost_seg = self.path_seg_list[0] if leftmost_seg and leftmost_seg[0] == remote_as: return True return False
[ "Check", "if", "leftmost", "AS", "matches", "*", "remote_as", "*", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/bgp.py#L3731-L3740
[ "def", "has_matching_leftmost", "(", "self", ",", "remote_as", ")", ":", "if", "not", "self", ".", "value", "or", "not", "remote_as", ":", "return", "False", "leftmost_seg", "=", "self", ".", "path_seg_list", "[", "0", "]", "if", "leftmost_seg", "and", "le...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
run_command
Runs a command in an out-of-process shell, returning the output of that command. Working directory is ROOT.
tools/install_venv.py
def run_command(cmd, redirect_output=True, check_exit_code=True): """ Runs a command in an out-of-process shell, returning the output of that command. Working directory is ROOT. """ if redirect_output: stdout = subprocess.PIPE else: stdout = None proc = subprocess.Popen(cmd,...
def run_command(cmd, redirect_output=True, check_exit_code=True): """ Runs a command in an out-of-process shell, returning the output of that command. Working directory is ROOT. """ if redirect_output: stdout = subprocess.PIPE else: stdout = None proc = subprocess.Popen(cmd,...
[ "Runs", "a", "command", "in", "an", "out", "-", "of", "-", "process", "shell", "returning", "the", "output", "of", "that", "command", ".", "Working", "directory", "is", "ROOT", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/tools/install_venv.py#L45-L58
[ "def", "run_command", "(", "cmd", ",", "redirect_output", "=", "True", ",", "check_exit_code", "=", "True", ")", ":", "if", "redirect_output", ":", "stdout", "=", "subprocess", ".", "PIPE", "else", ":", "stdout", "=", "None", "proc", "=", "subprocess", "."...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
create_virtualenv
Creates the virtual environment and installs PIP only into the virtual environment
tools/install_venv.py
def create_virtualenv(venv=VENV, install_pip=False): """Creates the virtual environment and installs PIP only into the virtual environment """ print 'Creating venv...', install = ['virtualenv', '-q', venv] run_command(install) print 'done.' print 'Installing pip in virtualenv...', ...
def create_virtualenv(venv=VENV, install_pip=False): """Creates the virtual environment and installs PIP only into the virtual environment """ print 'Creating venv...', install = ['virtualenv', '-q', venv] run_command(install) print 'done.' print 'Installing pip in virtualenv...', ...
[ "Creates", "the", "virtual", "environment", "and", "installs", "PIP", "only", "into", "the", "virtual", "environment" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/tools/install_venv.py#L76-L91
[ "def", "create_virtualenv", "(", "venv", "=", "VENV", ",", "install_pip", "=", "False", ")", ":", "print", "'Creating venv...'", ",", "install", "=", "[", "'virtualenv'", ",", "'-q'", ",", "venv", "]", "run_command", "(", "install", ")", "print", "'done.'", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
get_column_value
Example : To get datapath_id from Bridge table get_column_value('Bridge', <bridge name>, 'datapath_id').strip('"')
ryu/services/protocols/ovsdb/api.py
def get_column_value(manager, table, record, column): """ Example : To get datapath_id from Bridge table get_column_value('Bridge', <bridge name>, 'datapath_id').strip('"') """ row = row_by_name(manager, record, table) value = getattr(row, column, "") if isinstance(value, list) and len(valu...
def get_column_value(manager, table, record, column): """ Example : To get datapath_id from Bridge table get_column_value('Bridge', <bridge name>, 'datapath_id').strip('"') """ row = row_by_name(manager, record, table) value = getattr(row, column, "") if isinstance(value, list) and len(valu...
[ "Example", ":", "To", "get", "datapath_id", "from", "Bridge", "table", "get_column_value", "(", "Bridge", "<bridge", "name", ">", "datapath_id", ")", ".", "strip", "(", ")" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/ovsdb/api.py#L100-L111
[ "def", "get_column_value", "(", "manager", ",", "table", ",", "record", ",", "column", ")", ":", "row", "=", "row_by_name", "(", "manager", ",", "record", ",", "table", ")", "value", "=", "getattr", "(", "row", ",", "column", ",", "\"\"", ")", "if", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RestVtepController.add_speaker
Creates a new BGPSpeaker instance. Usage: ======= ================ Method URI ======= ================ POST /vtep/speakers ======= ================ Request parameters: ========== ============================================ ...
ryu/app/rest_vtep.py
def add_speaker(self, **kwargs): """ Creates a new BGPSpeaker instance. Usage: ======= ================ Method URI ======= ================ POST /vtep/speakers ======= ================ Request parameters: ===...
def add_speaker(self, **kwargs): """ Creates a new BGPSpeaker instance. Usage: ======= ================ Method URI ======= ================ POST /vtep/speakers ======= ================ Request parameters: ===...
[ "Creates", "a", "new", "BGPSpeaker", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/app/rest_vtep.py#L1177-L1226
[ "def", "add_speaker", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "body", "=", "self", ".", "vtep_app", ".", "add_speaker", "(", "*", "*", "kwargs", ")", "except", "DatapathNotFound", "as", "e", ":", "return", "e", ".", "to_response", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RestVtepController.get_speakers
Gets the info of BGPSpeaker instance. Usage: ======= ================ Method URI ======= ================ GET /vtep/speakers ======= ================ Example:: $ curl -X GET http://localhost:8080/vtep/speakers | ...
ryu/app/rest_vtep.py
def get_speakers(self, **kwargs): """ Gets the info of BGPSpeaker instance. Usage: ======= ================ Method URI ======= ================ GET /vtep/speakers ======= ================ Example:: $ curl -X...
def get_speakers(self, **kwargs): """ Gets the info of BGPSpeaker instance. Usage: ======= ================ Method URI ======= ================ GET /vtep/speakers ======= ================ Example:: $ curl -X...
[ "Gets", "the", "info", "of", "BGPSpeaker", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/app/rest_vtep.py#L1230-L1274
[ "def", "get_speakers", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "body", "=", "self", ".", "vtep_app", ".", "get_speaker", "(", ")", "except", "BGPSpeakerNotFound", "as", "e", ":", "return", "e", ".", "to_response", "(", "status", "="...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RestVtepController.del_network
Deletes the network for the specified VNI. Usage: ======= ===================== Method URI ======= ===================== DELETE /vtep/networks/{vni} ======= ===================== Request parameters: ================ ==========...
ryu/app/rest_vtep.py
def del_network(self, **kwargs): """ Deletes the network for the specified VNI. Usage: ======= ===================== Method URI ======= ===================== DELETE /vtep/networks/{vni} ======= ===================== Request...
def del_network(self, **kwargs): """ Deletes the network for the specified VNI. Usage: ======= ===================== Method URI ======= ===================== DELETE /vtep/networks/{vni} ======= ===================== Request...
[ "Deletes", "the", "network", "for", "the", "specified", "VNI", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/app/rest_vtep.py#L1670-L1722
[ "def", "del_network", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "body", "=", "self", ".", "vtep_app", ".", "del_network", "(", "*", "*", "kwargs", ")", "except", "(", "BGPSpeakerNotFound", ",", "DatapathNotFound", ",", "VniNotFound", ")...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RestVtepController.del_client
Registers a new client to the specified network. Usage: ======= =================================== Method URI ======= =================================== DELETE /vtep/networks/{vni}/clients/{mac} ======= =================================== ...
ryu/app/rest_vtep.py
def del_client(self, **kwargs): """ Registers a new client to the specified network. Usage: ======= =================================== Method URI ======= =================================== DELETE /vtep/networks/{vni}/clients/{mac} ...
def del_client(self, **kwargs): """ Registers a new client to the specified network. Usage: ======= =================================== Method URI ======= =================================== DELETE /vtep/networks/{vni}/clients/{mac} ...
[ "Registers", "a", "new", "client", "to", "the", "specified", "network", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/app/rest_vtep.py#L1796-L1842
[ "def", "del_client", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "body", "=", "self", ".", "vtep_app", ".", "del_client", "(", "*", "*", "kwargs", ")", "except", "(", "BGPSpeakerNotFound", ",", "DatapathNotFound", ",", "VniNotFound", ",",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.import_all_vpn_paths_to_vrf
Imports VPNv4/6 or EVPN paths from Global/VPN table into given VRFv4/6 or VRFEVPN table. :param vrf_table: Vrf table to which we import :type vrf_table: VrfTable :param import_rts: import RTs to override default import_rts of vrf table for this import :type import_rts: ...
ryu/services/protocols/bgp/core_managers/table_manager.py
def import_all_vpn_paths_to_vrf(self, vrf_table, import_rts=None): """Imports VPNv4/6 or EVPN paths from Global/VPN table into given VRFv4/6 or VRFEVPN table. :param vrf_table: Vrf table to which we import :type vrf_table: VrfTable :param import_rts: import RTs to override defau...
def import_all_vpn_paths_to_vrf(self, vrf_table, import_rts=None): """Imports VPNv4/6 or EVPN paths from Global/VPN table into given VRFv4/6 or VRFEVPN table. :param vrf_table: Vrf table to which we import :type vrf_table: VrfTable :param import_rts: import RTs to override defau...
[ "Imports", "VPNv4", "/", "6", "or", "EVPN", "paths", "from", "Global", "/", "VPN", "table", "into", "given", "VRFv4", "/", "6", "or", "VRFEVPN", "table", ".", ":", "param", "vrf_table", ":", "Vrf", "table", "to", "which", "we", "import", ":", "type", ...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L133-L160
[ "def", "import_all_vpn_paths_to_vrf", "(", "self", ",", "vrf_table", ",", "import_rts", "=", "None", ")", ":", "if", "vrf_table", ".", "route_family", "==", "Vrf4Table", ".", "ROUTE_FAMILY", ":", "vpn_table", "=", "self", ".", "get_vpn4_table", "(", ")", "elif...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.learn_path
Inserts `path` into correct global table. Since known paths to `Destination` has changes, we queue it for further processing.
ryu/services/protocols/bgp/core_managers/table_manager.py
def learn_path(self, path): """Inserts `path` into correct global table. Since known paths to `Destination` has changes, we queue it for further processing. """ # Get VPN/Global table table = self.get_global_table_by_route_family(path.route_family) gpath_dest = t...
def learn_path(self, path): """Inserts `path` into correct global table. Since known paths to `Destination` has changes, we queue it for further processing. """ # Get VPN/Global table table = self.get_global_table_by_route_family(path.route_family) gpath_dest = t...
[ "Inserts", "path", "into", "correct", "global", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L162-L172
[ "def", "learn_path", "(", "self", ",", "path", ")", ":", "# Get VPN/Global table", "table", "=", "self", ".", "get_global_table_by_route_family", "(", "path", ".", "route_family", ")", "gpath_dest", "=", "table", ".", "insert", "(", "path", ")", "# Since destina...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.remember_sent_route
Records `sent_route` inside proper table. Records of `sent_route` from Adj-RIB-out.
ryu/services/protocols/bgp/core_managers/table_manager.py
def remember_sent_route(self, sent_route): """Records `sent_route` inside proper table. Records of `sent_route` from Adj-RIB-out. """ route_family = sent_route.path.route_family table = self.get_global_table_by_route_family(route_family) table.insert_sent_route(sent_rout...
def remember_sent_route(self, sent_route): """Records `sent_route` inside proper table. Records of `sent_route` from Adj-RIB-out. """ route_family = sent_route.path.route_family table = self.get_global_table_by_route_family(route_family) table.insert_sent_route(sent_rout...
[ "Records", "sent_route", "inside", "proper", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L174-L181
[ "def", "remember_sent_route", "(", "self", ",", "sent_route", ")", ":", "route_family", "=", "sent_route", ".", "path", ".", "route_family", "table", "=", "self", ".", "get_global_table_by_route_family", "(", "route_family", ")", "table", ".", "insert_sent_route", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.on_interesting_rts_change
Update global tables as interested RTs changed. Adds `new_rts` and removes `removed_rts` rt nlris. Does not check if `new_rts` or `removed_rts` are already present. Schedules refresh request to peers that do not participate in RTC address-family.
ryu/services/protocols/bgp/core_managers/table_manager.py
def on_interesting_rts_change(self, new_global_rts, removed_global_rts): """Update global tables as interested RTs changed. Adds `new_rts` and removes `removed_rts` rt nlris. Does not check if `new_rts` or `removed_rts` are already present. Schedules refresh request to peers that do not...
def on_interesting_rts_change(self, new_global_rts, removed_global_rts): """Update global tables as interested RTs changed. Adds `new_rts` and removes `removed_rts` rt nlris. Does not check if `new_rts` or `removed_rts` are already present. Schedules refresh request to peers that do not...
[ "Update", "global", "tables", "as", "interested", "RTs", "changed", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L183-L203
[ "def", "on_interesting_rts_change", "(", "self", ",", "new_global_rts", ",", "removed_global_rts", ")", ":", "# We add new RT NLRI and request RR for other peers.", "if", "new_global_rts", ":", "LOG", ".", "debug", "(", "'Sending route_refresh to all neighbors that'", "' did no...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_ipv4_table
Returns global IPv4 table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_ipv4_table(self): """Returns global IPv4 table. Creates the table if it does not exist. """ vpn_table = self._global_tables.get(RF_IPv4_UC) # Lazy initialize the table. if not vpn_table: vpn_table = Ipv4Table(self._core_service, self._signal_bus) ...
def get_ipv4_table(self): """Returns global IPv4 table. Creates the table if it does not exist. """ vpn_table = self._global_tables.get(RF_IPv4_UC) # Lazy initialize the table. if not vpn_table: vpn_table = Ipv4Table(self._core_service, self._signal_bus) ...
[ "Returns", "global", "IPv4", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L251-L264
[ "def", "get_ipv4_table", "(", "self", ")", ":", "vpn_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_IPv4_UC", ")", "# Lazy initialize the table.", "if", "not", "vpn_table", ":", "vpn_table", "=", "Ipv4Table", "(", "self", ".", "_core_service", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_vpn6_table
Returns global VPNv6 table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_vpn6_table(self): """Returns global VPNv6 table. Creates the table if it does not exist. """ vpn_table = self._global_tables.get(RF_IPv6_VPN) # Lazy initialize the table. if not vpn_table: vpn_table = Vpnv6Table(self._core_service, self._signal_bus) ...
def get_vpn6_table(self): """Returns global VPNv6 table. Creates the table if it does not exist. """ vpn_table = self._global_tables.get(RF_IPv6_VPN) # Lazy initialize the table. if not vpn_table: vpn_table = Vpnv6Table(self._core_service, self._signal_bus) ...
[ "Returns", "global", "VPNv6", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L274-L286
[ "def", "get_vpn6_table", "(", "self", ")", ":", "vpn_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_IPv6_VPN", ")", "# Lazy initialize the table.", "if", "not", "vpn_table", ":", "vpn_table", "=", "Vpnv6Table", "(", "self", ".", "_core_service"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_vpn4_table
Returns global VPNv6 table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_vpn4_table(self): """Returns global VPNv6 table. Creates the table if it does not exist. """ vpn_table = self._global_tables.get(RF_IPv4_VPN) # Lazy initialize the table. if not vpn_table: vpn_table = Vpnv4Table(self._core_service, self._signal_bus) ...
def get_vpn4_table(self): """Returns global VPNv6 table. Creates the table if it does not exist. """ vpn_table = self._global_tables.get(RF_IPv4_VPN) # Lazy initialize the table. if not vpn_table: vpn_table = Vpnv4Table(self._core_service, self._signal_bus) ...
[ "Returns", "global", "VPNv6", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L288-L300
[ "def", "get_vpn4_table", "(", "self", ")", ":", "vpn_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_IPv4_VPN", ")", "# Lazy initialize the table.", "if", "not", "vpn_table", ":", "vpn_table", "=", "Vpnv4Table", "(", "self", ".", "_core_service"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_evpn_table
Returns global EVPN table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_evpn_table(self): """Returns global EVPN table. Creates the table if it does not exist. """ evpn_table = self._global_tables.get(RF_L2_EVPN) # Lazy initialization of the table. if not evpn_table: evpn_table = EvpnTable(self._core_service, self._signal...
def get_evpn_table(self): """Returns global EVPN table. Creates the table if it does not exist. """ evpn_table = self._global_tables.get(RF_L2_EVPN) # Lazy initialization of the table. if not evpn_table: evpn_table = EvpnTable(self._core_service, self._signal...
[ "Returns", "global", "EVPN", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L302-L314
[ "def", "get_evpn_table", "(", "self", ")", ":", "evpn_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_L2_EVPN", ")", "# Lazy initialization of the table.", "if", "not", "evpn_table", ":", "evpn_table", "=", "EvpnTable", "(", "self", ".", "_core_...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_rtc_table
Returns global RTC table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_rtc_table(self): """Returns global RTC table. Creates the table if it does not exist. """ rtc_table = self._global_tables.get(RF_RTC_UC) # Lazy initialization of the table. if not rtc_table: rtc_table = RtcTable(self._core_service, self._signal_bus) ...
def get_rtc_table(self): """Returns global RTC table. Creates the table if it does not exist. """ rtc_table = self._global_tables.get(RF_RTC_UC) # Lazy initialization of the table. if not rtc_table: rtc_table = RtcTable(self._core_service, self._signal_bus) ...
[ "Returns", "global", "RTC", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L316-L327
[ "def", "get_rtc_table", "(", "self", ")", ":", "rtc_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_RTC_UC", ")", "# Lazy initialization of the table.", "if", "not", "rtc_table", ":", "rtc_table", "=", "RtcTable", "(", "self", ".", "_core_servic...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_ipv4fs_table
Returns global IPv4 Flow Specification table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_ipv4fs_table(self): """Returns global IPv4 Flow Specification table. Creates the table if it does not exist. """ ipv4fs_table = self._global_tables.get(RF_IPv4_FLOWSPEC) # Lazy initialization of the table. if not ipv4fs_table: ipv4fs_table = IPv4FlowS...
def get_ipv4fs_table(self): """Returns global IPv4 Flow Specification table. Creates the table if it does not exist. """ ipv4fs_table = self._global_tables.get(RF_IPv4_FLOWSPEC) # Lazy initialization of the table. if not ipv4fs_table: ipv4fs_table = IPv4FlowS...
[ "Returns", "global", "IPv4", "Flow", "Specification", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L342-L355
[ "def", "get_ipv4fs_table", "(", "self", ")", ":", "ipv4fs_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_IPv4_FLOWSPEC", ")", "# Lazy initialization of the table.", "if", "not", "ipv4fs_table", ":", "ipv4fs_table", "=", "IPv4FlowSpecTable", "(", "s...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_ipv6fs_table
Returns global IPv6 Flow Specification table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_ipv6fs_table(self): """Returns global IPv6 Flow Specification table. Creates the table if it does not exist. """ ipv6fs_table = self._global_tables.get(RF_IPv6_FLOWSPEC) # Lazy initialization of the table. if not ipv6fs_table: ipv6fs_table = IPv6FlowS...
def get_ipv6fs_table(self): """Returns global IPv6 Flow Specification table. Creates the table if it does not exist. """ ipv6fs_table = self._global_tables.get(RF_IPv6_FLOWSPEC) # Lazy initialization of the table. if not ipv6fs_table: ipv6fs_table = IPv6FlowS...
[ "Returns", "global", "IPv6", "Flow", "Specification", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L357-L370
[ "def", "get_ipv6fs_table", "(", "self", ")", ":", "ipv6fs_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_IPv6_FLOWSPEC", ")", "# Lazy initialization of the table.", "if", "not", "ipv6fs_table", ":", "ipv6fs_table", "=", "IPv6FlowSpecTable", "(", "s...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_vpnv4fs_table
Returns global VPNv4 Flow Specification table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_vpnv4fs_table(self): """Returns global VPNv4 Flow Specification table. Creates the table if it does not exist. """ vpnv4fs_table = self._global_tables.get(RF_VPNv4_FLOWSPEC) # Lazy initialization of the table. if not vpnv4fs_table: vpnv4fs_table = VPN...
def get_vpnv4fs_table(self): """Returns global VPNv4 Flow Specification table. Creates the table if it does not exist. """ vpnv4fs_table = self._global_tables.get(RF_VPNv4_FLOWSPEC) # Lazy initialization of the table. if not vpnv4fs_table: vpnv4fs_table = VPN...
[ "Returns", "global", "VPNv4", "Flow", "Specification", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L372-L385
[ "def", "get_vpnv4fs_table", "(", "self", ")", ":", "vpnv4fs_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_VPNv4_FLOWSPEC", ")", "# Lazy initialization of the table.", "if", "not", "vpnv4fs_table", ":", "vpnv4fs_table", "=", "VPNv4FlowSpecTable", "("...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_vpnv6fs_table
Returns global VPNv6 Flow Specification table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_vpnv6fs_table(self): """Returns global VPNv6 Flow Specification table. Creates the table if it does not exist. """ vpnv6fs_table = self._global_tables.get(RF_VPNv6_FLOWSPEC) # Lazy initialization of the table. if not vpnv6fs_table: vpnv6fs_table = VPN...
def get_vpnv6fs_table(self): """Returns global VPNv6 Flow Specification table. Creates the table if it does not exist. """ vpnv6fs_table = self._global_tables.get(RF_VPNv6_FLOWSPEC) # Lazy initialization of the table. if not vpnv6fs_table: vpnv6fs_table = VPN...
[ "Returns", "global", "VPNv6", "Flow", "Specification", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L387-L400
[ "def", "get_vpnv6fs_table", "(", "self", ")", ":", "vpnv6fs_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_VPNv6_FLOWSPEC", ")", "# Lazy initialization of the table.", "if", "not", "vpnv6fs_table", ":", "vpnv6fs_table", "=", "VPNv6FlowSpecTable", "("...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.get_l2vpnfs_table
Returns global L2VPN Flow Specification table. Creates the table if it does not exist.
ryu/services/protocols/bgp/core_managers/table_manager.py
def get_l2vpnfs_table(self): """Returns global L2VPN Flow Specification table. Creates the table if it does not exist. """ l2vpnfs_table = self._global_tables.get(RF_L2VPN_FLOWSPEC) # Lazy initialization of the table. if not l2vpnfs_table: l2vpnfs_table = L2V...
def get_l2vpnfs_table(self): """Returns global L2VPN Flow Specification table. Creates the table if it does not exist. """ l2vpnfs_table = self._global_tables.get(RF_L2VPN_FLOWSPEC) # Lazy initialization of the table. if not l2vpnfs_table: l2vpnfs_table = L2V...
[ "Returns", "global", "L2VPN", "Flow", "Specification", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L402-L415
[ "def", "get_l2vpnfs_table", "(", "self", ")", ":", "l2vpnfs_table", "=", "self", ".", "_global_tables", ".", "get", "(", "RF_L2VPN_FLOWSPEC", ")", "# Lazy initialization of the table.", "if", "not", "l2vpnfs_table", ":", "l2vpnfs_table", "=", "L2VPNFlowSpecTable", "("...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.update_vrf_table_links
Update mapping from RT to VRF table.
ryu/services/protocols/bgp/core_managers/table_manager.py
def update_vrf_table_links(self, vrf_table, new_imp_rts, removed_imp_rts): """Update mapping from RT to VRF table.""" assert vrf_table if new_imp_rts: self._link_vrf_table(vrf_table, new_imp_rts) if removed_imp_rts: self._remove_link...
def update_vrf_table_links(self, vrf_table, new_imp_rts, removed_imp_rts): """Update mapping from RT to VRF table.""" assert vrf_table if new_imp_rts: self._link_vrf_table(vrf_table, new_imp_rts) if removed_imp_rts: self._remove_link...
[ "Update", "mapping", "from", "RT", "to", "VRF", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L423-L431
[ "def", "update_vrf_table_links", "(", "self", ",", "vrf_table", ",", "new_imp_rts", ",", "removed_imp_rts", ")", ":", "assert", "vrf_table", "if", "new_imp_rts", ":", "self", ".", "_link_vrf_table", "(", "vrf_table", ",", "new_imp_rts", ")", "if", "removed_imp_rts...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.re_install_net_ctrl_paths
Re-installs paths from NC with current BGP policy. Iterates over known paths from NC installed in `vrf4_table` and adds new path with path attributes as per current VRF configuration.
ryu/services/protocols/bgp/core_managers/table_manager.py
def re_install_net_ctrl_paths(self, vrf_table): """Re-installs paths from NC with current BGP policy. Iterates over known paths from NC installed in `vrf4_table` and adds new path with path attributes as per current VRF configuration. """ assert vrf_table for dest in vrf...
def re_install_net_ctrl_paths(self, vrf_table): """Re-installs paths from NC with current BGP policy. Iterates over known paths from NC installed in `vrf4_table` and adds new path with path attributes as per current VRF configuration. """ assert vrf_table for dest in vrf...
[ "Re", "-", "installs", "paths", "from", "NC", "with", "current", "BGP", "policy", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L433-L449
[ "def", "re_install_net_ctrl_paths", "(", "self", ",", "vrf_table", ")", ":", "assert", "vrf_table", "for", "dest", "in", "vrf_table", ".", "values", "(", ")", ":", "for", "path", "in", "dest", ".", "known_path_list", ":", "if", "path", ".", "source", "is",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager._remove_links_to_vrf_table
Removes any links to given `vrf_table`.
ryu/services/protocols/bgp/core_managers/table_manager.py
def _remove_links_to_vrf_table(self, vrf_table): """Removes any links to given `vrf_table`.""" assert vrf_table vrf_conf = vrf_table.vrf_conf self._remove_links_to_vrf_table_for_rts(vrf_table, vrf_conf.import_rts)
def _remove_links_to_vrf_table(self, vrf_table): """Removes any links to given `vrf_table`.""" assert vrf_table vrf_conf = vrf_table.vrf_conf self._remove_links_to_vrf_table_for_rts(vrf_table, vrf_conf.import_rts)
[ "Removes", "any", "links", "to", "given", "vrf_table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L451-L456
[ "def", "_remove_links_to_vrf_table", "(", "self", ",", "vrf_table", ")", ":", "assert", "vrf_table", "vrf_conf", "=", "vrf_table", ".", "vrf_conf", "self", ".", "_remove_links_to_vrf_table_for_rts", "(", "vrf_table", ",", "vrf_conf", ".", "import_rts", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.create_and_link_vrf_table
Factory method to create VRF table for given `vrf_conf`. Adds mapping to this table with appropriate scope. Also, adds mapping for import RT of this VRF to created table to facilitate importing/installing of paths from global tables. Returns created table.
ryu/services/protocols/bgp/core_managers/table_manager.py
def create_and_link_vrf_table(self, vrf_conf): """Factory method to create VRF table for given `vrf_conf`. Adds mapping to this table with appropriate scope. Also, adds mapping for import RT of this VRF to created table to facilitate importing/installing of paths from global tables. ...
def create_and_link_vrf_table(self, vrf_conf): """Factory method to create VRF table for given `vrf_conf`. Adds mapping to this table with appropriate scope. Also, adds mapping for import RT of this VRF to created table to facilitate importing/installing of paths from global tables. ...
[ "Factory", "method", "to", "create", "VRF", "table", "for", "given", "vrf_conf", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L480-L520
[ "def", "create_and_link_vrf_table", "(", "self", ",", "vrf_conf", ")", ":", "route_family", "=", "vrf_conf", ".", "route_family", "if", "route_family", "==", "VRF_RF_IPV4", ":", "vrf_table", "=", "Vrf4Table", "elif", "route_family", "==", "VRF_RF_IPV6", ":", "vrf_...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager._clean_global_uninteresting_paths
Marks paths that do not have any route targets of interest for withdrawal. Since global tables can have paths with route targets that are not interesting any more, we have to clean these paths so that appropriate withdraw are sent out to NC and other peers. Interesting route targets ...
ryu/services/protocols/bgp/core_managers/table_manager.py
def _clean_global_uninteresting_paths(self): """Marks paths that do not have any route targets of interest for withdrawal. Since global tables can have paths with route targets that are not interesting any more, we have to clean these paths so that appropriate withdraw are sent ...
def _clean_global_uninteresting_paths(self): """Marks paths that do not have any route targets of interest for withdrawal. Since global tables can have paths with route targets that are not interesting any more, we have to clean these paths so that appropriate withdraw are sent ...
[ "Marks", "paths", "that", "do", "not", "have", "any", "route", "targets", "of", "interest", "for", "withdrawal", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L534-L560
[ "def", "_clean_global_uninteresting_paths", "(", "self", ")", ":", "uninteresting_dest_count", "=", "0", "interested_rts", "=", "self", ".", "_rt_mgr", ".", "global_interested_rts", "LOG", ".", "debug", "(", "'Cleaning uninteresting paths. Global interested RTs %s'", ",", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.import_single_vpn_path_to_all_vrfs
Imports *vpn_path* to qualifying VRF tables. Import RTs of VRF table is matched with RTs from *vpn4_path* and if we have any common RTs we import the path into VRF.
ryu/services/protocols/bgp/core_managers/table_manager.py
def import_single_vpn_path_to_all_vrfs(self, vpn_path, path_rts=None): """Imports *vpn_path* to qualifying VRF tables. Import RTs of VRF table is matched with RTs from *vpn4_path* and if we have any common RTs we import the path into VRF. """ LOG.debug('Importing path %s to qual...
def import_single_vpn_path_to_all_vrfs(self, vpn_path, path_rts=None): """Imports *vpn_path* to qualifying VRF tables. Import RTs of VRF table is matched with RTs from *vpn4_path* and if we have any common RTs we import the path into VRF. """ LOG.debug('Importing path %s to qual...
[ "Imports", "*", "vpn_path", "*", "to", "qualifying", "VRF", "tables", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L562-L615
[ "def", "import_single_vpn_path_to_all_vrfs", "(", "self", ",", "vpn_path", ",", "path_rts", "=", "None", ")", ":", "LOG", ".", "debug", "(", "'Importing path %s to qualifying VRFs'", ",", "vpn_path", ")", "# If this path has no RTs we are done.", "if", "not", "path_rts"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.update_vrf_table
Update a BGP route in the VRF table identified by `route_dist` with the given `next_hop`. If `is_withdraw` is False, which is the default, add a BGP route to the VRF table identified by `route_dist` with the given `next_hop`. If `is_withdraw` is True, remove a BGP route from the...
ryu/services/protocols/bgp/core_managers/table_manager.py
def update_vrf_table(self, route_dist, prefix=None, next_hop=None, route_family=None, route_type=None, tunnel_type=None, is_withdraw=False, redundancy_mode=None, pmsi_tunnel_type=None, **kwargs): """Update a BGP route in the VRF table id...
def update_vrf_table(self, route_dist, prefix=None, next_hop=None, route_family=None, route_type=None, tunnel_type=None, is_withdraw=False, redundancy_mode=None, pmsi_tunnel_type=None, **kwargs): """Update a BGP route in the VRF table id...
[ "Update", "a", "BGP", "route", "in", "the", "VRF", "table", "identified", "by", "route_dist", "with", "the", "given", "next_hop", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L617-L712
[ "def", "update_vrf_table", "(", "self", ",", "route_dist", ",", "prefix", "=", "None", ",", "next_hop", "=", "None", ",", "route_family", "=", "None", ",", "route_type", "=", "None", ",", "tunnel_type", "=", "None", ",", "is_withdraw", "=", "False", ",", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.update_flowspec_vrf_table
Update a BGP route in the VRF table for Flow Specification. ``flowspec_family`` specifies one of the flowspec family name. ``route_dist`` specifies a route distinguisher value. ``rules`` specifies NLRIs of Flow Specification as a dictionary type value. `` actions`` specifies ...
ryu/services/protocols/bgp/core_managers/table_manager.py
def update_flowspec_vrf_table(self, flowspec_family, route_dist, rules, actions=None, is_withdraw=False): """Update a BGP route in the VRF table for Flow Specification. ``flowspec_family`` specifies one of the flowspec family name. ``route_dist`` specifies a r...
def update_flowspec_vrf_table(self, flowspec_family, route_dist, rules, actions=None, is_withdraw=False): """Update a BGP route in the VRF table for Flow Specification. ``flowspec_family`` specifies one of the flowspec family name. ``route_dist`` specifies a r...
[ "Update", "a", "BGP", "route", "in", "the", "VRF", "table", "for", "Flow", "Specification", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L714-L773
[ "def", "update_flowspec_vrf_table", "(", "self", ",", "flowspec_family", ",", "route_dist", ",", "rules", ",", "actions", "=", "None", ",", "is_withdraw", "=", "False", ")", ":", "from", "ryu", ".", "services", ".", "protocols", ".", "bgp", ".", "core", "i...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.update_global_table
Update a BGP route in the Global table for the given `prefix` with the given `next_hop`. If `is_withdraw` is False, which is the default, add a BGP route to the Global table. If `is_withdraw` is True, remove a BGP route from the Global table.
ryu/services/protocols/bgp/core_managers/table_manager.py
def update_global_table(self, prefix, next_hop=None, is_withdraw=False): """Update a BGP route in the Global table for the given `prefix` with the given `next_hop`. If `is_withdraw` is False, which is the default, add a BGP route to the Global table. If `is_withdraw` is True, re...
def update_global_table(self, prefix, next_hop=None, is_withdraw=False): """Update a BGP route in the Global table for the given `prefix` with the given `next_hop`. If `is_withdraw` is False, which is the default, add a BGP route to the Global table. If `is_withdraw` is True, re...
[ "Update", "a", "BGP", "route", "in", "the", "Global", "table", "for", "the", "given", "prefix", "with", "the", "given", "next_hop", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L775-L812
[ "def", "update_global_table", "(", "self", ",", "prefix", ",", "next_hop", "=", "None", ",", "is_withdraw", "=", "False", ")", ":", "src_ver_num", "=", "1", "peer", "=", "None", "# set mandatory path attributes", "origin", "=", "BGPPathAttributeOrigin", "(", "BG...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.update_flowspec_global_table
Update a BGP route in the Global table for Flow Specification. ``flowspec_family`` specifies one of the Flow Specification family name. ``rules`` specifies NLRIs of Flow Specification as a dictionary type value. `` actions`` specifies Traffic Filtering Actions of Flow...
ryu/services/protocols/bgp/core_managers/table_manager.py
def update_flowspec_global_table(self, flowspec_family, rules, actions=None, is_withdraw=False): """Update a BGP route in the Global table for Flow Specification. ``flowspec_family`` specifies one of the Flow Specification family name. ``rules`` sp...
def update_flowspec_global_table(self, flowspec_family, rules, actions=None, is_withdraw=False): """Update a BGP route in the Global table for Flow Specification. ``flowspec_family`` specifies one of the Flow Specification family name. ``rules`` sp...
[ "Update", "a", "BGP", "route", "in", "the", "Global", "table", "for", "Flow", "Specification", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L814-L897
[ "def", "update_flowspec_global_table", "(", "self", ",", "flowspec_family", ",", "rules", ",", "actions", "=", "None", ",", "is_withdraw", "=", "False", ")", ":", "from", "ryu", ".", "services", ".", "protocols", ".", "bgp", ".", "core", "import", "BgpCoreEr...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
TableCoreManager.clean_stale_routes
Removes old routes from `peer` from `route_family` table. Routes/paths version number is compared with `peer`s current version number.
ryu/services/protocols/bgp/core_managers/table_manager.py
def clean_stale_routes(self, peer, route_family=None): """Removes old routes from `peer` from `route_family` table. Routes/paths version number is compared with `peer`s current version number. """ if route_family is not None: if route_family not in SUPPORTED_GLOBAL_...
def clean_stale_routes(self, peer, route_family=None): """Removes old routes from `peer` from `route_family` table. Routes/paths version number is compared with `peer`s current version number. """ if route_family is not None: if route_family not in SUPPORTED_GLOBAL_...
[ "Removes", "old", "routes", "from", "peer", "from", "route_family", "table", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L899-L915
[ "def", "clean_stale_routes", "(", "self", ",", "peer", ",", "route_family", "=", "None", ")", ":", "if", "route_family", "is", "not", "None", ":", "if", "route_family", "not", "in", "SUPPORTED_GLOBAL_RF", ":", "raise", "ValueError", "(", "'Given route family %s ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
MacToPortTable.port_add
:returns: old port if learned. (this may be = port) None otherwise
ryu/controller/mac_to_port.py
def port_add(self, dpid, port, mac): """ :returns: old port if learned. (this may be = port) None otherwise """ old_port = self.mac_to_port[dpid].get(mac, None) self.mac_to_port[dpid][mac] = port if old_port is not None and old_port != port: ...
def port_add(self, dpid, port, mac): """ :returns: old port if learned. (this may be = port) None otherwise """ old_port = self.mac_to_port[dpid].get(mac, None) self.mac_to_port[dpid][mac] = port if old_port is not None and old_port != port: ...
[ ":", "returns", ":", "old", "port", "if", "learned", ".", "(", "this", "may", "be", "=", "port", ")", "None", "otherwise" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/controller/mac_to_port.py#L34-L46
[ "def", "port_add", "(", "self", ",", "dpid", ",", "port", ",", "mac", ")", ":", "old_port", "=", "self", ".", "mac_to_port", "[", "dpid", "]", ".", "get", "(", "mac", ",", "None", ")", "self", ".", "mac_to_port", "[", "dpid", "]", "[", "mac", "]"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
_register_make
class decorator to Register mf make
ryu/ofproto/nx_match.py
def _register_make(cls): '''class decorator to Register mf make''' assert cls.nxm_headers is not None assert cls.nxm_headers is not [] for nxm_header in cls.nxm_headers: assert nxm_header not in _MF_FIELDS _MF_FIELDS[nxm_header] = cls.make return cls
def _register_make(cls): '''class decorator to Register mf make''' assert cls.nxm_headers is not None assert cls.nxm_headers is not [] for nxm_header in cls.nxm_headers: assert nxm_header not in _MF_FIELDS _MF_FIELDS[nxm_header] = cls.make return cls
[ "class", "decorator", "to", "Register", "mf", "make" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/nx_match.py#L410-L417
[ "def", "_register_make", "(", "cls", ")", ":", "assert", "cls", ".", "nxm_headers", "is", "not", "None", "assert", "cls", ".", "nxm_headers", "is", "not", "[", "]", "for", "nxm_header", "in", "cls", ".", "nxm_headers", ":", "assert", "nxm_header", "not", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
ClsRule.match_tuple
return a tuple which can be used as *args for ofproto_v1_0_parser.OFPMatch.__init__(). see Datapath.send_flow_mod.
ryu/ofproto/nx_match.py
def match_tuple(self): """return a tuple which can be used as *args for ofproto_v1_0_parser.OFPMatch.__init__(). see Datapath.send_flow_mod. """ assert self.flow_format() == ofproto_v1_0.NXFF_OPENFLOW10 wildcards = ofproto_v1_0.OFPFW_ALL if not self.wc.wildcards ...
def match_tuple(self): """return a tuple which can be used as *args for ofproto_v1_0_parser.OFPMatch.__init__(). see Datapath.send_flow_mod. """ assert self.flow_format() == ofproto_v1_0.NXFF_OPENFLOW10 wildcards = ofproto_v1_0.OFPFW_ALL if not self.wc.wildcards ...
[ "return", "a", "tuple", "which", "can", "be", "used", "as", "*", "args", "for", "ofproto_v1_0_parser", ".", "OFPMatch", ".", "__init__", "()", ".", "see", "Datapath", ".", "send_flow_mod", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/nx_match.py#L346-L398
[ "def", "match_tuple", "(", "self", ")", ":", "assert", "self", ".", "flow_format", "(", ")", "==", "ofproto_v1_0", ".", "NXFF_OPENFLOW10", "wildcards", "=", "ofproto_v1_0", ".", "OFPFW_ALL", "if", "not", "self", ".", "wc", ".", "wildcards", "&", "FWW_IN_PORT...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
load_source
This function provides the backward compatibility for 'imp.load_source' in Python 2. :param name: Name used to create or access a module object. :param pathname: Path pointing to the source file. :return: Loaded and initialized module.
ryu/utils.py
def load_source(name, pathname): """ This function provides the backward compatibility for 'imp.load_source' in Python 2. :param name: Name used to create or access a module object. :param pathname: Path pointing to the source file. :return: Loaded and initialized module. """ if six.PY2...
def load_source(name, pathname): """ This function provides the backward compatibility for 'imp.load_source' in Python 2. :param name: Name used to create or access a module object. :param pathname: Path pointing to the source file. :return: Loaded and initialized module. """ if six.PY2...
[ "This", "function", "provides", "the", "backward", "compatibility", "for", "imp", ".", "load_source", "in", "Python", "2", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/utils.py#L28-L42
[ "def", "load_source", "(", "name", ",", "pathname", ")", ":", "if", "six", ".", "PY2", ":", "import", "imp", "return", "imp", ".", "load_source", "(", "name", ",", "pathname", ")", "else", ":", "loader", "=", "importlib", ".", "machinery", ".", "Source...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
_split_addr
Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP address and port. :return: IP address...
ryu/controller/controller.py
def _split_addr(addr): """ Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP addres...
def _split_addr(addr): """ Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP addres...
[ "Splits", "a", "str", "of", "IP", "address", "and", "port", "pair", "into", "(", "host", "port", ")", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/controller/controller.py#L92-L121
[ "def", "_split_addr", "(", "addr", ")", ":", "e", "=", "ValueError", "(", "'Invalid IP address and port pair: \"%s\"'", "%", "addr", ")", "pair", "=", "addr", ".", "rsplit", "(", "':'", ",", "1", ")", "if", "len", "(", "pair", ")", "!=", "2", ":", "rai...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
may_add_vlan
:type packet: ryu.lib.packet.packet.Packet :param packet: :type vlan_id: int (0 <= vlan_id <= 4095) or None (= No VLAN) :param vlan_id:
ryu/services/protocols/vrrp/utils.py
def may_add_vlan(packet, vlan_id): """ :type packet: ryu.lib.packet.packet.Packet :param packet: :type vlan_id: int (0 <= vlan_id <= 4095) or None (= No VLAN) :param vlan_id: """ if vlan_id is None: return e = packet.protocols[0] assert isinstance(e, ethernet.ethernet) v...
def may_add_vlan(packet, vlan_id): """ :type packet: ryu.lib.packet.packet.Packet :param packet: :type vlan_id: int (0 <= vlan_id <= 4095) or None (= No VLAN) :param vlan_id: """ if vlan_id is None: return e = packet.protocols[0] assert isinstance(e, ethernet.ethernet) v...
[ ":", "type", "packet", ":", "ryu", ".", "lib", ".", "packet", ".", "packet", ".", "Packet", ":", "param", "packet", ":", ":", "type", "vlan_id", ":", "int", "(", "0", "<", "=", "vlan_id", "<", "=", "4095", ")", "or", "None", "(", "=", "No", "VL...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/utils.py#L23-L37
[ "def", "may_add_vlan", "(", "packet", ",", "vlan_id", ")", ":", "if", "vlan_id", "is", "None", ":", "return", "e", "=", "packet", ".", "protocols", "[", "0", "]", "assert", "isinstance", "(", "e", ",", "ethernet", ".", "ethernet", ")", "v", "=", "vla...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
get_dp
:type dpid: datapath id :param dpid: :rtype: ryu.controller.controller.Datapath :returns: datapath corresponding to dpid
ryu/services/protocols/vrrp/utils.py
def get_dp(app, dpid): """ :type dpid: datapath id :param dpid: :rtype: ryu.controller.controller.Datapath :returns: datapath corresponding to dpid """ switches = topo_api.get_switch(app, dpid) if not switches: return None assert len(switches) == 1 return switches[0].dp
def get_dp(app, dpid): """ :type dpid: datapath id :param dpid: :rtype: ryu.controller.controller.Datapath :returns: datapath corresponding to dpid """ switches = topo_api.get_switch(app, dpid) if not switches: return None assert len(switches) == 1 return switches[0].dp
[ ":", "type", "dpid", ":", "datapath", "id", ":", "param", "dpid", ":", ":", "rtype", ":", "ryu", ".", "controller", ".", "controller", ".", "Datapath", ":", "returns", ":", "datapath", "corresponding", "to", "dpid" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/vrrp/utils.py#L40-L51
[ "def", "get_dp", "(", "app", ",", "dpid", ")", ":", "switches", "=", "topo_api", ".", "get_switch", "(", "app", ",", "dpid", ")", "if", "not", "switches", ":", "return", "None", "assert", "len", "(", "switches", ")", "==", "1", "return", "switches", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
clone_rtcpath_update_rt_as
Clones given RT NLRI `path`, and updates it with new RT_NLRI AS. Parameters: - `path`: (Path) RT_NLRI path - `new_rt_as`: AS value of cloned paths' RT_NLRI
ryu/services/protocols/bgp/utils/bgp.py
def clone_rtcpath_update_rt_as(path, new_rt_as): """Clones given RT NLRI `path`, and updates it with new RT_NLRI AS. Parameters: - `path`: (Path) RT_NLRI path - `new_rt_as`: AS value of cloned paths' RT_NLRI """ assert path and new_rt_as if not path or path.route_family ...
def clone_rtcpath_update_rt_as(path, new_rt_as): """Clones given RT NLRI `path`, and updates it with new RT_NLRI AS. Parameters: - `path`: (Path) RT_NLRI path - `new_rt_as`: AS value of cloned paths' RT_NLRI """ assert path and new_rt_as if not path or path.route_family ...
[ "Clones", "given", "RT", "NLRI", "path", "and", "updates", "it", "with", "new", "RT_NLRI", "AS", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/bgp.py#L109-L123
[ "def", "clone_rtcpath_update_rt_as", "(", "path", ",", "new_rt_as", ")", ":", "assert", "path", "and", "new_rt_as", "if", "not", "path", "or", "path", ".", "route_family", "!=", "RF_RTC_UC", ":", "raise", "ValueError", "(", "'Expected RT_NLRI path'", ")", "old_n...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
from_inet_ptoi
Convert an IPv4 address string format to a four byte long.
ryu/services/protocols/bgp/utils/bgp.py
def from_inet_ptoi(bgp_id): """Convert an IPv4 address string format to a four byte long. """ four_byte_id = None try: four_byte_id = ip.ipv4_to_int(bgp_id) except ValueError: LOG.debug('Invalid bgp id given for conversion to integer value %s', bgp_id) return f...
def from_inet_ptoi(bgp_id): """Convert an IPv4 address string format to a four byte long. """ four_byte_id = None try: four_byte_id = ip.ipv4_to_int(bgp_id) except ValueError: LOG.debug('Invalid bgp id given for conversion to integer value %s', bgp_id) return f...
[ "Convert", "an", "IPv4", "address", "string", "format", "to", "a", "four", "byte", "long", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/bgp.py#L126-L136
[ "def", "from_inet_ptoi", "(", "bgp_id", ")", ":", "four_byte_id", "=", "None", "try", ":", "four_byte_id", "=", "ip", ".", "ipv4_to_int", "(", "bgp_id", ")", "except", "ValueError", ":", "LOG", ".", "debug", "(", "'Invalid bgp id given for conversion to integer va...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
get_unknown_opttrans_attr
Utility method that gives a `dict` of unknown and unsupported optional transitive path attributes of `path`. Returns dict: <key> - attribute type code, <value> - unknown path-attr.
ryu/services/protocols/bgp/utils/bgp.py
def get_unknown_opttrans_attr(path): """Utility method that gives a `dict` of unknown and unsupported optional transitive path attributes of `path`. Returns dict: <key> - attribute type code, <value> - unknown path-attr. """ path_attrs = path.pathattr_map unknown_opt_tran_attrs = {} for _, ...
def get_unknown_opttrans_attr(path): """Utility method that gives a `dict` of unknown and unsupported optional transitive path attributes of `path`. Returns dict: <key> - attribute type code, <value> - unknown path-attr. """ path_attrs = path.pathattr_map unknown_opt_tran_attrs = {} for _, ...
[ "Utility", "method", "that", "gives", "a", "dict", "of", "unknown", "and", "unsupported", "optional", "transitive", "path", "attributes", "of", "path", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/bgp.py#L139-L155
[ "def", "get_unknown_opttrans_attr", "(", "path", ")", ":", "path_attrs", "=", "path", ".", "pathattr_map", "unknown_opt_tran_attrs", "=", "{", "}", "for", "_", ",", "attr", "in", "path_attrs", ".", "items", "(", ")", ":", "if", "(", "isinstance", "(", "att...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
create_end_of_rib_update
Construct end-of-rib (EOR) Update instance.
ryu/services/protocols/bgp/utils/bgp.py
def create_end_of_rib_update(): """Construct end-of-rib (EOR) Update instance.""" mpunreach_attr = BGPPathAttributeMpUnreachNLRI(RF_IPv4_VPN.afi, RF_IPv4_VPN.safi, []) eor = BGPUpdate(path_attributes=[mpunr...
def create_end_of_rib_update(): """Construct end-of-rib (EOR) Update instance.""" mpunreach_attr = BGPPathAttributeMpUnreachNLRI(RF_IPv4_VPN.afi, RF_IPv4_VPN.safi, []) eor = BGPUpdate(path_attributes=[mpunr...
[ "Construct", "end", "-", "of", "-", "rib", "(", "EOR", ")", "Update", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/bgp.py#L158-L164
[ "def", "create_end_of_rib_update", "(", ")", ":", "mpunreach_attr", "=", "BGPPathAttributeMpUnreachNLRI", "(", "RF_IPv4_VPN", ".", "afi", ",", "RF_IPv4_VPN", ".", "safi", ",", "[", "]", ")", "eor", "=", "BGPUpdate", "(", "path_attributes", "=", "[", "mpunreach_a...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
create_rt_extended_community
Creates an instance of the BGP Route Target Community (if "subtype=2") or Route Origin Community ("subtype=3"). :param value: String of Route Target or Route Origin value. :param subtype: Subtype of Extended Community. :return: An instance of Route Target or Route Origin Community.
ryu/services/protocols/bgp/utils/bgp.py
def create_rt_extended_community(value, subtype=2): """ Creates an instance of the BGP Route Target Community (if "subtype=2") or Route Origin Community ("subtype=3"). :param value: String of Route Target or Route Origin value. :param subtype: Subtype of Extended Community. :return: An instance...
def create_rt_extended_community(value, subtype=2): """ Creates an instance of the BGP Route Target Community (if "subtype=2") or Route Origin Community ("subtype=3"). :param value: String of Route Target or Route Origin value. :param subtype: Subtype of Extended Community. :return: An instance...
[ "Creates", "an", "instance", "of", "the", "BGP", "Route", "Target", "Community", "(", "if", "subtype", "=", "2", ")", "or", "Route", "Origin", "Community", "(", "subtype", "=", "3", ")", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/bgp.py#L171-L201
[ "def", "create_rt_extended_community", "(", "value", ",", "subtype", "=", "2", ")", ":", "global_admin", ",", "local_admin", "=", "value", ".", "split", "(", "':'", ")", "local_admin", "=", "int", "(", "local_admin", ")", "if", "global_admin", ".", "isdigit"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
create_v4flowspec_actions
Create list of traffic filtering actions for Ipv4 Flow Specification and VPNv4 Flow Specification. `` actions`` specifies Traffic Filtering Actions of Flow Specification as a dictionary type value. Returns a list of extended community values.
ryu/services/protocols/bgp/utils/bgp.py
def create_v4flowspec_actions(actions=None): """ Create list of traffic filtering actions for Ipv4 Flow Specification and VPNv4 Flow Specification. `` actions`` specifies Traffic Filtering Actions of Flow Specification as a dictionary type value. Returns a list of extended community values. ...
def create_v4flowspec_actions(actions=None): """ Create list of traffic filtering actions for Ipv4 Flow Specification and VPNv4 Flow Specification. `` actions`` specifies Traffic Filtering Actions of Flow Specification as a dictionary type value. Returns a list of extended community values. ...
[ "Create", "list", "of", "traffic", "filtering", "actions", "for", "Ipv4", "Flow", "Specification", "and", "VPNv4", "Flow", "Specification", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/bgp.py#L204-L229
[ "def", "create_v4flowspec_actions", "(", "actions", "=", "None", ")", ":", "from", "ryu", ".", "services", ".", "protocols", ".", "bgp", ".", "api", ".", "prefix", "import", "(", "FLOWSPEC_ACTION_TRAFFIC_RATE", ",", "FLOWSPEC_ACTION_TRAFFIC_ACTION", ",", "FLOWSPEC...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
create_l2vpnflowspec_actions
Create list of traffic filtering actions for L2VPN Flow Specification.
ryu/services/protocols/bgp/utils/bgp.py
def create_l2vpnflowspec_actions(actions=None): """ Create list of traffic filtering actions for L2VPN Flow Specification. """ from ryu.services.protocols.bgp.api.prefix import ( FLOWSPEC_ACTION_TRAFFIC_RATE, FLOWSPEC_ACTION_TRAFFIC_ACTION, FLOWSPEC_ACTION_REDIRECT, FLOWS...
def create_l2vpnflowspec_actions(actions=None): """ Create list of traffic filtering actions for L2VPN Flow Specification. """ from ryu.services.protocols.bgp.api.prefix import ( FLOWSPEC_ACTION_TRAFFIC_RATE, FLOWSPEC_ACTION_TRAFFIC_ACTION, FLOWSPEC_ACTION_REDIRECT, FLOWS...
[ "Create", "list", "of", "traffic", "filtering", "actions", "for", "L2VPN", "Flow", "Specification", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/bgp.py#L257-L280
[ "def", "create_l2vpnflowspec_actions", "(", "actions", "=", "None", ")", ":", "from", "ryu", ".", "services", ".", "protocols", ".", "bgp", ".", "api", ".", "prefix", "import", "(", "FLOWSPEC_ACTION_TRAFFIC_RATE", ",", "FLOWSPEC_ACTION_TRAFFIC_ACTION", ",", "FLOWS...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
vlan.get_packet_type
Override method for the Length/Type field (self.ethertype). The Length/Type field means Length or Type interpretation, same as ethernet IEEE802.3. If the value of Length/Type field is less than or equal to 1500 decimal(05DC hexadecimal), it means Length interpretation and be pass...
ryu/lib/packet/vlan.py
def get_packet_type(cls, type_): """Override method for the Length/Type field (self.ethertype). The Length/Type field means Length or Type interpretation, same as ethernet IEEE802.3. If the value of Length/Type field is less than or equal to 1500 decimal(05DC hexadecimal), it mea...
def get_packet_type(cls, type_): """Override method for the Length/Type field (self.ethertype). The Length/Type field means Length or Type interpretation, same as ethernet IEEE802.3. If the value of Length/Type field is less than or equal to 1500 decimal(05DC hexadecimal), it mea...
[ "Override", "method", "for", "the", "Length", "/", "Type", "field", "(", "self", ".", "ethertype", ")", ".", "The", "Length", "/", "Type", "field", "means", "Length", "or", "Type", "interpretation", "same", "as", "ethernet", "IEEE802", ".", "3", ".", "If...
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/vlan.py#L79-L88
[ "def", "get_packet_type", "(", "cls", ",", "type_", ")", ":", "if", "type_", "<=", "ether", ".", "ETH_TYPE_IEEE802_3", ":", "type_", "=", "ether", ".", "ETH_TYPE_IEEE802_3", "return", "cls", ".", "_TYPES", ".", "get", "(", "type_", ")" ]
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
sql_function
Decorator for wrapping the given function in order to manipulate (CRUD) the records safely. For the adding/updating/deleting records function, this decorator invokes "Session.commit()" after the given function. If any exception while modifying records raised, this decorator invokes "Session.rollbac...
ryu/services/protocols/zebra/db/base.py
def sql_function(func): """ Decorator for wrapping the given function in order to manipulate (CRUD) the records safely. For the adding/updating/deleting records function, this decorator invokes "Session.commit()" after the given function. If any exception while modifying records raised, this de...
def sql_function(func): """ Decorator for wrapping the given function in order to manipulate (CRUD) the records safely. For the adding/updating/deleting records function, this decorator invokes "Session.commit()" after the given function. If any exception while modifying records raised, this de...
[ "Decorator", "for", "wrapping", "the", "given", "function", "in", "order", "to", "manipulate", "(", "CRUD", ")", "the", "records", "safely", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/db/base.py#L42-L71
[ "def", "sql_function", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "_wrapper", "(", "session", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "None", "try", ":", "ret", "=", "func", "(", "sess...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
send_msg
Send an OpenFlow message and wait for reply messages. :param app: Client RyuApp instance :param msg: An OpenFlow controller-to-switch message to send :param reply_cls: OpenFlow message class for expected replies. None means no replies are expected. The default is None. :param reply_multi: True...
ryu/app/ofctl/api.py
def send_msg(app, msg, reply_cls=None, reply_multi=False): """ Send an OpenFlow message and wait for reply messages. :param app: Client RyuApp instance :param msg: An OpenFlow controller-to-switch message to send :param reply_cls: OpenFlow message class for expected replies. None means no r...
def send_msg(app, msg, reply_cls=None, reply_multi=False): """ Send an OpenFlow message and wait for reply messages. :param app: Client RyuApp instance :param msg: An OpenFlow controller-to-switch message to send :param reply_cls: OpenFlow message class for expected replies. None means no r...
[ "Send", "an", "OpenFlow", "message", "and", "wait", "for", "reply", "messages", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/app/ofctl/api.py#L53-L89
[ "def", "send_msg", "(", "app", ",", "msg", ",", "reply_cls", "=", "None", ",", "reply_multi", "=", "False", ")", ":", "return", "app", ".", "send_request", "(", "event", ".", "SendMsgRequest", "(", "msg", "=", "msg", ",", "reply_cls", "=", "reply_cls", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
start
Starts new context using provided configuration. Raises RuntimeConfigError if a context is already active.
ryu/services/protocols/bgp/api/core.py
def start(**kwargs): """Starts new context using provided configuration. Raises RuntimeConfigError if a context is already active. """ if CORE_MANAGER.started: raise RuntimeConfigError('Current context has to be stopped to start ' 'a new context.') try: ...
def start(**kwargs): """Starts new context using provided configuration. Raises RuntimeConfigError if a context is already active. """ if CORE_MANAGER.started: raise RuntimeConfigError('Current context has to be stopped to start ' 'a new context.') try: ...
[ "Starts", "new", "context", "using", "provided", "configuration", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/core.py#L31-L47
[ "def", "start", "(", "*", "*", "kwargs", ")", ":", "if", "CORE_MANAGER", ".", "started", ":", "raise", "RuntimeConfigError", "(", "'Current context has to be stopped to start '", "'a new context.'", ")", "try", ":", "waiter", "=", "kwargs", ".", "pop", "(", "'wa...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
validate_rpc_host
Validates the given ip for use as RPC server address.
ryu/services/protocols/bgp/application.py
def validate_rpc_host(ip): """ Validates the given ip for use as RPC server address. """ if not is_valid_ipv4(ip) and not is_valid_ipv6(ip): raise ApplicationException( desc='Invalid RPC ip address: %s' % ip) return ip
def validate_rpc_host(ip): """ Validates the given ip for use as RPC server address. """ if not is_valid_ipv4(ip) and not is_valid_ipv6(ip): raise ApplicationException( desc='Invalid RPC ip address: %s' % ip) return ip
[ "Validates", "the", "given", "ip", "for", "use", "as", "RPC", "server", "address", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/application.py#L153-L160
[ "def", "validate_rpc_host", "(", "ip", ")", ":", "if", "not", "is_valid_ipv4", "(", "ip", ")", "and", "not", "is_valid_ipv6", "(", "ip", ")", ":", "raise", "ApplicationException", "(", "desc", "=", "'Invalid RPC ip address: %s'", "%", "ip", ")", "return", "i...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
load_config
Validates the given file for use as the settings file for BGPSpeaker and loads the configuration from the given file as a module instance.
ryu/services/protocols/bgp/application.py
def load_config(config_file): """ Validates the given file for use as the settings file for BGPSpeaker and loads the configuration from the given file as a module instance. """ if not config_file or not os.path.isfile(config_file): raise ApplicationException( desc='Invalid config...
def load_config(config_file): """ Validates the given file for use as the settings file for BGPSpeaker and loads the configuration from the given file as a module instance. """ if not config_file or not os.path.isfile(config_file): raise ApplicationException( desc='Invalid config...
[ "Validates", "the", "given", "file", "for", "use", "as", "the", "settings", "file", "for", "BGPSpeaker", "and", "loads", "the", "configuration", "from", "the", "given", "file", "as", "a", "module", "instance", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/application.py#L163-L176
[ "def", "load_config", "(", "config_file", ")", ":", "if", "not", "config_file", "or", "not", "os", ".", "path", ".", "isfile", "(", "config_file", ")", ":", "raise", "ApplicationException", "(", "desc", "=", "'Invalid configuration file: %s'", "%", "config_file"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RyuBGPSpeaker._start_speaker
Starts BGPSpeaker using the given settings.
ryu/services/protocols/bgp/application.py
def _start_speaker(self, settings): """ Starts BGPSpeaker using the given settings. """ # Check required settings. _required_settings = ( LOCAL_AS, ROUTER_ID, ) for required in _required_settings: if required not in settings: ...
def _start_speaker(self, settings): """ Starts BGPSpeaker using the given settings. """ # Check required settings. _required_settings = ( LOCAL_AS, ROUTER_ID, ) for required in _required_settings: if required not in settings: ...
[ "Starts", "BGPSpeaker", "using", "the", "given", "settings", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/application.py#L319-L363
[ "def", "_start_speaker", "(", "self", ",", "settings", ")", ":", "# Check required settings.", "_required_settings", "=", "(", "LOCAL_AS", ",", "ROUTER_ID", ",", ")", "for", "required", "in", "_required_settings", ":", "if", "required", "not", "in", "settings", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RyuBGPSpeaker._add_neighbors
Add BGP neighbors from the given settings. All valid neighbors are loaded. Miss-configured neighbors are ignored and errors are logged.
ryu/services/protocols/bgp/application.py
def _add_neighbors(self, settings): """ Add BGP neighbors from the given settings. All valid neighbors are loaded. Miss-configured neighbors are ignored and errors are logged. """ for neighbor_settings in settings: LOG.debug('Adding neighbor settings: %s', ne...
def _add_neighbors(self, settings): """ Add BGP neighbors from the given settings. All valid neighbors are loaded. Miss-configured neighbors are ignored and errors are logged. """ for neighbor_settings in settings: LOG.debug('Adding neighbor settings: %s', ne...
[ "Add", "BGP", "neighbors", "from", "the", "given", "settings", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/application.py#L381-L393
[ "def", "_add_neighbors", "(", "self", ",", "settings", ")", ":", "for", "neighbor_settings", "in", "settings", ":", "LOG", ".", "debug", "(", "'Adding neighbor settings: %s'", ",", "neighbor_settings", ")", "try", ":", "self", ".", "speaker", ".", "neighbor_add"...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RyuBGPSpeaker._add_vrfs
Add BGP VRFs from the given settings. All valid VRFs are loaded. Miss-configured VRFs are ignored and errors are logged.
ryu/services/protocols/bgp/application.py
def _add_vrfs(self, settings): """ Add BGP VRFs from the given settings. All valid VRFs are loaded. Miss-configured VRFs are ignored and errors are logged. """ for vrf_settings in settings: LOG.debug('Adding VRF settings: %s', vrf_settings) try: ...
def _add_vrfs(self, settings): """ Add BGP VRFs from the given settings. All valid VRFs are loaded. Miss-configured VRFs are ignored and errors are logged. """ for vrf_settings in settings: LOG.debug('Adding VRF settings: %s', vrf_settings) try: ...
[ "Add", "BGP", "VRFs", "from", "the", "given", "settings", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/application.py#L395-L407
[ "def", "_add_vrfs", "(", "self", ",", "settings", ")", ":", "for", "vrf_settings", "in", "settings", ":", "LOG", ".", "debug", "(", "'Adding VRF settings: %s'", ",", "vrf_settings", ")", "try", ":", "self", ".", "speaker", ".", "vrf_add", "(", "*", "*", ...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
RyuBGPSpeaker._add_routes
Add BGP routes from given settings. All valid routes are loaded. Miss-configured routes are ignored and errors are logged.
ryu/services/protocols/bgp/application.py
def _add_routes(self, settings): """ Add BGP routes from given settings. All valid routes are loaded. Miss-configured routes are ignored and errors are logged. """ for route_settings in settings: if 'prefix' in route_settings: prefix_add = sel...
def _add_routes(self, settings): """ Add BGP routes from given settings. All valid routes are loaded. Miss-configured routes are ignored and errors are logged. """ for route_settings in settings: if 'prefix' in route_settings: prefix_add = sel...
[ "Add", "BGP", "routes", "from", "given", "settings", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/application.py#L409-L431
[ "def", "_add_routes", "(", "self", ",", "settings", ")", ":", "for", "route_settings", "in", "settings", ":", "if", "'prefix'", "in", "route_settings", ":", "prefix_add", "=", "self", ".", "speaker", ".", "prefix_add", "elif", "'route_type'", "in", "route_sett...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
valid_ovsdb_addr
Returns True if the given addr is valid OVSDB server address, otherwise False. The valid formats are: - ``unix:file`` - ``tcp:ip:port`` - ``ssl:ip:port`` If ip is IPv6 address, wrap ip with brackets (e.g., ssl:[::1]:6640). :param addr: str value of OVSDB server address. :return: True...
ryu/lib/ovs/vsctl.py
def valid_ovsdb_addr(addr): """ Returns True if the given addr is valid OVSDB server address, otherwise False. The valid formats are: - ``unix:file`` - ``tcp:ip:port`` - ``ssl:ip:port`` If ip is IPv6 address, wrap ip with brackets (e.g., ssl:[::1]:6640). :param addr: str value of...
def valid_ovsdb_addr(addr): """ Returns True if the given addr is valid OVSDB server address, otherwise False. The valid formats are: - ``unix:file`` - ``tcp:ip:port`` - ``ssl:ip:port`` If ip is IPv6 address, wrap ip with brackets (e.g., ssl:[::1]:6640). :param addr: str value of...
[ "Returns", "True", "if", "the", "given", "addr", "is", "valid", "OVSDB", "server", "address", "otherwise", "False", "." ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L52-L84
[ "def", "valid_ovsdb_addr", "(", "addr", ")", ":", "# Assumes Unix socket format: \"unix:file\"", "m", "=", "re", ".", "match", "(", "r'unix:(\\S+)'", ",", "addr", ")", "if", "m", ":", "file", "=", "m", ".", "group", "(", "1", ")", "return", "os", ".", "p...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtlContext.add_port
:type settings: list of (column, value_json) where column is str, value_json is json that is represented by Datum.to_json()
ryu/lib/ovs/vsctl.py
def add_port(self, br_name, port_name, may_exist, fake_iface, iface_names, settings=None): """ :type settings: list of (column, value_json) where column is str, value_json is json that is represented ...
def add_port(self, br_name, port_name, may_exist, fake_iface, iface_names, settings=None): """ :type settings: list of (column, value_json) where column is str, value_json is json that is represented ...
[ ":", "type", "settings", ":", "list", "of", "(", "column", "value_json", ")", "where", "column", "is", "str", "value_json", "is", "json", "that", "is", "represented", "by", "Datum", ".", "to_json", "()" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L623-L685
[ "def", "add_port", "(", "self", ",", "br_name", ",", "port_name", ",", "may_exist", ",", "fake_iface", ",", "iface_names", ",", "settings", "=", "None", ")", ":", "settings", "=", "settings", "or", "[", "]", "self", ".", "populate_cache", "(", ")", "if",...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c
train
VSCtlContext.parse_column_key
Parses 'setting_string' as str formatted in <column>[:<key>] and returns str type 'column' and 'key'
ryu/lib/ovs/vsctl.py
def parse_column_key(setting_string): """ Parses 'setting_string' as str formatted in <column>[:<key>] and returns str type 'column' and 'key' """ if ':' in setting_string: # splits <column>:<key> into <column> and <key> column, key = setting_string.split(...
def parse_column_key(setting_string): """ Parses 'setting_string' as str formatted in <column>[:<key>] and returns str type 'column' and 'key' """ if ':' in setting_string: # splits <column>:<key> into <column> and <key> column, key = setting_string.split(...
[ "Parses", "setting_string", "as", "str", "formatted", "in", "<column", ">", "[", ":", "<key", ">", "]", "and", "returns", "str", "type", "column", "and", "key" ]
osrg/ryu
python
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/vsctl.py#L759-L772
[ "def", "parse_column_key", "(", "setting_string", ")", ":", "if", "':'", "in", "setting_string", ":", "# splits <column>:<key> into <column> and <key>", "column", ",", "key", "=", "setting_string", ".", "split", "(", "':'", ",", "1", ")", "else", ":", "# stores <c...
6f906e72c92e10bd0264c9b91a2f7bb85b97780c