blob: 7652c651eda6807e1f8aa835d505ecbea578044e [file] [log] [blame]
Junyu Lai32a2d152024-07-03 16:05:41 +08001# Copyright (C) 2024 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Junyu Laicf655862024-07-04 11:09:52 +080015from mobly import asserts
16from net_tests_utils.host.python import adb_utils, apf_test_base, apf_utils, assert_utils, tether_utils
Junyu Lai32a2d152024-07-03 16:05:41 +080017from net_tests_utils.host.python.tether_utils import UpstreamType
18
19COUNTER_DROPPED_ETHERTYPE_NOT_ALLOWED = "DROPPED_ETHERTYPE_NOT_ALLOWED"
20
21
Junyu Laicf655862024-07-04 11:09:52 +080022class ApfV4Test(apf_test_base.ApfTestBase):
Junyu Lai32a2d152024-07-03 16:05:41 +080023
24 def test_apf_drop_ethercat(self):
Junyu Laicf655862024-07-04 11:09:52 +080025 count_before_test = apf_utils.get_apf_counter(
26 self.clientDevice,
27 self.client_iface_name,
28 COUNTER_DROPPED_ETHERTYPE_NOT_ALLOWED,
Junyu Lai32a2d152024-07-03 16:05:41 +080029 )
Junyu Laicf655862024-07-04 11:09:52 +080030 apf_utils.send_broadcast_empty_ethercat_packet(
31 self.serverDevice, self.server_iface_name
32 )
Junyu Lai32a2d152024-07-03 16:05:41 +080033
Junyu Laicf655862024-07-04 11:09:52 +080034 assert_utils.expect_with_retry(
35 lambda: apf_utils.get_apf_counter(
36 self.clientDevice,
37 self.client_iface_name,
38 COUNTER_DROPPED_ETHERTYPE_NOT_ALLOWED,
Junyu Lai32a2d152024-07-03 16:05:41 +080039 )
Junyu Laicf655862024-07-04 11:09:52 +080040 > count_before_test
41 )
Junyu Lai32a2d152024-07-03 16:05:41 +080042
Junyu Laicf655862024-07-04 11:09:52 +080043 # TODO: Verify the packet is not actually received.