2.149. test_wireguard module

Wg tests

class test_wireguard.TestWg(methodName='runTest')

Bases: framework.VppTestCase

Wireguard Test Case

error_str = re.compile('Error')
classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

classmethod tearDownClass()

Perform final cleanup after running all tests in this test-case

test_handshake_hash()

test hashing an init message

test_wg_interface()

Simple interface creation

test_wg_multi_peer()

multiple peer setup

test_wg_peer_init()

Send handshake init

test_wg_peer_resp()

Send handshake response

class test_wireguard.VppWgInterface(test, src, port)

Bases: vpp_interface.VppInterface

VPP WireGuard interface

add_vpp_config()
object_id()
private_key_bytes()
public_key_bytes()
query_vpp_config()
remove_vpp_config()
class test_wireguard.VppWgPeer(test, itf, endpoint, port, allowed_ips, persistent_keepalive=15)

Bases: vpp_object.VppObject

add_vpp_config()

Add the configuration for this object to vpp.

consume_init(p, tx_itf)
consume_response(p)
decrypt_transport(p)
encrypt_transport(p)
mk_handshake(tx_itf, public_key=None)
mk_tunnel_header(tx_itf)
noise_init(public_key=None)
object_id()

Return a unique string representing this object.

public_key_bytes()
query_vpp_config()

Query the vpp configuration.

Returns

True if the object is configured

remove_vpp_config()

Remove the configuration for this object from vpp.

set_responder()
validate_encapped(rxs, tx)
validate_no_routing()
validate_routing()
verify_header(p)
class test_wireguard.WireguardHandoffTests(methodName='runTest')

Bases: test_wireguard.TestWg

Wireguard Tests in multi worker setup

test_wg_peer_init()

Handoff

vpp_worker_count = 2
test_wireguard.find_route(test, prefix, table_id=0)
test_wireguard.private_key_bytes(k)
test_wireguard.public_key_bytes(k)