Skip to content

Commit

Permalink
ovn: Clear dynamic_addresses when addresses are not "dynamic"
Browse files Browse the repository at this point in the history
When a logical switch port changes to no longer use "dynamic" addresses,
then the dynamic_addresses should be cleared.

Reported-by: Girish Moodalbail <[email protected]>
Signed-off-by: Mark Michelson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
putnopvut authored and blp committed Jan 16, 2019
1 parent edfe8d2 commit dcad447
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ovn/northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ build_ipam(struct hmap *datapaths, struct hmap *ports)
}
}

if (!nbsp->n_addresses && nbsp->dynamic_addresses) {
if (!num_dynamic_addresses && nbsp->dynamic_addresses) {
nbrec_logical_switch_port_set_dynamic_addresses(nbsp, NULL);
}
}
Expand Down
19 changes: 19 additions & 0 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -12015,3 +12015,22 @@ AT_CHECK([sort hv1/br-phys-tx4.pcap], [0], [expout])

OVN_CLEANUP([hv1])
AT_CLEANUP

AT_SETUP([ovn -- ipam to non-ipam])
ovn_start

ovn-nbctl ls-add sw0
ovn-nbctl lsp-add sw0 p0 -- lsp-set-addresses p0 dynamic
ovn-nbctl --wait=sb add Logical-Switch sw0 other_config subnet=192.168.1.0/24

AT_CHECK([ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses], [0],
["0a:00:00:a8:01:03 192.168.1.2"
])

ovn-nbctl lsp-set-addresses p0 router

ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses

AT_CHECK([ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses], [0], [[[]]
])
AT_CLEANUP

0 comments on commit dcad447

Please sign in to comment.