test framework: add factory function and default parameters

This is the first step to be able to remove all the API message
wrappers in vpp_papi_provider.py. This allows to remove all
functions that do not override parameters (different from zero),
and a separate dictionary for messages requiring different defaults.

The general requirement is that all new tests should use named
arguments directly. Not positional arguments through the wrapper.

Note when removing functions, the calls in vpp_papi_provider
wrappers do not necessarily follow message order.

Change-Id: If64916c07f8622c138db3a9d7c4a98b93a058e68
Signed-off-by: Ole Troan <ot@cisco.com>
This commit is contained in:
Ole Troan
2019-02-28 20:20:47 +01:00
committed by Paul Vinciguerra
parent 84b83776d3
commit f159f58dbf
5 changed files with 61 additions and 89 deletions

View File

@ -95,7 +95,8 @@ class TestSyslog(VppTestCase):
def test_syslog(self):
""" Syslog Protocol test """
self.vapi.syslog_set_sender(self.pg0.remote_ip4n, self.pg0.local_ip4n)
self.vapi.syslog_set_sender(src_address=self.pg0.local_ip4n,
collector_address=self.pg0.remote_ip4n)
config = self.vapi.syslog_get_sender()
self.assertEqual(str(config.collector_address),
self.pg0.remote_ip4)
@ -167,8 +168,8 @@ class TestSyslog(VppTestCase):
sd1,
msg)
self.vapi.syslog_set_sender(self.pg0.remote_ip4n,
self.pg0.local_ip4n,
self.vapi.syslog_set_sender(self.pg0.local_ip4n,
self.pg0.remote_ip4n,
collector_port=12345)
config = self.vapi.syslog_get_sender()
self.assertEqual(config.collector_port, 12345)