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

README.md for Python Tools #8

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions fboss/agent/tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FBOSS Python Tools
=========================

Requirements:

apt-get install python-ipaddr python-thrift thrift-compiler
export FBOSS=/path/to/base/of/code

Generate the python bindings from the thrift files:

cd $FBOSS/fboss/agent/if
for p in *.thrift; do
thrift -I $FBOSS -r --gen py $p
echo $p done
done


######
# Apply a couple of fixups (fixups or ???)

Dodge the "can't find generator 'cpp2' error"

sed -i -e '^namespace cpp2 facebook.fboss/#namespace cpp2 facebook.fboss/' \
$FBOSS/fboss/agent/if/*.thrift
fboss.agent doesn't exist, but fboss.ctrl does

sed -i -e 's/^from fboss.agent/from fboss.ctrl/' \
$FBOSS/fboss/agent/tools/fboss_route.py


Now run the fboss_route command:

export FBOSS_IF=$FBOSS/fboss/agent/if/gen-py
PYTHONPATH=$FBOSS_IF/neteng/:$FBOSS/external/fbthrift/thrift/lib/py:$FBOSS_IF/:$FBOSS/external/fbthrift/thrift/lib/py python fboss_route.py


For example:

export FBOSS_IF=$FBOSS/fboss/agent/if/gen-py
export PYTHONPATH=$FBOSS_IF/neteng/:$FBOSS/external/fbthrift/thrift/lib/py:$FBOSS_IF/:$FBOSS/external/fbthrift/thrift/lib/py
python fboss_route.py host add 172.31.0.0/24 172.16.1.1