Code Monkey home page Code Monkey logo

go-p4's People

Contributors

ankur19 avatar dependabot[bot] avatar kjahed avatar lelia avatar mingyangcisco avatar rnhaddad avatar shrutira18 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

go-p4's Issues

Controller does not get the expected Rx packets after increasing the packet qSize

Hi,

After increasing the packet qSize (issue was reported in #5), the Rx packets reported is still less than the expected number of the packets.

Here is the code snippet to set the qSize:
client0Stream0 := leader.StreamChannelGet(&streamName)
if client0Stream0 == nil {
t.Logf("'%s' nil stream", streamName)
}

arbCntrs := client0Stream0.GetArbCounters()
t.Logf("stream '%s' Arbitration Counters RxArbCntr(%d) RxArbCntrDrop(%d) RxArbCntrQueued(%d)",
	streamName, arbCntrs.RxArbCntr, arbCntrs.RxArbCntrDrop, arbCntrs.RxArbCntrQueued)

qSize := 5000
client0Stream0.SetArbQSize(qSize)
qSizeRead := client0Stream0.GetArbQSize()
if qSize != qSizeRead {
	t.Logf("Stream '%s' expecting Arbitration qSize(%d) Got (%d)",
		streamName, qSize, qSizeRead)
}
pktCntrs := client0Stream0.GetPacketCounters()
t.Logf("stream '%s' Packet Counters RxPktCntr(%d) RxPktCntrDrop(%d) RxPktCntrQueued(%d)",
	streamName, pktCntrs.RxPktCntr, pktCntrs.RxPktCntrDrop, pktCntrs.RxPktCntrQueued)

client0Stream0.SetPacketQSize(qSize)
qSizeRead = client0Stream0.GetPacketQSize()
t.Logf(" qSizeRead is %d", qSizeRead)

if qSize != qSizeRead {
	t.Logf("Stream '%s' expecting Packet qSize(%d) Got (%d)",
		streamName, qSize, qSizeRead)
}

After the ATE sent more than 1496 packets (GDP and LLDP packets), the packet received reported from the controller is around 331, and no drop packets reported.

This is the snippet of the code to get the RxPktCtr .

// get the packet counters
client0Stream0 := client.StreamChannelGet(&streamName)
pktCntrs := client0Stream0.GetPacketCounters()
t.Logf("stream '%s' Packet Counters RxPktCntr(%d) RxPktCntrDrop(%d) RxPktCntrQueued(%d)",
streamName, pktCntrs.RxPktCntr, pktCntrs.RxPktCntrDrop, pktCntrs.RxPktCntrQueued)

Script run output is shown as below:

// get the packet counters
client0Stream0 := client.StreamChannelGet(&streamName)
pktCntrs := client0Stream0.GetPacketCounters()
t.Logf("stream '%s' Packet Counters RxPktCntr(%d) RxPktCntrDrop(%d) RxPktCntrQueued(%d)",
streamName, pktCntrs.RxPktCntr, pktCntrs.RxPktCntrDrop, pktCntrs.RxPktCntrQueued)

=== RUN TestPacketIn/PacketIn_to_Primary_Controller
p4rt_61_test.go:317: packets len is 0
p4rt_61_test.go:317: stream 'p4rt' Packet Counters RxPktCntr(329) RxPktCntrDrop(0) RxPktCntrQueued(329)
p4rt_61_test.go:318: packets len is 331. <<<<<<<<<<<<<<<<
p4rt_61_test.go:327: Start to decode packet and compare with expected packets.
=== CONT TestPacketIn
p4rt_61_test.go:390: gdpPacketNo is '221'. <<<<<<<<<<<<<<
p4rt_61_test.go:391: lldpPacketNo is '110'. <<<<<<<<<<<<<<<
--- PASS: TestPacketIn (426.50s)
--- PASS: TestPacketIn/PacketIn_to_Primary_Controller (0.01s)
PASS

*** Releasing the testbed...

*** PROPERTY: time.end -> 1671229848
*** PROPERTY: time.begin -> 1671229391

Thanks,

Sharon

StreamChannelGetPacket returned less packets than expected

When I use the below function to get the packets received from the Cisco controller for PacketIn packets, the returned value is less than expected.

The total number sent from ATE is 3000 packets. but the received from the function is 100

client.StreamChannelGetPacket(&streamName, 0)

Can this function add the loss packets?

thanks,

Sharon

P4InfoLoad returns a message by value not pointer

Description

The P4InfoLoad function returns a P4Info struct by value instead of by pointer:

func P4InfoLoad(fileName *string) (p4_v1_config.P4Info, error) {

The style guide says protocol buffer messages should be passed by pointer:
https://google.github.io/styleguide/go/decisions.html#pass-values

One problem is that it causes the mutex in the struct to be copied, which is forbidden:
https://google.github.io/styleguide/go/decisions.html#copying

Another problem is that the returned value does not satisfy the proto.Message interface.

Expected Behavior

It should return the type *p4_v1_config.P4Info

Actual Behavior

It returns the type p4_v1_config.P4Info

Affected Version

v0.1.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.