X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FNATUtil.py;h=5d3d131c804a90212f8324563adb20afb52ab35c;hb=d07f6cae7f18c1513650d4cb690115d60201e704;hp=0116306e6c71e350fc176003a641d9283c06a7fb;hpb=f9abe8e4e17faf59ae72113f4f11960dcd57b7cc;p=csit.git diff --git a/resources/libraries/python/NATUtil.py b/resources/libraries/python/NATUtil.py index 0116306e6c..5d3d131c80 100644 --- a/resources/libraries/python/NATUtil.py +++ b/resources/libraries/python/NATUtil.py @@ -62,23 +62,17 @@ class NATUtil: pass @staticmethod - def enable_nat44_plugin( - node, inside_vrf=0, outside_vrf=0, users=0, user_memory=0, - sessions=0, session_memory=0, user_sessions=0, mode=u""): + def enable_nat44_ed_plugin( + node, inside_vrf=0, outside_vrf=0, sessions=0, session_memory=0, + mode=u""): """Enable NAT44 plugin. :param node: DUT node. :param inside_vrf: Inside VRF ID. :param outside_vrf: Outside VRF ID. - :param users: Maximum number of users. Used only in endpoint-independent - mode. - :param user_memory: User memory size - overwrite auto calculated hash - allocation parameter if non-zero. :param sessions: Maximum number of sessions. :param session_memory: Session memory size - overwrite auto calculated hash allocation parameter if non-zero. - :param user_sessions: Maximum number of sessions per user. Used only in - endpoint-independent mode. :param mode: NAT44 mode. Valid values: - endpoint-independent - endpoint-dependent @@ -88,24 +82,18 @@ class NATUtil: :type node: dict :type inside_vrf: str or int :type outside_vrf: str or int - :type users: str or int - :type user_memory: str or int :type sessions: str or int :type session_memory: str or int - :type user_sessions: str or int :type mode: str """ - cmd = u"nat44_plugin_enable_disable" + cmd = u"nat44_ed_plugin_enable_disable" err_msg = f"Failed to enable NAT44 plugin on the host {node[u'host']}!" args_in = dict( enable=True, inside_vrf=int(inside_vrf), outside_vrf=int(outside_vrf), - users=int(users), - user_memory=int(user_memory), sessions=int(sessions), session_memory=int(session_memory), - user_sessions=int(user_sessions), flags=getattr( Nat44ConfigFlags, f"NAT44_IS_{mode.replace(u'-', u'_').upper()}" @@ -289,7 +277,7 @@ class NATUtil: @staticmethod def get_nat44_sessions_number(node, proto): - """Get number of established NAT44 sessions from NAT44 mapping data. + """Get number of expected NAT44 sessions from NAT44 mapping data. This keyword uses output from a CLI command, so it can start failing when VPP changes the output format. @@ -298,17 +286,21 @@ class NATUtil: The current implementation supports both 2202 and post-2202 format. (The Gerrit number changing the output format is 34877.) - For TCP proto, the post-2202 format includes "timed out" - established sessions into its count of total sessions. + For TCP proto, the expected state after rampup is + some number of sessions in transitory state (VPP has seen the FINs), + and some number of sessions in established state (meaning + some FINs were lost in the last trial). + While the two states may need slightly different number of cycles + to process next packet, the current implementation considers + both of them the "fast path", so they are both counted as expected. + As the tests should fail if a session is timed-out, - the logic substracts timed out sessions for the resturned value. + the logic substracts timed out sessions for the returned value + (only available for post-2202 format). - The 2202 output reports most of TCP sessions as in "transitory" state, - as opposed to "established", but the previous CSIT logic tolerated that. - Ideally, whis keyword would add establised and transitory sessions - (but without CLOSED and WAIT_CLOSED sessions) and return that. - The current implementation simply returns "total tcp sessions" value, - to preserve the previous CSIT behavior for 2202 output. + TODO: Investigate if it is worth to insert additional rampup trials + in TPUT tests to ensure all sessions are transitory before next + measurement. :param node: DUT node. :param proto: Required protocol - TCP/UDP/ICMP. @@ -339,9 +331,7 @@ class NATUtil: found = True continue # Proto is found, find the line we are interested in. - if proto_l == u"tcp" and u"established" not in line: - continue - if u"total" not in line and u"established" not in line: + if u"total" not in line: raise RuntimeError(f"show nat summary: no {proto} total.") # We have the line with relevant numbers. total_part, timed_out_part = line.split(u"(", 1)