Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • forge forge
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • forgeforge
  • Merge requests
  • !310

fix missing received values when checking option

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Andrei Pavel requested to merge response_check_include_option into master Sep 09, 2022
  • Overview 1
  • Commits 2
  • Pipelines 1
  • Changes 2
  • 59b6721a fix missing received values when checking option

    For example, an error would say:

    AssertionError: Invalid server_id[54] option received:  but expected 10.0.122.32

    The empty received value does not mean that the option is not there. The error would have been different if that was the case. There is a received value, but forge does not know how to display it.

    This change turns the error into:

    AssertionError: Invalid server_id[54] option received: ('server_id', '10.0.122.70') but expected 10.0.122.32

    It's not the best, but at least it is clear what the value difference is.

    It would be easy to only display the value like for other options, but with all the if-statements that check for specific code options, I don't know how to make it work without breaking the code for other options...

  • 1f9971b5 show the entire packet when checking fields

    • For easier debugging when this situation happens again

Here's a test that you can use to test these changes with. It should fail on the last line.

@pytest.mark.v4
def test_debug():
    misc.test_setup()
    srv_control.define_temporary_lease_db_backend('memfile')
    srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_msg.client_requests_option(1)
    srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:11:11:22')
    srv_msg.client_send_msg('DISCOVER')

    srv_msg.send_wait_for_message('MUST', 'OFFER')
    srv_msg.response_check_include_option(1)
    srv_msg.response_check_content('yiaddr', '192.168.50.1')
    srv_msg.response_check_option_content(1, 'value', '255.255.255.0')

    srv_msg.client_copy_option('server_id')
    srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:11:11:22')
    srv_msg.client_does_include_with_value('requested_addr', '192.168.50.1')
    srv_msg.client_requests_option(1)
    srv_msg.client_send_msg('REQUEST')

    srv_msg.send_wait_for_message('MUST', 'ACK')
    srv_msg.response_check_content('yiaddr', '192.168.50.1')
    srv_msg.response_check_option_content(1, 'value', '255.255.255.0')
    srv_msg.response_check_option_content(54, 'value', 'whatever')
Edited Sep 12, 2022 by Andrei Pavel
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: response_check_include_option