Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snappi is crashing while doing get config, if config contains TCP header #184

Closed
biplamal opened this issue Aug 30, 2022 · 5 comments
Closed
Assignees

Comments

@biplamal
Copy link

E TypeError: property value shall be of type <class 'int'> at <class 'snappi.snappi.PatternFlowTcpSeqNum'>
E got 0 of type <class 'str'> , expected min 0, expected max 4294967295

@biplamal
Copy link
Author

import snappi
import pytest


@pytest.mark.sanity
def test_grpc_http_config(settings):
    """
    - config without port & with flow
    Validate,
    - should fail at set_config
    """
    size, fixed_packets = 1518, 50000

    http_api = snappi.api(location=settings.http_server)

    grpc_api = snappi.api(location=settings.grpc_server,
                          transport=snappi.Transport.GRPC)

    config = new_config(http_api, settings, size, fixed_packets)

    # gRPC setConfig
    res_grpc = grpc_api.set_config(config)
    if len(res_grpc.warnings) > 0:
        print("Warnings: {}".format(res_grpc.warnings))

    res_grpc = grpc_api.get_config()

    # HTTP setConfig
    res_http = http_api.set_config(config)
    if len(res_http.warnings) > 0:
        print("Warnings: {}".format(res_http.warnings))

    res_http = http_api.get_config()

    assert res_http.serialize(
        encoding='dict') == res_grpc.serialize(encoding='dict')


def new_config(api, settings, size, fixed_packets):
    config = api.config()
    tx = config.ports.port(name='tx', location=settings.ports[0])
    ly = config.layer1.layer1(name='l1')[0]

    ly.speed = settings.speed
    ly.promiscuous = settings.promiscuous
    ly.mtu = settings.mtu
    ly.port_names = [tx[0].name]

    flw = config.flows.flow(name='flw')[-1]

    flw.size.fixed = size
    flw.rate.percentage = settings.line_rate
    flw.duration.fixed_packets.packets = fixed_packets
    flw.tx_rx.port.tx_name = tx[0].name

    flw.packet.ethernet().ipv4().tcp()

    return config

@biplamal
Copy link
Author

script to reproduce the issue

@Rangababu-R
Copy link
Contributor

@biplamal
Its issue with models. TCP.Seq.Num is being set to integer type and format is not set to int64. Why does the server returning in string? was it made to int64 type?

@shramroy
Copy link
Contributor

Observation is - Whichever field having
format: integer length: 32
this format causing this issue.
The affected fields are TCP seq_num, ack_num, gtpv1 teid & gtpv2 teid.

@apratimmukherjee
Copy link
Contributor

Its fixed by open-traffic-generator/openapiart#362 as per linked issue so closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants