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
console: BoardfarmPexpect
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
Execute AddOjbect RPC call for the specified parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
parameter to be used to add |
required |
|
str
|
the value to set the ParameterKey parameter, defaults to "" |
''
|
|
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 | |
DelObject
abstractmethod
Execute DeleteObject RPC call for the specified parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
parameter to be used to delete |
required |
|
str
|
the value to set the ParameterKey parameter, defaults to "" |
''
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
URL to download file |
required |
|
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'
|
|
str
|
TargetFileName to download through RPC |
''
|
|
int
|
the size of file to download in bytes |
200
|
|
str
|
User to authenticate with file Server. Default="" |
''
|
|
str
|
Password to authenticate with file Server. Default="" |
''
|
|
str
|
the string paramenter passed in Download API |
''
|
|
int
|
delay of seconds in integer |
10
|
|
str
|
URL to access in case of Download API execution succeeded |
''
|
|
str
|
URL to access in case of Download API execution Failed |
''
|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
GPA
abstractmethod
Execute GetParameterAttributes RPC call for the specified parameter.
Example usage:
acs_server.GPA("Device.WiFi.SSID.1.SSID")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
parameter to be used in get |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
parameter to be discovered |
required |
|
bool
|
displays the next level children of the object if marked true |
required |
|
int | None
|
Lifetime Expiry time |
None
|
|
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 | |
GPV
abstractmethod
Execute GetParameterValues RPC call for the specified parameter(s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
GpvInput
|
name of the parameter(s) to perform RPC |
required |
|
int | None
|
to set the Lifetime Expiry time, defaults to None |
None
|
|
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 | |
GetRPCMethods
abstractmethod
GetRPCMethods(cpe_id: str | None = None) -> list[dict]
Execute GetRPCMethods RPC.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
Reboot
abstractmethod
Reboot(CommandKey: str, cpe_id: str | None = None) -> list[dict]
Execute Reboot RPC.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
reboot command key |
required |
|
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 | |
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 |
|---|---|---|---|
|
list[dict] | dict
|
parameter as key of dictionary and notification as its value |
required |
|
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
|
|
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
|
|
list | None
|
Array of zero or more entities for which write access to the specified Parameter(s) is granted |
None
|
|
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 | |
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 |
|---|---|---|---|
|
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 |
|
int | None
|
wait time for the RPC to complete, defaults to None |
None
|
|
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 | |
ScheduleInform
abstractmethod
ScheduleInform(
CommandKey: str = "Test", DelaySeconds: int = 20, cpe_id: str | None = None
) -> list[dict]
Execute ScheduleInform RPC.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
string to return in the CommandKey element of the InformStruct when the CPE calls the Inform method, defaults to "Test" |
'Test'
|
|
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
|
|
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 | |
delete_file
abstractmethod
delete_file(filename: str) -> None
Delete the file from the device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
name of the file with absolute path |
required |
Source code in boardfarm3/templates/acs.py
353 354 355 356 357 358 359 360 | |
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 |
|---|---|---|---|
|
list[dict[str, list[dict[str, str]]]]
|
List of tr069 operations and their values |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
local file path |
required |
|
str
|
source path |
required |
Source code in boardfarm3/templates/acs.py
362 363 364 365 366 367 368 369 | |
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 |
|---|---|---|---|
|
str
|
inteface name where packets to be captured |
required |
|
str | None
|
port number, can be a range of ports(eg: 443 or 433-443) |
required |
|
str
|
pcap file name, Defaults: pkt_capture.pcap |
'pkt_capture.pcap'
|
|
dict | None
|
filters as key value pair(eg: {"-v": "", "-c": "4"}) |
None
|
|
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 | |
stop_tcpdump
abstractmethod
stop_tcpdump(process_id: str) -> None
Stop tcpdump capture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
tcpdump process id |
required |
Source code in boardfarm3/templates/acs.py
428 429 430 431 432 433 434 435 | |
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
WAN
|
WAN Device |
required |
Source code in boardfarm3/templates/aftr.py
11 12 13 14 15 16 17 18 | |
restart_aftr_process
abstractmethod
Restart aftr proess.
This is to ensure the ipv4 connectivity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
WAN
|
WAN Device |
required |
Source code in boardfarm3/templates/aftr.py
20 21 22 23 24 25 26 27 28 29 | |
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
console: BoardfarmPexpect
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 |
|---|---|---|---|
|
str
|
ip address of the destination |
required |
|
str
|
ip address of the hop |
required |
|
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 | |
delete_route
abstractmethod
delete_route(destination: str) -> None
Delete a route to a destination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
ip address of the destination |
required |
Source code in boardfarm3/templates/core_router.py
145 146 147 148 149 150 151 152 | |
get_interface_ipv4addr
abstractmethod
get_interface_ipv4addr(interface: str) -> str
Return ipv4 address of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_ipv6addr
abstractmethod
get_interface_ipv6addr(interface: str) -> str
Return ipv4 address of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
is_link_up
abstractmethod
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 | |
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 |
|---|---|---|---|
|
str
|
ip address on which nmap is performed |
required |
|
str
|
type of ip eg: ipv4/ipv6 |
required |
|
str | int | None
|
destination port on ip, defaults to None |
None
|
|
str | None
|
specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None |
None
|
|
int | None
|
number of port scan probe retransmissions, defaults to None |
None
|
|
int | None
|
Send packets no slower than per second, defaults to None |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
ping ip |
required |
|
int
|
number of ping, defaults to 4 |
4
|
|
str | None
|
ping via interface, defaults to None |
None
|
|
str
|
extra ping options, defaults to "" |
''
|
|
int
|
timeout, defaults to 50 |
50
|
|
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 | |
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
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 |
|---|---|---|---|
|
str
|
name of the device |
required |
Source code in boardfarm3/templates/cpe/cpe_hw.py
45 46 47 48 49 50 51 52 | |
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 | |
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 |
|---|---|---|---|
|
str
|
image name |
required |
|
dict[str, TFTP]
|
a list of LAN side TFTP devices |
required |
|
TerminationSystem
|
the termination system device (e.g. CMTS), defaults to None |
None
|
|
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 | |
get_console
abstractmethod
get_console(console_name: str) -> BoardfarmPexpect
Return console instance with the given name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
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 |
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 |
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.
erouter_iface
abstractmethod
property
erouter_iface: str
e-Router interface name.
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.
add_info_to_file
abstractmethod
Add data into a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
contents/data to be added to a file. |
required |
|
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 | |
enable_logs
abstractmethod
Enable logs for given component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
component name |
required |
|
str
|
flag name, Default: "enable" |
'enable'
|
Source code in boardfarm3/templates/cpe/cpe_sw.py
248 249 250 251 252 253 254 255 | |
factory_reset
abstractmethod
factory_reset(method: str | None = None) -> bool
Perform factory reset CPE via given method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
get_board_logs
abstractmethod
get_board_logs(timeout: int = 300) -> str
Return board console logs for given timeout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 | |
get_file_content
abstractmethod
Get the content of the given file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
name of the file with absolute path |
required |
|
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 | |
get_interface_ipv4addr
abstractmethod
get_interface_ipv4addr(interface: str) -> str
Return given interface IPv4 address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_ipv6addr
abstractmethod
get_interface_ipv6addr(interface: str) -> str
Return given interface IPv6 address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_link_local_ipv6_addr
abstractmethod
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 | |
get_interface_mac_addr
abstractmethod
get_interface_mac_addr(interface: str) -> str
Return given interface mac address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
get_provision_mode
abstractmethod
get_provision_mode() -> str
Return provision mode.
Source code in boardfarm3/templates/cpe/cpe_sw.py
117 118 119 120 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
is_link_up
abstractmethod
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 | |
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 | |
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 | |
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 | |
kill_process_immediately
abstractmethod
kill_process_immediately(pid: int) -> None
Kills any process based on the provided process ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
process number |
required |
Source code in boardfarm3/templates/cpe/cpe_sw.py
302 303 304 305 306 307 308 309 | |
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 |
Source code in boardfarm3/templates/cpe/cpe_sw.py
266 267 268 269 270 271 272 273 274 275 | |
reset
abstractmethod
reset(method: str | None = None) -> None
Perform reset via given method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | None
|
reset method. Default None |
None
|
Source code in boardfarm3/templates/cpe/cpe_sw.py
130 131 132 133 134 135 136 137 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
cpe
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 |
|---|---|---|---|
|
str
|
name of the device |
required |
Source code in boardfarm3/templates/cpe/cpe_hw.py
45 46 47 48 49 50 51 52 | |
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 | |
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 |
|---|---|---|---|
|
str
|
image name |
required |
|
dict[str, TFTP]
|
a list of LAN side TFTP devices |
required |
|
TerminationSystem
|
the termination system device (e.g. CMTS), defaults to None |
None
|
|
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 | |
get_console
abstractmethod
get_console(console_name: str) -> BoardfarmPexpect
Return console instance with the given name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
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 |
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 |
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.
erouter_iface
abstractmethod
property
erouter_iface: str
e-Router interface name.
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.
add_info_to_file
abstractmethod
Add data into a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
contents/data to be added to a file. |
required |
|
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 | |
enable_logs
abstractmethod
Enable logs for given component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
component name |
required |
|
str
|
flag name, Default: "enable" |
'enable'
|
Source code in boardfarm3/templates/cpe/cpe_sw.py
248 249 250 251 252 253 254 255 | |
factory_reset
abstractmethod
factory_reset(method: str | None = None) -> bool
Perform factory reset CPE via given method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
get_board_logs
abstractmethod
get_board_logs(timeout: int = 300) -> str
Return board console logs for given timeout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 | |
get_file_content
abstractmethod
Get the content of the given file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
name of the file with absolute path |
required |
|
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 | |
get_interface_ipv4addr
abstractmethod
get_interface_ipv4addr(interface: str) -> str
Return given interface IPv4 address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_ipv6addr
abstractmethod
get_interface_ipv6addr(interface: str) -> str
Return given interface IPv6 address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_link_local_ipv6_addr
abstractmethod
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 | |
get_interface_mac_addr
abstractmethod
get_interface_mac_addr(interface: str) -> str
Return given interface mac address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
get_provision_mode
abstractmethod
get_provision_mode() -> str
Return provision mode.
Source code in boardfarm3/templates/cpe/cpe_sw.py
117 118 119 120 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
is_link_up
abstractmethod
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 | |
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 | |
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 | |
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 | |
kill_process_immediately
abstractmethod
kill_process_immediately(pid: int) -> None
Kills any process based on the provided process ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
process number |
required |
Source code in boardfarm3/templates/cpe/cpe_sw.py
302 303 304 305 306 307 308 309 | |
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 |
Source code in boardfarm3/templates/cpe/cpe_sw.py
266 267 268 269 270 271 272 273 274 275 | |
reset
abstractmethod
reset(method: str | None = None) -> None
Perform reset via given method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | None
|
reset method. Default None |
None
|
Source code in boardfarm3/templates/cpe/cpe_sw.py
130 131 132 133 134 135 136 137 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 |
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
console: BoardfarmPexpect
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 entry in hosts file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
host ip addr |
required |
|
str
|
host name to be added |
required |
Source code in boardfarm3/templates/lan.py
855 856 857 858 859 860 861 862 863 864 | |
create_upnp_rule
abstractmethod
Create UPnP rule on the device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
internal port for UPnP |
required |
|
str
|
external port for UPnP |
required |
|
str
|
protocol to be used |
required |
|
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 | |
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 | |
del_default_route
abstractmethod
del_default_route(interface: str | None = None) -> None
Remove the default gateway.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | None
|
interface name, default to None |
None
|
Source code in boardfarm3/templates/lan.py
483 484 485 486 487 488 489 490 | |
delete_arp_table_entry
abstractmethod
Delete ARP table output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
ip of the host entry to be deleted |
required |
|
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 | |
delete_file
abstractmethod
delete_file(filename: str) -> None
Delete the file from the device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
name of the file with absolute path |
required |
Source code in boardfarm3/templates/lan.py
599 600 601 602 603 604 605 606 | |
delete_hosts_entry
abstractmethod
Delete entry in hosts file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
host name to be deleted |
required |
|
str
|
host ip addr |
required |
Source code in boardfarm3/templates/lan.py
866 867 868 869 870 871 872 873 874 875 | |
delete_upnp_rule
abstractmethod
Delete UPnP rule on the device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
external port for UPnP |
required |
|
str
|
protocol to be used |
required |
|
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 | |
disable_ipv6
abstractmethod
disable_ipv6() -> None
Disable IPv6 on the connected client interface.
Source code in boardfarm3/templates/lan.py
545 546 547 548 | |
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 |
|---|---|---|---|
|
str
|
domain name which needs lookup |
required |
|
str
|
AAAA for IPv6 else A |
required |
|
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 | |
enable_ipv6
abstractmethod
enable_ipv6() -> None
Enable IPv6 on the connected client interface.
Source code in boardfarm3/templates/lan.py
540 541 542 543 | |
flush_arp_cache
abstractmethod
flush_arp_cache() -> None
Flushes arp cache entries.
Source code in boardfarm3/templates/lan.py
877 878 879 880 | |
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 | |
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 | |
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 | |
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 | |
get_interface_ipv4addr
abstractmethod
get_interface_ipv4addr(interface: str) -> str
Get IPv4 address of interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_ipv6addr
abstractmethod
get_interface_ipv6addr(interface: str) -> str
Get IPv6 address of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_link_local_ipv6addr
abstractmethod
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 | |
get_interface_macaddr
abstractmethod
get_interface_macaddr(interface: str) -> str
Get the interface MAC address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_mask
abstractmethod
get_interface_mask(interface: str) -> str
Get the subnet mask of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
get_iperf_logs
abstractmethod
get_iperf_logs(log_file: str) -> str
Read the file output for traffic flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
str
|
mode, for ex 'S': syn-flood '1': ping-flood (icmp) '2': udp |
required |
|
str
|
target IP addr |
required |
|
str
|
number of packets to be transmitted. |
required |
|
str | None
|
extra arguments to be passed, defaults to None |
None
|
|
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 | |
http_get
abstractmethod
http_get(url: str, timeout: int, options: str) -> HTTPResult
Peform HTTP Get and return parsed result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
URL to get the response |
required |
|
int
|
connection timeout for the curl command in seconds |
required |
|
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 | |
is_link_up
abstractmethod
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 | |
kill_process
abstractmethod
kill_process(pid: int, signal: int) -> None
Kill the running process based on the process id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
process id |
required |
Source code in boardfarm3/templates/lan.py
949 950 951 952 953 954 955 956 957 958 | |
netcat
abstractmethod
netcat(host_ip: str, port: str, additional_args: str) -> None
Run netcat command to initiate brute force.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
host ip address |
required |
|
str
|
port number of the host |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
IP address on which nmap is performed |
required |
|
str
|
type of IP eg: IPv4/IPv6 |
required |
|
str | int | None
|
destination port on IP, defaults to None |
None
|
|
str | None
|
specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None |
None
|
|
int | None
|
number of port scan probe retransmissions, defaults to None |
None
|
|
int | None
|
send packets no slower than per second, defaults to None |
None
|
|
str | None
|
other options for a nmap command, defaults to None |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
ping IP |
required |
|
int
|
number of ping, defaults to 4 |
4
|
|
str | None
|
ping via interface, defaults to None |
None
|
|
str
|
extra ping options, defaults to "" |
''
|
|
int
|
timeout, defaults to 50 |
50
|
|
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 | |
release_dhcp
abstractmethod
release_dhcp(interface: str) -> None
Release IPv4 of the specified interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
interface name |
required |
Source code in boardfarm3/templates/lan.py
278 279 280 281 282 283 284 285 | |
release_ipv6
abstractmethod
Release IPv6 of the specified interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
interface name |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
interface name |
required |
Source code in boardfarm3/templates/lan.py
287 288 289 290 291 292 293 294 | |
renew_ipv6
abstractmethod
Renew IPv6 of the specified interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
interface name |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
local file path |
required |
|
str
|
source path |
required |
Source code in boardfarm3/templates/lan.py
608 609 610 611 612 613 614 615 | |
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 |
|---|---|---|---|
|
MulticastGroupRecord
|
MLDv2 multicast group record |
required |
|
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 | |
set_date
abstractmethod
set_date(opt: str, date_string: str) -> bool
Set the device's date and time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
value to be changed |
required |
|
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 | |
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 |
|---|---|---|---|
|
IPv4Address
|
gateway IP address |
required |
|
str
|
interface name |
required |
Source code in boardfarm3/templates/lan.py
492 493 494 495 496 497 498 499 500 501 | |
set_link_state
abstractmethod
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 | |
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 |
|---|---|---|---|
|
str
|
interface name |
required |
|
IPv4Address
|
static IP address |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
port number |
required |
|
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 | |
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 |
|---|---|---|---|
|
str | IPv4Address | None
|
WAN gateway IP to setup fixed route in case lan_fixed_route_to_wan option is provided |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str | IPv4Address | None
|
WAN gateway IP to setup fixed route in case lan_fixed_route_to_wan option is provided |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
interface ip addr |
required |
|
bool
|
flag if ipv6 addr to be used |
required |
|
str
|
any extra arguments |
required |
|
str
|
target port range |
required |
|
str
|
the number of times to target each host |
required |
|
str
|
num of packets per second to send |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
inteface name where packets to be captured |
required |
|
str | None
|
port number, can be a range of ports(eg: 443 or 433-443) |
required |
|
str
|
pcap file name, Defaults: pkt_capture.pcap |
'pkt_capture.pcap'
|
|
dict | None
|
filters as key value pair(eg: {"-v": "", "-c": "4"}) |
None
|
|
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 | |
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 |
|---|---|---|---|
|
int
|
server port to listen on |
required |
|
str | None
|
bind to the interface associated with the address host, defaults to None |
None
|
|
int | None
|
4 or 6 as it uses only IPv4 or IPv6, defaults to None |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
a host to run in client mode |
required |
|
int
|
server port to connect to |
required |
|
int | None
|
bandwidth(mbps) at which the traffic has to be generated, defaults to None |
None
|
|
str | None
|
bind to the interface associated with the address host, defaults to None |
None
|
|
str | None
|
|
None
|
|
int | None
|
4 or 6 as it uses only IPv4 or IPv6, defaults to None |
None
|
|
bool
|
use UDP rather than TCP, defaults to False |
False
|
|
int
|
time in seconds to transmit for, defaults to 10 |
10
|
|
int | None
|
client port from where the traffic is getting started |
None
|
|
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 | |
stop_http_service
abstractmethod
stop_http_service(port: str) -> None
Stop HTTP service running on given port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
port number |
required |
Source code in boardfarm3/templates/lan.py
424 425 426 427 428 429 430 431 | |
stop_nping
abstractmethod
stop_nping(process_id: str) -> None
Stop nping process running in background.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
stop_tcpdump
abstractmethod
stop_tcpdump(process_id: str) -> None
Stop tcpdump capture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
tcpdump process id |
required |
Source code in boardfarm3/templates/lan.py
909 910 911 912 913 914 915 916 | |
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 |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file where packet captures will be stored |
required |
|
str
|
name of the interface, defaults to "any" |
'any'
|
|
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 | |
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 |
|---|---|---|---|
|
str | IPv4Address
|
destination IP address |
required |
|
str
|
4 or 6 |
''
|
|
str
|
traceroute command options |
''
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file in which captures are saved |
required |
|
str | None
|
additional arguments for tshark command |
None
|
|
int
|
time out for tshark command to be executed, defaults to 30 |
30
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file in which captures are saved |
required |
|
str | None
|
additional arguments for tshark command |
None
|
|
int
|
time out for tshark command to be executed, defaults to 30 |
30
|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
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 |
|---|---|---|---|
|
dict
|
device configuration |
required |
|
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 | |
config
property
config: dict
Get device configuration.
Returns:
| Type | Description |
|---|---|
dict
|
device configuration |
console
abstractmethod
property
console: BoardfarmPexpect
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 |
|---|---|---|---|
|
str
|
name of the file with absolute path |
required |
Source code in boardfarm3/templates/provisioner.py
130 131 132 133 134 135 136 137 | |
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 | |
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 |
|---|---|---|---|
|
str
|
CPE mac address |
required |
|
dict[DHCPServicePools, DHCPv4Options]
|
DHCPv4 Options with ACS, NTP, DNS details |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
local file path |
required |
|
str
|
source path |
required |
Source code in boardfarm3/templates/provisioner.py
121 122 123 124 125 126 127 128 | |
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 |
|---|---|---|---|
|
str
|
inteface name where packets to be captured |
required |
|
str | None
|
port number, can be a range of ports(eg: 443 or 433-443) |
required |
|
str
|
pcap file name, Defaults: pkt_capture.pcap |
'pkt_capture.pcap'
|
|
dict | None
|
filters as key value pair(eg: {"-v": "", "-c": "4"}) |
None
|
|
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 | |
stop_tcpdump
abstractmethod
stop_tcpdump(process_id: str) -> None
Stop tcpdump capture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
tcpdump process id |
required |
Source code in boardfarm3/templates/provisioner.py
166 167 168 169 170 171 172 173 | |
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 |
|---|---|---|---|
|
str
|
name of the file in which captures are saved |
required |
|
str | None
|
additional arguments for tshark command |
None
|
|
int
|
timeout for tshark command to be executed, defaults to 30 |
30
|
|
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 | |
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 | |
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 | |
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 | |
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 |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 |
|---|---|---|---|
|
bool
|
dicatates whether to use ipv6 address or not |
required |
|
str
|
the sip server, defaults to "" |
''
|
Source code in boardfarm3/templates/sip_phone.py
63 64 65 66 67 68 69 70 71 72 | |
phone_kill
abstractmethod
phone_kill() -> None
Close the serial connection.
Source code in boardfarm3/templates/sip_phone.py
75 76 77 78 | |
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 | |
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 | |
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 | |
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 | |
press_buttons
abstractmethod
press_buttons(buttons: str) -> None
Press the given sequence of buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 to the directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
the user entry to be added |
required |
|
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 | |
allocate_number
abstractmethod
allocate_number(number: Optional[str] = None) -> str
Allocate a number from the sipserver number list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
delete_file
abstractmethod
delete_file(filename: str) -> None
Delete the file from the device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
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 | |
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 |
|---|---|---|---|
|
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 | |
remove_endpoint
abstractmethod
remove_endpoint(endpoint: str) -> None
Remove an endpoint from the directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
remove_endpoint_from_sipserver
remove_endpoint_from_sipserver(endpoint: str) -> None
Remove an endpoint from the directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 |
|---|---|---|---|
|
str
|
local file path |
required |
|
str
|
source path |
required |
Source code in boardfarm3/templates/sip_server.py
345 346 347 348 349 350 351 352 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
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 | |
sipserver_user_add
Add user to the directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
the user entry to be added |
required |
|
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 | |
start
abstractmethod
start() -> None
Start the server.
Source code in boardfarm3/templates/sip_server.py
72 73 74 75 | |
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file where packet captures will be stored |
required |
|
str
|
name of the interface, defaults to "any" |
'any'
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file in which captures are saved |
required |
|
Optional[str]
|
additional arguments for tshark, defaults to None |
None
|
|
int
|
timeout for tshark command to be executed, defaults to 30 |
30
|
|
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 | |
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 |
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 |
|---|---|---|---|
|
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 | |
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 | |
restart_lighttpd
abstractmethod
restart_lighttpd() -> None
Restart lighttpd service.
Source code in boardfarm3/templates/tftp.py
29 30 31 32 | |
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 |
|---|---|---|---|
|
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 | |
stop_lighttpd
abstractmethod
stop_lighttpd() -> None
Stop the lighttpd service.
Source code in boardfarm3/templates/tftp.py
34 35 36 37 | |
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 |
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
console: BoardfarmPexpect
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 |
|---|---|---|---|
|
str
|
ip address of the destination |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
local file path |
required |
Source code in boardfarm3/templates/wan.py
108 109 110 111 112 113 114 | |
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 | |
delete_file
abstractmethod
delete_file(filename: str) -> None
Delete the file from the device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
name of the file with absolute path |
required |
Source code in boardfarm3/templates/wan.py
465 466 467 468 469 470 471 472 | |
delete_route
abstractmethod
delete_route(destination: str) -> None
Delete a route to a destination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
ip address of the destination |
required |
Source code in boardfarm3/templates/wan.py
456 457 458 459 460 461 462 463 | |
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 |
|---|---|---|---|
|
str
|
domain name which needs lookup |
required |
|
str
|
AAAA for ipv6 else A |
required |
|
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 | |
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 |
|---|---|---|---|
|
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 | |
execute_snmp_command
abstractmethod
execute_snmp_command(snmp_command: str, timeout: int = 30) -> str
Execute SNMP command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
snmp command |
required |
|
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 | |
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 | |
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
get_interface_ipv4addr
abstractmethod
get_interface_ipv4addr(interface: str) -> str
Return ipv4 address of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_ipv6addr
abstractmethod
get_interface_ipv6addr(interface: str) -> str
Return ipv4 address of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_macaddr
abstractmethod
get_interface_macaddr(interface: str) -> str
Get the interface MAC address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_mask
abstractmethod
get_interface_mask(interface: str) -> str
Get the subnet mask of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
get_iperf_logs
abstractmethod
get_iperf_logs(log_file: str) -> str
Read the file output for traffic flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 | |
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 |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
str
|
mode, for ex 'S': syn-flood '1': ping-flood (icmp) '2': udp |
required |
|
str
|
target IP addr |
required |
|
str
|
number of packets to be transmitted. |
required |
|
str | None
|
extra arguments to be passed, defaults to None |
None
|
|
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 | |
http_get
abstractmethod
http_get(url: str, timeout: int, options: str) -> HTTPResult
Peform http get and return parsed result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
url to get the response |
required |
|
int
|
connection timeout for the curl command in seconds |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
username of the cpe |
required |
|
str | None
|
password to connect |
required |
|
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 | |
is_link_up
abstractmethod
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 | |
kill_process
abstractmethod
kill_process(pid: int, signal: int) -> None
Kill the running process based on the process id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
process id |
required |
Source code in boardfarm3/templates/wan.py
739 740 741 742 743 744 745 746 747 748 | |
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 |
|---|---|---|---|
|
str
|
ip address on which nmap is performed |
required |
|
str
|
type of ip eg: ipv4/ipv6 |
required |
|
str | int | None
|
destination port on ip, defaults to None |
None
|
|
str | None
|
specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None |
None
|
|
int | None
|
number of port scan probe retransmissions, defaults to None |
None
|
|
int | None
|
Send packets no slower than per second, defaults to None |
None
|
|
str | None
|
other options for a nmap command, defaults to None |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
ping ip |
required |
|
int
|
number of ping, defaults to 4 |
4
|
|
str | None
|
ping via interface, defaults to None |
None
|
|
str
|
extra ping options, defaults to "" |
''
|
|
int
|
timeout, defaults to 50 |
50
|
|
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 | |
release_dhcp
abstractmethod
release_dhcp(interface: str) -> None
Release IPv4 of the specified interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
interface name |
required |
Source code in boardfarm3/templates/wan.py
618 619 620 621 622 623 624 625 | |
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 |
|---|---|---|---|
|
str
|
local file path |
required |
|
str
|
source path |
required |
Source code in boardfarm3/templates/wan.py
474 475 476 477 478 479 480 481 | |
set_date
abstractmethod
set_date(opt: str, date_string: str) -> bool
Set the device's date and time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
value to be changed |
required |
|
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 | |
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 |
|---|---|---|---|
|
IPv4Address
|
gateway IP address |
required |
|
str
|
interface name |
required |
Source code in boardfarm3/templates/wan.py
645 646 647 648 649 650 651 652 653 654 | |
set_link_state
abstractmethod
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 | |
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 |
|---|---|---|---|
|
str
|
interface name |
required |
|
IPv4Address
|
static IP address |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
port number |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
inteface name where packets to be captured |
required |
|
str | None
|
port number, can be a range of ports(eg: 443 or 433-443) |
required |
|
str
|
pcap file name, Defaults: pkt_capture.pcap |
'pkt_capture.pcap'
|
|
dict | None
|
filters as key value pair(eg: {"-v": "", "-c": "4"}) |
None
|
|
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 | |
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 |
|---|---|---|---|
|
int
|
server port to listen on |
required |
|
str | None
|
bind to the interface associated with the address host, defaults to None |
None
|
|
int | None
|
4 or 6 as it uses only IPv4 or IPv6, defaults to None |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
a host to run in client mode |
required |
|
int
|
server port to connect to |
required |
|
int | None
|
bandwidth(mbps) at which the traffic has to be generated, defaults to None |
None
|
|
str | None
|
bind to the interface associated with the address host, defaults to None |
None
|
|
str | None
|
|
None
|
|
int | None
|
4 or 6 as it uses only IPv4 or IPv6, defaults to None |
None
|
|
bool
|
use UDP rather than TCP, defaults to False |
False
|
|
int
|
time in seconds to transmit for, defaults to 10 |
10
|
|
int | None
|
client port from where the traffic is getting started |
None
|
|
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 | |
stop_http_service
abstractmethod
stop_http_service(port: str) -> None
Stop http service running on given port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
port number |
required |
Source code in boardfarm3/templates/wan.py
243 244 245 246 247 248 249 | |
stop_tcpdump
abstractmethod
stop_tcpdump(process_id: str) -> None
Stop tcpdump capture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
tcpdump process id |
required |
Source code in boardfarm3/templates/wan.py
719 720 721 722 723 724 725 726 | |
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 |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file where packet captures will be stored |
required |
|
str
|
name of the interface, defaults to "any" |
'any'
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file in which captures are saved |
required |
|
str | None
|
additional arguments for tshark command |
None
|
|
int
|
time out for tshark command to be executed, defaults to 30 |
30
|
|
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 | |
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
console: BoardfarmPexpect
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 |
|---|---|---|---|
|
str
|
region to be set |
required |
Source code in boardfarm3/templates/wlan.py
219 220 221 222 223 224 225 226 | |
delete_file
abstractmethod
delete_file(filename: str) -> None
Delete the file from the device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
name of the file with absolute path |
required |
Source code in boardfarm3/templates/wlan.py
370 371 372 373 374 375 376 377 | |
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 | |
disable_ipv6
abstractmethod
disable_ipv6() -> None
Disable ipv6 on the connected client interface.
Source code in boardfarm3/templates/wlan.py
332 333 334 335 | |
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 | |
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 | |
disconnect_wpa
abstractmethod
disconnect_wpa() -> None
Disconnect the wpa supplicant initialisation.
Source code in boardfarm3/templates/wlan.py
242 243 244 245 | |
enable_ipv6
abstractmethod
enable_ipv6() -> None
Enable ipv6 on the connected client interface.
Source code in boardfarm3/templates/wlan.py
327 328 329 330 | |
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 | |
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 | |
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 | |
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 | |
get_interface_ipv4addr
abstractmethod
get_interface_ipv4addr(interface: str) -> str
Return ipv4 address of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_ipv6addr
abstractmethod
get_interface_ipv6addr(interface: str) -> str
Return ipv4 address of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_macaddr
abstractmethod
get_interface_macaddr(interface: str) -> str
Get the interface MAC address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
get_interface_mask
abstractmethod
get_interface_mask(interface: str) -> str
Get the subnet mask of the interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
get_iperf_logs
abstractmethod
get_iperf_logs(log_file: str) -> str
Read the file output for traffic flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
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 | |
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 | |
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 | |
iwlist_supported_channels
abstractmethod
iwlist_supported_channels(wifi_band: str) -> list[str]
List of wifi client support channels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
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 | |
kill_process
abstractmethod
kill_process(pid: int, signal: int) -> None
Kill the running process based on the process id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
process id |
required |
Source code in boardfarm3/templates/wlan.py
704 705 706 707 708 709 710 711 712 713 | |
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 | |
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 |
|---|---|---|---|
|
str
|
ip address on which nmap is performed |
required |
|
str
|
type of ip eg: ipv4/ipv6 |
required |
|
str | int | None
|
destination port on ip, defaults to None |
None
|
|
str | None
|
specific protocol to follow eg: tcp(-sT)/udp(-sU), defaults to None |
None
|
|
int | None
|
number of port scan probe retransmissions, defaults to None |
None
|
|
int | None
|
Send packets no slower than per second, defaults to None |
None
|
|
str | None
|
other options for a nmap command, defaults to None |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
ping IP |
required |
|
int
|
number of ping, defaults to 4 |
4
|
|
str | None
|
ping via interface, defaults to None |
None
|
|
str
|
extra ping options, defaults to "" |
''
|
|
int
|
timeout, defaults to 50 |
50
|
|
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 | |
release_dhcp
abstractmethod
release_dhcp(interface: str) -> None
Release IPv4 of the specified interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
interface name |
required |
Source code in boardfarm3/templates/wlan.py
596 597 598 599 600 601 602 603 | |
release_ipv6
abstractmethod
Release IPv6 of the specified interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
interface name |
required |
|
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 | |
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 |
|---|---|---|---|
|
str
|
interface name |
required |
Source code in boardfarm3/templates/wlan.py
605 606 607 608 609 610 611 612 | |
renew_ipv6
abstractmethod
Renew IPv6 of the specified interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
interface name |
required |
|
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 | |
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 | |
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 |
|---|---|---|---|
|
str
|
local file path |
required |
|
str
|
source path |
required |
Source code in boardfarm3/templates/wlan.py
379 380 381 382 383 384 385 386 | |
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 |
|---|---|---|---|
|
MulticastGroupRecord
|
MLDv2 multicast group record |
required |
|
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 | |
set_date
abstractmethod
set_date(opt: str, date_string: str) -> bool
Set the device's date and time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
value to be changed |
required |
|
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 | |
set_link_state
abstractmethod
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 | |
set_wlan_scan_channel
abstractmethod
set_wlan_scan_channel(channel: str) -> None
Change wifi client scan channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
wifi channel |
required |
Source code in boardfarm3/templates/wlan.py
167 168 169 170 171 172 173 174 | |
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 | |
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 | |
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 |
|---|---|---|---|
|
str
|
inteface name where packets to be captured |
required |
|
str | None
|
port number, can be a range of ports(eg: 443 or 433-443) |
required |
|
str
|
pcap file name, Defaults: pkt_capture.pcap |
'pkt_capture.pcap'
|
|
dict | None
|
filters as key value pair(eg: {"-v": "", "-c": "4"}) |
None
|
|
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 | |
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 |
|---|---|---|---|
|
int
|
server port to listen on |
required |
|
str | None
|
bind to the interface associated with the address host, defaults to None |
None
|
|
int | None
|
4 or 6 as it uses only IPv4 or IPv6, defaults to None |
None
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
a host to run in client mode |
required |
|
int
|
server port to connect to |
required |
|
int | None
|
bandwidth(mbps) at which the traffic has to be generated, defaults to None |
None
|
|
str | None
|
bind to the interface associated with the address host, defaults to None |
None
|
|
str | None
|
|
None
|
|
int | None
|
4 or 6 as it uses only IPv4 or IPv6, defaults to None |
None
|
|
bool
|
use UDP rather than TCP, defaults to False |
False
|
|
int
|
time in seconds to transmit for, defaults to 10 |
10
|
|
int | None
|
client port from where the traffic is getting started |
None
|
|
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 | |
stop_tcpdump
abstractmethod
stop_tcpdump(process_id: str) -> None
Stop tcpdump capture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
tcpdump process id |
required |
Source code in boardfarm3/templates/wlan.py
742 743 744 745 746 747 748 749 | |
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 |
|---|---|---|---|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file where packet captures will be stored |
required |
|
str
|
name of the interface, defaults to "any" |
'any'
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
name of the file in which captures are saved |
required |
|
str | None
|
additional arguments for tshark command |
None
|
|
int
|
time out for tshark command to be executed, defaults to 30 |
30
|
|
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 | |
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 |
|---|---|---|---|
|
str
|
SSID name |
required |
|
str | None
|
wifi password, defaults to None |
None
|
|
str | None
|
Security mode for the wifi, defaults to None |
None
|
|
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 | |
wifi_disconnect
abstractmethod
wifi_disconnect() -> None
Disconnect wifi connectivity.
Source code in boardfarm3/templates/wlan.py
237 238 239 240 | |