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 | BGPSpeaker.in_filter_get | This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
Returns a list object containing an instance of Filter sub-class | ryu/services/protocols/bgp/bgpspeaker.py | def in_filter_get(self, address):
"""This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
Returns a list object containing an instance of Filter sub-class
"""
func_name = 'neighbor.in_filter.get'
param = {
... | def in_filter_get(self, address):
"""This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
Returns a list object containing an instance of Filter sub-class
"""
func_name = 'neighbor.in_filter.get'
param = {
... | [
"This",
"method",
"gets",
"in",
"-",
"bound",
"filters",
"of",
"the",
"specified",
"neighbor",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1254-L1267 | [
"def",
"in_filter_get",
"(",
"self",
",",
"address",
")",
":",
"func_name",
"=",
"'neighbor.in_filter.get'",
"param",
"=",
"{",
"neighbors",
".",
"IP_ADDRESS",
":",
"address",
",",
"}",
"return",
"call",
"(",
"func_name",
",",
"*",
"*",
"param",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.bmp_server_add | This method registers a new BMP (BGP monitoring Protocol)
server. The BGP speaker starts to send BMP messages to the
server. Currently, only one BMP server can be registered.
``address`` specifies the IP address of a BMP server.
``port`` specifies the listen port number of a BMP server... | ryu/services/protocols/bgp/bgpspeaker.py | def bmp_server_add(self, address, port):
"""This method registers a new BMP (BGP monitoring Protocol)
server. The BGP speaker starts to send BMP messages to the
server. Currently, only one BMP server can be registered.
``address`` specifies the IP address of a BMP server.
``por... | def bmp_server_add(self, address, port):
"""This method registers a new BMP (BGP monitoring Protocol)
server. The BGP speaker starts to send BMP messages to the
server. Currently, only one BMP server can be registered.
``address`` specifies the IP address of a BMP server.
``por... | [
"This",
"method",
"registers",
"a",
"new",
"BMP",
"(",
"BGP",
"monitoring",
"Protocol",
")",
"server",
".",
"The",
"BGP",
"speaker",
"starts",
"to",
"send",
"BMP",
"messages",
"to",
"the",
"server",
".",
"Currently",
"only",
"one",
"BMP",
"server",
"can",
... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1269-L1285 | [
"def",
"bmp_server_add",
"(",
"self",
",",
"address",
",",
"port",
")",
":",
"func_name",
"=",
"'bmp.start'",
"param",
"=",
"{",
"'host'",
":",
"address",
",",
"'port'",
":",
"port",
",",
"}",
"call",
"(",
"func_name",
",",
"*",
"*",
"param",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.bmp_server_del | This method unregister the registered BMP server.
``address`` specifies the IP address of a BMP server.
``port`` specifies the listen port number of a BMP server. | ryu/services/protocols/bgp/bgpspeaker.py | def bmp_server_del(self, address, port):
""" This method unregister the registered BMP server.
``address`` specifies the IP address of a BMP server.
``port`` specifies the listen port number of a BMP server.
"""
func_name = 'bmp.stop'
param = {
'host': addr... | def bmp_server_del(self, address, port):
""" This method unregister the registered BMP server.
``address`` specifies the IP address of a BMP server.
``port`` specifies the listen port number of a BMP server.
"""
func_name = 'bmp.stop'
param = {
'host': addr... | [
"This",
"method",
"unregister",
"the",
"registered",
"BMP",
"server",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1287-L1301 | [
"def",
"bmp_server_del",
"(",
"self",
",",
"address",
",",
"port",
")",
":",
"func_name",
"=",
"'bmp.stop'",
"param",
"=",
"{",
"'host'",
":",
"address",
",",
"'port'",
":",
"port",
",",
"}",
"call",
"(",
"func_name",
",",
"*",
"*",
"param",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.attribute_map_set | This method sets attribute mapping to a neighbor.
attribute mapping can be used when you want to apply
attribute to BGPUpdate under specific conditions.
``address`` specifies the IP address of the neighbor
``attribute_maps`` specifies attribute_map list that are used
before pat... | ryu/services/protocols/bgp/bgpspeaker.py | def attribute_map_set(self, address, attribute_maps,
route_dist=None, route_family=RF_VPN_V4):
"""This method sets attribute mapping to a neighbor.
attribute mapping can be used when you want to apply
attribute to BGPUpdate under specific conditions.
``address`... | def attribute_map_set(self, address, attribute_maps,
route_dist=None, route_family=RF_VPN_V4):
"""This method sets attribute mapping to a neighbor.
attribute mapping can be used when you want to apply
attribute to BGPUpdate under specific conditions.
``address`... | [
"This",
"method",
"sets",
"attribute",
"mapping",
"to",
"a",
"neighbor",
".",
"attribute",
"mapping",
"can",
"be",
"used",
"when",
"you",
"want",
"to",
"apply",
"attribute",
"to",
"BGPUpdate",
"under",
"specific",
"conditions",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1303-L1347 | [
"def",
"attribute_map_set",
"(",
"self",
",",
"address",
",",
"attribute_maps",
",",
"route_dist",
"=",
"None",
",",
"route_family",
"=",
"RF_VPN_V4",
")",
":",
"if",
"route_family",
"not",
"in",
"SUPPORTED_VRF_RF",
":",
"raise",
"ValueError",
"(",
"'Unsupported... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker.attribute_map_get | This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
``route_dist`` specifies route distinguisher that has attribute_maps.
``route_family`` specifies route family of the VRF.
This parameter must be one of the following.
... | ryu/services/protocols/bgp/bgpspeaker.py | def attribute_map_get(self, address, route_dist=None,
route_family=RF_VPN_V4):
"""This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
``route_dist`` specifies route distinguisher that has attribute_maps.
... | def attribute_map_get(self, address, route_dist=None,
route_family=RF_VPN_V4):
"""This method gets in-bound filters of the specified neighbor.
``address`` specifies the IP address of the neighbor.
``route_dist`` specifies route distinguisher that has attribute_maps.
... | [
"This",
"method",
"gets",
"in",
"-",
"bound",
"filters",
"of",
"the",
"specified",
"neighbor",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1349-L1377 | [
"def",
"attribute_map_get",
"(",
"self",
",",
"address",
",",
"route_dist",
"=",
"None",
",",
"route_family",
"=",
"RF_VPN_V4",
")",
":",
"if",
"route_family",
"not",
"in",
"SUPPORTED_VRF_RF",
":",
"raise",
"ValueError",
"(",
"'Unsupported route_family: %s'",
"%",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BGPSpeaker._check_rf_and_normalize | check prefix's route_family and if the address is
IPv6 address, return IPv6 route_family and normalized IPv6 address.
If the address is IPv4 address, return IPv4 route_family
and the prefix itself. | ryu/services/protocols/bgp/bgpspeaker.py | def _check_rf_and_normalize(prefix):
""" check prefix's route_family and if the address is
IPv6 address, return IPv6 route_family and normalized IPv6 address.
If the address is IPv4 address, return IPv4 route_family
and the prefix itself.
"""
addr, masklen = prefix.split(... | def _check_rf_and_normalize(prefix):
""" check prefix's route_family and if the address is
IPv6 address, return IPv6 route_family and normalized IPv6 address.
If the address is IPv4 address, return IPv4 route_family
and the prefix itself.
"""
addr, masklen = prefix.split(... | [
"check",
"prefix",
"s",
"route_family",
"and",
"if",
"the",
"address",
"is",
"IPv6",
"address",
"return",
"IPv6",
"route_family",
"and",
"normalized",
"IPv6",
"address",
".",
"If",
"the",
"address",
"is",
"IPv4",
"address",
"return",
"IPv4",
"route_family",
"a... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1380-L1392 | [
"def",
"_check_rf_and_normalize",
"(",
"prefix",
")",
":",
"addr",
",",
"masklen",
"=",
"prefix",
".",
"split",
"(",
"'/'",
")",
"if",
"ip",
".",
"valid_ipv6",
"(",
"addr",
")",
":",
"# normalize IPv6 address",
"ipv6_prefix",
"=",
"str",
"(",
"netaddr",
".... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDSession.set_remote_addr | Configure remote ethernet and IP addresses. | ryu/lib/bfdlib.py | def set_remote_addr(self, dst_mac, dst_ip):
"""
Configure remote ethernet and IP addresses.
"""
self.dst_mac = dst_mac
self.dst_ip = dst_ip
if not (dst_mac == "FF:FF:FF:FF:FF:FF" or dst_ip == "255.255.255.255"):
self._remote_addr_config = True
LOG.in... | def set_remote_addr(self, dst_mac, dst_ip):
"""
Configure remote ethernet and IP addresses.
"""
self.dst_mac = dst_mac
self.dst_ip = dst_ip
if not (dst_mac == "FF:FF:FF:FF:FF:FF" or dst_ip == "255.255.255.255"):
self._remote_addr_config = True
LOG.in... | [
"Configure",
"remote",
"ethernet",
"and",
"IP",
"addresses",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L216-L227 | [
"def",
"set_remote_addr",
"(",
"self",
",",
"dst_mac",
",",
"dst_ip",
")",
":",
"self",
".",
"dst_mac",
"=",
"dst_mac",
"self",
".",
"dst_ip",
"=",
"dst_ip",
"if",
"not",
"(",
"dst_mac",
"==",
"\"FF:FF:FF:FF:FF:FF\"",
"or",
"dst_ip",
"==",
"\"255.255.255.255... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDSession.recv | BFD packet receiver. | ryu/lib/bfdlib.py | def recv(self, bfd_pkt):
"""
BFD packet receiver.
"""
LOG.debug("[BFD][%s][RECV] BFD Control received: %s",
hex(self._local_discr), six.binary_type(bfd_pkt))
self._remote_discr = bfd_pkt.my_discr
self._remote_state = bfd_pkt.state
self._remote_de... | def recv(self, bfd_pkt):
"""
BFD packet receiver.
"""
LOG.debug("[BFD][%s][RECV] BFD Control received: %s",
hex(self._local_discr), six.binary_type(bfd_pkt))
self._remote_discr = bfd_pkt.my_discr
self._remote_state = bfd_pkt.state
self._remote_de... | [
"BFD",
"packet",
"receiver",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L229-L309 | [
"def",
"recv",
"(",
"self",
",",
"bfd_pkt",
")",
":",
"LOG",
".",
"debug",
"(",
"\"[BFD][%s][RECV] BFD Control received: %s\"",
",",
"hex",
"(",
"self",
".",
"_local_discr",
")",
",",
"six",
".",
"binary_type",
"(",
"bfd_pkt",
")",
")",
"self",
".",
"_remo... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDSession._set_state | Set the state of the BFD session. | ryu/lib/bfdlib.py | def _set_state(self, new_state, diag=None):
"""
Set the state of the BFD session.
"""
old_state = self._session_state
LOG.info("[BFD][%s][STATE] State changed from %s to %s.",
hex(self._local_discr),
bfd.BFD_STATE_NAME[old_state],
... | def _set_state(self, new_state, diag=None):
"""
Set the state of the BFD session.
"""
old_state = self._session_state
LOG.info("[BFD][%s][STATE] State changed from %s to %s.",
hex(self._local_discr),
bfd.BFD_STATE_NAME[old_state],
... | [
"Set",
"the",
"state",
"of",
"the",
"BFD",
"session",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L311-L335 | [
"def",
"_set_state",
"(",
"self",
",",
"new_state",
",",
"diag",
"=",
"None",
")",
":",
"old_state",
"=",
"self",
".",
"_session_state",
"LOG",
".",
"info",
"(",
"\"[BFD][%s][STATE] State changed from %s to %s.\"",
",",
"hex",
"(",
"self",
".",
"_local_discr",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDSession._recv_timeout_loop | A loop to check timeout of receiving remote BFD packet. | ryu/lib/bfdlib.py | def _recv_timeout_loop(self):
"""
A loop to check timeout of receiving remote BFD packet.
"""
while self._detect_time:
last_wait = time.time()
self._lock = hub.Event()
self._lock.wait(timeout=self._detect_time)
if self._lock.is_set():
... | def _recv_timeout_loop(self):
"""
A loop to check timeout of receiving remote BFD packet.
"""
while self._detect_time:
last_wait = time.time()
self._lock = hub.Event()
self._lock.wait(timeout=self._detect_time)
if self._lock.is_set():
... | [
"A",
"loop",
"to",
"check",
"timeout",
"of",
"receiving",
"remote",
"BFD",
"packet",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L337-L364 | [
"def",
"_recv_timeout_loop",
"(",
"self",
")",
":",
"while",
"self",
".",
"_detect_time",
":",
"last_wait",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"_lock",
"=",
"hub",
".",
"Event",
"(",
")",
"self",
".",
"_lock",
".",
"wait",
"(",
"timeout... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDSession._update_xmit_period | Update transmission period of the BFD session. | ryu/lib/bfdlib.py | def _update_xmit_period(self):
"""
Update transmission period of the BFD session.
"""
# RFC5880 Section 6.8.7.
if self._desired_min_tx_interval > self._remote_min_rx_interval:
xmit_period = self._desired_min_tx_interval
else:
xmit_period = self._re... | def _update_xmit_period(self):
"""
Update transmission period of the BFD session.
"""
# RFC5880 Section 6.8.7.
if self._desired_min_tx_interval > self._remote_min_rx_interval:
xmit_period = self._desired_min_tx_interval
else:
xmit_period = self._re... | [
"Update",
"transmission",
"period",
"of",
"the",
"BFD",
"session",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L366-L385 | [
"def",
"_update_xmit_period",
"(",
"self",
")",
":",
"# RFC5880 Section 6.8.7.",
"if",
"self",
".",
"_desired_min_tx_interval",
">",
"self",
".",
"_remote_min_rx_interval",
":",
"xmit_period",
"=",
"self",
".",
"_desired_min_tx_interval",
"else",
":",
"xmit_period",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDSession._send_loop | A loop to proceed periodic BFD packet transmission. | ryu/lib/bfdlib.py | def _send_loop(self):
"""
A loop to proceed periodic BFD packet transmission.
"""
while self._enable_send:
hub.sleep(self._xmit_period)
# Send BFD packet. (RFC5880 Section 6.8.7.)
if self._remote_discr == 0 and not self._active_role:
... | def _send_loop(self):
"""
A loop to proceed periodic BFD packet transmission.
"""
while self._enable_send:
hub.sleep(self._xmit_period)
# Send BFD packet. (RFC5880 Section 6.8.7.)
if self._remote_discr == 0 and not self._active_role:
... | [
"A",
"loop",
"to",
"proceed",
"periodic",
"BFD",
"packet",
"transmission",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L387-L408 | [
"def",
"_send_loop",
"(",
"self",
")",
":",
"while",
"self",
".",
"_enable_send",
":",
"hub",
".",
"sleep",
"(",
"self",
".",
"_xmit_period",
")",
"# Send BFD packet. (RFC5880 Section 6.8.7.)",
"if",
"self",
".",
"_remote_discr",
"==",
"0",
"and",
"not",
"self... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDSession._send | BFD packet sender. | ryu/lib/bfdlib.py | def _send(self):
"""
BFD packet sender.
"""
# If the switch was not connected to controller, exit.
if self.datapath is None:
return
# BFD Flags Setup
flags = 0
if self._pending_final:
flags |= bfd.BFD_FLAG_FINAL
self._... | def _send(self):
"""
BFD packet sender.
"""
# If the switch was not connected to controller, exit.
if self.datapath is None:
return
# BFD Flags Setup
flags = 0
if self._pending_final:
flags |= bfd.BFD_FLAG_FINAL
self._... | [
"BFD",
"packet",
"sender",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L410-L511 | [
"def",
"_send",
"(",
"self",
")",
":",
"# If the switch was not connected to controller, exit.",
"if",
"self",
".",
"datapath",
"is",
"None",
":",
"return",
"# BFD Flags Setup",
"flags",
"=",
"0",
"if",
"self",
".",
"_pending_final",
":",
"flags",
"|=",
"bfd",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDPacket.bfd_packet | Generate BFD packet with Ethernet/IPv4/UDP encapsulated. | ryu/lib/bfdlib.py | def bfd_packet(src_mac, dst_mac, src_ip, dst_ip, ipv4_id,
src_port, dst_port,
diag=0, state=0, flags=0, detect_mult=0,
my_discr=0, your_discr=0, desired_min_tx_interval=0,
required_min_rx_interval=0,
required_min_echo_rx_inte... | def bfd_packet(src_mac, dst_mac, src_ip, dst_ip, ipv4_id,
src_port, dst_port,
diag=0, state=0, flags=0, detect_mult=0,
my_discr=0, your_discr=0, desired_min_tx_interval=0,
required_min_rx_interval=0,
required_min_echo_rx_inte... | [
"Generate",
"BFD",
"packet",
"with",
"Ethernet",
"/",
"IPv4",
"/",
"UDP",
"encapsulated",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L524-L562 | [
"def",
"bfd_packet",
"(",
"src_mac",
",",
"dst_mac",
",",
"src_ip",
",",
"dst_ip",
",",
"ipv4_id",
",",
"src_port",
",",
"dst_port",
",",
"diag",
"=",
"0",
",",
"state",
"=",
"0",
",",
"flags",
"=",
"0",
",",
"detect_mult",
"=",
"0",
",",
"my_discr",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDPacket.bfd_parse | Parse raw packet and return BFD class from packet library. | ryu/lib/bfdlib.py | def bfd_parse(data):
"""
Parse raw packet and return BFD class from packet library.
"""
pkt = packet.Packet(data)
i = iter(pkt)
eth_pkt = next(i)
assert isinstance(eth_pkt, ethernet.ethernet)
ipv4_pkt = next(i)
assert isinstance(ipv4_pkt, ipv4.ip... | def bfd_parse(data):
"""
Parse raw packet and return BFD class from packet library.
"""
pkt = packet.Packet(data)
i = iter(pkt)
eth_pkt = next(i)
assert isinstance(eth_pkt, ethernet.ethernet)
ipv4_pkt = next(i)
assert isinstance(ipv4_pkt, ipv4.ip... | [
"Parse",
"raw",
"packet",
"and",
"return",
"BFD",
"class",
"from",
"packet",
"library",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L565-L583 | [
"def",
"bfd_parse",
"(",
"data",
")",
":",
"pkt",
"=",
"packet",
".",
"Packet",
"(",
"data",
")",
"i",
"=",
"iter",
"(",
"pkt",
")",
"eth_pkt",
"=",
"next",
"(",
"i",
")",
"assert",
"isinstance",
"(",
"eth_pkt",
",",
"ethernet",
".",
"ethernet",
")... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ARPPacket.arp_packet | Generate ARP packet with ethernet encapsulated. | ryu/lib/bfdlib.py | def arp_packet(opcode, src_mac, src_ip, dst_mac, dst_ip):
"""
Generate ARP packet with ethernet encapsulated.
"""
# Generate ethernet header first.
pkt = packet.Packet()
eth_pkt = ethernet.ethernet(dst_mac, src_mac, ETH_TYPE_ARP)
pkt.add_protocol(eth_pkt)
... | def arp_packet(opcode, src_mac, src_ip, dst_mac, dst_ip):
"""
Generate ARP packet with ethernet encapsulated.
"""
# Generate ethernet header first.
pkt = packet.Packet()
eth_pkt = ethernet.ethernet(dst_mac, src_mac, ETH_TYPE_ARP)
pkt.add_protocol(eth_pkt)
... | [
"Generate",
"ARP",
"packet",
"with",
"ethernet",
"encapsulated",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L596-L610 | [
"def",
"arp_packet",
"(",
"opcode",
",",
"src_mac",
",",
"src_ip",
",",
"dst_mac",
",",
"dst_ip",
")",
":",
"# Generate ethernet header first.",
"pkt",
"=",
"packet",
".",
"Packet",
"(",
")",
"eth_pkt",
"=",
"ethernet",
".",
"ethernet",
"(",
"dst_mac",
",",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ARPPacket.arp_parse | Parse ARP packet, return ARP class from packet library. | ryu/lib/bfdlib.py | def arp_parse(data):
"""
Parse ARP packet, return ARP class from packet library.
"""
# Iteratize pkt
pkt = packet.Packet(data)
i = iter(pkt)
eth_pkt = next(i)
# Ensure it's an ethernet frame.
assert isinstance(eth_pkt, ethernet.ethernet)
a... | def arp_parse(data):
"""
Parse ARP packet, return ARP class from packet library.
"""
# Iteratize pkt
pkt = packet.Packet(data)
i = iter(pkt)
eth_pkt = next(i)
# Ensure it's an ethernet frame.
assert isinstance(eth_pkt, ethernet.ethernet)
a... | [
"Parse",
"ARP",
"packet",
"return",
"ARP",
"class",
"from",
"packet",
"library",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L613-L636 | [
"def",
"arp_parse",
"(",
"data",
")",
":",
"# Iteratize pkt",
"pkt",
"=",
"packet",
".",
"Packet",
"(",
"data",
")",
"i",
"=",
"iter",
"(",
"pkt",
")",
"eth_pkt",
"=",
"next",
"(",
"i",
")",
"# Ensure it's an ethernet frame.",
"assert",
"isinstance",
"(",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | BFDLib.add_bfd_session | Establish a new BFD session and return My Discriminator of new session.
Configure the BFD session with the following arguments.
================ ======================================================
Argument Description
================ ========================================... | ryu/lib/bfdlib.py | def add_bfd_session(self, dpid, ofport, src_mac, src_ip,
dst_mac="FF:FF:FF:FF:FF:FF", dst_ip="255.255.255.255",
auth_type=0, auth_keys=None):
"""
Establish a new BFD session and return My Discriminator of new session.
Configure the BFD session wit... | def add_bfd_session(self, dpid, ofport, src_mac, src_ip,
dst_mac="FF:FF:FF:FF:FF:FF", dst_ip="255.255.255.255",
auth_type=0, auth_keys=None):
"""
Establish a new BFD session and return My Discriminator of new session.
Configure the BFD session wit... | [
"Establish",
"a",
"new",
"BFD",
"session",
"and",
"return",
"My",
"Discriminator",
"of",
"new",
"session",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/bfdlib.py#L790-L858 | [
"def",
"add_bfd_session",
"(",
"self",
",",
"dpid",
",",
"ofport",
",",
"src_mac",
",",
"src_ip",
",",
"dst_mac",
"=",
"\"FF:FF:FF:FF:FF:FF\"",
",",
"dst_ip",
"=",
"\"255.255.255.255\"",
",",
"auth_type",
"=",
"0",
",",
"auth_keys",
"=",
"None",
")",
":",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | vrrp.create_packet | Prepare a VRRP packet.
Returns a newly created ryu.lib.packet.packet.Packet object
with appropriate protocol header objects added by add_protocol().
It's caller's responsibility to serialize().
The serialized packet would looks like the ones described in
the following sections.
... | ryu/lib/packet/vrrp.py | def create_packet(self, primary_ip_address, vlan_id=None):
"""Prepare a VRRP packet.
Returns a newly created ryu.lib.packet.packet.Packet object
with appropriate protocol header objects added by add_protocol().
It's caller's responsibility to serialize().
The serialized packet w... | def create_packet(self, primary_ip_address, vlan_id=None):
"""Prepare a VRRP packet.
Returns a newly created ryu.lib.packet.packet.Packet object
with appropriate protocol header objects added by add_protocol().
It's caller's responsibility to serialize().
The serialized packet w... | [
"Prepare",
"a",
"VRRP",
"packet",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/vrrp.py#L327-L376 | [
"def",
"create_packet",
"(",
"self",
",",
"primary_ip_address",
",",
"vlan_id",
"=",
"None",
")",
":",
"if",
"self",
".",
"is_ipv6",
":",
"traffic_class",
"=",
"0xc0",
"# set tos to internetwork control",
"flow_label",
"=",
"0",
"payload_length",
"=",
"ipv6",
".... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | add_local | Adds *prefix* from VRF identified by *route_dist* and sets the source as
network controller. | ryu/services/protocols/bgp/api/prefix.py | def add_local(route_dist, prefix, next_hop, route_family=VRF_RF_IPV4):
"""Adds *prefix* from VRF identified by *route_dist* and sets the source as
network controller.
"""
try:
# Create new path and insert into appropriate VRF table.
tm = CORE_MANAGER.get_core_service().table_manager
... | def add_local(route_dist, prefix, next_hop, route_family=VRF_RF_IPV4):
"""Adds *prefix* from VRF identified by *route_dist* and sets the source as
network controller.
"""
try:
# Create new path and insert into appropriate VRF table.
tm = CORE_MANAGER.get_core_service().table_manager
... | [
"Adds",
"*",
"prefix",
"*",
"from",
"VRF",
"identified",
"by",
"*",
"route_dist",
"*",
"and",
"sets",
"the",
"source",
"as",
"network",
"controller",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/prefix.py#L315-L332 | [
"def",
"add_local",
"(",
"route_dist",
",",
"prefix",
",",
"next_hop",
",",
"route_family",
"=",
"VRF_RF_IPV4",
")",
":",
"try",
":",
"# Create new path and insert into appropriate VRF table.",
"tm",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
".",
"tabl... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | delete_local | Deletes/withdraws *prefix* from VRF identified by *route_dist* and
source as network controller. | ryu/services/protocols/bgp/api/prefix.py | def delete_local(route_dist, prefix, route_family=VRF_RF_IPV4):
"""Deletes/withdraws *prefix* from VRF identified by *route_dist* and
source as network controller.
"""
try:
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_vrf_table(route_dist, prefix,
... | def delete_local(route_dist, prefix, route_family=VRF_RF_IPV4):
"""Deletes/withdraws *prefix* from VRF identified by *route_dist* and
source as network controller.
"""
try:
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_vrf_table(route_dist, prefix,
... | [
"Deletes",
"/",
"withdraws",
"*",
"prefix",
"*",
"from",
"VRF",
"identified",
"by",
"*",
"route_dist",
"*",
"and",
"source",
"as",
"network",
"controller",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/prefix.py#L338-L350 | [
"def",
"delete_local",
"(",
"route_dist",
",",
"prefix",
",",
"route_family",
"=",
"VRF_RF_IPV4",
")",
":",
"try",
":",
"tm",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
".",
"table_manager",
"tm",
".",
"update_vrf_table",
"(",
"route_dist",
",",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | add_evpn_local | Adds EVPN route from VRF identified by *route_dist*. | ryu/services/protocols/bgp/api/prefix.py | def add_evpn_local(route_type, route_dist, next_hop, **kwargs):
"""Adds EVPN route from VRF identified by *route_dist*.
"""
if(route_type in [EVPN_ETH_AUTO_DISCOVERY, EVPN_ETH_SEGMENT]
and kwargs['esi'] == 0):
raise ConfigValueError(conf_name=EVPN_ESI,
conf_val... | def add_evpn_local(route_type, route_dist, next_hop, **kwargs):
"""Adds EVPN route from VRF identified by *route_dist*.
"""
if(route_type in [EVPN_ETH_AUTO_DISCOVERY, EVPN_ETH_SEGMENT]
and kwargs['esi'] == 0):
raise ConfigValueError(conf_name=EVPN_ESI,
conf_val... | [
"Adds",
"EVPN",
"route",
"from",
"VRF",
"identified",
"by",
"*",
"route_dist",
"*",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/prefix.py#L364-L390 | [
"def",
"add_evpn_local",
"(",
"route_type",
",",
"route_dist",
",",
"next_hop",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"route_type",
"in",
"[",
"EVPN_ETH_AUTO_DISCOVERY",
",",
"EVPN_ETH_SEGMENT",
"]",
"and",
"kwargs",
"[",
"'esi'",
"]",
"==",
"0",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | delete_evpn_local | Deletes/withdraws EVPN route from VRF identified by *route_dist*. | ryu/services/protocols/bgp/api/prefix.py | def delete_evpn_local(route_type, route_dist, **kwargs):
"""Deletes/withdraws EVPN route from VRF identified by *route_dist*.
"""
try:
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_vrf_table(route_dist,
route_family=VRF_RF_L2_EVPN,
... | def delete_evpn_local(route_type, route_dist, **kwargs):
"""Deletes/withdraws EVPN route from VRF identified by *route_dist*.
"""
try:
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_vrf_table(route_dist,
route_family=VRF_RF_L2_EVPN,
... | [
"Deletes",
"/",
"withdraws",
"EVPN",
"route",
"from",
"VRF",
"identified",
"by",
"*",
"route_dist",
"*",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/prefix.py#L397-L410 | [
"def",
"delete_evpn_local",
"(",
"route_type",
",",
"route_dist",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"tm",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
".",
"table_manager",
"tm",
".",
"update_vrf_table",
"(",
"route_dist",
",",
"route... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | add_flowspec_local | Adds Flow Specification route from VRF identified by *route_dist*. | ryu/services/protocols/bgp/api/prefix.py | def add_flowspec_local(flowspec_family, route_dist, rules, **kwargs):
"""Adds Flow Specification route from VRF identified by *route_dist*.
"""
try:
# Create new path and insert into appropriate VRF table.
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_flowspec_vrf_tabl... | def add_flowspec_local(flowspec_family, route_dist, rules, **kwargs):
"""Adds Flow Specification route from VRF identified by *route_dist*.
"""
try:
# Create new path and insert into appropriate VRF table.
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_flowspec_vrf_tabl... | [
"Adds",
"Flow",
"Specification",
"route",
"from",
"VRF",
"identified",
"by",
"*",
"route_dist",
"*",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/prefix.py#L421-L437 | [
"def",
"add_flowspec_local",
"(",
"flowspec_family",
",",
"route_dist",
",",
"rules",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"# Create new path and insert into appropriate VRF table.",
"tm",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
".",
"table... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | del_flowspec_local | Deletes/withdraws Flow Specification route from VRF identified
by *route_dist*. | ryu/services/protocols/bgp/api/prefix.py | def del_flowspec_local(flowspec_family, route_dist, rules):
"""Deletes/withdraws Flow Specification route from VRF identified
by *route_dist*.
"""
try:
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_flowspec_vrf_table(
flowspec_family=flowspec_family, route_dist... | def del_flowspec_local(flowspec_family, route_dist, rules):
"""Deletes/withdraws Flow Specification route from VRF identified
by *route_dist*.
"""
try:
tm = CORE_MANAGER.get_core_service().table_manager
tm.update_flowspec_vrf_table(
flowspec_family=flowspec_family, route_dist... | [
"Deletes",
"/",
"withdraws",
"Flow",
"Specification",
"route",
"from",
"VRF",
"identified",
"by",
"*",
"route_dist",
"*",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/prefix.py#L443-L459 | [
"def",
"del_flowspec_local",
"(",
"flowspec_family",
",",
"route_dist",
",",
"rules",
")",
":",
"try",
":",
"tm",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
".",
"table_manager",
"tm",
".",
"update_flowspec_vrf_table",
"(",
"flowspec_family",
"=",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | create_connection | Wrapper for socket.create_connection() function.
If *address* (a 2-tuple ``(host, port)``) contains a valid IPv4/v6
address, passes *address* to socket.create_connection().
If *host* is valid path to Unix Domain socket, tries to connect to
the server listening on the given socket.
:param address: ... | ryu/services/protocols/zebra/client/zclient.py | def create_connection(address):
"""
Wrapper for socket.create_connection() function.
If *address* (a 2-tuple ``(host, port)``) contains a valid IPv4/v6
address, passes *address* to socket.create_connection().
If *host* is valid path to Unix Domain socket, tries to connect to
the server listenin... | def create_connection(address):
"""
Wrapper for socket.create_connection() function.
If *address* (a 2-tuple ``(host, port)``) contains a valid IPv4/v6
address, passes *address* to socket.create_connection().
If *host* is valid path to Unix Domain socket, tries to connect to
the server listenin... | [
"Wrapper",
"for",
"socket",
".",
"create_connection",
"()",
"function",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/client/zclient.py#L38-L65 | [
"def",
"create_connection",
"(",
"address",
")",
":",
"host",
",",
"_port",
"=",
"address",
"if",
"ip",
".",
"valid_ipv4",
"(",
"host",
")",
"or",
"ip",
".",
"valid_ipv6",
"(",
"host",
")",
":",
"return",
"socket",
".",
"create_connection",
"(",
"address... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ZClient.send_ip_route_add | Sends ZEBRA_IPV4/v6_ROUTE_ADD message to Zebra daemon.
:param prefix: IPv4/v6 Prefix to advertise.
:param nexthops: List of nexthop addresses.
:param safi: SAFI to advertise.
:param flags: Message flags to advertise. See "ZEBRA_FLAG_*".
:param distance: (Optional) Distance to ad... | ryu/services/protocols/zebra/client/zclient.py | def send_ip_route_add(
self, prefix, nexthops=None,
safi=packet_safi.UNICAST, flags=zebra.ZEBRA_FLAG_INTERNAL,
distance=None, metric=None, mtu=None, tag=None):
"""
Sends ZEBRA_IPV4/v6_ROUTE_ADD message to Zebra daemon.
:param prefix: IPv4/v6 Prefix to adverti... | def send_ip_route_add(
self, prefix, nexthops=None,
safi=packet_safi.UNICAST, flags=zebra.ZEBRA_FLAG_INTERNAL,
distance=None, metric=None, mtu=None, tag=None):
"""
Sends ZEBRA_IPV4/v6_ROUTE_ADD message to Zebra daemon.
:param prefix: IPv4/v6 Prefix to adverti... | [
"Sends",
"ZEBRA_IPV4",
"/",
"v6_ROUTE_ADD",
"message",
"to",
"Zebra",
"daemon",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/zebra/client/zclient.py#L293-L318 | [
"def",
"send_ip_route_add",
"(",
"self",
",",
"prefix",
",",
"nexthops",
"=",
"None",
",",
"safi",
"=",
"packet_safi",
".",
"UNICAST",
",",
"flags",
"=",
"zebra",
".",
"ZEBRA_FLAG_INTERNAL",
",",
"distance",
"=",
"None",
",",
"metric",
"=",
"None",
",",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | require_app | Request the application to be automatically loaded.
If this is used for "api" style modules, which is imported by a client
application, set api_style=True.
If this is used for client application module, set api_style=False. | ryu/base/app_manager.py | def require_app(app_name, api_style=False):
"""
Request the application to be automatically loaded.
If this is used for "api" style modules, which is imported by a client
application, set api_style=True.
If this is used for client application module, set api_style=False.
"""
iterable = (in... | def require_app(app_name, api_style=False):
"""
Request the application to be automatically loaded.
If this is used for "api" style modules, which is imported by a client
application, set api_style=True.
If this is used for client application module, set api_style=False.
"""
iterable = (in... | [
"Request",
"the",
"application",
"to",
"be",
"automatically",
"loaded",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L71-L88 | [
"def",
"require_app",
"(",
"app_name",
",",
"api_style",
"=",
"False",
")",
":",
"iterable",
"=",
"(",
"inspect",
".",
"getmodule",
"(",
"frame",
"[",
"0",
"]",
")",
"for",
"frame",
"in",
"inspect",
".",
"stack",
"(",
")",
")",
"modules",
"=",
"[",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RyuApp.get_handlers | Returns a list of handlers for the specific event.
:param ev: The event to handle.
:param state: The current state. ("dispatcher")
If None is given, returns all handlers for the event.
Otherwise, returns only handlers that are interested
... | ryu/base/app_manager.py | def get_handlers(self, ev, state=None):
"""Returns a list of handlers for the specific event.
:param ev: The event to handle.
:param state: The current state. ("dispatcher")
If None is given, returns all handlers for the event.
Otherwise, returns only... | def get_handlers(self, ev, state=None):
"""Returns a list of handlers for the specific event.
:param ev: The event to handle.
:param state: The current state. ("dispatcher")
If None is given, returns all handlers for the event.
Otherwise, returns only... | [
"Returns",
"a",
"list",
"of",
"handlers",
"for",
"the",
"specific",
"event",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L229-L255 | [
"def",
"get_handlers",
"(",
"self",
",",
"ev",
",",
"state",
"=",
"None",
")",
":",
"ev_cls",
"=",
"ev",
".",
"__class__",
"handlers",
"=",
"self",
".",
"event_handlers",
".",
"get",
"(",
"ev_cls",
",",
"[",
"]",
")",
"if",
"state",
"is",
"None",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RyuApp.send_request | Make a synchronous request.
Set req.sync to True, send it to a Ryu application specified by
req.dst, and block until receiving a reply.
Returns the received reply.
The argument should be an instance of EventRequestBase. | ryu/base/app_manager.py | def send_request(self, req):
"""
Make a synchronous request.
Set req.sync to True, send it to a Ryu application specified by
req.dst, and block until receiving a reply.
Returns the received reply.
The argument should be an instance of EventRequestBase.
"""
... | def send_request(self, req):
"""
Make a synchronous request.
Set req.sync to True, send it to a Ryu application specified by
req.dst, and block until receiving a reply.
Returns the received reply.
The argument should be an instance of EventRequestBase.
"""
... | [
"Make",
"a",
"synchronous",
"request",
".",
"Set",
"req",
".",
"sync",
"to",
"True",
"send",
"it",
"to",
"a",
"Ryu",
"application",
"specified",
"by",
"req",
".",
"dst",
"and",
"block",
"until",
"receiving",
"a",
"reply",
".",
"Returns",
"the",
"received... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L265-L279 | [
"def",
"send_request",
"(",
"self",
",",
"req",
")",
":",
"assert",
"isinstance",
"(",
"req",
",",
"EventRequestBase",
")",
"req",
".",
"sync",
"=",
"True",
"req",
".",
"reply_q",
"=",
"hub",
".",
"Queue",
"(",
")",
"self",
".",
"send_event",
"(",
"r... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RyuApp.send_event | Send the specified event to the RyuApp instance specified by name. | ryu/base/app_manager.py | def send_event(self, name, ev, state=None):
"""
Send the specified event to the RyuApp instance specified by name.
"""
if name in SERVICE_BRICKS:
if isinstance(ev, EventRequestBase):
ev.src = self.name
LOG.debug("EVENT %s->%s %s",
... | def send_event(self, name, ev, state=None):
"""
Send the specified event to the RyuApp instance specified by name.
"""
if name in SERVICE_BRICKS:
if isinstance(ev, EventRequestBase):
ev.src = self.name
LOG.debug("EVENT %s->%s %s",
... | [
"Send",
"the",
"specified",
"event",
"to",
"the",
"RyuApp",
"instance",
"specified",
"by",
"name",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L305-L318 | [
"def",
"send_event",
"(",
"self",
",",
"name",
",",
"ev",
",",
"state",
"=",
"None",
")",
":",
"if",
"name",
"in",
"SERVICE_BRICKS",
":",
"if",
"isinstance",
"(",
"ev",
",",
"EventRequestBase",
")",
":",
"ev",
".",
"src",
"=",
"self",
".",
"name",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RyuApp.send_event_to_observers | Send the specified event to all observers of this RyuApp. | ryu/base/app_manager.py | def send_event_to_observers(self, ev, state=None):
"""
Send the specified event to all observers of this RyuApp.
"""
for observer in self.get_observers(ev, state):
self.send_event(observer, ev, state) | def send_event_to_observers(self, ev, state=None):
"""
Send the specified event to all observers of this RyuApp.
"""
for observer in self.get_observers(ev, state):
self.send_event(observer, ev, state) | [
"Send",
"the",
"specified",
"event",
"to",
"all",
"observers",
"of",
"this",
"RyuApp",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L320-L326 | [
"def",
"send_event_to_observers",
"(",
"self",
",",
"ev",
",",
"state",
"=",
"None",
")",
":",
"for",
"observer",
"in",
"self",
".",
"get_observers",
"(",
"ev",
",",
"state",
")",
":",
"self",
".",
"send_event",
"(",
"observer",
",",
"ev",
",",
"state"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RyuApp.reply_to_request | Send a reply for a synchronous request sent by send_request.
The first argument should be an instance of EventRequestBase.
The second argument should be an instance of EventReplyBase. | ryu/base/app_manager.py | def reply_to_request(self, req, rep):
"""
Send a reply for a synchronous request sent by send_request.
The first argument should be an instance of EventRequestBase.
The second argument should be an instance of EventReplyBase.
"""
assert isinstance(req, EventRequestBase)
... | def reply_to_request(self, req, rep):
"""
Send a reply for a synchronous request sent by send_request.
The first argument should be an instance of EventRequestBase.
The second argument should be an instance of EventReplyBase.
"""
assert isinstance(req, EventRequestBase)
... | [
"Send",
"a",
"reply",
"for",
"a",
"synchronous",
"request",
"sent",
"by",
"send_request",
".",
"The",
"first",
"argument",
"should",
"be",
"an",
"instance",
"of",
"EventRequestBase",
".",
"The",
"second",
"argument",
"should",
"be",
"an",
"instance",
"of",
"... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L328-L341 | [
"def",
"reply_to_request",
"(",
"self",
",",
"req",
",",
"rep",
")",
":",
"assert",
"isinstance",
"(",
"req",
",",
"EventRequestBase",
")",
"assert",
"isinstance",
"(",
"rep",
",",
"EventReplyBase",
")",
"rep",
".",
"dst",
"=",
"req",
".",
"src",
"if",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | AppManager.run_apps | Run a set of Ryu applications
A convenient method to load and instantiate apps.
This blocks until all relevant apps stop. | ryu/base/app_manager.py | def run_apps(app_lists):
"""Run a set of Ryu applications
A convenient method to load and instantiate apps.
This blocks until all relevant apps stop.
"""
app_mgr = AppManager.get_instance()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
... | def run_apps(app_lists):
"""Run a set of Ryu applications
A convenient method to load and instantiate apps.
This blocks until all relevant apps stop.
"""
app_mgr = AppManager.get_instance()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
... | [
"Run",
"a",
"set",
"of",
"Ryu",
"applications"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L356-L376 | [
"def",
"run_apps",
"(",
"app_lists",
")",
":",
"app_mgr",
"=",
"AppManager",
".",
"get_instance",
"(",
")",
"app_mgr",
".",
"load_apps",
"(",
"app_lists",
")",
"contexts",
"=",
"app_mgr",
".",
"create_contexts",
"(",
")",
"services",
"=",
"app_mgr",
".",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_list_cap | list_cap <peer> | ryu/cmd/of_config_cli.py | def do_list_cap(self, line):
"""list_cap <peer>
"""
def f(p, args):
for i in p.netconf.server_capabilities:
print(i)
self._request(line, f) | def do_list_cap(self, line):
"""list_cap <peer>
"""
def f(p, args):
for i in p.netconf.server_capabilities:
print(i)
self._request(line, f) | [
"list_cap",
"<peer",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L104-L112 | [
"def",
"do_list_cap",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"for",
"i",
"in",
"p",
".",
"netconf",
".",
"server_capabilities",
":",
"print",
"(",
"i",
")",
"self",
".",
"_request",
"(",
"line",
",",
"f",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_raw_get | raw_get <peer> | ryu/cmd/of_config_cli.py | def do_raw_get(self, line):
"""raw_get <peer>
"""
def f(p, args):
result = p.raw_get()
tree = ET.fromstring(result)
validate(tree)
print(et_tostring_pp(tree))
self._request(line, f) | def do_raw_get(self, line):
"""raw_get <peer>
"""
def f(p, args):
result = p.raw_get()
tree = ET.fromstring(result)
validate(tree)
print(et_tostring_pp(tree))
self._request(line, f) | [
"raw_get",
"<peer",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L114-L124 | [
"def",
"do_raw_get",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"result",
"=",
"p",
".",
"raw_get",
"(",
")",
"tree",
"=",
"ET",
".",
"fromstring",
"(",
"result",
")",
"validate",
"(",
"tree",
")",
"print",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_raw_get_config | raw_get_config <peer> <source> | ryu/cmd/of_config_cli.py | def do_raw_get_config(self, line):
"""raw_get_config <peer> <source>
"""
def f(p, args):
try:
source = args[0]
except:
print("argument error")
return
result = p.raw_get_config(source)
tree = ET.froms... | def do_raw_get_config(self, line):
"""raw_get_config <peer> <source>
"""
def f(p, args):
try:
source = args[0]
except:
print("argument error")
return
result = p.raw_get_config(source)
tree = ET.froms... | [
"raw_get_config",
"<peer",
">",
"<source",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L126-L141 | [
"def",
"do_raw_get_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"source",
"=",
"args",
"[",
"0",
"]",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"result",
"=",
"p",
"."... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_get | get <peer>
eg. get sw1 | ryu/cmd/of_config_cli.py | def do_get(self, line):
"""get <peer>
eg. get sw1
"""
def f(p, args):
print(p.get())
self._request(line, f) | def do_get(self, line):
"""get <peer>
eg. get sw1
"""
def f(p, args):
print(p.get())
self._request(line, f) | [
"get",
"<peer",
">",
"eg",
".",
"get",
"sw1"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L143-L151 | [
"def",
"do_get",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"print",
"(",
"p",
".",
"get",
"(",
")",
")",
"self",
".",
"_request",
"(",
"line",
",",
"f",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_commit | commit <peer>
eg. commit sw1 | ryu/cmd/of_config_cli.py | def do_commit(self, line):
"""commit <peer>
eg. commit sw1
"""
def f(p, args):
print(p.commit())
self._request(line, f) | def do_commit(self, line):
"""commit <peer>
eg. commit sw1
"""
def f(p, args):
print(p.commit())
self._request(line, f) | [
"commit",
"<peer",
">",
"eg",
".",
"commit",
"sw1"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L153-L161 | [
"def",
"do_commit",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"print",
"(",
"p",
".",
"commit",
"(",
")",
")",
"self",
".",
"_request",
"(",
"line",
",",
"f",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_discard | discard <peer>
eg. discard sw1 | ryu/cmd/of_config_cli.py | def do_discard(self, line):
"""discard <peer>
eg. discard sw1
"""
def f(p, args):
print(p.discard_changes())
self._request(line, f) | def do_discard(self, line):
"""discard <peer>
eg. discard sw1
"""
def f(p, args):
print(p.discard_changes())
self._request(line, f) | [
"discard",
"<peer",
">",
"eg",
".",
"discard",
"sw1"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L163-L171 | [
"def",
"do_discard",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"print",
"(",
"p",
".",
"discard_changes",
"(",
")",
")",
"self",
".",
"_request",
"(",
"line",
",",
"f",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_get_config | get_config <peer> <source>
eg. get_config sw1 startup | ryu/cmd/of_config_cli.py | def do_get_config(self, line):
"""get_config <peer> <source>
eg. get_config sw1 startup
"""
def f(p, args):
try:
source = args[0]
except:
print("argument error")
return
print(p.get_config(source))
... | def do_get_config(self, line):
"""get_config <peer> <source>
eg. get_config sw1 startup
"""
def f(p, args):
try:
source = args[0]
except:
print("argument error")
return
print(p.get_config(source))
... | [
"get_config",
"<peer",
">",
"<source",
">",
"eg",
".",
"get_config",
"sw1",
"startup"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L173-L186 | [
"def",
"do_get_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"source",
"=",
"args",
"[",
"0",
"]",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"print",
"(",
"p",
".",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_delete_config | delete_config <peer> <source>
eg. delete_config sw1 startup | ryu/cmd/of_config_cli.py | def do_delete_config(self, line):
"""delete_config <peer> <source>
eg. delete_config sw1 startup
"""
def f(p, args):
try:
source = args[0]
except:
print("argument error")
return
print(p.delete_config(sou... | def do_delete_config(self, line):
"""delete_config <peer> <source>
eg. delete_config sw1 startup
"""
def f(p, args):
try:
source = args[0]
except:
print("argument error")
return
print(p.delete_config(sou... | [
"delete_config",
"<peer",
">",
"<source",
">",
"eg",
".",
"delete_config",
"sw1",
"startup"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L188-L201 | [
"def",
"do_delete_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"source",
"=",
"args",
"[",
"0",
"]",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"print",
"(",
"p",
".",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_copy_config | copy_config <peer> <source> <target>
eg. copy_config sw1 running startup | ryu/cmd/of_config_cli.py | def do_copy_config(self, line):
"""copy_config <peer> <source> <target>
eg. copy_config sw1 running startup
"""
def f(p, args):
try:
source, target = args
except:
print("argument error")
return
print(p.c... | def do_copy_config(self, line):
"""copy_config <peer> <source> <target>
eg. copy_config sw1 running startup
"""
def f(p, args):
try:
source, target = args
except:
print("argument error")
return
print(p.c... | [
"copy_config",
"<peer",
">",
"<source",
">",
"<target",
">",
"eg",
".",
"copy_config",
"sw1",
"running",
"startup"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L203-L216 | [
"def",
"do_copy_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"source",
",",
"target",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"print",
"(",
"p",
".",
"c... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_list_port | list_port <peer> | ryu/cmd/of_config_cli.py | def do_list_port(self, line):
"""list_port <peer>
"""
def f(p, args):
o = p.get()
for p in o.resources.port:
print('%s %s %s' % (p.resource_id, p.name, p.number))
self._request(line, f) | def do_list_port(self, line):
"""list_port <peer>
"""
def f(p, args):
o = p.get()
for p in o.resources.port:
print('%s %s %s' % (p.resource_id, p.name, p.number))
self._request(line, f) | [
"list_port",
"<peer",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L218-L227 | [
"def",
"do_list_port",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"o",
"=",
"p",
".",
"get",
"(",
")",
"for",
"p",
"in",
"o",
".",
"resources",
".",
"port",
":",
"print",
"(",
"'%s %s %s'",
"%",
"(",
"p",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_get_port_config | get_config_port <peer> <source> <port>
eg. get_port_config sw1 running LogicalSwitch7-Port2 | ryu/cmd/of_config_cli.py | def do_get_port_config(self, line):
"""get_config_port <peer> <source> <port>
eg. get_port_config sw1 running LogicalSwitch7-Port2
"""
def f(p, args):
try:
source, port = args
except:
print("argument error")
return
... | def do_get_port_config(self, line):
"""get_config_port <peer> <source> <port>
eg. get_port_config sw1 running LogicalSwitch7-Port2
"""
def f(p, args):
try:
source, port = args
except:
print("argument error")
return
... | [
"get_config_port",
"<peer",
">",
"<source",
">",
"<port",
">",
"eg",
".",
"get_port_config",
"sw1",
"running",
"LogicalSwitch7",
"-",
"Port2"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L236-L260 | [
"def",
"do_get_port_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"source",
",",
"port",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"o",
"=",
"p",
".",
"get... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_set_port_config | set_port_config <peer> <target> <port> <key> <value>
eg. set_port_config sw1 running LogicalSwitch7-Port2 admin-state down
eg. set_port_config sw1 running LogicalSwitch7-Port2 no-forward false | ryu/cmd/of_config_cli.py | def do_set_port_config(self, line):
"""set_port_config <peer> <target> <port> <key> <value>
eg. set_port_config sw1 running LogicalSwitch7-Port2 admin-state down
eg. set_port_config sw1 running LogicalSwitch7-Port2 no-forward false
"""
def f(p, args):
try:
... | def do_set_port_config(self, line):
"""set_port_config <peer> <target> <port> <key> <value>
eg. set_port_config sw1 running LogicalSwitch7-Port2 admin-state down
eg. set_port_config sw1 running LogicalSwitch7-Port2 no-forward false
"""
def f(p, args):
try:
... | [
"set_port_config",
"<peer",
">",
"<target",
">",
"<port",
">",
"<key",
">",
"<value",
">",
"eg",
".",
"set_port_config",
"sw1",
"running",
"LogicalSwitch7",
"-",
"Port2",
"admin",
"-",
"state",
"down",
"eg",
".",
"set_port_config",
"sw1",
"running",
"LogicalSw... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L262-L300 | [
"def",
"do_set_port_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"target",
",",
"port",
",",
"key",
",",
"value",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"print",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_list_queue | list_queue <peer> | ryu/cmd/of_config_cli.py | def do_list_queue(self, line):
"""list_queue <peer>
"""
def f(p, args):
o = p.get()
if o.resources.queue:
for q in o.resources.queue:
print('%s %s' % (q.resource_id, q.port))
self._request(line, f) | def do_list_queue(self, line):
"""list_queue <peer>
"""
def f(p, args):
o = p.get()
if o.resources.queue:
for q in o.resources.queue:
print('%s %s' % (q.resource_id, q.port))
self._request(line, f) | [
"list_queue",
"<peer",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L302-L312 | [
"def",
"do_list_queue",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"o",
"=",
"p",
".",
"get",
"(",
")",
"if",
"o",
".",
"resources",
".",
"queue",
":",
"for",
"q",
"in",
"o",
".",
"resources",
".",
"queue... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_get_queue_config | get_queue_port <peer> <source> <queue>
eg. get_queue_config sw1 running LogicalSwitch7-Port1-Queue922 | ryu/cmd/of_config_cli.py | def do_get_queue_config(self, line):
"""get_queue_port <peer> <source> <queue>
eg. get_queue_config sw1 running LogicalSwitch7-Port1-Queue922
"""
def f(p, args):
try:
source, queue = args
except:
print("argument error")
... | def do_get_queue_config(self, line):
"""get_queue_port <peer> <source> <queue>
eg. get_queue_config sw1 running LogicalSwitch7-Port1-Queue922
"""
def f(p, args):
try:
source, queue = args
except:
print("argument error")
... | [
"get_queue_port",
"<peer",
">",
"<source",
">",
"<queue",
">",
"eg",
".",
"get_queue_config",
"sw1",
"running",
"LogicalSwitch7",
"-",
"Port1",
"-",
"Queue922"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L320-L344 | [
"def",
"do_get_queue_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"source",
",",
"queue",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"o",
"=",
"p",
".",
"g... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_set_queue_config | set_queue_config <peer> <target> <queue> <key> <value>
eg. set_queue_config sw1 running LogicalSwitch7-Port1-Queue922 \
max-rate 100 | ryu/cmd/of_config_cli.py | def do_set_queue_config(self, line):
"""set_queue_config <peer> <target> <queue> <key> <value>
eg. set_queue_config sw1 running LogicalSwitch7-Port1-Queue922 \
max-rate 100
"""
def f(p, args):
try:
target, queue, key, value = args
except:
... | def do_set_queue_config(self, line):
"""set_queue_config <peer> <target> <queue> <key> <value>
eg. set_queue_config sw1 running LogicalSwitch7-Port1-Queue922 \
max-rate 100
"""
def f(p, args):
try:
target, queue, key, value = args
except:
... | [
"set_queue_config",
"<peer",
">",
"<target",
">",
"<queue",
">",
"<key",
">",
"<value",
">",
"eg",
".",
"set_queue_config",
"sw1",
"running",
"LogicalSwitch7",
"-",
"Port1",
"-",
"Queue922",
"\\",
"max",
"-",
"rate",
"100"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L346-L384 | [
"def",
"do_set_queue_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"target",
",",
"queue",
",",
"key",
",",
"value",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"print",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_add_queue | add_queue <peer> <target> <logical-switch> <queue>
eg. add_queue sw1 running LogicalSwitch7 NameOfNewQueue | ryu/cmd/of_config_cli.py | def do_add_queue(self, line):
"""add_queue <peer> <target> <logical-switch> <queue>
eg. add_queue sw1 running LogicalSwitch7 NameOfNewQueue
"""
def f(p, args):
try:
target, lsw, queue = args
except:
print("argument error")
... | def do_add_queue(self, line):
"""add_queue <peer> <target> <logical-switch> <queue>
eg. add_queue sw1 running LogicalSwitch7 NameOfNewQueue
"""
def f(p, args):
try:
target, lsw, queue = args
except:
print("argument error")
... | [
"add_queue",
"<peer",
">",
"<target",
">",
"<logical",
"-",
"switch",
">",
"<queue",
">",
"eg",
".",
"add_queue",
"sw1",
"running",
"LogicalSwitch7",
"NameOfNewQueue"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L386-L427 | [
"def",
"do_add_queue",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"target",
",",
"lsw",
",",
"queue",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"print",
"(",
"args",
")",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_list_logical_switch | list_logical_switch <peer> | ryu/cmd/of_config_cli.py | def do_list_logical_switch(self, line):
"""list_logical_switch <peer>
"""
def f(p, args):
o = p.get()
for s in o.logical_switches.switch:
print('%s %s' % (s.id, s.datapath_id))
self._request(line, f) | def do_list_logical_switch(self, line):
"""list_logical_switch <peer>
"""
def f(p, args):
o = p.get()
for s in o.logical_switches.switch:
print('%s %s' % (s.id, s.datapath_id))
self._request(line, f) | [
"list_logical_switch",
"<peer",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L429-L438 | [
"def",
"do_list_logical_switch",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"o",
"=",
"p",
".",
"get",
"(",
")",
"for",
"s",
"in",
"o",
".",
"logical_switches",
".",
"switch",
":",
"print",
"(",
"'%s %s'",
"%... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_show_logical_switch | show_logical_switch <peer> <logical switch> | ryu/cmd/of_config_cli.py | def do_show_logical_switch(self, line):
"""show_logical_switch <peer> <logical switch>
"""
def f(p, args):
try:
(lsw,) = args
except:
print("argument error")
return
o = p.get()
for s in o.logical_swi... | def do_show_logical_switch(self, line):
"""show_logical_switch <peer> <logical switch>
"""
def f(p, args):
try:
(lsw,) = args
except:
print("argument error")
return
o = p.get()
for s in o.logical_swi... | [
"show_logical_switch",
"<peer",
">",
"<logical",
"switch",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L440-L465 | [
"def",
"do_show_logical_switch",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"(",
"lsw",
",",
")",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"o",
"=",
"p",
".",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_get_logical_switch_config | get_logical_switch_config <peer> <source> <logical switch> | ryu/cmd/of_config_cli.py | def do_get_logical_switch_config(self, line):
"""get_logical_switch_config <peer> <source> <logical switch>
"""
def f(p, args):
try:
source, lsw = args
except:
print("argument error")
return
o = p.get_config(sou... | def do_get_logical_switch_config(self, line):
"""get_logical_switch_config <peer> <source> <logical switch>
"""
def f(p, args):
try:
source, lsw = args
except:
print("argument error")
return
o = p.get_config(sou... | [
"get_logical_switch_config",
"<peer",
">",
"<source",
">",
"<logical",
"switch",
">"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L471-L493 | [
"def",
"do_get_logical_switch_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"source",
",",
"lsw",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"return",
"o",
"=",
"p",
".... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | Cmd.do_set_logical_switch_config | set_logical_switch_config <peer> <logical switch> <key> <value>
eg. set_logical_switch_config sw1 running LogicalSwitch7 \
lost-connection-behavior failStandaloneMode | ryu/cmd/of_config_cli.py | def do_set_logical_switch_config(self, line):
"""set_logical_switch_config <peer> <logical switch> <key> <value>
eg. set_logical_switch_config sw1 running LogicalSwitch7 \
lost-connection-behavior failStandaloneMode
"""
def f(p, args):
try:
target, lsw, key, ... | def do_set_logical_switch_config(self, line):
"""set_logical_switch_config <peer> <logical switch> <key> <value>
eg. set_logical_switch_config sw1 running LogicalSwitch7 \
lost-connection-behavior failStandaloneMode
"""
def f(p, args):
try:
target, lsw, key, ... | [
"set_logical_switch_config",
"<peer",
">",
"<logical",
"switch",
">",
"<key",
">",
"<value",
">",
"eg",
".",
"set_logical_switch_config",
"sw1",
"running",
"LogicalSwitch7",
"\\",
"lost",
"-",
"connection",
"-",
"behavior",
"failStandaloneMode"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/cmd/of_config_cli.py#L495-L530 | [
"def",
"do_set_logical_switch_config",
"(",
"self",
",",
"line",
")",
":",
"def",
"f",
"(",
"p",
",",
"args",
")",
":",
"try",
":",
"target",
",",
"lsw",
",",
"key",
",",
"value",
"=",
"args",
"except",
":",
"print",
"(",
"\"argument error\"",
")",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | arp_ip | A convenient wrapper for IPv4 ARP for Ethernet.
This is an equivalent of the following code.
arp(ARP_HW_TYPE_ETHERNET, ether.ETH_TYPE_IP, \
6, 4, opcode, src_mac, src_ip, dst_mac, dst_ip) | ryu/lib/packet/arp.py | def arp_ip(opcode, src_mac, src_ip, dst_mac, dst_ip):
"""A convenient wrapper for IPv4 ARP for Ethernet.
This is an equivalent of the following code.
arp(ARP_HW_TYPE_ETHERNET, ether.ETH_TYPE_IP, \
6, 4, opcode, src_mac, src_ip, dst_mac, dst_ip)
"""
return arp(ARP_HW_TYPE_ETHERNE... | def arp_ip(opcode, src_mac, src_ip, dst_mac, dst_ip):
"""A convenient wrapper for IPv4 ARP for Ethernet.
This is an equivalent of the following code.
arp(ARP_HW_TYPE_ETHERNET, ether.ETH_TYPE_IP, \
6, 4, opcode, src_mac, src_ip, dst_mac, dst_ip)
"""
return arp(ARP_HW_TYPE_ETHERNE... | [
"A",
"convenient",
"wrapper",
"for",
"IPv4",
"ARP",
"for",
"Ethernet",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/packet/arp.py#L99-L110 | [
"def",
"arp_ip",
"(",
"opcode",
",",
"src_mac",
",",
"src_ip",
",",
"dst_mac",
",",
"dst_ip",
")",
":",
"return",
"arp",
"(",
"ARP_HW_TYPE_ETHERNET",
",",
"ether",
".",
"ETH_TYPE_IP",
",",
"6",
",",
"# ether mac address length",
"4",
",",
"# ipv4 address lengt... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | set_ev_cls | A decorator for Ryu application to declare an event handler.
Decorated method will become an event handler.
ev_cls is an event class whose instances this RyuApp wants to receive.
dispatchers argument specifies one of the following negotiation phases
(or a list of them) for which events should be genera... | ryu/controller/handler.py | def set_ev_cls(ev_cls, dispatchers=None):
"""
A decorator for Ryu application to declare an event handler.
Decorated method will become an event handler.
ev_cls is an event class whose instances this RyuApp wants to receive.
dispatchers argument specifies one of the following negotiation phases
... | def set_ev_cls(ev_cls, dispatchers=None):
"""
A decorator for Ryu application to declare an event handler.
Decorated method will become an event handler.
ev_cls is an event class whose instances this RyuApp wants to receive.
dispatchers argument specifies one of the following negotiation phases
... | [
"A",
"decorator",
"for",
"Ryu",
"application",
"to",
"declare",
"an",
"event",
"handler",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/controller/handler.py#L49-L83 | [
"def",
"set_ev_cls",
"(",
"ev_cls",
",",
"dispatchers",
"=",
"None",
")",
":",
"def",
"_set_ev_cls_dec",
"(",
"handler",
")",
":",
"if",
"'callers'",
"not",
"in",
"dir",
"(",
"handler",
")",
":",
"handler",
".",
"callers",
"=",
"{",
"}",
"for",
"e",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | register_service | Register the ryu application specified by 'service' as
a provider of events defined in the calling module.
If an application being loaded consumes events (in the sense of
set_ev_cls) provided by the 'service' application, the latter
application will be automatically loaded.
This mechanism is used ... | ryu/controller/handler.py | def register_service(service):
"""
Register the ryu application specified by 'service' as
a provider of events defined in the calling module.
If an application being loaded consumes events (in the sense of
set_ev_cls) provided by the 'service' application, the latter
application will be automat... | def register_service(service):
"""
Register the ryu application specified by 'service' as
a provider of events defined in the calling module.
If an application being loaded consumes events (in the sense of
set_ev_cls) provided by the 'service' application, the latter
application will be automat... | [
"Register",
"the",
"ryu",
"application",
"specified",
"by",
"service",
"as",
"a",
"provider",
"of",
"events",
"defined",
"in",
"the",
"calling",
"module",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/controller/handler.py#L139-L154 | [
"def",
"register_service",
"(",
"service",
")",
":",
"frame",
"=",
"inspect",
".",
"currentframe",
"(",
")",
"m_name",
"=",
"frame",
".",
"f_back",
".",
"f_globals",
"[",
"'__name__'",
"]",
"m",
"=",
"sys",
".",
"modules",
"[",
"m_name",
"]",
"m",
".",... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _get_neighbor_conf | Returns neighbor configuration for given neighbor ip address.
Raises exception if no neighbor with `neigh_ip_address` exists. | ryu/services/protocols/bgp/api/rtconf.py | def _get_neighbor_conf(neigh_ip_address):
"""Returns neighbor configuration for given neighbor ip address.
Raises exception if no neighbor with `neigh_ip_address` exists.
"""
neigh_conf = \
CORE_MANAGER.neighbors_conf.get_neighbor_conf(neigh_ip_address)
if not neigh_conf:
raise Runt... | def _get_neighbor_conf(neigh_ip_address):
"""Returns neighbor configuration for given neighbor ip address.
Raises exception if no neighbor with `neigh_ip_address` exists.
"""
neigh_conf = \
CORE_MANAGER.neighbors_conf.get_neighbor_conf(neigh_ip_address)
if not neigh_conf:
raise Runt... | [
"Returns",
"neighbor",
"configuration",
"for",
"given",
"neighbor",
"ip",
"address",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L45-L56 | [
"def",
"_get_neighbor_conf",
"(",
"neigh_ip_address",
")",
":",
"neigh_conf",
"=",
"CORE_MANAGER",
".",
"neighbors_conf",
".",
"get_neighbor_conf",
"(",
"neigh_ip_address",
")",
"if",
"not",
"neigh_conf",
":",
"raise",
"RuntimeConfigError",
"(",
"desc",
"=",
"'No Ne... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | get_neighbor_in_filter | Returns a neighbor in_filter for given ip address if exists. | ryu/services/protocols/bgp/api/rtconf.py | def get_neighbor_in_filter(neigh_ip_address):
"""Returns a neighbor in_filter for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
return peer.in_filters | def get_neighbor_in_filter(neigh_ip_address):
"""Returns a neighbor in_filter for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
return peer.in_filters | [
"Returns",
"a",
"neighbor",
"in_filter",
"for",
"given",
"ip",
"address",
"if",
"exists",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L130-L134 | [
"def",
"get_neighbor_in_filter",
"(",
"neigh_ip_address",
")",
":",
"core",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
"peer",
"=",
"core",
".",
"peer_manager",
".",
"get_by_addr",
"(",
"neigh_ip_address",
")",
"return",
"peer",
".",
"in_filters"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | set_neighbor_in_filter | Returns a neighbor in_filter for given ip address if exists. | ryu/services/protocols/bgp/api/rtconf.py | def set_neighbor_in_filter(neigh_ip_address, filters):
"""Returns a neighbor in_filter for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
peer.in_filters = filters
return True | def set_neighbor_in_filter(neigh_ip_address, filters):
"""Returns a neighbor in_filter for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
peer.in_filters = filters
return True | [
"Returns",
"a",
"neighbor",
"in_filter",
"for",
"given",
"ip",
"address",
"if",
"exists",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L139-L144 | [
"def",
"set_neighbor_in_filter",
"(",
"neigh_ip_address",
",",
"filters",
")",
":",
"core",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
"peer",
"=",
"core",
".",
"peer_manager",
".",
"get_by_addr",
"(",
"neigh_ip_address",
")",
"peer",
".",
"in_filte... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | get_neighbor_out_filter | Returns a neighbor out_filter for given ip address if exists. | ryu/services/protocols/bgp/api/rtconf.py | def get_neighbor_out_filter(neigh_ip_address):
"""Returns a neighbor out_filter for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
ret = core.peer_manager.get_by_addr(neigh_ip_address).out_filters
return ret | def get_neighbor_out_filter(neigh_ip_address):
"""Returns a neighbor out_filter for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
ret = core.peer_manager.get_by_addr(neigh_ip_address).out_filters
return ret | [
"Returns",
"a",
"neighbor",
"out_filter",
"for",
"given",
"ip",
"address",
"if",
"exists",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L149-L153 | [
"def",
"get_neighbor_out_filter",
"(",
"neigh_ip_address",
")",
":",
"core",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
"ret",
"=",
"core",
".",
"peer_manager",
".",
"get_by_addr",
"(",
"neigh_ip_address",
")",
".",
"out_filters",
"return",
"ret"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | set_neighbor_out_filter | Sets the out_filter of a neighbor. | ryu/services/protocols/bgp/api/rtconf.py | def set_neighbor_out_filter(neigh_ip_address, filters):
"""Sets the out_filter of a neighbor."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
peer.out_filters = filters
return True | def set_neighbor_out_filter(neigh_ip_address, filters):
"""Sets the out_filter of a neighbor."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
peer.out_filters = filters
return True | [
"Sets",
"the",
"out_filter",
"of",
"a",
"neighbor",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L158-L163 | [
"def",
"set_neighbor_out_filter",
"(",
"neigh_ip_address",
",",
"filters",
")",
":",
"core",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
"peer",
"=",
"core",
".",
"peer_manager",
".",
"get_by_addr",
"(",
"neigh_ip_address",
")",
"peer",
".",
"out_fil... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | set_neighbor_attribute_map | set attribute_maps to the neighbor. | ryu/services/protocols/bgp/api/rtconf.py | def set_neighbor_attribute_map(neigh_ip_address, at_maps,
route_dist=None, route_family=VRF_RF_IPV4):
"""set attribute_maps to the neighbor."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
at_maps_key = const.ATTR_MAPS_LABE... | def set_neighbor_attribute_map(neigh_ip_address, at_maps,
route_dist=None, route_family=VRF_RF_IPV4):
"""set attribute_maps to the neighbor."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
at_maps_key = const.ATTR_MAPS_LABE... | [
"set",
"attribute_maps",
"to",
"the",
"neighbor",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L170-L192 | [
"def",
"set_neighbor_attribute_map",
"(",
"neigh_ip_address",
",",
"at_maps",
",",
"route_dist",
"=",
"None",
",",
"route_family",
"=",
"VRF_RF_IPV4",
")",
":",
"core",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
"peer",
"=",
"core",
".",
"peer_manag... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | get_neighbor_attribute_map | Returns a neighbor attribute_map for given ip address if exists. | ryu/services/protocols/bgp/api/rtconf.py | def get_neighbor_attribute_map(neigh_ip_address, route_dist=None,
route_family=VRF_RF_IPV4):
"""Returns a neighbor attribute_map for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
at_maps_key = c... | def get_neighbor_attribute_map(neigh_ip_address, route_dist=None,
route_family=VRF_RF_IPV4):
"""Returns a neighbor attribute_map for given ip address if exists."""
core = CORE_MANAGER.get_core_service()
peer = core.peer_manager.get_by_addr(neigh_ip_address)
at_maps_key = c... | [
"Returns",
"a",
"neighbor",
"attribute_map",
"for",
"given",
"ip",
"address",
"if",
"exists",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L198-L211 | [
"def",
"get_neighbor_attribute_map",
"(",
"neigh_ip_address",
",",
"route_dist",
"=",
"None",
",",
"route_family",
"=",
"VRF_RF_IPV4",
")",
":",
"core",
"=",
"CORE_MANAGER",
".",
"get_core_service",
"(",
")",
"peer",
"=",
"core",
".",
"peer_manager",
".",
"get_b... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | register | Decorator for registering API function.
Does not do any check or validation. | ryu/services/protocols/bgp/api/base.py | def register(**kwargs):
"""Decorator for registering API function.
Does not do any check or validation.
"""
def decorator(func):
_CALL_REGISTRY[kwargs.get(API_SYM, func.__name__)] = func
return func
return decorator | def register(**kwargs):
"""Decorator for registering API function.
Does not do any check or validation.
"""
def decorator(func):
_CALL_REGISTRY[kwargs.get(API_SYM, func.__name__)] = func
return func
return decorator | [
"Decorator",
"for",
"registering",
"API",
"function",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/base.py#L86-L95 | [
"def",
"register",
"(",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"_CALL_REGISTRY",
"[",
"kwargs",
".",
"get",
"(",
"API_SYM",
",",
"func",
".",
"__name__",
")",
"]",
"=",
"func",
"return",
"func",
"return",
"decorator"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | call | Calls/executes BGPS public API identified by given symbol and passes
given kwargs as param. | ryu/services/protocols/bgp/api/base.py | def call(symbol, **kwargs):
"""Calls/executes BGPS public API identified by given symbol and passes
given kwargs as param.
"""
LOG.info("API method %s called with args: %s", symbol, str(kwargs))
# TODO(PH, JK) improve the way api function modules are loaded
from . import all # noqa
if not ... | def call(symbol, **kwargs):
"""Calls/executes BGPS public API identified by given symbol and passes
given kwargs as param.
"""
LOG.info("API method %s called with args: %s", symbol, str(kwargs))
# TODO(PH, JK) improve the way api function modules are loaded
from . import all # noqa
if not ... | [
"Calls",
"/",
"executes",
"BGPS",
"public",
"API",
"identified",
"by",
"given",
"symbol",
"and",
"passes",
"given",
"kwargs",
"as",
"param",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/base.py#L192-L215 | [
"def",
"call",
"(",
"symbol",
",",
"*",
"*",
"kwargs",
")",
":",
"LOG",
".",
"info",
"(",
"\"API method %s called with args: %s\"",
",",
"symbol",
",",
"str",
"(",
"kwargs",
")",
")",
"# TODO(PH, JK) improve the way api function modules are loaded",
"from",
".",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _error_code_to_str | This method is registered as ofp_error_code_to_str(type_, code) method
into ryu.ofproto.ofproto_v1_* modules.
And this method returns the error code as a string value for given
'type' and 'code' defined in ofp_error_msg structure.
Example::
>>> ofproto.ofp_error_code_to_str(4, 9)
'OFPB... | ryu/ofproto/ofproto_utils.py | def _error_code_to_str(mod, type_, code):
"""
This method is registered as ofp_error_code_to_str(type_, code) method
into ryu.ofproto.ofproto_v1_* modules.
And this method returns the error code as a string value for given
'type' and 'code' defined in ofp_error_msg structure.
Example::
... | def _error_code_to_str(mod, type_, code):
"""
This method is registered as ofp_error_code_to_str(type_, code) method
into ryu.ofproto.ofproto_v1_* modules.
And this method returns the error code as a string value for given
'type' and 'code' defined in ofp_error_msg structure.
Example::
... | [
"This",
"method",
"is",
"registered",
"as",
"ofp_error_code_to_str",
"(",
"type_",
"code",
")",
"method",
"into",
"ryu",
".",
"ofproto",
".",
"ofproto_v1_",
"*",
"modules",
".",
"And",
"this",
"method",
"returns",
"the",
"error",
"code",
"as",
"a",
"string",... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_utils.py#L93-L106 | [
"def",
"_error_code_to_str",
"(",
"mod",
",",
"type_",
",",
"code",
")",
":",
"(",
"_",
",",
"c_name",
")",
"=",
"_get_error_names",
"(",
"mod",
",",
"type_",
",",
"code",
")",
"return",
"'%s(%d)'",
"%",
"(",
"c_name",
",",
"code",
")"
] | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | _error_to_jsondict | This method is registered as ofp_error_to_jsondict(type_, code) method
into ryu.ofproto.ofproto_v1_* modules.
And this method returns ofp_error_msg as a json format for given
'type' and 'code' defined in ofp_error_msg structure.
Example::
>>> ofproto.ofp_error_to_jsondict(4, 9)
{'code'... | ryu/ofproto/ofproto_utils.py | def _error_to_jsondict(mod, type_, code):
"""
This method is registered as ofp_error_to_jsondict(type_, code) method
into ryu.ofproto.ofproto_v1_* modules.
And this method returns ofp_error_msg as a json format for given
'type' and 'code' defined in ofp_error_msg structure.
Example::
>... | def _error_to_jsondict(mod, type_, code):
"""
This method is registered as ofp_error_to_jsondict(type_, code) method
into ryu.ofproto.ofproto_v1_* modules.
And this method returns ofp_error_msg as a json format for given
'type' and 'code' defined in ofp_error_msg structure.
Example::
>... | [
"This",
"method",
"is",
"registered",
"as",
"ofp_error_to_jsondict",
"(",
"type_",
"code",
")",
"method",
"into",
"ryu",
".",
"ofproto",
".",
"ofproto_v1_",
"*",
"modules",
".",
"And",
"this",
"method",
"returns",
"ofp_error_msg",
"as",
"a",
"json",
"format",
... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_utils.py#L109-L123 | [
"def",
"_error_to_jsondict",
"(",
"mod",
",",
"type_",
",",
"code",
")",
":",
"(",
"t_name",
",",
"c_name",
")",
"=",
"_get_error_names",
"(",
"mod",
",",
"type_",
",",
"code",
")",
"return",
"{",
"'type'",
":",
"'%s(%d)'",
"%",
"(",
"t_name",
",",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | VrfConf.settings | Returns a copy of current settings.
As some of the attributes are themselves containers, we clone the
settings to provide clones for those containers as well. | ryu/services/protocols/bgp/rtconf/vrfs.py | def settings(self):
"""Returns a copy of current settings.
As some of the attributes are themselves containers, we clone the
settings to provide clones for those containers as well.
"""
# Shallow copy first
cloned_setting = self._settings.copy()
# Don't want clon... | def settings(self):
"""Returns a copy of current settings.
As some of the attributes are themselves containers, we clone the
settings to provide clones for those containers as well.
"""
# Shallow copy first
cloned_setting = self._settings.copy()
# Don't want clon... | [
"Returns",
"a",
"copy",
"of",
"current",
"settings",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/rtconf/vrfs.py#L271-L283 | [
"def",
"settings",
"(",
"self",
")",
":",
"# Shallow copy first",
"cloned_setting",
"=",
"self",
".",
"_settings",
".",
"copy",
"(",
")",
"# Don't want clone to link to same RT containers",
"cloned_setting",
"[",
"IMPORT_RTS",
"]",
"=",
"self",
".",
"import_rts",
"c... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | VrfConf.update | Updates this `VrfConf` settings.
Notifies listeners if any settings changed. Returns `True` if update
was successful. This vrfs' route family, id and route dist settings
cannot be updated/changed. | ryu/services/protocols/bgp/rtconf/vrfs.py | def update(self, **kwargs):
"""Updates this `VrfConf` settings.
Notifies listeners if any settings changed. Returns `True` if update
was successful. This vrfs' route family, id and route dist settings
cannot be updated/changed.
"""
# Update inherited configurations
... | def update(self, **kwargs):
"""Updates this `VrfConf` settings.
Notifies listeners if any settings changed. Returns `True` if update
was successful. This vrfs' route family, id and route dist settings
cannot be updated/changed.
"""
# Update inherited configurations
... | [
"Updates",
"this",
"VrfConf",
"settings",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/rtconf/vrfs.py#L303-L346 | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Update inherited configurations",
"super",
"(",
"VrfConf",
",",
"self",
")",
".",
"update",
"(",
"*",
"*",
"kwargs",
")",
"vrf_id",
"=",
"kwargs",
".",
"get",
"(",
"ConfWithId",
".",
"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | VrfsConf.remove_vrf_conf | Removes any matching `VrfConf` for given `route_dist` or `vrf_id`
Parameters:
- `route_dist`: (str) route distinguisher of a configured VRF
- `vrf_id`: (str) vrf ID
- `vrf_rf`: (str) route family of the VRF configuration
If only `route_dist` is given, removes `VrfCon... | ryu/services/protocols/bgp/rtconf/vrfs.py | def remove_vrf_conf(self, route_dist=None, vrf_id=None,
vrf_rf=None):
"""Removes any matching `VrfConf` for given `route_dist` or `vrf_id`
Parameters:
- `route_dist`: (str) route distinguisher of a configured VRF
- `vrf_id`: (str) vrf ID
- `vr... | def remove_vrf_conf(self, route_dist=None, vrf_id=None,
vrf_rf=None):
"""Removes any matching `VrfConf` for given `route_dist` or `vrf_id`
Parameters:
- `route_dist`: (str) route distinguisher of a configured VRF
- `vrf_id`: (str) vrf ID
- `vr... | [
"Removes",
"any",
"matching",
"VrfConf",
"for",
"given",
"route_dist",
"or",
"vrf_id"
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/rtconf/vrfs.py#L464-L505 | [
"def",
"remove_vrf_conf",
"(",
"self",
",",
"route_dist",
"=",
"None",
",",
"vrf_id",
"=",
"None",
",",
"vrf_rf",
"=",
"None",
")",
":",
"if",
"route_dist",
"is",
"None",
"and",
"vrf_id",
"is",
"None",
":",
"raise",
"RuntimeConfigError",
"(",
"desc",
"="... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpLib.packet_in_handler | PacketIn event handler. when the received packet was IGMP,
proceed it. otherwise, send a event. | ryu/lib/igmplib.py | def packet_in_handler(self, evt):
"""PacketIn event handler. when the received packet was IGMP,
proceed it. otherwise, send a event."""
msg = evt.msg
dpid = msg.datapath.id
req_pkt = packet.Packet(msg.data)
req_igmp = req_pkt.get_protocol(igmp.igmp)
if req_igmp:
... | def packet_in_handler(self, evt):
"""PacketIn event handler. when the received packet was IGMP,
proceed it. otherwise, send a event."""
msg = evt.msg
dpid = msg.datapath.id
req_pkt = packet.Packet(msg.data)
req_igmp = req_pkt.get_protocol(igmp.igmp)
if req_igmp:
... | [
"PacketIn",
"event",
"handler",
".",
"when",
"the",
"received",
"packet",
"was",
"IGMP",
"proceed",
"it",
".",
"otherwise",
"send",
"a",
"event",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L105-L119 | [
"def",
"packet_in_handler",
"(",
"self",
",",
"evt",
")",
":",
"msg",
"=",
"evt",
".",
"msg",
"dpid",
"=",
"msg",
".",
"datapath",
".",
"id",
"req_pkt",
"=",
"packet",
".",
"Packet",
"(",
"msg",
".",
"data",
")",
"req_igmp",
"=",
"req_pkt",
".",
"g... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpLib.state_change_handler | StateChange event handler. | ryu/lib/igmplib.py | def state_change_handler(self, evt):
"""StateChange event handler."""
datapath = evt.datapath
assert datapath is not None
if datapath.id == self._querier.dpid:
if evt.state == MAIN_DISPATCHER:
self._querier.start_loop(datapath)
elif evt.state == DE... | def state_change_handler(self, evt):
"""StateChange event handler."""
datapath = evt.datapath
assert datapath is not None
if datapath.id == self._querier.dpid:
if evt.state == MAIN_DISPATCHER:
self._querier.start_loop(datapath)
elif evt.state == DE... | [
"StateChange",
"event",
"handler",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L123-L131 | [
"def",
"state_change_handler",
"(",
"self",
",",
"evt",
")",
":",
"datapath",
"=",
"evt",
".",
"datapath",
"assert",
"datapath",
"is",
"not",
"None",
"if",
"datapath",
".",
"id",
"==",
"self",
".",
"_querier",
".",
"dpid",
":",
"if",
"evt",
".",
"state... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpBase._set_flow_entry | set a flow entry. | ryu/lib/igmplib.py | def _set_flow_entry(self, datapath, actions, in_port, dst, src=None):
"""set a flow entry."""
set_flow = self._set_flow_func.get(datapath.ofproto.OFP_VERSION)
assert set_flow
set_flow(datapath, actions, in_port, dst, src) | def _set_flow_entry(self, datapath, actions, in_port, dst, src=None):
"""set a flow entry."""
set_flow = self._set_flow_func.get(datapath.ofproto.OFP_VERSION)
assert set_flow
set_flow(datapath, actions, in_port, dst, src) | [
"set",
"a",
"flow",
"entry",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L185-L189 | [
"def",
"_set_flow_entry",
"(",
"self",
",",
"datapath",
",",
"actions",
",",
"in_port",
",",
"dst",
",",
"src",
"=",
"None",
")",
":",
"set_flow",
"=",
"self",
".",
"_set_flow_func",
".",
"get",
"(",
"datapath",
".",
"ofproto",
".",
"OFP_VERSION",
")",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpBase._del_flow_entry | remove a flow entry. | ryu/lib/igmplib.py | def _del_flow_entry(self, datapath, in_port, dst, src=None):
"""remove a flow entry."""
del_flow = self._del_flow_func.get(datapath.ofproto.OFP_VERSION)
assert del_flow
del_flow(datapath, in_port, dst, src) | def _del_flow_entry(self, datapath, in_port, dst, src=None):
"""remove a flow entry."""
del_flow = self._del_flow_func.get(datapath.ofproto.OFP_VERSION)
assert del_flow
del_flow(datapath, in_port, dst, src) | [
"remove",
"a",
"flow",
"entry",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L218-L222 | [
"def",
"_del_flow_entry",
"(",
"self",
",",
"datapath",
",",
"in_port",
",",
"dst",
",",
"src",
"=",
"None",
")",
":",
"del_flow",
"=",
"self",
".",
"_del_flow_func",
".",
"get",
"(",
"datapath",
".",
"ofproto",
".",
"OFP_VERSION",
")",
"assert",
"del_fl... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpBase._do_packet_out | send a packet. | ryu/lib/igmplib.py | def _do_packet_out(self, datapath, data, in_port, actions):
"""send a packet."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
out = parser.OFPPacketOut(
datapath=datapath, buffer_id=ofproto.OFP_NO_BUFFER,
data=data, in_port=in_port, actions=actions... | def _do_packet_out(self, datapath, data, in_port, actions):
"""send a packet."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
out = parser.OFPPacketOut(
datapath=datapath, buffer_id=ofproto.OFP_NO_BUFFER,
data=data, in_port=in_port, actions=actions... | [
"send",
"a",
"packet",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L224-L232 | [
"def",
"_do_packet_out",
"(",
"self",
",",
"datapath",
",",
"data",
",",
"in_port",
",",
"actions",
")",
":",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"out",
"=",
"parser",
".",
"OFPPacketOut",
"(",
"dat... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpBase._ipv4_text_to_int | convert ip v4 string to integer. | ryu/lib/igmplib.py | def _ipv4_text_to_int(self, ip_text):
"""convert ip v4 string to integer."""
if ip_text is None:
return None
assert isinstance(ip_text, str)
return struct.unpack('!I', addrconv.ipv4.text_to_bin(ip_text))[0] | def _ipv4_text_to_int(self, ip_text):
"""convert ip v4 string to integer."""
if ip_text is None:
return None
assert isinstance(ip_text, str)
return struct.unpack('!I', addrconv.ipv4.text_to_bin(ip_text))[0] | [
"convert",
"ip",
"v4",
"string",
"to",
"integer",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L237-L242 | [
"def",
"_ipv4_text_to_int",
"(",
"self",
",",
"ip_text",
")",
":",
"if",
"ip_text",
"is",
"None",
":",
"return",
"None",
"assert",
"isinstance",
"(",
"ip_text",
",",
"str",
")",
"return",
"struct",
".",
"unpack",
"(",
"'!I'",
",",
"addrconv",
".",
"ipv4"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier.set_querier_mode | set the datapath to work as a querier. note that you can set
up only the one querier. when you called this method several
times, only the last one becomes effective. | ryu/lib/igmplib.py | def set_querier_mode(self, dpid, server_port):
"""set the datapath to work as a querier. note that you can set
up only the one querier. when you called this method several
times, only the last one becomes effective."""
self.dpid = dpid
self.server_port = server_port
if se... | def set_querier_mode(self, dpid, server_port):
"""set the datapath to work as a querier. note that you can set
up only the one querier. when you called this method several
times, only the last one becomes effective."""
self.dpid = dpid
self.server_port = server_port
if se... | [
"set",
"the",
"datapath",
"to",
"work",
"as",
"a",
"querier",
".",
"note",
"that",
"you",
"can",
"set",
"up",
"only",
"the",
"one",
"querier",
".",
"when",
"you",
"called",
"this",
"method",
"several",
"times",
"only",
"the",
"last",
"one",
"becomes",
... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L287-L295 | [
"def",
"set_querier_mode",
"(",
"self",
",",
"dpid",
",",
"server_port",
")",
":",
"self",
".",
"dpid",
"=",
"dpid",
"self",
".",
"server_port",
"=",
"server_port",
"if",
"self",
".",
"_querier_thread",
":",
"hub",
".",
"kill",
"(",
"self",
".",
"_querie... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier.packet_in_handler | the process when the querier received IGMP. | ryu/lib/igmplib.py | def packet_in_handler(self, req_igmp, msg):
"""the process when the querier received IGMP."""
ofproto = msg.datapath.ofproto
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
in_port = msg.in_port
else:
in_port = msg.match['in_port']
if (igmp.IGMP_TYPE_R... | def packet_in_handler(self, req_igmp, msg):
"""the process when the querier received IGMP."""
ofproto = msg.datapath.ofproto
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
in_port = msg.in_port
else:
in_port = msg.match['in_port']
if (igmp.IGMP_TYPE_R... | [
"the",
"process",
"when",
"the",
"querier",
"received",
"IGMP",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L297-L308 | [
"def",
"packet_in_handler",
"(",
"self",
",",
"req_igmp",
",",
"msg",
")",
":",
"ofproto",
"=",
"msg",
".",
"datapath",
".",
"ofproto",
"if",
"ofproto",
".",
"OFP_VERSION",
"==",
"ofproto_v1_0",
".",
"OFP_VERSION",
":",
"in_port",
"=",
"msg",
".",
"in_port... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier.start_loop | start QUERY thread. | ryu/lib/igmplib.py | def start_loop(self, datapath):
"""start QUERY thread."""
self._datapath = datapath
self._querier_thread = hub.spawn(self._send_query)
self.logger.info("started a querier.") | def start_loop(self, datapath):
"""start QUERY thread."""
self._datapath = datapath
self._querier_thread = hub.spawn(self._send_query)
self.logger.info("started a querier.") | [
"start",
"QUERY",
"thread",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L310-L314 | [
"def",
"start_loop",
"(",
"self",
",",
"datapath",
")",
":",
"self",
".",
"_datapath",
"=",
"datapath",
"self",
".",
"_querier_thread",
"=",
"hub",
".",
"spawn",
"(",
"self",
".",
"_send_query",
")",
"self",
".",
"logger",
".",
"info",
"(",
"\"started a ... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier.stop_loop | stop QUERY thread. | ryu/lib/igmplib.py | def stop_loop(self):
"""stop QUERY thread."""
hub.kill(self._querier_thread)
self._querier_thread = None
self._datapath = None
self.logger.info("stopped a querier.") | def stop_loop(self):
"""stop QUERY thread."""
hub.kill(self._querier_thread)
self._querier_thread = None
self._datapath = None
self.logger.info("stopped a querier.") | [
"stop",
"QUERY",
"thread",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L316-L321 | [
"def",
"stop_loop",
"(",
"self",
")",
":",
"hub",
".",
"kill",
"(",
"self",
".",
"_querier_thread",
")",
"self",
".",
"_querier_thread",
"=",
"None",
"self",
".",
"_datapath",
"=",
"None",
"self",
".",
"logger",
".",
"info",
"(",
"\"stopped a querier.\"",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier._send_query | send a QUERY message periodically. | ryu/lib/igmplib.py | def _send_query(self):
""" send a QUERY message periodically."""
timeout = 60
ofproto = self._datapath.ofproto
parser = self._datapath.ofproto_parser
if ofproto_v1_0.OFP_VERSION == ofproto.OFP_VERSION:
send_port = ofproto.OFPP_NONE
else:
send_port ... | def _send_query(self):
""" send a QUERY message periodically."""
timeout = 60
ofproto = self._datapath.ofproto
parser = self._datapath.ofproto_parser
if ofproto_v1_0.OFP_VERSION == ofproto.OFP_VERSION:
send_port = ofproto.OFPP_NONE
else:
send_port ... | [
"send",
"a",
"QUERY",
"message",
"periodically",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L326-L396 | [
"def",
"_send_query",
"(",
"self",
")",
":",
"timeout",
"=",
"60",
"ofproto",
"=",
"self",
".",
"_datapath",
".",
"ofproto",
"parser",
"=",
"self",
".",
"_datapath",
".",
"ofproto_parser",
"if",
"ofproto_v1_0",
".",
"OFP_VERSION",
"==",
"ofproto",
".",
"OF... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier._do_report | the process when the querier received a REPORT message. | ryu/lib/igmplib.py | def _do_report(self, report, in_port, msg):
"""the process when the querier received a REPORT message."""
datapath = msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
size = 65535
else... | def _do_report(self, report, in_port, msg):
"""the process when the querier received a REPORT message."""
datapath = msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
size = 65535
else... | [
"the",
"process",
"when",
"the",
"querier",
"received",
"a",
"REPORT",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L398-L424 | [
"def",
"_do_report",
"(",
"self",
",",
"report",
",",
"in_port",
",",
"msg",
")",
":",
"datapath",
"=",
"msg",
".",
"datapath",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"if",
"ofproto",
".",
"OFP_VERSION... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier._do_leave | the process when the querier received a LEAVE message. | ryu/lib/igmplib.py | def _do_leave(self, leave, in_port, msg):
"""the process when the querier received a LEAVE message."""
datapath = msg.datapath
parser = datapath.ofproto_parser
self._mcast.setdefault(leave.address, {})
if in_port in self._mcast[leave.address]:
self._del_flow_entry(
... | def _do_leave(self, leave, in_port, msg):
"""the process when the querier received a LEAVE message."""
datapath = msg.datapath
parser = datapath.ofproto_parser
self._mcast.setdefault(leave.address, {})
if in_port in self._mcast[leave.address]:
self._del_flow_entry(
... | [
"the",
"process",
"when",
"the",
"querier",
"received",
"a",
"LEAVE",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L426-L444 | [
"def",
"_do_leave",
"(",
"self",
",",
"leave",
",",
"in_port",
",",
"msg",
")",
":",
"datapath",
"=",
"msg",
".",
"datapath",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"self",
".",
"_mcast",
".",
"setdefault",
"(",
"leave",
".",
"address",
",",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpQuerier._set_logger | change log format. | ryu/lib/igmplib.py | def _set_logger(self):
"""change log format."""
self.logger.propagate = False
hdl = logging.StreamHandler()
fmt_str = '[querier][%(levelname)s] %(message)s'
hdl.setFormatter(logging.Formatter(fmt_str))
self.logger.addHandler(hdl) | def _set_logger(self):
"""change log format."""
self.logger.propagate = False
hdl = logging.StreamHandler()
fmt_str = '[querier][%(levelname)s] %(message)s'
hdl.setFormatter(logging.Formatter(fmt_str))
self.logger.addHandler(hdl) | [
"change",
"log",
"format",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L449-L455 | [
"def",
"_set_logger",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"propagate",
"=",
"False",
"hdl",
"=",
"logging",
".",
"StreamHandler",
"(",
")",
"fmt_str",
"=",
"'[querier][%(levelname)s] %(message)s'",
"hdl",
".",
"setFormatter",
"(",
"logging",
"."... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper.packet_in_handler | the process when the snooper received IGMP. | ryu/lib/igmplib.py | def packet_in_handler(self, req_pkt, req_igmp, msg):
"""the process when the snooper received IGMP."""
dpid = msg.datapath.id
ofproto = msg.datapath.ofproto
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
in_port = msg.in_port
else:
in_port = msg.match... | def packet_in_handler(self, req_pkt, req_igmp, msg):
"""the process when the snooper received IGMP."""
dpid = msg.datapath.id
ofproto = msg.datapath.ofproto
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
in_port = msg.in_port
else:
in_port = msg.match... | [
"the",
"process",
"when",
"the",
"snooper",
"received",
"IGMP",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L522-L552 | [
"def",
"packet_in_handler",
"(",
"self",
",",
"req_pkt",
",",
"req_igmp",
",",
"msg",
")",
":",
"dpid",
"=",
"msg",
".",
"datapath",
".",
"id",
"ofproto",
"=",
"msg",
".",
"datapath",
".",
"ofproto",
"if",
"ofproto",
".",
"OFP_VERSION",
"==",
"ofproto_v1... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper._do_query | the process when the snooper received a QUERY message. | ryu/lib/igmplib.py | def _do_query(self, query, iph, eth, in_port, msg):
"""the process when the snooper received a QUERY message."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
# learn the querier.
self._to_querier[dpid] = {... | def _do_query(self, query, iph, eth, in_port, msg):
"""the process when the snooper received a QUERY message."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
# learn the querier.
self._to_querier[dpid] = {... | [
"the",
"process",
"when",
"the",
"snooper",
"received",
"a",
"QUERY",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L557-L595 | [
"def",
"_do_query",
"(",
"self",
",",
"query",
",",
"iph",
",",
"eth",
",",
"in_port",
",",
"msg",
")",
":",
"datapath",
"=",
"msg",
".",
"datapath",
"dpid",
"=",
"datapath",
".",
"id",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"data... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper._do_report | the process when the snooper received a REPORT message. | ryu/lib/igmplib.py | def _do_report(self, report, in_port, msg):
"""the process when the snooper received a REPORT message."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
... | def _do_report(self, report, in_port, msg):
"""the process when the snooper received a REPORT message."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
... | [
"the",
"process",
"when",
"the",
"snooper",
"received",
"a",
"REPORT",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L597-L666 | [
"def",
"_do_report",
"(",
"self",
",",
"report",
",",
"in_port",
",",
"msg",
")",
":",
"datapath",
"=",
"msg",
".",
"datapath",
"dpid",
"=",
"datapath",
".",
"id",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parse... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper._do_leave | the process when the snooper received a LEAVE message. | ryu/lib/igmplib.py | def _do_leave(self, leave, in_port, msg):
"""the process when the snooper received a LEAVE message."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
# check whether the querier port has been specified.
if n... | def _do_leave(self, leave, in_port, msg):
"""the process when the snooper received a LEAVE message."""
datapath = msg.datapath
dpid = datapath.id
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
# check whether the querier port has been specified.
if n... | [
"the",
"process",
"when",
"the",
"snooper",
"received",
"a",
"LEAVE",
"message",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L668-L718 | [
"def",
"_do_leave",
"(",
"self",
",",
"leave",
",",
"in_port",
",",
"msg",
")",
":",
"datapath",
"=",
"msg",
".",
"datapath",
"dpid",
"=",
"datapath",
".",
"id",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper._do_flood | the process when the snooper received a message of the
outside for processing. | ryu/lib/igmplib.py | def _do_flood(self, in_port, msg):
"""the process when the snooper received a message of the
outside for processing. """
datapath = msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
actions = [parser.OFPActionOutput(ofproto.OFPP_FLOOD)]
sel... | def _do_flood(self, in_port, msg):
"""the process when the snooper received a message of the
outside for processing. """
datapath = msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
actions = [parser.OFPActionOutput(ofproto.OFPP_FLOOD)]
sel... | [
"the",
"process",
"when",
"the",
"snooper",
"received",
"a",
"message",
"of",
"the",
"outside",
"for",
"processing",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L720-L728 | [
"def",
"_do_flood",
"(",
"self",
",",
"in_port",
",",
"msg",
")",
":",
"datapath",
"=",
"msg",
".",
"datapath",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"actions",
"=",
"[",
"parser",
".",
"OFPActionOutp... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper._do_timeout_for_query | the process when the QUERY from the querier timeout expired. | ryu/lib/igmplib.py | def _do_timeout_for_query(self, timeout, datapath):
"""the process when the QUERY from the querier timeout expired."""
dpid = datapath.id
hub.sleep(timeout)
outport = self._to_querier[dpid]['port']
remove_dsts = []
for dst in self._to_hosts[dpid]:
if not sel... | def _do_timeout_for_query(self, timeout, datapath):
"""the process when the QUERY from the querier timeout expired."""
dpid = datapath.id
hub.sleep(timeout)
outport = self._to_querier[dpid]['port']
remove_dsts = []
for dst in self._to_hosts[dpid]:
if not sel... | [
"the",
"process",
"when",
"the",
"QUERY",
"from",
"the",
"querier",
"timeout",
"expired",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L730-L747 | [
"def",
"_do_timeout_for_query",
"(",
"self",
",",
"timeout",
",",
"datapath",
")",
":",
"dpid",
"=",
"datapath",
".",
"id",
"hub",
".",
"sleep",
"(",
"timeout",
")",
"outport",
"=",
"self",
".",
"_to_querier",
"[",
"dpid",
"]",
"[",
"'port'",
"]",
"rem... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper._do_timeout_for_leave | the process when the QUERY from the switch timeout expired. | ryu/lib/igmplib.py | def _do_timeout_for_leave(self, timeout, datapath, dst, in_port):
"""the process when the QUERY from the switch timeout expired."""
parser = datapath.ofproto_parser
dpid = datapath.id
hub.sleep(timeout)
outport = self._to_querier[dpid]['port']
if self._to_hosts[dpid][ds... | def _do_timeout_for_leave(self, timeout, datapath, dst, in_port):
"""the process when the QUERY from the switch timeout expired."""
parser = datapath.ofproto_parser
dpid = datapath.id
hub.sleep(timeout)
outport = self._to_querier[dpid]['port']
if self._to_hosts[dpid][ds... | [
"the",
"process",
"when",
"the",
"QUERY",
"from",
"the",
"switch",
"timeout",
"expired",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L749-L777 | [
"def",
"_do_timeout_for_leave",
"(",
"self",
",",
"timeout",
",",
"datapath",
",",
"dst",
",",
"in_port",
")",
":",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"dpid",
"=",
"datapath",
".",
"id",
"hub",
".",
"sleep",
"(",
"timeout",
")",
"outport",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | IgmpSnooper._remove_multicast_group | remove flow entries about the group and send a LEAVE message
if exists. | ryu/lib/igmplib.py | def _remove_multicast_group(self, datapath, outport, dst):
"""remove flow entries about the group and send a LEAVE message
if exists."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id
self._send_event(
EventMulticastGroupStateC... | def _remove_multicast_group(self, datapath, outport, dst):
"""remove flow entries about the group and send a LEAVE message
if exists."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
dpid = datapath.id
self._send_event(
EventMulticastGroupStateC... | [
"remove",
"flow",
"entries",
"about",
"the",
"group",
"and",
"send",
"a",
"LEAVE",
"message",
"if",
"exists",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/igmplib.py#L779-L800 | [
"def",
"_remove_multicast_group",
"(",
"self",
",",
"datapath",
",",
"outport",
",",
"dst",
")",
":",
"ofproto",
"=",
"datapath",
".",
"ofproto",
"parser",
"=",
"datapath",
".",
"ofproto_parser",
"dpid",
"=",
"datapath",
".",
"id",
"self",
".",
"_send_event"... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RouteTargetManager.update_rtc_as_set | Syncs RT NLRIs for new and removed RTC_ASes.
This method should be called when a neighbor is added or removed. | ryu/services/protocols/bgp/utils/rtfilter.py | def update_rtc_as_set(self):
"""Syncs RT NLRIs for new and removed RTC_ASes.
This method should be called when a neighbor is added or removed.
"""
# Compute the diffs in RTC_ASes
curr_rtc_as_set = self._neighbors_conf.rtc_as_set
# Always add local AS to RTC AS set
... | def update_rtc_as_set(self):
"""Syncs RT NLRIs for new and removed RTC_ASes.
This method should be called when a neighbor is added or removed.
"""
# Compute the diffs in RTC_ASes
curr_rtc_as_set = self._neighbors_conf.rtc_as_set
# Always add local AS to RTC AS set
... | [
"Syncs",
"RT",
"NLRIs",
"for",
"new",
"and",
"removed",
"RTC_ASes",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/rtfilter.py#L96-L118 | [
"def",
"update_rtc_as_set",
"(",
"self",
")",
":",
"# Compute the diffs in RTC_ASes",
"curr_rtc_as_set",
"=",
"self",
".",
"_neighbors_conf",
".",
"rtc_as_set",
"# Always add local AS to RTC AS set",
"curr_rtc_as_set",
".",
"add",
"(",
"self",
".",
"_core_service",
".",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RouteTargetManager.update_local_rt_nlris | Does book-keeping of local RT NLRIs based on all configured VRFs.
Syncs all import RTs and RT NLRIs.
The method should be called when any VRFs are added/removed/changed. | ryu/services/protocols/bgp/utils/rtfilter.py | def update_local_rt_nlris(self):
"""Does book-keeping of local RT NLRIs based on all configured VRFs.
Syncs all import RTs and RT NLRIs.
The method should be called when any VRFs are added/removed/changed.
"""
current_conf_import_rts = set()
for vrf in self._vrfs_conf.vr... | def update_local_rt_nlris(self):
"""Does book-keeping of local RT NLRIs based on all configured VRFs.
Syncs all import RTs and RT NLRIs.
The method should be called when any VRFs are added/removed/changed.
"""
current_conf_import_rts = set()
for vrf in self._vrfs_conf.vr... | [
"Does",
"book",
"-",
"keeping",
"of",
"local",
"RT",
"NLRIs",
"based",
"on",
"all",
"configured",
"VRFs",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/rtfilter.py#L120-L138 | [
"def",
"update_local_rt_nlris",
"(",
"self",
")",
":",
"current_conf_import_rts",
"=",
"set",
"(",
")",
"for",
"vrf",
"in",
"self",
".",
"_vrfs_conf",
".",
"vrf_confs",
":",
"current_conf_import_rts",
".",
"update",
"(",
"vrf",
".",
"import_rts",
")",
"removed... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RouteTargetManager._compute_global_interested_rts | Computes current global interested RTs for global tables.
Computes interested RTs based on current RT filters for peers. This
filter should be used to check if for RTs on a path that is installed
in any global table (expect RT Table). | ryu/services/protocols/bgp/utils/rtfilter.py | def _compute_global_interested_rts(self):
"""Computes current global interested RTs for global tables.
Computes interested RTs based on current RT filters for peers. This
filter should be used to check if for RTs on a path that is installed
in any global table (expect RT Table).
... | def _compute_global_interested_rts(self):
"""Computes current global interested RTs for global tables.
Computes interested RTs based on current RT filters for peers. This
filter should be used to check if for RTs on a path that is installed
in any global table (expect RT Table).
... | [
"Computes",
"current",
"global",
"interested",
"RTs",
"for",
"global",
"tables",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/rtfilter.py#L164-L180 | [
"def",
"_compute_global_interested_rts",
"(",
"self",
")",
":",
"interested_rts",
"=",
"set",
"(",
")",
"for",
"rtfilter",
"in",
"self",
".",
"_peer_to_rtfilter_map",
".",
"values",
"(",
")",
":",
"interested_rts",
".",
"update",
"(",
"rtfilter",
")",
"interes... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | RouteTargetManager.update_interested_rts | Updates interested RT list.
Check if interested RTs have changes from previous check.
Takes appropriate action for new interesting RTs and removal of un-
interesting RTs. | ryu/services/protocols/bgp/utils/rtfilter.py | def update_interested_rts(self):
"""Updates interested RT list.
Check if interested RTs have changes from previous check.
Takes appropriate action for new interesting RTs and removal of un-
interesting RTs.
"""
prev_global_rts = self._global_interested_rts
curr_g... | def update_interested_rts(self):
"""Updates interested RT list.
Check if interested RTs have changes from previous check.
Takes appropriate action for new interesting RTs and removal of un-
interesting RTs.
"""
prev_global_rts = self._global_interested_rts
curr_g... | [
"Updates",
"interested",
"RT",
"list",
"."
] | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/utils/rtfilter.py#L182-L201 | [
"def",
"update_interested_rts",
"(",
"self",
")",
":",
"prev_global_rts",
"=",
"self",
".",
"_global_interested_rts",
"curr_global_rts",
"=",
"self",
".",
"_compute_global_interested_rts",
"(",
")",
"new_global_rts",
"=",
"curr_global_rts",
"-",
"prev_global_rts",
"remo... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ipv4_to_str | Converts binary or int type representation to human readable IPv4 string.
:param ip: binary or int type representation of IPv4 address
:return: IPv4 address string | ryu/lib/ip.py | def ipv4_to_str(ip):
"""
Converts binary or int type representation to human readable IPv4 string.
:param ip: binary or int type representation of IPv4 address
:return: IPv4 address string
"""
if isinstance(ip, numbers.Integral):
return addrconv.ipv4.bin_to_text(struct.pack("!I", ip))
... | def ipv4_to_str(ip):
"""
Converts binary or int type representation to human readable IPv4 string.
:param ip: binary or int type representation of IPv4 address
:return: IPv4 address string
"""
if isinstance(ip, numbers.Integral):
return addrconv.ipv4.bin_to_text(struct.pack("!I", ip))
... | [
"Converts",
"binary",
"or",
"int",
"type",
"representation",
"to",
"human",
"readable",
"IPv4",
"string",
".",
":",
"param",
"ip",
":",
"binary",
"or",
"int",
"type",
"representation",
"of",
"IPv4",
"address",
":",
"return",
":",
"IPv4",
"address",
"string"
... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ip.py#L81-L90 | [
"def",
"ipv4_to_str",
"(",
"ip",
")",
":",
"if",
"isinstance",
"(",
"ip",
",",
"numbers",
".",
"Integral",
")",
":",
"return",
"addrconv",
".",
"ipv4",
".",
"bin_to_text",
"(",
"struct",
".",
"pack",
"(",
"\"!I\"",
",",
"ip",
")",
")",
"else",
":",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | ipv6_to_str | Converts binary or int type representation to human readable IPv6 string.
:param ip: binary or int type representation of IPv6 address
:return: IPv6 address string | ryu/lib/ip.py | def ipv6_to_str(ip):
"""
Converts binary or int type representation to human readable IPv6 string.
:param ip: binary or int type representation of IPv6 address
:return: IPv6 address string
"""
if isinstance(ip, numbers.Integral):
return addrconv.ipv6.bin_to_text(type_desc.Int16.from_user... | def ipv6_to_str(ip):
"""
Converts binary or int type representation to human readable IPv6 string.
:param ip: binary or int type representation of IPv6 address
:return: IPv6 address string
"""
if isinstance(ip, numbers.Integral):
return addrconv.ipv6.bin_to_text(type_desc.Int16.from_user... | [
"Converts",
"binary",
"or",
"int",
"type",
"representation",
"to",
"human",
"readable",
"IPv6",
"string",
".",
":",
"param",
"ip",
":",
"binary",
"or",
"int",
"type",
"representation",
"of",
"IPv6",
"address",
":",
"return",
":",
"IPv6",
"address",
"string"
... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ip.py#L111-L120 | [
"def",
"ipv6_to_str",
"(",
"ip",
")",
":",
"if",
"isinstance",
"(",
"ip",
",",
"numbers",
".",
"Integral",
")",
":",
"return",
"addrconv",
".",
"ipv6",
".",
"bin_to_text",
"(",
"type_desc",
".",
"Int16",
".",
"from_user",
"(",
"ip",
")",
")",
"else",
... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
train | bin_to_text | Converts binary representation to human readable IPv4 or IPv6 string.
:param ip: binary representation of IPv4 or IPv6 address
:return: IPv4 or IPv6 address string | ryu/lib/ip.py | def bin_to_text(ip):
"""
Converts binary representation to human readable IPv4 or IPv6 string.
:param ip: binary representation of IPv4 or IPv6 address
:return: IPv4 or IPv6 address string
"""
if len(ip) == 4:
return ipv4_to_str(ip)
elif len(ip) == 16:
return ipv6_to_str(ip)
... | def bin_to_text(ip):
"""
Converts binary representation to human readable IPv4 or IPv6 string.
:param ip: binary representation of IPv4 or IPv6 address
:return: IPv4 or IPv6 address string
"""
if len(ip) == 4:
return ipv4_to_str(ip)
elif len(ip) == 16:
return ipv6_to_str(ip)
... | [
"Converts",
"binary",
"representation",
"to",
"human",
"readable",
"IPv4",
"or",
"IPv6",
"string",
".",
":",
"param",
"ip",
":",
"binary",
"representation",
"of",
"IPv4",
"or",
"IPv6",
"address",
":",
"return",
":",
"IPv4",
"or",
"IPv6",
"address",
"string"
... | osrg/ryu | python | https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ip.py#L149-L160 | [
"def",
"bin_to_text",
"(",
"ip",
")",
":",
"if",
"len",
"(",
"ip",
")",
"==",
"4",
":",
"return",
"ipv4_to_str",
"(",
"ip",
")",
"elif",
"len",
"(",
"ip",
")",
"==",
"16",
":",
"return",
"ipv6_to_str",
"(",
"ip",
")",
"else",
":",
"raise",
"struc... | 6f906e72c92e10bd0264c9b91a2f7bb85b97780c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.