X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FTestConfig.py;h=3a00afbf279d62a6247bd96cbc716e0e5e8f4e8e;hb=5302eeabb757ccf710568a66b8f6435c1894cd4d;hp=28778b2c3105c93a6925f9b1f8019f65763de4da;hpb=6ae8614cf1459f977508f9f4ba3548ac0a16b231;p=csit.git diff --git a/resources/libraries/python/TestConfig.py b/resources/libraries/python/TestConfig.py index 28778b2c31..3a00afbf27 100644 --- a/resources/libraries/python/TestConfig.py +++ b/resources/libraries/python/TestConfig.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -19,6 +19,7 @@ from robot.api import logger from resources.libraries.python.Constants import Constants from resources.libraries.python.InterfaceUtil import InterfaceUtil, \ InterfaceStatusFlags +from resources.libraries.python.IPAddress import IPAddress from resources.libraries.python.IPUtil import IPUtil from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.topology import Topology @@ -155,10 +156,9 @@ class TestConfig: del_all=False, prefix=None ) - cmd2 = u"vxlan_add_del_tunnel" + cmd2 = u"vxlan_add_del_tunnel_v3" args2 = dict( - is_add=1, - is_ipv6=0, + is_add=True, instance=Constants.BITWISE_NON_ZERO, src_address=None, dst_address=None, @@ -174,7 +174,7 @@ class TestConfig: vlan_id=None ) - with PapiSocketExecutor(node) as papi_exec: + with PapiSocketExecutor(node, is_async=True) as papi_exec: for i in range(0, vxlan_count): try: src_ip = src_ip_start + i * ip_step @@ -189,14 +189,18 @@ class TestConfig: args1[u"prefix"] = IPUtil.create_prefix_object( src_ip, 128 if src_ip_start.version == 6 else 32 ) - args2[u"src_address"] = getattr(src_ip, u"packed") - args2[u"dst_address"] = getattr(dst_ip, u"packed") + args2[u"src_address"] = IPAddress.create_ip_address_object( + src_ip + ) + args2[u"dst_address"] = IPAddress.create_ip_address_object( + dst_ip + ) args2[u"vni"] = int(vni_start) + i args3[u"vlan_id"] = i + 1 history = bool(not 1 < i < vxlan_count - 1) - papi_exec.add(cmd1, history=history, **args1).\ - add(cmd2, history=history, **args2).\ - add(cmd3, history=history, **args3) + papi_exec.add(cmd1, history=history, **args1) + papi_exec.add(cmd2, history=history, **args2) + papi_exec.add(cmd3, history=history, **args3) papi_exec.get_replies() return vxlan_count @@ -270,7 +274,7 @@ class TestConfig: flags=InterfaceStatusFlags.IF_STATUS_API_FLAG_ADMIN_UP.value ) - with PapiSocketExecutor(node) as papi_exec: + with PapiSocketExecutor(node, is_async=True) as papi_exec: for i in range(0, vxlan_count): vxlan_subif_key = Topology.add_new_port(node, u"vxlan_tunnel") vxlan_subif_name = f"vxlan_tunnel{i}" @@ -306,9 +310,8 @@ class TestConfig: ) args2[u"sw_if_index"] = vlan_idx history = bool(not 1 < i < vxlan_count - 1) - papi_exec.add(cmd, history=history, **args1). \ - add(cmd, history=history, **args2) - papi_exec.add(cmd, **args1).add(cmd, **args2) + papi_exec.add(cmd, history=history, **args1) + papi_exec.add(cmd, history=history, **args2) papi_exec.get_replies() @staticmethod @@ -418,14 +421,14 @@ class TestConfig: enable=1 ) - with PapiSocketExecutor(node) as papi_exec: + with PapiSocketExecutor(node, is_async=True) as papi_exec: for i in range(0, vxlan_count): args1[u"neighbor"][u"ip_address"] = \ str(dst_ip_start + i * ip_step) args2[u"route"][u"prefix"][u"address"][u"un"] = \ - IPUtil.union_addr(dst_ip_start + i * ip_step) + IPAddress.union_addr(dst_ip_start + i * ip_step) args2[u"route"][u"paths"][0][u"nh"][u"address"] = \ - IPUtil.union_addr(dst_ip_start + i * ip_step) + IPAddress.union_addr(dst_ip_start + i * ip_step) args3[u"rx_sw_if_index"] = Topology.get_interface_sw_index( node, f"vxlan_tunnel{i+1}" ) @@ -435,8 +438,8 @@ class TestConfig: ) args4[u"bd_id"] = int(bd_id_start+i) history = bool(not 1 < i < vxlan_count - 1) - papi_exec.add(cmd1, history=history, **args1). \ - add(cmd2, history=history, **args2). \ - add(cmd3, history=history, **args3). \ - add(cmd3, history=history, **args4) + papi_exec.add(cmd1, history=history, **args1) + papi_exec.add(cmd2, history=history, **args2) + papi_exec.add(cmd3, history=history, **args3) + papi_exec.add(cmd3, history=history, **args4) papi_exec.get_replies()