Skip to content

templates

Boardfarm templates package.

Modules:

Name Description
acs

Boardfarm ACS device template.

aftr

Boardfarm AFTR template.

core_router

Core Router Template.

cpe

Boardfarm LGI shared CPE templates.

lan

Boardfarm LAN device template.

line_termination

Generic Template for Line Termination Systems.

pdu

Define the PDU template.

provisioner

Provisioner device template.

sip_phone

SIPPhone Template module.

sip_server

SIPServer Template module.

tftp

Boardfarm TFTP device template.

wan

Boardfarm WAN device template.

wlan

Boardfarm WLAN device template.

acs

Boardfarm ACS device template.

Classes:

Name Description
ACS

Boardfarm ACS device template.

ACS

Boardfarm ACS device template.

Methods:

Name Description
AddObject

Execute AddOjbect RPC call for the specified parameter.

DelObject

Execute DeleteObject RPC call for the specified parameter.

Download

Execute Download RPC.

FactoryReset

Execute FactoryReset RPC.

GPA

Execute GetParameterAttributes RPC call for the specified parameter.

GPN

Execute GetParameterNames RPC call for the specified parameter.

GPV

Execute GetParameterValues RPC call for the specified parameter(s).

GetRPCMethods

Execute GetRPCMethods RPC.

Reboot

Execute Reboot RPC.

SPA

Execute SetParameterAttributes RPC call for the specified parameter.

SPV

Execute SetParameterValues RPC call for the specified parameter.

ScheduleInform

Execute ScheduleInform RPC.

delete_file

Delete the file from the device.

provision_cpe_via_tr069

Provision the cpe with tr069 parameters defined in env json.

scp_device_file_to_local

Copy a local file from a server using SCP.

start_tcpdump

Start tcpdump capture on given interface.

stop_tcpdump

Stop tcpdump capture.

Attributes:

Name Type Description
console BoardfarmPexpect

Returns ACS console.

firewall IptablesFirewall

Returns Firewall iptables instance.

ipv4_addr str

Return the IPv4 address on IFACE facing DUT.

ipv6_addr str

Return the IPv6 address on IFACE facing DUT.

url str

Returns the acs url used.

console abstractmethod property

Returns ACS console.

Returns:

Type Description
BoardfarmPexpect

console

firewall abstractmethod property

firewall: IptablesFirewall

Returns Firewall iptables instance.

Returns:

Type Description
IptablesFirewall

firewall iptables instance with console object

ipv4_addr abstractmethod cached property

ipv4_addr: str

Return the IPv4 address on IFACE facing DUT.

Returns:

Type Description
str

IPv4 address in string format.

ipv6_addr abstractmethod cached property

ipv6_addr: str

Return the IPv6 address on IFACE facing DUT.

Returns:

Type Description
str

IPv6 address in string format.

url abstractmethod property

url: str

Returns the acs url used.

Returns:

Type Description
str

acs url component instance

AddObject abstractmethod

AddObject(param: str, param_key: str = '', cpe_id: str | None = None) -> list[dict]

Execute AddOjbect RPC call for the specified parameter.

Parameters:

Name Type Description Default
param
str

parameter to be used to add

required
param_key
str

the value to set the ParameterKey parameter, defaults to ""

''
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

list of dictionary with key, value, type indicating the AddObject

Source code in boardfarm3/templates/acs.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
@abstractmethod
def AddObject(
    self,
    param: str,
    param_key: str = "",
    cpe_id: str | None = None,
) -> list[dict]:
    """Execute AddOjbect RPC call for the specified parameter.

    :param param: parameter to be used to add
    :type param: str
    :param param_key: the value to set the ParameterKey parameter, defaults to ""
    :type param_key: str
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: list of dictionary with key, value, type indicating the AddObject
    :rtype: list[dict]
    """
    raise NotImplementedError

DelObject abstractmethod

DelObject(param: str, param_key: str = '', cpe_id: str | None = None) -> list[dict]

Execute DeleteObject RPC call for the specified parameter.

Parameters:

Name Type Description Default
param
str

parameter to be used to delete

required
param_key
str

the value to set the ParameterKey parameter, defaults to ""

''
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

list of dictionary with key, value, type indicating the DelObject

Source code in boardfarm3/templates/acs.py
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
@abstractmethod
def DelObject(
    self,
    param: str,
    param_key: str = "",
    cpe_id: str | None = None,
) -> list[dict]:
    """Execute DeleteObject RPC call for the specified parameter.

    :param param: parameter to be used to delete
    :type param: str
    :param param_key: the value to set the ParameterKey parameter, defaults to ""
    :type param_key: str
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: list of dictionary with key, value, type indicating the DelObject
    :rtype: list[dict]
    """
    raise NotImplementedError

Download abstractmethod

Download(
    url: str,
    filetype: str = "1 Firmware Upgrade Image",
    targetfilename: str = "",
    filesize: int = 200,
    username: str = "",
    password: str = "",
    commandkey: str = "",
    delayseconds: int = 10,
    successurl: str = "",
    failureurl: str = "",
    cpe_id: str | None = None,
) -> list[dict]

Execute Download RPC.

Parameters:

Name Type Description Default
url
str

URL to download file

required
filetype
str

the string paramenter from following 6 values only .. code-block:: python [ "1 Firmware Upgrade Image", "2 Web Content", "3 Vendor Configuration File", "4 Tone File", "5 Ringer File", "6 Stored Firmware Image", ]

'1 Firmware Upgrade Image'
targetfilename
str

TargetFileName to download through RPC

''
filesize
int

the size of file to download in bytes

200
username
str

User to authenticate with file Server. Default=""

''
password
str

Password to authenticate with file Server. Default=""

''
commandkey
str

the string paramenter passed in Download API

''
delayseconds
int

delay of seconds in integer

10
successurl
str

URL to access in case of Download API execution succeeded

''
failureurl
str

URL to access in case of Download API execution Failed

''
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

returns Download response

Source code in boardfarm3/templates/acs.py
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
@abstractmethod
def Download(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    url: str,
    filetype: str = "1 Firmware Upgrade Image",
    targetfilename: str = "",
    filesize: int = 200,
    username: str = "",
    password: str = "",
    commandkey: str = "",
    delayseconds: int = 10,
    successurl: str = "",
    failureurl: str = "",
    cpe_id: str | None = None,
) -> list[dict]:
    """Execute Download RPC.

    :param url: URL to download file
    :type url: str
    :param filetype: the string paramenter from following 6 values only

        .. code-block:: python

            [
                "1 Firmware Upgrade Image",
                "2 Web Content",
                "3 Vendor Configuration File",
                "4 Tone File",
                "5 Ringer File",
                "6 Stored Firmware Image",
            ]

    :type filetype: str
    :param targetfilename: TargetFileName to download through RPC
    :type targetfilename: str
    :param filesize: the size of file to download in bytes
    :type filesize: int
    :param username: User to authenticate with file Server.  Default=""
    :type username: str
    :param password: Password to authenticate with file Server. Default=""
    :type password: str
    :param commandkey: the string paramenter passed in Download API
    :type commandkey: str
    :param delayseconds: delay of seconds in integer
    :type delayseconds: int
    :param successurl: URL to access in case of Download API execution succeeded
    :type successurl: str
    :param failureurl: URL to access in case of Download API execution Failed
    :type failureurl: str
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: returns Download response
    :rtype: list[dict]
    """
    raise NotImplementedError

FactoryReset abstractmethod

FactoryReset(cpe_id: str | None = None) -> list[dict]

Execute FactoryReset RPC.

Note: This method only informs if the FactoryReset request initiated or not. The wait for the reboot of the device has to be handled in the test.

Parameters:

Name Type Description Default
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

factory reset response

Source code in boardfarm3/templates/acs.py
158
159
160
161
162
163
164
165
166
167
168
169
170
@abstractmethod
def FactoryReset(self, cpe_id: str | None = None) -> list[dict]:
    """Execute FactoryReset RPC.

    Note: This method only informs if the FactoryReset request initiated or not.
    The wait for the reboot of the device has to be handled in the test.

    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: factory reset response
    :rtype: list[dict]
    """
    raise NotImplementedError

GPA abstractmethod

GPA(param: str, cpe_id: str | None = None) -> list[dict]

Execute GetParameterAttributes RPC call for the specified parameter.

Example usage:

acs_server.GPA("Device.WiFi.SSID.1.SSID")

Parameters:

Name Type Description Default
param
str

parameter to be used in get

required
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

dictionary with keys Name, AccessList, Notification indicating the GPA

Source code in boardfarm3/templates/acs.py
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@abstractmethod
def GPA(self, param: str, cpe_id: str | None = None) -> list[dict]:
    """Execute GetParameterAttributes RPC call for the specified parameter.

    Example usage:

    >>> acs_server.GPA("Device.WiFi.SSID.1.SSID")

    :param param: parameter to be used in get
    :type param: str
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: dictionary with keys Name, AccessList, Notification indicating the GPA
    :rtype: list[dict]
    """
    raise NotImplementedError

GPN abstractmethod

GPN(
    param: str, next_level: bool, timeout: int | None = None, cpe_id: str | None = None
) -> list[dict]

Execute GetParameterNames RPC call for the specified parameter.

Parameters:

Name Type Description Default
param
str

parameter to be discovered

required
next_level
bool

displays the next level children of the object if marked true

required
timeout
int | None

Lifetime Expiry time

None
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

value as a list of dictionary

Source code in boardfarm3/templates/acs.py
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
@abstractmethod
def GPN(
    self,
    param: str,
    next_level: bool,
    timeout: int | None = None,
    cpe_id: str | None = None,
) -> list[dict]:
    """Execute GetParameterNames RPC call for the specified parameter.

    :param param: parameter to be discovered
    :type param: str
    :param next_level: displays the next level children of the object if marked true
    :type next_level: bool
    :param timeout: Lifetime Expiry time
    :type timeout: Optional[int]
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: value as a list of dictionary
    :rtype: list[dict]
    """
    raise NotImplementedError

GPV abstractmethod

GPV(
    param: GpvInput, timeout: int | None = None, cpe_id: str | None = None
) -> GpvResponse

Execute GetParameterValues RPC call for the specified parameter(s).

Parameters:

Name Type Description Default
param
GpvInput

name of the parameter(s) to perform RPC

required
timeout
int | None

to set the Lifetime Expiry time, defaults to None

None
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
GpvResponse

GPV response with keys, value and datatype Example: .. code-block:: python [ { "key": "Device.WiFi.AccessPoint.1.AC.1.Alias", "value": "mok_1", "type": "string", } ]

Source code in boardfarm3/templates/acs.py
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@abstractmethod
def GPV(
    self,
    param: GpvInput,
    timeout: int | None = None,
    cpe_id: str | None = None,
) -> GpvResponse:
    """Execute GetParameterValues RPC call for the specified parameter(s).

    :param param: name of the parameter(s) to perform RPC
    :type param: GpvInput
    :param timeout: to set the Lifetime Expiry time, defaults to None
    :type timeout: Optional[int]
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: GPV response with keys, value and datatype
        Example:

        .. code-block:: python

            [
                {
                    "key": "Device.WiFi.AccessPoint.1.AC.1.Alias",
                    "value": "mok_1",
                    "type": "string",
                }
            ]

    :rtype: GpvResponse
    """
    raise NotImplementedError

GetRPCMethods abstractmethod

GetRPCMethods(cpe_id: str | None = None) -> list[dict]

Execute GetRPCMethods RPC.

Parameters:

Name Type Description Default
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

GetRPCMethods response of supported functions

Source code in boardfarm3/templates/acs.py
271
272
273
274
275
276
277
278
279
280
@abstractmethod
def GetRPCMethods(self, cpe_id: str | None = None) -> list[dict]:
    """Execute GetRPCMethods RPC.

    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: GetRPCMethods response of supported functions
    :rtype: list[dict]
    """
    raise NotImplementedError

Reboot abstractmethod

Reboot(CommandKey: str, cpe_id: str | None = None) -> list[dict]

Execute Reboot RPC.

Parameters:

Name Type Description Default
CommandKey
str

reboot command key

required
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

reboot RPC response

Source code in boardfarm3/templates/acs.py
172
173
174
175
176
177
178
179
180
181
182
183
@abstractmethod
def Reboot(self, CommandKey: str, cpe_id: str | None = None) -> list[dict]:
    """Execute Reboot RPC.

    :param CommandKey: reboot command key
    :type CommandKey: str
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: reboot RPC response
    :rtype: list[dict]
    """
    raise NotImplementedError

SPA abstractmethod

SPA(
    param: list[dict] | dict,
    notification_param: bool = True,
    access_param: bool = False,
    access_list: list | None = None,
    cpe_id: str | None = None,
) -> list[dict]

Execute SetParameterAttributes RPC call for the specified parameter.

Example usage:

(acs_server.SPA({"Device.WiFi.SSID.1.SSID": "1"}),)

could be parameter list of dicts/dict containing param name and notifications

Parameters:

Name Type Description Default
param
list[dict] | dict

parameter as key of dictionary and notification as its value

required
notification_param
bool

If True, the value of Notification replaces the current notification setting for this Parameter or group of Parameters. If False, no change is made to the notification setting

True
access_param
bool

If True, the value of AccessList replaces the current access list for this Parameter or group of Parameters. If False, no change is made to the access list

False
access_list
list | None

Array of zero or more entities for which write access to the specified Parameter(s) is granted

None
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

SPA response

Source code in boardfarm3/templates/acs.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
@abstractmethod
def SPA(
    self,
    param: list[dict] | dict,
    notification_param: bool = True,
    access_param: bool = False,
    access_list: list | None = None,
    cpe_id: str | None = None,
) -> list[dict]:
    """Execute SetParameterAttributes RPC call for the specified parameter.

    Example usage:

    >>> (acs_server.SPA({"Device.WiFi.SSID.1.SSID": "1"}),)

    could be parameter list of dicts/dict containing param name and notifications

    :param param: parameter as key of dictionary and notification as its value
    :type param: Union[list[dict], dict]
    :param notification_param: If True, the value of Notification replaces the
        current notification setting for this Parameter or group of Parameters.
        If False, no change is made to the notification setting
    :type notification_param: bool
    :param access_param: If True, the value of AccessList replaces the current
        access list for this Parameter or group of Parameters.
        If False, no change is made to the access list
    :type access_param: bool
    :param access_list: Array of zero or more entities for which write access to
        the specified Parameter(s) is granted
    :type access_list: list, optional
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: SPA response
    :rtype: list[dict]
    """
    raise NotImplementedError

SPV abstractmethod

SPV(
    param_value: SpvInput, timeout: int | None = None, cpe_id: str | None = None
) -> int

Execute SetParameterValues RPC call for the specified parameter.

Parameters:

Name Type Description Default
param_value
SpvInput

dictionary that contains the path to the key and the value to be set. Example: .. code-block:: python {"Device.WiFi.AccessPoint.1.AC.1.Alias": "mok_1"}

required
timeout
int | None

wait time for the RPC to complete, defaults to None

None
cpe_id
str | None

CPE identifier, defaults to None

None

Returns:

Type Description
int

status of the SPV, either 0 or 1

Source code in boardfarm3/templates/acs.py
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@abstractmethod
def SPV(
    self,
    param_value: SpvInput,
    timeout: int | None = None,
    cpe_id: str | None = None,
) -> int:
    """Execute SetParameterValues RPC call for the specified parameter.

    :param param_value: dictionary that contains the path to the key and
        the value to be set. Example:
        .. code-block:: python

            {"Device.WiFi.AccessPoint.1.AC.1.Alias": "mok_1"}

    :type param_value: SpvInput
    :param timeout: wait time for the RPC to complete, defaults to None
    :type timeout: Optional[int]
    :param cpe_id: CPE identifier, defaults to None
    :type cpe_id: Optional[str]
    :return: status of the SPV, either 0 or 1
    :rtype: int
    """
    raise NotImplementedError

ScheduleInform abstractmethod

ScheduleInform(
    CommandKey: str = "Test", DelaySeconds: int = 20, cpe_id: str | None = None
) -> list[dict]

Execute ScheduleInform RPC.

Parameters:

Name Type Description Default
CommandKey
str

string to return in the CommandKey element of the InformStruct when the CPE calls the Inform method, defaults to "Test"

'Test'
DelaySeconds
int

number of seconds from the time this method is called to the time the CPE is requested to initiate a one-time Inform method call, defaults to 20

20
cpe_id
str | None

cpe identifier, defaults to None

None

Returns:

Type Description
list[dict]

returns ScheduleInform response

Source code in boardfarm3/templates/acs.py
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
@abstractmethod
def ScheduleInform(
    self,
    CommandKey: str = "Test",
    DelaySeconds: int = 20,
    cpe_id: str | None = None,
) -> list[dict]:
    """Execute ScheduleInform RPC.

    :param CommandKey: string to return in the CommandKey element of the
        InformStruct when the CPE calls the Inform method, defaults to "Test"
    :type CommandKey: str
    :param DelaySeconds: number of seconds from the time this method is
        called to the time the CPE is requested to initiate a one-time Inform
        method call, defaults to 20
    :type DelaySeconds: int
    :param cpe_id: cpe identifier, defaults to None
    :type cpe_id: Optional[str], optional
    :return: returns ScheduleInform response
    :rtype: list[dict]
    """
    raise NotImplementedError

delete_file abstractmethod

delete_file(filename: str) -> None

Delete the file from the device.

Parameters:

Name Type Description Default
filename
str

name of the file with absolute path

required
Source code in boardfarm3/templates/acs.py
353
354
355
356
357
358
359
360
@abstractmethod
def delete_file(self, filename: str) -> None:
    """Delete the file from the device.

    :param filename: name of the file with absolute path
    :type filename: str
    """
    raise NotImplementedError

provision_cpe_via_tr069 abstractmethod

provision_cpe_via_tr069(
    tr069provision_api_list: list[dict[str, list[dict[str, str]]]], cpe_id: str
) -> None

Provision the cpe with tr069 parameters defined in env json.

Parameters:

Name Type Description Default
tr069provision_api_list
list[dict[str, list[dict[str, str]]]]

List of tr069 operations and their values

required
cpe_id
str

cpe identifier

required
Source code in boardfarm3/templates/acs.py
338
339
340
341
342
343
344
345
346
347
348
349
350
351
@abstractmethod
def provision_cpe_via_tr069(
    self,
    tr069provision_api_list: list[dict[str, list[dict[str, str]]]],
    cpe_id: str,
) -> None:
    """Provision the cpe with tr069 parameters defined in env json.

    :param tr069provision_api_list: List of tr069 operations and their values
    :type tr069provision_api_list: list[dict[str, list[dict[str, str]]]]
    :param cpe_id: cpe identifier
    :type cpe_id: str
    """
    raise NotImplementedError

scp_device_file_to_local abstractmethod

scp_device_file_to_local(local_path: str, source_path: str) -> None

Copy a local file from a server using SCP.

Parameters:

Name Type Description Default
local_path
str

local file path

required
source_path
str

source path

required
Source code in boardfarm3/templates/acs.py
362
363
364
365
366
367
368
369
@abstractmethod
def scp_device_file_to_local(self, local_path: str, source_path: str) -> None:
    """Copy a local file from a server using SCP.

    :param local_path: local file path
    :param source_path: source path
    """
    raise NotImplementedError

start_tcpdump abstractmethod

