diff options
author | Steven Luong <sluong@cisco.com> | 2024-09-27 08:35:45 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-09-28 01:51:31 +0000 |
commit | 6f173171b1d5c4b10165a7d8603e4e6b9d07b7b4 (patch) | |
tree | cabebe82ce00d86f627d4b5c5ce4c9bfdca9d08d /test/asf | |
parent | 6b3b6072e078c999382e371d63bc6c8732394244 (diff) |
session: fix SDL to use remote instead local
The language is
local == VPP local interface
remote == sender prefix to VPP node
SDL acts on remote prefix.
Type: fix
Change-Id: I82917c6ef801fc67430dfdd15c5630cb7a6347e0
Signed-off-by: Steven Luong <sluong@cisco.com>
Diffstat (limited to 'test/asf')
-rw-r--r-- | test/asf/test_session_sdl.py | 43 | ||||
-rw-r--r-- | test/asf/vpp_session_sdl.py | 8 |
2 files changed, 25 insertions, 26 deletions
diff --git a/test/asf/test_session_sdl.py b/test/asf/test_session_sdl.py index 15d696350bc..c03dc83ba1e 100644 --- a/test/asf/test_session_sdl.py +++ b/test/asf/test_session_sdl.py @@ -63,8 +63,8 @@ class TestSessionSDL(VppTestCase): self.loop1.remove_vpp_config() super(TestSessionSDL, self).tearDown() - def create_rule(self, lcl, action_index, tag): - return SessionSdl(lcl=lcl, action_index=action_index, tag=tag) + def create_rule(self, rmt, action_index, tag): + return SessionSdl(rmt=rmt, action_index=action_index, tag=tag) def apply_rules(self, rules, is_add, appns_index): r = VppSessionSdl(self, rules, is_add=is_add, appns_index=appns_index) @@ -110,44 +110,44 @@ class TestSessionSDL(VppTestCase): ip_t01.add_vpp_config() ip_t10.add_vpp_config() - # Start builtin server for ip4 + # Start builtin server for ip4 on loop0 appns 0 self.logger.info(self.vapi.cli(server_cmd)) - # Add session filter to block loop0 + # Add session filter to block loop1 (client on loop1 appns 1) rules = [] rules.append( - self.create_rule(lcl=self.loop0.local_ip4 + "/32", action_index=0, tag="") + self.create_rule(rmt=self.loop1.local_ip4 + "/32", action_index=0, tag="") ) self.apply_rules(rules, is_add=1, appns_index=0) - filter = self.vapi.session_sdl_dump() - self.assertEqual(filter[0].lcl, IPv4Network(self.loop0.local_ip4 + "/32")) + filter = self.vapi.session_sdl_v2_dump() + self.assertEqual(filter[0].rmt, IPv4Network(self.loop1.local_ip4 + "/32")) # irrelevant rules - add 64k entries in one API call rules = [] for i in range(255): for j in range(255): prefix = "10.1.{0}.{1}/32".format(i, j) - rules.append(self.create_rule(lcl=prefix, action_index=0, tag="")) + rules.append(self.create_rule(rmt=prefix, action_index=0, tag="")) self.apply_rules(rules, is_add=1, appns_index=0) - error = self.vapi.cli_return_response(server_cmd) - # Expecting an error because loop0 is blocked + error = self.vapi.cli_return_response(client_cmd) + # Expecting an error because loop1 is blocked self.assertEqual(-1, error.retval) # Remove the session filter rules = [] rules.append( - self.create_rule(lcl=self.loop0.local_ip4 + "/32", action_index=0, tag="") + self.create_rule(rmt=self.loop1.local_ip4 + "/32", action_index=0, tag="") ) self.apply_rules(rules, is_add=0, appns_index=0) # Not expecting an error self.logger.info(self.vapi.cli(client_cmd)) - # Add a session filter not matching loop0 + # Add a session filter not matching loop1 rules = [] - rules.append(self.create_rule(lcl="172.100.1.0/24", action_index=0, tag="")) + rules.append(self.create_rule(rmt="172.100.1.0/24", action_index=0, tag="")) self.apply_rules(rules, is_add=1, appns_index=0) # Not expecting an error @@ -210,7 +210,7 @@ class TestSessionSDL(VppTestCase): ip_t01.add_vpp_config() ip_t10.add_vpp_config() - # Start builtin server for ip6 + # Start builtin server for ip6 on loop0 appns 0 self.logger.info(self.vapi.cli(server_cmd)) # case 1: No filter @@ -219,24 +219,23 @@ class TestSessionSDL(VppTestCase): self.logger.info(self.vapi.cli(client_cmd)) # case 2: filter to block - # Add session filter to block loop0 + # Add session filter to block loop1, client appns 1 rules = [] rules.append( - self.create_rule(lcl=self.loop0.local_ip6 + "/128", action_index=0, tag="") + self.create_rule(rmt=self.loop1.local_ip6 + "/128", action_index=0, tag="") ) self.apply_rules(rules, is_add=1, appns_index=0) - filter = self.vapi.session_sdl_dump() - self.assertEqual(filter[0].lcl, IPv6Network(self.loop0.local_ip6 + "/128")) + filter = self.vapi.session_sdl_v2_dump() + self.assertEqual(filter[0].rmt, IPv6Network(self.loop1.local_ip6 + "/128")) error = self.vapi.cli_return_response(client_cmd) - # Expecting an error because loop0 is blocked + # Expecting an error because loop1 is blocked self.assertEqual(-1, error.retval) - # case 3: remove to block - # Add session filter to block loop0 + # case 3: remove filter to unblock rules = [] rules.append( - self.create_rule(lcl=self.loop0.local_ip6 + "/128", action_index=0, tag="") + self.create_rule(rmt=self.loop1.local_ip6 + "/128", action_index=0, tag="") ) self.apply_rules(rules, is_add=0, appns_index=0) # Not expecting an error diff --git a/test/asf/vpp_session_sdl.py b/test/asf/vpp_session_sdl.py index b10c11d1e15..2bebbe6e49d 100644 --- a/test/asf/vpp_session_sdl.py +++ b/test/asf/vpp_session_sdl.py @@ -11,18 +11,18 @@ class SessionSdl: def __init__( self, - lcl, + rmt, action_index, tag, ): self.action_index = action_index - self.lcl = lcl + self.rmt = rmt self.tag = tag def encode(self): return { - "lcl": self.lcl, + "rmt": self.rmt, "action_index": self.action_index, "tag": self.tag, } @@ -53,7 +53,7 @@ class VppSessionSdl(VppObject): def add_vpp_config(self, expect_error=False): try: - reply = self._test.vapi.session_sdl_add_del( + reply = self._test.vapi.session_sdl_add_del_v2( is_add=self.is_add, appns_index=self.appns_index, count=self.count, |