Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
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))
#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
#echo "ovn-nbctl add Port_group ${pg_name} ports ${lsp_uuid}"
ovn-nbctl --wait=sb add Port_group ${pg_name} ports ${lsp_uuid}

This comment has been minimized.

Copy link

@ryzhyk ryzhyk commented Jul 18, 2019

How do you change the script to run with DDlog?


This comment has been minimized.

Copy link
Owner Author

@putnopvut putnopvut commented Jul 18, 2019


This comment has been minimized.

Copy link

@ryzhyk ryzhyk commented Jul 19, 2019

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