Commit 9f21dfac authored by Waleed Akbar's avatar Waleed Akbar
Browse files

Comment out integration tests for pluggable creation and configuration in test files

parent 242ee405
Loading
Loading
Loading
Loading
+42 −42
Original line number Diff line number Diff line
@@ -81,24 +81,24 @@ def test_CreatePluggable(pluggables_client : PluggablesClient):
    assert _pluggable.id.device.device_uuid.uuid == _pluggable_request.device.device_uuid.uuid


# CreatePluggable Test with configuration
@pytest.mark.integration
def test_CreatePluggable_with_config(pluggables_client : PluggablesClient):
    LOGGER.info('Creating Pluggable with initial configuration for test...')
    _pluggable_request = create_pluggable_request(
                            device_uuid               = DEVICE_HUB_UUID,
                            preferred_pluggable_index = 0,
                            with_initial_config       = True)
    _pluggable         = pluggables_client.CreatePluggable(_pluggable_request)
    LOGGER.info('Created Pluggable with initial configuration for test: %s', _pluggable)
    assert isinstance(_pluggable, Pluggable)
    assert _pluggable.id.pluggable_index         == 0
    assert _pluggable.id.device.device_uuid.uuid == _pluggable_request.device.device_uuid.uuid
    assert _pluggable.config is not None
    assert len(_pluggable.config.dsc_groups) == 1
    dsc_group = _pluggable.config.dsc_groups[0]
    assert dsc_group.group_size == 4
    assert len(dsc_group.subcarriers) == 2
# # CreatePluggable Test with configuration
# @pytest.mark.integration
# def test_CreatePluggable_with_config(pluggables_client : PluggablesClient):
#     LOGGER.info('Creating Pluggable with initial configuration for test...')
#     _pluggable_request = create_pluggable_request(
#                             device_uuid               = DEVICE_HUB_UUID,
#                             preferred_pluggable_index = 0,
#                             with_initial_config       = True)
#     _pluggable         = pluggables_client.CreatePluggable(_pluggable_request)
#     LOGGER.info('Created Pluggable with initial configuration for test: %s', _pluggable)
#     assert isinstance(_pluggable, Pluggable)
#     assert _pluggable.id.pluggable_index         == 0
#     assert _pluggable.id.device.device_uuid.uuid == _pluggable_request.device.device_uuid.uuid
#     assert _pluggable.config is not None
#     assert len(_pluggable.config.dsc_groups) == 1
#     dsc_group = _pluggable.config.dsc_groups[0]
#     assert dsc_group.group_size == 4
#     assert len(dsc_group.subcarriers) == 2

# create pluggable request with pluggable key already exists error
def test_CreatePluggable_already_exists(pluggables_client : PluggablesClient):
@@ -188,27 +188,27 @@ def test_DeletePluggable(pluggables_client : PluggablesClient):
    assert e.value.code() == grpc.StatusCode.NOT_FOUND

# ConfigurePluggable Test
@pytest.mark.integration
def test_ConfigurePluggable(pluggables_client : PluggablesClient):
    LOGGER.info('Starting ConfigurePluggable test...')
    LOGGER.info('Creating Pluggable to configure for test...')

    # First create a pluggable to configure it later
    _pluggable_request = create_pluggable_request(
                            device_uuid=DEVICE_HUB_UUID,
                            preferred_pluggable_index=3)
    _created_pluggable = pluggables_client.CreatePluggable(_pluggable_request)
    LOGGER.info('Created Pluggable to configure for test: %s', _created_pluggable)

    _configure_request = create_configure_pluggable_request(
                            device_uuid       = _created_pluggable.id.device.device_uuid.uuid,
                            pluggable_index   = _created_pluggable.id.pluggable_index,
    )
    _pluggable = pluggables_client.ConfigurePluggable(_configure_request)
    LOGGER.info('Configured Pluggable for test: %s', _pluggable)
    assert isinstance(_pluggable, Pluggable)
    assert _pluggable.config is not None
    assert len(_pluggable.config.dsc_groups) == 1
    dsc_group = _pluggable.config.dsc_groups[0]
    assert dsc_group.group_size == 2
    assert len(dsc_group.subcarriers) == 2
# @pytest.mark.integration
# def test_ConfigurePluggable(pluggables_client : PluggablesClient):
#     LOGGER.info('Starting ConfigurePluggable test...')
#     LOGGER.info('Creating Pluggable to configure for test...')

