Created
July 18, 2019 17:12
-
-
Save putnopvut/3df7156b6d44b81d75a598262c5e959b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export OVN_NB_DAEMON=$(ovn-nbctl --pidfile --detach) | |
# Create router | |
ovn-nbctl lr-add router | |
# Create switches | |
for i in $(seq 1 159); do | |
j=$(printf '%02x' $i) | |
ovn-nbctl ls-add ls$i | |
ovn-nbctl lsp-add ls$i lsp-ro$i | |
ovn-nbctl lrp-add router ro-lsp$i 00:00:00:00:00:$j 10.0.0.$i/16 | |
ovn-nbctl set Logical_Switch_Port lsp-ro$i options:router-port=ro-lsp$i type=router addresses=router | |
done | |
for i in $(seq 1 92); do | |
for j in $(seq 1 159); do | |
k=$(printf '%02x' $i) | |
l=$(printf '%02x' $j) | |
create_pg=$((($j - 1) % 4)) | |
pg_index=$((($j - 1) / 4)) | |
pg_name=${i}_${pg_index} | |
lsp_name=lsp${j}_10.$i.0.$j | |
#echo "lsp-add ls$j ${lsp_name}" | |
lsp_uuid=$(ovn-nbctl --id=@id create logical_switch_port name=${lsp_name} -- add logical_switch ls$j ports @id) | |
#echo "lsp-set-addresses ${lsp_name} \"00:00:00:00:$k:$l 10.$i.0.$j\"" | |
ovn-nbctl lsp-set-addresses ${lsp_name} "00:00:00:00:$k:$l 10.$i.0.$j" | |
if [ $create_pg -eq 0 ]; then | |
#echo "ovn-nbctl create Port_Group name=${pg_name} ports=${lsp_uuid}" | |
ovn-nbctl create Port_Group name=${pg_name} ports=${lsp_uuid} 1> /dev/null | |
#echo "Create in-pod acl allow" | |
ovn-nbctl --type=port-group acl-add ${pg_name} to-lport 1000 "outport == \@${pg_name} && ip4.src == \$${pg_name}_ip4" allow | |
#echo "Create drop acl" | |
ovn-nbctl --wait=sb --type=port-group acl-add ${pg_name} to-lport 900 "outport == \@${pg_name}" drop | |
else | |
#echo "ovn-nbctl add Port_group ${pg_name} ports ${lsp_uuid}" | |
ovn-nbctl --wait=sb add Port_group ${pg_name} ports ${lsp_uuid} | |
fi | |
done | |
done |
Hi Leonid.
I run this script in the OVS sandbox. If you start the sandbox with:
make sandbox SANDBOXFLAGS="--ovn"
Then the sandbox is started with the C-based ovn-northd. If you start the
sandbox with:
make sandbox SANDBOXFLAGS="--ovn --ddlog"
Then the sandbox is started with the ddlog-based ovn-northd-ddlog. The
script doesn't require a change when the northd implementation changes
since it just uses ovn-nbctl.
…On Thu, Jul 18, 2019 at 1:51 PM Leonid Ryzhyk ***@***.***> wrote:
How do you change the script to run with DDlog?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/3df7156b6d44b81d75a598262c5e959b?email_source=notifications&email_token=AAKELTV2OEWX4R2XVKZ7FE3QACUTFA5CNFSM4IE6FMZKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFVRHQ#gistcomment-2974328>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKELTXLXGZBMN5YPNROE4TQACUTFANCNFSM4IE6FMZA>
.
Thanks! I was able to reproduce the experiment by following your instructions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you change the script to run with DDlog?