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 | OpenThreadController.remove_prefix | Remove network prefix. | tools/harness-automation/autothreadharness/open_thread_controller.py | def remove_prefix(self, prefix):
"""Remove network prefix.
"""
self._req('prefix remove %s' % prefix)
time.sleep(1)
self._req('netdataregister') | def remove_prefix(self, prefix):
"""Remove network prefix.
"""
self._req('prefix remove %s' % prefix)
time.sleep(1)
self._req('netdataregister') | [
"Remove",
"network",
"prefix",
"."
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L372-L377 | [
"def",
"remove_prefix",
"(",
"self",
",",
"prefix",
")",
":",
"self",
".",
"_req",
"(",
"'prefix remove %s'",
"%",
"prefix",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"self",
".",
"_req",
"(",
"'netdataregister'",
")"
] | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | ApcPduController._init | Initialize the telnet connection | tools/harness-automation/autothreadharness/pdu_controller.py | def _init(self):
"""Initialize the telnet connection
"""
self.tn = telnetlib.Telnet(self.ip, self.port)
self.tn.read_until('User Name')
self.tn.write('apc\r\n')
self.tn.read_until('Password')
self.tn.write('apc\r\n')
self.until_done() | def _init(self):
"""Initialize the telnet connection
"""
self.tn = telnetlib.Telnet(self.ip, self.port)
self.tn.read_until('User Name')
self.tn.write('apc\r\n')
self.tn.read_until('Password')
self.tn.write('apc\r\n')
self.until_done() | [
"Initialize",
"the",
"telnet",
"connection"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/pdu_controller.py#L82-L90 | [
"def",
"_init",
"(",
"self",
")",
":",
"self",
".",
"tn",
"=",
"telnetlib",
".",
"Telnet",
"(",
"self",
".",
"ip",
",",
"self",
".",
"port",
")",
"self",
".",
"tn",
".",
"read_until",
"(",
"'User Name'",
")",
"self",
".",
"tn",
".",
"write",
"(",... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | ApcPduController.open | Open telnet connection
Args:
params (dict), must contain two parameters "ip" - ip address or hostname and "port" - port number
Example:
params = {'port': 23, 'ip': 'localhost'} | tools/harness-automation/autothreadharness/pdu_controller.py | def open(self, **params):
"""Open telnet connection
Args:
params (dict), must contain two parameters "ip" - ip address or hostname and "port" - port number
Example:
params = {'port': 23, 'ip': 'localhost'}
"""
logger.info('opening telnet')
self.p... | def open(self, **params):
"""Open telnet connection
Args:
params (dict), must contain two parameters "ip" - ip address or hostname and "port" - port number
Example:
params = {'port': 23, 'ip': 'localhost'}
"""
logger.info('opening telnet')
self.p... | [
"Open",
"telnet",
"connection"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/pdu_controller.py#L92-L105 | [
"def",
"open",
"(",
"self",
",",
"*",
"*",
"params",
")",
":",
"logger",
".",
"info",
"(",
"'opening telnet'",
")",
"self",
".",
"port",
"=",
"params",
"[",
"'port'",
"]",
"self",
".",
"ip",
"=",
"params",
"[",
"'ip'",
"]",
"self",
".",
"tn",
"="... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | ApcPduController.until | Wait until the regex encountered | tools/harness-automation/autothreadharness/pdu_controller.py | def until(self, regex):
"""Wait until the regex encountered
"""
logger.debug('waiting for %s', regex)
r = re.compile(regex, re.M)
self.tn.expect([r]) | def until(self, regex):
"""Wait until the regex encountered
"""
logger.debug('waiting for %s', regex)
r = re.compile(regex, re.M)
self.tn.expect([r]) | [
"Wait",
"until",
"the",
"regex",
"encountered"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/pdu_controller.py#L118-L123 | [
"def",
"until",
"(",
"self",
",",
"regex",
")",
":",
"logger",
".",
"debug",
"(",
"'waiting for %s'",
",",
"regex",
")",
"r",
"=",
"re",
".",
"compile",
"(",
"regex",
",",
"re",
".",
"M",
")",
"self",
".",
"tn",
".",
"expect",
"(",
"[",
"r",
"]... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | ApcPduController.reboot | Reboot outlet
Args:
params (dict), must contain parameter "outlet" - outlet number
Example:
params = {'outlet': 1} | tools/harness-automation/autothreadharness/pdu_controller.py | def reboot(self, **params):
"""Reboot outlet
Args:
params (dict), must contain parameter "outlet" - outlet number
Example:
params = {'outlet': 1}
"""
outlet = params['outlet']
# main menu
self.tn.write('\x1b\r\n')
self.until_done... | def reboot(self, **params):
"""Reboot outlet
Args:
params (dict), must contain parameter "outlet" - outlet number
Example:
params = {'outlet': 1}
"""
outlet = params['outlet']
# main menu
self.tn.write('\x1b\r\n')
self.until_done... | [
"Reboot",
"outlet"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/pdu_controller.py#L125-L169 | [
"def",
"reboot",
"(",
"self",
",",
"*",
"*",
"params",
")",
":",
"outlet",
"=",
"params",
"[",
"'outlet'",
"]",
"# main menu",
"self",
".",
"tn",
".",
"write",
"(",
"'\\x1b\\r\\n'",
")",
"self",
".",
"until_done",
"(",
")",
"# Device Manager",
"self",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__sendCommand | send specific command to reference unit over serial port
Args:
cmd: OpenThread_WpanCtl command string
Returns:
Fail: Failed to send the command to reference unit and parse it
Value: successfully retrieve the desired value from reference unit
Error: some ... | tools/harness-thci/OpenThread_WpanCtl.py | def __sendCommand(self, cmd):
"""send specific command to reference unit over serial port
Args:
cmd: OpenThread_WpanCtl command string
Returns:
Fail: Failed to send the command to reference unit and parse it
Value: successfully retrieve the desired value fro... | def __sendCommand(self, cmd):
"""send specific command to reference unit over serial port
Args:
cmd: OpenThread_WpanCtl command string
Returns:
Fail: Failed to send the command to reference unit and parse it
Value: successfully retrieve the desired value fro... | [
"send",
"specific",
"command",
"to",
"reference",
"unit",
"over",
"serial",
"port"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L184-L271 | [
"def",
"__sendCommand",
"(",
"self",
",",
"cmd",
")",
":",
"logging",
".",
"info",
"(",
"'%s: sendCommand[%s]'",
",",
"self",
".",
"port",
",",
"cmd",
")",
"if",
"self",
".",
"logThreadStatus",
"==",
"self",
".",
"logStatus",
"[",
"'running'",
"]",
":",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__stripValue | strip the special characters in the value
Args:
value: value string
Returns:
value string without special characters | tools/harness-thci/OpenThread_WpanCtl.py | def __stripValue(self, value):
"""strip the special characters in the value
Args:
value: value string
Returns:
value string without special characters
"""
if isinstance(value, str):
if ( value[0] == '"' and val... | def __stripValue(self, value):
"""strip the special characters in the value
Args:
value: value string
Returns:
value string without special characters
"""
if isinstance(value, str):
if ( value[0] == '"' and val... | [
"strip",
"the",
"special",
"characters",
"in",
"the",
"value"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L273-L285 | [
"def",
"__stripValue",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"if",
"(",
"value",
"[",
"0",
"]",
"==",
"'\"'",
"and",
"value",
"[",
"-",
"1",
"]",
"==",
"'\"'",
")",
"or",
"(",
"value",
"[",... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__getIp6Address | get specific type of IPv6 address configured on OpenThread_WpanCtl
Args:
addressType: the specific type of IPv6 address
link local: link local unicast IPv6 address that's within one-hop scope
global: global unicast IPv6 address
rloc: mesh local unicast IPv6 addr... | tools/harness-thci/OpenThread_WpanCtl.py | def __getIp6Address(self, addressType):
"""get specific type of IPv6 address configured on OpenThread_WpanCtl
Args:
addressType: the specific type of IPv6 address
link local: link local unicast IPv6 address that's within one-hop scope
global: global unicast IPv6 add... | def __getIp6Address(self, addressType):
"""get specific type of IPv6 address configured on OpenThread_WpanCtl
Args:
addressType: the specific type of IPv6 address
link local: link local unicast IPv6 address that's within one-hop scope
global: global unicast IPv6 add... | [
"get",
"specific",
"type",
"of",
"IPv6",
"address",
"configured",
"on",
"OpenThread_WpanCtl"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L301-L361 | [
"def",
"__getIp6Address",
"(",
"self",
",",
"addressType",
")",
":",
"addrType",
"=",
"[",
"'link local'",
",",
"'global'",
",",
"'rloc'",
",",
"'mesh EID'",
"]",
"addrs",
"=",
"[",
"]",
"globalAddr",
"=",
"[",
"]",
"linkLocal64Addr",
"=",
"''",
"rlocAddr"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__setDeviceMode | set thread device mode:
Args:
mode: thread device mode. 15=rsdn, 13=rsn, 4=s
r: rx-on-when-idle
s: secure IEEE 802.15.4 data request
d: full thread device
n: full network data
Returns:
True: successful to set the device mode
... | tools/harness-thci/OpenThread_WpanCtl.py | def __setDeviceMode(self, mode):
"""set thread device mode:
Args:
mode: thread device mode. 15=rsdn, 13=rsn, 4=s
r: rx-on-when-idle
s: secure IEEE 802.15.4 data request
d: full thread device
n: full network data
Returns:
True: s... | def __setDeviceMode(self, mode):
"""set thread device mode:
Args:
mode: thread device mode. 15=rsdn, 13=rsn, 4=s
r: rx-on-when-idle
s: secure IEEE 802.15.4 data request
d: full thread device
n: full network data
Returns:
True: s... | [
"set",
"thread",
"device",
"mode",
":"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L363-L383 | [
"def",
"__setDeviceMode",
"(",
"self",
",",
"mode",
")",
":",
"print",
"'call __setDeviceMode'",
"try",
":",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'setprop Thread:DeviceMode %d'",
"%",
"mode",
"return",
"self",
".",
"__sendCommand",
"(",
"cmd",
")",
"[",
"0",
"]",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__setAddressfilterMode | set address filter mode
Returns:
True: successful to set address filter mode.
False: fail to set address filter mode. | tools/harness-thci/OpenThread_WpanCtl.py | def __setAddressfilterMode(self, mode):
"""set address filter mode
Returns:
True: successful to set address filter mode.
False: fail to set address filter mode.
"""
print 'call setAddressFilterMode() ' + mode
try:
if re.match('list', mode, re... | def __setAddressfilterMode(self, mode):
"""set address filter mode
Returns:
True: successful to set address filter mode.
False: fail to set address filter mode.
"""
print 'call setAddressFilterMode() ' + mode
try:
if re.match('list', mode, re... | [
"set",
"address",
"filter",
"mode"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L439-L459 | [
"def",
"__setAddressfilterMode",
"(",
"self",
",",
"mode",
")",
":",
"print",
"'call setAddressFilterMode() '",
"+",
"mode",
"try",
":",
"if",
"re",
".",
"match",
"(",
"'list'",
",",
"mode",
",",
"re",
".",
"M",
"|",
"re",
".",
"I",
")",
":",
"cmd",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__startOpenThreadWpan | start OpenThreadWpan
Returns:
True: successful to start OpenThreadWpan up
False: fail to start OpenThreadWpan | tools/harness-thci/OpenThread_WpanCtl.py | def __startOpenThreadWpan(self):
"""start OpenThreadWpan
Returns:
True: successful to start OpenThreadWpan up
False: fail to start OpenThreadWpan
"""
print 'call startOpenThreadWpan'
try:
# restore whitelist/blacklist address filter mode if r... | def __startOpenThreadWpan(self):
"""start OpenThreadWpan
Returns:
True: successful to start OpenThreadWpan up
False: fail to start OpenThreadWpan
"""
print 'call startOpenThreadWpan'
try:
# restore whitelist/blacklist address filter mode if r... | [
"start",
"OpenThreadWpan"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L461-L524 | [
"def",
"__startOpenThreadWpan",
"(",
"self",
")",
":",
"print",
"'call startOpenThreadWpan'",
"try",
":",
"# restore whitelist/blacklist address filter mode if rejoin after reset",
"if",
"self",
".",
"isPowerDown",
":",
"if",
"self",
".",
"_addressfilterMode",
"==",
"'white... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__stopOpenThreadWpan | stop OpenThreadWpan
Returns:
True: successfully stop OpenThreadWpan
False: failed to stop OpenThreadWpan | tools/harness-thci/OpenThread_WpanCtl.py | def __stopOpenThreadWpan(self):
"""stop OpenThreadWpan
Returns:
True: successfully stop OpenThreadWpan
False: failed to stop OpenThreadWpan
"""
print 'call stopOpenThreadWpan'
try:
if self.__sendCommand(WPANCTL_CMD + 'leave')[0] != 'Fail' and ... | def __stopOpenThreadWpan(self):
"""stop OpenThreadWpan
Returns:
True: successfully stop OpenThreadWpan
False: failed to stop OpenThreadWpan
"""
print 'call stopOpenThreadWpan'
try:
if self.__sendCommand(WPANCTL_CMD + 'leave')[0] != 'Fail' and ... | [
"stop",
"OpenThreadWpan"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L526-L540 | [
"def",
"__stopOpenThreadWpan",
"(",
"self",
")",
":",
"print",
"'call stopOpenThreadWpan'",
"try",
":",
"if",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'leave'",
")",
"[",
"0",
"]",
"!=",
"'Fail'",
"and",
"self",
".",
"__sendCommand",
"(",
"WPA... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__isOpenThreadWpanRunning | check whether or not OpenThreadWpan is running
Returns:
True: OpenThreadWpan is running
False: OpenThreadWpan is not running | tools/harness-thci/OpenThread_WpanCtl.py | def __isOpenThreadWpanRunning(self):
"""check whether or not OpenThreadWpan is running
Returns:
True: OpenThreadWpan is running
False: OpenThreadWpan is not running
"""
print 'call __isOpenThreadWpanRunning'
if self.__stripValue(self.__sendCommand(WPANCTL... | def __isOpenThreadWpanRunning(self):
"""check whether or not OpenThreadWpan is running
Returns:
True: OpenThreadWpan is running
False: OpenThreadWpan is not running
"""
print 'call __isOpenThreadWpanRunning'
if self.__stripValue(self.__sendCommand(WPANCTL... | [
"check",
"whether",
"or",
"not",
"OpenThreadWpan",
"is",
"running"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L542-L555 | [
"def",
"__isOpenThreadWpanRunning",
"(",
"self",
")",
":",
"print",
"'call __isOpenThreadWpanRunning'",
"if",
"self",
".",
"__stripValue",
"(",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v NCP:State'",
")",
"[",
"0",
"]",
")",
"==",
"'associ... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__convertRlocToRouterId | mapping Rloc16 to router id
Args:
xRloc16: hex rloc16 short address
Returns:
actual router id allocated by leader | tools/harness-thci/OpenThread_WpanCtl.py | def __convertRlocToRouterId(self, xRloc16):
"""mapping Rloc16 to router id
Args:
xRloc16: hex rloc16 short address
Returns:
actual router id allocated by leader
"""
routerList = []
routerList = self.__sendCommand(WPANCTL_CMD + 'getprop -v Thread:... | def __convertRlocToRouterId(self, xRloc16):
"""mapping Rloc16 to router id
Args:
xRloc16: hex rloc16 short address
Returns:
actual router id allocated by leader
"""
routerList = []
routerList = self.__sendCommand(WPANCTL_CMD + 'getprop -v Thread:... | [
"mapping",
"Rloc16",
"to",
"router",
"id"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L558-L599 | [
"def",
"__convertRlocToRouterId",
"(",
"self",
",",
"xRloc16",
")",
":",
"routerList",
"=",
"[",
"]",
"routerList",
"=",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v Thread:RouterTable'",
")",
"print",
"routerList",
"print",
"xRloc16",
"for"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__ChannelMaskListToStr | convert a channel list to a string
Args:
channelList: channel list (i.e. [21, 22, 23])
Returns:
a comma separated channel string (i.e. '21, 22, 23') | tools/harness-thci/OpenThread_WpanCtl.py | def __ChannelMaskListToStr(self, channelList):
"""convert a channel list to a string
Args:
channelList: channel list (i.e. [21, 22, 23])
Returns:
a comma separated channel string (i.e. '21, 22, 23')
"""
chan_mask_range = ''
if isinstance(channelL... | def __ChannelMaskListToStr(self, channelList):
"""convert a channel list to a string
Args:
channelList: channel list (i.e. [21, 22, 23])
Returns:
a comma separated channel string (i.e. '21, 22, 23')
"""
chan_mask_range = ''
if isinstance(channelL... | [
"convert",
"a",
"channel",
"list",
"to",
"a",
"string"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L656-L674 | [
"def",
"__ChannelMaskListToStr",
"(",
"self",
",",
"channelList",
")",
":",
"chan_mask_range",
"=",
"''",
"if",
"isinstance",
"(",
"channelList",
",",
"list",
")",
":",
"if",
"len",
"(",
"channelList",
")",
":",
"chan_mask_range",
"=",
"\",\"",
".",
"join",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.__getJoinerState | get joiner state | tools/harness-thci/OpenThread_WpanCtl.py | def __getJoinerState(self):
""" get joiner state """
maxDuration = 150 # seconds
t_end = time.time() + maxDuration
while time.time() < t_end:
joinerState = self.__stripValue(self.__sendCommand('sudo wpanctl getprop -v NCP:State')[0])
if joinerState == 'offline:co... | def __getJoinerState(self):
""" get joiner state """
maxDuration = 150 # seconds
t_end = time.time() + maxDuration
while time.time() < t_end:
joinerState = self.__stripValue(self.__sendCommand('sudo wpanctl getprop -v NCP:State')[0])
if joinerState == 'offline:co... | [
"get",
"joiner",
"state"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L727-L740 | [
"def",
"__getJoinerState",
"(",
"self",
")",
":",
"maxDuration",
"=",
"150",
"# seconds",
"t_end",
"=",
"time",
".",
"time",
"(",
")",
"+",
"maxDuration",
"while",
"time",
".",
"time",
"(",
")",
"<",
"t_end",
":",
"joinerState",
"=",
"self",
".",
"__st... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.intialize | initialize the serial port with baudrate, timeout parameters | tools/harness-thci/OpenThread_WpanCtl.py | def intialize(self):
"""initialize the serial port with baudrate, timeout parameters"""
print '%s call intialize' % self.port
try:
# init serial port
self.deviceConnected = False
self._connect()
if self.deviceConnected:
self.UIStat... | def intialize(self):
"""initialize the serial port with baudrate, timeout parameters"""
print '%s call intialize' % self.port
try:
# init serial port
self.deviceConnected = False
self._connect()
if self.deviceConnected:
self.UIStat... | [
"initialize",
"the",
"serial",
"port",
"with",
"baudrate",
"timeout",
"parameters"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L820-L840 | [
"def",
"intialize",
"(",
"self",
")",
":",
"print",
"'%s call intialize'",
"%",
"self",
".",
"port",
"try",
":",
"# init serial port",
"self",
".",
"deviceConnected",
"=",
"False",
"self",
".",
"_connect",
"(",
")",
"if",
"self",
".",
"deviceConnected",
":",... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getNetworkName | get Thread Network name | tools/harness-thci/OpenThread_WpanCtl.py | def getNetworkName(self):
"""get Thread Network name"""
print '%s call getNetworkname' % self.port
networkName = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:Name')[0]
return self.__stripValue(networkName) | def getNetworkName(self):
"""get Thread Network name"""
print '%s call getNetworkname' % self.port
networkName = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:Name')[0]
return self.__stripValue(networkName) | [
"get",
"Thread",
"Network",
"name"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L862-L866 | [
"def",
"getNetworkName",
"(",
"self",
")",
":",
"print",
"'%s call getNetworkname'",
"%",
"self",
".",
"port",
"networkName",
"=",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v Network:Name'",
")",
"[",
"0",
"]",
"return",
"self",
".",
"_... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setMAC | set the extended addresss of Thread device
Args:
xEUI: extended address in hex format
Returns:
True: successful to set the extended address
False: fail to set the extended address | tools/harness-thci/OpenThread_WpanCtl.py | def setMAC(self, xEUI):
"""set the extended addresss of Thread device
Args:
xEUI: extended address in hex format
Returns:
True: successful to set the extended address
False: fail to set the extended address
"""
print '%s call setMAC' % self.p... | def setMAC(self, xEUI):
"""set the extended addresss of Thread device
Args:
xEUI: extended address in hex format
Returns:
True: successful to set the extended address
False: fail to set the extended address
"""
print '%s call setMAC' % self.p... | [
"set",
"the",
"extended",
"addresss",
"of",
"Thread",
"device"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L896-L931 | [
"def",
"setMAC",
"(",
"self",
",",
"xEUI",
")",
":",
"print",
"'%s call setMAC'",
"%",
"self",
".",
"port",
"address64",
"=",
"''",
"try",
":",
"if",
"not",
"xEUI",
":",
"address64",
"=",
"self",
".",
"mac",
"if",
"not",
"isinstance",
"(",
"xEUI",
",... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getMAC | get one specific type of MAC address
currently OpenThreadWpan only supports Random MAC address
Args:
bType: indicate which kind of MAC address is required
Returns:
specific type of MAC address | tools/harness-thci/OpenThread_WpanCtl.py | def getMAC(self, bType=MacType.RandomMac):
"""get one specific type of MAC address
currently OpenThreadWpan only supports Random MAC address
Args:
bType: indicate which kind of MAC address is required
Returns:
specific type of MAC address
"""
... | def getMAC(self, bType=MacType.RandomMac):
"""get one specific type of MAC address
currently OpenThreadWpan only supports Random MAC address
Args:
bType: indicate which kind of MAC address is required
Returns:
specific type of MAC address
"""
... | [
"get",
"one",
"specific",
"type",
"of",
"MAC",
"address",
"currently",
"OpenThreadWpan",
"only",
"supports",
"Random",
"MAC",
"address"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L933-L956 | [
"def",
"getMAC",
"(",
"self",
",",
"bType",
"=",
"MacType",
".",
"RandomMac",
")",
":",
"print",
"'%s call getMAC'",
"%",
"self",
".",
"port",
"# if power down happens, return extended address assigned previously",
"if",
"self",
".",
"isPowerDown",
":",
"macAddr64",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getLL64 | get link local unicast IPv6 address | tools/harness-thci/OpenThread_WpanCtl.py | def getLL64(self):
"""get link local unicast IPv6 address"""
print '%s call getLL64' % self.port
return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v IPv6:LinkLocalAddress')[0]) | def getLL64(self):
"""get link local unicast IPv6 address"""
print '%s call getLL64' % self.port
return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v IPv6:LinkLocalAddress')[0]) | [
"get",
"link",
"local",
"unicast",
"IPv6",
"address"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L958-L961 | [
"def",
"getLL64",
"(",
"self",
")",
":",
"print",
"'%s call getLL64'",
"%",
"self",
".",
"port",
"return",
"self",
".",
"__stripValue",
"(",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v IPv6:LinkLocalAddress'",
")",
"[",
"0",
"]",
")"
] | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getRloc | get router locator unicast IPv6 address | tools/harness-thci/OpenThread_WpanCtl.py | def getRloc(self):
"""get router locator unicast IPv6 address"""
print '%s call getRloc' % self.port
prefix = self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v IPv6:MeshLocalPrefix')[0])
mlprefix = prefix.split('/')[0]
rloc16 = self.__sendCommand(WPANCTL_CMD + 'getpr... | def getRloc(self):
"""get router locator unicast IPv6 address"""
print '%s call getRloc' % self.port
prefix = self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v IPv6:MeshLocalPrefix')[0])
mlprefix = prefix.split('/')[0]
rloc16 = self.__sendCommand(WPANCTL_CMD + 'getpr... | [
"get",
"router",
"locator",
"unicast",
"IPv6",
"address"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L974-L986 | [
"def",
"getRloc",
"(",
"self",
")",
":",
"print",
"'%s call getRloc'",
"%",
"self",
".",
"port",
"prefix",
"=",
"self",
".",
"__stripValue",
"(",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v IPv6:MeshLocalPrefix'",
")",
"[",
"0",
"]",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setNetworkKey | set Thread Network master key
Args:
key: Thread Network master key used in secure the MLE/802.15.4 packet
Returns:
True: successful to set the Thread Network master key
False: fail to set the Thread Network master key | tools/harness-thci/OpenThread_WpanCtl.py | def setNetworkKey(self, key):
"""set Thread Network master key
Args:
key: Thread Network master key used in secure the MLE/802.15.4 packet
Returns:
True: successful to set the Thread Network master key
False: fail to set the Thread Network master key
... | def setNetworkKey(self, key):
"""set Thread Network master key
Args:
key: Thread Network master key used in secure the MLE/802.15.4 packet
Returns:
True: successful to set the Thread Network master key
False: fail to set the Thread Network master key
... | [
"set",
"Thread",
"Network",
"master",
"key"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L995-L1027 | [
"def",
"setNetworkKey",
"(",
"self",
",",
"key",
")",
":",
"masterKey",
"=",
"''",
"print",
"'%s call setNetworkKey'",
"%",
"self",
".",
"port",
"try",
":",
"if",
"not",
"isinstance",
"(",
"key",
",",
"str",
")",
":",
"masterKey",
"=",
"self",
".",
"__... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.addAllowMAC | add a given extended address to the whitelist addressfilter
Args:
xEUI: a given extended address in hex format
Returns:
True: successful to add a given extended address to the whitelist entry
False: fail to add a given extended address to the whitelist entry | tools/harness-thci/OpenThread_WpanCtl.py | def addAllowMAC(self, xEUI):
"""add a given extended address to the whitelist addressfilter
Args:
xEUI: a given extended address in hex format
Returns:
True: successful to add a given extended address to the whitelist entry
False: fail to add a given extende... | def addAllowMAC(self, xEUI):
"""add a given extended address to the whitelist addressfilter
Args:
xEUI: a given extended address in hex format
Returns:
True: successful to add a given extended address to the whitelist entry
False: fail to add a given extende... | [
"add",
"a",
"given",
"extended",
"address",
"to",
"the",
"whitelist",
"addressfilter"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1073-L1105 | [
"def",
"addAllowMAC",
"(",
"self",
",",
"xEUI",
")",
":",
"print",
"'%s call addAllowMAC'",
"%",
"self",
".",
"port",
"print",
"xEUI",
"if",
"isinstance",
"(",
"xEUI",
",",
"str",
")",
":",
"macAddr",
"=",
"xEUI",
"else",
":",
"macAddr",
"=",
"self",
"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.clearAllowList | clear all entries in whitelist table
Returns:
True: successful to clear the whitelist
False: fail to clear the whitelist | tools/harness-thci/OpenThread_WpanCtl.py | def clearAllowList(self):
"""clear all entries in whitelist table
Returns:
True: successful to clear the whitelist
False: fail to clear the whitelist
"""
print '%s call clearAllowList' % self.port
# remove all entries in whitelist
try:
... | def clearAllowList(self):
"""clear all entries in whitelist table
Returns:
True: successful to clear the whitelist
False: fail to clear the whitelist
"""
print '%s call clearAllowList' % self.port
# remove all entries in whitelist
try:
... | [
"clear",
"all",
"entries",
"in",
"whitelist",
"table"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1134-L1159 | [
"def",
"clearAllowList",
"(",
"self",
")",
":",
"print",
"'%s call clearAllowList'",
"%",
"self",
".",
"port",
"# remove all entries in whitelist",
"try",
":",
"print",
"'clearing whitelist entries:'",
"for",
"addr",
"in",
"self",
".",
"_addressfilterSet",
":",
"print... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getDeviceRole | get current device role in Thread Network | tools/harness-thci/OpenThread_WpanCtl.py | def getDeviceRole(self):
"""get current device role in Thread Network"""
print '%s call getDeviceRole' % self.port
return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0]) | def getDeviceRole(self):
"""get current device role in Thread Network"""
print '%s call getDeviceRole' % self.port
return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0]) | [
"get",
"current",
"device",
"role",
"in",
"Thread",
"Network"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1161-L1164 | [
"def",
"getDeviceRole",
"(",
"self",
")",
":",
"print",
"'%s call getDeviceRole'",
"%",
"self",
".",
"port",
"return",
"self",
".",
"__stripValue",
"(",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v Network:NodeType'",
")",
"[",
"0",
"]",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.joinNetwork | make device ready to join the Thread Network with a given role
Args:
eRoleId: a given device role id
Returns:
True: ready to set Thread Network parameter for joining desired Network | tools/harness-thci/OpenThread_WpanCtl.py | def joinNetwork(self, eRoleId):
"""make device ready to join the Thread Network with a given role
Args:
eRoleId: a given device role id
Returns:
True: ready to set Thread Network parameter for joining desired Network
"""
print '%s call joinNetwork' % sel... | def joinNetwork(self, eRoleId):
"""make device ready to join the Thread Network with a given role
Args:
eRoleId: a given device role id
Returns:
True: ready to set Thread Network parameter for joining desired Network
"""
print '%s call joinNetwork' % sel... | [
"make",
"device",
"ready",
"to",
"join",
"the",
"Thread",
"Network",
"with",
"a",
"given",
"role"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1166-L1238 | [
"def",
"joinNetwork",
"(",
"self",
",",
"eRoleId",
")",
":",
"print",
"'%s call joinNetwork'",
"%",
"self",
".",
"port",
"print",
"eRoleId",
"self",
".",
"deviceRole",
"=",
"eRoleId",
"mode",
"=",
"15",
"try",
":",
"if",
"ModuleHelper",
".",
"LeaderDutChanne... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getNetworkFragmentID | get current partition id of Thread Network Partition from LeaderData
Returns:
The Thread network Partition Id | tools/harness-thci/OpenThread_WpanCtl.py | def getNetworkFragmentID(self):
"""get current partition id of Thread Network Partition from LeaderData
Returns:
The Thread network Partition Id
"""
print '%s call getNetworkFragmentID' % self.port
if not self.____isOpenThreadWpanRunning():
print 'OpenThr... | def getNetworkFragmentID(self):
"""get current partition id of Thread Network Partition from LeaderData
Returns:
The Thread network Partition Id
"""
print '%s call getNetworkFragmentID' % self.port
if not self.____isOpenThreadWpanRunning():
print 'OpenThr... | [
"get",
"current",
"partition",
"id",
"of",
"Thread",
"Network",
"Partition",
"from",
"LeaderData"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1240-L1251 | [
"def",
"getNetworkFragmentID",
"(",
"self",
")",
":",
"print",
"'%s call getNetworkFragmentID'",
"%",
"self",
".",
"port",
"if",
"not",
"self",
".",
"____isOpenThreadWpanRunning",
"(",
")",
":",
"print",
"'OpenThreadWpan is not running'",
"return",
"None",
"return",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getParentAddress | get Thread device's parent extended address and rloc16 short address
Returns:
The extended address of parent in hex format | tools/harness-thci/OpenThread_WpanCtl.py | def getParentAddress(self):
"""get Thread device's parent extended address and rloc16 short address
Returns:
The extended address of parent in hex format
"""
print '%s call getParentAddress' % self.port
parentInfo = []
parentInfo = self.__stripValue(self.__se... | def getParentAddress(self):
"""get Thread device's parent extended address and rloc16 short address
Returns:
The extended address of parent in hex format
"""
print '%s call getParentAddress' % self.port
parentInfo = []
parentInfo = self.__stripValue(self.__se... | [
"get",
"Thread",
"device",
"s",
"parent",
"extended",
"address",
"and",
"rloc16",
"short",
"address"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1253-L1263 | [
"def",
"getParentAddress",
"(",
"self",
")",
":",
"print",
"'%s call getParentAddress'",
"%",
"self",
".",
"port",
"parentInfo",
"=",
"[",
"]",
"parentInfo",
"=",
"self",
".",
"__stripValue",
"(",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getpor... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.powerDown | power down the OpenThreadWpan | tools/harness-thci/OpenThread_WpanCtl.py | def powerDown(self):
"""power down the OpenThreadWpan"""
print '%s call powerDown' % self.port
if self.__sendCommand(WPANCTL_CMD + 'setprop Daemon:AutoAssociateAfterReset false')[0] != 'Fail':
time.sleep(0.5)
if self.__sendCommand(WPANCTL_CMD + 'reset')[0] != 'Fail':
... | def powerDown(self):
"""power down the OpenThreadWpan"""
print '%s call powerDown' % self.port
if self.__sendCommand(WPANCTL_CMD + 'setprop Daemon:AutoAssociateAfterReset false')[0] != 'Fail':
time.sleep(0.5)
if self.__sendCommand(WPANCTL_CMD + 'reset')[0] != 'Fail':
... | [
"power",
"down",
"the",
"OpenThreadWpan"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1265-L1276 | [
"def",
"powerDown",
"(",
"self",
")",
":",
"print",
"'%s call powerDown'",
"%",
"self",
".",
"port",
"if",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'setprop Daemon:AutoAssociateAfterReset false'",
")",
"[",
"0",
"]",
"!=",
"'Fail'",
":",
"time",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.powerUp | power up the Thread device | tools/harness-thci/OpenThread_WpanCtl.py | def powerUp(self):
"""power up the Thread device"""
print '%s call powerUp' % self.port
if not self.handle:
self._connect()
self.isPowerDown = False
if self.__sendCommand(WPANCTL_CMD + 'attach')[0] != 'Fail':
time.sleep(3)
else:
return... | def powerUp(self):
"""power up the Thread device"""
print '%s call powerUp' % self.port
if not self.handle:
self._connect()
self.isPowerDown = False
if self.__sendCommand(WPANCTL_CMD + 'attach')[0] != 'Fail':
time.sleep(3)
else:
return... | [
"power",
"up",
"the",
"Thread",
"device"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1278-L1297 | [
"def",
"powerUp",
"(",
"self",
")",
":",
"print",
"'%s call powerUp'",
"%",
"self",
".",
"port",
"if",
"not",
"self",
".",
"handle",
":",
"self",
".",
"_connect",
"(",
")",
"self",
".",
"isPowerDown",
"=",
"False",
"if",
"self",
".",
"__sendCommand",
"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.reboot | reset and rejoin to Thread Network without any timeout
Returns:
True: successful to reset and rejoin the Thread Network
False: fail to reset and rejoin the Thread Network | tools/harness-thci/OpenThread_WpanCtl.py | def reboot(self):
"""reset and rejoin to Thread Network without any timeout
Returns:
True: successful to reset and rejoin the Thread Network
False: fail to reset and rejoin the Thread Network
"""
print '%s call reboot' % self.port
try:
self._s... | def reboot(self):
"""reset and rejoin to Thread Network without any timeout
Returns:
True: successful to reset and rejoin the Thread Network
False: fail to reset and rejoin the Thread Network
"""
print '%s call reboot' % self.port
try:
self._s... | [
"reset",
"and",
"rejoin",
"to",
"Thread",
"Network",
"without",
"any",
"timeout"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1299-L1318 | [
"def",
"reboot",
"(",
"self",
")",
":",
"print",
"'%s call reboot'",
"%",
"self",
".",
"port",
"try",
":",
"self",
".",
"_sendline",
"(",
"WPANCTL_CMD",
"+",
"'reset'",
")",
"self",
".",
"isPowerDown",
"=",
"True",
"if",
"self",
".",
"__sendCommand",
"("... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.ping | send ICMPv6 echo request with a given length to a unicast destination
address
Args:
destination: the unicast destination address of ICMPv6 echo request
length: the size of ICMPv6 echo request payload | tools/harness-thci/OpenThread_WpanCtl.py | def ping(self, destination, length=20):
""" send ICMPv6 echo request with a given length to a unicast destination
address
Args:
destination: the unicast destination address of ICMPv6 echo request
length: the size of ICMPv6 echo request payload
"""
pri... | def ping(self, destination, length=20):
""" send ICMPv6 echo request with a given length to a unicast destination
address
Args:
destination: the unicast destination address of ICMPv6 echo request
length: the size of ICMPv6 echo request payload
"""
pri... | [
"send",
"ICMPv6",
"echo",
"request",
"with",
"a",
"given",
"length",
"to",
"a",
"unicast",
"destination",
"address"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1320-L1340 | [
"def",
"ping",
"(",
"self",
",",
"destination",
",",
"length",
"=",
"20",
")",
":",
"print",
"'%s call ping'",
"%",
"self",
".",
"port",
"print",
"'destination: %s'",
"%",
"destination",
"try",
":",
"cmd",
"=",
"'ping %s -c 1 -s %s -I %s'",
"%",
"(",
"destin... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getVersionNumber | get OpenThreadWpan stack firmware version number | tools/harness-thci/OpenThread_WpanCtl.py | def getVersionNumber(self):
"""get OpenThreadWpan stack firmware version number"""
print '%s call getVersionNumber' % self.port
versionStr = self.__sendCommand(WPANCTL_CMD + 'getprop -v NCP:Version')[0]
return self.__stripValue(versionStr) | def getVersionNumber(self):
"""get OpenThreadWpan stack firmware version number"""
print '%s call getVersionNumber' % self.port
versionStr = self.__sendCommand(WPANCTL_CMD + 'getprop -v NCP:Version')[0]
return self.__stripValue(versionStr) | [
"get",
"OpenThreadWpan",
"stack",
"firmware",
"version",
"number"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1364-L1369 | [
"def",
"getVersionNumber",
"(",
"self",
")",
":",
"print",
"'%s call getVersionNumber'",
"%",
"self",
".",
"port",
"versionStr",
"=",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v NCP:Version'",
")",
"[",
"0",
"]",
"return",
"self",
".",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setPANID | set Thread Network PAN ID
Args:
xPAN: a given PAN ID in hex format
Returns:
True: successful to set the Thread Network PAN ID
False: fail to set the Thread Network PAN ID | tools/harness-thci/OpenThread_WpanCtl.py | def setPANID(self, xPAN):
"""set Thread Network PAN ID
Args:
xPAN: a given PAN ID in hex format
Returns:
True: successful to set the Thread Network PAN ID
False: fail to set the Thread Network PAN ID
"""
print '%s call setPANID' % self.port
... | def setPANID(self, xPAN):
"""set Thread Network PAN ID
Args:
xPAN: a given PAN ID in hex format
Returns:
True: successful to set the Thread Network PAN ID
False: fail to set the Thread Network PAN ID
"""
print '%s call setPANID' % self.port
... | [
"set",
"Thread",
"Network",
"PAN",
"ID"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1371-L1394 | [
"def",
"setPANID",
"(",
"self",
",",
"xPAN",
")",
":",
"print",
"'%s call setPANID'",
"%",
"self",
".",
"port",
"print",
"xPAN",
"panid",
"=",
"''",
"try",
":",
"if",
"not",
"isinstance",
"(",
"xPAN",
",",
"str",
")",
":",
"panid",
"=",
"str",
"(",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.reset | factory reset | tools/harness-thci/OpenThread_WpanCtl.py | def reset(self):
"""factory reset"""
print '%s call reset' % self.port
try:
if self._is_net:
self.__sendCommand(WPANCTL_CMD + 'leave')
else:
self._sendline(WPANCTL_CMD + 'leave')
self.__sendCommand(WPANCTL_CMD + 'dataset erase'... | def reset(self):
"""factory reset"""
print '%s call reset' % self.port
try:
if self._is_net:
self.__sendCommand(WPANCTL_CMD + 'leave')
else:
self._sendline(WPANCTL_CMD + 'leave')
self.__sendCommand(WPANCTL_CMD + 'dataset erase'... | [
"factory",
"reset"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1401-L1415 | [
"def",
"reset",
"(",
"self",
")",
":",
"print",
"'%s call reset'",
"%",
"self",
".",
"port",
"try",
":",
"if",
"self",
".",
"_is_net",
":",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'leave'",
")",
"else",
":",
"self",
".",
"_sendline",
"(... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.removeRouter | kick router with a given router id from the Thread Network
Args:
xRouterId: a given router id in hex format
Returns:
True: successful to remove the router from the Thread Network
False: fail to remove the router from the Thread Network | tools/harness-thci/OpenThread_WpanCtl.py | def removeRouter(self, xRouterId):
"""kick router with a given router id from the Thread Network
Args:
xRouterId: a given router id in hex format
Returns:
True: successful to remove the router from the Thread Network
False: fail to remove the router from the... | def removeRouter(self, xRouterId):
"""kick router with a given router id from the Thread Network
Args:
xRouterId: a given router id in hex format
Returns:
True: successful to remove the router from the Thread Network
False: fail to remove the router from the... | [
"kick",
"router",
"with",
"a",
"given",
"router",
"id",
"from",
"the",
"Thread",
"Network"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1417-L1441 | [
"def",
"removeRouter",
"(",
"self",
",",
"xRouterId",
")",
":",
"print",
"'%s call removeRouter'",
"%",
"self",
".",
"port",
"print",
"xRouterId",
"routerId",
"=",
"''",
"routerId",
"=",
"self",
".",
"__convertRlocToRouterId",
"(",
"xRouterId",
")",
"print",
"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setDefaultValues | set default mandatory Thread Network parameter value | tools/harness-thci/OpenThread_WpanCtl.py | def setDefaultValues(self):
"""set default mandatory Thread Network parameter value"""
print '%s call setDefaultValues' % self.port
# initialize variables
self.networkName = ModuleHelper.Default_NwkName
self.networkKey = ModuleHelper.Default_NwkKey
self.channel = ModuleH... | def setDefaultValues(self):
"""set default mandatory Thread Network parameter value"""
print '%s call setDefaultValues' % self.port
# initialize variables
self.networkName = ModuleHelper.Default_NwkName
self.networkKey = ModuleHelper.Default_NwkKey
self.channel = ModuleH... | [
"set",
"default",
"mandatory",
"Thread",
"Network",
"parameter",
"value"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1443-L1487 | [
"def",
"setDefaultValues",
"(",
"self",
")",
":",
"print",
"'%s call setDefaultValues'",
"%",
"self",
".",
"port",
"# initialize variables",
"self",
".",
"networkName",
"=",
"ModuleHelper",
".",
"Default_NwkName",
"self",
".",
"networkKey",
"=",
"ModuleHelper",
".",... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setPollingRate | set data polling rate for sleepy end device
Args:
iPollingRate: data poll period of sleepy end device
Returns:
True: successful to set the data polling rate for sleepy end device
False: fail to set the data polling rate for sleepy end device | tools/harness-thci/OpenThread_WpanCtl.py | def setPollingRate(self, iPollingRate):
"""set data polling rate for sleepy end device
Args:
iPollingRate: data poll period of sleepy end device
Returns:
True: successful to set the data polling rate for sleepy end device
False: fail to set the data polling ... | def setPollingRate(self, iPollingRate):
"""set data polling rate for sleepy end device
Args:
iPollingRate: data poll period of sleepy end device
Returns:
True: successful to set the data polling rate for sleepy end device
False: fail to set the data polling ... | [
"set",
"data",
"polling",
"rate",
"for",
"sleepy",
"end",
"device"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1499-L1516 | [
"def",
"setPollingRate",
"(",
"self",
",",
"iPollingRate",
")",
":",
"print",
"'%s call setPollingRate'",
"%",
"self",
".",
"port",
"print",
"iPollingRate",
"try",
":",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'setprop NCP:SleepyPollInterval %s'",
"%",
"str",
"(",
"iPolli... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.resetAndRejoin | reset and join back Thread Network with a given timeout delay
Args:
timeout: a timeout interval before rejoin Thread Network
Returns:
True: successful to reset and rejoin Thread Network
False: fail to reset and rejoin the Thread Network | tools/harness-thci/OpenThread_WpanCtl.py | def resetAndRejoin(self, timeout):
"""reset and join back Thread Network with a given timeout delay
Args:
timeout: a timeout interval before rejoin Thread Network
Returns:
True: successful to reset and rejoin Thread Network
False: fail to reset and rejoin th... | def resetAndRejoin(self, timeout):
"""reset and join back Thread Network with a given timeout delay
Args:
timeout: a timeout interval before rejoin Thread Network
Returns:
True: successful to reset and rejoin Thread Network
False: fail to reset and rejoin th... | [
"reset",
"and",
"join",
"back",
"Thread",
"Network",
"with",
"a",
"given",
"timeout",
"delay"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1571-L1610 | [
"def",
"resetAndRejoin",
"(",
"self",
",",
"timeout",
")",
":",
"print",
"'%s call resetAndRejoin'",
"%",
"self",
".",
"port",
"print",
"timeout",
"try",
":",
"if",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'setprop Daemon:AutoAssociateAfterReset false... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.configBorderRouter | configure the border router with a given prefix entry parameters
Args:
P_Prefix: IPv6 prefix that is available on the Thread Network
P_stable: is true if the default router is expected to be stable network data
P_default: is true if border router offers the default route for... | tools/harness-thci/OpenThread_WpanCtl.py | def configBorderRouter(self, P_Prefix, P_stable=1, P_default=1, P_slaac_preferred=0, P_Dhcp=0, P_preference=0, P_on_mesh=1, P_nd_dns=0):
"""configure the border router with a given prefix entry parameters
Args:
P_Prefix: IPv6 prefix that is available on the Thread Network
P_stab... | def configBorderRouter(self, P_Prefix, P_stable=1, P_default=1, P_slaac_preferred=0, P_Dhcp=0, P_preference=0, P_on_mesh=1, P_nd_dns=0):
"""configure the border router with a given prefix entry parameters
Args:
P_Prefix: IPv6 prefix that is available on the Thread Network
P_stab... | [
"configure",
"the",
"border",
"router",
"with",
"a",
"given",
"prefix",
"entry",
"parameters"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1612-L1658 | [
"def",
"configBorderRouter",
"(",
"self",
",",
"P_Prefix",
",",
"P_stable",
"=",
"1",
",",
"P_default",
"=",
"1",
",",
"P_slaac_preferred",
"=",
"0",
",",
"P_Dhcp",
"=",
"0",
",",
"P_preference",
"=",
"0",
",",
"P_on_mesh",
"=",
"1",
",",
"P_nd_dns",
"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setKeepAliveTimeOut | set keep alive timeout for device
has been deprecated and also set SED polling rate
Args:
iTimeOut: data poll period for sleepy end device
Returns:
True: successful to set the data poll period for SED
False: fail to set the data poll period for SED | tools/harness-thci/OpenThread_WpanCtl.py | def setKeepAliveTimeOut(self, iTimeOut):
"""set keep alive timeout for device
has been deprecated and also set SED polling rate
Args:
iTimeOut: data poll period for sleepy end device
Returns:
True: successful to set the data poll period for SED
Fa... | def setKeepAliveTimeOut(self, iTimeOut):
"""set keep alive timeout for device
has been deprecated and also set SED polling rate
Args:
iTimeOut: data poll period for sleepy end device
Returns:
True: successful to set the data poll period for SED
Fa... | [
"set",
"keep",
"alive",
"timeout",
"for",
"device",
"has",
"been",
"deprecated",
"and",
"also",
"set",
"SED",
"polling",
"rate"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1674-L1692 | [
"def",
"setKeepAliveTimeOut",
"(",
"self",
",",
"iTimeOut",
")",
":",
"print",
"'%s call setKeepAliveTimeOut'",
"%",
"self",
".",
"port",
"print",
"iTimeOut",
"try",
":",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'setprop NCP:SleepyPollInterval %s'",
"%",
"str",
"(",
"iTim... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setKeySequenceCounter | set the Key sequence counter corresponding to Thread Network master key
Args:
iKeySequenceValue: key sequence value
Returns:
True: successful to set the key sequence
False: fail to set the key sequence | tools/harness-thci/OpenThread_WpanCtl.py | def setKeySequenceCounter(self, iKeySequenceValue):
""" set the Key sequence counter corresponding to Thread Network master key
Args:
iKeySequenceValue: key sequence value
Returns:
True: successful to set the key sequence
False: fail to set the key sequence
... | def setKeySequenceCounter(self, iKeySequenceValue):
""" set the Key sequence counter corresponding to Thread Network master key
Args:
iKeySequenceValue: key sequence value
Returns:
True: successful to set the key sequence
False: fail to set the key sequence
... | [
"set",
"the",
"Key",
"sequence",
"counter",
"corresponding",
"to",
"Thread",
"Network",
"master",
"key"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1694-L1714 | [
"def",
"setKeySequenceCounter",
"(",
"self",
",",
"iKeySequenceValue",
")",
":",
"print",
"'%s call setKeySequenceCounter'",
"%",
"self",
".",
"port",
"print",
"iKeySequenceValue",
"try",
":",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'setprop Network:KeyIndex %s'",
"%",
"str"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getKeySequenceCounter | get current Thread Network key sequence | tools/harness-thci/OpenThread_WpanCtl.py | def getKeySequenceCounter(self):
"""get current Thread Network key sequence"""
print '%s call getKeySequenceCounter' % self.port
keySequence = ''
keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]
return keySequence | def getKeySequenceCounter(self):
"""get current Thread Network key sequence"""
print '%s call getKeySequenceCounter' % self.port
keySequence = ''
keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]
return keySequence | [
"get",
"current",
"Thread",
"Network",
"key",
"sequence"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1716-L1721 | [
"def",
"getKeySequenceCounter",
"(",
"self",
")",
":",
"print",
"'%s call getKeySequenceCounter'",
"%",
"self",
".",
"port",
"keySequence",
"=",
"''",
"keySequence",
"=",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getprop -v Network:KeyIndex'",
")",
"[... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.incrementKeySequenceCounter | increment the key sequence with a given value
Args:
iIncrementValue: specific increment value to be added
Returns:
True: successful to increment the key sequence with a given value
False: fail to increment the key sequence with a given value | tools/harness-thci/OpenThread_WpanCtl.py | def incrementKeySequenceCounter(self, iIncrementValue=1):
"""increment the key sequence with a given value
Args:
iIncrementValue: specific increment value to be added
Returns:
True: successful to increment the key sequence with a given value
False: fail to i... | def incrementKeySequenceCounter(self, iIncrementValue=1):
"""increment the key sequence with a given value
Args:
iIncrementValue: specific increment value to be added
Returns:
True: successful to increment the key sequence with a given value
False: fail to i... | [
"increment",
"the",
"key",
"sequence",
"with",
"a",
"given",
"value"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1723-L1742 | [
"def",
"incrementKeySequenceCounter",
"(",
"self",
",",
"iIncrementValue",
"=",
"1",
")",
":",
"print",
"'%s call incrementKeySequenceCounter'",
"%",
"self",
".",
"port",
"print",
"iIncrementValue",
"currentKeySeq",
"=",
"''",
"try",
":",
"currentKeySeq",
"=",
"self... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setXpanId | set extended PAN ID of Thread Network
Args:
xPanId: extended PAN ID in hex format
Returns:
True: successful to set the extended PAN ID
False: fail to set the extended PAN ID | tools/harness-thci/OpenThread_WpanCtl.py | def setXpanId(self, xPanId):
"""set extended PAN ID of Thread Network
Args:
xPanId: extended PAN ID in hex format
Returns:
True: successful to set the extended PAN ID
False: fail to set the extended PAN ID
"""
xpanid = ''
print '%s ca... | def setXpanId(self, xPanId):
"""set extended PAN ID of Thread Network
Args:
xPanId: extended PAN ID in hex format
Returns:
True: successful to set the extended PAN ID
False: fail to set the extended PAN ID
"""
xpanid = ''
print '%s ca... | [
"set",
"extended",
"PAN",
"ID",
"of",
"Thread",
"Network"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1814-L1846 | [
"def",
"setXpanId",
"(",
"self",
",",
"xPanId",
")",
":",
"xpanid",
"=",
"''",
"print",
"'%s call setXpanId'",
"%",
"self",
".",
"port",
"print",
"xPanId",
"try",
":",
"if",
"not",
"isinstance",
"(",
"xPanId",
",",
"str",
")",
":",
"xpanid",
"=",
"self... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setPartationId | set Thread Network Partition ID
Args:
partitionId: partition id to be set by leader
Returns:
True: successful to set the Partition ID
False: fail to set the Partition ID | tools/harness-thci/OpenThread_WpanCtl.py | def setPartationId(self, partationId):
"""set Thread Network Partition ID
Args:
partitionId: partition id to be set by leader
Returns:
True: successful to set the Partition ID
False: fail to set the Partition ID
"""
print '%s call setPartatio... | def setPartationId(self, partationId):
"""set Thread Network Partition ID
Args:
partitionId: partition id to be set by leader
Returns:
True: successful to set the Partition ID
False: fail to set the Partition ID
"""
print '%s call setPartatio... | [
"set",
"Thread",
"Network",
"Partition",
"ID"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1879-L1894 | [
"def",
"setPartationId",
"(",
"self",
",",
"partationId",
")",
":",
"print",
"'%s call setPartationId'",
"%",
"self",
".",
"port",
"print",
"partationId",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'setprop Network:PartitionId %s'",
"%",
"(",
"str",
"(",
"hex",
"(",
"part... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getGUA | get expected global unicast IPv6 address of OpenThreadWpan
Args:
filterByPrefix: a given expected global IPv6 prefix to be matched
Returns:
a global IPv6 address | tools/harness-thci/OpenThread_WpanCtl.py | def getGUA(self, filterByPrefix=None):
"""get expected global unicast IPv6 address of OpenThreadWpan
Args:
filterByPrefix: a given expected global IPv6 prefix to be matched
Returns:
a global IPv6 address
"""
print '%s call getGUA' % self.port
pri... | def getGUA(self, filterByPrefix=None):
"""get expected global unicast IPv6 address of OpenThreadWpan
Args:
filterByPrefix: a given expected global IPv6 prefix to be matched
Returns:
a global IPv6 address
"""
print '%s call getGUA' % self.port
pri... | [
"get",
"expected",
"global",
"unicast",
"IPv6",
"address",
"of",
"OpenThreadWpan"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1896-L1924 | [
"def",
"getGUA",
"(",
"self",
",",
"filterByPrefix",
"=",
"None",
")",
":",
"print",
"'%s call getGUA'",
"%",
"self",
".",
"port",
"print",
"filterByPrefix",
"globalAddrs",
"=",
"[",
"]",
"try",
":",
"# get global addrs set if multiple",
"globalAddrs",
"=",
"sel... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.getChildTimeoutValue | get child timeout | tools/harness-thci/OpenThread_WpanCtl.py | def getChildTimeoutValue(self):
"""get child timeout"""
print '%s call getChildTimeoutValue' % self.port
childTimeout = self.__sendCommand(WPANCTL_CMD + 'getporp -v Thread:ChildTimeout')[0]
return int(childTimeout) | def getChildTimeoutValue(self):
"""get child timeout"""
print '%s call getChildTimeoutValue' % self.port
childTimeout = self.__sendCommand(WPANCTL_CMD + 'getporp -v Thread:ChildTimeout')[0]
return int(childTimeout) | [
"get",
"child",
"timeout"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L1970-L1974 | [
"def",
"getChildTimeoutValue",
"(",
"self",
")",
":",
"print",
"'%s call getChildTimeoutValue'",
"%",
"self",
".",
"port",
"childTimeout",
"=",
"self",
".",
"__sendCommand",
"(",
"WPANCTL_CMD",
"+",
"'getporp -v Thread:ChildTimeout'",
")",
"[",
"0",
"]",
"return",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.startCollapsedCommissioner | start Collapsed Commissioner
Returns:
True: successful to start Commissioner
False: fail to start Commissioner | tools/harness-thci/OpenThread_WpanCtl.py | def startCollapsedCommissioner(self):
"""start Collapsed Commissioner
Returns:
True: successful to start Commissioner
False: fail to start Commissioner
"""
print '%s call startCollapsedCommissioner' % self.port
startCmd = WPANCTL_CMD + 'form %s -c %s -T r... | def startCollapsedCommissioner(self):
"""start Collapsed Commissioner
Returns:
True: successful to start Commissioner
False: fail to start Commissioner
"""
print '%s call startCollapsedCommissioner' % self.port
startCmd = WPANCTL_CMD + 'form %s -c %s -T r... | [
"start",
"Collapsed",
"Commissioner"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2000-L2017 | [
"def",
"startCollapsedCommissioner",
"(",
"self",
")",
":",
"print",
"'%s call startCollapsedCommissioner'",
"%",
"self",
".",
"port",
"startCmd",
"=",
"WPANCTL_CMD",
"+",
"'form %s -c %s -T router'",
"%",
"(",
"self",
".",
"networkName",
",",
"str",
"(",
"self",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.scanJoiner | scan Joiner
Args:
xEUI: Joiner's EUI-64
strPSKd: Joiner's PSKd for commissioning
Returns:
True: successful to add Joiner's steering data
False: fail to add Joiner's steering data | tools/harness-thci/OpenThread_WpanCtl.py | def scanJoiner(self, xEUI='*', strPSKd='threadjpaketest'):
"""scan Joiner
Args:
xEUI: Joiner's EUI-64
strPSKd: Joiner's PSKd for commissioning
Returns:
True: successful to add Joiner's steering data
False: fail to add Joiner's steering data
... | def scanJoiner(self, xEUI='*', strPSKd='threadjpaketest'):
"""scan Joiner
Args:
xEUI: Joiner's EUI-64
strPSKd: Joiner's PSKd for commissioning
Returns:
True: successful to add Joiner's steering data
False: fail to add Joiner's steering data
... | [
"scan",
"Joiner"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2022-L2054 | [
"def",
"scanJoiner",
"(",
"self",
",",
"xEUI",
"=",
"'*'",
",",
"strPSKd",
"=",
"'threadjpaketest'",
")",
":",
"print",
"'%s call scanJoiner'",
"%",
"self",
".",
"port",
"if",
"not",
"isinstance",
"(",
"xEUI",
",",
"str",
")",
":",
"eui64",
"=",
"self",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.setProvisioningUrl | set provisioning Url
Args:
strURL: Provisioning Url string
Returns:
True: successful to set provisioning Url
False: fail to set provisioning Url | tools/harness-thci/OpenThread_WpanCtl.py | def setProvisioningUrl(self, strURL='grl.com'):
"""set provisioning Url
Args:
strURL: Provisioning Url string
Returns:
True: successful to set provisioning Url
False: fail to set provisioning Url
"""
print '%s call setProvisioningUrl' % self.... | def setProvisioningUrl(self, strURL='grl.com'):
"""set provisioning Url
Args:
strURL: Provisioning Url string
Returns:
True: successful to set provisioning Url
False: fail to set provisioning Url
"""
print '%s call setProvisioningUrl' % self.... | [
"set",
"provisioning",
"Url"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2056-L2072 | [
"def",
"setProvisioningUrl",
"(",
"self",
",",
"strURL",
"=",
"'grl.com'",
")",
":",
"print",
"'%s call setProvisioningUrl'",
"%",
"self",
".",
"port",
"self",
".",
"provisioningUrl",
"=",
"strURL",
"if",
"self",
".",
"deviceRole",
"==",
"Thread_Device_Role",
".... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.allowCommission | start commissioner candidate petition process
Returns:
True: successful to start commissioner candidate petition process
False: fail to start commissioner candidate petition process | tools/harness-thci/OpenThread_WpanCtl.py | def allowCommission(self):
"""start commissioner candidate petition process
Returns:
True: successful to start commissioner candidate petition process
False: fail to start commissioner candidate petition process
"""
print '%s call allowCommission' % self.port
... | def allowCommission(self):
"""start commissioner candidate petition process
Returns:
True: successful to start commissioner candidate petition process
False: fail to start commissioner candidate petition process
"""
print '%s call allowCommission' % self.port
... | [
"start",
"commissioner",
"candidate",
"petition",
"process"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2074-L2094 | [
"def",
"allowCommission",
"(",
"self",
")",
":",
"print",
"'%s call allowCommission'",
"%",
"self",
".",
"port",
"try",
":",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'commissioner start'",
"print",
"cmd",
"if",
"self",
".",
"isActiveCommissioner",
":",
"return",
"True",... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.joinCommissioned | start joiner
Args:
strPSKd: Joiner's PSKd
Returns:
True: successful to start joiner
False: fail to start joiner | tools/harness-thci/OpenThread_WpanCtl.py | def joinCommissioned(self, strPSKd='threadjpaketest', waitTime=20):
"""start joiner
Args:
strPSKd: Joiner's PSKd
Returns:
True: successful to start joiner
False: fail to start joiner
"""
print '%s call joinCommissioned' % self.port
cm... | def joinCommissioned(self, strPSKd='threadjpaketest', waitTime=20):
"""start joiner
Args:
strPSKd: Joiner's PSKd
Returns:
True: successful to start joiner
False: fail to start joiner
"""
print '%s call joinCommissioned' % self.port
cm... | [
"start",
"joiner"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2096-L2117 | [
"def",
"joinCommissioned",
"(",
"self",
",",
"strPSKd",
"=",
"'threadjpaketest'",
",",
"waitTime",
"=",
"20",
")",
":",
"print",
"'%s call joinCommissioned'",
"%",
"self",
".",
"port",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'joiner --start %s %s'",
"%",
"(",
"strPSKd"... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.MGMT_PANID_QUERY | send MGMT_PANID_QUERY message to a given destination
Args:
xPanId: a given PAN ID to check the conflicts
Returns:
True: successful to send MGMT_PANID_QUERY message.
False: fail to send MGMT_PANID_QUERY message. | tools/harness-thci/OpenThread_WpanCtl.py | def MGMT_PANID_QUERY(self, sAddr, xCommissionerSessionId, listChannelMask, xPanId):
"""send MGMT_PANID_QUERY message to a given destination
Args:
xPanId: a given PAN ID to check the conflicts
Returns:
True: successful to send MGMT_PANID_QUERY message.
False:... | def MGMT_PANID_QUERY(self, sAddr, xCommissionerSessionId, listChannelMask, xPanId):
"""send MGMT_PANID_QUERY message to a given destination
Args:
xPanId: a given PAN ID to check the conflicts
Returns:
True: successful to send MGMT_PANID_QUERY message.
False:... | [
"send",
"MGMT_PANID_QUERY",
"message",
"to",
"a",
"given",
"destination"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2196-L2219 | [
"def",
"MGMT_PANID_QUERY",
"(",
"self",
",",
"sAddr",
",",
"xCommissionerSessionId",
",",
"listChannelMask",
",",
"xPanId",
")",
":",
"print",
"'%s call MGMT_PANID_QUERY'",
"%",
"self",
".",
"port",
"panid",
"=",
"''",
"channelMask",
"=",
"''",
"channelMask",
"=... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.MGMT_ANNOUNCE_BEGIN | send MGMT_ANNOUNCE_BEGIN message to a given destination
Returns:
True: successful to send MGMT_ANNOUNCE_BEGIN message.
False: fail to send MGMT_ANNOUNCE_BEGIN message. | tools/harness-thci/OpenThread_WpanCtl.py | def MGMT_ANNOUNCE_BEGIN(self, sAddr, xCommissionerSessionId, listChannelMask, xCount, xPeriod):
"""send MGMT_ANNOUNCE_BEGIN message to a given destination
Returns:
True: successful to send MGMT_ANNOUNCE_BEGIN message.
False: fail to send MGMT_ANNOUNCE_BEGIN message.
"""
... | def MGMT_ANNOUNCE_BEGIN(self, sAddr, xCommissionerSessionId, listChannelMask, xCount, xPeriod):
"""send MGMT_ANNOUNCE_BEGIN message to a given destination
Returns:
True: successful to send MGMT_ANNOUNCE_BEGIN message.
False: fail to send MGMT_ANNOUNCE_BEGIN message.
"""
... | [
"send",
"MGMT_ANNOUNCE_BEGIN",
"message",
"to",
"a",
"given",
"destination"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2221-L2236 | [
"def",
"MGMT_ANNOUNCE_BEGIN",
"(",
"self",
",",
"sAddr",
",",
"xCommissionerSessionId",
",",
"listChannelMask",
",",
"xCount",
",",
"xPeriod",
")",
":",
"print",
"'%s call MGMT_ANNOUNCE_BEGIN'",
"%",
"self",
".",
"port",
"channelMask",
"=",
"''",
"channelMask",
"=... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.MGMT_ACTIVE_GET | send MGMT_ACTIVE_GET command
Returns:
True: successful to send MGMT_ACTIVE_GET
False: fail to send MGMT_ACTIVE_GET | tools/harness-thci/OpenThread_WpanCtl.py | def MGMT_ACTIVE_GET(self, Addr='', TLVs=[]):
"""send MGMT_ACTIVE_GET command
Returns:
True: successful to send MGMT_ACTIVE_GET
False: fail to send MGMT_ACTIVE_GET
"""
print '%s call MGMT_ACTIVE_GET' % self.port
try:
cmd = WPANCTL_CMD + 'datas... | def MGMT_ACTIVE_GET(self, Addr='', TLVs=[]):
"""send MGMT_ACTIVE_GET command
Returns:
True: successful to send MGMT_ACTIVE_GET
False: fail to send MGMT_ACTIVE_GET
"""
print '%s call MGMT_ACTIVE_GET' % self.port
try:
cmd = WPANCTL_CMD + 'datas... | [
"send",
"MGMT_ACTIVE_GET",
"command"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2238-L2269 | [
"def",
"MGMT_ACTIVE_GET",
"(",
"self",
",",
"Addr",
"=",
"''",
",",
"TLVs",
"=",
"[",
"]",
")",
":",
"print",
"'%s call MGMT_ACTIVE_GET'",
"%",
"self",
".",
"port",
"try",
":",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'dataset mgmt-get-active'",
"if",
"len",
"(",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.MGMT_ACTIVE_SET | send MGMT_ACTIVE_SET command
Returns:
True: successful to send MGMT_ACTIVE_SET
False: fail to send MGMT_ACTIVE_SET | tools/harness-thci/OpenThread_WpanCtl.py | def MGMT_ACTIVE_SET(self, sAddr='', xCommissioningSessionId=None, listActiveTimestamp=None, listChannelMask=None, xExtendedPanId=None,
sNetworkName=None, sPSKc=None, listSecurityPolicy=None, xChannel=None, sMeshLocalPrefix=None, xMasterKey=None,
xPanId=None, xTmfPort=None... | def MGMT_ACTIVE_SET(self, sAddr='', xCommissioningSessionId=None, listActiveTimestamp=None, listChannelMask=None, xExtendedPanId=None,
sNetworkName=None, sPSKc=None, listSecurityPolicy=None, xChannel=None, sMeshLocalPrefix=None, xMasterKey=None,
xPanId=None, xTmfPort=None... | [
"send",
"MGMT_ACTIVE_SET",
"command"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2271-L2426 | [
"def",
"MGMT_ACTIVE_SET",
"(",
"self",
",",
"sAddr",
"=",
"''",
",",
"xCommissioningSessionId",
"=",
"None",
",",
"listActiveTimestamp",
"=",
"None",
",",
"listChannelMask",
"=",
"None",
",",
"xExtendedPanId",
"=",
"None",
",",
"sNetworkName",
"=",
"None",
","... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.MGMT_PENDING_SET | send MGMT_PENDING_SET command
Returns:
True: successful to send MGMT_PENDING_SET
False: fail to send MGMT_PENDING_SET | tools/harness-thci/OpenThread_WpanCtl.py | def MGMT_PENDING_SET(self, sAddr='', xCommissionerSessionId=None, listPendingTimestamp=None, listActiveTimestamp=None, xDelayTimer=None,
xChannel=None, xPanId=None, xMasterKey=None, sMeshLocalPrefix=None, sNetworkName=None):
"""send MGMT_PENDING_SET command
Returns:
... | def MGMT_PENDING_SET(self, sAddr='', xCommissionerSessionId=None, listPendingTimestamp=None, listActiveTimestamp=None, xDelayTimer=None,
xChannel=None, xPanId=None, xMasterKey=None, sMeshLocalPrefix=None, sNetworkName=None):
"""send MGMT_PENDING_SET command
Returns:
... | [
"send",
"MGMT_PENDING_SET",
"command"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2460-L2533 | [
"def",
"MGMT_PENDING_SET",
"(",
"self",
",",
"sAddr",
"=",
"''",
",",
"xCommissionerSessionId",
"=",
"None",
",",
"listPendingTimestamp",
"=",
"None",
",",
"listActiveTimestamp",
"=",
"None",
",",
"xDelayTimer",
"=",
"None",
",",
"xChannel",
"=",
"None",
",",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.MGMT_COMM_SET | send MGMT_COMM_SET command
Returns:
True: successful to send MGMT_COMM_SET
False: fail to send MGMT_COMM_SET | tools/harness-thci/OpenThread_WpanCtl.py | def MGMT_COMM_SET(self, Addr='ff02::1', xCommissionerSessionID=None, xSteeringData=None, xBorderRouterLocator=None,
xChannelTlv=None, ExceedMaxPayload=False):
"""send MGMT_COMM_SET command
Returns:
True: successful to send MGMT_COMM_SET
False: fail to send ... | def MGMT_COMM_SET(self, Addr='ff02::1', xCommissionerSessionID=None, xSteeringData=None, xBorderRouterLocator=None,
xChannelTlv=None, ExceedMaxPayload=False):
"""send MGMT_COMM_SET command
Returns:
True: successful to send MGMT_COMM_SET
False: fail to send ... | [
"send",
"MGMT_COMM_SET",
"command"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2559-L2603 | [
"def",
"MGMT_COMM_SET",
"(",
"self",
",",
"Addr",
"=",
"'ff02::1'",
",",
"xCommissionerSessionID",
"=",
"None",
",",
"xSteeringData",
"=",
"None",
",",
"xBorderRouterLocator",
"=",
"None",
",",
"xChannelTlv",
"=",
"None",
",",
"ExceedMaxPayload",
"=",
"False",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | OpenThread_WpanCtl.commissionerUnregister | stop commissioner
Returns:
True: successful to stop commissioner
False: fail to stop commissioner | tools/harness-thci/OpenThread_WpanCtl.py | def commissionerUnregister(self):
"""stop commissioner
Returns:
True: successful to stop commissioner
False: fail to stop commissioner
"""
print '%s call commissionerUnregister' % self.port
cmd = WPANCTL_CMD + 'commissioner stop'
print cmd
... | def commissionerUnregister(self):
"""stop commissioner
Returns:
True: successful to stop commissioner
False: fail to stop commissioner
"""
print '%s call commissionerUnregister' % self.port
cmd = WPANCTL_CMD + 'commissioner stop'
print cmd
... | [
"stop",
"commissioner"
] | openthread/openthread | python | https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread_WpanCtl.py#L2648-L2662 | [
"def",
"commissionerUnregister",
"(",
"self",
")",
":",
"print",
"'%s call commissionerUnregister'",
"%",
"self",
".",
"port",
"cmd",
"=",
"WPANCTL_CMD",
"+",
"'commissioner stop'",
"print",
"cmd",
"if",
"self",
".",
"__sendCommand",
"(",
"cmd",
")",
"[",
"0",
... | 0208d10563aa21c518092985c78ecf9cd223ab74 |
train | Task.start | Run the task for the given host.
Arguments:
host (:obj:`nornir.core.inventory.Host`): Host we are operating with. Populated right
before calling the ``task``
nornir(:obj:`nornir.core.Nornir`): Populated right before calling
the ``task``
Returns:
... | nornir/core/task.py | def start(self, host, nornir):
"""
Run the task for the given host.
Arguments:
host (:obj:`nornir.core.inventory.Host`): Host we are operating with. Populated right
before calling the ``task``
nornir(:obj:`nornir.core.Nornir`): Populated right before callin... | def start(self, host, nornir):
"""
Run the task for the given host.
Arguments:
host (:obj:`nornir.core.inventory.Host`): Host we are operating with. Populated right
before calling the ``task``
nornir(:obj:`nornir.core.Nornir`): Populated right before callin... | [
"Run",
"the",
"task",
"for",
"the",
"given",
"host",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/task.py#L49-L95 | [
"def",
"start",
"(",
"self",
",",
"host",
",",
"nornir",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"nornir",
"=",
"nornir",
"try",
":",
"logger",
".",
"debug",
"(",
"\"Host %r: running task %r\"",
",",
"self",
".",
"host",
".",
"name",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Task.run | This is a utility method to call a task from within a task. For instance:
def grouped_tasks(task):
task.run(my_first_task)
task.run(my_second_task)
nornir.run(grouped_tasks)
This method will ensure the subtask is run only for the host in the current thr... | nornir/core/task.py | def run(self, task, **kwargs):
"""
This is a utility method to call a task from within a task. For instance:
def grouped_tasks(task):
task.run(my_first_task)
task.run(my_second_task)
nornir.run(grouped_tasks)
This method will ensure the ... | def run(self, task, **kwargs):
"""
This is a utility method to call a task from within a task. For instance:
def grouped_tasks(task):
task.run(my_first_task)
task.run(my_second_task)
nornir.run(grouped_tasks)
This method will ensure the ... | [
"This",
"is",
"a",
"utility",
"method",
"to",
"call",
"a",
"task",
"from",
"within",
"a",
"task",
".",
"For",
"instance",
":"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/task.py#L97-L126 | [
"def",
"run",
"(",
"self",
",",
"task",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"host",
"or",
"not",
"self",
".",
"nornir",
":",
"msg",
"=",
"(",
"\"You have to call this after setting host and nornir attributes. \"",
",",
"\"You probably ... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Task.is_dry_run | Returns whether current task is a dry_run or not. | nornir/core/task.py | def is_dry_run(self, override: bool = None) -> bool:
"""
Returns whether current task is a dry_run or not.
"""
return override if override is not None else self.nornir.data.dry_run | def is_dry_run(self, override: bool = None) -> bool:
"""
Returns whether current task is a dry_run or not.
"""
return override if override is not None else self.nornir.data.dry_run | [
"Returns",
"whether",
"current",
"task",
"is",
"a",
"dry_run",
"or",
"not",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/task.py#L128-L132 | [
"def",
"is_dry_run",
"(",
"self",
",",
"override",
":",
"bool",
"=",
"None",
")",
"->",
"bool",
":",
"return",
"override",
"if",
"override",
"is",
"not",
"None",
"else",
"self",
".",
"nornir",
".",
"data",
".",
"dry_run"
] | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | AggregatedResult.failed_hosts | Hosts that failed during the execution of the task. | nornir/core/task.py | def failed_hosts(self):
"""Hosts that failed during the execution of the task."""
return {h: r for h, r in self.items() if r.failed} | def failed_hosts(self):
"""Hosts that failed during the execution of the task."""
return {h: r for h, r in self.items() if r.failed} | [
"Hosts",
"that",
"failed",
"during",
"the",
"execution",
"of",
"the",
"task",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/task.py#L216-L218 | [
"def",
"failed_hosts",
"(",
"self",
")",
":",
"return",
"{",
"h",
":",
"r",
"for",
"h",
",",
"r",
"in",
"self",
".",
"items",
"(",
")",
"if",
"r",
".",
"failed",
"}"
] | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | napalm_validate | Gather information with napalm and validate it:
http://napalm.readthedocs.io/en/develop/validate/index.html
Arguments:
src: file to use as validation source
validation_source (list): data to validate device's state
Returns:
Result object with the following attributes set:
... | nornir/plugins/tasks/networking/napalm_validate.py | def napalm_validate(
task: Task,
src: Optional[str] = None,
validation_source: ValidationSourceData = None,
) -> Result:
"""
Gather information with napalm and validate it:
http://napalm.readthedocs.io/en/develop/validate/index.html
Arguments:
src: file to use as validation sou... | def napalm_validate(
task: Task,
src: Optional[str] = None,
validation_source: ValidationSourceData = None,
) -> Result:
"""
Gather information with napalm and validate it:
http://napalm.readthedocs.io/en/develop/validate/index.html
Arguments:
src: file to use as validation sou... | [
"Gather",
"information",
"with",
"napalm",
"and",
"validate",
"it",
":"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/napalm_validate.py#L8-L31 | [
"def",
"napalm_validate",
"(",
"task",
":",
"Task",
",",
"src",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"validation_source",
":",
"ValidationSourceData",
"=",
"None",
",",
")",
"->",
"Result",
":",
"device",
"=",
"task",
".",
"host",
".",
"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | netmiko_save_config | Execute Netmiko save_config method
Arguments:
cmd(str, optional): Command used to save the configuration.
confirm(bool, optional): Does device prompt for confirmation before executing save operation
confirm_response(str, optional): Response send to device when it prompts for confirmation
... | nornir/plugins/tasks/networking/netmiko_save_config.py | def netmiko_save_config(
task: Task, cmd: str = "", confirm: bool = False, confirm_response: str = ""
) -> Result:
"""
Execute Netmiko save_config method
Arguments:
cmd(str, optional): Command used to save the configuration.
confirm(bool, optional): Does device prompt for confirmation be... | def netmiko_save_config(
task: Task, cmd: str = "", confirm: bool = False, confirm_response: str = ""
) -> Result:
"""
Execute Netmiko save_config method
Arguments:
cmd(str, optional): Command used to save the configuration.
confirm(bool, optional): Does device prompt for confirmation be... | [
"Execute",
"Netmiko",
"save_config",
"method",
"Arguments",
":",
"cmd",
"(",
"str",
"optional",
")",
":",
"Command",
"used",
"to",
"save",
"the",
"configuration",
".",
"confirm",
"(",
"bool",
"optional",
")",
":",
"Does",
"device",
"prompt",
"for",
"confirma... | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/netmiko_save_config.py#L6-L27 | [
"def",
"netmiko_save_config",
"(",
"task",
":",
"Task",
",",
"cmd",
":",
"str",
"=",
"\"\"",
",",
"confirm",
":",
"bool",
"=",
"False",
",",
"confirm_response",
":",
"str",
"=",
"\"\"",
")",
"->",
"Result",
":",
"conn",
"=",
"task",
".",
"host",
".",... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | netmiko_send_command | Execute Netmiko send_command method (or send_command_timing)
Arguments:
command_string: Command to execute on the remote network device.
use_timing: Set to True to switch to send_command_timing method.
enable: Set to True to force Netmiko .enable() call.
kwargs: Additional arguments... | nornir/plugins/tasks/networking/netmiko_send_command.py | def netmiko_send_command(
task: Task,
command_string: str,
use_timing: bool = False,
enable: bool = False,
**kwargs: Any
) -> Result:
"""
Execute Netmiko send_command method (or send_command_timing)
Arguments:
command_string: Command to execute on the remote network device.
... | def netmiko_send_command(
task: Task,
command_string: str,
use_timing: bool = False,
enable: bool = False,
**kwargs: Any
) -> Result:
"""
Execute Netmiko send_command method (or send_command_timing)
Arguments:
command_string: Command to execute on the remote network device.
... | [
"Execute",
"Netmiko",
"send_command",
"method",
"(",
"or",
"send_command_timing",
")"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/netmiko_send_command.py#L6-L33 | [
"def",
"netmiko_send_command",
"(",
"task",
":",
"Task",
",",
"command_string",
":",
"str",
",",
"use_timing",
":",
"bool",
"=",
"False",
",",
"enable",
":",
"bool",
"=",
"False",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Result",
":",
"net_conn... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Host.has_parent_group | Retuns whether the object is a child of the :obj:`Group` ``group`` | nornir/core/inventory.py | def has_parent_group(self, group):
"""Retuns whether the object is a child of the :obj:`Group` ``group``"""
if isinstance(group, str):
return self._has_parent_group_by_name(group)
else:
return self._has_parent_group_by_object(group) | def has_parent_group(self, group):
"""Retuns whether the object is a child of the :obj:`Group` ``group``"""
if isinstance(group, str):
return self._has_parent_group_by_name(group)
else:
return self._has_parent_group_by_object(group) | [
"Retuns",
"whether",
"the",
"object",
"is",
"a",
"child",
"of",
"the",
":",
"obj",
":",
"Group",
"group"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L130-L136 | [
"def",
"has_parent_group",
"(",
"self",
",",
"group",
")",
":",
"if",
"isinstance",
"(",
"group",
",",
"str",
")",
":",
"return",
"self",
".",
"_has_parent_group_by_name",
"(",
"group",
")",
"else",
":",
"return",
"self",
".",
"_has_parent_group_by_object",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Host.get | Returns the value ``item`` from the host or hosts group variables.
Arguments:
item(``str``): The variable to get
default(``any``): Return value if item not found | nornir/core/inventory.py | def get(self, item, default=None):
"""
Returns the value ``item`` from the host or hosts group variables.
Arguments:
item(``str``): The variable to get
default(``any``): Return value if item not found
"""
if hasattr(self, item):
return getattr... | def get(self, item, default=None):
"""
Returns the value ``item`` from the host or hosts group variables.
Arguments:
item(``str``): The variable to get
default(``any``): Return value if item not found
"""
if hasattr(self, item):
return getattr... | [
"Returns",
"the",
"value",
"item",
"from",
"the",
"host",
"or",
"hosts",
"group",
"variables",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L198-L212 | [
"def",
"get",
"(",
"self",
",",
"item",
",",
"default",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"item",
")",
":",
"return",
"getattr",
"(",
"self",
",",
"item",
")",
"try",
":",
"return",
"self",
".",
"__getitem__",
"(",
"item",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Host.get_connection | The function of this method is twofold:
1. If an existing connection is already established for the given type return it
2. If none exists, establish a new connection of that type with default parameters
and return it
Raises:
AttributeError: if it's unknown h... | nornir/core/inventory.py | def get_connection(self, connection: str, configuration: Config) -> Any:
"""
The function of this method is twofold:
1. If an existing connection is already established for the given type return it
2. If none exists, establish a new connection of that type with default parameter... | def get_connection(self, connection: str, configuration: Config) -> Any:
"""
The function of this method is twofold:
1. If an existing connection is already established for the given type return it
2. If none exists, establish a new connection of that type with default parameter... | [
"The",
"function",
"of",
"this",
"method",
"is",
"twofold",
":"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L275-L304 | [
"def",
"get_connection",
"(",
"self",
",",
"connection",
":",
"str",
",",
"configuration",
":",
"Config",
")",
"->",
"Any",
":",
"if",
"connection",
"not",
"in",
"self",
".",
"connections",
":",
"conn",
"=",
"self",
".",
"get_connection_parameters",
"(",
"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Host.get_connection_state | For an already established connection return its state. | nornir/core/inventory.py | def get_connection_state(self, connection: str) -> Dict[str, Any]:
"""
For an already established connection return its state.
"""
if connection not in self.connections:
raise ConnectionNotOpen(connection)
return self.connections[connection].state | def get_connection_state(self, connection: str) -> Dict[str, Any]:
"""
For an already established connection return its state.
"""
if connection not in self.connections:
raise ConnectionNotOpen(connection)
return self.connections[connection].state | [
"For",
"an",
"already",
"established",
"connection",
"return",
"its",
"state",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L306-L313 | [
"def",
"get_connection_state",
"(",
"self",
",",
"connection",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"connection",
"not",
"in",
"self",
".",
"connections",
":",
"raise",
"ConnectionNotOpen",
"(",
"connection",
")",
"return"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Host.open_connection | Open a new connection.
If ``default_to_host_attributes`` is set to ``True`` arguments will default to host
attributes if not specified.
Raises:
AttributeError: if it's unknown how to establish a connection for the given type
Returns:
An already established conn... | nornir/core/inventory.py | def open_connection(
self,
connection: str,
configuration: Config,
hostname: Optional[str] = None,
username: Optional[str] = None,
password: Optional[str] = None,
port: Optional[int] = None,
platform: Optional[str] = None,
extras: Optional[Dict[str... | def open_connection(
self,
connection: str,
configuration: Config,
hostname: Optional[str] = None,
username: Optional[str] = None,
password: Optional[str] = None,
port: Optional[int] = None,
platform: Optional[str] = None,
extras: Optional[Dict[str... | [
"Open",
"a",
"new",
"connection",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L315-L364 | [
"def",
"open_connection",
"(",
"self",
",",
"connection",
":",
"str",
",",
"configuration",
":",
"Config",
",",
"hostname",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"username",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"password",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Host.close_connection | Close the connection | nornir/core/inventory.py | def close_connection(self, connection: str) -> None:
""" Close the connection"""
if connection not in self.connections:
raise ConnectionNotOpen(connection)
self.connections.pop(connection).close() | def close_connection(self, connection: str) -> None:
""" Close the connection"""
if connection not in self.connections:
raise ConnectionNotOpen(connection)
self.connections.pop(connection).close() | [
"Close",
"the",
"connection"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L366-L371 | [
"def",
"close_connection",
"(",
"self",
",",
"connection",
":",
"str",
")",
"->",
"None",
":",
"if",
"connection",
"not",
"in",
"self",
".",
"connections",
":",
"raise",
"ConnectionNotOpen",
"(",
"connection",
")",
"self",
".",
"connections",
".",
"pop",
"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Inventory.children_of_group | Returns set of hosts that belongs to a group including those that belong
indirectly via inheritance | nornir/core/inventory.py | def children_of_group(self, group: Union[str, Group]) -> Set[Host]:
"""
Returns set of hosts that belongs to a group including those that belong
indirectly via inheritance
"""
hosts: List[Host] = set()
for host in self.hosts.values():
if host.has_parent_group(... | def children_of_group(self, group: Union[str, Group]) -> Set[Host]:
"""
Returns set of hosts that belongs to a group including those that belong
indirectly via inheritance
"""
hosts: List[Host] = set()
for host in self.hosts.values():
if host.has_parent_group(... | [
"Returns",
"set",
"of",
"hosts",
"that",
"belongs",
"to",
"a",
"group",
"including",
"those",
"that",
"belong",
"indirectly",
"via",
"inheritance"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L431-L440 | [
"def",
"children_of_group",
"(",
"self",
",",
"group",
":",
"Union",
"[",
"str",
",",
"Group",
"]",
")",
"->",
"Set",
"[",
"Host",
"]",
":",
"hosts",
":",
"List",
"[",
"Host",
"]",
"=",
"set",
"(",
")",
"for",
"host",
"in",
"self",
".",
"hosts",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Inventory.add_host | Add a host to the inventory after initialization | nornir/core/inventory.py | def add_host(self, name: str, **kwargs) -> None:
"""
Add a host to the inventory after initialization
"""
host = {
name: deserializer.inventory.InventoryElement.deserialize_host(
name=name, defaults=self.defaults, **kwargs
)
}
self.... | def add_host(self, name: str, **kwargs) -> None:
"""
Add a host to the inventory after initialization
"""
host = {
name: deserializer.inventory.InventoryElement.deserialize_host(
name=name, defaults=self.defaults, **kwargs
)
}
self.... | [
"Add",
"a",
"host",
"to",
"the",
"inventory",
"after",
"initialization"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L442-L451 | [
"def",
"add_host",
"(",
"self",
",",
"name",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"host",
"=",
"{",
"name",
":",
"deserializer",
".",
"inventory",
".",
"InventoryElement",
".",
"deserialize_host",
"(",
"name",
"=",
"name",
",",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Inventory.add_group | Add a group to the inventory after initialization | nornir/core/inventory.py | def add_group(self, name: str, **kwargs) -> None:
"""
Add a group to the inventory after initialization
"""
group = {
name: deserializer.inventory.InventoryElement.deserialize_group(
name=name, defaults=self.defaults, **kwargs
)
}
s... | def add_group(self, name: str, **kwargs) -> None:
"""
Add a group to the inventory after initialization
"""
group = {
name: deserializer.inventory.InventoryElement.deserialize_group(
name=name, defaults=self.defaults, **kwargs
)
}
s... | [
"Add",
"a",
"group",
"to",
"the",
"inventory",
"after",
"initialization"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L453-L462 | [
"def",
"add_group",
"(",
"self",
",",
"name",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"group",
"=",
"{",
"name",
":",
"deserializer",
".",
"inventory",
".",
"InventoryElement",
".",
"deserialize_group",
"(",
"name",
"=",
"name",
",... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Inventory.get_defaults_dict | Returns serialized dictionary of defaults from inventory | nornir/core/inventory.py | def get_defaults_dict(self) -> Dict:
"""
Returns serialized dictionary of defaults from inventory
"""
return deserializer.inventory.Defaults.serialize(self.defaults).dict() | def get_defaults_dict(self) -> Dict:
"""
Returns serialized dictionary of defaults from inventory
"""
return deserializer.inventory.Defaults.serialize(self.defaults).dict() | [
"Returns",
"serialized",
"dictionary",
"of",
"defaults",
"from",
"inventory"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L470-L474 | [
"def",
"get_defaults_dict",
"(",
"self",
")",
"->",
"Dict",
":",
"return",
"deserializer",
".",
"inventory",
".",
"Defaults",
".",
"serialize",
"(",
"self",
".",
"defaults",
")",
".",
"dict",
"(",
")"
] | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Inventory.get_groups_dict | Returns serialized dictionary of groups from inventory | nornir/core/inventory.py | def get_groups_dict(self) -> Dict:
"""
Returns serialized dictionary of groups from inventory
"""
return {
k: deserializer.inventory.InventoryElement.serialize(v).dict()
for k, v in self.groups.items()
} | def get_groups_dict(self) -> Dict:
"""
Returns serialized dictionary of groups from inventory
"""
return {
k: deserializer.inventory.InventoryElement.serialize(v).dict()
for k, v in self.groups.items()
} | [
"Returns",
"serialized",
"dictionary",
"of",
"groups",
"from",
"inventory"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L476-L483 | [
"def",
"get_groups_dict",
"(",
"self",
")",
"->",
"Dict",
":",
"return",
"{",
"k",
":",
"deserializer",
".",
"inventory",
".",
"InventoryElement",
".",
"serialize",
"(",
"v",
")",
".",
"dict",
"(",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"group... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Inventory.get_hosts_dict | Returns serialized dictionary of hosts from inventory | nornir/core/inventory.py | def get_hosts_dict(self) -> Dict:
"""
Returns serialized dictionary of hosts from inventory
"""
return {
k: deserializer.inventory.InventoryElement.serialize(v).dict()
for k, v in self.hosts.items()
} | def get_hosts_dict(self) -> Dict:
"""
Returns serialized dictionary of hosts from inventory
"""
return {
k: deserializer.inventory.InventoryElement.serialize(v).dict()
for k, v in self.hosts.items()
} | [
"Returns",
"serialized",
"dictionary",
"of",
"hosts",
"from",
"inventory"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L485-L492 | [
"def",
"get_hosts_dict",
"(",
"self",
")",
"->",
"Dict",
":",
"return",
"{",
"k",
":",
"deserializer",
".",
"inventory",
".",
"InventoryElement",
".",
"serialize",
"(",
"v",
")",
".",
"dict",
"(",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"hosts"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | sftp | Transfer files from/to the device using sftp protocol
Example::
nornir.run(files.sftp,
action="put",
src="README.md",
dst="/tmp/README.md")
Arguments:
dry_run: Whether to apply changes or not
src: source file
dst: des... | nornir/plugins/tasks/files/sftp.py | def sftp(
task: Task, src: str, dst: str, action: str, dry_run: Optional[bool] = None
) -> Result:
"""
Transfer files from/to the device using sftp protocol
Example::
nornir.run(files.sftp,
action="put",
src="README.md",
dst="/tmp/REA... | def sftp(
task: Task, src: str, dst: str, action: str, dry_run: Optional[bool] = None
) -> Result:
"""
Transfer files from/to the device using sftp protocol
Example::
nornir.run(files.sftp,
action="put",
src="README.md",
dst="/tmp/REA... | [
"Transfer",
"files",
"from",
"/",
"to",
"the",
"device",
"using",
"sftp",
"protocol"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/files/sftp.py#L126-L158 | [
"def",
"sftp",
"(",
"task",
":",
"Task",
",",
"src",
":",
"str",
",",
"dst",
":",
"str",
",",
"action",
":",
"str",
",",
"dry_run",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
")",
"->",
"Result",
":",
"dry_run",
"=",
"task",
".",
"is_dry_run... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | template_file | Renders contants of a file with jinja2. All the host data is available in the template
Arguments:
template: filename
path: path to dir with templates
jinja_filters: jinja filters to enable. Defaults to nornir.config.jinja2.filters
**kwargs: additional data to pass to the template
... | nornir/plugins/tasks/text/template_file.py | def template_file(
task: Task,
template: str,
path: str,
jinja_filters: FiltersDict = None,
**kwargs: Any
) -> Result:
"""
Renders contants of a file with jinja2. All the host data is available in the template
Arguments:
template: filename
path: path to dir with template... | def template_file(
task: Task,
template: str,
path: str,
jinja_filters: FiltersDict = None,
**kwargs: Any
) -> Result:
"""
Renders contants of a file with jinja2. All the host data is available in the template
Arguments:
template: filename
path: path to dir with template... | [
"Renders",
"contants",
"of",
"a",
"file",
"with",
"jinja2",
".",
"All",
"the",
"host",
"data",
"is",
"available",
"in",
"the",
"template"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/text/template_file.py#L9-L37 | [
"def",
"template_file",
"(",
"task",
":",
"Task",
",",
"template",
":",
"str",
",",
"path",
":",
"str",
",",
"jinja_filters",
":",
"FiltersDict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Result",
":",
"jinja_filters",
"=",
"jinja_f... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | http_method | This is a convenience task that uses `requests <http://docs.python-requests.org/en/master/>`_ to
interact with an HTTP server.
Arguments:
method: HTTP method to call
url: URL to connect to
raise_for_status: Whether to call `raise_for_status
<http://docs.python-requests.org/e... | nornir/plugins/tasks/apis/http_method.py | def http_method(
task: Optional[Task] = None,
method: str = "get",
url: str = "",
raise_for_status: bool = True,
**kwargs: Any
) -> Result:
"""
This is a convenience task that uses `requests <http://docs.python-requests.org/en/master/>`_ to
interact with an HTTP server.
Arguments:
... | def http_method(
task: Optional[Task] = None,
method: str = "get",
url: str = "",
raise_for_status: bool = True,
**kwargs: Any
) -> Result:
"""
This is a convenience task that uses `requests <http://docs.python-requests.org/en/master/>`_ to
interact with an HTTP server.
Arguments:
... | [
"This",
"is",
"a",
"convenience",
"task",
"that",
"uses",
"requests",
"<http",
":",
"//",
"docs",
".",
"python",
"-",
"requests",
".",
"org",
"/",
"en",
"/",
"master",
"/",
">",
"_",
"to",
"interact",
"with",
"an",
"HTTP",
"server",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/apis/http_method.py#L7-L48 | [
"def",
"http_method",
"(",
"task",
":",
"Optional",
"[",
"Task",
"]",
"=",
"None",
",",
"method",
":",
"str",
"=",
"\"get\"",
",",
"url",
":",
"str",
"=",
"\"\"",
",",
"raise_for_status",
":",
"bool",
"=",
"True",
",",
"*",
"*",
"kwargs",
":",
"Any... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | netmiko_send_config | Execute Netmiko send_config_set method (or send_config_from_file)
Arguments:
config_commands: Commands to configure on the remote network device.
config_file: File to read configuration commands from.
kwargs: Additional arguments to pass to method.
Returns:
Result object with t... | nornir/plugins/tasks/networking/netmiko_send_config.py | def netmiko_send_config(
task: Task,
config_commands: Optional[List[str]] = None,
config_file: Optional[str] = None,
**kwargs: Any
) -> Result:
"""
Execute Netmiko send_config_set method (or send_config_from_file)
Arguments:
config_commands: Commands to configure on the remote netwo... | def netmiko_send_config(
task: Task,
config_commands: Optional[List[str]] = None,
config_file: Optional[str] = None,
**kwargs: Any
) -> Result:
"""
Execute Netmiko send_config_set method (or send_config_from_file)
Arguments:
config_commands: Commands to configure on the remote netwo... | [
"Execute",
"Netmiko",
"send_config_set",
"method",
"(",
"or",
"send_config_from_file",
")"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/netmiko_send_config.py#L6-L33 | [
"def",
"netmiko_send_config",
"(",
"task",
":",
"Task",
",",
"config_commands",
":",
"Optional",
"[",
"List",
"[",
"str",
"]",
"]",
"=",
"None",
",",
"config_file",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | napalm_configure | Loads configuration into a network devices using napalm
Arguments:
dry_run: Whether to apply changes or not
filename: filename containing the configuration to load into the device
configuration: configuration to load into the device
replace: whether to replace or merge the configura... | nornir/plugins/tasks/networking/napalm_configure.py | def napalm_configure(
task: Task,
dry_run: Optional[bool] = None,
filename: Optional[str] = None,
configuration: Optional[str] = None,
replace: bool = False,
) -> Result:
"""
Loads configuration into a network devices using napalm
Arguments:
dry_run: Whether to apply changes or ... | def napalm_configure(
task: Task,
dry_run: Optional[bool] = None,
filename: Optional[str] = None,
configuration: Optional[str] = None,
replace: bool = False,
) -> Result:
"""
Loads configuration into a network devices using napalm
Arguments:
dry_run: Whether to apply changes or ... | [
"Loads",
"configuration",
"into",
"a",
"network",
"devices",
"using",
"napalm"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/napalm_configure.py#L6-L40 | [
"def",
"napalm_configure",
"(",
"task",
":",
"Task",
",",
"dry_run",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
",",
"filename",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"configuration",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | load_json | Loads a json file.
Arguments:
file: path to the file containing the json file to load
Examples:
Simple example with ``ordered_dict``::
> nr.run(task=load_json,
file="mydata.json")
file: path to the file containing the json file to load
Returns:
... | nornir/plugins/tasks/data/load_json.py | def load_json(task: Task, file: str) -> Result:
"""
Loads a json file.
Arguments:
file: path to the file containing the json file to load
Examples:
Simple example with ``ordered_dict``::
> nr.run(task=load_json,
file="mydata.json")
file: path... | def load_json(task: Task, file: str) -> Result:
"""
Loads a json file.
Arguments:
file: path to the file containing the json file to load
Examples:
Simple example with ``ordered_dict``::
> nr.run(task=load_json,
file="mydata.json")
file: path... | [
"Loads",
"a",
"json",
"file",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/data/load_json.py#L7-L31 | [
"def",
"load_json",
"(",
"task",
":",
"Task",
",",
"file",
":",
"str",
")",
"->",
"Result",
":",
"kwargs",
":",
"Dict",
"[",
"str",
",",
"Type",
"[",
"MutableMapping",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
"=",
"{",
"}",
"with",
"open",
"(",
"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | print_title | Helper function to print a title. | nornir/plugins/functions/text/__init__.py | def print_title(title: str) -> None:
"""
Helper function to print a title.
"""
msg = "**** {} ".format(title)
print("{}{}{}{}".format(Style.BRIGHT, Fore.GREEN, msg, "*" * (80 - len(msg)))) | def print_title(title: str) -> None:
"""
Helper function to print a title.
"""
msg = "**** {} ".format(title)
print("{}{}{}{}".format(Style.BRIGHT, Fore.GREEN, msg, "*" * (80 - len(msg)))) | [
"Helper",
"function",
"to",
"print",
"a",
"title",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/functions/text/__init__.py#L19-L24 | [
"def",
"print_title",
"(",
"title",
":",
"str",
")",
"->",
"None",
":",
"msg",
"=",
"\"**** {} \"",
".",
"format",
"(",
"title",
")",
"print",
"(",
"\"{}{}{}{}\"",
".",
"format",
"(",
"Style",
".",
"BRIGHT",
",",
"Fore",
".",
"GREEN",
",",
"msg",
","... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | print_result | Prints the :obj:`nornir.core.task.Result` from a previous task to screen
Arguments:
result: from a previous task
host: # TODO
vars: Which attributes you want to print
failed: if ``True`` assume the task failed
severity_level: Print only errors with this severity level or hig... | nornir/plugins/functions/text/__init__.py | def print_result(
result: Result,
host: Optional[str] = None,
vars: List[str] = None,
failed: bool = False,
severity_level: int = logging.INFO,
) -> None:
"""
Prints the :obj:`nornir.core.task.Result` from a previous task to screen
Arguments:
result: from a previous task
... | def print_result(
result: Result,
host: Optional[str] = None,
vars: List[str] = None,
failed: bool = False,
severity_level: int = logging.INFO,
) -> None:
"""
Prints the :obj:`nornir.core.task.Result` from a previous task to screen
Arguments:
result: from a previous task
... | [
"Prints",
"the",
":",
"obj",
":",
"nornir",
".",
"core",
".",
"task",
".",
"Result",
"from",
"a",
"previous",
"task",
"to",
"screen"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/functions/text/__init__.py#L112-L133 | [
"def",
"print_result",
"(",
"result",
":",
"Result",
",",
"host",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"vars",
":",
"List",
"[",
"str",
"]",
"=",
"None",
",",
"failed",
":",
"bool",
"=",
"False",
",",
"severity_level",
":",
"int",
"=... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | command | Executes a command locally
Arguments:
command: command to execute
Returns:
Result object with the following attributes set:
* result (``str``): stderr or stdout
* stdout (``str``): stdout
* stderr (``str``): stderr
Raises:
:obj:`nornir.core.exceptions... | nornir/plugins/tasks/commands/command.py | def command(task: Task, command: str) -> Result:
"""
Executes a command locally
Arguments:
command: command to execute
Returns:
Result object with the following attributes set:
* result (``str``): stderr or stdout
* stdout (``str``): stdout
* stderr (``str... | def command(task: Task, command: str) -> Result:
"""
Executes a command locally
Arguments:
command: command to execute
Returns:
Result object with the following attributes set:
* result (``str``): stderr or stdout
* stdout (``str``): stdout
* stderr (``str... | [
"Executes",
"a",
"command",
"locally"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/commands/command.py#L9-L40 | [
"def",
"command",
"(",
"task",
":",
"Task",
",",
"command",
":",
"str",
")",
"->",
"Result",
":",
"cmd",
"=",
"subprocess",
".",
"Popen",
"(",
"shlex",
".",
"split",
"(",
"command",
")",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | netmiko_file_transfer | Execute Netmiko file_transfer method
Arguments:
source_file: Source file.
dest_file: Destination file.
kwargs: Additional arguments to pass to file_transfer
Returns:
Result object with the following attributes set:
* result (``bool``): file exists and MD5 is valid
... | nornir/plugins/tasks/networking/netmiko_file_transfer.py | def netmiko_file_transfer(
task: Task, source_file: str, dest_file: str, **kwargs: Any
) -> Result:
"""
Execute Netmiko file_transfer method
Arguments:
source_file: Source file.
dest_file: Destination file.
kwargs: Additional arguments to pass to file_transfer
Returns:
... | def netmiko_file_transfer(
task: Task, source_file: str, dest_file: str, **kwargs: Any
) -> Result:
"""
Execute Netmiko file_transfer method
Arguments:
source_file: Source file.
dest_file: Destination file.
kwargs: Additional arguments to pass to file_transfer
Returns:
... | [
"Execute",
"Netmiko",
"file_transfer",
"method"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/netmiko_file_transfer.py#L8-L36 | [
"def",
"netmiko_file_transfer",
"(",
"task",
":",
"Task",
",",
"source_file",
":",
"str",
",",
"dest_file",
":",
"str",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Result",
":",
"net_connect",
"=",
"task",
".",
"host",
".",
"get_connection",
"(",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | napalm_cli | Run commands on remote devices using napalm
Arguments:
commands: commands to execute
Returns:
Result object with the following attributes set:
* result (``dict``): result of the commands execution | nornir/plugins/tasks/networking/napalm_cli.py | def napalm_cli(task: Task, commands: List[str]) -> Result:
"""
Run commands on remote devices using napalm
Arguments:
commands: commands to execute
Returns:
Result object with the following attributes set:
* result (``dict``): result of the commands execution
"""
devi... | def napalm_cli(task: Task, commands: List[str]) -> Result:
"""
Run commands on remote devices using napalm
Arguments:
commands: commands to execute
Returns:
Result object with the following attributes set:
* result (``dict``): result of the commands execution
"""
devi... | [
"Run",
"commands",
"on",
"remote",
"devices",
"using",
"napalm"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/napalm_cli.py#L6-L19 | [
"def",
"napalm_cli",
"(",
"task",
":",
"Task",
",",
"commands",
":",
"List",
"[",
"str",
"]",
")",
"->",
"Result",
":",
"device",
"=",
"task",
".",
"host",
".",
"get_connection",
"(",
"\"napalm\"",
",",
"task",
".",
"nornir",
".",
"config",
")",
"res... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Nornir.filter | See :py:meth:`nornir.core.inventory.Inventory.filter`
Returns:
:obj:`Nornir`: A new object with same configuration as ``self`` but filtered inventory. | nornir/core/__init__.py | def filter(self, *args, **kwargs):
"""
See :py:meth:`nornir.core.inventory.Inventory.filter`
Returns:
:obj:`Nornir`: A new object with same configuration as ``self`` but filtered inventory.
"""
b = Nornir(**self.__dict__)
b.inventory = self.inventory.filter(*... | def filter(self, *args, **kwargs):
"""
See :py:meth:`nornir.core.inventory.Inventory.filter`
Returns:
:obj:`Nornir`: A new object with same configuration as ``self`` but filtered inventory.
"""
b = Nornir(**self.__dict__)
b.inventory = self.inventory.filter(*... | [
"See",
":",
"py",
":",
"meth",
":",
"nornir",
".",
"core",
".",
"inventory",
".",
"Inventory",
".",
"filter"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/__init__.py#L46-L55 | [
"def",
"filter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"b",
"=",
"Nornir",
"(",
"*",
"*",
"self",
".",
"__dict__",
")",
"b",
".",
"inventory",
"=",
"self",
".",
"inventory",
".",
"filter",
"(",
"*",
"args",
",",
"*",... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | Nornir.run | Run task over all the hosts in the inventory.
Arguments:
task (``callable``): function or callable that will be run against each device in
the inventory
num_workers(``int``): Override for how many hosts to run in paralell for this task
raise_on_error (``bool``)... | nornir/core/__init__.py | def run(
self,
task,
num_workers=None,
raise_on_error=None,
on_good=True,
on_failed=False,
**kwargs,
):
"""
Run task over all the hosts in the inventory.
Arguments:
task (``callable``): function or callable that will be run... | def run(
self,
task,
num_workers=None,
raise_on_error=None,
on_good=True,
on_failed=False,
**kwargs,
):
"""
Run task over all the hosts in the inventory.
Arguments:
task (``callable``): function or callable that will be run... | [
"Run",
"task",
"over",
"all",
"the",
"hosts",
"in",
"the",
"inventory",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/__init__.py#L78-L144 | [
"def",
"run",
"(",
"self",
",",
"task",
",",
"num_workers",
"=",
"None",
",",
"raise_on_error",
"=",
"None",
",",
"on_good",
"=",
"True",
",",
"on_failed",
"=",
"False",
",",
"*",
"*",
"kwargs",
",",
")",
":",
"num_workers",
"=",
"num_workers",
"or",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | gitlab | Exposes some of the Gitlab API functionality for operations on files
in a Gitlab repository.
Example:
nornir.run(files.gitlab,
action="create",
url="https://gitlab.localhost.com",
token="ABCD1234",
repository="test",
... | nornir/plugins/tasks/version_control/gitlab.py | def gitlab(
task: Task,
url: str,
token: str,
repository: str,
filename: str,
content: str = "",
action: str = "create",
dry_run: bool = False,
branch: str = "master",
destination: str = "",
ref: str = "master",
commit_message: str = "",
) -> Result:
"""
Exposes s... | def gitlab(
task: Task,
url: str,
token: str,
repository: str,
filename: str,
content: str = "",
action: str = "create",
dry_run: bool = False,
branch: str = "master",
destination: str = "",
ref: str = "master",
commit_message: str = "",
) -> Result:
"""
Exposes s... | [
"Exposes",
"some",
"of",
"the",
"Gitlab",
"API",
"functionality",
"for",
"operations",
"on",
"files",
"in",
"a",
"Gitlab",
"repository",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/version_control/gitlab.py#L155-L222 | [
"def",
"gitlab",
"(",
"task",
":",
"Task",
",",
"url",
":",
"str",
",",
"token",
":",
"str",
",",
"repository",
":",
"str",
",",
"filename",
":",
"str",
",",
"content",
":",
"str",
"=",
"\"\"",
",",
"action",
":",
"str",
"=",
"\"create\"",
",",
"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | echo_data | Dummy task that echoes the data passed to it. Useful in grouped_tasks
to debug data passed to tasks.
Arguments:
``**kwargs``: Any <key,value> pair you want
Returns:
Result object with the following attributes set:
* result (``dict``): ``**kwargs`` passed to the task | nornir/plugins/tasks/data/echo_data.py | def echo_data(task: Task, **kwargs: Any) -> Result:
"""
Dummy task that echoes the data passed to it. Useful in grouped_tasks
to debug data passed to tasks.
Arguments:
``**kwargs``: Any <key,value> pair you want
Returns:
Result object with the following attributes set:
* ... | def echo_data(task: Task, **kwargs: Any) -> Result:
"""
Dummy task that echoes the data passed to it. Useful in grouped_tasks
to debug data passed to tasks.
Arguments:
``**kwargs``: Any <key,value> pair you want
Returns:
Result object with the following attributes set:
* ... | [
"Dummy",
"task",
"that",
"echoes",
"the",
"data",
"passed",
"to",
"it",
".",
"Useful",
"in",
"grouped_tasks",
"to",
"debug",
"data",
"passed",
"to",
"tasks",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/data/echo_data.py#L6-L18 | [
"def",
"echo_data",
"(",
"task",
":",
"Task",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Result",
":",
"return",
"Result",
"(",
"host",
"=",
"task",
".",
"host",
",",
"result",
"=",
"kwargs",
")"
] | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | NornirExecutionError.failed_hosts | Hosts that failed to complete the task | nornir/core/exceptions.py | def failed_hosts(self) -> Dict[str, "MultiResult"]:
"""
Hosts that failed to complete the task
"""
return {k: v for k, v in self.result.items() if v.failed} | def failed_hosts(self) -> Dict[str, "MultiResult"]:
"""
Hosts that failed to complete the task
"""
return {k: v for k, v in self.result.items() if v.failed} | [
"Hosts",
"that",
"failed",
"to",
"complete",
"the",
"task"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/exceptions.py#L75-L79 | [
"def",
"failed_hosts",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"\"MultiResult\"",
"]",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"result",
".",
"items",
"(",
")",
"if",
"v",
".",
"failed",
"}"
] | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | template_string | Renders a string with jinja2. All the host data is available in the template
Arguments:
template (string): template string
jinja_filters (dict): jinja filters to enable. Defaults to nornir.config.jinja2.filters
**kwargs: additional data to pass to the template
Returns:
Result o... | nornir/plugins/tasks/text/template_string.py | def template_string(
task: Task, template: str, jinja_filters: FiltersDict = None, **kwargs: Any
) -> Result:
"""
Renders a string with jinja2. All the host data is available in the template
Arguments:
template (string): template string
jinja_filters (dict): jinja filters to enable. Def... | def template_string(
task: Task, template: str, jinja_filters: FiltersDict = None, **kwargs: Any
) -> Result:
"""
Renders a string with jinja2. All the host data is available in the template
Arguments:
template (string): template string
jinja_filters (dict): jinja filters to enable. Def... | [
"Renders",
"a",
"string",
"with",
"jinja2",
".",
"All",
"the",
"host",
"data",
"is",
"available",
"in",
"the",
"template"
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/text/template_string.py#L9-L28 | [
"def",
"template_string",
"(",
"task",
":",
"Task",
",",
"template",
":",
"str",
",",
"jinja_filters",
":",
"FiltersDict",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Result",
":",
"jinja_filters",
"=",
"jinja_filters",
"or",
"{",
"}",
... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | build_configuration_parameters | Create documentation for configuration parameters. | docs/conf.py | def build_configuration_parameters(app):
"""Create documentation for configuration parameters."""
env = Environment(loader=FileSystemLoader("{0}/_data_templates".format(BASEPATH)))
template_file = env.get_template("configuration-parameters.j2")
data = {}
data["schema"] = Config.schema()
rendered... | def build_configuration_parameters(app):
"""Create documentation for configuration parameters."""
env = Environment(loader=FileSystemLoader("{0}/_data_templates".format(BASEPATH)))
template_file = env.get_template("configuration-parameters.j2")
data = {}
data["schema"] = Config.schema()
rendered... | [
"Create",
"documentation",
"for",
"configuration",
"parameters",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/docs/conf.py#L183-L192 | [
"def",
"build_configuration_parameters",
"(",
"app",
")",
":",
"env",
"=",
"Environment",
"(",
"loader",
"=",
"FileSystemLoader",
"(",
"\"{0}/_data_templates\"",
".",
"format",
"(",
"BASEPATH",
")",
")",
")",
"template_file",
"=",
"env",
".",
"get_template",
"("... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | setup | Map methods to states of the documentation build. | docs/conf.py | def setup(app):
"""Map methods to states of the documentation build."""
app.connect("builder-inited", build_configuration_parameters)
app.connect("autodoc-skip-member", skip_slots)
app.add_stylesheet("css/custom.css") | def setup(app):
"""Map methods to states of the documentation build."""
app.connect("builder-inited", build_configuration_parameters)
app.connect("autodoc-skip-member", skip_slots)
app.add_stylesheet("css/custom.css") | [
"Map",
"methods",
"to",
"states",
"of",
"the",
"documentation",
"build",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/docs/conf.py#L195-L199 | [
"def",
"setup",
"(",
"app",
")",
":",
"app",
".",
"connect",
"(",
"\"builder-inited\"",
",",
"build_configuration_parameters",
")",
"app",
".",
"connect",
"(",
"\"autodoc-skip-member\"",
",",
"skip_slots",
")",
"app",
".",
"add_stylesheet",
"(",
"\"css/custom.css\... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
train | load_yaml | Loads a yaml file.
Arguments:
file: path to the file containing the yaml file to load
Examples:
Simple example with ``ordered_dict``::
> nr.run(task=load_yaml,
file="mydata.yaml")
Returns:
Result object with the following attributes set:
... | nornir/plugins/tasks/data/load_yaml.py | def load_yaml(task: Task, file: str) -> Result:
"""
Loads a yaml file.
Arguments:
file: path to the file containing the yaml file to load
Examples:
Simple example with ``ordered_dict``::
> nr.run(task=load_yaml,
file="mydata.yaml")
Returns:
... | def load_yaml(task: Task, file: str) -> Result:
"""
Loads a yaml file.
Arguments:
file: path to the file containing the yaml file to load
Examples:
Simple example with ``ordered_dict``::
> nr.run(task=load_yaml,
file="mydata.yaml")
Returns:
... | [
"Loads",
"a",
"yaml",
"file",
"."
] | nornir-automation/nornir | python | https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/data/load_yaml.py#L6-L28 | [
"def",
"load_yaml",
"(",
"task",
":",
"Task",
",",
"file",
":",
"str",
")",
"->",
"Result",
":",
"with",
"open",
"(",
"file",
",",
"\"r\"",
")",
"as",
"f",
":",
"yml",
"=",
"ruamel",
".",
"yaml",
".",
"YAML",
"(",
"typ",
"=",
"\"safe\"",
")",
"... | 3425c47fd870db896cb80f619bae23bd98d50c74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.