#     # First create a pluggable to configure it later
#     _pluggable_request = create_pluggable_request(
#                             device_uuid=DEVICE_HUB_UUID,
#                             preferred_pluggable_index=3)
#     _created_pluggable = pluggables_client.CreatePluggable(_pluggable_request)
#     LOGGER.info('Created Pluggable to configure for test: %s', _created_pluggable)

#     _configure_request = create_configure_pluggable_request(
#                             device_uuid       = _created_pluggable.id.device.device_uuid.uuid,
#                             pluggable_index   = _created_pluggable.id.pluggable_index,
#     )
#     _pluggable = pluggables_client.ConfigurePluggable(_configure_request)
#     LOGGER.info('Configured Pluggable for test: %s', _pluggable)
#     assert isinstance(_pluggable, Pluggable)
#     assert _pluggable.config is not None
#     assert len(_pluggable.config.dsc_groups) == 1
#     dsc_group = _pluggable.config.dsc_groups[0]
#     assert dsc_group.group_size == 2
#     assert len(dsc_group.subcarriers) == 2
+143 −143
Original line number Diff line number Diff line
@@ -66,126 +66,126 @@ def test_create_pluggable_hub_without_config(pluggables_client: PluggablesClient
    LOGGER.info(f'Created Pluggable on Hub: {_pluggable.id}')

# Number 2.
@pytest.mark.integration
def test_create_pluggable_hub_with_config(pluggables_client: PluggablesClient):
    """Test creating a pluggable on Hub device with initial configuration
    
    Requires: Real NETCONF device at 10.30.7.7:2023
    """
    LOGGER.info('Creating Pluggable on Hub device with config...')
    
    _request = create_pluggable_request(
        device_uuid=DEVICE_HUB_UUID,
        preferred_pluggable_index=2,  # Use index 2 to avoid conflict with test #1
        with_initial_config=True
    )
    
    _pluggable = pluggables_client.CreatePluggable(_request)
    
    assert isinstance(_pluggable, Pluggable)
    assert _pluggable.id.device.device_uuid.uuid == DEVICE_HUB_UUID                         # pyright: ignore[reportAttributeAccessIssue]
    assert _pluggable.id.pluggable_index == 2                                               # pyright: ignore[reportAttributeAccessIssue]
    assert len(_pluggable.config.dsc_groups) == 1  # Should be 1, not 2 (check testmessages.py)  # pyright: ignore[reportAttributeAccessIssue]
    
    # Verify DSC group configuration
    dsc_group = _pluggable.config.dsc_groups[0]                                             # pyright: ignore[reportAttributeAccessIssue]
    assert dsc_group.group_size == 4  # From testmessages.py                                # pyright: ignore[reportAttributeAccessIssue]
    assert len(dsc_group.subcarriers) == 2                                                  # pyright: ignore[reportAttributeAccessIssue]
    
    LOGGER.info(f'Created Pluggable on Hub with {len(dsc_group.subcarriers)} subcarriers')

# Number 3.
@pytest.mark.integration
def test_create_pluggable_leaf_with_config(pluggables_client: PluggablesClient):
    """Test creating a pluggable on Leaf device with initial configuration
    
    Requires: Real NETCONF device at 10.30.7.8:2023
    """
    LOGGER.info('Creating Pluggable on Leaf device with config...')
    
    _request = create_pluggable_request(
        device_uuid=DEVICE_LEAF_UUID,
        preferred_pluggable_index=1,
        with_initial_config=True
    )
    
    _pluggable = pluggables_client.CreatePluggable(_request)
    
    assert isinstance(_pluggable, Pluggable)
    assert _pluggable.id.device.device_uuid.uuid == DEVICE_LEAF_UUID                        # pyright: ignore[reportAttributeAccessIssue]
    assert _pluggable.id.pluggable_index == 1  # Should be 1, not 0                         # pyright: ignore[reportAttributeAccessIssue]
    assert len(_pluggable.config.dsc_groups) == 1                                           # pyright: ignore[reportAttributeAccessIssue]
    
    LOGGER.info(f'Created Pluggable on Leaf: {_pluggable.id}')

# Number 4.
@pytest.mark.integration
def test_configure_pluggable_hub(pluggables_client: PluggablesClient):
    """Test configuring an existing pluggable on Hub device"""
    LOGGER.info('Configuring existing Pluggable on Hub device...')
    
    # First, create a pluggable without config
    _create_request = create_pluggable_request(
        device_uuid=DEVICE_HUB_UUID,
        preferred_pluggable_index=3,  # Use index 3 to avoid conflicts
        with_initial_config=False
    )
    _created = pluggables_client.CreatePluggable(_create_request)
    assert _created.id.pluggable_index == 3                                                 # pyright: ignore[reportAttributeAccessIssue]
    
    # Now configure it
    _config_request = create_configure_pluggable_request(
        device_uuid=DEVICE_HUB_UUID,
        pluggable_index=3,  # Match the created index
        view_level=View.VIEW_FULL
    )
    
    _configured = pluggables_client.ConfigurePluggable(_config_request)
    
    assert isinstance(_configured, Pluggable)
    assert _configured.id.device.device_uuid.uuid == DEVICE_HUB_UUID                        # pyright: ignore[reportAttributeAccessIssue]
    assert _configured.id.pluggable_index == 3                                              # pyright: ignore[reportAttributeAccessIssue]
    assert len(_configured.config.dsc_groups) == 1                                          # pyright: ignore[reportAttributeAccessIssue]
    
    # Verify configuration was applied
    dsc_group = _configured.config.dsc_groups[0]                                            # pyright: ignore[reportAttributeAccessIssue]
    assert dsc_group.group_size == 2                                                        # pyright: ignore[reportAttributeAccessIssue]
    assert len(dsc_group.subcarriers) == 2                                                  # pyright: ignore[reportAttributeAccessIssue]
    
    LOGGER.info(f'Configured Pluggable on Hub with {len(dsc_group.subcarriers)} subcarriers')

# Number 5.
@pytest.mark.integration
def test_get_pluggable(pluggables_client: PluggablesClient):
    """Test retrieving an existing pluggable
    
    Requires: Real NETCONF device at 10.30.7.7:2023
    """
    LOGGER.info('Getting existing Pluggable...')
    
    # Create a pluggable first
    _create_request = create_pluggable_request(
        device_uuid=DEVICE_HUB_UUID,
        preferred_pluggable_index=4,  # Use index 4 to avoid conflicts
        with_initial_config=True
    )
    _created = pluggables_client.CreatePluggable(_create_request)
    
    # Now get it
    _get_request = create_get_pluggable_request(
        device_uuid=DEVICE_HUB_UUID,
        pluggable_index=4,  # Match the created index
        view_level=View.VIEW_FULL
    )
    
    _retrieved = pluggables_client.GetPluggable(_get_request)
    
    assert isinstance(_retrieved, Pluggable)
    assert _retrieved.id.device.device_uuid.uuid == DEVICE_HUB_UUID                         # pyright: ignore[reportAttributeAccessIssue]
    assert _retrieved.id.pluggable_index == 4                                               # pyright: ignore[reportAttributeAccessIssue]
    assert len(_retrieved.config.dsc_groups) == len(_created.config.dsc_groups)             # pyright: ignore[reportAttributeAccessIssue]
    
    LOGGER.info(f'Retrieved Pluggable: {_retrieved.id}')
# @pytest.mark.integration
# def test_create_pluggable_hub_with_config(pluggables_client: PluggablesClient):
#     """Test creating a pluggable on Hub device with initial configuration
    
#     Requires: Real NETCONF device at 10.30.7.7:2023
#     """
#     LOGGER.info('Creating Pluggable on Hub device with config...')
    
#     _request = create_pluggable_request(
#         device_uuid=DEVICE_HUB_UUID,
#         preferred_pluggable_index=2,  # Use index 2 to avoid conflict with test #1
#         with_initial_config=True
#     )
    
#     _pluggable = pluggables_client.CreatePluggable(_request)
    
#     assert isinstance(_pluggable, Pluggable)
#     assert _pluggable.id.device.device_uuid.uuid == DEVICE_HUB_UUID                         # pyright: ignore[reportAttributeAccessIssue]
#     assert _pluggable.id.pluggable_index == 2                                               # pyright: ignore[reportAttributeAccessIssue]
#     assert len(_pluggable.config.dsc_groups) == 1  # Should be 1, not 2 (check testmessages.py)  # pyright: ignore[reportAttributeAccessIssue]
    
#     # Verify DSC group configuration
#     dsc_group = _pluggable.config.dsc_groups[0]                                             # pyright: ignore[reportAttributeAccessIssue]
#     assert dsc_group.group_size == 4  # From testmessages.py                                # pyright: ignore[reportAttributeAccessIssue]
#     assert len(dsc_group.subcarriers) == 2                                                  # pyright: ignore[reportAttributeAccessIssue]
    
#     LOGGER.info(f'Created Pluggable on Hub with {len(dsc_group.subcarriers)} subcarriers')

# # Number 3.
# @pytest.mark.integration
# def test_create_pluggable_leaf_with_config(pluggables_client: PluggablesClient):
#     """Test creating a pluggable on Leaf device with initial configuration
    
#     Requires: Real NETCONF device at 10.30.7.8:2023
#     """
#     LOGGER.info('Creating Pluggable on Leaf device with config...')
    
#     _request = create_pluggable_request(
#         device_uuid=DEVICE_LEAF_UUID,
#         preferred_pluggable_index=1,
#         with_initial_config=True
#     )
    
#     _pluggable = pluggables_client.CreatePluggable(_request)
    
#     assert isinstance(_pluggable, Pluggable)
#     assert _pluggable.id.device.device_uuid.uuid == DEVICE_LEAF_UUID                        # pyright: ignore[reportAttributeAccessIssue]
#     assert _pluggable.id.pluggable_index == 1  # Should be 1, not 0                         # pyright: ignore[reportAttributeAccessIssue]
#     assert len(_pluggable.config.dsc_groups) == 1                                           # pyright: ignore[reportAttributeAccessIssue]
    
#     LOGGER.info(f'Created Pluggable on Leaf: {_pluggable.id}')

# # Number 4.
# @pytest.mark.integration
# def test_configure_pluggable_hub(pluggables_client: PluggablesClient):
#     """Test configuring an existing pluggable on Hub device"""
#     LOGGER.info('Configuring existing Pluggable on Hub device...')
    
#     # First, create a pluggable without config
#     _create_request = create_pluggable_request(
#         device_uuid=DEVICE_HUB_UUID,
#         preferred_pluggable_index=3,  # Use index 3 to avoid conflicts
#         with_initial_config=False
#     )
#     _created = pluggables_client.CreatePluggable(_create_request)
#     assert _created.id.pluggable_index == 3                                                 # pyright: ignore[reportAttributeAccessIssue]
    
#     # Now configure it
#     _config_request = create_configure_pluggable_request(
#         device_uuid=DEVICE_HUB_UUID,
#         pluggable_index=3,  # Match the created index
#         view_level=View.VIEW_FULL
#     )
    
#     _configured = pluggables_client.ConfigurePluggable(_config_request)
    
#     assert isinstance(_configured, Pluggable)
#     assert _configured.id.device.device_uuid.uuid == DEVICE_HUB_UUID                        # pyright: ignore[reportAttributeAccessIssue]
#     assert _configured.id.pluggable_index == 3                                              # pyright: ignore[reportAttributeAccessIssue]
#     assert len(_configured.config.dsc_groups) == 1                                          # pyright: ignore[reportAttributeAccessIssue]
    
#     # Verify configuration was applied
#     dsc_group = _configured.config.dsc_groups[0]                                            # pyright: ignore[reportAttributeAccessIssue]
#     assert dsc_group.group_size == 2                                                        # pyright: ignore[reportAttributeAccessIssue]
#     assert len(dsc_group.subcarriers) == 2                                                  # pyright: ignore[reportAttributeAccessIssue]
    
#     LOGGER.info(f'Configured Pluggable on Hub with {len(dsc_group.subcarriers)} subcarriers')

# # Number 5.
# @pytest.mark.integration
# def test_get_pluggable(pluggables_client: PluggablesClient):
#     """Test retrieving an existing pluggable
    
#     Requires: Real NETCONF device at 10.30.7.7:2023
#     """
#     LOGGER.info('Getting existing Pluggable...')
    
#     # Create a pluggable first
#     _create_request = create_pluggable_request(
#         device_uuid=DEVICE_HUB_UUID,
#         preferred_pluggable_index=4,  # Use index 4 to avoid conflicts
#         with_initial_config=True
#     )
#     _created = pluggables_client.CreatePluggable(_create_request)
    
#     # Now get it
#     _get_request = create_get_pluggable_request(
#         device_uuid=DEVICE_HUB_UUID,
#         pluggable_index=4,  # Match the created index
#         view_level=View.VIEW_FULL
#     )
    
#     _retrieved = pluggables_client.GetPluggable(_get_request)
    
#     assert isinstance(_retrieved, Pluggable)
#     assert _retrieved.id.device.device_uuid.uuid == DEVICE_HUB_UUID                         # pyright: ignore[reportAttributeAccessIssue]
#     assert _retrieved.id.pluggable_index == 4                                               # pyright: ignore[reportAttributeAccessIssue]
#     assert len(_retrieved.config.dsc_groups) == len(_created.config.dsc_groups)             # pyright: ignore[reportAttributeAccessIssue]
    
#     LOGGER.info(f'Retrieved Pluggable: {_retrieved.id}')

# Number 6.
def test_list_pluggables(pluggables_client: PluggablesClient):
@@ -206,43 +206,43 @@ def test_list_pluggables(pluggables_client: PluggablesClient):
        assert pluggable.id.device.device_uuid.uuid == DEVICE_HUB_UUID                      # pyright: ignore[reportAttributeAccessIssue]
        LOGGER.info(f'Found Pluggable: index={pluggable.id.pluggable_index}')              # pyright: ignore[reportAttributeAccessIssue]

# Number 7.
@pytest.mark.integration
def test_delete_pluggable(pluggables_client: PluggablesClient):
    """Test deleting a pluggable
    
    Requires: Real NETCONF device at 10.30.7.8:2023
    """
    LOGGER.info('Deleting Pluggable...')
    
    # Create a pluggable to delete
    _create_request = create_pluggable_request(
        device_uuid=DEVICE_LEAF_UUID,
        preferred_pluggable_index=2,  # Use index 2 to avoid conflict with test #3
        with_initial_config=True
    )
    _created = pluggables_client.CreatePluggable(_create_request)
    assert _created.id.pluggable_index == 2                                                 # pyright: ignore[reportAttributeAccessIssue]
    
    # Delete it
    _delete_request = create_delete_pluggable_request(
        device_uuid=DEVICE_LEAF_UUID,
        pluggable_index=2
    )
    
    _response = pluggables_client.DeletePluggable(_delete_request)
    assert isinstance(_response, Empty)
    
    # Verify it's deleted
    with pytest.raises(grpc.RpcError) as e:
        _get_request = create_get_pluggable_request(
            device_uuid=DEVICE_LEAF_UUID,
            pluggable_index=2
        )
        pluggables_client.GetPluggable(_get_request)
    
    assert e.value.code() == grpc.StatusCode.NOT_FOUND
    LOGGER.info('Successfully deleted Pluggable and verified removal')
# # Number 7.
# @pytest.mark.integration
# def test_delete_pluggable(pluggables_client: PluggablesClient):
#     """Test deleting a pluggable
    
#     Requires: Real NETCONF device at 10.30.7.8:2023
#     """
#     LOGGER.info('Deleting Pluggable...')
    
#     # Create a pluggable to delete
#     _create_request = create_pluggable_request(
#         device_uuid=DEVICE_LEAF_UUID,
#         preferred_pluggable_index=2,  # Use index 2 to avoid conflict with test #3
#         with_initial_config=True
#     )
#     _created = pluggables_client.CreatePluggable(_create_request)
#     assert _created.id.pluggable_index == 2                                                 # pyright: ignore[reportAttributeAccessIssue]
    
#     # Delete it
#     _delete_request = create_delete_pluggable_request(
#         device_uuid=DEVICE_LEAF_UUID,
#         pluggable_index=2
#     )
    
#     _response = pluggables_client.DeletePluggable(_delete_request)
#     assert isinstance(_response, Empty)
    
#     # Verify it's deleted
#     with pytest.raises(grpc.RpcError) as e:
#         _get_request = create_get_pluggable_request(
#             device_uuid=DEVICE_LEAF_UUID,
#             pluggable_index=2
#         )
#         pluggables_client.GetPluggable(_get_request)
    
#     assert e.value.code() == grpc.StatusCode.NOT_FOUND
#     LOGGER.info('Successfully deleted Pluggable and verified removal')

# Number 8.
def test_pluggable_already_exists_error(pluggables_client: PluggablesClient):