start_tcpdump(
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str

Start tcpdump capture on given interface.

Parameters:

Name Type Description Default
interface
str

inteface name where packets to be captured

required
port
str | None

port number, can be a range of ports(eg: 443 or 433-443)

required
output_file
str

pcap file name, Defaults: pkt_capture.pcap

'pkt_capture.pcap'
filters
dict | None

filters as key value pair(eg: {"-v": "", "-c": "4"})

None
additional_filters
str | None

additional filters

''

Returns:

Type Description
str

console ouput and tcpdump process id

Raises:

Type Description
ValueError

on failed to start tcpdump

Source code in boardfarm3/templates/acs.py
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
@abstractmethod
def start_tcpdump(
    self,
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str:
    """Start tcpdump capture on given interface.

    :param interface: inteface name where packets to be captured
    :type interface: str
    :param port: port number, can be a range of ports(eg: 443 or 433-443)
    :type port: str
    :param output_file: pcap file name, Defaults: pkt_capture.pcap
    :type output_file: str
    :param filters: filters as key value pair(eg: {"-v": "", "-c": "4"})
    :type filters: Optional[Dict]
    :param additional_filters: additional filters
    :type additional_filters: Optional[str]
    :raises ValueError: on failed to start tcpdump
    :return: console ouput and tcpdump process id
    :rtype: str
    """
    raise NotImplementedError

stop_tcpdump abstractmethod

stop_tcpdump(process_id: str) -> None

Stop tcpdump capture.

Parameters:

Name Type Description Default
process_id
str

tcpdump process id

required
Source code in boardfarm3/templates/acs.py
428
429
430
431
432
433
434
435
@abstractmethod
def stop_tcpdump(self, process_id: str) -> None:
    """Stop tcpdump capture.

    :param process_id: tcpdump process id
    :type process_id: str
    """
    raise NotImplementedError

aftr

Boardfarm AFTR template.

Classes:

Name Description
AFTR

Boardfarm AFTR template.

AFTR

Boardfarm AFTR template.

Methods:

Name Description
configure_aftr

Configure aftr.

restart_aftr_process

Restart aftr proess.

configure_aftr abstractmethod

configure_aftr(wan: WAN) -> None

Configure aftr.

Parameters:

Name Type Description Default
wan
WAN

WAN Device

required
Source code in boardfarm3/templates/aftr.py
11
12
13
14
15
16
17
18
@abstractmethod
def configure_aftr(self, wan: WAN) -> None:
    """Configure aftr.

    :param wan: WAN Device
    :type wan: WAN
    """
    raise NotImplementedError

restart_aftr_process abstractmethod

restart_aftr_process(wan: WAN) -> None

Restart aftr proess.

This is to ensure the ipv4 connectivity.

Parameters:

Name Type Description Default
wan
WAN

WAN Device

required
Source code in boardfarm3/templates/aftr.py
20
21
22
23
24
25
26
27
28
29
@abstractmethod
def restart_aftr_process(self, wan: WAN) -> None:
    """Restart aftr proess.

    This is to ensure the ipv4 connectivity.

    :param wan: WAN Device
    :type wan: WAN
    """
    raise NotImplementedError

core_router

Core Router Template.

Classes:

Name Description
CoreRouter

Core Router Template.

CoreRouter

Core Router Template.

Methods:

Name Description
add_route

Add a route to a destination via a specific gateway interface.

delete_route

Delete a route to a destination.

get_interface_ipv4addr

Return ipv4 address of the interface.

get_interface_ipv6addr

Return ipv4 address of the interface.

is_link_up

Return the link status.

nmap

Perform nmap operation on linux device.

ping

Ping remote host.

Attributes:

Name Type Description
config dict

Device configuration.

console BoardfarmPexpect

Returns WAN console.

config abstractmethod property

config: dict

Device configuration.

console abstractmethod property

Returns WAN console.

Returns:

Type Description
BoardfarmPexpect

console

add_route abstractmethod

add_route(destination: str, hop: str, gw_interface: str | None) -> None

Add a route to a destination via a specific gateway interface.

The method will internally calculate the exit interface's ip address before adding the route. The gw_interface must be an interface name that exists on the host. Alternatively, you can provide a hop value.

Parameters:

Name Type Description Default
destination
str

ip address of the destination

required
hop
str

ip address of the hop

required
gw_interface
str | None

name of the interface

required
Source code in boardfarm3/templates/core_router.py
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
@abstractmethod
def add_route(self, destination: str, hop: str, gw_interface: str | None) -> None:
    """Add a route to a destination via a specific gateway interface.

    The method will internally calculate the exit interface's ip address
    before adding the route.
    The gw_interface must be an interface name that exists on the host.
    Alternatively, you can provide a hop value.

    :param destination: ip address of the destination
    :type destination: str
    :param hop: ip address of the hop
    :type hop: str
    :param gw_interface: name of the interface
    :type gw_interface: str | None
    """
    raise NotImplementedError

delete_route abstractmethod

delete_route(destination: str) -> None

Delete a route to a destination.

Parameters:

Name Type Description Default
destination
str

ip address of the destination

required
Source code in boardfarm3/templates/core_router.py
145
146
147
148
149
150
151
152
@abstractmethod
def delete_route(self, destination: str) -> None:
    """Delete a route to a destination.

    :param destination: ip address of the destination
    :type destination: str
    """
    raise NotImplementedError

get_interface_ipv4addr abstractmethod

get_interface_ipv4addr(interface: str) -> str

Return ipv4 address of the interface.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv4 of the interface

Raises:

Type Description
BoardfarmException

in case IPv4 is not found

Source code in boardfarm3/templates/core_router.py
31
32
33
34
35
36
37
38
39
@abstractmethod
def get_interface_ipv4addr(self, interface: str) -> str:
    """Return ipv4 address of the interface.

    :param interface: interface name
    :return: IPv4 of the interface
    :raises BoardfarmException: in case IPv4 is not found
    """
    raise NotImplementedError

get_interface_ipv6addr abstractmethod

get_interface_ipv6addr(interface: str) -> str

Return ipv4 address of the interface.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv6 of the interface

Raises:

Type Description
BoardfarmException

in case IPv6 is not found

Source code in boardfarm3/templates/core_router.py
41
42
43
44
45
46
47
48
49
@abstractmethod
def get_interface_ipv6addr(self, interface: str) -> str:
    """Return ipv4 address of the interface.

    :param interface: interface name
    :return: IPv6 of the interface
    :raises BoardfarmException: in case IPv6 is not found
    """
    raise NotImplementedError
is_link_up(interface: str, pattern: str = 'BROADCAST,MULTICAST,UP') -> bool

Return the link status.

Parameters:

Name Type Description Default
str

interface name, defaults to "BROADCAST,MULTICAST,UP"

required
str

interface state

'BROADCAST,MULTICAST,UP'

Returns:

Type Description
bool

True if the link is up

Source code in boardfarm3/templates/core_router.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@abstractmethod
def is_link_up(
    self,
    interface: str,
    pattern: str = "BROADCAST,MULTICAST,UP",
) -> bool:
    """Return the link status.

    :param interface: interface name, defaults to "BROADCAST,MULTICAST,UP"
    :type interface: str
    :param pattern: interface state
    :type pattern: str
    :return: True if the link is up
    :rtype: bool
    """
    raise NotImplementedError

nmap abstractmethod

nmap(
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
) -> dict

Perform nmap operation on linux device.

Parameters:

Name Type Description Default
ipaddr
str

ip address on which nmap is performed

required
ip_type
str

type of ip eg: ipv4/ipv6

required
port
str | int | None

destination port on ip, defaults to None

None
protocol
str | None

specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None

None
max_retries
int | None

number of port scan probe retransmissions, defaults to None

None
min_rate
int | None

Send packets no slower than per second, defaults to None

None
opts
str | None

other options for a nmap command, defaults to None

None

Returns:

Type Description
dict

response of nmap command in xml/dict format

Raises:

Type Description
BoardfarmException

Raises exception if ip type is invalid

Source code in boardfarm3/templates/core_router.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
@abstractmethod
def nmap(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
) -> dict:
    """Perform nmap operation on linux device.

    :param ipaddr: ip address on which nmap is performed
    :type ipaddr: str
    :param ip_type: type of ip eg: ipv4/ipv6
    :type ip_type: str
    :param port: destination port on ip, defaults to None
    :type port: Optional[Union[str, int]], optional
    :param protocol: specific protocol to follow eg: tcp(-sT)/udp(-sU),
        defaults to None
    :type protocol: Optional[str], optional
    :param max_retries: number of port scan probe retransmissions, defaults to None
    :type max_retries: Optional[int], optional
    :param min_rate: Send packets no slower than per second, defaults to None
    :type min_rate: Optional[int], optional
    :param opts: other options for a nmap command, defaults to None
    :type opts: str, optional
    :raises BoardfarmException: Raises exception if ip type is invalid
    :return: response of nmap command in xml/dict format
    :rtype: dict
    """
    raise NotImplementedError

ping abstractmethod

ping(
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict

Ping remote host.

Return True if ping has 0% loss or parsed output in JSON if json_output=True flag is provided.

Parameters:

Name Type Description Default
ping_ip
str

ping ip

required
ping_count
int

number of ping, defaults to 4

4
ping_interface
str | None

ping via interface, defaults to None

None
options
str

extra ping options, defaults to ""

''
timeout
int

timeout, defaults to 50

50
json_output
bool

return ping output in dictionary format, defaults to False

False

Returns:

Type Description
bool | dict

ping output

Source code in boardfarm3/templates/core_router.py
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@abstractmethod
def ping(  # noqa: PLR0913
    self,
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict:
    """Ping remote host.

    Return True if ping has 0% loss
    or parsed output in JSON if json_output=True flag is provided.

    :param ping_ip: ping ip
    :param ping_count: number of ping, defaults to 4
    :param ping_interface: ping via interface, defaults to None
    :param options: extra ping options, defaults to ""
    :param timeout: timeout, defaults to 50
    :param json_output: return ping output in dictionary format, defaults to False
    :return: ping output
    """
    raise NotImplementedError

cpe

Boardfarm LGI shared CPE templates.

Modules:

Name Description
cpe

CPE template.

cpe_hw

CPE HW Template.

cpe_sw

CPE SW Template.

Classes:

Name Description
CPE

CPE Template.

CPEHW

CPE hardware template.

CPESW

CPE Software Template.

CPE

CPE Template.

Attributes:

Name Type Description
config dict

Device configuration.

hw CPEHW

CPE Hardware.

sw CPESW

CPE Software.

config abstractmethod property

config: dict

Device configuration.

hw abstractmethod property

hw: CPEHW

CPE Hardware.

sw abstractmethod property

sw: CPESW

CPE Software.

CPEHW

CPE hardware template.

Methods:

Name Description
connect_to_consoles

Connect to the consoles.

disconnect_from_consoles

Disconnect/Close the console connections.

flash_via_bootloader

Flash cable modem via the bootloader.

get_console

Return console instance with the given name.

get_interactive_consoles

Get interactive consoles of the device.

power_cycle

Power cycle the board via HW (usually via a PDU device).

wait_for_hw_boot

Wait for the HW boot messages(bootloader).

Attributes:

Name Type Description
config dict[str, Any]

Device config.

mac_address str

Get the MAC address.

mta_iface str

MTA interface name.

wan_iface str

WAN interface name.

config abstractmethod property

config: dict[str, Any]

Device config.

mac_address abstractmethod property

mac_address: str

Get the MAC address.

mta_iface abstractmethod property

mta_iface: str

MTA interface name.

wan_iface abstractmethod property

wan_iface: str

WAN interface name.

connect_to_consoles abstractmethod

connect_to_consoles(device_name: str) -> None

Connect to the consoles.

Parameters:

Name Type Description Default
device_name
str

name of the device

required
Source code in boardfarm3/templates/cpe/cpe_hw.py
45
46
47
48
49
50
51
52
@abstractmethod
def connect_to_consoles(self, device_name: str) -> None:
    """Connect to the consoles.

    :param device_name: name of the device
    :type device_name: str
    """
    raise NotImplementedError

disconnect_from_consoles abstractmethod

disconnect_from_consoles() -> None

Disconnect/Close the console connections.

Source code in boardfarm3/templates/cpe/cpe_hw.py
 99
100
101
102
@abstractmethod
def disconnect_from_consoles(self) -> None:
    """Disconnect/Close the console connections."""
    raise NotImplementedError

flash_via_bootloader abstractmethod

flash_via_bootloader(
    image: str,
    tftp_devices: dict[str, TFTP],
    termination_sys: TerminationSystem = None,
    method: str | None = None,
) -> None

Flash cable modem via the bootloader.

Parameters:

Name Type Description Default
image
str

image name

required
tftp_devices
dict[str, TFTP]

a list of LAN side TFTP devices

required
termination_sys
TerminationSystem

the termination system device (e.g. CMTS), defaults to None

None
method
str | None

flash method, defaults to None

None

Raises:

Type Description
NotImplementedError

as a safety measure

Source code in boardfarm3/templates/cpe/cpe_hw.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@abstractmethod
def flash_via_bootloader(
    self,
    image: str,
    tftp_devices: dict[str, TFTP],
    termination_sys: TerminationSystem = None,
    method: str | None = None,
) -> None:
    """Flash cable modem via the bootloader.

    :param image: image name
    :type image: str
    :param tftp_devices: a list of LAN side TFTP devices
    :type tftp_devices: dict[str, TFTP]
    :param termination_sys: the termination system device (e.g. CMTS),
        defaults to None
    :type termination_sys: TerminationSystem
    :param method: flash method, defaults to None
    :type method: str, optional
    :raises NotImplementedError: as a safety measure
    """
    raise NotImplementedError

get_console abstractmethod

get_console(console_name: str) -> BoardfarmPexpect

Return console instance with the given name.

Parameters:

Name Type Description Default
console_name
str

name of the console

required

Returns:

Type Description
BoardfarmPexpect

console instance with given name

Raises:

Type Description
ValueError

on unknown console name

Source code in boardfarm3/templates/cpe/cpe_hw.py
54
55
56
57
58
59
60
61
62
63
64
@abstractmethod
def get_console(self, console_name: str) -> BoardfarmPexpect:
    """Return console instance with the given name.

    :param console_name: name of the console
    :type console_name: str
    :raises ValueError: on unknown console name
    :return: console instance with given name
    :rtype: BoardfarmPexpect
    """
    raise NotImplementedError

get_interactive_consoles abstractmethod

get_interactive_consoles() -> dict[str, BoardfarmPexpect]

Get interactive consoles of the device.

Returns:

Type Description
Dict[str, BoardfarmPexpect]

device interactive consoles

Source code in boardfarm3/templates/cpe/cpe_hw.py
104
105
106
107
108
109
110
111
@abstractmethod
def get_interactive_consoles(self) -> dict[str, BoardfarmPexpect]:
    """Get interactive consoles of the device.

    :returns: device interactive consoles
    :rtype: Dict[str, BoardfarmPexpect]
    """
    raise NotImplementedError

power_cycle abstractmethod

power_cycle() -> None

Power cycle the board via HW (usually via a PDU device).

Source code in boardfarm3/templates/cpe/cpe_hw.py
66
67
68
69
@abstractmethod
def power_cycle(self) -> None:
    """Power cycle the board via HW (usually via a PDU device)."""
    raise NotImplementedError

wait_for_hw_boot abstractmethod

wait_for_hw_boot() -> None

Wait for the HW boot messages(bootloader).

Source code in boardfarm3/templates/cpe/cpe_hw.py
71
72
73
74
@abstractmethod
def wait_for_hw_boot(self) -> None:
    """Wait for the HW boot messages(bootloader)."""
    raise NotImplementedError

CPESW

CPE Software Template.

Methods:

Name Description
add_info_to_file

Add data into a file.

enable_logs

Enable logs for given component.

factory_reset

Perform factory reset CPE via given method.

finalize_boot

Validate board settings post boot.

get_board_logs

Return board console logs for given timeout.

get_boottime_log

Return the boot time log from the board.

get_date

Get the system date and time.

get_file_content

Get the content of the given file.

get_interface_ipv4addr

Return given interface IPv4 address.

get_interface_ipv6addr

Return given interface IPv6 address.

get_interface_link_local_ipv6_addr

Return given interface link local IPv6 address.

get_interface_mac_addr

Return given interface mac address.

get_interface_mtu_size

Get the MTU size of the interface in bytes.

get_load_avg

Return current load average of the CPE.

get_memory_utilization

Return the current memory utilization of the CPE.

get_ntp_sync_status

Execute ntpq command to get the synchronization status.

get_provision_mode

Return provision mode.

get_running_processes

Return the currently running processes in the CPE via the ps command.

get_seconds_uptime

Return uptime in seconds.

get_tr069_log

Return the TR-069 log from the board.

is_link_up

Return the link status.

is_online

Is CPE online.

is_production

Is production software.

is_tr069_connected

Is TR-69 agent is connected.

kill_process_immediately

Kills any process based on the provided process ID.

read_event_logs

Return the event logs from the logread command.

reset

Perform reset via given method.

set_date

Set the device's date and time.

verify_cpe_is_booting

Verify CPE is booting.

wait_for_boot

Wait for CPE to boot.

Attributes:

Name Type Description
aftr_iface str

AFTR interface name.

cpe_id str

TR069 CPE ID.

dmcli DMCLIAPI

Dmcli instance running in CPE Software (if any).

erouter_iface str

e-Router interface name.

firewall IptablesFirewall

Firewall component of cpe software.

guest_iface str

Guest network interface name.

gui_password str

GUI login password.

json_values dict[str, Any]

CPE Specific JSON values.

lan_gateway_ipv4 IPv4Address

LAN Gateway IPv4 address.

lan_gateway_ipv6 IPv6Address

LAN Gateway IPv6 address.

lan_iface str

LAN interface name.

lan_network_ipv4 IPv4Network

LAN IPv4 network.

nw_utility NetworkUtility

Network utility component of cpe software.

tr69_cpe_id str

TR-69 CPE Identifier.

version str

CPE software version.

wifi WiFiHal

Wifi instance CPE Software.

aftr_iface abstractmethod property

aftr_iface: str

AFTR interface name.

cpe_id abstractmethod property

cpe_id: str

TR069 CPE ID.

dmcli abstractmethod property

dmcli: DMCLIAPI

Dmcli instance running in CPE Software (if any).

erouter_iface abstractmethod property

erouter_iface: str

e-Router interface name.

firewall abstractmethod property

firewall: IptablesFirewall

Firewall component of cpe software.

guest_iface abstractmethod property

guest_iface: str

Guest network interface name.

gui_password abstractmethod property

gui_password: str

GUI login password.

json_values abstractmethod property

json_values: dict[str, Any]

CPE Specific JSON values.

lan_gateway_ipv4 abstractmethod property

lan_gateway_ipv4: IPv4Address

LAN Gateway IPv4 address.

lan_gateway_ipv6 abstractmethod property

lan_gateway_ipv6: IPv6Address

LAN Gateway IPv6 address.

lan_iface abstractmethod property

lan_iface: str

LAN interface name.

lan_network_ipv4 abstractmethod property

lan_network_ipv4: IPv4Network

LAN IPv4 network.

nw_utility abstractmethod property

nw_utility: NetworkUtility

Network utility component of cpe software.

tr69_cpe_id abstractmethod property

tr69_cpe_id: str

TR-69 CPE Identifier.

version abstractmethod property

version: str

CPE software version.

This will reload after each flash.

wifi abstractmethod property

wifi: WiFiHal

Wifi instance CPE Software.

add_info_to_file abstractmethod

add_info_to_file(to_add: str, fname: str) -> None

Add data into a file.

Parameters:

Name Type Description Default
to_add
str

contents/data to be added to a file.

required
fname
str

filename with absolute path

required
Source code in boardfarm3/templates/cpe/cpe_sw.py
342
343
344
345
346
347
348
349
350
351
@abstractmethod
def add_info_to_file(self, to_add: str, fname: str) -> None:
    """Add data into a file.

    :param to_add: contents/data to be added to a file.
    :type to_add: str
    :param fname: filename with absolute path
    :type fname: str
    """
    raise NotImplementedError

enable_logs abstractmethod

enable_logs(component: str, flag: str = 'enable') -> None

Enable logs for given component.

Parameters:

Name Type Description Default
component
str

component name

required
flag
str

flag name, Default: "enable"

'enable'
Source code in boardfarm3/templates/cpe/cpe_sw.py
248
249
250
251
252
253
254
255
@abstractmethod
def enable_logs(self, component: str, flag: str = "enable") -> None:
    """Enable logs for given component.

    :param component: component name
    :param flag: flag name, Default: "enable"
    """
    raise NotImplementedError

factory_reset abstractmethod

factory_reset(method: str | None = None) -> bool

Perform factory reset CPE via given method.

Parameters:

Name Type Description Default
method
str | None

factory reset method. Default None.

None

Returns:

Type Description
bool

True on successful factory reset, False otherwise

Source code in boardfarm3/templates/cpe/cpe_sw.py
139
140
141
142
143
144
145
146
147
@abstractmethod
def factory_reset(self, method: str | None = None) -> bool:
    """Perform factory reset CPE via given method.

    :param method: factory reset method. Default None.
    :type method: str | None
    :return: True on successful factory reset, False otherwise
    """
    raise NotImplementedError

finalize_boot abstractmethod

finalize_boot() -> bool

Validate board settings post boot.

Returns:

Type Description
bool

True on successful validation

Source code in boardfarm3/templates/cpe/cpe_sw.py
381
382
383
384
385
386
387
@abstractmethod
def finalize_boot(self) -> bool:
    """Validate board settings post boot.

    :return: True on successful validation
    """
    raise NotImplementedError

get_board_logs abstractmethod

get_board_logs(timeout: int = 300) -> str

Return board console logs for given timeout.

Parameters:

Name Type Description Default
timeout
int

log capture time in seconds

300

Returns:

Type Description
str

captured logs

Source code in boardfarm3/templates/cpe/cpe_sw.py
257
258
259
260
261
262
263
264
@abstractmethod
def get_board_logs(self, timeout: int = 300) -> str:
    """Return board console logs for given timeout.

    :param timeout: log capture time in seconds
    :return: captured logs
    """
    raise NotImplementedError

get_boottime_log abstractmethod

get_boottime_log() -> list[str]

Return the boot time log from the board.

Returns:

Type Description
list[str]

boot time log

Source code in boardfarm3/templates/cpe/cpe_sw.py
311
312
313
314
315
316
317
318
@abstractmethod
def get_boottime_log(self) -> list[str]:
    """Return the boot time log from the board.

    :return: boot time log
    :rtype: list[str]
    """
    raise NotImplementedError

get_date abstractmethod

get_date() -> str | None

Get the system date and time.

.. code-block:: python

# example output
donderdag, mei 23, 2024 14:23:39

Returns:

Type Description
str | None

date

Source code in boardfarm3/templates/cpe/cpe_sw.py
353
354
355
356
357
358
359
360
361
362
363
364
365
366
@abstractmethod
def get_date(self) -> str | None:
    """Get the system date and time.

    .. code-block:: python

        # example output
        donderdag, mei 23, 2024 14:23:39


    :return: date
    :rtype: str | None
    """
    raise NotImplementedError

get_file_content abstractmethod

get_file_content(fname: str, timeout: int) -> str

Get the content of the given file.

Parameters:

Name Type Description Default
fname
str

name of the file with absolute path

required
timeout
int

timeout value to fetch the file content

required

Returns:

Type Description
str

contents of the file

Source code in boardfarm3/templates/cpe/cpe_sw.py
329
330
331
332
333
334
335
336
337
338
339
340
@abstractmethod
def get_file_content(self, fname: str, timeout: int) -> str:
    """Get the content of the given file.

    :param fname: name of the file with absolute path
    :type fname: str
    :param timeout: timeout value to fetch the file content
    :type timeout: int
    :return: contents of the file
    :rtype: str
    """
    raise NotImplementedError

get_interface_ipv4addr abstractmethod

get_interface_ipv4addr(interface: str) -> str

Return given interface IPv4 address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv4 address

Source code in boardfarm3/templates/cpe/cpe_sw.py
170
171
172
173
174
175
176
177
@abstractmethod
def get_interface_ipv4addr(self, interface: str) -> str:
    """Return given interface IPv4 address.

    :param interface: interface name
    :return: IPv4 address
    """
    raise NotImplementedError

get_interface_ipv6addr abstractmethod

get_interface_ipv6addr(interface: str) -> str

Return given interface IPv6 address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv6 address

Source code in boardfarm3/templates/cpe/cpe_sw.py
179
180
181
182
183
184
185
186
@abstractmethod
def get_interface_ipv6addr(self, interface: str) -> str:
    """Return given interface IPv6 address.

    :param interface: interface name
    :return: IPv6 address
    """
    raise NotImplementedError
get_interface_link_local_ipv6_addr(interface: str) -> str

Return given interface link local IPv6 address.

Parameters:

Name Type Description Default
str

interface name

required

Returns:

Type Description
str

link local IPv6 address

Source code in boardfarm3/templates/cpe/cpe_sw.py
188
189
190
191
192
193
194
195
@abstractmethod
def get_interface_link_local_ipv6_addr(self, interface: str) -> str:
    """Return given interface link local IPv6 address.

    :param interface: interface name
    :return: link local IPv6 address
    """
    raise NotImplementedError

get_interface_mac_addr abstractmethod

get_interface_mac_addr(interface: str) -> str

Return given interface mac address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

mac address of the given interface

Source code in boardfarm3/templates/cpe/cpe_sw.py
214
215
216
217
218
219
220
221
@abstractmethod
def get_interface_mac_addr(self, interface: str) -> str:
    """Return given interface mac address.

    :param interface: interface name
    :return: mac address of the given interface
    """
    raise NotImplementedError

get_interface_mtu_size abstractmethod

get_interface_mtu_size(interface: str) -> int

Get the MTU size of the interface in bytes.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
int

size of the MTU in bytes

Source code in boardfarm3/templates/cpe/cpe_sw.py
395
396
397
398
399
400
401
402
403
404
@abstractmethod
def get_interface_mtu_size(self, interface: str) -> int:
    """Get the MTU size of the interface in bytes.

    :param interface: name of the interface
    :type interface: str
    :return: size of the MTU in bytes
    :rtype: int
    """
    raise NotImplementedError

get_load_avg abstractmethod

get_load_avg() -> float

Return current load average of the CPE.

Returns:

Type Description
float

current load average

Source code in boardfarm3/templates/cpe/cpe_sw.py
231
232
233
234
235
236
237
@abstractmethod
def get_load_avg(self) -> float:
    """Return current load average of the CPE.

    :return: current load average
    """
    raise NotImplementedError

get_memory_utilization abstractmethod

get_memory_utilization() -> dict[str, int]

Return the current memory utilization of the CPE.

Returns:

Type Description
dict[str, int]

current memory utilization

Source code in boardfarm3/templates/cpe/cpe_sw.py
239
240
241
242
243
244
245
246
@abstractmethod
def get_memory_utilization(self) -> dict[str, int]:
    """Return the current memory utilization of the CPE.

    :return: current memory utilization
    :rtype: dict[str, int]
    """
    raise NotImplementedError

get_ntp_sync_status abstractmethod

get_ntp_sync_status() -> list[dict[str, Any]]

Execute ntpq command to get the synchronization status.

Returns:

Type Description
list[dict[str, Any]]

parsed output of ntpq command

Source code in boardfarm3/templates/cpe/cpe_sw.py
291
292
293
294
295
296
297
298
299
300
@abstractmethod
def get_ntp_sync_status(
    self,
) -> list[dict[str, Any]]:
    """Execute ntpq command to get the synchronization status.

    :return: parsed output of ntpq command
    :rtype: list[dict[str, Any]]
    """
    raise NotImplementedError

get_provision_mode abstractmethod

get_provision_mode() -> str

Return provision mode.

Source code in boardfarm3/templates/cpe/cpe_sw.py
117
118
119
120
@abstractmethod
def get_provision_mode(self) -> str:
    """Return provision mode."""
    raise NotImplementedError

get_running_processes abstractmethod

get_running_processes(ps_options: str = '-A') -> Iterable[ParsedPSOutput]

Return the currently running processes in the CPE via the ps command.

Parameters:

Name Type Description Default
ps_options
str

The options to be passed to the ps command, defaults to "-A"

'-A'

Returns:

Type Description
Iterable[ParsedPSOutput]

the currently running processes as a parsed tuple of dictionaries

Source code in boardfarm3/templates/cpe/cpe_sw.py
277
278
279
280
281
282
283
284
285
286
287
288
289
@abstractmethod
def get_running_processes(
    self,
    ps_options: str = "-A",
) -> Iterable[ParsedPSOutput]:
    """Return the currently running processes in the CPE via the `ps` command.

    :param ps_options: The options to be passed to the ps command, defaults to "-A"
    :type ps_options: str
    :return: the currently running processes as a parsed tuple of dictionaries
    :rtype: Iterable[ParsedPSOutput]
    """
    raise NotImplementedError

get_seconds_uptime abstractmethod

get_seconds_uptime() -> float

Return uptime in seconds.

Returns:

Type Description
float

uptime in seconds

Source code in boardfarm3/templates/cpe/cpe_sw.py
154
155
156
157
158
159
160
@abstractmethod
def get_seconds_uptime(self) -> float:
    """Return uptime in seconds.

    :return: uptime in seconds
    """
    raise NotImplementedError

get_tr069_log abstractmethod

get_tr069_log() -> list[str]

Return the TR-069 log from the board.

Returns:

Type Description
list[str]

TR-069 logs

Source code in boardfarm3/templates/cpe/cpe_sw.py
320
321
322
323
324
325
326
327
@abstractmethod
def get_tr069_log(self) -> list[str]:
    """Return the TR-069 log from the board.

    :return: TR-069 logs
    :rtype: list[str]
    """
    raise NotImplementedError
is_link_up(interface: str, pattern: str = 'BROADCAST,MULTICAST,UP') -> bool

Return the link status.

Parameters:

Name Type Description Default
str

interface state

required
str

interface name, defaults to "BROADCAST,MULTICAST,UP"

'BROADCAST,MULTICAST,UP'

Returns:

Type Description
bool

True if the link is up

Source code in boardfarm3/templates/cpe/cpe_sw.py
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
@abstractmethod
def is_link_up(
    self,
    interface: str,
    pattern: str = "BROADCAST,MULTICAST,UP",
) -> bool:
    """Return the link status.

    :param interface: interface state
    :type interface: str
    :param pattern: interface name, defaults to "BROADCAST,MULTICAST,UP"
    :type pattern: str
    :return: True if the link is up
    :rtype: bool
    """
    raise NotImplementedError

is_online abstractmethod

is_online() -> bool

Is CPE online.

Returns:

Type Description
bool

True if the CPE is online, False otherwise

Source code in boardfarm3/templates/cpe/cpe_sw.py
162
163
164
165
166
167
168
@abstractmethod
def is_online(self) -> bool:
    """Is CPE online.

    :return: True if the CPE is online, False otherwise
    """
    raise NotImplementedError

is_production abstractmethod

is_production() -> bool

Is production software.

Production software has limited capabilities.

Source code in boardfarm3/templates/cpe/cpe_sw.py
122
123
124
125
126
127
128
@abstractmethod
def is_production(self) -> bool:
    """Is production software.

    Production software has limited capabilities.
    """
    raise NotImplementedError

is_tr069_connected abstractmethod

is_tr069_connected() -> bool

Is TR-69 agent is connected.

Returns:

Type Description
bool

True is TR-69 is connected, otherwise False

Source code in boardfarm3/templates/cpe/cpe_sw.py
223
224
225
226
227
228
229
@abstractmethod
def is_tr069_connected(self) -> bool:
    """Is TR-69 agent is connected.

    :return: True is TR-69 is connected, otherwise False
    """
    raise NotImplementedError

kill_process_immediately abstractmethod

kill_process_immediately(pid: int) -> None

Kills any process based on the provided process ID.

Parameters:

Name Type Description Default
pid
int

process number

required
Source code in boardfarm3/templates/cpe/cpe_sw.py
302
303
304
305
306
307
308
309
@abstractmethod
def kill_process_immediately(self, pid: int) -> None:
    """Kills any process based on the provided process ID.

    :param pid: process number
    :type pid: int
    """
    raise NotImplementedError

read_event_logs abstractmethod

read_event_logs() -> JSONDictType | list[JSONDictType] | Iterator[JSONDictType]

Return the event logs from the logread command.

Returns:

Type Description
JSONDictType | list[JSONDictType] | Iterator[JSONDictType]

the event logs from the logread command.

Source code in boardfarm3/templates/cpe/cpe_sw.py
266
267
268
269
270
271
272
273
274
275
@abstractmethod
def read_event_logs(
    self,
) -> JSONDictType | list[JSONDictType] | Iterator[JSONDictType]:
    """Return the event logs from the `logread` command.

    :return: the event logs from the `logread` command.
    :rtype: JSONDictType | list[JSONDictType] | Iterator[JSONDictType]
    """
    raise NotImplementedError

reset abstractmethod

reset(method: str | None = None) -> None

Perform reset via given method.

Parameters:

Name Type Description Default
method
str | None

reset method. Default None

None
Source code in boardfarm3/templates/cpe/cpe_sw.py
130
131
132
133
134
135
136
137
@abstractmethod
def reset(self, method: str | None = None) -> None:
    """Perform reset via given method.

    :param method: reset method. Default None
    :type method: str | None
    """
    raise NotImplementedError

set_date abstractmethod

set_date(date_string: str) -> bool

Set the device's date and time.

It should execute date -s {date_string} on the device's console.

Parameters:

Name Type Description Default
date_string
str

value to be changed

required

Returns:

Type Description
bool

True if set is successful

Source code in boardfarm3/templates/cpe/cpe_sw.py
368
369
370
371
372
373
374
375
376
377
378
379
@abstractmethod
def set_date(self, date_string: str) -> bool:
    """Set the device's date and time.

    It should execute `date -s {date_string}` on the device's console.

    :param date_string: value to be changed
    :type date_string: str
    :return: True if set is successful
    :rtype: bool
    """
    raise NotImplementedError

verify_cpe_is_booting abstractmethod

verify_cpe_is_booting() -> None

Verify CPE is booting.

Source code in boardfarm3/templates/cpe/cpe_sw.py
112
113
114
115
@abstractmethod
def verify_cpe_is_booting(self) -> None:
    """Verify CPE is booting."""
    raise NotImplementedError

wait_for_boot abstractmethod

wait_for_boot() -> None

Wait for CPE to boot.

Source code in boardfarm3/templates/cpe/cpe_sw.py
149
150
151
152
@abstractmethod
def wait_for_boot(self) -> None:
    """Wait for CPE to boot."""
    raise NotImplementedError

cpe

CPE template.

Classes:

Name Description
CPE

CPE Template.

CPE

CPE Template.

Attributes:

Name Type Description
config dict

Device configuration.

hw CPEHW

CPE Hardware.

sw CPESW

CPE Software.

config abstractmethod property
config: dict

Device configuration.

hw abstractmethod property
hw: CPEHW

CPE Hardware.

sw abstractmethod property
sw: CPESW

CPE Software.

cpe_hw

CPE HW Template.

Classes:

Name Description
CPEHW

CPE hardware template.

CPEHW

CPE hardware template.

Methods:

Name Description
connect_to_consoles

Connect to the consoles.

disconnect_from_consoles

Disconnect/Close the console connections.

flash_via_bootloader

Flash cable modem via the bootloader.

get_console

Return console instance with the given name.

get_interactive_consoles

Get interactive consoles of the device.

power_cycle

Power cycle the board via HW (usually via a PDU device).

wait_for_hw_boot

Wait for the HW boot messages(bootloader).

Attributes:

Name Type Description
config dict[str, Any]

Device config.

mac_address str

Get the MAC address.

mta_iface str

MTA interface name.

wan_iface str

WAN interface name.

config abstractmethod property
config: dict[str, Any]

Device config.

mac_address abstractmethod property
mac_address: str

Get the MAC address.

mta_iface abstractmethod property
mta_iface: str

MTA interface name.

wan_iface abstractmethod property
wan_iface: str

WAN interface name.

connect_to_consoles abstractmethod
connect_to_consoles(device_name: str) -> None

Connect to the consoles.

Parameters:

Name Type Description Default
device_name
str

name of the device

required
Source code in boardfarm3/templates/cpe/cpe_hw.py
45
46
47
48
49
50
51
52
@abstractmethod
def connect_to_consoles(self, device_name: str) -> None:
    """Connect to the consoles.

    :param device_name: name of the device
    :type device_name: str
    """
    raise NotImplementedError
disconnect_from_consoles abstractmethod
disconnect_from_consoles() -> None

Disconnect/Close the console connections.

Source code in boardfarm3/templates/cpe/cpe_hw.py
 99
100
101
102
@abstractmethod
def disconnect_from_consoles(self) -> None:
    """Disconnect/Close the console connections."""
    raise NotImplementedError
flash_via_bootloader abstractmethod
flash_via_bootloader(
    image: str,
    tftp_devices: dict[str, TFTP],
    termination_sys: TerminationSystem = None,
    method: str | None = None,
) -> None

Flash cable modem via the bootloader.

Parameters:

Name Type Description Default
image
str

image name

required
tftp_devices
dict[str, TFTP]

a list of LAN side TFTP devices

required
termination_sys
TerminationSystem

the termination system device (e.g. CMTS), defaults to None

None
method
str | None

flash method, defaults to None

None

Raises:

Type Description
NotImplementedError

as a safety measure

Source code in boardfarm3/templates/cpe/cpe_hw.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@abstractmethod
def flash_via_bootloader(
    self,
    image: str,
    tftp_devices: dict[str, TFTP],
    termination_sys: TerminationSystem = None,
    method: str | None = None,
) -> None:
    """Flash cable modem via the bootloader.

    :param image: image name
    :type image: str
    :param tftp_devices: a list of LAN side TFTP devices
    :type tftp_devices: dict[str, TFTP]
    :param termination_sys: the termination system device (e.g. CMTS),
        defaults to None
    :type termination_sys: TerminationSystem
    :param method: flash method, defaults to None
    :type method: str, optional
    :raises NotImplementedError: as a safety measure
    """
    raise NotImplementedError
get_console abstractmethod
get_console(console_name: str) -> BoardfarmPexpect

Return console instance with the given name.

Parameters:

Name Type Description Default
console_name
str

name of the console

required

Returns:

Type Description
BoardfarmPexpect

console instance with given name

Raises:

Type Description
ValueError

on unknown console name

Source code in boardfarm3/templates/cpe/cpe_hw.py
54
55
56
57
58
59
60
61
62
63
64
@abstractmethod
def get_console(self, console_name: str) -> BoardfarmPexpect:
    """Return console instance with the given name.

    :param console_name: name of the console
    :type console_name: str
    :raises ValueError: on unknown console name
    :return: console instance with given name
    :rtype: BoardfarmPexpect
    """
    raise NotImplementedError
get_interactive_consoles abstractmethod
get_interactive_consoles() -> dict[str, BoardfarmPexpect]

Get interactive consoles of the device.

Returns:

Type Description
Dict[str, BoardfarmPexpect]

device interactive consoles

Source code in boardfarm3/templates/cpe/cpe_hw.py
104
105
106
107
108
109
110
111
@abstractmethod
def get_interactive_consoles(self) -> dict[str, BoardfarmPexpect]:
    """Get interactive consoles of the device.

    :returns: device interactive consoles
    :rtype: Dict[str, BoardfarmPexpect]
    """
    raise NotImplementedError
power_cycle abstractmethod
power_cycle() -> None

Power cycle the board via HW (usually via a PDU device).

Source code in boardfarm3/templates/cpe/cpe_hw.py
66
67
68
69
@abstractmethod
def power_cycle(self) -> None:
    """Power cycle the board via HW (usually via a PDU device)."""
    raise NotImplementedError
wait_for_hw_boot abstractmethod
wait_for_hw_boot() -> None

Wait for the HW boot messages(bootloader).

Source code in boardfarm3/templates/cpe/cpe_hw.py
71
72
73
74
@abstractmethod
def wait_for_hw_boot(self) -> None:
    """Wait for the HW boot messages(bootloader)."""
    raise NotImplementedError

cpe_sw

CPE SW Template.

Classes:

Name Description
CPESW

CPE Software Template.

CPESW

CPE Software Template.

Methods:

Name Description
add_info_to_file

Add data into a file.

enable_logs

Enable logs for given component.

factory_reset

Perform factory reset CPE via given method.

finalize_boot

Validate board settings post boot.

get_board_logs

Return board console logs for given timeout.

get_boottime_log

Return the boot time log from the board.

get_date

Get the system date and time.

get_file_content

Get the content of the given file.

get_interface_ipv4addr

Return given interface IPv4 address.

get_interface_ipv6addr

Return given interface IPv6 address.

get_interface_link_local_ipv6_addr

Return given interface link local IPv6 address.

get_interface_mac_addr

Return given interface mac address.

get_interface_mtu_size

Get the MTU size of the interface in bytes.

get_load_avg

Return current load average of the CPE.

get_memory_utilization

Return the current memory utilization of the CPE.

get_ntp_sync_status

Execute ntpq command to get the synchronization status.

get_provision_mode

Return provision mode.

get_running_processes

Return the currently running processes in the CPE via the ps command.

get_seconds_uptime

Return uptime in seconds.

get_tr069_log

Return the TR-069 log from the board.

is_link_up

Return the link status.

is_online

Is CPE online.

is_production

Is production software.

is_tr069_connected

Is TR-69 agent is connected.

kill_process_immediately

Kills any process based on the provided process ID.

read_event_logs

Return the event logs from the logread command.

reset

Perform reset via given method.

set_date

Set the device's date and time.

verify_cpe_is_booting

Verify CPE is booting.

wait_for_boot

Wait for CPE to boot.

Attributes:

Name Type Description
aftr_iface str

AFTR interface name.

cpe_id str

TR069 CPE ID.

dmcli DMCLIAPI

Dmcli instance running in CPE Software (if any).

erouter_iface str

e-Router interface name.

firewall IptablesFirewall

Firewall component of cpe software.

guest_iface str

Guest network interface name.

gui_password str

GUI login password.

json_values dict[str, Any]

CPE Specific JSON values.

lan_gateway_ipv4 IPv4Address

LAN Gateway IPv4 address.

lan_gateway_ipv6 IPv6Address

LAN Gateway IPv6 address.

lan_iface str

LAN interface name.

lan_network_ipv4 IPv4Network

LAN IPv4 network.

nw_utility NetworkUtility

Network utility component of cpe software.

tr69_cpe_id str

TR-69 CPE Identifier.

version str

CPE software version.

wifi WiFiHal

Wifi instance CPE Software.

aftr_iface abstractmethod property
aftr_iface: str

AFTR interface name.

cpe_id abstractmethod property
cpe_id: str

TR069 CPE ID.

dmcli abstractmethod property
dmcli: DMCLIAPI

Dmcli instance running in CPE Software (if any).

erouter_iface abstractmethod property
erouter_iface: str

e-Router interface name.

firewall abstractmethod property
firewall: IptablesFirewall

Firewall component of cpe software.

guest_iface abstractmethod property
guest_iface: str

Guest network interface name.

gui_password abstractmethod property
gui_password: str

GUI login password.

json_values abstractmethod property
json_values: dict[str, Any]

CPE Specific JSON values.

lan_gateway_ipv4 abstractmethod property
lan_gateway_ipv4: IPv4Address

LAN Gateway IPv4 address.

lan_gateway_ipv6 abstractmethod property
lan_gateway_ipv6: IPv6Address

LAN Gateway IPv6 address.

lan_iface abstractmethod property
lan_iface: str

LAN interface name.

lan_network_ipv4 abstractmethod property
lan_network_ipv4: IPv4Network

LAN IPv4 network.

nw_utility abstractmethod property
nw_utility: NetworkUtility

Network utility component of cpe software.

tr69_cpe_id abstractmethod property
tr69_cpe_id: str

TR-69 CPE Identifier.

version abstractmethod property
version: str

CPE software version.

This will reload after each flash.

wifi abstractmethod property
wifi: WiFiHal

Wifi instance CPE Software.

add_info_to_file abstractmethod
add_info_to_file(to_add: str, fname: str) -> None

Add data into a file.

Parameters:

Name Type Description Default
to_add
str

contents/data to be added to a file.

required
fname
str

filename with absolute path

required
Source code in boardfarm3/templates/cpe/cpe_sw.py
342
343
344
345
346
347
348
349
350
351
@abstractmethod
def add_info_to_file(self, to_add: str, fname: str) -> None:
    """Add data into a file.

    :param to_add: contents/data to be added to a file.
    :type to_add: str
    :param fname: filename with absolute path
    :type fname: str
    """
    raise NotImplementedError
enable_logs abstractmethod
enable_logs(component: str, flag: str = 'enable') -> None

Enable logs for given component.

Parameters:

Name Type Description Default
component
str

component name

required
flag
str

flag name, Default: "enable"

'enable'
Source code in boardfarm3/templates/cpe/cpe_sw.py
248
249
250
251
252
253
254
255
@abstractmethod
def enable_logs(self, component: str, flag: str = "enable") -> None:
    """Enable logs for given component.

    :param component: component name
    :param flag: flag name, Default: "enable"
    """
    raise NotImplementedError
factory_reset abstractmethod
factory_reset(method: str | None = None) -> bool

Perform factory reset CPE via given method.

Parameters:

Name Type Description Default
method
str | None

factory reset method. Default None.

None

Returns:

Type Description
bool

True on successful factory reset, False otherwise

Source code in boardfarm3/templates/cpe/cpe_sw.py
139
140
141
142
143
144
145
146
147
@abstractmethod
def factory_reset(self, method: str | None = None) -> bool:
    """Perform factory reset CPE via given method.

    :param method: factory reset method. Default None.
    :type method: str | None
    :return: True on successful factory reset, False otherwise
    """
    raise NotImplementedError
finalize_boot abstractmethod
finalize_boot() -> bool

Validate board settings post boot.

Returns:

Type Description
bool

True on successful validation

Source code in boardfarm3/templates/cpe/cpe_sw.py
381
382
383
384
385
386
387
@abstractmethod
def finalize_boot(self) -> bool:
    """Validate board settings post boot.

    :return: True on successful validation
    """
    raise NotImplementedError
get_board_logs abstractmethod
get_board_logs(timeout: int = 300) -> str

Return board console logs for given timeout.

Parameters:

Name Type Description Default
timeout
int

log capture time in seconds

300

Returns:

Type Description
str

captured logs

Source code in boardfarm3/templates/cpe/cpe_sw.py
257
258
259
260
261
262
263
264
@abstractmethod
def get_board_logs(self, timeout: int = 300) -> str:
    """Return board console logs for given timeout.

    :param timeout: log capture time in seconds
    :return: captured logs
    """
    raise NotImplementedError
get_boottime_log abstractmethod
get_boottime_log() -> list[str]

Return the boot time log from the board.

Returns:

Type Description
list[str]

boot time log

Source code in boardfarm3/templates/cpe/cpe_sw.py
311
312
313
314
315
316
317
318
@abstractmethod
def get_boottime_log(self) -> list[str]:
    """Return the boot time log from the board.

    :return: boot time log
    :rtype: list[str]
    """
    raise NotImplementedError
get_date abstractmethod
get_date() -> str | None

Get the system date and time.

.. code-block:: python

# example output
donderdag, mei 23, 2024 14:23:39

Returns:

Type Description
str | None

date

Source code in boardfarm3/templates/cpe/cpe_sw.py
353
354
355
356
357
358
359
360
361
362
363
364
365
366
@abstractmethod
def get_date(self) -> str | None:
    """Get the system date and time.

    .. code-block:: python

        # example output
        donderdag, mei 23, 2024 14:23:39


    :return: date
    :rtype: str | None
    """
    raise NotImplementedError
get_file_content abstractmethod
get_file_content(fname: str, timeout: int) -> str

Get the content of the given file.

Parameters:

Name Type Description Default
fname
str

name of the file with absolute path

required
timeout
int

timeout value to fetch the file content

required

Returns:

Type Description
str

contents of the file

Source code in boardfarm3/templates/cpe/cpe_sw.py
329
330
331
332
333
334
335
336
337
338
339
340
@abstractmethod
def get_file_content(self, fname: str, timeout: int) -> str:
    """Get the content of the given file.

    :param fname: name of the file with absolute path
    :type fname: str
    :param timeout: timeout value to fetch the file content
    :type timeout: int
    :return: contents of the file
    :rtype: str
    """
    raise NotImplementedError
get_interface_ipv4addr abstractmethod
get_interface_ipv4addr(interface: str) -> str

Return given interface IPv4 address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv4 address

Source code in boardfarm3/templates/cpe/cpe_sw.py
170
171
172
173
174
175
176
177
@abstractmethod
def get_interface_ipv4addr(self, interface: str) -> str:
    """Return given interface IPv4 address.

    :param interface: interface name
    :return: IPv4 address
    """
    raise NotImplementedError
get_interface_ipv6addr abstractmethod
get_interface_ipv6addr(interface: str) -> str

Return given interface IPv6 address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv6 address

Source code in boardfarm3/templates/cpe/cpe_sw.py
179
180
181
182
183
184
185
186
@abstractmethod
def get_interface_ipv6addr(self, interface: str) -> str:
    """Return given interface IPv6 address.

    :param interface: interface name
    :return: IPv6 address
    """
    raise NotImplementedError
get_interface_link_local_ipv6_addr(interface: str) -> str

Return given interface link local IPv6 address.

Parameters:

Name Type Description Default
str

interface name

required

Returns:

Type Description
str

link local IPv6 address

Source code in boardfarm3/templates/cpe/cpe_sw.py
188
189
190
191
192
193
194
195
@abstractmethod
def get_interface_link_local_ipv6_addr(self, interface: str) -> str:
    """Return given interface link local IPv6 address.

    :param interface: interface name
    :return: link local IPv6 address
    """
    raise NotImplementedError
get_interface_mac_addr abstractmethod
get_interface_mac_addr(interface: str) -> str

Return given interface mac address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

mac address of the given interface

Source code in boardfarm3/templates/cpe/cpe_sw.py
214
215
216
217
218
219
220
221
@abstractmethod
def get_interface_mac_addr(self, interface: str) -> str:
    """Return given interface mac address.

    :param interface: interface name
    :return: mac address of the given interface
    """
    raise NotImplementedError
get_interface_mtu_size abstractmethod
get_interface_mtu_size(interface: str) -> int

Get the MTU size of the interface in bytes.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
int

size of the MTU in bytes

Source code in boardfarm3/templates/cpe/cpe_sw.py
395
396
397
398
399
400
401
402
403
404
@abstractmethod
def get_interface_mtu_size(self, interface: str) -> int:
    """Get the MTU size of the interface in bytes.

    :param interface: name of the interface
    :type interface: str
    :return: size of the MTU in bytes
    :rtype: int
    """
    raise NotImplementedError
get_load_avg abstractmethod
get_load_avg() -> float

Return current load average of the CPE.

Returns:

Type Description
float

current load average

Source code in boardfarm3/templates/cpe/cpe_sw.py
231
232
233
234
235
236
237
@abstractmethod
def get_load_avg(self) -> float:
    """Return current load average of the CPE.

    :return: current load average
    """
    raise NotImplementedError
get_memory_utilization abstractmethod
get_memory_utilization() -> dict[str, int]

Return the current memory utilization of the CPE.

Returns:

Type Description
dict[str, int]

current memory utilization

Source code in boardfarm3/templates/cpe/cpe_sw.py
239
240
241
242
243
244
245
246
@abstractmethod
def get_memory_utilization(self) -> dict[str, int]:
    """Return the current memory utilization of the CPE.

    :return: current memory utilization
    :rtype: dict[str, int]
    """
    raise NotImplementedError
get_ntp_sync_status abstractmethod
get_ntp_sync_status() -> list[dict[str, Any]]

Execute ntpq command to get the synchronization status.

Returns:

Type Description
list[dict[str, Any]]

parsed output of ntpq command

Source code in boardfarm3/templates/cpe/cpe_sw.py
291
292
293
294
295
296
297
298
299
300
@abstractmethod
def get_ntp_sync_status(
    self,
) -> list[dict[str, Any]]:
    """Execute ntpq command to get the synchronization status.

    :return: parsed output of ntpq command
    :rtype: list[dict[str, Any]]
    """
    raise NotImplementedError
get_provision_mode abstractmethod
get_provision_mode() -> str

Return provision mode.

Source code in boardfarm3/templates/cpe/cpe_sw.py
117
118
119
120
@abstractmethod
def get_provision_mode(self) -> str:
    """Return provision mode."""
    raise NotImplementedError
get_running_processes abstractmethod
get_running_processes(ps_options: str = '-A') -> Iterable[ParsedPSOutput]

Return the currently running processes in the CPE via the ps command.

Parameters:

Name Type Description Default
ps_options
str

The options to be passed to the ps command, defaults to "-A"

'-A'

Returns:

Type Description
Iterable[ParsedPSOutput]

the currently running processes as a parsed tuple of dictionaries

Source code in boardfarm3/templates/cpe/cpe_sw.py
277
278
279
280
281
282
283
284
285
286
287
288
289
@abstractmethod
def get_running_processes(
    self,
    ps_options: str = "-A",
) -> Iterable[ParsedPSOutput]:
    """Return the currently running processes in the CPE via the `ps` command.

    :param ps_options: The options to be passed to the ps command, defaults to "-A"
    :type ps_options: str
    :return: the currently running processes as a parsed tuple of dictionaries
    :rtype: Iterable[ParsedPSOutput]
    """
    raise NotImplementedError
get_seconds_uptime abstractmethod
get_seconds_uptime() -> float

Return uptime in seconds.

Returns:

Type Description
float

uptime in seconds

Source code in boardfarm3/templates/cpe/cpe_sw.py
154
155
156
157
158
159
160
@abstractmethod
def get_seconds_uptime(self) -> float:
    """Return uptime in seconds.

    :return: uptime in seconds
    """
    raise NotImplementedError
get_tr069_log abstractmethod
get_tr069_log() -> list[str]

Return the TR-069 log from the board.

Returns:

Type Description
list[str]

TR-069 logs

Source code in boardfarm3/templates/cpe/cpe_sw.py
320
321
322
323
324
325
326
327
@abstractmethod
def get_tr069_log(self) -> list[str]:
    """Return the TR-069 log from the board.

    :return: TR-069 logs
    :rtype: list[str]
    """
    raise NotImplementedError
is_link_up(interface: str, pattern: str = 'BROADCAST,MULTICAST,UP') -> bool

Return the link status.

Parameters:

Name Type Description Default
str

interface state

required
str

interface name, defaults to "BROADCAST,MULTICAST,UP"

'BROADCAST,MULTICAST,UP'

Returns:

Type Description
bool

True if the link is up

Source code in boardfarm3/templates/cpe/cpe_sw.py
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
@abstractmethod
def is_link_up(
    self,
    interface: str,
    pattern: str = "BROADCAST,MULTICAST,UP",
) -> bool:
    """Return the link status.

    :param interface: interface state
    :type interface: str
    :param pattern: interface name, defaults to "BROADCAST,MULTICAST,UP"
    :type pattern: str
    :return: True if the link is up
    :rtype: bool
    """
    raise NotImplementedError
is_online abstractmethod
is_online() -> bool

Is CPE online.

Returns:

Type Description
bool

True if the CPE is online, False otherwise

Source code in boardfarm3/templates/cpe/cpe_sw.py
162
163
164
165
166
167
168
@abstractmethod
def is_online(self) -> bool:
    """Is CPE online.

    :return: True if the CPE is online, False otherwise
    """
    raise NotImplementedError
is_production abstractmethod
is_production() -> bool

Is production software.

Production software has limited capabilities.

Source code in boardfarm3/templates/cpe/cpe_sw.py
122
123
124
125
126
127
128
@abstractmethod
def is_production(self) -> bool:
    """Is production software.

    Production software has limited capabilities.
    """
    raise NotImplementedError
is_tr069_connected abstractmethod
is_tr069_connected() -> bool

Is TR-69 agent is connected.

Returns:

Type Description
bool

True is TR-69 is connected, otherwise False

Source code in boardfarm3/templates/cpe/cpe_sw.py
223
224
225
226
227
228
229
@abstractmethod
def is_tr069_connected(self) -> bool:
    """Is TR-69 agent is connected.

    :return: True is TR-69 is connected, otherwise False
    """
    raise NotImplementedError
kill_process_immediately abstractmethod
kill_process_immediately(pid: int) -> None

Kills any process based on the provided process ID.

Parameters:

Name Type Description Default
pid
int

process number

required
Source code in boardfarm3/templates/cpe/cpe_sw.py
302
303
304
305
306
307
308
309
@abstractmethod
def kill_process_immediately(self, pid: int) -> None:
    """Kills any process based on the provided process ID.

    :param pid: process number
    :type pid: int
    """
    raise NotImplementedError
read_event_logs abstractmethod
read_event_logs() -> JSONDictType | list[JSONDictType] | Iterator[JSONDictType]

Return the event logs from the logread command.

Returns:

Type Description
JSONDictType | list[JSONDictType] | Iterator[JSONDictType]

the event logs from the logread command.

Source code in boardfarm3/templates/cpe/cpe_sw.py
266
267
268
269
270
271
272
273
274
275
@abstractmethod
def read_event_logs(
    self,
) -> JSONDictType | list[JSONDictType] | Iterator[JSONDictType]:
    """Return the event logs from the `logread` command.

    :return: the event logs from the `logread` command.
    :rtype: JSONDictType | list[JSONDictType] | Iterator[JSONDictType]
    """
    raise NotImplementedError
reset abstractmethod
reset(method: str | None = None) -> None

Perform reset via given method.

Parameters:

Name Type Description Default
method
str | None

reset method. Default None

None
Source code in boardfarm3/templates/cpe/cpe_sw.py
130
131
132
133
134
135
136
137
@abstractmethod
def reset(self, method: str | None = None) -> None:
    """Perform reset via given method.

    :param method: reset method. Default None
    :type method: str | None
    """
    raise NotImplementedError
set_date abstractmethod
set_date(date_string: str) -> bool

Set the device's date and time.

It should execute date -s {date_string} on the device's console.

Parameters:

Name Type Description Default
date_string
str

value to be changed

required

Returns:

Type Description
bool

True if set is successful

Source code in boardfarm3/templates/cpe/cpe_sw.py
368
369
370
371
372
373
374
375
376
377
378
379
@abstractmethod
def set_date(self, date_string: str) -> bool:
    """Set the device's date and time.

    It should execute `date -s {date_string}` on the device's console.

    :param date_string: value to be changed
    :type date_string: str
    :return: True if set is successful
    :rtype: bool
    """
    raise NotImplementedError
verify_cpe_is_booting abstractmethod
verify_cpe_is_booting() -> None

Verify CPE is booting.

Source code in boardfarm3/templates/cpe/cpe_sw.py
112
113
114
115
@abstractmethod
def verify_cpe_is_booting(self) -> None:
    """Verify CPE is booting."""
    raise NotImplementedError
wait_for_boot abstractmethod
wait_for_boot() -> None

Wait for CPE to boot.

Source code in boardfarm3/templates/cpe/cpe_sw.py
149
150
151
152
@abstractmethod
def wait_for_boot(self) -> None:
    """Wait for CPE to boot."""
    raise NotImplementedError

lan

Boardfarm LAN device template.

Classes:

Name Description
LAN

Boardfarm LAN device template.

LAN

Boardfarm LAN device template.

Methods:

Name Description
add_hosts_entry

Add entry in hosts file.

create_upnp_rule

Create UPnP rule on the device.

curl

Perform curl action to Web service.

del_default_route

Remove the default gateway.

delete_arp_table_entry

Delete ARP table output.

delete_file

Delete the file from the device.

delete_hosts_entry

Delete entry in hosts file.

delete_upnp_rule

Delete UPnP rule on the device.

disable_ipv6

Disable IPv6 on the connected client interface.

dns_lookup

Perform dig command in the devices to resolve DNS.

enable_ipv6

Enable IPv6 on the connected client interface.

flush_arp_cache

Flushes arp cache entries.

get_arp_table

Fetch ARP table output.

get_date

Get the system date and time.

get_default_gateway

Get the default gateway from IP route output.

get_hostname

Get the hostname of the device.

get_interface_ipv4addr

Get IPv4 address of interface.

get_interface_ipv6addr

Get IPv6 address of the interface.

get_interface_link_local_ipv6addr

Get IPv6 link local address of the interface.

get_interface_macaddr

Get the interface MAC address.

get_interface_mask

Get the subnet mask of the interface.

get_interface_mtu_size

Get the MTU size of the interface in bytes.

get_iperf_logs

Read the file output for traffic flow.

get_process_id

Return the process id to the device.

hping_flood

Validate SYN, UDP and ICMP flood operation.

http_get

Peform HTTP Get and return parsed result.

is_link_up

Return the link status.

kill_process

Kill the running process based on the process id.

netcat

Run netcat command to initiate brute force.

nmap

Perform nmap operation on linux device.

ping

Ping remote host.

release_dhcp

Release IPv4 of the specified interface.

release_ipv6

Release IPv6 of the specified interface.

renew_dhcp

Renew IPv4 of the specified interface by restart of the IPv4 dhclient.

renew_ipv6

Renew IPv6 of the specified interface.

scp_device_file_to_local

Copy a local file from a server using SCP.

send_mldv2_report

Send an MLDv2 report with desired multicast record.

set_date

Set the device's date and time.

set_default_gw

Set given IP address as default gateway address for given interface.

set_link_state

Set link state.

set_static_ip

Set given static IP for the LAN.

start_http_service

Start HTTP service on given port number.

start_ipv4_lan_client

Restart IPv4 dhclient to obtain IP.

start_ipv6_lan_client

Restart IPv6 dhclient to obtain IP.

start_nping

Perform nping.

start_tcpdump

Start tcpdump capture on given interface.

start_traffic_receiver

Start the server on a linux device to generate traffic using iperf3.

start_traffic_sender

Start traffic on a linux client using iperf3.

stop_http_service

Stop HTTP service running on given port.

stop_nping

Stop nping process running in background.

stop_tcpdump

Stop tcpdump capture.

stop_traffic

Stop the iPerf3 process for a specific PID or killall.

tcpdump_capture

Capture packets from specified interface.

traceroute

Return output of traceroute command.

tshark_read_pcap

Read packet captures from an existing file.

Attributes:

Name Type Description
console BoardfarmPexpect

Returns LAN console.

firewall IptablesFirewall

Returns Firewall iptables instance.

http_proxy str

SOCKS5 Dante proxy address, e.g http://{proxy_ip}:{proxy_port}/.

iface_dut str

Name of the interface that is connected to DUT.

ipv4_addr str

Return the IPv4 address on IFACE facing DUT.

ipv6_addr str

Return the IPv6 address on IFACE facing DUT.

lan_gateway str

Gateway address.

multicast Multicast

Return multicast component instance.

nslookup NSLookup

Returns NSLookup utility instance.

nw_utility NetworkUtility

Returns Network utility instance.

console abstractmethod property

Returns LAN console.

Returns:

Type Description
BoardfarmPexpect

console

firewall abstractmethod property

firewall: IptablesFirewall

Returns Firewall iptables instance.

Returns:

Type Description
IptablesFirewall

firewall iptables instance with console object

http_proxy abstractmethod property

http_proxy: str

SOCKS5 Dante proxy address, e.g http://{proxy_ip}:{proxy_port}/.

iface_dut abstractmethod property

iface_dut: str

Name of the interface that is connected to DUT.

ipv4_addr abstractmethod cached property

ipv4_addr: str

Return the IPv4 address on IFACE facing DUT.

Returns:

Type Description
str

IPv4 address in string format.

ipv6_addr abstractmethod cached property

ipv6_addr: str

Return the IPv6 address on IFACE facing DUT.

Returns:

Type Description
str

IPv6 address in string format.

lan_gateway abstractmethod property

lan_gateway: str

Gateway address.

multicast abstractmethod property

multicast: Multicast

Return multicast component instance.

Returns:

Type Description
Multicast

multicast component instance

nslookup abstractmethod property

nslookup: NSLookup

Returns NSLookup utility instance.

Returns:

Type Description
NSLookup

NSLookup utility instance with console object

nw_utility abstractmethod property

nw_utility: NetworkUtility

Returns Network utility instance.

Returns:

Type Description
NetworkUtility

network utiluty instance with console object

add_hosts_entry abstractmethod

add_hosts_entry(ip: str, host_name: str) -> None

Add entry in hosts file.

Parameters:

Name Type Description Default
ip
str

host ip addr

required
host_name
str

host name to be added

required
Source code in boardfarm3/templates/lan.py
855
856
857
858
859
860
861
862
863
864
@abstractmethod
def add_hosts_entry(self, ip: str, host_name: str) -> None:
    """Add entry in hosts file.

    :param ip: host ip addr
    :type ip: str
    :param host_name: host name to be added
    :type host_name: str
    """
    raise NotImplementedError

create_upnp_rule abstractmethod

create_upnp_rule(int_port: str, ext_port: str, protocol: str, url: str) -> str

Create UPnP rule on the device.

Parameters:

Name Type Description Default
int_port
str

internal port for UPnP

required
ext_port
str

external port for UPnP

required
protocol
str

protocol to be used

required
url
str

url to be used

required

Returns:

Type Description
str

output of upnpc add port command

Source code in boardfarm3/templates/lan.py
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
@abstractmethod
def create_upnp_rule(
    self,
    int_port: str,
    ext_port: str,
    protocol: str,
    url: str,
) -> str:
    """Create UPnP rule on the device.

    :param int_port: internal port for UPnP
    :type int_port: str
    :param ext_port: external port for UPnP
    :type ext_port: str
    :param protocol: protocol to be used
    :type protocol: str
    :param url: url to be used
    :type url: str
    :return: output of upnpc add port command
    :rtype: str
    """
    raise NotImplementedError

curl abstractmethod

curl(
    url: str | IPv4Address,
    protocol: str,
    port: str | int | None = None,
    options: str = "",
) -> bool

Perform curl action to Web service.

Parameters:

Name Type Description Default
url

Web service address

required

Returns:

Type Description
bool

True if curl action is successful

Source code in boardfarm3/templates/lan.py
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
@abstractmethod
def curl(
    self,
    url: str | IPv4Address,
    protocol: str,
    port: str | int | None = None,
    options: str = "",
) -> bool:
    """Perform curl action to Web service.

    :param url : Web service address
    :type url : str
    :param protocol : Web Protocol (HTTP or HTTPS)
    :type protocol : str
    :param port : port number of server
    :type port : str | int | None
    :param options : Additional curl options
    :type options : str
    :return: True if curl action is successful
    :rtype: bool
    """
    raise NotImplementedError

del_default_route abstractmethod

del_default_route(interface: str | None = None) -> None

Remove the default gateway.

Parameters:

Name Type Description Default
interface
str | None

interface name, default to None

None
Source code in boardfarm3/templates/lan.py
483
484
485
486
487
488
489
490
@abstractmethod
def del_default_route(self, interface: str | None = None) -> None:
    """Remove the default gateway.

    :param interface: interface name, default to None
    :type interface: str | None
    """
    raise NotImplementedError

delete_arp_table_entry abstractmethod

delete_arp_table_entry(ip: str, intf: str) -> None

Delete ARP table output.

Parameters:

Name Type Description Default
ip
str

ip of the host entry to be deleted

required
intf
str

interface for which the entry needs to be deleted

required
Source code in boardfarm3/templates/lan.py
927
928
929
930
931
932
933
934
935
936
@abstractmethod
def delete_arp_table_entry(self, ip: str, intf: str) -> None:
    """Delete ARP table output.

    :param ip: ip of the host entry to be deleted
    :type ip: str
    :param intf: interface for which the entry needs to be deleted
    :type intf: str
    """
    raise NotImplementedError

delete_file abstractmethod

delete_file(filename: str) -> None

Delete the file from the device.

Parameters:

Name Type Description Default
filename
str

name of the file with absolute path

required
Source code in boardfarm3/templates/lan.py
599
600
601
602
603
604
605
606
@abstractmethod
def delete_file(self, filename: str) -> None:
    """Delete the file from the device.

    :param filename: name of the file with absolute path
    :type filename: str
    """
    raise NotImplementedError

delete_hosts_entry abstractmethod

delete_hosts_entry(host_name: str, ip: str) -> None

Delete entry in hosts file.

Parameters:

Name Type Description Default
host_name
str

host name to be deleted

required
ip
str

host ip addr

required
Source code in boardfarm3/templates/lan.py
866
867
868
869
870
871
872
873
874
875
@abstractmethod
def delete_hosts_entry(self, host_name: str, ip: str) -> None:
    """Delete entry in hosts file.

    :param host_name: host name to be deleted
    :type host_name: str
    :param ip: host ip addr
    :type ip: str
    """
    raise NotImplementedError

delete_upnp_rule abstractmethod

delete_upnp_rule(ext_port: str, protocol: str, url: str) -> str

Delete UPnP rule on the device.

Parameters:

Name Type Description Default
ext_port
str

external port for UPnP

required
protocol
str

protocol to be used

required
url
str

url to be used

required

Returns:

Type Description
str

output of upnpc delete port command

Source code in boardfarm3/templates/lan.py
573
574
575
576
577
578
579
580
581
582
583
584
585
586
@abstractmethod
def delete_upnp_rule(self, ext_port: str, protocol: str, url: str) -> str:
    """Delete UPnP rule on the device.

    :param ext_port: external port for UPnP
    :type ext_port: str
    :param protocol: protocol to be used
    :type protocol: str
    :param url: url to be used
    :type url: str
    :return: output of upnpc delete port command
    :rtype: str
    """
    raise NotImplementedError

disable_ipv6 abstractmethod

disable_ipv6() -> None

Disable IPv6 on the connected client interface.

Source code in boardfarm3/templates/lan.py
545
546
547
548
@abstractmethod
def disable_ipv6(self) -> None:
    """Disable IPv6 on the connected client interface."""
    raise NotImplementedError

dns_lookup abstractmethod

dns_lookup(domain_name: str, record_type: str, opts: str = '') -> list[dict[str, Any]]

Perform dig command in the devices to resolve DNS.

Parameters:

Name Type Description Default
domain_name
str

domain name which needs lookup

required
record_type
str

AAAA for IPv6 else A

required
opts
str

options to be provided to dig command, defaults to ""

''

Returns:

Type Description
List[dict[str, Any]]

parsed dig command ouput

Source code in boardfarm3/templates/lan.py
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
@abstractmethod
def dns_lookup(
    self, domain_name: str, record_type: str, opts: str = ""
) -> list[dict[str, Any]]:
    """Perform ``dig`` command in the devices to resolve DNS.

    :param domain_name: domain name which needs lookup
    :type domain_name: str
    :param record_type: AAAA for IPv6 else A
    :type record_type: str
    :param opts: options to be provided to dig command, defaults to ""
    :type opts: str
    :return: parsed dig command ouput
    :rtype: List[dict[str, Any]]
    """
    raise NotImplementedError

enable_ipv6 abstractmethod

enable_ipv6() -> None

Enable IPv6 on the connected client interface.

Source code in boardfarm3/templates/lan.py
540
541
542
543
@abstractmethod
def enable_ipv6(self) -> None:
    """Enable IPv6 on the connected client interface."""
    raise NotImplementedError

flush_arp_cache abstractmethod

flush_arp_cache() -> None

Flushes arp cache entries.

Source code in boardfarm3/templates/lan.py
877
878
879
880
@abstractmethod
def flush_arp_cache(self) -> None:
    """Flushes arp cache entries."""
    raise NotImplementedError

get_arp_table abstractmethod

get_arp_table() -> str

Fetch ARP table output.

Returns:

Type Description
str

output of arp command

Source code in boardfarm3/templates/lan.py
918
919
920
921
922
923
924
925
@abstractmethod
def get_arp_table(self) -> str:
    """Fetch ARP table output.

    :return: output of arp command
    :rtype: str
    """
    raise NotImplementedError

get_date abstractmethod

get_date() -> str | None

Get the system date and time.

.. code-block:: python

# example output
donderdag, mei 23, 2024 14:23:39

Returns:

Type Description
str | None

date

Source code in boardfarm3/templates/lan.py
714
715
716
717
718
719
720
721
722
723
724
725
726
727
@abstractmethod
def get_date(self) -> str | None:
    """Get the system date and time.

    .. code-block:: python

        # example output
        donderdag, mei 23, 2024 14:23:39


    :return: date
    :rtype: str | None
    """
    raise NotImplementedError

get_default_gateway abstractmethod

get_default_gateway() -> IPv4Address

Get the default gateway from IP route output.

Returns:

Type Description
IPv4Address

IPv4 of the default gateway

Source code in boardfarm3/templates/lan.py
269
270
271
272
273
274
275
276
@abstractmethod
def get_default_gateway(self) -> IPv4Address:
    """Get the default gateway from IP route output.

    :return: IPv4 of the default gateway
    :rtype: IPv4Address
    """
    raise NotImplementedError

get_hostname abstractmethod

get_hostname() -> str

Get the hostname of the device.

Returns:

Type Description
str

hostname of the device

Source code in boardfarm3/templates/lan.py
846
847
848
849
850
851
852
853
@abstractmethod
def get_hostname(self) -> str:
    """Get the hostname of the device.

    :return: hostname of the device
    :rtype: str
    """
    raise NotImplementedError

get_interface_ipv4addr abstractmethod

get_interface_ipv4addr(interface: str) -> str

Get IPv4 address of interface.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv4 address of the interface

Raises:

Type Description
BoardfarmException

in case IPv4 can not be found

Source code in boardfarm3/templates/lan.py
190
191
192
193
194
195
196
197
198
199
200
@abstractmethod
def get_interface_ipv4addr(self, interface: str) -> str:
    """Get IPv4 address of interface.

    :param interface: interface name
    :type interface: str
    :return: IPv4 address of the interface
    :rtype: str
    :raises BoardfarmException: in case IPv4 can not be found
    """
    raise NotImplementedError

get_interface_ipv6addr abstractmethod

get_interface_ipv6addr(interface: str) -> str

Get IPv6 address of the interface.

Parameters:

Name Type Description Default
interface
str

interface name to get the link local

required

Returns:

Type Description
str

Global IPv6 address of the interface

Raises:

Type Description
BoardfarmException

in case IPv6 can not be found

Source code in boardfarm3/templates/lan.py
202
203
204
205
206
207
208
209
210
211
212
@abstractmethod
def get_interface_ipv6addr(self, interface: str) -> str:
    """Get IPv6 address of the interface.

    :param interface: interface name to get the link local
    :type interface: str
    :return: Global IPv6 address of the interface
    :rtype: str
    :raises BoardfarmException: in case IPv6 can not be found
    """
    raise NotImplementedError
get_interface_link_local_ipv6addr(interface: str) -> str

Get IPv6 link local address of the interface.

Parameters:

Name Type Description Default
str

interface name

required

Returns:

Type Description
str

Link local ipv6 address of the interface

Raises:

Type Description
BoardfarmException

in case ipv6 can not be found

Source code in boardfarm3/templates/lan.py
214
215
216
217
218
219
220
221
222
223
224
@abstractmethod
def get_interface_link_local_ipv6addr(self, interface: str) -> str:
    """Get IPv6 link local address of the interface.

    :param interface: interface name
    :type interface: str
    :return: Link local ipv6 address of the interface
    :rtype: str
    :raises BoardfarmException: in case ipv6 can not be found
    """
    raise NotImplementedError

get_interface_macaddr abstractmethod

get_interface_macaddr(interface: str) -> str

Get the interface MAC address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

MAC address of the interface

Source code in boardfarm3/templates/lan.py
179
180
181
182
183
184
185
186
187
188
@abstractmethod
def get_interface_macaddr(self, interface: str) -> str:
    """Get the interface MAC address.

    :param interface: interface name
    :type interface: str
    :return: MAC address of the interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_mask abstractmethod

get_interface_mask(interface: str) -> str

Get the subnet mask of the interface.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
str

subnet mask of interface

Source code in boardfarm3/templates/lan.py
226
227
228
229
230
231
232
233
234
235
@abstractmethod
def get_interface_mask(self, interface: str) -> str:
    """Get the subnet mask of the interface.

    :param interface: name of the interface
    :type interface: str
    :return: subnet mask of interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_mtu_size abstractmethod

get_interface_mtu_size(interface: str) -> int

Get the MTU size of the interface in bytes.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
int

size of the MTU in bytes

Source code in boardfarm3/templates/lan.py
588
589
590
591
592
593
594
595
596
597
@abstractmethod
def get_interface_mtu_size(self, interface: str) -> int:
    """Get the MTU size of the interface in bytes.

    :param interface: name of the interface
    :type interface: str
    :return: size of the MTU in bytes
    :rtype: int
    """
    raise NotImplementedError

get_iperf_logs abstractmethod

get_iperf_logs(log_file: str) -> str

Read the file output for traffic flow.

Parameters:

Name Type Description Default
log_file
str

iperf log file path

required

Returns:

Type Description
str

traffic flow logs

Source code in boardfarm3/templates/lan.py
703
704
705
706
707
708
709
710
711
712
@abstractmethod
def get_iperf_logs(self, log_file: str) -> str:
    """Read the file output for traffic flow.

    :param log_file: iperf log file path
    :type log_file: str
    :return: traffic flow logs
    :rtype: str
    """
    raise NotImplementedError

get_process_id abstractmethod

get_process_id(process_name: str) -> list[str] | None

Return the process id to the device.

Parameters:

Name Type Description Default
process_name
str

name of the process

required

Returns:

Type Description
list[str] | None

process id if the process exist, else None

Source code in boardfarm3/templates/lan.py
938
939
940
941
942
943
944
945
946
947
@abstractmethod
def get_process_id(self, process_name: str) -> list[str] | None:
    """Return the process id to the device.

    :param process_name: name of the process
    :type process_name: str
    :return: process id if the process exist, else None
    :rtype: list[str] | None
    """
    raise NotImplementedError

hping_flood abstractmethod

hping_flood(
    protocol: str,
    target: str,
    packet_count: str,
    extra_args: str | None = None,
    pkt_interval: str = "",
) -> str

Validate SYN, UDP and ICMP flood operation.

Parameters:

Name Type Description Default
protocol
str

mode, for ex 'S': syn-flood '1': ping-flood (icmp) '2': udp

required
target
str

target IP addr

required
packet_count
str

number of packets to be transmitted.

required
extra_args
str | None

extra arguments to be passed, defaults to None

None
pkt_interval
str

wait for X microseconds before sending next packet uX, defaults to "", uX for X microseconds, for example -i u1000

''

Returns:

Type Description
str

command output

Source code in boardfarm3/templates/lan.py
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
@abstractmethod
def hping_flood(
    self,
    protocol: str,
    target: str,
    packet_count: str,
    extra_args: str | None = None,
    pkt_interval: str = "",
) -> str:
    """Validate SYN, UDP and ICMP flood operation.

    :param protocol: mode, for ex 'S': syn-flood '1': ping-flood (icmp) '2': udp
    :type protocol: str
    :param target: target IP addr
    :type target: str
    :param packet_count: number of packets to be transmitted.
    :type packet_count: str
    :param extra_args: extra arguments to be passed, defaults to None
    :type extra_args: str
    :param pkt_interval: wait for X microseconds before sending next packet uX,
        defaults to "", uX for X microseconds, for example -i u1000
    :type pkt_interval: str
    :return: command output
    :rtype: str
    """
    raise NotImplementedError

http_get abstractmethod

http_get(url: str, timeout: int, options: str) -> HTTPResult

Peform HTTP Get and return parsed result.

Parameters:

Name Type Description Default
url
str

URL to get the response

required
timeout
int

connection timeout for the curl command in seconds

required
options
str

additional curl options

required

Returns:

Type Description
HTTPResult

parsed HTTP response

Source code in boardfarm3/templates/lan.py
433
434
435
436
437
438
439
440
441
442
443
444
445
446
@abstractmethod
def http_get(self, url: str, timeout: int, options: str) -> HTTPResult:
    """Peform HTTP Get and return parsed result.

    :param url: URL to get the response
    :type url: str
    :param timeout: connection timeout for the curl command in seconds
    :type timeout: int
    :param options: additional curl options
    :type options: str
    :return: parsed HTTP response
    :rtype: HTTPResult
    """
    raise NotImplementedError
is_link_up(interface: str, pattern: str = 'BROADCAST,MULTICAST,UP') -> bool

Return the link status.

Parameters:

Name Type Description Default
str

interface name, defaults to "BROADCAST,MULTICAST,UP"

required
str

interface state

'BROADCAST,MULTICAST,UP'

Returns:

Type Description
bool

True if the link is up

Source code in boardfarm3/templates/lan.py
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
@abstractmethod
def is_link_up(
    self,
    interface: str,
    pattern: str = "BROADCAST,MULTICAST,UP",
) -> bool:
    """Return the link status.

    :param interface: interface name, defaults to "BROADCAST,MULTICAST,UP"
    :type interface: str
    :param pattern: interface state
    :type pattern: str
    :return: True if the link is up
    :rtype: bool
    """
    raise NotImplementedError

kill_process abstractmethod

kill_process(pid: int, signal: int) -> None

Kill the running process based on the process id.

Parameters:

Name Type Description Default
pid
int

process id

required
Source code in boardfarm3/templates/lan.py
949
950
951
952
953
954
955
956
957
958
@abstractmethod
def kill_process(self, pid: int, signal: int) -> None:
    """Kill the running process based on the process id.

    :param pid: process id
    :type pid: int
    :type signal: signal number to terminate the process
    :type signal: int
    """
    raise NotImplementedError

netcat abstractmethod

netcat(host_ip: str, port: str, additional_args: str) -> None

Run netcat command to initiate brute force.

Parameters:

Name Type Description Default
host_ip
str

host ip address

required
port
str

port number of the host

required
additional_args
str

additional args to be provided with netcat command

required
Source code in boardfarm3/templates/lan.py
763
764
765
766
767
768
769
770
771
772
773
774
@abstractmethod
def netcat(self, host_ip: str, port: str, additional_args: str) -> None:
    """Run netcat command to initiate brute force.

    :param host_ip: host ip address
    :type host_ip: str
    :param port: port number of the host
    :type port: str
    :param additional_args: additional args to be provided with netcat command
    :type additional_args: str
    """
    raise NotImplementedError

nmap abstractmethod

nmap(
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
    timeout: int = 30,
) -> dict

Perform nmap operation on linux device.

Parameters:

Name Type Description Default
ipaddr
str

IP address on which nmap is performed

required
ip_type
str

type of IP eg: IPv4/IPv6

required
port
str | int | None

destination port on IP, defaults to None

None
protocol
str | None

specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None

None
max_retries
int | None

number of port scan probe retransmissions, defaults to None

None
min_rate
int | None

send packets no slower than per second, defaults to None

None
opts
str | None

other options for a nmap command, defaults to None

None
timeout
int

pexpect timeout for the command in seconds, defaults to 30

30

Returns:

Type Description
dict

response of nmap command in XML/dict format

Raises:

Type Description
BoardfarmException

if IP type is invalid

Source code in boardfarm3/templates/lan.py
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
@abstractmethod
def nmap(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
    timeout: int = 30,
) -> dict:
    """Perform nmap operation on linux device.

    :param ipaddr: IP address on which nmap is performed
    :type ipaddr: str
    :param ip_type: type of IP eg: IPv4/IPv6
    :type ip_type: str
    :param port: destination port on IP, defaults to None
    :type port: str | int | None
    :param protocol: specific protocol to follow eg: tcp(-sT)/udp(-sU),
        defaults to None
    :type protocol: str | None
    :param max_retries: number of port scan probe retransmissions, defaults to None
    :type max_retries: int | None
    :param min_rate: send packets no slower than per second, defaults to None
    :type min_rate: int | None
    :param opts: other options for a nmap command, defaults to None
    :type opts: str | None
    :param timeout: pexpect timeout for the command in seconds, defaults to 30
    :type timeout: int
    :raises BoardfarmException: if IP type is invalid
    :return: response of nmap command in XML/dict format
    :rtype: dict
    """
    raise NotImplementedError

ping abstractmethod

ping(
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict[str, Any]

Ping remote host.

Return True if ping has 0% loss or parsed output in JSON if json_output=True flag is provided.

Parameters:

Name Type Description Default
ping_ip
str

ping IP

required
ping_count
int

number of ping, defaults to 4

4
ping_interface
str | None

ping via interface, defaults to None

None
options
str

extra ping options, defaults to ""

''
timeout
int

timeout, defaults to 50

50
json_output
bool

return ping output in dictionary format, defaults to False

False

Returns:

Type Description
bool | dict[str, Any]

ping output

Source code in boardfarm3/templates/lan.py
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
@abstractmethod
def ping(  # noqa: PLR0913
    self,
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict[str, Any]:
    """Ping remote host.

    Return True if ping has 0% loss
    or parsed output in JSON if json_output=True flag is provided.

    :param ping_ip: ping IP
    :type ping_ip: str
    :param ping_count: number of ping, defaults to 4
    :type ping_count: int
    :param ping_interface: ping via interface, defaults to None
    :type ping_interface: str
    :param options: extra ping options, defaults to ""
    :type options: str
    :param timeout: timeout, defaults to 50
    :type timeout: int
    :param json_output: return ping output in dictionary format, defaults to False
    :type json_output: bool
    :return: ping output
    :rtype: bool | dict[str, Any]
    """
    raise NotImplementedError

release_dhcp abstractmethod

release_dhcp(interface: str) -> None

Release IPv4 of the specified interface.

Parameters:

Name Type Description Default
interface
str

interface name

required
Source code in boardfarm3/templates/lan.py
278
279
280
281
282
283
284
285
@abstractmethod
def release_dhcp(self, interface: str) -> None:
    """Release IPv4 of the specified interface.

    :param interface: interface name
    :type interface: str
    """
    raise NotImplementedError

release_ipv6 abstractmethod

release_ipv6(interface: str, stateless: bool = False) -> None

Release IPv6 of the specified interface.

Parameters:

Name Type Description Default
interface
str

interface name

required
stateless
bool

run command with -S or -6 options. -6 by default

False
Source code in boardfarm3/templates/lan.py
296
297
298
299
300
301
302
303
304
305
@abstractmethod
def release_ipv6(self, interface: str, stateless: bool = False) -> None:
    """Release IPv6 of the specified interface.

    :param interface: interface name
    :type interface: str
    :param stateless: run command with -S or -6 options. -6 by default
    :type stateless: bool
    """
    raise NotImplementedError

renew_dhcp abstractmethod

renew_dhcp(interface: str) -> None

Renew IPv4 of the specified interface by restart of the IPv4 dhclient.

Parameters:

Name Type Description Default
interface
str

interface name

required
Source code in boardfarm3/templates/lan.py
287
288
289
290
291
292
293
294
@abstractmethod
def renew_dhcp(self, interface: str) -> None:
    """Renew IPv4 of the specified interface by restart of the IPv4 dhclient.

    :param interface: interface name
    :type interface: str
    """
    raise NotImplementedError

renew_ipv6 abstractmethod

renew_ipv6(interface: str, stateless: bool = False) -> None

Renew IPv6 of the specified interface.

Parameters:

Name Type Description Default
interface
str

interface name

required
stateless
bool

run command with -S or -6 options. -6 by default

False
Source code in boardfarm3/templates/lan.py
307
308
309
310
311
312
313
314
315
316
@abstractmethod
def renew_ipv6(self, interface: str, stateless: bool = False) -> None:
    """Renew IPv6 of the specified interface.

    :param interface: interface name
    :type interface: str
    :param stateless: run command with -S or -6 options. -6 by default
    :type stateless: bool
    """
    raise NotImplementedError

scp_device_file_to_local abstractmethod

scp_device_file_to_local(local_path: str, source_path: str) -> None

Copy a local file from a server using SCP.

Parameters:

Name Type Description Default
local_path
str

local file path

required
source_path
str

source path

required
Source code in boardfarm3/templates/lan.py
608
609
610
611
612
613
614
615
@abstractmethod
def scp_device_file_to_local(self, local_path: str, source_path: str) -> None:
    """Copy a local file from a server using SCP.

    :param local_path: local file path
    :param source_path: source path
    """
    raise NotImplementedError

send_mldv2_report abstractmethod

send_mldv2_report(mcast_group_record: MulticastGroupRecord, count: int) -> None

Send an MLDv2 report with desired multicast record.

Multicast source and group must be IPv6 addresses. Multicast sources need to be non-multicast addresses and group address needs to be a multicast address.

Implementation relies on a custom send_mld_report script based on scapy.

Parameters:

Name Type Description Default
mcast_group_record
MulticastGroupRecord

MLDv2 multicast group record

required
count
int

num of packets to send in 1s interval

required

Raises:

Type Description
CodeError

if send_mld_report command fails

Source code in boardfarm3/templates/lan.py
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
@abstractmethod
def send_mldv2_report(
    self, mcast_group_record: MulticastGroupRecord, count: int
) -> None:
    """Send an MLDv2 report with desired multicast record.

    Multicast source and group must be IPv6 addresses.
    Multicast sources need to be non-multicast addresses and
    group address needs to be a multicast address.

    Implementation relies on a custom send_mld_report
    script based on scapy.

    :param mcast_group_record: MLDv2 multicast group record
    :type mcast_group_record: MulticastGroupRecord
    :param count: num of packets to send in 1s interval
    :type count: int
    :raises CodeError: if send_mld_report command fails
    """
    raise NotImplementedError

set_date abstractmethod

set_date(opt: str, date_string: str) -> bool

Set the device's date and time.

Parameters:

Name Type Description Default
date_string
str

value to be changed

required
opt
str

Option to set the date or time or day

required

Returns:

Type Description
bool

True if set is successful

Source code in boardfarm3/templates/lan.py
729
730
731
732
733
734
735
736
737
738
739
740
@abstractmethod
def set_date(self, opt: str, date_string: str) -> bool:
    """Set the device's date and time.

    :param date_string: value to be changed
    :type date_string: str
    :param opt: Option to set the date or time or day
    :type opt: str
    :return: True if set is successful
    :rtype: bool
    """
    raise NotImplementedError

set_default_gw abstractmethod

set_default_gw(ip_address: IPv4Address, interface: str) -> None

Set given IP address as default gateway address for given interface.

Parameters:

Name Type Description Default
ip_address
IPv4Address

gateway IP address

required
interface
str

interface name

required
Source code in boardfarm3/templates/lan.py
492
493
494
495
496
497
498
499
500
501
@abstractmethod
def set_default_gw(self, ip_address: IPv4Address, interface: str) -> None:
    """Set given IP address as default gateway address for given interface.

    :param ip_address: gateway IP address
    :type ip_address: IPv4Address
    :param interface: interface name
    :type interface: str
    """
    raise NotImplementedError
set_link_state(interface: str, state: str) -> None

Set link state.

Parameters:

Name Type Description Default
str

name of the interface

required
str

desired state up or down

required
Source code in boardfarm3/templates/lan.py
151
152
153
154
155
156
157
158
159
160
@abstractmethod
def set_link_state(self, interface: str, state: str) -> None:
    """Set link state.

    :param interface: name of the interface
    :type interface: str
    :param state: desired state up or down
    :type state: str
    """
    raise NotImplementedError

set_static_ip abstractmethod

set_static_ip(interface: str, ip_address: IPv4Address, netmask: IPv4Address) -> None

Set given static IP for the LAN.

Parameters:

Name Type Description Default
interface
str

interface name

required
ip_address
IPv4Address

static IP address

required
netmask
IPv4Address

netmask

required
Source code in boardfarm3/templates/lan.py
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
@abstractmethod
def set_static_ip(
    self,
    interface: str,
    ip_address: IPv4Address,
    netmask: IPv4Address,
) -> None:
    """Set given static IP for the LAN.

    :param interface: interface name
    :type interface: str
    :param ip_address: static IP address
    :type ip_address: IPv4Address
    :param netmask: netmask
    :type netmask: IPv4Address
    """
    raise NotImplementedError

start_http_service abstractmethod

start_http_service(port: str, ip_version: str) -> str

Start HTTP service on given port number.

Parameters:

Name Type Description Default
port
str

port number

required
ip_version
str

IP version, 4 - IPv4, 6 - IPv6

required

Returns:

Type Description
str

PID number of the HTTP service

Source code in boardfarm3/templates/lan.py
411
412
413
414
415
416
417
418
419
420
421
422
@abstractmethod
def start_http_service(self, port: str, ip_version: str) -> str:
    """Start HTTP service on given port number.

    :param port: port number
    :type port: str
    :param ip_version: IP version, 4 - IPv4, 6 - IPv6
    :type ip_version: str
    :return: PID number of the HTTP service
    :rtype: str
    """
    raise NotImplementedError

start_ipv4_lan_client abstractmethod

start_ipv4_lan_client(
    wan_gw: str | IPv4Address | None = None, prep_iface: bool = False
) -> str

Restart IPv4 dhclient to obtain IP.

Parameters:

Name Type Description Default
wan_gw
str | IPv4Address | None

WAN gateway IP to setup fixed route in case lan_fixed_route_to_wan option is provided

None
prep_iface
bool

restart interface before dhclient request

False

Returns:

Type Description
str

IPv4 after renewal

Raises:

Type Description
pexpect.TimeoutException

in case of failure

Source code in boardfarm3/templates/lan.py
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
@abstractmethod
def start_ipv4_lan_client(
    self,
    wan_gw: str | IPv4Address | None = None,
    prep_iface: bool = False,
) -> str:
    """Restart IPv4 dhclient to obtain IP.

    :param wan_gw: WAN gateway IP
        to setup fixed route in case lan_fixed_route_to_wan option is provided
    :type wan_gw: str | IPv4Address | None
    :param prep_iface: restart interface before dhclient request
    :type prep_iface: bool
    :return: IPv4 after renewal
    :rtype: str
    :raises pexpect.TimeoutException: in case of failure
    """
    raise NotImplementedError

start_ipv6_lan_client abstractmethod

start_ipv6_lan_client(
    wan_gw: str | IPv4Address | None = None, prep_iface: bool = False
) -> str

Restart IPv6 dhclient to obtain IP.

Parameters:

Name Type Description Default
wan_gw
str | IPv4Address | None

WAN gateway IP to setup fixed route in case lan_fixed_route_to_wan option is provided

None
prep_iface
bool

restart interface before dhclient request

False

Returns:

Type Description
str

IPv6 after renewal

Raises:

Type Description
pexpect.TimeoutException

in case of failure

Source code in boardfarm3/templates/lan.py
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
@abstractmethod
def start_ipv6_lan_client(
    self,
    wan_gw: str | IPv4Address | None = None,
    prep_iface: bool = False,
) -> str:
    """Restart IPv6 dhclient to obtain IP.

    :param wan_gw: WAN gateway IP
        to setup fixed route in case lan_fixed_route_to_wan option is provided
    :type wan_gw: str | IPv4Address | None
    :param prep_iface: restart interface before dhclient request
    :type prep_iface: bool
    :return: IPv6 after renewal
    :rtype: str
    :raises pexpect.TimeoutException: in case of failure
    """
    raise NotImplementedError

start_nping abstractmethod

start_nping(
    interface_ip: str,
    ipv6_flag: bool,
    extra_args: str,
    port_range: str,
    hit_count: str,
    rate: str,
    mode: str,
) -> str

Perform nping.

Parameters:

Name Type Description Default
interface_ip
str

interface ip addr

required
ipv6_flag
bool

flag if ipv6 addr to be used

required
extra_args
str

any extra arguments

required
port_range
str

target port range

required
hit_count
str

the number of times to target each host

required
rate
str

num of packets per second to send

required
mode
str

probe mode. tcp/udp/icmp etc protocol

required

Returns:

Type Description
str

process id

Raises:

Type Description
ValueError

if unable to start nping.

Source code in boardfarm3/templates/lan.py
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
@abstractmethod
def start_nping(  # pylint: disable=too-many-arguments # noqa: PLR0913
    self,
    interface_ip: str,
    ipv6_flag: bool,
    extra_args: str,
    port_range: str,
    hit_count: str,
    rate: str,
    mode: str,
) -> str:
    """Perform nping.

    :param interface_ip: interface ip addr
    :type interface_ip: str
    :param ipv6_flag: flag if ipv6 addr to be used
    :type ipv6_flag: bool
    :param extra_args: any extra arguments
    :type extra_args: str
    :param port_range: target port range
    :type port_range: str
    :param hit_count: the number of times to target each host
    :type hit_count: str
    :param rate: num of packets per second to send
    :type rate: str
    :param mode: probe mode. tcp/udp/icmp etc protocol
    :type mode: str
    :return: process id
    :rtype: str
    :raises ValueError: if unable to start nping.
    """
    raise NotImplementedError

start_tcpdump abstractmethod

start_tcpdump(
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str

Start tcpdump capture on given interface.

Parameters:

Name Type Description Default
interface
str

inteface name where packets to be captured

required
port
str | None

port number, can be a range of ports(eg: 443 or 433-443)

required
output_file
str

pcap file name, Defaults: pkt_capture.pcap

'pkt_capture.pcap'
filters
dict | None

filters as key value pair(eg: {"-v": "", "-c": "4"})

None
additional_filters
str | None

additional filters

''

Returns:

Type Description
str

console ouput and tcpdump process id

Raises:

Type Description
ValueError

on failed to start tcpdump

Source code in boardfarm3/templates/lan.py
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
@abstractmethod
def start_tcpdump(
    self,
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str:
    """Start tcpdump capture on given interface.

    :param interface: inteface name where packets to be captured
    :type interface: str
    :param port: port number, can be a range of ports(eg: 443 or 433-443)
    :type port: str
    :param output_file: pcap file name, Defaults: pkt_capture.pcap
    :type output_file: str
    :param filters: filters as key value pair(eg: {"-v": "", "-c": "4"})
    :type filters: Optional[Dict]
    :param additional_filters: additional filters
    :type additional_filters: Optional[str]
    :raises ValueError: on failed to start tcpdump
    :return: console ouput and tcpdump process id
    :rtype: str
    """
    raise NotImplementedError

start_traffic_receiver abstractmethod

start_traffic_receiver(
    traffic_port: int,
    bind_to_ip: str | None = None,
    ip_version: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]

Start the server on a linux device to generate traffic using iperf3.

Parameters:

Name Type Description Default
traffic_port
int

server port to listen on

required
bind_to_ip
str | None

bind to the interface associated with the address host, defaults to None

None
ip_version
int | None

4 or 6 as it uses only IPv4 or IPv6, defaults to None

None
udp_only
bool | None

to be used if protocol is UDP only, backward compatibility with iperf version 2 as iperf3 does not support udp only flag for server

None

Returns:

Type Description
tuple[int, str]

the process id(pid) and log file path

Raises:

Type Description
CodeError

raises if unable to start server

Source code in boardfarm3/templates/lan.py
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
@abstractmethod
def start_traffic_receiver(
    self,
    traffic_port: int,
    bind_to_ip: str | None = None,
    ip_version: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]:
    """Start the server on a linux device to generate traffic using iperf3.

    :param traffic_port: server port to listen on
    :type traffic_port: int
    :param bind_to_ip: bind to the interface associated with
        the address host, defaults to None
    :type bind_to_ip: str | None
    :param ip_version: 4 or 6 as it uses only IPv4 or IPv6, defaults to None
    :type ip_version: int | None
    :param udp_only: to be used if protocol is UDP only,
        backward compatibility with iperf version 2 as iperf3 does not support
        udp only flag for server
    :type udp_only: bool, optional
    :raises CodeError: raises if unable to start server
    :return: the process id(pid) and log file path
    :rtype: tuple[int, str]
    """
    raise NotImplementedError

start_traffic_sender abstractmethod

start_traffic_sender(
    host: str,
    traffic_port: int,
    bandwidth: int | None = None,
    bind_to_ip: str | None = None,
    direction: str | None = None,
    ip_version: int | None = None,
    udp_protocol: bool = False,
    time: int = 10,
    client_port: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]

Start traffic on a linux client using iperf3.

Parameters:

Name Type Description Default
host
str

a host to run in client mode

required
traffic_port
int

server port to connect to

required
bandwidth
int | None

bandwidth(mbps) at which the traffic has to be generated, defaults to None

None
bind_to_ip
str | None

bind to the interface associated with the address host, defaults to None

None
direction
str | None

--reverse to run in reverse mode (server sends, client receives) or --bidir to run in bidirectional mode, defaults to None

None
ip_version
int | None

4 or 6 as it uses only IPv4 or IPv6, defaults to None

None
udp_protocol
bool

use UDP rather than TCP, defaults to False

False
time
int

time in seconds to transmit for, defaults to 10

10
client_port
int | None

client port from where the traffic is getting started

None
udp_only
bool | None

to be used if protocol is UDP only, backward compatibility with iperf version 2

None

Returns:

Type Description
tuple[int, str]

the process id(pid) and log file path

Raises:

Type Description
CodeError

raises if unable to start server

Source code in boardfarm3/templates/lan.py
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
@abstractmethod
def start_traffic_sender(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    host: str,
    traffic_port: int,
    bandwidth: int | None = None,
    bind_to_ip: str | None = None,
    direction: str | None = None,
    ip_version: int | None = None,
    udp_protocol: bool = False,
    time: int = 10,
    client_port: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]:
    """Start traffic on a linux client using iperf3.

    :param host: a host to run in client mode
    :type host: str
    :param traffic_port: server port to connect to
    :type traffic_port: int
    :param bandwidth: bandwidth(mbps) at which the traffic
        has to be generated, defaults to None
    :type bandwidth: int | None
    :param bind_to_ip: bind to the interface associated with
        the address host, defaults to None
    :type bind_to_ip: str | None
    :param direction: `--reverse` to run in reverse mode
        (server sends, client receives) or `--bidir` to run in
        bidirectional mode, defaults to None
    :type direction: str | None
    :param ip_version: 4 or 6 as it uses only IPv4 or IPv6, defaults to None
    :type ip_version: int | None
    :param udp_protocol: use UDP rather than TCP, defaults to False
    :type udp_protocol: bool
    :param time: time in seconds to transmit for, defaults to 10
    :type time: int
    :param client_port: client port from where the traffic is getting started
    :type client_port: int | None
    :param udp_only: to be used if protocol is UDP only,
        backward compatibility with iperf version 2
    :type udp_only: bool, optional
    :raises CodeError: raises if unable to start server
    :return: the process id(pid) and log file path
    :rtype: tuple[int, str]
    """
    raise NotImplementedError

stop_http_service abstractmethod

stop_http_service(port: str) -> None

Stop HTTP service running on given port.

Parameters:

Name Type Description Default
port
str

port number

required
Source code in boardfarm3/templates/lan.py
424
425
426
427
428
429
430
431
@abstractmethod
def stop_http_service(self, port: str) -> None:
    """Stop HTTP service running on given port.

    :param port: port number
    :type port: str
    """
    raise NotImplementedError

stop_nping abstractmethod

stop_nping(process_id: str) -> None

Stop nping process running in background.

Parameters:

Name Type Description Default
process_id
str

process id of nping

required

Raises:

Type Description
BoardfarmException

when unable to stop process

Source code in boardfarm3/templates/lan.py
809
810
811
812
813
814
815
816
817
@abstractmethod
def stop_nping(self, process_id: str) -> None:
    """Stop nping process running in background.

    :param process_id: process id of nping
    :type process_id: str
    :raises BoardfarmException: when unable to stop process
    """
    raise NotImplementedError

stop_tcpdump abstractmethod

stop_tcpdump(process_id: str) -> None

Stop tcpdump capture.

Parameters:

Name Type Description Default
process_id
str

tcpdump process id

required
Source code in boardfarm3/templates/lan.py
909
910
911
912
913
914
915
916
@abstractmethod
def stop_tcpdump(self, process_id: str) -> None:
    """Stop tcpdump capture.

    :param process_id: tcpdump process id
    :type process_id: str
    """
    raise NotImplementedError

stop_traffic abstractmethod

stop_traffic(pid: int | None = None) -> bool

Stop the iPerf3 process for a specific PID or killall.

Parameters:

Name Type Description Default
pid
int | None

process ID for a iPerf3 service either for reciever or sender, defaults to None

None

Returns:

Type Description
bool

True if process is stopped else False

Source code in boardfarm3/templates/lan.py
691
692
693
694
695
696
697
698
699
700
701
@abstractmethod
def stop_traffic(self, pid: int | None = None) -> bool:
    """Stop the iPerf3 process for a specific PID or killall.

    :param pid: process ID for a iPerf3 service either for reciever or sender,
        defaults to None
    :type pid: int | None
    :return: True if process is stopped else False
    :rtype: bool
    """
    raise NotImplementedError

tcpdump_capture abstractmethod

tcpdump_capture(
    fname: str, interface: str = "any", additional_args: str | None = None
) -> Generator[str]

Capture packets from specified interface.

Packet capture using tcpdump utility at a specified interface.

:yield: process id of tcpdump process

Parameters:

Name Type Description Default
fname
str

name of the file where packet captures will be stored

required
interface
str

name of the interface, defaults to "any"

'any'
additional_args
str | None

argument arguments to tcpdump executable

None

Returns:

Type Description
Generator[str, None, None]

tcpdump capture command console output

Source code in boardfarm3/templates/lan.py
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
@contextmanager
@abstractmethod
def tcpdump_capture(
    self,
    fname: str,
    interface: str = "any",
    additional_args: str | None = None,
) -> Generator[str]:
    """Capture packets from specified interface.

    Packet capture using tcpdump utility at a specified interface.

    :param fname: name of the file where packet captures will be stored
    :type fname: str
    :param interface: name of the interface, defaults to "any"
    :type interface: str
    :param additional_args: argument arguments to tcpdump executable
    :type additional_args: str
    :return: tcpdump capture command console output
    :rtype: Generator[str, None, None]
    :yield: process id of tcpdump process
    """
    raise NotImplementedError

traceroute abstractmethod

traceroute(
    host_ip: str | IPv4Address, version: str = "", options: str = "", timeout: int = 60
) -> str | None

Return output of traceroute command.

Parameters:

Name Type Description Default
host_ip
str | IPv4Address

destination IP address

required
version
str

4 or 6

''
options
str

traceroute command options

''
timeout
int

request timeout

60

Returns:

Type Description
str | None

traceroute command output

Source code in boardfarm3/templates/lan.py
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
@abstractmethod
def traceroute(
    self,
    host_ip: str | IPv4Address,
    version: str = "",
    options: str = "",
    timeout: int = 60,
) -> str | None:
    """Return output of traceroute command.

    :param host_ip: destination IP address
    :type host_ip: str | IPv4Address
    :param version: 4 or 6
    :type version: str
    :param options: traceroute command options
    :type options: str
    :param timeout: request timeout
    :type timeout: int
    :return: traceroute command output
    :rtype: str | None
    """
    raise NotImplementedError

tshark_read_pcap abstractmethod

tshark_read_pcap(
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str

Read packet captures from an existing file.

Parameters:

Name Type Description Default
fname
str

name of the file in which captures are saved

required
additional_args
str | None

additional arguments for tshark command

None
timeout
int

time out for tshark command to be executed, defaults to 30

30
rm_pcap
bool

If True remove the packet capture file after reading it

False

Returns:

Type Description
str

return tshark read command console output

Source code in boardfarm3/templates/lan.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
@abstractmethod
def tshark_read_pcap(
    self,
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str:
    """Read packet captures from an existing file.

    :param fname: name of the file in which captures are saved
    :type fname: str
    :param additional_args: additional arguments for tshark command
    :type additional_args: str
    :param timeout: time out for tshark command to be executed, defaults to 30
    :type timeout: int
    :param rm_pcap: If True remove the packet capture file after reading it
    :type rm_pcap: bool
    :return: return tshark read command console output
    :rtype: str
    """
    raise NotImplementedError

line_termination

Generic Template for Line Termination Systems.

Acts as a boilerplate to further extend templating of different broadband LTSs like CMTS, OLT or DSLAMs.

Classes:

Name Description
LTS

Generic LTS template.

LTS

Generic LTS template.

Methods:

Name Description
tshark_read_pcap

Read packet captures from an existing file.

tshark_read_pcap abstractmethod

tshark_read_pcap(
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str

Read packet captures from an existing file.

Parameters:

Name Type Description Default
fname
str

name of the file in which captures are saved

required
additional_args
str | None

additional arguments for tshark command

None
timeout
int

time out for tshark command to be executed, defaults to 30

30
rm_pcap
bool

If True remove the packet capture file after reading it

False

Returns:

Type Description
str

return tshark read command console output

Source code in boardfarm3/templates/line_termination.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@abstractmethod
def tshark_read_pcap(
    self,
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str:
    """Read packet captures from an existing file.

    :param fname: name of the file in which captures are saved
    :param additional_args: additional arguments for tshark command
    :param timeout: time out for tshark command to be executed, defaults to 30
    :param rm_pcap: If True remove the packet capture file after reading it
    :return: return tshark read command console output
    """
    raise NotImplementedError

pdu

Define the PDU template.

Classes:

Name Description
PDU

PDU template to be implemented.

PDU

PDU(uri: str)

PDU template to be implemented.

Initialise the PUD object.

examples of PDU uris:

NetIO:        "10.64.40.34; 2"
Raritan PX2:  "10.71.10.53:23; 2"
Raritan PX3:  "10.71.10.53:22; 1"

No type is passed to the PDU only the connection parameters.

Parameters:

Name Type Description Default

uri

str

a string relating to the PDU access params

required

Methods:

Name Description
power_cycle

Power cycle the given PDU outlet.

power_off

Power OFF the given PDU outlet.

power_on

Power ON the given PDU outlet.

Source code in boardfarm3/templates/pdu.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@abstractmethod
def __init__(self, uri: str) -> None:
    """Initialise the PUD object.

    examples of PDU uris:

        NetIO:        "10.64.40.34; 2"
        Raritan PX2:  "10.71.10.53:23; 2"
        Raritan PX3:  "10.71.10.53:22; 1"

    No type is passed to the PDU only the connection parameters.

    :param uri: a string relating to the PDU access params
    :type uri: str
    """
    raise NotImplementedError

power_cycle abstractmethod

power_cycle() -> bool

Power cycle the given PDU outlet.

Returns:

Type Description
bool

True on success

Source code in boardfarm3/templates/pdu.py
42
43
44
45
46
47
48
@abstractmethod
def power_cycle(self) -> bool:
    """Power cycle the given PDU outlet.

    :returns: True on success
    """
    raise NotImplementedError

power_off abstractmethod

power_off() -> bool

Power OFF the given PDU outlet.

Returns:

Type Description
bool

True on success

Source code in boardfarm3/templates/pdu.py
26
27
28
29
30
31
32
@abstractmethod
def power_off(self) -> bool:
    """Power OFF the given PDU outlet.

    :returns: True on success
    """
    raise NotImplementedError

power_on abstractmethod

power_on() -> bool

Power ON the given PDU outlet.

Returns:

Type Description
bool

True on success

Source code in boardfarm3/templates/pdu.py
34
35
36
37
38
39
40
@abstractmethod
def power_on(self) -> bool:
    """Power ON the given PDU outlet.

    :returns: True on success
    """
    raise NotImplementedError

provisioner

Provisioner device template.

Classes:

Name Description
Provisioner

Boardfarm base provisioner device template.

Provisioner

Provisioner(config: dict, cmdline_args: Namespace)

Boardfarm base provisioner device template.

Initialize boardfarm base device.

Parameters:

Name Type Description Default

config

dict

device configuration

required

cmdline_args

Namespace

command line arguments

required

Methods:

Name Description
delete_file

Delete the file from the device.

get_interactive_consoles

Get interactive consoles from device.

provision_cpe

Provision the CPE.

scp_device_file_to_local

Copy a local file from a server using SCP.

start_tcpdump

Start tcpdump capture on given interface.

stop_tcpdump

Stop tcpdump capture.

tshark_read_pcap

Read packet captures from an existing file.

Attributes:

Name Type Description
config dict

Get device configuration.

console BoardfarmPexpect

Returns Provisioner console.

device_name str

Get name of the device.

device_type str

Get type of the device.

firewall IptablesFirewall

Returns Firewall utility instance.

iface_dut str

Name of the interface that is connected to DUT.

Source code in boardfarm3/devices/base_devices/boardfarm_device.py
11
12
13
14
15
16
17
18
def __init__(self, config: dict, cmdline_args: Namespace) -> None:
    """Initialize boardfarm base device.

    :param config: device configuration
    :param cmdline_args: command line arguments
    """
    self._config: dict = config
    self._cmdline_args = cmdline_args

config property

config: dict

Get device configuration.

Returns:

Type Description
dict

device configuration

console abstractmethod property

Returns Provisioner console.

Returns:

Type Description
BoardfarmPexpect

console

device_name property

device_name: str

Get name of the device.

Returns:

Type Description
str

device name

device_type property

device_type: str

Get type of the device.

Returns:

Type Description
str

device type

firewall abstractmethod property

firewall: IptablesFirewall

Returns Firewall utility instance.

Returns:

Type Description
IptablesFirewall

firewall utility instance with console object

iface_dut abstractmethod property

iface_dut: str

Name of the interface that is connected to DUT.

delete_file abstractmethod

delete_file(filename: str) -> None

Delete the file from the device.

Parameters:

Name Type Description Default
filename
str

name of the file with absolute path

required
Source code in boardfarm3/templates/provisioner.py
130
131
132
133
134
135
136
137
@abstractmethod
def delete_file(self, filename: str) -> None:
    """Delete the file from the device.

    :param filename: name of the file with absolute path
    :type filename: str
    """
    raise NotImplementedError

get_interactive_consoles

get_interactive_consoles() -> dict[str, BoardfarmPexpect]

Get interactive consoles from device.

Returns:

Type Description
dict[str, BoardfarmPexpect]

interactive consoles of the device

Source code in boardfarm3/devices/base_devices/boardfarm_device.py
44
45
46
47
48
49
def get_interactive_consoles(self) -> dict[str, BoardfarmPexpect]:
    """Get interactive consoles from device.

    :returns: interactive consoles of the device
    """
    return {}

provision_cpe abstractmethod

provision_cpe(
    cpe_mac: str,
    dhcpv4_options: dict[DHCPServicePools, DHCPv4Options],
    dhcpv6_options: dict[DHCPServicePools, DHCPv6Options],
) -> None

Provision the CPE.

Adds a DHCP Host reservation in the provisioner.

The host reservation can further be configured to also provide custom DHCP option data, depending on the option requested as part of the dhcpv4_option and dhcpv6_options arguments.

.. code-block:: python

mac = "AA:BB:CC:DD:EE:AA"
provisioner = device_manager.get_device_by_type(Provisioner)

# Provision a CPE MAC with default DHCP options
provisioner.provision_cpe(
    cpe_mac=mac,
    dhcpv4_options={},
    dhcpv6_options={},
)

# Provision a CPE MAC with custom DHCP options
# Note: This is a partial configuration.
# If only partial details are provided, device class
# will fill the remaining option data with defaults
dhcpv4_options = {
    "data": {"dns-server": "x.x.x.x"},
    "voice": {"ntp-server": "y.y.y.y"},
}
provisioner.provision_cpe(
    cpe_mac=mac, dhcpv4_options=dhcpv4_options, dhcpv6_options={}
)

Parameters:

Name Type Description Default
cpe_mac
str

CPE mac address

required
dhcpv4_options
dict[DHCPServicePools, DHCPv4Options]

DHCPv4 Options with ACS, NTP, DNS details

required
dhcpv6_options
dict[DHCPServicePools, DHCPv6Options]

DHCPv6 Options with ACS, NTP, DNS details

required
Source code in boardfarm3/templates/provisioner.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@abstractmethod
def provision_cpe(
    self,
    cpe_mac: str,
    dhcpv4_options: dict[DHCPServicePools, DHCPv4Options],
    dhcpv6_options: dict[DHCPServicePools, DHCPv6Options],
) -> None:
    """Provision the CPE.

    Adds a DHCP Host reservation in the provisioner.

    The host reservation can further be configured to also provide
    custom DHCP option data, depending on the option requested as part
    of the ```dhcpv4_option``` and ```dhcpv6_options``` arguments.

    .. code-block:: python

        mac = "AA:BB:CC:DD:EE:AA"
        provisioner = device_manager.get_device_by_type(Provisioner)

        # Provision a CPE MAC with default DHCP options
        provisioner.provision_cpe(
            cpe_mac=mac,
            dhcpv4_options={},
            dhcpv6_options={},
        )

        # Provision a CPE MAC with custom DHCP options
        # Note: This is a partial configuration.
        # If only partial details are provided, device class
        # will fill the remaining option data with defaults
        dhcpv4_options = {
            "data": {"dns-server": "x.x.x.x"},
            "voice": {"ntp-server": "y.y.y.y"},
        }
        provisioner.provision_cpe(
            cpe_mac=mac, dhcpv4_options=dhcpv4_options, dhcpv6_options={}
        )

    :param cpe_mac: CPE mac address
    :type cpe_mac: str
    :param dhcpv4_options: DHCPv4 Options with ACS, NTP, DNS details
    :type dhcpv4_options: dict[DHCPServicePools, DHCPv4Options]
    :param dhcpv6_options: DHCPv6 Options with ACS, NTP, DNS details
    :type dhcpv6_options: dict[DHCPServicePools, DHCPv6Options]

    """
    raise NotImplementedError

scp_device_file_to_local abstractmethod

scp_device_file_to_local(local_path: str, source_path: str) -> None

Copy a local file from a server using SCP.

Parameters:

Name Type Description Default
local_path
str

local file path

required
source_path
str

source path

required
Source code in boardfarm3/templates/provisioner.py
121
122
123
124
125
126
127
128
@abstractmethod
def scp_device_file_to_local(self, local_path: str, source_path: str) -> None:
    """Copy a local file from a server using SCP.

    :param local_path: local file path
    :param source_path: source path
    """
    raise NotImplementedError

start_tcpdump abstractmethod

start_tcpdump(
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str

Start tcpdump capture on given interface.

Parameters:

Name Type Description Default
interface
str

inteface name where packets to be captured

required
port
str | None

port number, can be a range of ports(eg: 443 or 433-443)

required
output_file
str

pcap file name, Defaults: pkt_capture.pcap

'pkt_capture.pcap'
filters
dict | None

filters as key value pair(eg: {"-v": "", "-c": "4"})

None
additional_filters
str | None

additional filters

''

Returns:

Type Description
str

console ouput and tcpdump process id

Raises:

Type Description
ValueError

on failed to start tcpdump

Source code in boardfarm3/templates/provisioner.py
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
@abstractmethod
def start_tcpdump(
    self,
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str:
    """Start tcpdump capture on given interface.

    :param interface: inteface name where packets to be captured
    :type interface: str
    :param port: port number, can be a range of ports(eg: 443 or 433-443)
    :type port: str
    :param output_file: pcap file name, Defaults: pkt_capture.pcap
    :type output_file: str
    :param filters: filters as key value pair(eg: {"-v": "", "-c": "4"})
    :type filters: Optional[Dict]
    :param additional_filters: additional filters
    :type additional_filters: Optional[str]
    :raises ValueError: on failed to start tcpdump
    :return: console ouput and tcpdump process id
    :rtype: str
    """
    raise NotImplementedError

stop_tcpdump abstractmethod

stop_tcpdump(process_id: str) -> None

Stop tcpdump capture.

Parameters:

Name Type Description Default
process_id
str

tcpdump process id

required
Source code in boardfarm3/templates/provisioner.py
166
167
168
169
170
171
172
173
@abstractmethod
def stop_tcpdump(self, process_id: str) -> None:
    """Stop tcpdump capture.

    :param process_id: tcpdump process id
    :type process_id: str
    """
    raise NotImplementedError

tshark_read_pcap abstractmethod

tshark_read_pcap(
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str

Read packet captures from an existing file.

Parameters:

Name Type Description Default
fname
str

name of the file in which captures are saved

required
additional_args
str | None

additional arguments for tshark command

None
timeout
int

timeout for tshark command to be executed, defaults to 30

30
rm_pcap
bool

If True remove the packet capture file after reading it

False

Returns:

Type Description
str

return tshark read command console output

Raises:

Type Description
BoardfarmException

when invalid filters are added

Source code in boardfarm3/templates/provisioner.py
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@abstractmethod
def tshark_read_pcap(
    self,
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str:
    """Read packet captures from an existing file.

    :param fname: name of the file in which captures are saved
    :param additional_args: additional arguments for tshark command
    :param timeout: timeout for tshark command to be executed, defaults to 30
    :param rm_pcap: If True remove the packet capture file after reading it
    :return: return tshark read command console output
    :raises  FileNotFoundError: when file is not found
    :raises BoardfarmException: when invalid filters are added
    """
    raise NotImplementedError

sip_phone

SIPPhone Template module.

Classes:

Name Description
SIPPhone

SIP Phone Template.

SIPPhone

SIP Phone Template.

Methods:

Name Description
answer

To answer a call on RING state.

answer_waiting_call

Answer the waiting call and hang up on the current call.

detect_dialtone

Check if dialtone is detected off_hook on the active_line.

dial

Dial the given sequence.

dial_feature_code

Dial a feature code.

has_off_hook_warning

Check if Phone has off hook warning on a line represented by active_line.

hook_flash

Perform hook flash.

is_call_ended

Check if Phone has end up the call on a line represented by active_line.

is_call_not_answered

Verify if caller's call was not answered on active_line.

is_call_waiting

Check if Phone is on call waiting on a line represented by active_line.

is_code_ended

Check if Phone has end up the code on a line represented by active_line.

is_connected

Check if call is connected on the active_line.

is_dialing

Check if the phone is dialing to another phone.

is_idle

Check if Phone is in idle state on a line represented by active_line.

is_in_conference

Check if Phone is in conference on a line represented by active_line.

is_incall_connected

Check if call is in call connected on the active_line.

is_incall_dialing

Check if Phone is in call and dialing.

is_incall_playing_dialtone

Check if Phone is playing dialtone. on one line and on call to another line.

is_line_busy

Check if the call is denied due to callee being busy.

is_onhold

Check if Phone is on hold on a line represented by active_line.

is_playing_dialtone

Check if Phone is playing dialtone on a line represented by active_line.

is_ringing

Check if Phone is ringing on a line represented by active_line.

merge_two_calls

Merge the two calls for conference calling.

off_hook

Execute off_hook procedure to connect to a line.

on_hook

Execute on_hook procedure to disconnect to a line.

phone_config

Configure phone with a SIP url using SIP server ddqn for registration.

phone_kill

Close the serial connection.

phone_start

Connect to the serial line of FXS modem.

place_call_offhold

Place an ongoing call off-hold.

place_call_onhold

Place an ongoing call on-hold.

press_R_button

Press the R button.

press_buttons

Press the given sequence of buttons.

reject_waiting_call

Reject a call on waiting on second line.

reply_with_code

To reply back to an incoming call with a SIP code value.

toggle_call

Toggle between the calls.

Attributes:

Name Type Description
ipv4_addr str | None

Return the SIP Phone IP v4 address.

ipv6_addr str | None

Return the SIP Phone IP v6 address.

name str

Return the SIP Phone name.

number str

To get the registered SIP number.

ipv4_addr abstractmethod property

ipv4_addr: str | None

Return the SIP Phone IP v4 address.

Returns:

Type Description
str | None

phone IP v4 address

ipv6_addr abstractmethod property

ipv6_addr: str | None

Return the SIP Phone IP v6 address.

Returns:

Type Description
str | None

phone IP v6 address

name abstractmethod property

name: str

Return the SIP Phone name.

Returns:

Type Description
str

phone name

number abstractmethod property

number: str

To get the registered SIP number.

This property shall be dynamically populated during the post_boot activities of environment setup for voice.

answer abstractmethod

answer() -> bool

To answer a call on RING state.

Source code in boardfarm3/templates/sip_phone.py
90
91
92
93
@abstractmethod
def answer(self) -> bool:
    """To answer a call on RING state."""
    raise NotImplementedError

answer_waiting_call abstractmethod

answer_waiting_call() -> None

Answer the waiting call and hang up on the current call.

This will toggle the line on the device.

Source code in boardfarm3/templates/sip_phone.py
306
307
308
309
310
311
312
@abstractmethod
def answer_waiting_call(self) -> None:
    """Answer the waiting call and hang up on the current call.

    This will toggle the line on the device.
    """
    raise NotImplementedError

detect_dialtone abstractmethod

detect_dialtone() -> bool

Check if dialtone is detected off_hook on the active_line.

Returns:

Type Description
bool

True if dial tone is detected

Source code in boardfarm3/templates/sip_phone.py
259
260
261
262
263
264
265
266
@abstractmethod
def detect_dialtone(self) -> bool:
    """Check if dialtone is detected off_hook on the active_line.

    :return: True if dial tone is detected
    :rtype: bool
    """
    raise NotImplementedError

dial abstractmethod

dial(sequence: str) -> None

Dial the given sequence.

This sequence could be a phone number or a VSC.

Call shall proceed on the line indicated by active_line property.

Parameters:

Name Type Description Default
sequence
str

phone number or VSC

required

Raises:

Type Description
NotImplementedError

as this is a Template.

Source code in boardfarm3/templates/sip_phone.py
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
@abstractmethod
def dial(self, sequence: str) -> None:
    """Dial the given sequence.

    This sequence could be a phone number or a VSC.

    Call shall proceed on the line indicated by active_line property.

    :param sequence: phone number or VSC
    :type sequence: str
    :raises NotImplementedError: as this is a Template.
    """
    raise NotImplementedError

dial_feature_code

dial_feature_code(code: str) -> None

Dial a feature code.

Dial the given code, check that it executed and put the phone on hook.

Parameters:

Name Type Description Default
code
str

the code to be executed

required

Raises:

Type Description
VoiceError

in case execution did not end well

Source code in boardfarm3/templates/sip_phone.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
def dial_feature_code(self, code: str) -> None:
    """Dial a feature code.

    Dial the given code, check that it executed and put the phone on hook.

    :param code: the code to be executed
    :type code: str
    :raises VoiceError: in case execution did not end well
    """
    self.dial(sequence=code)
    if not self.is_code_ended():
        msg = f"Call not ended after dialing a feature code: {code}"
        raise VoiceError(msg)
    self.on_hook()

has_off_hook_warning abstractmethod

has_off_hook_warning() -> bool

Check if Phone has off hook warning on a line represented by active_line.

Returns:

Type Description
bool

True if the phone has off hook warning

Source code in boardfarm3/templates/sip_phone.py
250
251
252
253
254
255
256
257
@abstractmethod
def has_off_hook_warning(self) -> bool:
    """Check if Phone has off hook warning on a line represented by active_line.

    :return: True if the phone has off hook warning
    :rtype: bool
    """
    raise NotImplementedError

hook_flash abstractmethod

hook_flash() -> None

Perform hook flash.

Raises:

Type Description
NotImplementedError

as this is a Template

Source code in boardfarm3/templates/sip_phone.py
371
372
373
374
375
376
377
378
@abstractmethod
def hook_flash(self) -> None:
    """Perform hook flash.

    :raises NotImplementedError: as this is a Template
    """
    msg = "Not supported."
    raise NotImplementedError(msg)

is_call_ended abstractmethod

is_call_ended() -> bool

Check if Phone has end up the call on a line represented by active_line.

Returns:

Type Description
bool

True if the phone end up the call

Source code in boardfarm3/templates/sip_phone.py
214
215
216
217
218
219
220
221
@abstractmethod
def is_call_ended(self) -> bool:
    """Check if Phone has end up the call on a line represented by active_line.

    :return: True if the phone end up the call
    :rtype: bool
    """
    raise NotImplementedError

is_call_not_answered abstractmethod

is_call_not_answered() -> bool

Verify if caller's call was not answered on active_line.

Returns:

Type Description
bool

True if not answered, else False

Source code in boardfarm3/templates/sip_phone.py
296
297
298
299
300
301
302
303
@abstractmethod
def is_call_not_answered(self) -> bool:
    """Verify if caller's call was not answered on active_line.

    :return: True if not answered, else False
    :rtype: bool
    """
    raise NotImplementedError

is_call_waiting abstractmethod

is_call_waiting() -> bool

Check if Phone is on call waiting on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is on call waiting

Source code in boardfarm3/templates/sip_phone.py
232
233
234
235
236
237
238
239
@abstractmethod
def is_call_waiting(self) -> bool:
    """Check if Phone is on call waiting on a line represented by active_line.

    :return: True if the phone is on call waiting
    :rtype: bool
    """
    raise NotImplementedError

is_code_ended abstractmethod

is_code_ended() -> bool

Check if Phone has end up the code on a line represented by active_line.

Returns:

Type Description
bool

True if the phone has end up the code

Source code in boardfarm3/templates/sip_phone.py
223
224
225
226
227
228
229
230
@abstractmethod
def is_code_ended(self) -> bool:
    """Check if Phone has end up the code on a line represented by active_line.

    :return: True if the phone has end up the code
    :rtype: bool
    """
    raise NotImplementedError

is_connected abstractmethod

is_connected() -> bool

Check if call is connected on the active_line.

Returns:

Type Description
bool

True if the phone is connected

Source code in boardfarm3/templates/sip_phone.py
169
170
171
172
173
174
175
176
@abstractmethod
def is_connected(self) -> bool:
    """Check if call is connected on the active_line.

    :return: True if the phone is connected
    :rtype: bool
    """
    raise NotImplementedError

is_dialing abstractmethod

is_dialing() -> bool

Check if the phone is dialing to another phone.

Check if the phone is dialing to another phone on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is dialing in progress

Source code in boardfarm3/templates/sip_phone.py
134
135
136
137
138
139
140
141
142
143
144
@abstractmethod
def is_dialing(self) -> bool:
    """Check if the phone is dialing to another phone.

    Check if the phone is dialing to another phone on a line represented
    by active_line.

    :return: True if the phone is dialing in progress
    :rtype: bool
    """
    raise NotImplementedError

is_idle abstractmethod

is_idle() -> bool

Check if Phone is in idle state on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is idle

Source code in boardfarm3/templates/sip_phone.py
124
125
126
127
128
129
130
131
@abstractmethod
def is_idle(self) -> bool:
    """Check if Phone is in idle state on a line represented by active_line.

    :return: True if the phone is idle
    :rtype: bool
    """
    raise NotImplementedError

is_in_conference abstractmethod

is_in_conference() -> bool

Check if Phone is in conference on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is in conference

Source code in boardfarm3/templates/sip_phone.py
241
242
243
244
245
246
247
248
@abstractmethod
def is_in_conference(self) -> bool:
    """Check if Phone is in conference on a line represented by active_line.

    :return: True if the phone is in conference
    :rtype: bool
    """
    raise NotImplementedError

is_incall_connected abstractmethod

is_incall_connected() -> bool

Check if call is in call connected on the active_line.

Returns:

Type Description
bool

True if the phone is in call connected

Source code in boardfarm3/templates/sip_phone.py
178
179
180
181
182
183
184
185
@abstractmethod
def is_incall_connected(self) -> bool:
    """Check if call is in call connected on the active_line.

    :return: True if the phone is in call connected
    :rtype: bool
    """
    raise NotImplementedError

is_incall_dialing abstractmethod

is_incall_dialing() -> bool

Check if Phone is in call and dialing.

Check if Phone is in call and dialing to another phone on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is in call and dialing in progress on another line

Source code in boardfarm3/templates/sip_phone.py
147
148
149
150
151
152
153
154
155
156
157
158
@abstractmethod
def is_incall_dialing(self) -> bool:
    """Check if Phone is in call and dialing.

    Check if Phone is in call and dialing to another phone on a line
    represented by active_line.

    :return: True if the phone is in call and dialing in progress on
             another line
    :rtype: bool
    """
    raise NotImplementedError

is_incall_playing_dialtone abstractmethod

is_incall_playing_dialtone() -> bool

Check if Phone is playing dialtone. on one line and on call to another line.

Returns:

Type Description
bool

True if the phone is incall playing dialtone

Source code in boardfarm3/templates/sip_phone.py
205
206
207
208
209
210
211
212
@abstractmethod
def is_incall_playing_dialtone(self) -> bool:
    """Check if Phone is playing dialtone. on one line and on call to another line.

    :return: True if the phone is incall playing dialtone
    :rtype: bool
    """
    raise NotImplementedError

is_line_busy abstractmethod

is_line_busy() -> bool

Check if the call is denied due to callee being busy.

Validation will be performed on the line indicated by active_line property.

Returns:

Type Description
bool

True if line is busy, else False

Source code in boardfarm3/templates/sip_phone.py
268
269
270
271
272
273
274
275
276
277
278
@abstractmethod
def is_line_busy(self) -> bool:
    """Check if the call is denied due to callee being busy.

    Validation will be performed on the line indicated by
    active_line property.

    :return: True if line is busy, else False
    :rtype: bool
    """
    raise NotImplementedError

is_onhold abstractmethod

is_onhold() -> bool

Check if Phone is on hold on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is on hold

Source code in boardfarm3/templates/sip_phone.py
187
188
189
190
191
192
193
194
@abstractmethod
def is_onhold(self) -> bool:
    """Check if Phone is on hold on a line represented by active_line.

    :return: True if the phone is on hold
    :rtype: bool
    """
    raise NotImplementedError

is_playing_dialtone abstractmethod

is_playing_dialtone() -> bool

Check if Phone is playing dialtone on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is playing dialtone

Source code in boardfarm3/templates/sip_phone.py
196
197
198
199
200
201
202
203
@abstractmethod
def is_playing_dialtone(self) -> bool:
    """Check if Phone is playing dialtone on a line represented by active_line.

    :return: True if the phone is playing dialtone
    :rtype: bool
    """
    raise NotImplementedError

is_ringing abstractmethod

is_ringing() -> bool

Check if Phone is ringing on a line represented by active_line.

Returns:

Type Description
bool

True if the phone is ringing

Source code in boardfarm3/templates/sip_phone.py
160
161
162
163
164
165
166
167
@abstractmethod
def is_ringing(self) -> bool:
    """Check if Phone is ringing on a line represented by active_line.

    :return: True if the phone is ringing
    :rtype: bool
    """
    raise NotImplementedError

merge_two_calls abstractmethod

merge_two_calls() -> None

Merge the two calls for conference calling.

Ensure call waiting must be enabled. There must be a call on other line to add to conference.

Source code in boardfarm3/templates/sip_phone.py
325
326
327
328
329
330
331
332
@abstractmethod
def merge_two_calls(self) -> None:
    """Merge the two calls for conference calling.

    Ensure call waiting must be enabled.
    There must be a call on other line to add to conference.
    """
    raise NotImplementedError

off_hook abstractmethod

off_hook() -> None

Execute off_hook procedure to connect to a line.

Source code in boardfarm3/templates/sip_phone.py
85
86
87
88
@abstractmethod
def off_hook(self) -> None:
    """Execute off_hook procedure to connect to a line."""
    raise NotImplementedError

on_hook abstractmethod

on_hook() -> None

Execute on_hook procedure to disconnect to a line.

Source code in boardfarm3/templates/sip_phone.py
80
81
82
83
@abstractmethod
def on_hook(self) -> None:
    """Execute on_hook procedure to disconnect to a line."""
    raise NotImplementedError

phone_config abstractmethod

phone_config(ipv6_flag: bool, sipserver_fqdn: str = '') -> None

Configure phone with a SIP url using SIP server ddqn for registration.

Parameters:

Name Type Description Default
ipv6_flag
bool

dicatates whether to use ipv6 address or not

required
sipserver_fqdn
str

the sip server, defaults to ""

''
Source code in boardfarm3/templates/sip_phone.py
63
64
65
66
67
68
69
70
71
72
@abstractmethod
def phone_config(self, ipv6_flag: bool, sipserver_fqdn: str = "") -> None:
    """Configure phone with a SIP url using SIP server ddqn for registration.

    :param ipv6_flag: dicatates whether to use ipv6 address or not
    :type ipv6_flag: bool
    :param sipserver_fqdn: the sip server, defaults to ""
    :type sipserver_fqdn: str
    """
    raise NotImplementedError

phone_kill abstractmethod

phone_kill() -> None

Close the serial connection.

Source code in boardfarm3/templates/sip_phone.py
75
76
77
78
@abstractmethod
def phone_kill(self) -> None:
    """Close the serial connection."""
    raise NotImplementedError

phone_start abstractmethod

phone_start() -> None

Connect to the serial line of FXS modem.

Source code in boardfarm3/templates/sip_phone.py
57
58
59
60
@abstractmethod
def phone_start(self) -> None:
    """Connect to the serial line of FXS modem."""
    raise NotImplementedError

place_call_offhold abstractmethod

place_call_offhold() -> None

Place an ongoing call off-hold.

There must be a call on hold to be placed to off hold.

Source code in boardfarm3/templates/sip_phone.py
354
355
356
357
358
359
360
@abstractmethod
def place_call_offhold(self) -> None:
    """Place an ongoing call off-hold.

    There must be a call on hold to be placed to off hold.
    """
    raise NotImplementedError

place_call_onhold abstractmethod

place_call_onhold() -> None

Place an ongoing call on-hold.

There must be an active call to be placed on hold.

Source code in boardfarm3/templates/sip_phone.py
345
346
347
348
349
350
351
@abstractmethod
def place_call_onhold(self) -> None:
    """Place an ongoing call on-hold.

    There must be an active call to be placed on hold.
    """
    raise NotImplementedError

press_R_button abstractmethod

press_R_button() -> None

Press the R button.

Used when we put a call on hold, or during dialing.

Source code in boardfarm3/templates/sip_phone.py
363
364
365
366
367
368
369
@abstractmethod
def press_R_button(self) -> None:  # pylint: disable=invalid-name
    """Press the R button.

    Used when we put a call on hold, or during dialing.
    """
    raise NotImplementedError

press_buttons abstractmethod

press_buttons(buttons: str) -> None

Press the given sequence of buttons.

Parameters:

Name Type Description Default
buttons
str

sequence of buttons, e.g. "R2"

required

Raises:

Type Description
NotImplementedError

as this is a Template

Source code in boardfarm3/templates/sip_phone.py
380
381
382
383
384
385
386
387
388
389
@abstractmethod
def press_buttons(self, buttons: str) -> None:
    """Press the given sequence of buttons.

    :param buttons: sequence of buttons, e.g. "R2"
    :type buttons: str
    :raises NotImplementedError: as this is a Template
    """
    # press a button for each button in the list
    raise NotImplementedError

reject_waiting_call abstractmethod

reject_waiting_call() -> None

Reject a call on waiting on second line.

This will send the call to voice mail or a busy tone. There must be a call on the second line to reject.

Source code in boardfarm3/templates/sip_phone.py
335
336
337
338
339
340
341
342
@abstractmethod
def reject_waiting_call(self) -> None:
    """Reject a call on waiting on second line.

    This will send the call to voice mail or a busy tone.
    There must be a call on the second line to reject.
    """
    raise NotImplementedError

reply_with_code abstractmethod

reply_with_code(code: int) -> None

To reply back to an incoming call with a SIP code value.

In case of certain phones, we need to explicitly send out SIP codes such as: - 486 Busy - 200 OK - 603 Decline - 608 Rejected

Parameters:

Name Type Description Default
code
int

SIP code value

required
Source code in boardfarm3/templates/sip_phone.py
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
@abstractmethod
def reply_with_code(self, code: int) -> None:
    """To reply back to an incoming call with a SIP code value.

    In case of certain phones, we need to explicitly send out SIP codes
    such as:
    - 486 Busy
    - 200 OK
    - 603 Decline
    - 608 Rejected

    :param code: SIP code value
    :type code: int
    """
    raise NotImplementedError

toggle_call abstractmethod

toggle_call() -> None

Toggle between the calls.

Need to first validate, there is an incoming call on other line. If not throw an exception.

Source code in boardfarm3/templates/sip_phone.py
315
316
317
318
319
320
321
322
@abstractmethod
def toggle_call(self) -> None:
    """Toggle between the calls.

    Need to first validate, there is an incoming call on other line.
    If not throw an exception.
    """
    raise NotImplementedError

sip_server

SIPServer Template module.

Classes:

Name Description
SIPServer

SIP Server template class.

SIPServer

SIP Server template class.

Contains a list of APIs to interact with the SIP server. All methods marked with @abstractmethod annotation have to be implemented in the derived class with the same signatures as in template. Unsupported functionality shall raise a NotSupportedError exception.

Methods:

Name Description
add_user

Add user to the directory.

allocate_number

Allocate a number from the sipserver number list.

delete_file

Delete the file from the device.

get_expire_timer

Get the call expire timer in the sipserver config.

get_interface_ipaddr

Return the IPv4 address of the DUT connected interface.

get_online_users

Get SipServer online users.

get_status

Return the status of the server.

get_vsc_prefix

Get prefix to build a VSC.

remove_endpoint

Remove an endpoint from the directory.

remove_endpoint_from_sipserver

Remove an endpoint from the directory.

restart

Restart the server.

scp_device_file_to_local

Copy a local file from a server using SCP.

set_expire_timer

Modify call expire timer in the sipserver config.

sipserver_get_expire_timer

Get the call expire timer in the sipserver config.

sipserver_get_online_users

Get SipServer online users.

sipserver_restart

Restart the server.

sipserver_set_expire_timer

Modify call expire timer in the sipserver config.

sipserver_start

Start the server.

sipserver_status

Return the status of the server.

sipserver_stop

Stop the server.

sipserver_user_add

Add user to the directory.

start

Start the server.

stop

Stop the server.

tcpdump_capture

Capture packets from specified interface.

tshark_read_pcap

Read packet captures from an existing file.

Attributes:

Name Type Description
fqdn Optional[str]

Return the sipserver fqdn.

iface_dut str

Return the DUT connected interface.

ipv4_addr Optional[str]

Return the server IP v4 address.

ipv6_addr Optional[str]

Return the server IP v6 address.

name str

Return the SIP server name.

fqdn property

fqdn: Optional[str]

Return the sipserver fqdn.

Raises:

Type Description
NotImplementedError

not implemented yet

iface_dut abstractmethod property

iface_dut: str

Return the DUT connected interface.

ipv4_addr property

ipv4_addr: Optional[str]

Return the server IP v4 address.

Raises:

Type Description
NotImplementedError

not implemented yet

ipv6_addr property

ipv6_addr: Optional[str]

Return the server IP v6 address.

Raises:

Type Description
NotImplementedError

not implemented yet

name abstractmethod property

name: str

Return the SIP server name.

Returns:

Type Description
str

server name

add_user abstractmethod

add_user(user: str, password: Optional[str] = None) -> None

Add user to the directory.

Parameters:

Name Type Description Default
user
str

the user entry to be added

required
password
Optional[str]

the password of the endpoint is determined by the user

None
Source code in boardfarm3/templates/sip_server.py
154
155
156
157
158
159
160
161
162
163
164
165
166
167
@abstractmethod
def add_user(
    self,
    user: str,
    password: Optional[str] = None,
) -> None:
    """Add user to the directory.

    :param user: the user entry to be added
    :type user: str
    :param password: the password of the endpoint is determined by the user
    :type password: Optional[str]
    """
    raise NotImplementedError

allocate_number abstractmethod

allocate_number(number: Optional[str] = None) -> str

Allocate a number from the sipserver number list.

Parameters:

Name Type Description Default
number
Optional[str]

the phone number, defaults to None

None

Returns:

Type Description
str

the allocated number

Source code in boardfarm3/templates/sip_server.py
205
206
207
208
209
210
211
212
213
214
@abstractmethod
def allocate_number(self, number: Optional[str] = None) -> str:
    """Allocate a number from the sipserver number list.

    :param number: the phone number, defaults to None
    :type number: Optional[str]
    :return: the allocated number
    :rtype: str
    """
    raise NotImplementedError

delete_file abstractmethod

delete_file(filename: str) -> None

Delete the file from the device.

Parameters:

Name Type Description Default
filename
str

name of the file with absolute path

required
Source code in boardfarm3/templates/sip_server.py
336
337
338
339
340
341
342
343
@abstractmethod
def delete_file(self, filename: str) -> None:
    """Delete the file from the device.

    :param filename: name of the file with absolute path
    :type filename: str
    """
    raise NotImplementedError

get_expire_timer abstractmethod

get_expire_timer() -> int

Get the call expire timer in the sipserver config.

Returns:

Type Description
int

expiry timer saved in the config

Source code in boardfarm3/templates/sip_server.py
273
274
275
276
277
278
279
280
@abstractmethod
def get_expire_timer(self) -> int:
    """Get the call expire timer in the sipserver config.

    :return: expiry timer saved in the config
    :rtype: int
    """
    raise NotImplementedError

get_interface_ipaddr

get_interface_ipaddr() -> Optional[str]

Return the IPv4 address of the DUT connected interface.

This method is deprecated in favour of reading the ipv4_addr property.

Returns:

Type Description
Optional[str]

the IPv4 address

Source code in boardfarm3/templates/sip_server.py
216
217
218
219
220
221
222
223
224
225
@moves.moved_method("ipv4_addr")
def get_interface_ipaddr(self) -> Optional[str]:
    """Return the IPv4 address of the DUT connected interface.

    This method is deprecated in favour of reading the `ipv4_addr` property.

    :return: the IPv4 address
    :rtype: Optional[str]
    """
    return self.ipv4_addr

get_online_users abstractmethod

get_online_users() -> str

Get SipServer online users.

Returns:

Type Description
str

the online users

Source code in boardfarm3/templates/sip_server.py
136
137
138
139
140
141
142
143
@abstractmethod
def get_online_users(self) -> str:
    """Get SipServer online users.

    :return: the online users
    :rtype: str
    """
    raise NotImplementedError

get_status abstractmethod

get_status() -> str

Return the status of the server.

Returns:

Type Description
str

the status of the server

Source code in boardfarm3/templates/sip_server.py
117
118
119
120
121
122
123
124
@abstractmethod
def get_status(self) -> str:
    """Return the status of the server.

    :return: the status of the server
    :rtype: str
    """
    raise NotImplementedError

get_vsc_prefix abstractmethod

get_vsc_prefix(scope: VscScopeType) -> str

Get prefix to build a VSC.

It is expected that, to enable call forwarding, the phone dials a pattern as: "{prefix}{phone_number}#".

It is is expected that all prefixes to disable call forwarding terminate with # to execute the VSC.

.. code-block:: python

# example output
"*63*"  # to activate call forwarding busy

"#63#"  # to disable call forwarding busy

Parameters:

Name Type Description Default
scope
VscScopeType

Set/Unset call forwarding in case of busy/no answer/unconditional

required

Returns:

Type Description
str

the prefix to be dialled

Raises:

Type Description
NotImplementedError

as this is a Template

Source code in boardfarm3/templates/sip_server.py
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
@abstractmethod
def get_vsc_prefix(self, scope: VscScopeType) -> str:
    """Get prefix to build a VSC.

    It is expected that, to enable call forwarding, the phone dials a pattern as:
    "{prefix}{phone_number}#".

    It is is expected that all prefixes to disable call forwarding terminate with
    `#` to execute the VSC.

    .. code-block:: python

        # example output
        "*63*"  # to activate call forwarding busy

        "#63#"  # to disable call forwarding busy


    :param scope: Set/Unset call forwarding in case of busy/no answer/unconditional
    :type scope: VscScopeType
    :raises NotImplementedError: as this is a Template
    :return: the prefix to be dialled
    :rtype: str
    """
    raise NotImplementedError

remove_endpoint abstractmethod

remove_endpoint(endpoint: str) -> None

Remove an endpoint from the directory.

Parameters:

Name Type Description Default
endpoint
str

the endpoint entry to be added

required

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
185
186
187
188
189
190
191
192
193
@abstractmethod
def remove_endpoint(self, endpoint: str) -> None:
    """Remove an endpoint from the directory.

    :param endpoint: the endpoint entry to be added
    :type endpoint: str
    :return: None
    """
    raise NotImplementedError

remove_endpoint_from_sipserver

remove_endpoint_from_sipserver(endpoint: str) -> None

Remove an endpoint from the directory.

Parameters:

Name Type Description Default
endpoint
str

the endpoint entry to be added

required

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
195
196
197
198
199
200
201
202
203
@moves.moved_method("remove_endpoint")
def remove_endpoint_from_sipserver(self, endpoint: str) -> None:
    """Remove an endpoint from the directory.

    :param endpoint: the endpoint entry to be added
    :type endpoint: str
    :return: None
    """
    return self.remove_endpoint(endpoint=endpoint)

restart abstractmethod

restart() -> None

Restart the server.

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
101
102
103
104
105
106
107
@abstractmethod
def restart(self) -> None:
    """Restart the server.

    :return: None
    """
    raise NotImplementedError

scp_device_file_to_local abstractmethod

scp_device_file_to_local(local_path: str, source_path: str) -> None

Copy a local file from a server using SCP.

Parameters:

Name Type Description Default
local_path
str

local file path

required
source_path
str

source path

required
Source code in boardfarm3/templates/sip_server.py
345
346
347
348
349
350
351
352
@abstractmethod
def scp_device_file_to_local(self, local_path: str, source_path: str) -> None:
    """Copy a local file from a server using SCP.

    :param local_path: local file path
    :param source_path: source path
    """
    raise NotImplementedError

set_expire_timer abstractmethod

set_expire_timer(to_timer: int = 60) -> None

Modify call expire timer in the sipserver config.

Parameters:

Name Type Description Default
to_timer
int

Expire timer value change to, default to 60

60
Source code in boardfarm3/templates/sip_server.py
291
292
293
294
295
296
297
298
@abstractmethod
def set_expire_timer(self, to_timer: int = 60) -> None:
    """Modify call expire timer in the sipserver config.

    :param to_timer: Expire timer value change to, default to 60
    :type to_timer: int
    """
    raise NotImplementedError

sipserver_get_expire_timer

sipserver_get_expire_timer() -> int

Get the call expire timer in the sipserver config.

Returns:

Type Description
int

expiry timer saved in the config

Source code in boardfarm3/templates/sip_server.py
282
283
284
285
286
287
288
289
@moves.moved_method("get_expire_timer")
def sipserver_get_expire_timer(self) -> int:
    """Get the call expire timer in the sipserver config.

    :return: expiry timer saved in the config
    :rtype: int
    """
    return self.get_expire_timer()

sipserver_get_online_users

sipserver_get_online_users() -> str

Get SipServer online users.

Returns:

Type Description
str

the online users

Source code in boardfarm3/templates/sip_server.py
145
146
147
148
149
150
151
152
@moves.moved_method("get_online_users")
def sipserver_get_online_users(self) -> str:
    """Get SipServer online users.

    :return: the online users
    :rtype: str
    """
    return self.get_online_users()

sipserver_restart

sipserver_restart() -> None

Restart the server.

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
109
110
111
112
113
114
115
@moves.moved_method("restart")
def sipserver_restart(self) -> None:
    """Restart the server.

    :return: None
    """
    return self.restart()

sipserver_set_expire_timer

sipserver_set_expire_timer(to_timer: int = 60) -> None

Modify call expire timer in the sipserver config.

Parameters:

Name Type Description Default
to_timer
int

Expire timer value change to, default to 60

60

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
300
301
302
303
304
305
306
307
308
@moves.moved_method("set_expire_timer")
def sipserver_set_expire_timer(self, to_timer: int = 60) -> None:
    """Modify call expire timer in the sipserver config.

    :param to_timer: Expire timer value change to, default to 60
    :type to_timer: int
    :return: None
    """
    return self.set_expire_timer(to_timer=to_timer)

sipserver_start

sipserver_start() -> None

Start the server.

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
77
78
79
80
81
82
83
@moves.moved_method("start")
def sipserver_start(self) -> None:
    """Start the server.

    :return: None
    """
    return self.start()

sipserver_status

sipserver_status() -> str

Return the status of the server.

Returns:

Type Description
str

the status of the server

Source code in boardfarm3/templates/sip_server.py
126
127
128
129
130
131
132
133
@moves.moved_method("get_status")
def sipserver_status(self) -> str:
    """Return the status of the server.

    :return: the status of the server
    :rtype: str
    """
    return self.get_status()

sipserver_stop

sipserver_stop() -> None

Stop the server.

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
93
94
95
96
97
98
99
@moves.moved_method("stop")
def sipserver_stop(self) -> None:
    """Stop the server.

    :return: None
    """
    return self.stop()

sipserver_user_add

sipserver_user_add(user: str, password: Optional[str] = None) -> None

Add user to the directory.

Parameters:

Name Type Description Default
user
str

the user entry to be added

required
password
Optional[str]

the password of the endpoint is determined by the user

None

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
@moves.moved_method("add_user")
def sipserver_user_add(
    self,
    user: str,
    password: Optional[str] = None,
) -> None:
    """Add user to the directory.

    :param user: the user entry to be added
    :type user: str
    :param password: the password of the endpoint is determined by the user
    :type password: Optional[str]
    :return: None
    """
    return self.add_user(user=user, password=password)

start abstractmethod

start() -> None

Start the server.

Source code in boardfarm3/templates/sip_server.py
72
73
74
75
@abstractmethod
def start(self) -> None:
    """Start the server."""
    raise NotImplementedError

stop abstractmethod

stop() -> None

Stop the server.

Returns:

Type Description
None

None

Source code in boardfarm3/templates/sip_server.py
85
86
87
88
89
90
91
@abstractmethod
def stop(self) -> None:
    """Stop the server.

    :return: None
    """
    raise NotImplementedError

tcpdump_capture abstractmethod

tcpdump_capture(
    fname: str, interface: str = "any", additional_args: Optional[str] = None
) -> Generator[str, None, None]

Capture packets from specified interface.

Packet capture using tcpdump utility at a specified interface.

Parameters:

Name Type Description Default
fname
str

name of the file where packet captures will be stored

required
interface
str

name of the interface, defaults to "any"

'any'
additional_args
Optional[str]

arguments to tcpdump command, defaults to None

None

Returns:

Type Description
Generator[str, None, None]

process id of tcpdump process

Source code in boardfarm3/templates/sip_server.py
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
@contextmanager
@abstractmethod
def tcpdump_capture(
    self,
    fname: str,
    interface: str = "any",
    additional_args: Optional[str] = None,
) -> Generator[str, None, None]:
    """Capture packets from specified interface.

    Packet capture using tcpdump utility at a specified interface.

    :param fname: name of the file where packet captures will be stored
    :type fname: str
    :param interface: name of the interface, defaults to "any"
    :type interface: str
    :param additional_args: arguments to tcpdump command, defaults to None
    :type additional_args: Optional[str]
    :return: process id of tcpdump process
    :rtype: Generator[str, None, None]
    """
    raise NotImplementedError

tshark_read_pcap abstractmethod

tshark_read_pcap(
    fname: str,
    additional_args: Optional[str] = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str

Read packet captures from an existing file.

Parameters:

Name Type Description Default
fname
str

name of the file in which captures are saved

required
additional_args
Optional[str]

additional arguments for tshark, defaults to None

None
timeout
int

timeout for tshark command to be executed, defaults to 30

30
rm_pcap
bool

remove the pcap file after reading if True, defaults to False

False

Returns:

Type Description
str

return tshark read command console output

Source code in boardfarm3/templates/sip_server.py
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
@abstractmethod
def tshark_read_pcap(
    self,
    fname: str,
    additional_args: Optional[str] = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str:
    """Read packet captures from an existing file.

    :param fname: name of the file in which captures are saved
    :type fname: str
    :param additional_args: additional arguments for tshark, defaults to None
    :type additional_args: Optional[str], optional
    :param timeout: timeout for tshark command to be executed, defaults to 30
    :type timeout: int
    :param rm_pcap: remove the pcap file after reading if True, defaults to False
    :type rm_pcap: bool
    :return: return tshark read command console output
    :rtype: str
    """
    raise NotImplementedError

tftp

Boardfarm TFTP device template.

Classes:

Name Description
TFTP

Boardfarm TFTP device template.

TFTP

Boardfarm TFTP device template.

Methods:

Name Description
download_image_from_uri

Download image from given URI.

get_eth_interface_ipv4_address

Get eth interface ipv4 address.

restart_lighttpd

Restart lighttpd service.

set_tmp_static_ip

Temporarily set a static IPv4 on the DUT connected iface via the ip cmd.

stop_lighttpd

Stop the lighttpd service.

download_image_from_uri abstractmethod

download_image_from_uri(image_uri: str) -> str

Download image from given URI.

Parameters:

Name Type Description Default
image_uri
str

image URI

required

Returns:

Type Description
str

downloaded image name

Source code in boardfarm3/templates/tftp.py
12
13
14
15
16
17
18
19
@abstractmethod
def download_image_from_uri(self, image_uri: str) -> str:
    """Download image from given URI.

    :param image_uri: image URI
    :returns: downloaded image name
    """
    raise NotImplementedError

get_eth_interface_ipv4_address abstractmethod

get_eth_interface_ipv4_address() -> str

Get eth interface ipv4 address.

Returns:

Type Description
str

IPv4 address of eth interface

Source code in boardfarm3/templates/tftp.py
21
22
23
24
25
26
27
@abstractmethod
def get_eth_interface_ipv4_address(self) -> str:
    """Get eth interface ipv4 address.

    :returns: IPv4 address of eth interface
    """
    raise NotImplementedError

restart_lighttpd abstractmethod

restart_lighttpd() -> None

Restart lighttpd service.

Source code in boardfarm3/templates/tftp.py
29
30
31
32
@abstractmethod
def restart_lighttpd(self) -> None:
    """Restart lighttpd service."""
    raise NotImplementedError

set_tmp_static_ip abstractmethod

set_tmp_static_ip(static_address: IPv4Address) -> Generator[None, None, None]

Temporarily set a static IPv4 on the DUT connected iface via the ip cmd.

:yield: The DUT connected interface with the static ip address applied

Parameters:

Name Type Description Default
static_address
IPv4Address

Static IPv4 address to be set

required
Source code in boardfarm3/templates/tftp.py
39
40
41
42
43
44
45
46
47
48
49
50
51
@abstractmethod
@contextmanager
def set_tmp_static_ip(
    self, static_address: IPv4Address
) -> Generator[None, None, None]:
    """Temporarily set a static IPv4 on the DUT connected iface via the `ip` cmd.

    :param static_address: Static IPv4 address to be set
    :type static_address: IPv4Address
    :yield: The DUT connected interface with the static ip address applied
    :rtype: Generator[None, None, None]
    """
    raise NotImplementedError

stop_lighttpd abstractmethod

stop_lighttpd() -> None

Stop the lighttpd service.

Source code in boardfarm3/templates/tftp.py
34
35
36
37
@abstractmethod
def stop_lighttpd(self) -> None:
    """Stop the lighttpd service."""
    raise NotImplementedError

wan

Boardfarm WAN device template.

Classes:

Name Description
WAN

Boardfarm WAN device template.

WAN

Boardfarm WAN device template.

Methods:

Name Description
add_route

Add a route to a destination via a specific gateway interface.

copy_local_file_to_tftpboot

SCP local file to tftpboot directory.

curl

Perform curl action to web service.

delete_file

Delete the file from the device.

delete_route

Delete a route to a destination.

dns_lookup

Perform dig command in the devices to resolve DNS.

download_image_to_tftpboot

Download image from URL to tftpboot directory.

execute_snmp_command

Execute SNMP command.

get_date

Get the system date and time.

get_eth_interface_ipv4_address

Get eth interface ipv4 address.

get_eth_interface_ipv6_address

Get IPv6 address of eth interface.

get_hostname

Get the hostname of the device.

get_interface_ipv4addr

Return ipv4 address of the interface.

get_interface_ipv6addr

Return ipv4 address of the interface.

get_interface_macaddr

Get the interface MAC address.

get_interface_mask

Get the subnet mask of the interface.

get_interface_mtu_size

Get the MTU size of the interface in bytes.

get_iperf_logs

Read the file output for traffic flow.

get_network_statistics

Execute netstat command to get the port status.

get_process_id

Return the process id to the device.

hping_flood

Validate SYN, UDP and ICMP flood operation.

http_get

Peform http get and return parsed result.

is_connect_to_board_via_reverse_ssh_successful

Perform reverse SSH from jump server to CPE.

is_link_up

Return the link status.

kill_process

Kill the running process based on the process id.

nmap

Perform nmap operation on linux device.

ping

Ping remote host.

release_dhcp

Release IPv4 of the specified interface.

scp_device_file_to_local

Copy a local file from a server using SCP.

set_date

Set the device's date and time.

set_default_gw

Set given IP address as default gateway address for given interface.

set_link_state

Set link state.

set_static_ip

Set given static IP for the LAN.

start_http_service

Start HTTP service on given port number.

start_tcpdump

Start tcpdump capture on given interface.

start_traffic_receiver

Start the server on a linux device to generate traffic using iperf3.

start_traffic_sender

Start traffic on a linux client using iperf3.

stop_http_service

Stop http service running on given port.

stop_tcpdump

Stop tcpdump capture.

stop_traffic

Stop the iPerf3 process for a specific PID or killall.

tcpdump_capture

Capture packets from specified interface.

tshark_read_pcap

Read packet captures from an existing file.

Attributes:

Name Type Description
console BoardfarmPexpect

Returns WAN console.

firewall IptablesFirewall

Returns Firewall iptables instance.

http_proxy str

SOCKS5 Dante proxy address, e.g http://{proxy_ip}:{proxy_port}/.

iface_dut str

Name of the interface that is connected to DUT.

ipv4_addr str

Return the IPv4 address on IFACE facing DUT.

ipv6_addr str

Return the IPv6 address on IFACE facing DUT.

multicast Multicast

Return multicast component instance.

nslookup NSLookup

Returns NSLookup utility instance.

nw_utility NetworkUtility

Returns Network utility instance.

rssh_password str

Return the WAN password for reverse SSH.

rssh_username str

Return the WAN username for reverse SSH.

console abstractmethod property

Returns WAN console.

Returns:

Type Description
BoardfarmPexpect

console

firewall abstractmethod property

firewall: IptablesFirewall

Returns Firewall iptables instance.

Returns:

Type Description
IptablesFirewall

firewall iptables instance with console object

http_proxy abstractmethod property

http_proxy: str

SOCKS5 Dante proxy address, e.g http://{proxy_ip}:{proxy_port}/.

iface_dut abstractmethod property

iface_dut: str

Name of the interface that is connected to DUT.

ipv4_addr abstractmethod cached property

ipv4_addr: str

Return the IPv4 address on IFACE facing DUT.

Returns:

Type Description
str

IPv4 address in string format.

ipv6_addr abstractmethod cached property

ipv6_addr: str

Return the IPv6 address on IFACE facing DUT.

Returns:

Type Description
str

IPv6 address in string format.

multicast abstractmethod property

multicast: Multicast

Return multicast component instance.

Returns:

Type Description
Multicast

multicast component instance

nslookup abstractmethod property

nslookup: NSLookup

Returns NSLookup utility instance.

Returns:

Type Description
NSLookup

nslookup utility instance with console object

nw_utility abstractmethod property

nw_utility: NetworkUtility

Returns Network utility instance.

Returns:

Type Description
NetworkUtility

network utiluty instance with console object

rssh_password abstractmethod property

rssh_password: str

Return the WAN password for reverse SSH.

Returns:

Type Description
str

WAN password

rssh_username abstractmethod property

rssh_username: str

Return the WAN username for reverse SSH.

Returns:

Type Description
str

WAN username

add_route abstractmethod

add_route(destination: str, gw_interface: str) -> None

Add a route to a destination via a specific gateway interface.

The method will internally calculate the exit interface's ip address before adding the route. The gw_interface must be an interface name that exists on the host.

Parameters:

Name Type Description Default
destination
str

ip address of the destination

required
gw_interface
str

name of the interface

required
Source code in boardfarm3/templates/wan.py
441
442
443
444
445
446
447
448
449
450
451
452
453
454
@abstractmethod
def add_route(self, destination: str, gw_interface: str) -> None:
    """Add a route to a destination via a specific gateway interface.

    The method will internally calculate the exit interface's ip address
    before adding the route.
    The gw_interface must be an interface name that exists on the host.

    :param destination: ip address of the destination
    :type destination: str
    :param gw_interface: name of the interface
    :type gw_interface: str
    """
    raise NotImplementedError

copy_local_file_to_tftpboot abstractmethod

copy_local_file_to_tftpboot(local_file_path: str) -> str

SCP local file to tftpboot directory.

Parameters:

Name Type Description Default
local_file_path
str

local file path

required
Source code in boardfarm3/templates/wan.py
108
109
110
111
112
113
114
@abstractmethod
def copy_local_file_to_tftpboot(self, local_file_path: str) -> str:
    """SCP local file to tftpboot directory.

    :param local_file_path: local file path
    """
    raise NotImplementedError

curl abstractmethod

curl(
    url: str | IPv4Address,
    protocol: str,
    port: str | int | None = None,
    options: str = "",
) -> bool

Perform curl action to web service.

Parameters:

Name Type Description Default
url

web service address

required
Source code in boardfarm3/templates/wan.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
@abstractmethod
def curl(
    self,
    url: str | IPv4Address,
    protocol: str,
    port: str | int | None = None,
    options: str = "",
) -> bool:
    """Perform curl action to web service.

    :param url : web service address
    :param protocol : Web Protocol (http or https)
    :param port : port number of server
    :param options : Additional curl options
    """
    raise NotImplementedError

delete_file abstractmethod

delete_file(filename: str) -> None

Delete the file from the device.

Parameters:

Name Type Description Default
filename
str

name of the file with absolute path

required
Source code in boardfarm3/templates/wan.py
465
466
467
468
469
470
471
472
@abstractmethod
def delete_file(self, filename: str) -> None:
    """Delete the file from the device.

    :param filename: name of the file with absolute path
    :type filename: str
    """
    raise NotImplementedError

delete_route abstractmethod

delete_route(destination: str) -> None

Delete a route to a destination.

Parameters:

Name Type Description Default
destination
str

ip address of the destination

required
Source code in boardfarm3/templates/wan.py
456
457
458
459
460
461
462
463
@abstractmethod
def delete_route(self, destination: str) -> None:
    """Delete a route to a destination.

    :param destination: ip address of the destination
    :type destination: str
    """
    raise NotImplementedError

dns_lookup abstractmethod

dns_lookup(domain_name: str, record_type: str, opts: str = '') -> list[dict[str, Any]]

Perform dig command in the devices to resolve DNS.

Parameters:

Name Type Description Default
domain_name
str

domain name which needs lookup

required
record_type
str

AAAA for ipv6 else A

required
opts
str

options to be provided to dig command, defaults to ""

''

Returns:

Type Description
List[Dict[str, Any]]

parsed dig command ouput

Source code in boardfarm3/templates/wan.py
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
@abstractmethod
def dns_lookup(
    self, domain_name: str, record_type: str, opts: str = ""
) -> list[dict[str, Any]]:
    """Perform ``dig`` command in the devices to resolve DNS.

    :param domain_name: domain name which needs lookup
    :type domain_name: str
    :param record_type: AAAA for ipv6 else A
    :type record_type: str
    :param opts: options to be provided to dig command, defaults to ""
    :type opts: str
    :return: parsed dig command ouput
    :rtype: List[Dict[str, Any]]
    """
    raise NotImplementedError

download_image_to_tftpboot abstractmethod

download_image_to_tftpboot(image_uri: str) -> str

Download image from URL to tftpboot directory.

Parameters:

Name Type Description Default
image_uri
str

image file URI

required

Returns:

Type Description
str

name of the image in tftpboot

Source code in boardfarm3/templates/wan.py
116
117
118
119
120
121
122
123
@abstractmethod
def download_image_to_tftpboot(self, image_uri: str) -> str:
    """Download image from URL to tftpboot directory.

    :param image_uri: image file URI
    :returns: name of the image in tftpboot
    """
    raise NotImplementedError

execute_snmp_command abstractmethod

execute_snmp_command(snmp_command: str, timeout: int = 30) -> str

Execute SNMP command.

Parameters:

Name Type Description Default
snmp_command
str

snmp command

required
timeout
int

pexpect timeout for the command in seconds, defaults to 30

30

Returns:

Type Description
str

given snmp command output

Source code in boardfarm3/templates/wan.py
142
143
144
145
146
147
148
149
150
151
152
@abstractmethod
def execute_snmp_command(self, snmp_command: str, timeout: int = 30) -> str:
    """Execute SNMP command.

    :param snmp_command: snmp command
    :type snmp_command: str
    :param timeout: pexpect timeout for the command in seconds, defaults to 30
    :type timeout: int
    :returns: given snmp command output
    """
    raise NotImplementedError

get_date abstractmethod

get_date() -> str | None

Get the system date and time.

.. code-block:: python

# example output
donderdag, mei 23, 2024 14:23:39

Returns:

Type Description
str | None

date

Source code in boardfarm3/templates/wan.py
590
591
592
593
594
595
596
597
598
599
600
601
602
603
@abstractmethod
def get_date(self) -> str | None:
    """Get the system date and time.

    .. code-block:: python

        # example output
        donderdag, mei 23, 2024 14:23:39


    :return: date
    :rtype: str | None
    """
    raise NotImplementedError

get_eth_interface_ipv4_address abstractmethod

get_eth_interface_ipv4_address() -> str

Get eth interface ipv4 address.

Returns:

Type Description
str

IPv4 address of eth interface

Source code in boardfarm3/templates/wan.py
125
126
127
128
129
130
131
@abstractmethod
def get_eth_interface_ipv4_address(self) -> str:
    """Get eth interface ipv4 address.

    :returns: IPv4 address of eth interface
    """
    raise NotImplementedError

get_eth_interface_ipv6_address abstractmethod

get_eth_interface_ipv6_address(address_type: str = 'global') -> str

Get IPv6 address of eth interface.

Parameters:

Name Type Description Default
address_type
str

ipv6 address type. defaults to "global".

'global'

Returns:

Type Description
str

IPv6 address of eth interface

Source code in boardfarm3/templates/wan.py
133
134
135
136
137
138
139
140
@abstractmethod
def get_eth_interface_ipv6_address(self, address_type: str = "global") -> str:
    """Get IPv6 address of eth interface.

    :param address_type: ipv6 address type. defaults to "global".
    :returns: IPv6 address of eth interface
    """
    raise NotImplementedError

get_hostname abstractmethod

get_hostname() -> str

Get the hostname of the device.

Returns:

Type Description
str

hostname of the device

Source code in boardfarm3/templates/wan.py
683
684
685
686
687
688
689
690
@abstractmethod
def get_hostname(self) -> str:
    """Get the hostname of the device.

    :return: hostname of the device
    :rtype: str
    """
    raise NotImplementedError

get_interface_ipv4addr abstractmethod

get_interface_ipv4addr(interface: str) -> str

Return ipv4 address of the interface.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv4 of the interface

Raises:

Type Description
BoardfarmException

in case IPv4 is not found

Source code in boardfarm3/templates/wan.py
154
155
156
157
158
159
160
161
162
@abstractmethod
def get_interface_ipv4addr(self, interface: str) -> str:
    """Return ipv4 address of the interface.

    :param interface: interface name
    :return: IPv4 of the interface
    :raises BoardfarmException: in case IPv4 is not found
    """
    raise NotImplementedError

get_interface_ipv6addr abstractmethod

get_interface_ipv6addr(interface: str) -> str

Return ipv4 address of the interface.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv6 of the interface

Raises:

Type Description
BoardfarmException

in case IPv6 is not found

Source code in boardfarm3/templates/wan.py
164
165
166
167
168
169
170
171
172
@abstractmethod
def get_interface_ipv6addr(self, interface: str) -> str:
    """Return ipv4 address of the interface.

    :param interface: interface name
    :return: IPv6 of the interface
    :raises BoardfarmException: in case IPv6 is not found
    """
    raise NotImplementedError

get_interface_macaddr abstractmethod

get_interface_macaddr(interface: str) -> str

Get the interface MAC address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

mac address of the interface

Source code in boardfarm3/templates/wan.py
408
409
410
411
412
413
414
415
416
417
@abstractmethod
def get_interface_macaddr(self, interface: str) -> str:
    """Get the interface MAC address.

    :param interface: interface name
    :type interface: str
    :return: mac address of the interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_mask abstractmethod

get_interface_mask(interface: str) -> str

Get the subnet mask of the interface.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
str

subnet mask of interface

Source code in boardfarm3/templates/wan.py
419
420
421
422
423
424
425
426
427
428
@abstractmethod
def get_interface_mask(self, interface: str) -> str:
    """Get the subnet mask of the interface.

    :param interface: name of the interface
    :type interface: str
    :return: subnet mask of interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_mtu_size abstractmethod

get_interface_mtu_size(interface: str) -> int

Get the MTU size of the interface in bytes.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
int

size of the MTU in bytes

Source code in boardfarm3/templates/wan.py
430
431
432
433
434
435
436
437
438
439
@abstractmethod
def get_interface_mtu_size(self, interface: str) -> int:
    """Get the MTU size of the interface in bytes.

    :param interface: name of the interface
    :type interface: str
    :return: size of the MTU in bytes
    :rtype: int
    """
    raise NotImplementedError

get_iperf_logs abstractmethod

get_iperf_logs(log_file: str) -> str

Read the file output for traffic flow.

Parameters:

Name Type Description Default
log_file
str

iperf log file path

required

Returns:

Type Description
str

traffic flow logs

Source code in boardfarm3/templates/wan.py
568
569
570
571
572
573
574
575
576
577
@abstractmethod
def get_iperf_logs(self, log_file: str) -> str:
    """Read the file output for traffic flow.

    :param log_file: iperf log file path
    :type log_file: str
    :return: traffic flow logs
    :rtype: str
    """
    raise NotImplementedError

get_network_statistics abstractmethod

get_network_statistics() -> (
    dict[str, Any] | list[dict[str, Any]] | Iterator[dict[str, Any]]
)

Execute netstat command to get the port status.

Returns:

Type Description
Union[dict[str, Any], list[dict[str, Any]], Iterator[dict[str, Any]]]

parsed output of netstat command

Source code in boardfarm3/templates/wan.py
397
398
399
400
401
402
403
404
405
406
@abstractmethod
def get_network_statistics(
    self,
) -> dict[str, Any] | list[dict[str, Any]] | Iterator[dict[str, Any]]:
    """Execute netstat command to get the port status.

    :return: parsed output of netstat command
    :rtype: Union[dict[str, Any], list[dict[str, Any]], Iterator[dict[str, Any]]]
    """
    raise NotImplementedError

get_process_id abstractmethod

get_process_id(process_name: str) -> list[str] | None

Return the process id to the device.

Parameters:

Name Type Description Default
process_name
str

name of the process

required

Returns:

Type Description
list[str] | None

process id if the process exist, else None

Source code in boardfarm3/templates/wan.py
728
729
730
731
732
733
734
735
736
737
@abstractmethod
def get_process_id(self, process_name: str) -> list[str] | None:
    """Return the process id to the device.

    :param process_name: name of the process
    :type process_name: str
    :return: process id if the process exist, else None
    :rtype: list[str] | None
    """
    raise NotImplementedError

hping_flood abstractmethod

hping_flood(
    protocol: str,
    target: str,
    packet_count: str,
    extra_args: str | None = None,
    pkt_interval: str = "",
) -> str

Validate SYN, UDP and ICMP flood operation.

Parameters:

Name Type Description Default
protocol
str

mode, for ex 'S': syn-flood '1': ping-flood (icmp) '2': udp

required
target
str

target IP addr

required
packet_count
str

number of packets to be transmitted.

required
extra_args
str | None

extra arguments to be passed, defaults to None

None
pkt_interval
str

wait for X microseconds before sending next packet uX, defaults to "", uX for X microseconds, for example -i u1000

''

Returns:

Type Description
str

command output

Source code in boardfarm3/templates/wan.py
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
@abstractmethod
def hping_flood(
    self,
    protocol: str,
    target: str,
    packet_count: str,
    extra_args: str | None = None,
    pkt_interval: str = "",
) -> str:
    """Validate SYN, UDP and ICMP flood operation.

    :param protocol: mode, for ex 'S': syn-flood '1': ping-flood (icmp) '2': udp
    :type protocol: str
    :param target: target IP addr
    :type target: str
    :param packet_count: number of packets to be transmitted.
    :type packet_count: str
    :param extra_args: extra arguments to be passed, defaults to None
    :type extra_args: str
    :param pkt_interval: wait for X microseconds before sending next packet uX,
        defaults to "", uX for X microseconds, for example -i u1000
    :type pkt_interval: str
    :return: command output
    :rtype: str
    """
    raise NotImplementedError

http_get abstractmethod

http_get(url: str, timeout: int, options: str) -> HTTPResult

Peform http get and return parsed result.

Parameters:

Name Type Description Default
url
str

url to get the response

required
timeout
int

connection timeout for the curl command in seconds

required
options
str

additional curl options

required

Returns:

Type Description
HTTPResult

parsed http response

Source code in boardfarm3/templates/wan.py
251
252
253
254
255
256
257
258
259
260
261
262
263
264
@abstractmethod
def http_get(self, url: str, timeout: int, options: str) -> HTTPResult:
    """Peform http get and return parsed result.

    :param url: url to get the response
    :type url: str
    :param timeout: connection timeout for the curl command in seconds
    :type timeout: int
    :param options: additional curl options
    :type options: str
    :return: parsed http response
    :rtype: HTTPResult
    """
    raise NotImplementedError

is_connect_to_board_via_reverse_ssh_successful abstractmethod

is_connect_to_board_via_reverse_ssh_successful(
    rssh_username: str, rssh_password: str | None, reverse_ssh_port: str
) -> bool

Perform reverse SSH from jump server to CPE.

Parameters:

Name Type Description Default
rssh_username
str

username of the cpe

required
rssh_password
str | None

password to connect

required
reverse_ssh_port
str

the port number

required

Returns:

Type Description
bool

True if the RSSH is successful, false otherwise

Source code in boardfarm3/templates/wan.py
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
@abstractmethod
def is_connect_to_board_via_reverse_ssh_successful(
    self,
    rssh_username: str,
    rssh_password: str | None,
    reverse_ssh_port: str,
) -> bool:
    """Perform reverse SSH from jump server to CPE.

    :param rssh_username: username of the cpe
    :type rssh_username: str
    :param rssh_password: password to connect
    :type rssh_password: Optional[str]
    :param reverse_ssh_port: the port number
    :type reverse_ssh_port: str
    :return: True if the RSSH is successful, false otherwise
    :rtype: bool
    """
    raise NotImplementedError
is_link_up(interface: str, pattern: str = 'BROADCAST,MULTICAST,UP') -> bool

Return the link status.

Parameters:

Name Type Description Default
str

interface name, defaults to "BROADCAST,MULTICAST,UP"

required
str

interface state

'BROADCAST,MULTICAST,UP'

Returns:

Type Description
bool

True if the link is up

Source code in boardfarm3/templates/wan.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
@abstractmethod
def is_link_up(
    self,
    interface: str,
    pattern: str = "BROADCAST,MULTICAST,UP",
) -> bool:
    """Return the link status.

    :param interface: interface name, defaults to "BROADCAST,MULTICAST,UP"
    :type interface: str
    :param pattern: interface state
    :type pattern: str
    :return: True if the link is up
    :rtype: bool
    """
    raise NotImplementedError

kill_process abstractmethod

kill_process(pid: int, signal: int) -> None

Kill the running process based on the process id.

Parameters:

Name Type Description Default
pid
int

process id

required
Source code in boardfarm3/templates/wan.py
739
740
741
742
743
744
745
746
747
748
@abstractmethod
def kill_process(self, pid: int, signal: int) -> None:
    """Kill the running process based on the process id.

    :param pid: process id
    :type pid: int
    :type signal: signal number to terminate the process
    :type signal: int
    """
    raise NotImplementedError

nmap abstractmethod

nmap(
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
    timeout: int = 30,
) -> dict

Perform nmap operation on linux device.

Parameters:

Name Type Description Default
ipaddr
str

ip address on which nmap is performed

required
ip_type
str

type of ip eg: ipv4/ipv6

required
port
str | int | None

destination port on ip, defaults to None

None
protocol
str | None

specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None

None
max_retries
int | None

number of port scan probe retransmissions, defaults to None

None
min_rate
int | None

Send packets no slower than per second, defaults to None

None
opts
str | None

other options for a nmap command, defaults to None

None
timeout
int

pexpect timeout for the command in seconds, defaults to 30

30

Returns:

Type Description
dict

response of nmap command in xml/dict format

Raises:

Type Description
BoardfarmException

Raises exception if ip type is invalid

Source code in boardfarm3/templates/wan.py
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
@abstractmethod
def nmap(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
    timeout: int = 30,
) -> dict:
    """Perform nmap operation on linux device.

    :param ipaddr: ip address on which nmap is performed
    :type ipaddr: str
    :param ip_type: type of ip eg: ipv4/ipv6
    :type ip_type: str
    :param port: destination port on ip, defaults to None
    :type port: Optional[Union[str, int]], optional
    :param protocol: specific protocol to follow eg: tcp(-sT)/udp(-sU),
        defaults to None
    :type protocol: Optional[str], optional
    :param max_retries: number of port scan probe retransmissions, defaults to None
    :type max_retries: Optional[int], optional
    :param min_rate: Send packets no slower than per second, defaults to None
    :type min_rate: Optional[int], optional
    :param opts: other options for a nmap command, defaults to None
    :type opts: str, optional
    :param timeout: pexpect timeout for the command in seconds, defaults to 30
    :type timeout: int
    :raises BoardfarmException: Raises exception if ip type is invalid
    :return: response of nmap command in xml/dict format
    :rtype: dict
    """
    raise NotImplementedError

ping abstractmethod

ping(
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict

Ping remote host.

Return True if ping has 0% loss or parsed output in JSON if json_output=True flag is provided.

Parameters:

Name Type Description Default
ping_ip
str

ping ip

required
ping_count
int

number of ping, defaults to 4

4
ping_interface
str | None

ping via interface, defaults to None

None
options
str

extra ping options, defaults to ""

''
timeout
int

timeout, defaults to 50

50
json_output
bool

return ping output in dictionary format, defaults to False

False

Returns:

Type Description
bool | dict

ping output

Source code in boardfarm3/templates/wan.py
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
@abstractmethod
def ping(  # noqa: PLR0913
    self,
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict:
    """Ping remote host.

    Return True if ping has 0% loss
    or parsed output in JSON if json_output=True flag is provided.

    :param ping_ip: ping ip
    :param ping_count: number of ping, defaults to 4
    :param ping_interface: ping via interface, defaults to None
    :param options: extra ping options, defaults to ""
    :param timeout: timeout, defaults to 50
    :param json_output: return ping output in dictionary format, defaults to False
    :return: ping output
    """
    raise NotImplementedError

release_dhcp abstractmethod

release_dhcp(interface: str) -> None

Release IPv4 of the specified interface.

Parameters:

Name Type Description Default
interface
str

interface name

required
Source code in boardfarm3/templates/wan.py
618
619
620
621
622
623
624
625
@abstractmethod
def release_dhcp(self, interface: str) -> None:
    """Release IPv4 of the specified interface.

    :param interface: interface name
    :type interface: str
    """
    raise NotImplementedError

scp_device_file_to_local abstractmethod

scp_device_file_to_local(local_path: str, source_path: str) -> None

Copy a local file from a server using SCP.

Parameters:

Name Type Description Default
local_path
str

local file path

required
source_path
str

source path

required
Source code in boardfarm3/templates/wan.py
474
475
476
477
478
479
480
481
@abstractmethod
def scp_device_file_to_local(self, local_path: str, source_path: str) -> None:
    """Copy a local file from a server using SCP.

    :param local_path: local file path
    :param source_path: source path
    """
    raise NotImplementedError

set_date abstractmethod

set_date(opt: str, date_string: str) -> bool

Set the device's date and time.

Parameters:

Name Type Description Default
date_string
str

value to be changed

required
opt
str

Option to set the date or time or day

required

Returns:

Type Description
bool

True if set is successful

Source code in boardfarm3/templates/wan.py
605
606
607
608
609
610
611
612
613
614
615
616
@abstractmethod
def set_date(self, opt: str, date_string: str) -> bool:
    """Set the device's date and time.

    :param date_string: value to be changed
    :type date_string: str
    :param opt: Option to set the date or time or day
    :type opt: str
    :return: True if set is successful
    :rtype: bool
    """
    raise NotImplementedError

set_default_gw abstractmethod

set_default_gw(ip_address: IPv4Address, interface: str) -> None

Set given IP address as default gateway address for given interface.

Parameters:

Name Type Description Default
ip_address
IPv4Address

gateway IP address

required
interface
str

interface name

required
Source code in boardfarm3/templates/wan.py
645
646
647
648
649
650
651
652
653
654
@abstractmethod
def set_default_gw(self, ip_address: IPv4Address, interface: str) -> None:
    """Set given IP address as default gateway address for given interface.

    :param ip_address: gateway IP address
    :type ip_address: IPv4Address
    :param interface: interface name
    :type interface: str
    """
    raise NotImplementedError
set_link_state(interface: str, state: str) -> None

Set link state.

Parameters:

Name Type Description Default
str

name of the interface

required
str

desired state up or down

required
Source code in boardfarm3/templates/wan.py
579
580
581
582
583
584
585
586
587
588
@abstractmethod
def set_link_state(self, interface: str, state: str) -> None:
    """Set link state.

    :param interface: name of the interface
    :type interface: str
    :param state: desired state up or down
    :type state: str
    """
    raise NotImplementedError

set_static_ip abstractmethod

set_static_ip(interface: str, ip_address: IPv4Address, netmask: IPv4Address) -> None

Set given static IP for the LAN.

Parameters:

Name Type Description Default
interface
str

interface name

required
ip_address
IPv4Address

static IP address

required
netmask
IPv4Address

netmask

required
Source code in boardfarm3/templates/wan.py
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
@abstractmethod
def set_static_ip(
    self,
    interface: str,
    ip_address: IPv4Address,
    netmask: IPv4Address,
) -> None:
    """Set given static IP for the LAN.

    :param interface: interface name
    :type interface: str
    :param ip_address: static IP address
    :type ip_address: IPv4Address
    :param netmask: netmask
    :type netmask: IPv4Address
    """
    raise NotImplementedError

start_http_service abstractmethod

start_http_service(port: str, ip_version: str) -> str

Start HTTP service on given port number.

Parameters:

Name Type Description Default
port
str

port number

required
ip_version
str

ip version, 4 - IPv4, 6 - IPv6

required

Returns:

Type Description
str

pid number of the http service

Source code in boardfarm3/templates/wan.py
233
234
235
236
237
238
239
240
241
@abstractmethod
def start_http_service(self, port: str, ip_version: str) -> str:
    """Start HTTP service on given port number.

    :param port: port number
    :param ip_version: ip version, 4 - IPv4, 6 - IPv6
    :return: pid number of the http service
    """
    raise NotImplementedError

start_tcpdump abstractmethod

start_tcpdump(
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str

Start tcpdump capture on given interface.

Parameters:

Name Type Description Default
interface
str

inteface name where packets to be captured

required
port
str | None

port number, can be a range of ports(eg: 443 or 433-443)

required
output_file
str

pcap file name, Defaults: pkt_capture.pcap

'pkt_capture.pcap'
filters
dict | None

filters as key value pair(eg: {"-v": "", "-c": "4"})

None
additional_filters
str | None

additional filters

''

Returns:

Type Description
str

console ouput and tcpdump process id

Raises:

Type Description
ValueError

on failed to start tcpdump

Source code in boardfarm3/templates/wan.py
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
@abstractmethod
def start_tcpdump(
    self,
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str:
    """Start tcpdump capture on given interface.

    :param interface: inteface name where packets to be captured
    :type interface: str
    :param port: port number, can be a range of ports(eg: 443 or 433-443)
    :type port: str
    :param output_file: pcap file name, Defaults: pkt_capture.pcap
    :type output_file: str
    :param filters: filters as key value pair(eg: {"-v": "", "-c": "4"})
    :type filters: Optional[Dict]
    :param additional_filters: additional filters
    :type additional_filters: Optional[str]
    :raises ValueError: on failed to start tcpdump
    :return: console ouput and tcpdump process id
    :rtype: str
    """
    raise NotImplementedError

start_traffic_receiver abstractmethod

start_traffic_receiver(
    traffic_port: int,
    bind_to_ip: str | None = None,
    ip_version: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]

Start the server on a linux device to generate traffic using iperf3.

Parameters:

Name Type Description Default
traffic_port
int

server port to listen on

required
bind_to_ip
str | None

bind to the interface associated with the address host, defaults to None

None
ip_version
int | None

4 or 6 as it uses only IPv4 or IPv6, defaults to None

None
udp_only
bool | None

to be used if protocol is UDP only, backward compatibility with iperf version 2

None

Returns:

Type Description
tuple[int, str]

the process id(pid) and log file path

Raises:

Type Description
CodeError

raises if unable to start server

Source code in boardfarm3/templates/wan.py
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
@abstractmethod
def start_traffic_receiver(
    self,
    traffic_port: int,
    bind_to_ip: str | None = None,
    ip_version: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]:
    """Start the server on a linux device to generate traffic using iperf3.

    :param traffic_port: server port to listen on
    :type traffic_port: int
    :param bind_to_ip: bind to the interface associated with
        the address host, defaults to None
    :type bind_to_ip: str, optional
    :param ip_version: 4 or 6 as it uses only IPv4 or IPv6, defaults to None
    :type ip_version: int,
    :param udp_only: to be used if protocol is UDP only,
        backward compatibility with iperf version 2
    :type udp_only: bool, optional
    :raises CodeError: raises if unable to start server
    :return: the process id(pid) and log file path
    :rtype: tuple[int, str]
    """
    raise NotImplementedError

start_traffic_sender abstractmethod

start_traffic_sender(
    host: str,
    traffic_port: int,
    bandwidth: int | None = None,
    bind_to_ip: str | None = None,
    direction: str | None = None,
    ip_version: int | None = None,
    udp_protocol: bool = False,
    time: int = 10,
    client_port: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]

Start traffic on a linux client using iperf3.

Parameters:

Name Type Description Default
host
str

a host to run in client mode

required
traffic_port
int

server port to connect to

required
bandwidth
int | None

bandwidth(mbps) at which the traffic has to be generated, defaults to None

None
bind_to_ip
str | None

bind to the interface associated with the address host, defaults to None

None
direction
str | None

--reverse to run in reverse mode (server sends, client receives) or --bidir to run in bidirectional mode, defaults to None

None
ip_version
int | None

4 or 6 as it uses only IPv4 or IPv6, defaults to None

None
udp_protocol
bool

use UDP rather than TCP, defaults to False

False
time
int

time in seconds to transmit for, defaults to 10

10
client_port
int | None

client port from where the traffic is getting started

None
udp_only
bool | None

to be used if protocol is UDP only, backward compatibility with iperf version 2

None

Returns:

Type Description
tuple[int, str]

the process id(pid) and log file path

Raises:

Type Description
CodeError

raises if unable to start server

Source code in boardfarm3/templates/wan.py
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
@abstractmethod
def start_traffic_sender(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    host: str,
    traffic_port: int,
    bandwidth: int | None = None,
    bind_to_ip: str | None = None,
    direction: str | None = None,
    ip_version: int | None = None,
    udp_protocol: bool = False,
    time: int = 10,
    client_port: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]:
    """Start traffic on a linux client using iperf3.

    :param host: a host to run in client mode
    :type host: str
    :param traffic_port: server port to connect to
    :type traffic_port: int
    :param bandwidth: bandwidth(mbps) at which the traffic
        has to be generated, defaults to None
    :type bandwidth: Optional[int], optional
    :param bind_to_ip: bind to the interface associated with
        the address host, defaults to None
    :type bind_to_ip: Optional[str], optional
    :param direction: `--reverse` to run in reverse mode
        (server sends, client receives) or `--bidir` to run in
        bidirectional mode, defaults to None
    :type direction: Optional[str], optional
    :param ip_version: 4 or 6 as it uses only IPv4 or IPv6, defaults to None
    :type ip_version: int, optional
    :param udp_protocol: use UDP rather than TCP, defaults to False
    :type udp_protocol: bool
    :param time: time in seconds to transmit for, defaults to 10
    :type time: int
    :param client_port: client port from where the traffic is getting started
    :type client_port: int | None
    :param udp_only: to be used if protocol is UDP only,
        backward compatibility with iperf version 2
    :type udp_only: bool, optional
    :raises CodeError: raises if unable to start server
    :return: the process id(pid) and log file path
    :rtype: tuple[int, str]
    """
    raise NotImplementedError

stop_http_service abstractmethod

stop_http_service(port: str) -> None

Stop http service running on given port.

Parameters:

Name Type Description Default
port
str

port number

required
Source code in boardfarm3/templates/wan.py
243
244
245
246
247
248
249
@abstractmethod
def stop_http_service(self, port: str) -> None:
    """Stop http service running on given port.

    :param port: port number
    """
    raise NotImplementedError

stop_tcpdump abstractmethod

stop_tcpdump(process_id: str) -> None

Stop tcpdump capture.

Parameters:

Name Type Description Default
process_id
str

tcpdump process id

required
Source code in boardfarm3/templates/wan.py
719
720
721
722
723
724
725
726
@abstractmethod
def stop_tcpdump(self, process_id: str) -> None:
    """Stop tcpdump capture.

    :param process_id: tcpdump process id
    :type process_id: str
    """
    raise NotImplementedError

stop_traffic abstractmethod

stop_traffic(pid: int | None = None) -> bool

Stop the iPerf3 process for a specific PID or killall.

Parameters:

Name Type Description Default
pid
int | None

process ID for a iPerf3 service either for reciever or sender, defaults to None

None

Returns:

Type Description
bool

True if process is stopped else False

Source code in boardfarm3/templates/wan.py
556
557
558
559
560
561
562
563
564
565
566
@abstractmethod
def stop_traffic(self, pid: int | None = None) -> bool:
    """Stop the iPerf3 process for a specific PID or killall.

    :param pid: process ID for a iPerf3 service either for reciever or sender,
        defaults to None
    :type pid: int | None
    :return: True if process is stopped else False
    :rtype: bool
    """
    raise NotImplementedError

tcpdump_capture abstractmethod

tcpdump_capture(
    fname: str, interface: str = "any", additional_args: str | None = None
) -> Generator[str]

Capture packets from specified interface.

Packet capture using tcpdump utility at a specified interface.

:yield: process id of tcpdump process

Parameters:

Name Type Description Default
fname
str

name of the file where packet captures will be stored

required
interface
str

name of the interface, defaults to "any"

'any'
additional_args
str | None

argument arguments to tcpdump executable

None
Source code in boardfarm3/templates/wan.py
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
@contextmanager
@abstractmethod
def tcpdump_capture(
    self,
    fname: str,
    interface: str = "any",
    additional_args: str | None = None,
) -> Generator[str]:
    """Capture packets from specified interface.

    Packet capture using tcpdump utility at a specified interface.

    :param fname: name of the file where packet captures will be stored
    :param interface: name of the interface, defaults to "any"
    :param additional_args: argument arguments to tcpdump executable
    :yield: process id of tcpdump process
    """
    raise NotImplementedError

tshark_read_pcap abstractmethod

tshark_read_pcap(
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str

Read packet captures from an existing file.

Parameters:

Name Type Description Default
fname
str

name of the file in which captures are saved

required
additional_args
str | None

additional arguments for tshark command

None
timeout
int

time out for tshark command to be executed, defaults to 30

30
rm_pcap
bool

If True remove the packet capture file after reading it

False

Returns:

Type Description
str

return tshark read command console output

Source code in boardfarm3/templates/wan.py
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
@abstractmethod
def tshark_read_pcap(
    self,
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str:
    """Read packet captures from an existing file.

    :param fname: name of the file in which captures are saved
    :param additional_args: additional arguments for tshark command
    :param timeout: time out for tshark command to be executed, defaults to 30
    :param rm_pcap: If True remove the packet capture file after reading it
    :return: return tshark read command console output
    """
    raise NotImplementedError

wlan

Boardfarm WLAN device template.

Classes:

Name Description
WLAN

Boardfarm WLAN device template.

WLAN

Boardfarm WLAN device template.

Methods:

Name Description
change_wifi_region

Change the region of the wifi.

delete_file

Delete the file from the device.

dhcp_release_wlan_iface

DHCP release the wifi interface.

disable_ipv6

Disable ipv6 on the connected client interface.

disable_monitor_mode

Disable monitor mode on WLAN interface.

disable_wifi

Disabling the wifi interface.

disconnect_wpa

Disconnect the wpa supplicant initialisation.

enable_ipv6

Enable ipv6 on the connected client interface.

enable_monitor_mode

Enable monitor mode on WLAN interface.

enable_wifi

Enable the wifi interface.

get_date

Get the system date and time.

get_hostname

Get the hostname of the device.

get_interface_ipv4addr

Return ipv4 address of the interface.

get_interface_ipv6addr

Return ipv4 address of the interface.

get_interface_macaddr

Get the interface MAC address.

get_interface_mask

Get the subnet mask of the interface.

get_interface_mtu_size

Get the MTU size of the interface in bytes.

get_iperf_logs

Read the file output for traffic flow.

get_process_id

Return the process id to the device.

is_monitor_mode_enabled

Check if monitor mode is enabled on WLAN interface.

is_wlan_connected

Verify wifi is in the connected state.

iwlist_supported_channels

List of wifi client support channels.

kill_process

Kill the running process based on the process id.

list_wifi_ssids

Scan for available WiFi SSIDs.

nmap

Perform nmap operation on linux device.

ping

Ping remote host.

release_dhcp

Release IPv4 of the specified interface.

release_ipv6

Release IPv6 of the specified interface.

renew_dhcp

Renew IPv4 of the specified interface by restart of the IPv4 dhclient.

renew_ipv6

Renew IPv6 of the specified interface.

reset_wifi_iface

Disable and enable wifi interface.

scp_device_file_to_local

Copy a local file from a server using SCP.

send_mldv2_report

Send an MLDv2 report with desired multicast record.

set_date

Set the device's date and time.

set_link_state

Set link state.

set_wlan_scan_channel

Change wifi client scan channel.

start_ipv4_wlan_client

Restart ipv4 dhclient to obtain an IP.

start_ipv6_wlan_client

Restart ipv6 dhclient to obtain IP.

start_tcpdump

Start tcpdump capture on given interface.

start_traffic_receiver

Start the server on a linux device to generate traffic using iperf3.

start_traffic_sender

Start traffic on a linux client using iperf3.

stop_tcpdump

Stop tcpdump capture.

stop_traffic

Stop the iPerf3 process for a specific PID or killall.

tcpdump_capture

Capture packets from specified interface.

tshark_read_pcap

Read packet captures from an existing file.

wifi_client_connect

Scan for SSID and verify wifi connectivity.

wifi_disconnect

Disconnect wifi connectivity.

Attributes:

Name Type Description
authentication str

Wifi authentication through which wlan device should connect.

band str

Wifi band supported by the wlan device.

console BoardfarmPexpect

Returns WLAN console.

http_proxy str

SOCKS5 dante proxy address.

iface_dut str

Name of the interface that is connected to DUT.

ipv4_addr str

Return the IPv4 address on IFACE facing DUT.

ipv6_addr str

Return the IPv6 address on IFACE facing DUT.

lan_gateway IPv4Address

WLAN gateway address.

lan_network IPv4Network

IPv4 WLAN Network.

multicast Multicast

Return multicast component instance.

network str

Wifi network to which wlan device should connect.

protocol str

Wifi protocol using which wlan device should connect.

authentication abstractmethod property

authentication: str

Wifi authentication through which wlan device should connect.

Returns:

Type Description
str

WPA-PSK, WPA2, etc

band abstractmethod property

band: str

Wifi band supported by the wlan device.

Returns:

Type Description
str

type of band i.e. 2.4, 5, dual

console abstractmethod property

Returns WLAN console.

Returns:

Type Description
BoardfarmPexpect

console

http_proxy abstractmethod property

http_proxy: str

SOCKS5 dante proxy address.

Returns:

Type Description
str

http://{proxy_ip}:{proxy_port}/

iface_dut abstractmethod property

iface_dut: str

Name of the interface that is connected to DUT.

Returns:

Type Description
str

interface

ipv4_addr abstractmethod cached property

ipv4_addr: str

Return the IPv4 address on IFACE facing DUT.

Returns:

Type Description
str

IPv4 address in string format.

ipv6_addr abstractmethod cached property

ipv6_addr: str

Return the IPv6 address on IFACE facing DUT.

Returns:

Type Description
str

IPv6 address in string format.

lan_gateway abstractmethod property

lan_gateway: IPv4Address

WLAN gateway address.

Returns:

Type Description
IPv4Address

Ipv4 wlan gateway address

lan_network abstractmethod property

lan_network: IPv4Network

IPv4 WLAN Network.

Returns:

Type Description
IPv4Network

IPv4 address network

multicast abstractmethod property

multicast: Multicast

Return multicast component instance.

Returns:

Type Description
Multicast

multicast component instance

network abstractmethod property

network: str

Wifi network to which wlan device should connect.

Returns:

Type Description
str

type of network i.e. private, guest, community

protocol abstractmethod property

protocol: str

Wifi protocol using which wlan device should connect.

Returns:

Type Description
str

802.11ac, 802.11, etc

change_wifi_region abstractmethod

change_wifi_region(country: str) -> None

Change the region of the wifi.

Parameters:

Name Type Description Default
country
str

region to be set

required
Source code in boardfarm3/templates/wlan.py
219
220
221
222
223
224
225
226
@abstractmethod
def change_wifi_region(self, country: str) -> None:
    """Change the region of the wifi.

    :param country: region to be set
    :type country: str
    """
    raise NotImplementedError

delete_file abstractmethod

delete_file(filename: str) -> None

Delete the file from the device.

Parameters:

Name Type Description Default
filename
str

name of the file with absolute path

required
Source code in boardfarm3/templates/wlan.py
370
371
372
373
374
375
376
377
@abstractmethod
def delete_file(self, filename: str) -> None:
    """Delete the file from the device.

    :param filename: name of the file with absolute path
    :type filename: str
    """
    raise NotImplementedError

dhcp_release_wlan_iface abstractmethod

dhcp_release_wlan_iface() -> None

DHCP release the wifi interface.

Source code in boardfarm3/templates/wlan.py
148
149
150
151
@abstractmethod
def dhcp_release_wlan_iface(self) -> None:
    """DHCP release the wifi interface."""
    raise NotImplementedError

disable_ipv6 abstractmethod

disable_ipv6() -> None

Disable ipv6 on the connected client interface.

Source code in boardfarm3/templates/wlan.py
332
333
334
335
@abstractmethod
def disable_ipv6(self) -> None:
    """Disable ipv6 on the connected client interface."""
    raise NotImplementedError

disable_monitor_mode abstractmethod

disable_monitor_mode() -> None

Disable monitor mode on WLAN interface.

Set the type to managed

Source code in boardfarm3/templates/wlan.py
644
645
646
647
648
649
650
@abstractmethod
def disable_monitor_mode(self) -> None:
    """Disable monitor mode on WLAN interface.

    Set the type to managed
    """
    raise NotImplementedError

disable_wifi abstractmethod

disable_wifi() -> None

Disabling the wifi interface.

Set the interface link to "down"

Source code in boardfarm3/templates/wlan.py
132
133
134
135
136
137
138
@abstractmethod
def disable_wifi(self) -> None:
    """Disabling the wifi interface.

    Set the interface link to "down"
    """
    raise NotImplementedError

disconnect_wpa abstractmethod

disconnect_wpa() -> None

Disconnect the wpa supplicant initialisation.

Source code in boardfarm3/templates/wlan.py
242
243
244
245
@abstractmethod
def disconnect_wpa(self) -> None:
    """Disconnect the wpa supplicant initialisation."""
    raise NotImplementedError

enable_ipv6 abstractmethod

enable_ipv6() -> None

Enable ipv6 on the connected client interface.

Source code in boardfarm3/templates/wlan.py
327
328
329
330
@abstractmethod
def enable_ipv6(self) -> None:
    """Enable ipv6 on the connected client interface."""
    raise NotImplementedError

enable_monitor_mode abstractmethod

enable_monitor_mode() -> None

Enable monitor mode on WLAN interface.

Set the type to monitor

Source code in boardfarm3/templates/wlan.py
636
637
638
639
640
641
642
@abstractmethod
def enable_monitor_mode(self) -> None:
    """Enable monitor mode on WLAN interface.

    Set the type to monitor
    """
    raise NotImplementedError

enable_wifi abstractmethod

enable_wifi() -> None

Enable the wifi interface.

Set the interface link to "up"

Source code in boardfarm3/templates/wlan.py
140
141
142
143
144
145
146
@abstractmethod
def enable_wifi(self) -> None:
    """Enable the wifi interface.

    Set the interface link to "up"
    """
    raise NotImplementedError

get_date abstractmethod

get_date() -> str | None

Get the system date and time.

.. code-block:: python

# example output
donderdag, mei 23, 2024 14:23:39

Returns:

Type Description
str | None

date

Source code in boardfarm3/templates/wlan.py
495
496
497
498
499
500
501
502
503
504
505
506
507
508
@abstractmethod
def get_date(self) -> str | None:
    """Get the system date and time.

    .. code-block:: python

        # example output
        donderdag, mei 23, 2024 14:23:39


    :return: date
    :rtype: str | None
    """
    raise NotImplementedError

get_hostname abstractmethod

get_hostname() -> str

Get the hostname of the device.

Returns:

Type Description
str

hostname of the device

Source code in boardfarm3/templates/wlan.py
684
685
686
687
688
689
690
691
@abstractmethod
def get_hostname(self) -> str:
    """Get the hostname of the device.

    :return: hostname of the device
    :rtype: str
    """
    raise NotImplementedError

get_interface_ipv4addr abstractmethod

get_interface_ipv4addr(interface: str) -> str

Return ipv4 address of the interface.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv4 of the interface

Raises:

Type Description
BoardfarmException

in case IPv4 is not found

Source code in boardfarm3/templates/wlan.py
247
248
249
250
251
252
253
254
255
256
257
@abstractmethod
def get_interface_ipv4addr(self, interface: str) -> str:
    """Return ipv4 address of the interface.

    :param interface: interface name
    :type interface: str
    :raises BoardfarmException: in case IPv4 is not found
    :return: IPv4 of the interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_ipv6addr abstractmethod

get_interface_ipv6addr(interface: str) -> str

Return ipv4 address of the interface.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

IPv6 of the interface

Raises:

Type Description
BoardfarmException

in case IPv6 is not found

Source code in boardfarm3/templates/wlan.py
259
260
261
262
263
264
265
266
267
268
269
@abstractmethod
def get_interface_ipv6addr(self, interface: str) -> str:
    """Return ipv4 address of the interface.

    :param interface: interface name
    :type interface: str
    :raises BoardfarmException: in case IPv6 is not found
    :return: IPv6 of the interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_macaddr abstractmethod

get_interface_macaddr(interface: str) -> str

Get the interface MAC address.

Parameters:

Name Type Description Default
interface
str

interface name

required

Returns:

Type Description
str

mac address of the interface

Source code in boardfarm3/templates/wlan.py
337
338
339
340
341
342
343
344
345
346
@abstractmethod
def get_interface_macaddr(self, interface: str) -> str:
    """Get the interface MAC address.

    :param interface: interface name
    :type interface: str
    :return: mac address of the interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_mask abstractmethod

get_interface_mask(interface: str) -> str

Get the subnet mask of the interface.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
str

subnet mask of interface

Source code in boardfarm3/templates/wlan.py
348
349
350
351
352
353
354
355
356
357
@abstractmethod
def get_interface_mask(self, interface: str) -> str:
    """Get the subnet mask of the interface.

    :param interface: name of the interface
    :type interface: str
    :return: subnet mask of interface
    :rtype: str
    """
    raise NotImplementedError

get_interface_mtu_size abstractmethod

get_interface_mtu_size(interface: str) -> int

Get the MTU size of the interface in bytes.

Parameters:

Name Type Description Default
interface
str

name of the interface

required

Returns:

Type Description
int

size of the MTU in bytes

Source code in boardfarm3/templates/wlan.py
359
360
361
362
363
364
365
366
367
368
@abstractmethod
def get_interface_mtu_size(self, interface: str) -> int:
    """Get the MTU size of the interface in bytes.

    :param interface: name of the interface
    :type interface: str
    :return: size of the MTU in bytes
    :rtype: int
    """
    raise NotImplementedError

get_iperf_logs abstractmethod

get_iperf_logs(log_file: str) -> str

Read the file output for traffic flow.

Parameters:

Name Type Description Default
log_file
str

iperf log file path

required

Returns:

Type Description
str

traffic flow logs

Source code in boardfarm3/templates/wlan.py
473
474
475
476
477
478
479
480
481
482
@abstractmethod
def get_iperf_logs(self, log_file: str) -> str:
    """Read the file output for traffic flow.

    :param log_file: iperf log file path
    :type log_file: str
    :return: traffic flow logs
    :rtype: str
    """
    raise NotImplementedError

get_process_id abstractmethod

get_process_id(process_name: str) -> list[str] | None

Return the process id to the device.

Parameters:

Name Type Description Default
process_name
str

name of the process

required

Returns:

Type Description
list[str] | None

process id if the process exist, else None

Source code in boardfarm3/templates/wlan.py
693
694
695
696
697
698
699
700
701
702
@abstractmethod
def get_process_id(self, process_name: str) -> list[str] | None:
    """Return the process id to the device.

    :param process_name: name of the process
    :type process_name: str
    :return: process id if the process exist, else None
    :rtype: list[str] | None
    """
    raise NotImplementedError

is_monitor_mode_enabled abstractmethod

is_monitor_mode_enabled() -> bool

Check if monitor mode is enabled on WLAN interface.

Returns:

Type Description
bool

Status of monitor mode

Source code in boardfarm3/templates/wlan.py
652
653
654
655
656
657
658
659
@abstractmethod
def is_monitor_mode_enabled(self) -> bool:
    """Check if monitor mode is enabled on WLAN interface.

    :return: Status of monitor mode
    :rtype: bool
    """
    raise NotImplementedError

is_wlan_connected abstractmethod

is_wlan_connected() -> bool

Verify wifi is in the connected state.

Returns:

Type Description
bool

True if wlan is connected, False otherwise

Source code in boardfarm3/templates/wlan.py
228
229
230
231
232
233
234
235
@abstractmethod
def is_wlan_connected(self) -> bool:
    """Verify wifi is in the connected state.

    :return: True if wlan is connected, False otherwise
    :rtype: bool
    """
    raise NotImplementedError

iwlist_supported_channels abstractmethod

iwlist_supported_channels(wifi_band: str) -> list[str]

List of wifi client support channels.

Parameters:

Name Type Description Default
wifi_band
str

wifi frequency ['2.4' or '5']

required

Returns:

Type Description
list[str]

list of channel in wifi mode

Source code in boardfarm3/templates/wlan.py
176
177
178
179
180
181
182
183
184
185
@abstractmethod
def iwlist_supported_channels(self, wifi_band: str) -> list[str]:
    """List of wifi client support channels.

    :param wifi_band: wifi frequency ['2.4' or '5']
    :type wifi_band: str
    :return: list of channel in wifi mode
    :rtype: list[str]
    """
    raise NotImplementedError

kill_process abstractmethod

kill_process(pid: int, signal: int) -> None

Kill the running process based on the process id.

Parameters:

Name Type Description Default
pid
int

process id

required
Source code in boardfarm3/templates/wlan.py
704
705
706
707
708
709
710
711
712
713
@abstractmethod
def kill_process(self, pid: int, signal: int) -> None:
    """Kill the running process based on the process id.

    :param pid: process id
    :type pid: int
    :type signal: signal number to terminate the process
    :type signal: int
    """
    raise NotImplementedError

list_wifi_ssids abstractmethod

list_wifi_ssids() -> list[str]

Scan for available WiFi SSIDs.

Returns:

Type Description
list[str]

List of Wi-FI SSIDs

Raises:

Type Description
CodeError

WLAN card was blocked due to some process.

Source code in boardfarm3/templates/wlan.py
187
188
189
190
191
192
193
194
195
@abstractmethod
def list_wifi_ssids(self) -> list[str]:
    """Scan for available WiFi SSIDs.

    :raises CodeError: WLAN card was blocked due to some process.
    :return: List of Wi-FI SSIDs
    :rtype: list[str]
    """
    raise NotImplementedError

nmap abstractmethod

nmap(
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
    timeout: int = 30,
) -> dict

Perform nmap operation on linux device.

Parameters:

Name Type Description Default
ipaddr
str

ip address on which nmap is performed

required
ip_type
str

type of ip eg: ipv4/ipv6

required
port
str | int | None

destination port on ip, defaults to None

None
protocol
str | None

specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None

None
max_retries
int | None

number of port scan probe retransmissions, defaults to None

None
min_rate
int | None

Send packets no slower than per second, defaults to None

None
opts
str | None

other options for a nmap command, defaults to None

None
timeout
int

pexpect timeout for the command in seconds, defaults to 30

30

Returns:

Type Description
dict

response of nmap command in xml/dict format

Raises:

Type Description
BoardfarmException

Raises exception if ip type is invalid

Source code in boardfarm3/templates/wlan.py
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
@abstractmethod
def nmap(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    ipaddr: str,
    ip_type: str,
    port: str | int | None = None,
    protocol: str | None = None,
    max_retries: int | None = None,
    min_rate: int | None = None,
    opts: str | None = None,
    timeout: int = 30,
) -> dict:
    """Perform nmap operation on linux device.

    :param ipaddr: ip address on which nmap is performed
    :type ipaddr: str
    :param ip_type: type of ip eg: ipv4/ipv6
    :type ip_type: str
    :param port: destination port on ip, defaults to None
    :type port: Optional[Union[str, int]], optional
    :param protocol: specific protocol to follow eg: tcp(-sT)/udp(-sU),
        defaults to None
    :type protocol: Optional[str], optional
    :param max_retries: number of port scan probe retransmissions, defaults to None
    :type max_retries: Optional[int], optional
    :param min_rate: Send packets no slower than per second, defaults to None
    :type min_rate: Optional[int], optional
    :param opts: other options for a nmap command, defaults to None
    :type opts: str, optional
    :param timeout: pexpect timeout for the command in seconds, defaults to 30
    :type timeout: int
    :raises BoardfarmException: Raises exception if ip type is invalid
    :return: response of nmap command in xml/dict format
    :rtype: dict
    """
    raise NotImplementedError

ping abstractmethod

ping(
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict[str, Any]

Ping remote host.

Return True if ping has 0% loss or parsed output in JSON if json_output=True flag is provided.

Parameters:

Name Type Description Default
ping_ip
str

ping IP

required
ping_count
int

number of ping, defaults to 4

4
ping_interface
str | None

ping via interface, defaults to None

None
options
str

extra ping options, defaults to ""

''
timeout
int

timeout, defaults to 50

50
json_output
bool

return ping output in dictionary format, defaults to False

False

Returns:

Type Description
bool | dict[str, Any]

ping output

Source code in boardfarm3/templates/wlan.py
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
@abstractmethod
def ping(  # noqa: PLR0913
    self,
    ping_ip: str,
    ping_count: int = 4,
    ping_interface: str | None = None,
    options: str = "",
    timeout: int = 50,
    json_output: bool = False,
) -> bool | dict[str, Any]:
    """Ping remote host.

    Return True if ping has 0% loss
    or parsed output in JSON if json_output=True flag is provided.

    :param ping_ip: ping IP
    :type ping_ip: str
    :param ping_count: number of ping, defaults to 4
    :type ping_count: int
    :param ping_interface: ping via interface, defaults to None
    :type ping_interface: str
    :param options: extra ping options, defaults to ""
    :type options: str
    :param timeout: timeout, defaults to 50
    :type timeout: int
    :param json_output: return ping output in dictionary format, defaults to False
    :type json_output: bool
    :return: ping output
    :rtype: bool | dict[str, Any]
    """
    raise NotImplementedError

release_dhcp abstractmethod

release_dhcp(interface: str) -> None

Release IPv4 of the specified interface.

Parameters:

Name Type Description Default
interface
str

interface name

required
Source code in boardfarm3/templates/wlan.py
596
597
598
599
600
601
602
603
@abstractmethod
def release_dhcp(self, interface: str) -> None:
    """Release IPv4 of the specified interface.

    :param interface: interface name
    :type interface: str
    """
    raise NotImplementedError

release_ipv6 abstractmethod

release_ipv6(interface: str, stateless: bool = False) -> None

Release IPv6 of the specified interface.

Parameters:

Name Type Description Default
interface
str

interface name

required
stateless
bool

run command with -S or -6 options. -6 by default

False
Source code in boardfarm3/templates/wlan.py
614
615
616
617
618
619
620
621
622
623
@abstractmethod
def release_ipv6(self, interface: str, stateless: bool = False) -> None:
    """Release IPv6 of the specified interface.

    :param interface: interface name
    :type interface: str
    :param stateless: run command with -S or -6 options. -6 by default
    :type stateless: bool
    """
    raise NotImplementedError

renew_dhcp abstractmethod

renew_dhcp(interface: str) -> None

Renew IPv4 of the specified interface by restart of the IPv4 dhclient.

Parameters:

Name Type Description Default
interface
str

interface name

required
Source code in boardfarm3/templates/wlan.py
605
606
607
608
609
610
611
612
@abstractmethod
def renew_dhcp(self, interface: str) -> None:
    """Renew IPv4 of the specified interface by restart of the IPv4 dhclient.

    :param interface: interface name
    :type interface: str
    """
    raise NotImplementedError

renew_ipv6 abstractmethod

renew_ipv6(interface: str, stateless: bool = False) -> None

Renew IPv6 of the specified interface.

Parameters:

Name Type Description Default
interface
str

interface name

required
stateless
bool

run command with -S or -6 options. -6 by default

False
Source code in boardfarm3/templates/wlan.py
625
626
627
628
629
630
631
632
633
634
@abstractmethod
def renew_ipv6(self, interface: str, stateless: bool = False) -> None:
    """Renew IPv6 of the specified interface.

    :param interface: interface name
    :type interface: str
    :param stateless: run command with -S or -6 options. -6 by default
    :type stateless: bool
    """
    raise NotImplementedError

reset_wifi_iface abstractmethod

reset_wifi_iface() -> None

Disable and enable wifi interface.

i.e., set the interface link to "down" and then to "up" This calls the disable wifi and enable wifi methods

Source code in boardfarm3/templates/wlan.py
123
124
125
126
127
128
129
130
@abstractmethod
def reset_wifi_iface(self) -> None:
    """Disable and enable wifi interface.

    i.e., set the interface link to "down" and then to "up"
    This calls the disable wifi and enable wifi methods
    """
    raise NotImplementedError

scp_device_file_to_local abstractmethod

scp_device_file_to_local(local_path: str, source_path: str) -> None

Copy a local file from a server using SCP.

Parameters:

Name Type Description Default
local_path
str

local file path

required
source_path
str

source path

required
Source code in boardfarm3/templates/wlan.py
379
380
381
382
383
384
385
386
@abstractmethod
def scp_device_file_to_local(self, local_path: str, source_path: str) -> None:
    """Copy a local file from a server using SCP.

    :param local_path: local file path
    :param source_path: source path
    """
    raise NotImplementedError

send_mldv2_report abstractmethod

send_mldv2_report(mcast_group_record: MulticastGroupRecord, count: int) -> None

Send an MLDv2 report with desired multicast record.

Multicast source and group must be IPv6 addresses. Multicast sources need to be non-multicast addresses and group address needs to be a multicast address.

Implementation relies on a custom send_mld_report script based on scapy.

Parameters:

Name Type Description Default
mcast_group_record
MulticastGroupRecord

MLDv2 multicast group record

required
count
int

num of packets to send in 1s interval

required

Raises:

Type Description
CodeError

if send_mld_report command fails

Source code in boardfarm3/templates/wlan.py
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
@abstractmethod
def send_mldv2_report(
    self, mcast_group_record: MulticastGroupRecord, count: int
) -> None:
    """Send an MLDv2 report with desired multicast record.

    Multicast source and group must be IPv6 addresses.
    Multicast sources need to be non-multicast addresses and
    group address needs to be a multicast address.

    Implementation relies on a custom send_mld_report
    script based on scapy.

    :param mcast_group_record: MLDv2 multicast group record
    :type mcast_group_record: MulticastGroupRecord
    :param count: num of packets to send in 1s interval
    :type count: int
    :raises CodeError: if send_mld_report command fails
    """
    raise NotImplementedError

set_date abstractmethod

set_date(opt: str, date_string: str) -> bool

Set the device's date and time.

Parameters:

Name Type Description Default
date_string
str

value to be changed

required
opt
str

Option to set the date or time or day

required

Returns:

Type Description
bool

True if set is successful

Source code in boardfarm3/templates/wlan.py
510
511
512
513
514
515
516
517
518
519
520
521
@abstractmethod
def set_date(self, opt: str, date_string: str) -> bool:
    """Set the device's date and time.

    :param date_string: value to be changed
    :type date_string: str
    :param opt: Option to set the date or time or day
    :type opt: str
    :return: True if set is successful
    :rtype: bool
    """
    raise NotImplementedError
set_link_state(interface: str, state: str) -> None

Set link state.

Parameters:

Name Type Description Default
str

name of the interface

required
str

desired state up or down

required
Source code in boardfarm3/templates/wlan.py
484
485
486
487
488
489
490
491
492
493
@abstractmethod
def set_link_state(self, interface: str, state: str) -> None:
    """Set link state.

    :param interface: name of the interface
    :type interface: str
    :param state: desired state up or down
    :type state: str
    """
    raise NotImplementedError

set_wlan_scan_channel abstractmethod

set_wlan_scan_channel(channel: str) -> None

Change wifi client scan channel.

Parameters:

Name Type Description Default
channel
str

wifi channel

required
Source code in boardfarm3/templates/wlan.py
167
168
169
170
171
172
173
174
@abstractmethod
def set_wlan_scan_channel(self, channel: str) -> None:
    """Change wifi client scan channel.

    :param channel: wifi channel
    :type channel: str
    """
    raise NotImplementedError

start_ipv4_wlan_client abstractmethod

start_ipv4_wlan_client() -> bool

Restart ipv4 dhclient to obtain an IP.

Returns:

Type Description
bool

True if renew is success else False

Source code in boardfarm3/templates/wlan.py
153
154
155
156
157
158
159
160
@abstractmethod
def start_ipv4_wlan_client(self) -> bool:
    """Restart ipv4 dhclient to obtain an IP.

    :return: True if renew is success else False
    :rtype: bool
    """
    raise NotImplementedError

start_ipv6_wlan_client abstractmethod

start_ipv6_wlan_client() -> None

Restart ipv6 dhclient to obtain IP.

Source code in boardfarm3/templates/wlan.py
162
163
164
165
@abstractmethod
def start_ipv6_wlan_client(self) -> None:
    """Restart ipv6 dhclient to obtain IP."""
    raise NotImplementedError

start_tcpdump abstractmethod

start_tcpdump(
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str

Start tcpdump capture on given interface.

Parameters:

Name Type Description Default
interface
str

inteface name where packets to be captured

required
port
str | None

port number, can be a range of ports(eg: 443 or 433-443)

required
output_file
str

pcap file name, Defaults: pkt_capture.pcap

'pkt_capture.pcap'
filters
dict | None

filters as key value pair(eg: {"-v": "", "-c": "4"})

None
additional_filters
str | None

additional filters

''

Returns:

Type Description
str

console ouput and tcpdump process id

Raises:

Type Description
ValueError

on failed to start tcpdump

Source code in boardfarm3/templates/wlan.py
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
@abstractmethod
def start_tcpdump(
    self,
    interface: str,
    port: str | None,
    output_file: str = "pkt_capture.pcap",
    filters: dict | None = None,
    additional_filters: str | None = "",
) -> str:
    """Start tcpdump capture on given interface.

    :param interface: inteface name where packets to be captured
    :type interface: str
    :param port: port number, can be a range of ports(eg: 443 or 433-443)
    :type port: str
    :param output_file: pcap file name, Defaults: pkt_capture.pcap
    :type output_file: str
    :param filters: filters as key value pair(eg: {"-v": "", "-c": "4"})
    :type filters: Optional[Dict]
    :param additional_filters: additional filters
    :type additional_filters: Optional[str]
    :raises ValueError: on failed to start tcpdump
    :return: console ouput and tcpdump process id
    :rtype: str
    """
    raise NotImplementedError

start_traffic_receiver abstractmethod

start_traffic_receiver(
    traffic_port: int,
    bind_to_ip: str | None = None,
    ip_version: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]

Start the server on a linux device to generate traffic using iperf3.

Parameters:

Name Type Description Default
traffic_port
int

server port to listen on

required
bind_to_ip
str | None

bind to the interface associated with the address host, defaults to None

None
ip_version
int | None

4 or 6 as it uses only IPv4 or IPv6, defaults to None

None
udp_only
bool | None

to be used if protocol is UDP only, backward compatibility with iperf version 2

None

Returns:

Type Description
tuple[int, str]

the process id(pid) and log file path

Raises:

Type Description
CodeError

raises if unable to start server

Source code in boardfarm3/templates/wlan.py
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
@abstractmethod
def start_traffic_receiver(
    self,
    traffic_port: int,
    bind_to_ip: str | None = None,
    ip_version: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]:
    """Start the server on a linux device to generate traffic using iperf3.

    :param traffic_port: server port to listen on
    :type traffic_port: int
    :param bind_to_ip: bind to the interface associated with
        the address host, defaults to None
    :type bind_to_ip: str, optional
    :param ip_version: 4 or 6 as it uses only IPv4 or IPv6, defaults to None
    :type ip_version: int, optional
    :param udp_only: to be used if protocol is UDP only,
        backward compatibility with iperf version 2
    :type udp_only: bool, optional
    :raises CodeError: raises if unable to start server
    :return: the process id(pid) and log file path
    :rtype: tuple[int, str]
    """
    raise NotImplementedError

start_traffic_sender abstractmethod

start_traffic_sender(
    host: str,
    traffic_port: int,
    bandwidth: int | None = None,
    bind_to_ip: str | None = None,
    direction: str | None = None,
    ip_version: int | None = None,
    udp_protocol: bool = False,
    time: int = 10,
    client_port: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]

Start traffic on a linux client using iperf3.

Parameters:

Name Type Description Default
host
str

a host to run in client mode

required
traffic_port
int

server port to connect to

required
bandwidth
int | None

bandwidth(mbps) at which the traffic has to be generated, defaults to None

None
bind_to_ip
str | None

bind to the interface associated with the address host, defaults to None

None
direction
str | None

--reverse to run in reverse mode (server sends, client receives) or --bidir to run in bidirectional mode, defaults to None

None
ip_version
int | None

4 or 6 as it uses only IPv4 or IPv6, defaults to None

None
udp_protocol
bool

use UDP rather than TCP, defaults to False

False
time
int

time in seconds to transmit for, defaults to 10

10
client_port
int | None

client port from where the traffic is getting started

None
udp_only
bool | None

to be used if protocol is UDP only, backward compatibility with iperf version 2

None

Returns:

Type Description
tuple[int, str]

the process id(pid) and log file path

Raises:

Type Description
CodeError

raises if unable to start server

Source code in boardfarm3/templates/wlan.py
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
@abstractmethod
def start_traffic_sender(  # pylint: disable=too-many-arguments  # noqa: PLR0913
    self,
    host: str,
    traffic_port: int,
    bandwidth: int | None = None,
    bind_to_ip: str | None = None,
    direction: str | None = None,
    ip_version: int | None = None,
    udp_protocol: bool = False,
    time: int = 10,
    client_port: int | None = None,
    udp_only: bool | None = None,
) -> tuple[int, str]:
    """Start traffic on a linux client using iperf3.

    :param host: a host to run in client mode
    :type host: str
    :param traffic_port: server port to connect to
    :type traffic_port: int
    :param bandwidth: bandwidth(mbps) at which the traffic
        has to be generated, defaults to None
    :type bandwidth: Optional[int], optional
    :param bind_to_ip: bind to the interface associated with
        the address host, defaults to None
    :type bind_to_ip: Optional[str], optional
    :param direction: `--reverse` to run in reverse mode
        (server sends, client receives) or `--bidir` to run in
        bidirectional mode, defaults to None
    :type direction: Optional[str], optional
    :param ip_version: 4 or 6 as it uses only IPv4 or IPv6, defaults to None
    :type ip_version: int, optional
    :param udp_protocol: use UDP rather than TCP, defaults to False
    :type udp_protocol: bool
    :param time: time in seconds to transmit for, defaults to 10
    :type time: int
    :param client_port: client port from where the traffic is getting started
    :type client_port: int | None
    :param udp_only: to be used if protocol is UDP only,
        backward compatibility with iperf version 2
    :type udp_only: bool, optional
    :raises CodeError: raises if unable to start server
    :return: the process id(pid) and log file path
    :rtype: tuple[int, str]
    """
    raise NotImplementedError

stop_tcpdump abstractmethod

stop_tcpdump(process_id: str) -> None

Stop tcpdump capture.

Parameters:

Name Type Description Default
process_id
str

tcpdump process id

required
Source code in boardfarm3/templates/wlan.py
742
743
744
745
746
747
748
749
@abstractmethod
def stop_tcpdump(self, process_id: str) -> None:
    """Stop tcpdump capture.

    :param process_id: tcpdump process id
    :type process_id: str
    """
    raise NotImplementedError

stop_traffic abstractmethod

stop_traffic(pid: int | None = None) -> bool

Stop the iPerf3 process for a specific PID or killall.

Parameters:

Name Type Description Default
pid
int | None

process ID for a iPerf3 service either for reciever or sender, defaults to None

None

Returns:

Type Description
bool

True if process is stopped else False

Source code in boardfarm3/templates/wlan.py
461
462
463
464
465
466
467
468
469
470
471
@abstractmethod
def stop_traffic(self, pid: int | None = None) -> bool:
    """Stop the iPerf3 process for a specific PID or killall.

    :param pid: process ID for a iPerf3 service either for reciever or sender,
        defaults to None
    :type pid: int | None
    :return: True if process is stopped else False
    :rtype: bool
    """
    raise NotImplementedError

tcpdump_capture abstractmethod

tcpdump_capture(
    fname: str, interface: str = "any", additional_args: str | None = None
) -> Generator[str]

Capture packets from specified interface.

Packet capture using tcpdump utility at a specified interface.

:yield: process id of tcpdump process

Parameters:

Name Type Description Default
fname
str

name of the file where packet captures will be stored

required
interface
str

name of the interface, defaults to "any"

'any'
additional_args
str | None

argument arguments to tcpdump executable

None
Source code in boardfarm3/templates/wlan.py
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
@contextmanager
@abstractmethod
def tcpdump_capture(
    self,
    fname: str,
    interface: str = "any",
    additional_args: str | None = None,
) -> Generator[str]:
    """Capture packets from specified interface.

    Packet capture using tcpdump utility at a specified interface.

    :param fname: name of the file where packet captures will be stored
    :param interface: name of the interface, defaults to "any"
    :param additional_args: argument arguments to tcpdump executable
    :yield: process id of tcpdump process
    """
    raise NotImplementedError

tshark_read_pcap abstractmethod

tshark_read_pcap(
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str

Read packet captures from an existing file.

Parameters:

Name Type Description Default
fname
str

name of the file in which captures are saved

required
additional_args
str | None

additional arguments for tshark command

None
timeout
int

time out for tshark command to be executed, defaults to 30

30
rm_pcap
bool

If True remove the packet capture file after reading it

False

Returns:

Type Description
str

return tshark read command console output

Source code in boardfarm3/templates/wlan.py
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
@abstractmethod
def tshark_read_pcap(
    self,
    fname: str,
    additional_args: str | None = None,
    timeout: int = 30,
    rm_pcap: bool = False,
) -> str:
    """Read packet captures from an existing file.

    :param fname: name of the file in which captures are saved
    :type fname: str
    :param additional_args: additional arguments for tshark command
    :type additional_args: str
    :param timeout: time out for tshark command to be executed, defaults to 30
    :type timeout: int
    :param rm_pcap: If True remove the packet capture file after reading it
    :type rm_pcap: bool
    :return: return tshark read command console output
    :rtype: str
    """
    raise NotImplementedError

wifi_client_connect abstractmethod

wifi_client_connect(
    ssid_name: str,
    password: str | None = None,
    security_mode: str | None = None,
    bssid: str | None = None,
) -> None

Scan for SSID and verify wifi connectivity.

Parameters:

Name Type Description Default
ssid_name
str

SSID name

required
password
str | None

wifi password, defaults to None

None
security_mode
str | None

Security mode for the wifi, defaults to None

None
bssid
str | None

BSSID of the desired network. Used to differentialte between 2.4/5 GHz networks with same SSID

None
Source code in boardfarm3/templates/wlan.py
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
@abstractmethod
def wifi_client_connect(
    self,
    ssid_name: str,
    password: str | None = None,
    security_mode: str | None = None,
    bssid: str | None = None,
) -> None:
    """Scan for SSID and verify wifi connectivity.

    :param ssid_name: SSID name
    :type ssid_name: str
    :param password: wifi password, defaults to None
    :type password: str, optional
    :param security_mode: Security mode for the wifi, defaults to None
    :type security_mode: str, optional
    :param bssid: BSSID of the desired network.
        Used to differentialte between 2.4/5 GHz networks with same SSID
    :type bssid: str, optional
    """
    raise NotImplementedError

wifi_disconnect abstractmethod

wifi_disconnect() -> None

Disconnect wifi connectivity.

Source code in boardfarm3/templates/wlan.py
237
238
239
240
@abstractmethod
def wifi_disconnect(self) -> None:
    """Disconnect wifi connectivity."""
    raise NotImplementedError