From a47c63da42a64b73f9849e3766666c807b311ee5 Mon Sep 17 00:00:00 2001 From: vikumarks <119973184+vikumarks@users.noreply.github.com> Date: Sat, 16 Sep 2023 00:40:29 -0700 Subject: [PATCH] Adding new DASH TCs for create, set and remove API (#195) Signed-off-by: Vinod Kumar Signed-off-by: selldinesh --- tests/api/test_dash_acl_group.py | 56 +++ tests/api/test_direction_lookup_entry.py | 54 +++ tests/api/test_eni.py | 489 ++++++++++++++++++++++ tests/api/test_inbound_routing_entry.py | 97 +++++ tests/api/test_outbound_ca_to_pa_entry.py | 124 ++++++ tests/api/test_pa_validation_entry.py | 79 ++++ tests/api/test_vip_entry.py | 55 +++ tests/api/test_vnet.py | 54 +++ 8 files changed, 1008 insertions(+) create mode 100644 tests/api/test_dash_acl_group.py create mode 100644 tests/api/test_direction_lookup_entry.py create mode 100644 tests/api/test_eni.py create mode 100644 tests/api/test_inbound_routing_entry.py create mode 100644 tests/api/test_outbound_ca_to_pa_entry.py create mode 100644 tests/api/test_pa_validation_entry.py create mode 100644 tests/api/test_vip_entry.py create mode 100644 tests/api/test_vnet.py diff --git a/tests/api/test_dash_acl_group.py b/tests/api/test_dash_acl_group.py new file mode 100644 index 00000000..3551a051 --- /dev/null +++ b/tests/api/test_dash_acl_group.py @@ -0,0 +1,56 @@ + +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiDashAclGroup: + # object with no attributes + + def test_dash_acl_group_create(self, dpu): + #Attribs are not marked mandatory but if we dont gives it throws an error + commands = [ + { + 'name': 'dash_acl_group_1', + 'op': 'create', + 'type': 'SAI_OBJECT_TYPE_DASH_ACL_GROUP', + 'attributes': ["SAI_DASH_ACL_GROUP_ATTR_IP_ADDR_FAMILY","SAI_IP_ADDR_FAMILY_IPV4"] + } + ] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + + @pytest.mark.dependency(name="test_sai_dash_acl_group_attr_ip_addr_family_set") + def test_sai_dash_acl_group_attr_ip_addr_family_set(self, dpu): + + commands = [ + { + "name": "dash_acl_group_1", + "op": "set", + "attributes": ["SAI_DASH_ACL_GROUP_ATTR_IP_ADDR_FAMILY", 'SAI_IP_ADDR_FAMILY_IPV4'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + + def test_dash_acl_group_remove(self, dpu): + + commands = [{'name': 'dash_acl_group_1', 'op': 'remove'}] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) + diff --git a/tests/api/test_direction_lookup_entry.py b/tests/api/test_direction_lookup_entry.py new file mode 100644 index 00000000..c94ace8d --- /dev/null +++ b/tests/api/test_direction_lookup_entry.py @@ -0,0 +1,54 @@ + +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiDirectionLookupEntry: + # object with no attributes + + def test_direction_lookup_entry_create(self, dpu): + commands = [ + { + 'name': 'direction_lookup_entry_1', + 'op': 'create', + 'type': 'SAI_OBJECT_TYPE_DIRECTION_LOOKUP_ENTRY', + 'attributes': [], + 'key': {'switch_id': '$SWITCH_ID', 'vni': "2000"} + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + + @pytest.mark.dependency(name="test_sai_direction_lookup_entry_attr_action_set") + def test_sai_direction_lookup_entry_attr_action_set(self, dpu): + + commands = [ + { + "name": "direction_lookup_entry_1", + "op": "set", + "attributes": ["SAI_DIRECTION_LOOKUP_ENTRY_ATTR_ACTION", 'SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_OUTBOUND_DIRECTION'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + def test_direction_lookup_entry_remove(self, dpu): + + commands = [{'name': 'direction_lookup_entry_1', 'key': {'switch_id': '$SWITCH_ID', 'vni': '2000'}, 'op': 'remove'}] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) + diff --git a/tests/api/test_eni.py b/tests/api/test_eni.py new file mode 100644 index 00000000..e420e991 --- /dev/null +++ b/tests/api/test_eni.py @@ -0,0 +1,489 @@ +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiEni: + # object with no attributes + + def test_eni_create(self, dpu): + commands = [ + {"name": "vnet","op": "create","type": "SAI_OBJECT_TYPE_VNET","attributes": ["SAI_VNET_ATTR_VNI","2000"]}, + { + "name": "eni_1", + "op": "create", + "type": "SAI_OBJECT_TYPE_ENI", + "attributes": [ + "SAI_ENI_ATTR_ADMIN_STATE","True", + "SAI_ENI_ATTR_VM_UNDERLAY_DIP","10.10.1.10", + "SAI_ENI_ATTR_VM_VNI","2000", + "SAI_ENI_ATTR_VNET_ID","$vnet", + ] + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + @pytest.mark.dependency(name='test_sai_eni_attr_cps_set') + def test_sai_eni_attr_cps_set(self, dpu): + commands = [ + {'name': 'eni_1', 'op': 'set', 'attributes': ['SAI_ENI_ATTR_CPS', '0']} + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency(name='test_sai_eni_attr_pps_set') + def test_sai_eni_attr_pps_set(self, dpu): + commands = [ + {'name': 'eni_1', 'op': 'set', 'attributes': ['SAI_ENI_ATTR_PPS', '0']} + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency(name='test_sai_eni_attr_flows_set') + def test_sai_eni_attr_flows_set(self, dpu): + commands = [ + {'name': 'eni_1', 'op': 'set', 'attributes': ['SAI_ENI_ATTR_FLOWS', '0']} + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency(name='test_sai_eni_attr_admin_state_set') + def test_sai_eni_attr_admin_state_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': ['SAI_ENI_ATTR_ADMIN_STATE', 'false'], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency(name='test_sai_eni_attr_vm_underlay_dip_set') + def test_sai_eni_attr_vm_underlay_dip_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': ['SAI_ENI_ATTR_VM_UNDERLAY_DIP', '0.0.0.0'], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency(name='test_sai_eni_attr_vm_vni_set') + def test_sai_eni_attr_vm_vni_set(self, dpu): + commands = [ + {'name': 'eni_1', 'op': 'set', 'attributes': ['SAI_ENI_ATTR_VM_VNI', '0']} + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency(name='test_sai_eni_attr_vnet_id_set') + def test_sai_eni_attr_vnet_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': ['SAI_ENI_ATTR_VNET_ID', 'null'], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v4_stage1_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v4_stage1_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V4_STAGE1_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v4_stage2_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v4_stage2_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V4_STAGE2_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v4_stage3_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v4_stage3_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V4_STAGE3_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v4_stage4_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v4_stage4_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V4_STAGE4_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v4_stage5_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v4_stage5_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V4_STAGE5_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v6_stage1_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v6_stage1_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V6_STAGE1_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v6_stage2_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v6_stage2_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V6_STAGE2_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v6_stage3_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v6_stage3_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V6_STAGE3_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v6_stage4_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v6_stage4_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V6_STAGE4_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_inbound_v6_stage5_dash_acl_group_id_set' + ) + def test_sai_eni_attr_inbound_v6_stage5_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_INBOUND_V6_STAGE5_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v4_stage1_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v4_stage1_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V4_STAGE1_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v4_stage2_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v4_stage2_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V4_STAGE2_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v4_stage3_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v4_stage3_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V4_STAGE3_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v4_stage4_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v4_stage4_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V4_STAGE4_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v4_stage5_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v4_stage5_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V4_STAGE5_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v6_stage1_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v6_stage1_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V6_STAGE1_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v6_stage2_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v6_stage2_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V6_STAGE2_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v6_stage3_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v6_stage3_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V6_STAGE3_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v6_stage4_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v6_stage4_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V6_STAGE4_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + @pytest.mark.dependency( + name='test_sai_eni_attr_outbound_v6_stage5_dash_acl_group_id_set' + ) + def test_sai_eni_attr_outbound_v6_stage5_dash_acl_group_id_set(self, dpu): + commands = [ + { + 'name': 'eni_1', + 'op': 'set', + 'attributes': [ + 'SAI_ENI_ATTR_OUTBOUND_V6_STAGE5_DASH_ACL_GROUP_ID', + 'null', + ], + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values get =======') + pprint(results) + + + def test_eni_remove(self, dpu): + + commands = [ + {'name': 'eni_1', 'op': 'remove'}, + {"name": "vnet","op": "remove"}, + ] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) \ No newline at end of file diff --git a/tests/api/test_inbound_routing_entry.py b/tests/api/test_inbound_routing_entry.py new file mode 100644 index 00000000..54b0ea54 --- /dev/null +++ b/tests/api/test_inbound_routing_entry.py @@ -0,0 +1,97 @@ + +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiInboundRoutingEntry: + # object with no attributes + + def test_inbound_routing_entry_create(self, dpu): + + commands = [ + {"name": "vnet","op": "create","type": "SAI_OBJECT_TYPE_VNET","attributes": ["SAI_VNET_ATTR_VNI","2000"]}, + {"name": "eni_1","op": "create","type": "SAI_OBJECT_TYPE_ENI", + "attributes": [ + "SAI_ENI_ATTR_ADMIN_STATE","True", + "SAI_ENI_ATTR_VM_UNDERLAY_DIP","10.10.1.10", + "SAI_ENI_ATTR_VM_VNI","2000", + "SAI_ENI_ATTR_VNET_ID","$vnet", + ] + }, + {'name': 'inbound_routing_entry_1', 'op': 'create', 'type': 'SAI_OBJECT_TYPE_INBOUND_ROUTING_ENTRY', + 'attributes': [ + "SAI_INBOUND_ROUTING_ENTRY_ATTR_ACTION","SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP_PA_VALIDATE", + "SAI_INBOUND_ROUTING_ENTRY_ATTR_SRC_VNET_ID","$vnet" + ], + 'key': {'switch_id': '$SWITCH_ID', 'eni_id': "33", 'vni': '2000', 'sip': '1.1.1.1', 'sip_mask': '32', 'priority': '0'} + } + ] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + + @pytest.mark.dependency(name="test_sai_inbound_routing_entry_attr_action_set") + def test_sai_inbound_routing_entry_attr_action_set(self, dpu): + + commands = [ + { + "name": "inbound_routing_entry_1", + "op": "set", + "attributes": [ + "SAI_INBOUND_ROUTING_ENTRY_ATTR_ACTION", + 'SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP' + ], + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + @pytest.mark.dependency(name="test_sai_inbound_routing_entry_attr_src_vnet_id_set") + def test_sai_inbound_routing_entry_attr_src_vnet_id_set(self, dpu): + + commands = [ + { + "name": "inbound_routing_entry_1", + "op": "set", + "attributes": ["SAI_INBOUND_ROUTING_ENTRY_ATTR_SRC_VNET_ID", '0'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + def test_inbound_routing_entry_remove(self, dpu): + + commands = [ + { + 'name': 'inbound_routing_entry_1', + 'op': 'remove', + 'key': + { + 'switch_id': '$SWITCH_ID', + 'eni_id': '33', + 'vni': '2000', + 'sip': '1.1.1.1', + 'sip_mask': '32', + 'priority': '0' + }, + }, + {'name': 'eni_1', 'op': 'remove'}, + {"name": "vnet","op": "remove"}, + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) + diff --git a/tests/api/test_outbound_ca_to_pa_entry.py b/tests/api/test_outbound_ca_to_pa_entry.py new file mode 100644 index 00000000..100b036e --- /dev/null +++ b/tests/api/test_outbound_ca_to_pa_entry.py @@ -0,0 +1,124 @@ + +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiOutboundCaToPaEntry: + # object with no attributes + + def test_outbound_ca_to_pa_entry_create(self, dpu): + + commands = [ + { + "name": "vnet", + "op": "create", + "type": "SAI_OBJECT_TYPE_VNET", + "attributes": ["SAI_VNET_ATTR_VNI","2000"] + }, + { + 'name': 'outbound_ca_to_pa_entry_1', + 'op': 'create', + 'type': 'SAI_OBJECT_TYPE_OUTBOUND_CA_TO_PA_ENTRY', + 'attributes': [ + "SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_UNDERLAY_DIP","221.0.2.100", + "SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_OVERLAY_DMAC","00:1B:6E:00:00:01", + "SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_USE_DST_VNET_VNI","True", + ], + 'key': {'switch_id': '$SWITCH_ID', 'dst_vnet_id': '$vnet', 'dip': '1.128.0.1'} + } + ] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + + @pytest.mark.dependency(name="test_sai_outbound_ca_to_pa_entry_attr_underlay_dip_set") + def test_sai_outbound_ca_to_pa_entry_attr_underlay_dip_set(self, dpu): + + commands = [ + { + "name": "outbound_ca_to_pa_entry_1", + "op": "set", + "attributes": ["SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_UNDERLAY_DIP", '0.0.0.0'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + + @pytest.mark.dependency(name="test_sai_outbound_ca_to_pa_entry_attr_overlay_dmac_set") + def test_sai_outbound_ca_to_pa_entry_attr_overlay_dmac_set(self, dpu): + + commands = [ + { + "name": "outbound_ca_to_pa_entry_1", + "op": "set", + "attributes": ["SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_OVERLAY_DMAC", '0:0:0:0:0:0'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + @pytest.mark.dependency(name="test_sai_outbound_ca_to_pa_entry_attr_use_dst_vnet_vni_set") + def test_sai_outbound_ca_to_pa_entry_attr_use_dst_vnet_vni_set(self, dpu): + + commands = [ + { + "name": "outbound_ca_to_pa_entry_1", + "op": "set", + "attributes": ["SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_USE_DST_VNET_VNI", 'false'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + @pytest.mark.dependency(name="test_sai_outbound_ca_to_pa_entry_attr_counter_id_set") + def test_sai_outbound_ca_to_pa_entry_attr_counter_id_set(self, dpu): + + commands = [ + { + "name": "outbound_ca_to_pa_entry_1", + "op": "set", + "attributes": ["SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_COUNTER_ID", '0'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + def test_outbound_ca_to_pa_entry_remove(self, dpu): + + commands = [ + { + 'name': 'outbound_ca_to_pa_entry_1', + 'op': 'remove', + 'key': + { + 'switch_id': '$SWITCH_ID', + 'dst_vnet_id': '$vnet', + 'dip': '1.128.0.1' + }, + }, + {"name": "vnet","op": "remove"}, + + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) + diff --git a/tests/api/test_pa_validation_entry.py b/tests/api/test_pa_validation_entry.py new file mode 100644 index 00000000..118b8f7e --- /dev/null +++ b/tests/api/test_pa_validation_entry.py @@ -0,0 +1,79 @@ + +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiPaValidationEntry: + # object with no attributes + + def test_pa_validation_entry_create(self, dpu): + + commands = [ + { + "name": "vnet", + "op": "create", + "type": "SAI_OBJECT_TYPE_VNET", + "attributes": ["SAI_VNET_ATTR_VNI","7000"] + }, + { + 'name': 'pa_validation_entry_1', + 'op': 'create', + 'type': 'SAI_OBJECT_TYPE_PA_VALIDATION_ENTRY', + 'attributes': [], + 'key': + { + 'switch_id': '$SWITCH_ID', + 'vnet_id': '$vnet', + 'sip': '1.1.1.1' + } + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + + @pytest.mark.dependency(name="test_sai_pa_validation_entry_attr_action_set") + def test_sai_pa_validation_entry_attr_action_set(self, dpu): + + commands = [ + { + "name": "pa_validation_entry_1", + "op": "set", + "attributes": [ + "SAI_PA_VALIDATION_ENTRY_ATTR_ACTION", + 'SAI_PA_VALIDATION_ENTRY_ACTION_PERMIT' + ], + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + def test_pa_validation_entry_remove(self, dpu): + + commands = [ + { + 'name': 'pa_validation_entry_1', + 'op': 'remove', + 'key': + { + 'switch_id': '$SWITCH_ID', + 'vnet_id': '$vnet', + 'sip': '1.1.1.1' + }, + } + ] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) + diff --git a/tests/api/test_vip_entry.py b/tests/api/test_vip_entry.py new file mode 100644 index 00000000..d59e619f --- /dev/null +++ b/tests/api/test_vip_entry.py @@ -0,0 +1,55 @@ + +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiVipEntry: + # object with no attributes + + def test_vip_entry_create(self, dpu): + + commands = [ + { + 'name': 'vip_entry_1', + 'op': 'create', + 'type': 'SAI_OBJECT_TYPE_VIP_ENTRY', + 'attributes': [], + 'key': {'switch_id': '$SWITCH_ID', 'vip': '1.2.1.1'} + } + ] + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + + @pytest.mark.dependency(name="test_sai_vip_entry_attr_action_set") + def test_sai_vip_entry_attr_action_set(self, dpu): + + commands = [ + { + "name": "vip_entry_1", + "op": "set", + "attributes": ["SAI_VIP_ENTRY_ATTR_ACTION", 'SAI_VIP_ENTRY_ACTION_ACCEPT'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + def test_vip_entry_remove(self, dpu): + + commands = [{'name': 'vip_entry_1', 'key': {'switch_id': '$SWITCH_ID', 'vip': '1.2.1.1'}, 'op': 'remove'}] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) + diff --git a/tests/api/test_vnet.py b/tests/api/test_vnet.py new file mode 100644 index 00000000..db35a3cf --- /dev/null +++ b/tests/api/test_vnet.py @@ -0,0 +1,54 @@ + +from pprint import pprint + +import pytest + +@pytest.fixture(scope="module", autouse=True) +def skip_all(testbed_instance): + testbed = testbed_instance + if testbed is not None and len(testbed.dpu) != 1: + pytest.skip("invalid for \"{}\" testbed".format(testbed.name)) + +@pytest.mark.dpu +class TestSaiVnet: + # object with no attributes + + def test_vnet_create(self, dpu): + + commands = [ + { + 'name': 'vnet_1', + 'op': 'create', + 'type': 'SAI_OBJECT_TYPE_VNET', + 'attributes': ["SAI_VNET_ATTR_VNI", '2001'] + } + ] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values create =======') + pprint(results) + + + @pytest.mark.dependency(name="test_sai_vnet_attr_vni_set") + def test_sai_vnet_attr_vni_set(self, dpu): + + commands = [ + { + "name": "vnet_1", + "op": "set", + "attributes": ["SAI_VNET_ATTR_VNI", '2001'] + } + ] + results = [*dpu.process_commands(commands)] + print("======= SAI commands RETURN values get =======") + pprint(results) + + + def test_vnet_remove(self, dpu): + + commands = [{'name': 'vnet_1', 'op': 'remove'}] + + results = [*dpu.process_commands(commands)] + print('======= SAI commands RETURN values remove =======') + pprint(results) +