Git Product home page Git Product logo

bal_pcap's Introduction

bal_pcap

To decode bal voltha adapter grpc packets. The GRPC bal packet is encoded as a HTTP2/protobuf packet.

In order to deserialize the protobuf packet, we need to decode the field/tag:value binary format which is cool and optimized encoding.

However we also would need to map it to the grpc descriptor out.

Do you really want to replicate Jeff Dean's brilliance? :)

We just reverse engineer the bal api packet using the logic from which it was created.

We run it against the bal_pb2 serializer based on the Path/object we are parsing. And then dump the packet.

Right now, it supports BalInit, BalCfgSet,BalHeartbeat and BalIndications which should make for a good starting line up.

The packet capture asfvolt16.pcap here was created using my bal_voltha project at:

http://github.com/karthick18/bal_voltha and simulating a run of activation with bal edge core.

To quick test: make run and watch it decode asfvolt16.pcap sample.

In order to generate the pcap in a real environment, just run a tcpdump against the bal grpc and indications port.

Like:

tcpdump -i any -w ~/asf.pcap port 50051 or port 60001
make run
./bal_pcap.py asfvolt16.pcap
BalApiInit
----------------------------------------
voltha_adapter_ip_port: "172.17.0.1:60001"

----------------------------------------
BalCfgSet
----------------------------------------
hdr {
}
cfg {
  key {
  }
  data {
    admin_state: BAL_STATE_UP
  }
}
device_id: "0001cb6cfb7b3ffb"

----------------------------------------
BalApiHeartbeat
----------------------------------------
device_id: "0001cb6cfb7b3ffb"

----------------------------------------

In order to decode the packets in real-time as they are captured by tcpdump, do the following:

sudo tcpdump -i any -w /tmp/bal_stream.pcap -xxx -vvv -U -p tcp port 50051 or port 60001

And on another shell:

./bal_pcap.py --pcap /tmp/bal_stream.pcap --stream

And watch the BAL grpc packets being decoded as they arrive.

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.