def test_vlan_three_vlans(self) -> None: args = self.base_args + [ '--vlan', '2', '1', '4', '--vlan', '20', '2', '4', '--vlan', '21', '2', ] data = get_data_from_cli_args(parser=create_parser(args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [ [24, 0, 1 << 2, 0], # VLAN_VALID [24, 1, 2, 0], # VID_0 [24, 2, 20, 0], # VID_1 [24, 3, 21, 0], # VID_2 [24, 17, 0b01000100, 0b01001000], # VLAN_MEMBER_0, VLAN_MEMBER_1 [24, 18, 0b00001000, 255], # VLAN_MEMBER_2 ] assert data == expected_result
def test_reset(self, ) -> None: data = get_data_from_cli_args(parser=create_parser(self.base_args), args=self.base_args) assert_ip175g_command_is_correct_type(data=data) expected_result = [[20, 4, 1, 224], [20, 3, 1, 0]] assert data == expected_result
def test_erase(self, ) -> None: data = get_data_from_cli_args( parser=create_parser(self.base_args), args=self.base_args, ) assert_ip175g_command_is_correct_type(data=data) expected_result = [[101, 0, 0, 0]] assert data == expected_result
def test_reset(self, ) -> None: data = get_data_from_cli_args( parser=create_parser(self.base_args), args=self.base_args, ) assert_ip175g_command_is_correct_type(data=data) expected_result = [[23, 16, 255, 255], [23, 17, 255, 0], [23, 18, 255, 255]] assert data == expected_result
def test_force_all(self) -> None: args = self.base_args + [ '--force-vlan-id', ] data = get_data_from_cli_args(parser=create_parser(args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [ [23, 1, 0, 0b11011100], # VLAN_CLS ] assert data == expected_result
def test_mode_only_untagged(self) -> None: args = self.base_args + [ '--receive-mode', 'ONLY_UNTAGGED', ] data = get_data_from_cli_args(parser=create_parser(args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [ [23, 2, 255, 0b0000_0110], # ACCEPTABLE_FRM_TYPE ] assert data == expected_result
def test_single_tx_port(self, ) -> None: test_args = self.base_args + [ '-M', '1', '-tx', '2', ] data = get_data_from_cli_args(parser=create_parser(self.base_args), args=test_args) assert_ip175g_command_is_correct_type(data=data) expected_result = [[20, 4, 8, 64], [20, 3, 1, 160]] assert data == expected_result
def test_port_only(self) -> None: args = self.base_args + [ '--port-default-vlan', '2', '20', ] data = get_data_from_cli_args(parser=create_parser(args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [ [23, 8, 20, 0], # VLAN_INFO_1 ] assert data == expected_result
def test_default_mirror_port(self, ) -> None: test_args = self.base_args + [ '--tx-port', '1', '2', '3', '4', ] data = get_data_from_cli_args(parser=create_parser(self.base_args), args=test_args) assert_ip175g_command_is_correct_type(data=data) expected_result = [[20, 4, 92, 224], [20, 3, 1, 160]] assert data == expected_result
def test_mixed(self) -> None: args = self.base_args + [ '--default-vlan', '20', '--port-default-vlan', '2', '21' ] data = get_data_from_cli_args(parser=create_parser(args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [ [23, 7, 20, 0], # VLAN_INFO_0 [23, 8, 21, 0], # VLAN_INFO_1 [23, 9, 20, 0], # VLAN_INFO_2 [23, 11, 20, 0], # VLAN_INFO_3 [23, 12, 20, 0], # VLAN_INFO_4 ] assert data == expected_result
def test_reset(self) -> None: data = get_data_from_cli_args( parser=create_parser(self.base_args), args=self.base_args, ) assert_ip175g_command_is_correct_type(data=data) expected_result = [ [23, 0, 0, 160], # UNVID_MODE=1, VLAN_TABLE_CLR=1 [23, 1, 0, 0], # TAG_VLAN_EN=0 [23, 2, 255, 4], # ACCEPTABLE_FRM_TYPE=0 [23, 13, 0, 0], # ADD_TAG=0 [23, 14, 0, 0], # REMOVE_TAG=0 [24, 0, 0, 0] # VLAN_VALID=0 ] assert data == expected_result
def test_2x2_groups_1_isolated(self, ) -> None: args = self.base_args + [ '--group', '1', '2', '--group', '3', '4', ] data = get_data_from_cli_args(parser=create_parser(args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [[23, 16, 12, 12], [23, 17, 80, 0], [23, 18, 80, 255]] assert data == expected_result
def test_vlan_one_member(self) -> None: args = self.base_args + [ '--vlan', '2', '1', ] data = get_data_from_cli_args(parser=create_parser(args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [ [24, 0, 1, 0], # VLAN_VALID [24, 1, 2, 0], # VID_0 [24, 17, 0b00000100, 255], # VLAN_MEMBER_0 ] assert data == expected_result
def test_multiple_rx_port( self, ) -> None: args = self.base_args + [ '-M', '1', '-rx', '2', '3', '4', '5', ] data = get_data_from_cli_args(parser=create_parser(self.base_args), args=args) assert_ip175g_command_is_correct_type(data=data) expected_result = [[20, 4, 1, 64], [20, 3, 216, 128]] assert data == expected_result