open-traffic-generator / models

Open Traffic Generator Core Models
https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/open-traffic-generator/models/master/artifacts/openapi.yaml&nocors
MIT License
60 stars 16 forks source link

Support for SNMPv3 Packet Header (Data Plane Only) #366

Open biplamal opened 5 months ago

biplamal commented 5 months ago

Redocly View: ReDoc Interactive Demo (redocly.github.io) ( New object at : set_config/flows/packet/snmpv3 )

SNMPv3-RFC3412 USM-RFC2274 USM-SNMPv3-RFC2574

Requirement: The user able to define SNMPv3 data plane packet headers. Purpose is to flood DUT with SNMPv3 request and responses. The user should be able to configure different fields in Global Data, Security Parameters and Data with ability to specify Increment/Decrement operations on certain applicable fields in the specified fields.

Example usage:

        f1 := config.Flows().Items()[0]
    f1.SetName("flow-snmpv3").
        TxRx().Port().SetTxName("port1").SetRxName("port2")

    f1.Duration().FixedPackets().SetPackets(100)
    f1.Rate().SetPps(10)

    f1.Packet().Add().Ethernet()
    f1.Packet().Add().Ipv4()
    f1.Packet().Add().Tcp()

    // SNMPv3 Header
    flowSnmpv3 := f1.Packet().Add().Snmpv3()

    // Version
    flowSnmpv3.Version().SetValue(3)

    // Global Data
    globalData := flowSnmpv3.GlobalData()
    globalData.Id().SetValue(1)
    globalData.MaxSize().SetValue(100)
    globalData.Flags().
        SetReportable(true)
    globalData.SecurityModel().SetValue(1)

    // Security Parameters

    // No Authentication
    securityParams := flowSnmpv3.SecurityParameters()
    securityParams.SetAuthoritativeEngineId("80004f4db1aadcadbc89affa118dbd53824c6b05")
    securityParams.AuthoritativeEngineBoots().SetValue(3)
    securityParams.AuthoritativeEngineTime().SetValue(68125)
    securityParams.SetUserName("tchyon")

    // Data
    plainText := flowSnmpv3.ScopedData()
    plainText.SetContextName("tchyon")
    plainText.SetContextEngineId("80004f4db1aadcadbc89affa118dbd53824c6b05")
    pdu := plainText.Data().GetRequest()
    pdu.RequestId().SetValue(722681733)
    pdu.SetErrorStatus(gosnappi.FlowSnmpv2CPDUErrorStatus.WRONG_VALUE)
    pdu.ErrorIndex().SetValue(0)
    varBinds := pdu.VariableBindings().Add()
    varBinds.SetObjectIdentifier("0.1")
    varBinds.Value().TimeticksValue().SetValue(20)

    // Authentication

    md5 := securityParams.AuthenticationParameters().Md5()
    md5.SetPassword("abcd")