From 51d2651e4aceff4016228c669480437eac84f221 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Thu, 14 Sep 2017 18:26:36 +0200 Subject: acl-plugin: test: move the API calls to vpp_papi_provider.py Change-Id: I1d3818027b8a1fcb1ec12016e3476b5c22a2d5a5 Signed-off-by: Andrew Yourtchenko --- test/test_acl_plugin_conns.py | 52 +++++++++---------------------------------- 1 file changed, 10 insertions(+), 42 deletions(-) (limited to 'test/test_acl_plugin_conns.py') diff --git a/test/test_acl_plugin_conns.py b/test/test_acl_plugin_conns.py index 0d4aa09d5eb..43e8b69f930 100644 --- a/test/test_acl_plugin_conns.py +++ b/test/test_acl_plugin_conns.py @@ -79,30 +79,30 @@ class Conn(L4_Conn): r = [] r.append(pkt.to_acl_rule(2, wildcard_sport=True)) r.append(self.wildcard_rule(0)) - res = self.testcase.api_acl_add_replace(0xffffffff, r) + res = self.testcase.vapi.acl_add_replace(0xffffffff, r) self.testcase.assert_equal(res.retval, 0, "error adding ACL") reflect_acl_index = res.acl_index r = [] r.append(self.wildcard_rule(0)) - res = self.testcase.api_acl_add_replace(0xffffffff, r) + res = self.testcase.vapi.acl_add_replace(0xffffffff, r) self.testcase.assert_equal(res.retval, 0, "error adding deny ACL") deny_acl_index = res.acl_index if reflect_side == acl_side: - self.testcase.api_acl_interface_set_acl_list( - self.ifs[acl_side].sw_if_index, 2, 1, + self.testcase.vapi.acl_interface_set_acl_list( + self.ifs[acl_side].sw_if_index, 1, [reflect_acl_index, deny_acl_index]) - self.testcase.api_acl_interface_set_acl_list( - self.ifs[1-acl_side].sw_if_index, 0, 0, []) + self.testcase.vapi.acl_interface_set_acl_list( + self.ifs[1-acl_side].sw_if_index, 0, []) else: - self.testcase.api_acl_interface_set_acl_list( - self.ifs[acl_side].sw_if_index, 2, 1, + self.testcase.vapi.acl_interface_set_acl_list( + self.ifs[acl_side].sw_if_index, 1, [deny_acl_index, reflect_acl_index]) - self.testcase.api_acl_interface_set_acl_list( - self.ifs[1-acl_side].sw_if_index, 0, 0, []) + self.testcase.vapi.acl_interface_set_acl_list( + self.ifs[1-acl_side].sw_if_index, 0, []) def wildcard_rule(self, is_permit): any_addr = ["0.0.0.0", "::"] @@ -152,38 +152,6 @@ class ACLPluginConnTestCase(VppTestCase): self.logger.info(self.vapi.cli("show acl-plugin interface")) self.logger.info(self.vapi.cli("show acl-plugin tables")) - def api_acl_add_replace(self, acl_index, r, count=-1, tag="", - expected_retval=0): - """Add/replace an ACL - - :param int acl_index: ACL index to replace, 4294967295 to create new. - :param acl_rule r: ACL rules array. - :param str tag: symbolic tag (description) for this ACL. - :param int count: number of rules. - """ - if (count < 0): - count = len(r) - return self.vapi.api(self.vapi.papi.acl_add_replace, - {'acl_index': acl_index, - 'r': r, - 'count': count, - 'tag': tag - }, expected_retval=expected_retval) - - def api_acl_interface_set_acl_list(self, sw_if_index, count, n_input, acls, - expected_retval=0): - return self.vapi.api(self.vapi.papi.acl_interface_set_acl_list, - {'sw_if_index': sw_if_index, - 'count': count, - 'n_input': n_input, - 'acls': acls - }, expected_retval=expected_retval) - - def api_acl_dump(self, acl_index, expected_retval=0): - return self.vapi.api(self.vapi.papi.acl_dump, - {'acl_index': acl_index}, - expected_retval=expected_retval) - def run_basic_conn_test(self, af, acl_side): """ Basic conn timeout test """ conn1 = Conn(self, self.pg0, self.pg1, af, UDP, 42001, 4242) -- cgit 1.2.3-korg