[P4-dev] how to add forwarding state to a behavior model

Antonin Bas antonin at barefootnetworks.com
Thu Jul 23 16:30:12 EDT 2015

Hi Brian,

switch-control.sh was created only for the sake of the demo. It only worked
for one specific P4 program (I believe it was simple_router.p4). In the
general case, you don't know which features are implemented in a P4
program, what are the tables names, what are the action names... so you
cannot provide an API "add_arp" that will work for any arbitrary P4
program. This is why you have to use the CLI. The CLI code calls into the
PD API, which is generated from the P4 program. To start the CLI, you have
to run run_cli.bash. You can then populate the tables with commands like:
add_entry *table_name* *match_parameters* *action_names*

In the demo you refer to, I believe add_arp was actually invoking the CLI
with a command like this:
add_entry send_frame 1 rewrite_mac 00:aa:bb:00:00:00

Let us know if you need more help,


On Thu, Jul 23, 2015 at 1:13 PM, brian fiegen <brianfiegen at gmail.com> wrote:

> I've pulled the p4factory code and have setup two name spaces.  I've
> created and configured an interface in each name space that are in the same
> L3 subnet.  I've then gone into the switch target and run make and thus
> created the behavior-model.  I then start the behavior-model with the
> interfaces for each name space.   If I then ping from one name space to the
> other, my pings time out-- which is expected given that I haven't pushed
> and forwarding state into the model.
> I was watching the video that shows a similar setup though using mininet
> and LJ uses a command called "switch-control.sh" which takes as stdin
> commands called "add_arp", "set_iface_mac" etc.  I was hoping to use this
> mechanism to load the state in my behavior model but the switch-control.sh
> does not seem to be part of the p4factory distro.   I know there's a
> process listening on port 9090 that I'm guessing can be used to install
> state into the model but haven't figured out the syntax for talking to that
> process.  I also found a script in the distro (run_cli.bash or something)
> that will get me to a CLI but the commands there don't match the ones being
> feed into this switch_control.sh script.
> So what would be a simple / easy way for me to push forwarding info into a
> behavior model?
> Thanks
> _______________________________________________
> P4-dev mailing list
> P4-dev at p4.org
> Listinfo - http://mail.p4.org/mailman/listinfo/p4-dev_p4.org
> Archives - http://mail.p4.org/pipermail/p4-dev_p4.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150723/8dc9c965/attachment-0001.html>

More information about the P4-dev mailing list