2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 05:47:55 +00:00

ovn-nbctl: Update logical switch port commands.

A few minor changes related to logical switch port commands:

    - Use "lsp" instead of "lport" to be more consistent with later
      changes.
    - Use commands where possible in ovn unit tests.
    - Update references from "lport" to "lsp" (code) or "port" (user).

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Justin Pettit 2016-06-07 16:43:34 -07:00
parent 80f408f4cf
commit 31ed1192e2
19 changed files with 409 additions and 406 deletions

View File

@ -157,7 +157,7 @@ Docker currently does not have a CLI command to list all your logical ports.
But you can look at them in the OVN database, by running: But you can look at them in the OVN database, by running:
``` ```
ovn-nbctl --db=tcp:$CENTRAL_IP:6640 lport-list $NID ovn-nbctl --db=tcp:$CENTRAL_IP:6640 lsp-list $NID
``` ```
* You can also create a logical port and attach it to a running container. * You can also create a logical port and attach it to a running container.

View File

@ -228,9 +228,9 @@ def create_endpoint():
mac_address_output = "" mac_address_output = ""
try: try:
ovn_nbctl("lport-add", nid, eid) ovn_nbctl("lsp-add", nid, eid)
except Exception as e: except Exception as e:
error = "create_endpoint: lport-add (%s)" % (str(e)) error = "create_endpoint: lsp-add (%s)" % (str(e))
return jsonify({'Err': error}) return jsonify({'Err': error})
if not mac_address_input: if not mac_address_input:
@ -243,10 +243,10 @@ def create_endpoint():
mac_address = mac_address_input mac_address = mac_address_input
try: try:
ovn_nbctl("lport-set-addresses", eid, ovn_nbctl("lsp-set-addresses", eid,
mac_address + " " + ip_address) mac_address + " " + ip_address)
except Exception as e: except Exception as e:
error = "create_endpoint: lport-set-addresses (%s)" % (str(e)) error = "create_endpoint: lsp-set-addresses (%s)" % (str(e))
return jsonify({'Err': error}) return jsonify({'Err': error})
# Only return a mac address if one did not come as request. # Only return a mac address if one did not come as request.
@ -295,7 +295,8 @@ def show_endpoint():
if error: if error:
jsonify({'Err': error}) jsonify({'Err': error})
except Exception as e: except Exception as e:
error = "show_endpoint: get Logical_Switch_Port addresses. (%s)" % (str(e)) error = "show_endpoint: get Logical_Switch_Port addresses. (%s)" \
% (str(e))
return jsonify({'Err': error}) return jsonify({'Err': error})
veth_outside = eid[0:15] veth_outside = eid[0:15]
@ -321,9 +322,9 @@ def delete_endpoint():
abort(400) abort(400)
try: try:
ovn_nbctl("lport-del", eid) ovn_nbctl("lsp-del", eid)
except Exception as e: except Exception as e:
error = "delete_endpoint: lport-del %s" % (str(e)) error = "delete_endpoint: lsp-del %s" % (str(e))
return jsonify({'Err': error}) return jsonify({'Err': error})
return jsonify({}) return jsonify({})

View File

@ -94,17 +94,17 @@
</dd> </dd>
</dl> </dl>
<h1>Logical Port Commands</h1> <h1>Logical Switch Port Commands</h1>
<dl> <dl>
<dt>[<code>--may-exist</code>] <code>lport-add</code> <var>lswitch</var> <var>lport</var></dt> <dt>[<code>--may-exist</code>] <code>lsp-add</code> <var>lswitch</var> <var>port</var></dt>
<dd> <dd>
<p> <p>
Creates on <var>lswitch</var> a new logical port named Creates on <var>lswitch</var> a new logical switch port named
<var>lport</var>. <var>port</var>.
</p> </p>
<p> <p>
It is an error if a logical port named <var>lport</var> already It is an error if a logical port named <var>port</var> already
exists, unless <code>--may-exist</code> is specified. Regardless of exists, unless <code>--may-exist</code> is specified. Regardless of
<code>--may-exist</code>, it is an error if the existing port is in <code>--may-exist</code>, it is an error if the existing port is in
some logical switch other than <var>lswitch</var> or if it has a some logical switch other than <var>lswitch</var> or if it has a
@ -112,19 +112,19 @@
</p> </p>
</dd> </dd>
<dt>[<code>--may-exist</code>] <code>lport-add</code> <var>lswitch</var> <var>lport</var> <var>parent</var> <var>tag</var></dt> <dt>[<code>--may-exist</code>] <code>lsp-add</code> <var>lswitch</var> <var>port</var> <var>parent</var> <var>tag</var></dt>
<dd> <dd>
<p> <p>
Creates on <var>lswitch</var> a logical port named <var>lport</var> Creates on <var>lswitch</var> a logical switch port named
that is a child of <var>parent</var> that is identifed with VLAN ID <var>port</var> that is a child of <var>parent</var> that is
<var>tag</var>. This is useful in cases such as virtualized identifed with VLAN ID <var>tag</var>. This is useful in
container environments where Open vSwitch does not have a direct cases such as virtualized container environments where Open
connection to the container's port and it must be shared with vSwitch does not have a direct connection to the container's
the virtual machine's port. port and it must be shared with the virtual machine's port.
</p> </p>
<p> <p>
It is an error if a logical port named <var>lport</var> already It is an error if a logical port named <var>port</var> already
exists, unless <code>--may-exist</code> is specified. Regardless of exists, unless <code>--may-exist</code> is specified. Regardless of
<code>--may-exist</code>, it is an error if the existing port is not <code>--may-exist</code>, it is an error if the existing port is not
in <var>lswitch</var> or if it does not have the specified in <var>lswitch</var> or if it does not have the specified
@ -132,55 +132,55 @@
</p> </p>
</dd> </dd>
<dt>[<code>--if-exists</code>] <code>lport-del</code> <var>lport</var></dt> <dt>[<code>--if-exists</code>] <code>lsp-del</code> <var>port</var></dt>
<dd> <dd>
Deletes <var>lport</var>. It is an error if <var>lport</var> does Deletes <var>port</var>. It is an error if <var>port</var> does
not exist, unless <code>--if-exists</code> is specified. not exist, unless <code>--if-exists</code> is specified.
</dd> </dd>
<dt><code>lport-list</code> <var>lswitch</var></dt> <dt><code>lsp-list</code> <var>lswitch</var></dt>
<dd> <dd>
Lists all the logical ports within <var>lswitch</var> on Lists all the logical switch ports within <var>lswitch</var> on
standard output, one per line. standard output, one per line.
</dd> </dd>
<dt><code>lport-get-parent</code> <var>lport</var></dt> <dt><code>lsp-get-parent</code> <var>port</var></dt>
<dd> <dd>
If set, get the parent port of <var>lport</var>. If not set, print If set, get the parent port of <var>port</var>. If not set, print
nothing. nothing.
</dd> </dd>
<dt><code>lport-get-tag</code> <var>lport</var></dt> <dt><code>lsp-get-tag</code> <var>port</var></dt>
<dd> <dd>
If set, get the tag for <var>lport</var> traffic. If not set, print If set, get the tag for <var>port</var> traffic. If not set, print
nothing. nothing.
</dd> </dd>
<dt><code>lport-set-addresses</code> <var>lport</var> [<var>address</var>]...</dt> <dt><code>lsp-set-addresses</code> <var>port</var> [<var>address</var>]...</dt>
<dd> <dd>
Sets the addresses associated with <var>lport</var> to Sets the addresses associated with <var>port</var> to
<var>address</var>. Each <var>address</var> should be either an <var>address</var>. Each <var>address</var> should be either an
Ethernet address or an Ethernet address followed by an IP address Ethernet address or an Ethernet address followed by an IP address
(separated by a space and quoted to form a single command-line (separated by a space and quoted to form a single command-line
argument). The special form <code>unknown</code> is also valid. argument). The special form <code>unknown</code> is also valid.
Multiple Ethernet addresses or Ethernet+IP pairs may be set. If no Multiple Ethernet addresses or Ethernet+IP pairs may be set. If no
<var>address</var> argument is given, <var>lport</var> will have no <var>address</var> argument is given, <var>port</var> will have no
addresses associated with it. addresses associated with it.
</dd> </dd>
<dt><code>lport-get-addresses</code> <var>lport</var></dt> <dt><code>lsp-get-addresses</code> <var>port</var></dt>
<dd> <dd>
Lists all the addresses associated with <var>lport</var> on standard Lists all the addresses associated with <var>port</var> on standard
output, one per line. output, one per line.
</dd> </dd>
<dt><code>lport-set-port-security</code> <var>lport</var> [<var>addrs</var>]...</dt> <dt><code>lsp-set-port-security</code> <var>port</var> [<var>addrs</var>]...</dt>
<dd> <dd>
<p> <p>
Sets the port security addresses associated with <var>lport</var> to Sets the port security addresses associated with <var>port</var> to
<var>addrs</var>. Multiple sets of addresses may be set by using <var>addrs</var>. Multiple sets of addresses may be set by using
multiple <var>addrs</var> arguments. If no <var>addrs</var> argument multiple <var>addrs</var> arguments. If no <var>addrs</var> argument
is given, <var>lport</var> will not have port security enabled. is given, <var>port</var> will not have port security enabled.
</p> </p>
<p> <p>
@ -192,47 +192,47 @@
</p> </p>
</dd> </dd>
<dt><code>lport-get-port-security</code> <var>lport</var></dt> <dt><code>lsp-get-port-security</code> <var>port</var></dt>
<dd> <dd>
Lists all the port security addresses associated with <var>lport</var> Lists all the port security addresses associated with <var>port</var>
on standard output, one per line. on standard output, one per line.
</dd> </dd>
<dt><code>lport-get-up</code> <var>lport</var></dt> <dt><code>lsp-get-up</code> <var>port</var></dt>
<dd> <dd>
Prints the state of <var>lport</var>, either <code>up</code> or Prints the state of <var>port</var>, either <code>up</code> or
<code>down</code>. <code>down</code>.
</dd> </dd>
<dt><code>lport-set-enabled</code> <var>lport</var> <var>state</var></dt> <dt><code>lsp-set-enabled</code> <var>port</var> <var>state</var></dt>
<dd> <dd>
Set the administrative state of <var>lport</var>, either <code>enabled</code> Set the administrative state of <var>port</var>, either <code>enabled</code>
or <code>disabled</code>. When a port is disabled, no traffic is allowed into or <code>disabled</code>. When a port is disabled, no traffic is allowed into
or out of the port. or out of the port.
</dd> </dd>
<dt><code>lport-get-enabled</code> <var>lport</var></dt> <dt><code>lsp-get-enabled</code> <var>port</var></dt>
<dd> <dd>
Prints the administrative state of <var>lport</var>, either <code>enabled</code> Prints the administrative state of <var>port</var>, either <code>enabled</code>
or <code>disabled</code>. or <code>disabled</code>.
</dd> </dd>
<dt><code>lport-set-type</code> <var>lport</var> <var>type</var></dt> <dt><code>lsp-set-type</code> <var>port</var> <var>type</var></dt>
<dd> <dd>
Set the type for the logical port. No special types have been implemented yet. Set the type for the logical port. No special types have been implemented yet.
</dd> </dd>
<dt><code>lport-get-type</code> <var>lport</var></dt> <dt><code>lsp-get-type</code> <var>port</var></dt>
<dd> <dd>
Get the type for the logical port. Get the type for the logical port.
</dd> </dd>
<dt><code>lport-set-options</code> <var>lport</var> [<var>key=value</var>]...</dt> <dt><code>lsp-set-options</code> <var>port</var> [<var>key=value</var>]...</dt>
<dd> <dd>
Set type-specific key-value options for the logical port. Set type-specific key-value options for the logical port.
</dd> </dd>
<dt><code>lport-get-options</code> <var>lport</var></dt> <dt><code>lsp-get-options</code> <var>port</var></dt>
<dd> <dd>
Get the type-specific options for the logical port. Get the type-specific options for the logical port.
</dd> </dd>

View File

@ -308,31 +308,31 @@ ACL commands:\n\
acl-list LSWITCH print ACLs for LSWITCH\n\ acl-list LSWITCH print ACLs for LSWITCH\n\
\n\ \n\
Logical switch port commands:\n\ Logical switch port commands:\n\
lport-add LSWITCH LPORT add logical port LPORT on LSWITCH\n\ lsp-add LSWITCH PORT add logical port PORT on LSWITCH\n\
lport-add LSWITCH LPORT PARENT TAG\n\ lsp-add LSWITCH PORT PARENT TAG\n\
add logical port LPORT on LSWITCH with PARENT\n\ add logical port PORT on LSWITCH with PARENT\n\
on TAG\n\ on TAG\n\
lport-del LPORT delete LPORT from its attached switch\n\ lsp-del PORT delete PORT from its attached switch\n\
lport-list LSWITCH print the names of all logical ports on LSWITCH\n\ lsp-list LSWITCH print the names of all logical ports on LSWITCH\n\
lport-get-parent LPORT get the parent of LPORT if set\n\ lsp-get-parent PORT get the parent of PORT if set\n\
lport-get-tag LPORT get the LPORT's tag if set\n\ lsp-get-tag PORT get the PORT's tag if set\n\
lport-set-addresses LPORT [ADDRESS]...\n\ lsp-set-addresses PORT [ADDRESS]...\n\
set MAC or MAC+IP addresses for LPORT.\n\ set MAC or MAC+IP addresses for PORT.\n\
lport-get-addresses LPORT get a list of MAC addresses on LPORT\n\ lsp-get-addresses PORT get a list of MAC addresses on PORT\n\
lport-set-port-security LPORT [ADDRS]...\n\ lsp-set-port-security PORT [ADDRS]...\n\
set port security addresses for LPORT.\n\ set port security addresses for PORT.\n\
lport-get-port-security LPORT get LPORT's port security addresses\n\ lsp-get-port-security PORT get PORT's port security addresses\n\
lport-get-up LPORT get state of LPORT ('up' or 'down')\n\ lsp-get-up PORT get state of PORT ('up' or 'down')\n\
lport-set-enabled LPORT STATE\n\ lsp-set-enabled PORT STATE\n\
set administrative state LPORT\n\ set administrative state PORT\n\
('enabled' or 'disabled')\n\ ('enabled' or 'disabled')\n\
lport-get-enabled LPORT get administrative state LPORT\n\ lsp-get-enabled PORT get administrative state PORT\n\
('enabled' or 'disabled')\n\ ('enabled' or 'disabled')\n\
lport-set-type LPORT TYPE Set the type for LPORT\n\ lsp-set-type PORT TYPE set the type for PORT\n\
lport-get-type LPORT Get the type for LPORT\n\ lsp-get-type PORT get the type for PORT\n\
lport-set-options LPORT KEY=VALUE [KEY=VALUE]...\n\ lsp-set-options PORT KEY=VALUE [KEY=VALUE]...\n\
Set options related to the type of LPORT\n\ set options related to the type of PORT\n\
lport-get-options LPORT Get the type specific options for LPORT\n\ lsp-get-options PORT get the type specific options for PORT\n\
\n\ \n\
Logical router commands:\n\ Logical router commands:\n\
lr-add [ROUTER] create a logical router named ROUTER\n\ lr-add [ROUTER] create a logical router named ROUTER\n\
@ -673,7 +673,7 @@ nbctl_lsp_add(struct ctl_context *ctx)
ctl_fatal("%s: invalid tag", ctx->argv[4]); ctl_fatal("%s: invalid tag", ctx->argv[4]);
} }
} else { } else {
ctl_fatal("lport-add with parent must also specify a tag"); ctl_fatal("lsp-add with parent must also specify a tag");
} }
const char *lsp_name = ctx->argv[2]; const char *lsp_name = ctx->argv[2];
@ -681,7 +681,7 @@ nbctl_lsp_add(struct ctl_context *ctx)
lsp = lsp_by_name_or_uuid(ctx, lsp_name, false); lsp = lsp_by_name_or_uuid(ctx, lsp_name, false);
if (lsp) { if (lsp) {
if (!may_exist) { if (!may_exist) {
ctl_fatal("%s: an lport with this name already exists", ctl_fatal("%s: a port with this name already exists",
lsp_name); lsp_name);
} }
@ -689,29 +689,29 @@ nbctl_lsp_add(struct ctl_context *ctx)
lsw = lsp_to_lswitch(ctx->idl, lsp); lsw = lsp_to_lswitch(ctx->idl, lsp);
if (lsw != lswitch) { if (lsw != lswitch) {
char uuid_s[UUID_LEN + 1]; char uuid_s[UUID_LEN + 1];
ctl_fatal("%s: lport already exists but in lswitch %s", lsp_name, ctl_fatal("%s: port already exists but in lswitch %s", lsp_name,
lswitch_get_name(lsw, uuid_s, sizeof uuid_s)); lswitch_get_name(lsw, uuid_s, sizeof uuid_s));
} }
if (parent_name) { if (parent_name) {
if (!lsp->parent_name) { if (!lsp->parent_name) {
ctl_fatal("%s: lport already exists but has no parent", ctl_fatal("%s: port already exists but has no parent",
lsp_name); lsp_name);
} else if (strcmp(parent_name, lsp->parent_name)) { } else if (strcmp(parent_name, lsp->parent_name)) {
ctl_fatal("%s: lport already exists with different parent %s", ctl_fatal("%s: port already exists with different parent %s",
lsp_name, lsp->parent_name); lsp_name, lsp->parent_name);
} }
if (!lsp->n_tag) { if (!lsp->n_tag) {
ctl_fatal("%s: lport already exists but has no tag", ctl_fatal("%s: port already exists but has no tag",
lsp_name); lsp_name);
} else if (lsp->tag[0] != tag) { } else if (lsp->tag[0] != tag) {
ctl_fatal("%s: lport already exists with different " ctl_fatal("%s: port already exists with different "
"tag %"PRId64, lsp_name, lsp->tag[0]); "tag %"PRId64, lsp_name, lsp->tag[0]);
} }
} else { } else {
if (lsp->parent_name) { if (lsp->parent_name) {
ctl_fatal("%s: lport already exists but has parent %s", ctl_fatal("%s: port already exists but has parent %s",
lsp_name, lsp->parent_name); lsp_name, lsp->parent_name);
} }
} }
@ -2084,36 +2084,32 @@ static const struct ctl_command_syntax nbctl_commands[] = {
{ "acl-list", 1, 1, "LSWITCH", NULL, nbctl_acl_list, NULL, "", RO }, { "acl-list", 1, 1, "LSWITCH", NULL, nbctl_acl_list, NULL, "", RO },
/* logical switch port commands. */ /* logical switch port commands. */
{ "lport-add", 2, 4, "LSWITCH LPORT [PARENT] [TAG]", NULL, nbctl_lsp_add, { "lsp-add", 2, 4, "LSWITCH PORT [PARENT] [TAG]", NULL, nbctl_lsp_add,
NULL, "--may-exist", RW }, NULL, "--may-exist", RW },
{ "lport-del", 1, 1, "LPORT", NULL, nbctl_lsp_del, NULL, "--if-exists", { "lsp-del", 1, 1, "PORT", NULL, nbctl_lsp_del, NULL, "--if-exists", RW },
RW }, { "lsp-list", 1, 1, "LSWITCH", NULL, nbctl_lsp_list, NULL, "", RO },
{ "lport-list", 1, 1, "LSWITCH", NULL, nbctl_lsp_list, NULL, "", RO }, { "lsp-get-parent", 1, 1, "PORT", NULL, nbctl_lsp_get_parent, NULL,
{ "lport-get-parent", 1, 1, "LPORT", NULL, nbctl_lsp_get_parent, NULL,
"", RO }, "", RO },
{ "lport-get-tag", 1, 1, "LPORT", NULL, nbctl_lsp_get_tag, NULL, "", { "lsp-get-tag", 1, 1, "PORT", NULL, nbctl_lsp_get_tag, NULL, "", RO },
RO }, { "lsp-set-addresses", 1, INT_MAX, "PORT [ADDRESS]...", NULL,
{ "lport-set-addresses", 1, INT_MAX, "LPORT [ADDRESS]...", NULL,
nbctl_lsp_set_addresses, NULL, "", RW }, nbctl_lsp_set_addresses, NULL, "", RW },
{ "lport-get-addresses", 1, 1, "LPORT", NULL, { "lsp-get-addresses", 1, 1, "PORT", NULL, nbctl_lsp_get_addresses, NULL,
nbctl_lsp_get_addresses, NULL,
"", RO }, "", RO },
{ "lport-set-port-security", 0, INT_MAX, "LPORT [ADDRS]...", NULL, { "lsp-set-port-security", 0, INT_MAX, "PORT [ADDRS]...", NULL,
nbctl_lsp_set_port_security, NULL, "", RW }, nbctl_lsp_set_port_security, NULL, "", RW },
{ "lport-get-port-security", 1, 1, "LPORT", NULL, { "lsp-get-port-security", 1, 1, "PORT", NULL,
nbctl_lsp_get_port_security, NULL, "", RO }, nbctl_lsp_get_port_security, NULL, "", RO },
{ "lport-get-up", 1, 1, "LPORT", NULL, nbctl_lsp_get_up, NULL, "", RO }, { "lsp-get-up", 1, 1, "PORT", NULL, nbctl_lsp_get_up, NULL, "", RO },
{ "lport-set-enabled", 2, 2, "LPORT STATE", NULL, nbctl_lsp_set_enabled, { "lsp-set-enabled", 2, 2, "PORT STATE", NULL, nbctl_lsp_set_enabled,
NULL, "", RW }, NULL, "", RW },
{ "lport-get-enabled", 1, 1, "LPORT", NULL, nbctl_lsp_get_enabled, NULL, { "lsp-get-enabled", 1, 1, "PORT", NULL, nbctl_lsp_get_enabled, NULL,
"", RO }, "", RO },
{ "lport-set-type", 2, 2, "LPORT TYPE", NULL, nbctl_lsp_set_type, NULL, { "lsp-set-type", 2, 2, "PORT TYPE", NULL, nbctl_lsp_set_type, NULL,
"", RW }, "", RW },
{ "lport-get-type", 1, 1, "LPORT", NULL, nbctl_lsp_get_type, NULL, "", { "lsp-get-type", 1, 1, "PORT", NULL, nbctl_lsp_get_type, NULL, "", RO },
RO }, { "lsp-set-options", 1, INT_MAX, "PORT KEY=VALUE [KEY=VALUE]...", NULL,
{ "lport-set-options", 1, INT_MAX, "LPORT KEY=VALUE [KEY=VALUE]...", NULL,
nbctl_lsp_set_options, NULL, "", RW }, nbctl_lsp_set_options, NULL, "", RW },
{ "lport-get-options", 1, 1, "LPORT", NULL, nbctl_lsp_get_options, NULL, { "lsp-get-options", 1, 1, "PORT", NULL, nbctl_lsp_get_options, NULL,
"", RO }, "", RO },
/* logical router commands. */ /* logical router commands. */

View File

@ -102,10 +102,10 @@ m4_define([OVN_CONTROLLER_VTEP_STOP],
# $3: physical vtep gateway name # $3: physical vtep gateway name
# $4: logical switch name on vtep gateway chassis # $4: logical switch name on vtep gateway chassis
m4_define([OVN_NB_ADD_VTEP_PORT], [ m4_define([OVN_NB_ADD_VTEP_PORT], [
AT_CHECK([ovn-nbctl lport-add $1 $2]) AT_CHECK([ovn-nbctl lsp-add $1 $2])
AT_CHECK([ovn-nbctl lport-set-type $2 vtep]) AT_CHECK([ovn-nbctl lsp-set-type $2 vtep])
AT_CHECK([ovn-nbctl lport-set-options $2 vtep-physical-switch=$3 vtep-logical-switch=$4]) AT_CHECK([ovn-nbctl lsp-set-options $2 vtep-physical-switch=$3 vtep-logical-switch=$4])
]) ])
############################################## ##############################################
@ -321,7 +321,7 @@ ${tunnel_key}
# changes the ovn-nb logical port type so that it is no longer # changes the ovn-nb logical port type so that it is no longer
# vtep port. # vtep port.
AT_CHECK([ovn-nbctl lport-set-type br-vtep_lswitch0 void]) AT_CHECK([ovn-nbctl lsp-set-type br-vtep_lswitch0 void])
OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 1`"]) OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 1`"])
# now should see the tunnel key reset. # now should see the tunnel key reset.
AT_CHECK([vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '], [0], [dnl AT_CHECK([vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '], [0], [dnl
@ -338,8 +338,8 @@ OVN_CONTROLLER_VTEP_START
# creates a simple logical network with the vtep device and a fake hv chassis # creates a simple logical network with the vtep device and a fake hv chassis
# 'ch0'. # 'ch0'.
AT_CHECK([ovn-nbctl lport-add br-test vif0]) AT_CHECK([ovn-nbctl lsp-add br-test vif0])
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02]) AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02])
AT_CHECK([ovn-sbctl chassis-add ch0 vxlan 1.2.3.5]) AT_CHECK([ovn-sbctl chassis-add ch0 vxlan 1.2.3.5])
AT_CHECK([ovn-sbctl lport-bind vif0 ch0]) AT_CHECK([ovn-sbctl lport-bind vif0 ch0])
@ -352,8 +352,8 @@ OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep br-vtep_lswitch0`"
# adds another lswitch 'br-void' in ovn-nb database. # adds another lswitch 'br-void' in ovn-nb database.
AT_CHECK([ovn-nbctl lswitch-add br-void]) AT_CHECK([ovn-nbctl lswitch-add br-void])
# adds fake hv chassis 'ch1'. # adds fake hv chassis 'ch1'.
AT_CHECK([ovn-nbctl lport-add br-void vif1]) AT_CHECK([ovn-nbctl lsp-add br-void vif1])
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:02]) AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02])
AT_CHECK([ovn-sbctl chassis-add ch1 vxlan 1.2.3.6]) AT_CHECK([ovn-sbctl chassis-add ch1 vxlan 1.2.3.6])
AT_CHECK([ovn-sbctl lport-bind vif1 ch1]) AT_CHECK([ovn-sbctl lport-bind vif1 ch1])
OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep vif1`"]) OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep vif1`"])
@ -377,7 +377,7 @@ AT_CHECK([ovs-vsctl --columns=options list Interface bfd1.2.3.5 | cut -d ':' -f2
]) ])
# adds another mac to logical switch port. # adds another mac to logical switch port.
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02 f0:ab:cd:ef:01:03]) AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02 f0:ab:cd:ef:01:03])
OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep 03`"]) OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep 03`"])
AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
@ -386,15 +386,15 @@ AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -
]) ])
# removes one mac to logical switch port. # removes one mac to logical switch port.
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:03]) AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:03])
OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02`"]) OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02`"])
AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
"f0:ab:cd:ef:01:03" "f0:ab:cd:ef:01:03"
]) ])
# migrates mac to logical switch port vif1 on 'br-void'. # migrates mac to logical switch port vif1 on 'br-void'.
AT_CHECK([ovn-nbctl lport-set-addresses vif0]) AT_CHECK([ovn-nbctl lsp-set-addresses vif0])
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:03]) AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03])
OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 03`"]) OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 03`"])
AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
]) ])
@ -409,14 +409,14 @@ OVN_CONTROLLER_VTEP_START
# creates a simple logical network with the vtep device and a fake hv chassis # creates a simple logical network with the vtep device and a fake hv chassis
# 'ch0'. # 'ch0'.
AT_CHECK([ovn-nbctl lport-add br-test vif0]) AT_CHECK([ovn-nbctl lsp-add br-test vif0])
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02]) AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02])
AT_CHECK([ovn-sbctl chassis-add ch0 vxlan 1.2.3.5]) AT_CHECK([ovn-sbctl chassis-add ch0 vxlan 1.2.3.5])
AT_CHECK([ovn-sbctl lport-bind vif0 ch0]) AT_CHECK([ovn-sbctl lport-bind vif0 ch0])
# creates another vif in the same logical switch with duplicate mac. # creates another vif in the same logical switch with duplicate mac.
AT_CHECK([ovn-nbctl lport-add br-test vif1]) AT_CHECK([ovn-nbctl lsp-add br-test vif1])
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:02]) AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02])
AT_CHECK([ovn-sbctl lport-bind vif1 ch0]) AT_CHECK([ovn-sbctl lport-bind vif1 ch0])
# creates the logical switch in vtep and adds the corresponding logical # creates the logical switch in vtep and adds the corresponding logical
@ -438,13 +438,13 @@ AT_CHECK([sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([[-
]) ])
# deletes vif1. # deletes vif1.
AT_CHECK([ovn-nbctl lport-del vif1]) AT_CHECK([ovn-nbctl lsp-del vif1])
# adds another lswitch 'br-void' in ovn-nb database. # adds another lswitch 'br-void' in ovn-nb database.
AT_CHECK([ovn-nbctl lswitch-add br-void]) AT_CHECK([ovn-nbctl lswitch-add br-void])
# adds fake hv chassis 'ch1' and vif1 with same mac address as vif0. # adds fake hv chassis 'ch1' and vif1 with same mac address as vif0.
AT_CHECK([ovn-nbctl lport-add br-void vif1]) AT_CHECK([ovn-nbctl lsp-add br-void vif1])
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:02]) AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02])
AT_CHECK([ovn-sbctl chassis-add ch1 vxlan 1.2.3.6]) AT_CHECK([ovn-sbctl chassis-add ch1 vxlan 1.2.3.6])
AT_CHECK([ovn-sbctl lport-bind vif1 ch1]) AT_CHECK([ovn-sbctl lport-bind vif1 ch1])
OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep vif1`"]) OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep vif1`"])

View File

@ -87,51 +87,51 @@ AT_CLEANUP
dnl --------------------------------------------------------------------- dnl ---------------------------------------------------------------------
AT_SETUP([ovn-nbctl - basic lport commands]) AT_SETUP([ovn-nbctl - basic logical switch port commands])
OVN_NBCTL_TEST_START OVN_NBCTL_TEST_START
AT_CHECK([ovn-nbctl lswitch-add ls0]) AT_CHECK([ovn-nbctl lswitch-add ls0])
AT_CHECK([ovn-nbctl lport-add ls0 lp0]) AT_CHECK([ovn-nbctl lsp-add ls0 lp0])
AT_CHECK([ovn-nbctl lport-add ls0 lp0], [1], [], AT_CHECK([ovn-nbctl lsp-add ls0 lp0], [1], [],
[ovn-nbctl: lp0: an lport with this name already exists [ovn-nbctl: lp0: a port with this name already exists
]) ])
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp0]) AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp0])
AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
<0> (lp0) <0> (lp0)
]) ])
AT_CHECK([ovn-nbctl lport-add ls0 lp1]) AT_CHECK([ovn-nbctl lsp-add ls0 lp1])
AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
<0> (lp0) <0> (lp0)
<1> (lp1) <1> (lp1)
]) ])
AT_CHECK([ovn-nbctl lswitch-add ls1]) AT_CHECK([ovn-nbctl lswitch-add ls1])
AT_CHECK([ovn-nbctl lport-add ls0 lp1], [1], [], AT_CHECK([ovn-nbctl lsp-add ls0 lp1], [1], [],
[ovn-nbctl: lp1: an lport with this name already exists [ovn-nbctl: lp1: a port with this name already exists
]) ])
AT_CHECK([ovn-nbctl --may-exist lport-add ls1 lp1], [1], [], AT_CHECK([ovn-nbctl --may-exist lsp-add ls1 lp1], [1], [],
[ovn-nbctl: lp1: lport already exists but in lswitch ls0 [ovn-nbctl: lp1: port already exists but in lswitch ls0
]) ])
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp1 lp0 5], [1], [], AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp1 lp0 5], [1], [],
[ovn-nbctl: lp1: lport already exists but has no parent [ovn-nbctl: lp1: port already exists but has no parent
]) ])
AT_CHECK([ovn-nbctl lport-del lp1]) AT_CHECK([ovn-nbctl lsp-del lp1])
AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
<0> (lp0) <0> (lp0)
]) ])
AT_CHECK([ovn-nbctl lport-add ls0 lp2 lp3 5]) AT_CHECK([ovn-nbctl lsp-add ls0 lp2 lp3 5])
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp2 lp4 5], [1], [], AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp4 5], [1], [],
[ovn-nbctl: lp2: lport already exists with different parent lp3 [ovn-nbctl: lp2: port already exists with different parent lp3
]) ])
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp2 lp3 10], [1], [], AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 10], [1], [],
[ovn-nbctl: lp2: lport already exists with different tag 5 [ovn-nbctl: lp2: port already exists with different tag 5
]) ])
AT_CHECK([ovn-nbctl clear Logical_Switch_Port lp2 tag]) AT_CHECK([ovn-nbctl clear Logical_Switch_Port lp2 tag])
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp2 lp3 5], [1], [], AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 5], [1], [],
[ovn-nbctl: lp2: lport already exists but has no tag [ovn-nbctl: lp2: port already exists but has no tag
]) ])
OVN_NBCTL_TEST_STOP OVN_NBCTL_TEST_STOP
@ -143,18 +143,18 @@ AT_SETUP([ovn-nbctl - lport addresses])
OVN_NBCTL_TEST_START OVN_NBCTL_TEST_START
AT_CHECK([ovn-nbctl lswitch-add ls0]) AT_CHECK([ovn-nbctl lswitch-add ls0])
AT_CHECK([ovn-nbctl lport-add ls0 lp0]) AT_CHECK([ovn-nbctl lsp-add ls0 lp0])
AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl
]) ])
AT_CHECK([ovn-nbctl lport-set-addresses lp0 00:11:22:33:44:55 unknown]) AT_CHECK([ovn-nbctl lsp-set-addresses lp0 00:11:22:33:44:55 unknown])
AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl
00:11:22:33:44:55 00:11:22:33:44:55
unknown unknown
]) ])
AT_CHECK([ovn-nbctl lport-set-addresses lp0]) AT_CHECK([ovn-nbctl lsp-set-addresses lp0])
AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl
]) ])
OVN_NBCTL_TEST_STOP OVN_NBCTL_TEST_STOP
@ -166,18 +166,18 @@ AT_SETUP([ovn-nbctl - port security])
OVN_NBCTL_TEST_START OVN_NBCTL_TEST_START
AT_CHECK([ovn-nbctl lswitch-add ls0]) AT_CHECK([ovn-nbctl lswitch-add ls0])
AT_CHECK([ovn-nbctl lport-add ls0 lp0]) AT_CHECK([ovn-nbctl lsp-add ls0 lp0])
AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl
]) ])
AT_CHECK([ovn-nbctl lport-set-port-security lp0 aa:bb:cc:dd:ee:ff 00:11:22:33:44:55]) AT_CHECK([ovn-nbctl lsp-set-port-security lp0 aa:bb:cc:dd:ee:ff 00:11:22:33:44:55])
AT_CHECK([ovn-nbctl lport-get-port-security lp0], [0], [dnl AT_CHECK([ovn-nbctl lsp-get-port-security lp0], [0], [dnl
00:11:22:33:44:55 00:11:22:33:44:55
aa:bb:cc:dd:ee:ff aa:bb:cc:dd:ee:ff
]) ])
AT_CHECK([ovn-nbctl lport-set-port-security lp0]) AT_CHECK([ovn-nbctl lsp-set-port-security lp0])
AT_CHECK([ovn-nbctl lport-get-port-security lp0], [0], [dnl AT_CHECK([ovn-nbctl lsp-get-port-security lp0], [0], [dnl
]) ])
OVN_NBCTL_TEST_STOP OVN_NBCTL_TEST_STOP

View File

@ -80,8 +80,8 @@ AT_SETUP([ovn-sbctl])
OVN_SBCTL_TEST_START OVN_SBCTL_TEST_START
AT_CHECK([ovn-nbctl lswitch-add br-test]) AT_CHECK([ovn-nbctl lswitch-add br-test])
AT_CHECK([ovn-nbctl lport-add br-test vif0]) AT_CHECK([ovn-nbctl lsp-add br-test vif0])
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02]) AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02])
AT_CHECK([ovn-sbctl chassis-add ch0 stt 1.2.3.5]) AT_CHECK([ovn-sbctl chassis-add ch0 stt 1.2.3.5])
AT_CHECK([ovn-sbctl lport-bind vif0 ch0]) AT_CHECK([ovn-sbctl lport-bind vif0 ch0])
@ -93,8 +93,8 @@ Chassis "ch0"
]) ])
# adds another 'vif1' # adds another 'vif1'
AT_CHECK([ovn-nbctl lport-add br-test vif1]) AT_CHECK([ovn-nbctl lsp-add br-test vif1])
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:03]) AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03])
AT_CHECK([ovn-sbctl lport-bind vif1 ch0]) AT_CHECK([ovn-sbctl lport-bind vif1 ch0])
AT_CHECK([ovn-sbctl show | sed 's/vif[[0-9]]/vif/'], [0], [dnl AT_CHECK([ovn-sbctl show | sed 's/vif[[0-9]]/vif/'], [0], [dnl
@ -106,7 +106,7 @@ Chassis "ch0"
]) ])
# deletes 'vif1' # deletes 'vif1'
AT_CHECK([ovn-nbctl lport-del vif1]) AT_CHECK([ovn-nbctl lsp-del vif1])
AT_CHECK([ovn-sbctl show], [0], [dnl AT_CHECK([ovn-sbctl show], [0], [dnl
Chassis "ch0" Chassis "ch0"
@ -123,9 +123,9 @@ chassis : ${uuid}
]) ])
# test the passing down of logical port type and options. # test the passing down of logical port type and options.
AT_CHECK([ovn-nbctl lport-add br-test vtep0]) AT_CHECK([ovn-nbctl lsp-add br-test vtep0])
AT_CHECK([ovn-nbctl lport-set-type vtep0 vtep]) AT_CHECK([ovn-nbctl lsp-set-type vtep0 vtep])
AT_CHECK([ovn-nbctl lport-set-options vtep0 vtep_physical_switch=p0 vtep_logical_switch=l0]) AT_CHECK([ovn-nbctl lsp-set-options vtep0 vtep_physical_switch=p0 vtep_logical_switch=l0])
OVS_WAIT_UNTIL([test -n "`ovn-sbctl --columns=logical_port list Port_Binding | grep vtep0`" ]) OVS_WAIT_UNTIL([test -n "`ovn-sbctl --columns=logical_port list Port_Binding | grep vtep0`" ])
AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0], [0], [dnl AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0], [0], [dnl

View File

@ -565,17 +565,17 @@ for i in 1 2 3; do
for j in 1 2 3; do for j in 1 2 3; do
ovs-vsctl add-port br-int vif$i$j -- set Interface vif$i$j external-ids:iface-id=lp$i$j options:tx_pcap=hv$i/vif$i$j-tx.pcap options:rxq_pcap=hv$i/vif$i$j-rx.pcap ofport-request=$i$j ovs-vsctl add-port br-int vif$i$j -- set Interface vif$i$j external-ids:iface-id=lp$i$j options:tx_pcap=hv$i/vif$i$j-tx.pcap options:rxq_pcap=hv$i/vif$i$j-rx.pcap ofport-request=$i$j
ovn-nbctl lport-add lsw0 lp$i$j ovn-nbctl lsp-add lsw0 lp$i$j
if test $j = 1; then if test $j = 1; then
ovn-nbctl lport-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" unknown ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" unknown
else else
if test $j = 3; then if test $j = 3; then
ip_addrs="192.168.0.$i$j fe80::ea2a:eaff:fe28:$i$j/64 192.169.0.$i$j" ip_addrs="192.168.0.$i$j fe80::ea2a:eaff:fe28:$i$j/64 192.169.0.$i$j"
else else
ip_addrs="192.168.0.$i$j" ip_addrs="192.168.0.$i$j"
fi fi
ovn-nbctl lport-set-addresses lp$i$j "f0:00:00:00:00:$i$j $ip_addrs" ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j $ip_addrs"
ovn-nbctl lport-set-port-security lp$i$j f0:00:00:00:00:$i$j ovn-nbctl lsp-set-port-security lp$i$j f0:00:00:00:00:$i$j
fi fi
done done
done done
@ -604,7 +604,7 @@ vif_to_hv() {
# content has Ethernet destination DST and source SRC (each exactly 12 hex # content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or # digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the # more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as lport numbers, e.g. 11 for vif11. # OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
trim_zeros() { trim_zeros() {
sed 's/\(00\)\{1,\}$//' sed 's/\(00\)\{1,\}$//'
} }
@ -630,7 +630,7 @@ test_packet() {
# it should be the hardware address of the target to expect to receive in an # it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected. # ARP reply; otherwise no reply is expected.
# #
# INPORT is an lport number, e.g. 11 for vif11. # INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits. # SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits. # SPA and TPA are each 8 hex digits.
test_arp() { test_arp() {
@ -663,10 +663,11 @@ ip_to_hex() {
# Send packets between all pairs of source and destination ports: # Send packets between all pairs of source and destination ports:
# #
# 1. Unicast packets are delivered to exactly one lport (except that packets # 1. Unicast packets are delivered to exactly one logical switch port
# destined to their input ports are dropped). # (except that packets destined to their input ports are dropped).
# #
# 2. Broadcast and multicast are delivered to all lports except the input port. # 2. Broadcast and multicast are delivered to all logical switch ports
# except the input port.
# #
# 3. When port security is turned on, the lswitch drops packets from the wrong # 3. When port security is turned on, the lswitch drops packets from the wrong
# MAC address. # MAC address.
@ -677,8 +678,9 @@ ip_to_hex() {
# affects behavior when port security is turned off, since otherwise port # affects behavior when port security is turned off, since otherwise port
# security would drop the packet anyway.) # security would drop the packet anyway.)
# #
# 6. The lswitch delivers packets with an unknown destination to lports with # 6. The lswitch delivers packets with an unknown destination to logical
# "unknown" among their MAC addresses (and port security disabled). # switch ports with "unknown" among their MAC addresses (and port
# security disabled).
# #
# 7. The lswitch drops unicast packets that violate an ACL. # 7. The lswitch drops unicast packets that violate an ACL.
# #
@ -731,7 +733,7 @@ for is in 1 2 3; do
test_arp $s f000000000$s $sip $tip_unknown #10 test_arp $s f000000000$s $sip $tip_unknown #10
if test $jd = 3; then if test $jd = 3; then
# lport[123]3 has an additional ip 192.169.0.[123]3. # lsp[123]3 has an additional ip 192.169.0.[123]3.
tip=`ip_to_hex 192 169 0 $id$jd` tip=`ip_to_hex 192 169 0 $id$jd`
test_arp $s f000000000$s $sip $tip f000000000$d #9 test_arp $s f000000000$s $sip $tip f000000000$d #9
fi fi
@ -761,7 +763,7 @@ done
# set address for lp13 with invalid characters. # set address for lp13 with invalid characters.
# lp13 should be configured with only 192.168.0.13. # lp13 should be configured with only 192.168.0.13.
ovn-nbctl lport-set-addresses lp13 "f0:00:00:00:00:13 192.168.0.13 invalid 192.169.0.13" ovn-nbctl lsp-set-addresses lp13 "f0:00:00:00:00:13 192.168.0.13 invalid 192.169.0.13"
sip=`ip_to_hex 192 168 0 11` sip=`ip_to_hex 192 168 0 11`
tip=`ip_to_hex 192 168 0 13` tip=`ip_to_hex 192 168 0 13`
test_arp 11 f00000000011 $sip $tip f00000000013 test_arp 11 f00000000011 $sip $tip f00000000013
@ -837,7 +839,7 @@ ovn_start
# of VIF port name indicates the hypervisor it is bound to, e.g. # of VIF port name indicates the hypervisor it is bound to, e.g.
# lp23 means VIF 3 on hv2. # lp23 means VIF 3 on hv2.
# #
# lswitch's VLAN tag and their lports are: # lswitch's VLAN tag and their logical switch ports are:
# - ls1: # - ls1:
# - untagged # - untagged
# - lports: lp11, lp12, lp21, lp22 # - lports: lp11, lp12, lp21, lp22
@ -857,13 +859,13 @@ for i in 1 2 3; do
ovn-nbctl lswitch-add $lswitch_name ovn-nbctl lswitch-add $lswitch_name
ln_port_name=ln$i ln_port_name=ln$i
if test $i -eq 2; then if test $i -eq 2; then
ovn-nbctl lport-add $lswitch_name $ln_port_name "" 101 ovn-nbctl lsp-add $lswitch_name $ln_port_name "" 101
else else
ovn-nbctl lport-add $lswitch_name $ln_port_name ovn-nbctl lsp-add $lswitch_name $ln_port_name
fi fi
ovn-nbctl lport-set-addresses $ln_port_name unknown ovn-nbctl lsp-set-addresses $ln_port_name unknown
ovn-nbctl lport-set-type $ln_port_name localnet ovn-nbctl lsp-set-type $ln_port_name localnet
ovn-nbctl lport-set-options $ln_port_name network_name=phys ovn-nbctl lsp-set-options $ln_port_name network_name=phys
done done
net_add n1 net_add n1
@ -881,7 +883,7 @@ for i in 1 2; do
options:rxq_pcap=hv$i/vif$i$j-rx.pcap \ options:rxq_pcap=hv$i/vif$i$j-rx.pcap \
ofport-request=$i$j ofport-request=$i$j
lport_name=lp$i$j lsp_name=lp$i$j
if test $j -le 2; then if test $j -le 2; then
lswitch_name=ls1 lswitch_name=ls1
elif test $j -le 4; then elif test $j -le 4; then
@ -890,11 +892,11 @@ for i in 1 2; do
lswitch_name=ls3 lswitch_name=ls3
fi fi
ovn-nbctl lport-add $lswitch_name $lport_name ovn-nbctl lsp-add $lswitch_name $lsp_name
ovn-nbctl lport-set-addresses $lport_name f0:00:00:00:00:$i$j ovn-nbctl lsp-set-addresses $lsp_name f0:00:00:00:00:$i$j
ovn-nbctl lport-set-port-security $lport_name f0:00:00:00:00:$i$j ovn-nbctl lsp-set-port-security $lsp_name f0:00:00:00:00:$i$j
OVS_WAIT_UNTIL([test x`ovn-nbctl lport-get-up $lport_name` = xup]) OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up $lsp_name` = xup])
done done
done done
@ -914,7 +916,7 @@ vif_to_hv() {
# content has Ethernet destination DST and source SRC (each exactly 12 hex # content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or # digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the # more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as lport numbers, e.g. 11 for vif11. # OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
trim_zeros() { trim_zeros() {
sed 's/\(00\)\{1,\}$//' sed 's/\(00\)\{1,\}$//'
} }
@ -1034,16 +1036,16 @@ ovn_start
# Configure the Northbound database # Configure the Northbound database
ovn-nbctl lswitch-add lsw0 ovn-nbctl lswitch-add lsw0
ovn-nbctl lport-add lsw0 lp1 ovn-nbctl lsp-add lsw0 lp1
ovn-nbctl lport-set-addresses lp1 f0:00:00:00:00:01 ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01
ovn-nbctl lport-add lsw0 lp2 ovn-nbctl lsp-add lsw0 lp2
ovn-nbctl lport-set-addresses lp2 f0:00:00:00:00:02 ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02
ovn-nbctl lport-add lsw0 lp-vtep ovn-nbctl lsp-add lsw0 lp-vtep
ovn-nbctl lport-set-type lp-vtep vtep ovn-nbctl lsp-set-type lp-vtep vtep
ovn-nbctl lport-set-options lp-vtep vtep-physical-switch=br-vtep vtep-logical-switch=lsw0 ovn-nbctl lsp-set-options lp-vtep vtep-physical-switch=br-vtep vtep-logical-switch=lsw0
ovn-nbctl lport-set-addresses lp-vtep unknown ovn-nbctl lsp-set-addresses lp-vtep unknown
net_add n1 # Network to connect hv1, hv2, and vtep net_add n1 # Network to connect hv1, hv2, and vtep
net_add n2 # Network to connect vtep and hv3 net_add n2 # Network to connect vtep and hv3
@ -1117,7 +1119,7 @@ sleep 1
# content has Ethernet destination DST and source SRC (each exactly 12 hex # content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or # digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the # more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as lport numbers, e.g. 1 for vif1. # OUTPORTs are specified as logical switch port numbers, e.g. 1 for vif1.
trim_zeros() { trim_zeros() {
sed 's/\(00\)\{1,\}$//' sed 's/\(00\)\{1,\}$//'
} }
@ -1137,13 +1139,15 @@ test_packet() {
# Send packets between all pairs of source and destination ports: # Send packets between all pairs of source and destination ports:
# #
# 1. Unicast packets are delivered to exactly one lport (except that packets # 1. Unicast packets are delivered to exactly one logical switch port
# destined to their input ports are dropped). # (except that packets destined to their input ports are dropped).
# #
# 2. Broadcast and multicast are delivered to all lports except the input port. # 2. Broadcast and multicast are delivered to all logical switch ports
# except the input port.
# #
# 3. The lswitch delivers packets with an unknown destination to lports with # 3. The lswitch delivers packets with an unknown destination to logical
# "unknown" among their MAC addresses (and port security disabled). # switch ports with "unknown" among their MAC addresses (and port
# security disabled).
for s in 1 2 3; do for s in 1 2 3; do
bcast= bcast=
unknown= unknown=
@ -1252,13 +1256,14 @@ for i in 1 2 3; do
ovn-nbctl lswitch-add ls$i ovn-nbctl lswitch-add ls$i
for j in 1 2 3; do for j in 1 2 3; do
for k in 1 2 3; do for k in 1 2 3; do
# Add "unknown" to MAC addresses for lp?11, so packets for # Add "unknown" to MAC addresses for lp?11, so packets for
# MAC-IP bindings discovered via ARP later have somewhere to go. # MAC-IP bindings discovered via ARP later have somewhere to go.
if test $j$k = 11; then unknown=unknown; else unknown=; fi if test $j$k = 11; then unknown=unknown; else unknown=; fi
ovn-nbctl \ ovn-nbctl \
-- lport-add ls$i lp$i$j$k \ -- lsp-add ls$i lp$i$j$k \
-- lport-set-addresses lp$i$j$k "f0:00:00:00:0$i:$j$k 192.168.$i$j.$k" $unknown -- lsp-set-addresses lp$i$j$k "f0:00:00:00:0$i:$j$k \
192.168.$i$j.$k" $unknown
done done
done done
done done
@ -1269,7 +1274,7 @@ for i in 1 2 3; do
ovn-nbctl lrp-add lr0 lrp$i$j 00:00:00:00:ff:$i$j \ ovn-nbctl lrp-add lr0 lrp$i$j 00:00:00:00:ff:$i$j \
192.168.$i$j.254/24 lrp$i$j-attachment 192.168.$i$j.254/24 lrp$i$j-attachment
ovn-nbctl \ ovn-nbctl \
-- lport-add ls$i lrp$i$j-attachment \ -- lsp-add ls$i lrp$i$j-attachment \
-- set Logical_Switch_Port lrp$i$j-attachment type=router \ -- set Logical_Switch_Port lrp$i$j-attachment type=router \
options:router-port=lrp$i$j \ options:router-port=lrp$i$j \
addresses='"00:00:00:00:ff:'$i$j'"' addresses='"00:00:00:00:ff:'$i$j'"'
@ -1346,7 +1351,7 @@ sleep 1
# content has Ethernet destination DST and source SRC (each exactly 12 hex # content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or # digits) and Ethernet type ETHTYPE (4 hex digits). The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received. INPORT and the # more) list the VIFs on which the packet should be received. INPORT and the
# OUTPORTs are specified as lport numbers, e.g. 123 for vif123. # OUTPORTs are specified as logical switch port numbers, e.g. 123 for vif123.
trim_zeros() { trim_zeros() {
sed 's/\(00\)\{1,\}$//' sed 's/\(00\)\{1,\}$//'
} }
@ -1389,10 +1394,11 @@ as hv1 ovs-ofctl dump-flows br-int
# Send IP packets between all pairs of source and destination ports: # Send IP packets between all pairs of source and destination ports:
# #
# 1. Unicast IP packets are delivered to exactly one lport (except # 1. Unicast IP packets are delivered to exactly one logical switch port
# that packets destined to their input ports are dropped). # (except that packets destined to their input ports are dropped).
# #
# 2. Broadcast IP packets are delivered to all lports except the input port. # 2. Broadcast IP packets are delivered to all logical switch ports
# except the input port.
ip_to_hex() { ip_to_hex() {
printf "%02x%02x%02x%02x" "$@" printf "%02x%02x%02x%02x" "$@"
} }
@ -1471,7 +1477,7 @@ done
# it should be the hardware address of the target to expect to receive in an # it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected. # ARP reply; otherwise no reply is expected.
# #
# INPORT is an lport number, e.g. 11 for vif11. # INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits. # SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits. # SPA and TPA are each 8 hex digits.
test_arp() { test_arp() {
@ -1676,16 +1682,16 @@ for i in 1 2 3; do
for j in 1 2 3; do for j in 1 2 3; do
ovs-vsctl add-port br-int vif$i$j -- set Interface vif$i$j external-ids:iface-id=lp$i$j options:tx_pcap=hv$i/vif$i$j-tx.pcap options:rxq_pcap=hv$i/vif$i$j-rx.pcap ofport-request=$i$j ovs-vsctl add-port br-int vif$i$j -- set Interface vif$i$j external-ids:iface-id=lp$i$j options:tx_pcap=hv$i/vif$i$j-tx.pcap options:rxq_pcap=hv$i/vif$i$j-rx.pcap ofport-request=$i$j
ovn-nbctl lport-add lsw0 lp$i$j ovn-nbctl lsp-add lsw0 lp$i$j
if test $j = 1; then if test $j = 1; then
ovn-nbctl lport-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" unknown ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" unknown
elif test $j = 2; then elif test $j = 2; then
ovn-nbctl lport-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j"
ovn-nbctl lport-set-port-security lp$i$j f0:00:00:00:00:$i$j ovn-nbctl lsp-set-port-security lp$i$j f0:00:00:00:00:$i$j
else else
extra_addr="f0:00:00:00:0$i:$i$j fe80::ea2a:eaff:fe28:$i$j" extra_addr="f0:00:00:00:0$i:$i$j fe80::ea2a:eaff:fe28:$i$j"
ovn-nbctl lport-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" "$extra_addr" ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" "$extra_addr"
ovn-nbctl lport-set-port-security lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" "$extra_addr" ovn-nbctl lsp-set-port-security lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" "$extra_addr"
fi fi
done done
done done
@ -1721,8 +1727,8 @@ done
# The packet's content has Ethernet destination DST and source SRC # The packet's content has Ethernet destination DST and source SRC
# (each exactly 12 hex digits) and Ethernet type ETHTYPE (4 hex digits). # (each exactly 12 hex digits) and Ethernet type ETHTYPE (4 hex digits).
# The OUTPORTs (zero or more) list the VIFs on which the packet should # The OUTPORTs (zero or more) list the VIFs on which the packet should
# be received. INPORT and the OUTPORTs are specified as lport numbers, # be received. INPORT and the OUTPORTs are specified as logical switch
# e.g. 11 for vif11. # port numbers, e.g. 11 for vif11.
test_ip() { test_ip() {
# This packet has bad checksums but logical L3 routing doesn't check. # This packet has bad checksums but logical L3 routing doesn't check.
local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
@ -1743,7 +1749,7 @@ test_ip() {
# it should be the hardware address of the target to expect to receive in an # it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected. # ARP reply; otherwise no reply is expected.
# #
# INPORT is an lport number, e.g. 11 for vif11. # INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits. # SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits. # SPA and TPA are each 8 hex digits.
test_arp() { test_arp() {
@ -1954,56 +1960,56 @@ for i in 1 2 3; do
test_ipv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip $tip test_ipv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip $tip
done done
# configure lport13 to send and received IPv4 packets with an address range # configure lsp13 to send and received IPv4 packets with an address range
ovn-nbctl lport-set-port-security lp13 "f0:00:00:00:00:13 192.168.0.13 20.0.0.4/24 10.0.0.0/24" ovn-nbctl lsp-set-port-security lp13 "f0:00:00:00:00:13 192.168.0.13 20.0.0.4/24 10.0.0.0/24"
sleep 2 sleep 2
sip=`ip_to_hex 10 0 0 13` sip=`ip_to_hex 10 0 0 13`
tip=`ip_to_hex 192 168 0 22` tip=`ip_to_hex 192 168 0 22`
# arp packet with inner ip 10.0.0.13 should be allowed for lport13 # arp packet with inner ip 10.0.0.13 should be allowed for lsp13
test_arp 13 f00000000013 f00000000013 $sip $tip 0 f00000000022 test_arp 13 f00000000013 f00000000013 $sip $tip 0 f00000000022
sip=`ip_to_hex 10 0 0 14` sip=`ip_to_hex 10 0 0 14`
tip=`ip_to_hex 192 168 0 23` tip=`ip_to_hex 192 168 0 23`
# IPv4 packet from lport13 with src ip 10.0.0.14 destined to lport23 # IPv4 packet from lsp13 with src ip 10.0.0.14 destined to lsp23
# with dst ip 192.168.0.23 should be allowed # with dst ip 192.168.0.23 should be allowed
test_ip 13 f00000000013 f00000000023 $sip $tip 23 test_ip 13 f00000000013 f00000000023 $sip $tip 23
sip=`ip_to_hex 192 168 0 33` sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 10 0 0 15` tip=`ip_to_hex 10 0 0 15`
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13 # IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 10.0.0.15 should be received by lport13 # with dst ip 10.0.0.15 should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13 test_ip 33 f00000000033 f00000000013 $sip $tip 13
sip=`ip_to_hex 192 168 0 33` sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 20 0 0 4` tip=`ip_to_hex 20 0 0 4`
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13 # IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 20.0.0.4 should be received by lport13 # with dst ip 20.0.0.4 should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13 test_ip 33 f00000000033 f00000000013 $sip $tip 13
sip=`ip_to_hex 192 168 0 33` sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 20 0 0 5` tip=`ip_to_hex 20 0 0 5`
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13 # IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 20.0.0.5 should not be received by lport13 # with dst ip 20.0.0.5 should not be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip test_ip 33 f00000000033 f00000000013 $sip $tip
sip=`ip_to_hex 192 168 0 33` sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 20 0 0 255` tip=`ip_to_hex 20 0 0 255`
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13 # IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 20.0.0.255 should be received by lport13 # with dst ip 20.0.0.255 should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13 test_ip 33 f00000000033 f00000000013 $sip $tip 13
sip=`ip_to_hex 192 168 0 33` sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 192 168 0 255` tip=`ip_to_hex 192 168 0 255`
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13 # IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 192.168.0.255 should not be received by lport13 # with dst ip 192.168.0.255 should not be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip test_ip 33 f00000000033 f00000000013 $sip $tip
sip=`ip_to_hex 192 168 0 33` sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 224 0 0 4` tip=`ip_to_hex 224 0 0 4`
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13 # IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 224.0.0.4 should be received by lport13 # with dst ip 224.0.0.4 should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13 test_ip 33 f00000000033 f00000000013 $sip $tip 13
# Allow some time for packet forwarding. # Allow some time for packet forwarding.
@ -2084,13 +2090,13 @@ ovn-nbctl lswitch-add ls2
# Connect ls1 to R1 # Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:03 192.168.1.1/24 rp-ls1 ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:03 192.168.1.1/24 rp-ls1
ovn-nbctl lport-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 type=router \ ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 type=router \
options:router-port=ls1 addresses=\"00:00:00:01:02:03\" options:router-port=ls1 addresses=\"00:00:00:01:02:03\"
# Connect ls2 to R2 # Connect ls2 to R2
ovn-nbctl lrp-add R2 ls2 00:00:00:01:02:04 172.16.1.1/24 rp-ls2 ovn-nbctl lrp-add R2 ls2 00:00:00:01:02:04 172.16.1.1/24 rp-ls2
ovn-nbctl lport-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 type=router \ ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 type=router \
options:router-port=ls2 addresses=\"00:00:00:01:02:04\" options:router-port=ls2 addresses=\"00:00:00:01:02:04\"
# Connect R1 to R2 # Connect R1 to R2
@ -2101,12 +2107,12 @@ ovn-nbctl set Logical_Router R1 default_gw="20.0.0.2"
ovn-nbctl set Logical_Router R2 default_gw="20.0.0.1" ovn-nbctl set Logical_Router R2 default_gw="20.0.0.1"
# Create logical port ls1-lp1 in ls1 # Create logical port ls1-lp1 in ls1
ovn-nbctl lport-add ls1 ls1-lp1 \ ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lport-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2" -- lsp-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"
# Create logical port ls2-lp1 in ls2 # Create logical port ls2-lp1 in ls2
ovn-nbctl lport-add ls2 ls2-lp1 \ ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lport-set-addresses ls2-lp1 "f0:00:00:01:02:04 172.16.1.2" -- lsp-set-addresses ls2-lp1 "f0:00:00:01:02:04 172.16.1.2"
# Create two hypervisor and create OVS ports corresponding to logical ports. # Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1 net_add n1
@ -2227,21 +2233,21 @@ ovn-nbctl lswitch-add ls2
# Connect ls1 to R1 # Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:03 192.168.1.1/24 rp-ls1 ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:03 192.168.1.1/24 rp-ls1
ovn-nbctl lport-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 type=router \ ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 type=router \
options:router-port=ls1 addresses=\"00:00:00:01:02:03\" options:router-port=ls1 addresses=\"00:00:00:01:02:03\"
# Connect ls2 to R1 # Connect ls2 to R1
ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:04 172.16.1.1/24 rp-ls2 ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:04 172.16.1.1/24 rp-ls2
ovn-nbctl lport-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 type=router \ ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 type=router \
options:router-port=ls2 addresses=\"00:00:00:01:02:04\" options:router-port=ls2 addresses=\"00:00:00:01:02:04\"
# Create logical port ls1-lp1 in ls1 # Create logical port ls1-lp1 in ls1
ovn-nbctl lport-add ls1 ls1-lp1 \ ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lport-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2" -- lsp-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"
# Create logical port ls2-lp1 in ls2 # Create logical port ls2-lp1 in ls2
ovn-nbctl lport-add ls2 ls2-lp1 \ ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lport-set-addresses ls2-lp1 "f0:00:00:01:02:04 172.16.1.2" -- lsp-set-addresses ls2-lp1 "f0:00:00:01:02:04 172.16.1.2"
# Create one hypervisor and create OVS ports corresponding to logical ports. # Create one hypervisor and create OVS ports corresponding to logical ports.
net_add n1 net_add n1
@ -2366,17 +2372,17 @@ ovn-nbctl lswitch-add bob
# Connect foo to R1 # Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:00:01:02:03 192.168.1.1/24 rp-foo ovn-nbctl lrp-add R1 foo 00:00:00:01:02:03 192.168.1.1/24 rp-foo
ovn-nbctl lport-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \ ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
options:router-port=foo addresses=\"00:00:00:01:02:03\" options:router-port=foo addresses=\"00:00:00:01:02:03\"
# Connect alice to R2 # Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:00:01:02:04 172.16.1.1/24 rp-alice ovn-nbctl lrp-add R2 alice 00:00:00:01:02:04 172.16.1.1/24 rp-alice
ovn-nbctl lport-add alice rp-alice -- set Logical_Switch_Port rp-alice \ ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
type=router options:router-port=alice addresses=\"00:00:00:01:02:04\" type=router options:router-port=alice addresses=\"00:00:00:01:02:04\"
# Connect bob to R2 # Connect bob to R2
ovn-nbctl lrp-add R2 bob 00:00:00:01:02:05 172.16.2.1/24 rp-bob ovn-nbctl lrp-add R2 bob 00:00:00:01:02:05 172.16.2.1/24 rp-bob
ovn-nbctl lport-add bob rp-bob -- set Logical_Switch_Port rp-bob type=router \ ovn-nbctl lsp-add bob rp-bob -- set Logical_Switch_Port rp-bob type=router \
options:router-port=bob addresses=\"00:00:00:01:02:05\" options:router-port=bob addresses=\"00:00:00:01:02:05\"
# Connect R1 to R2 # Connect R1 to R2
@ -2389,16 +2395,16 @@ ovn-nbctl lr-route-add R2 172.16.2.0/24 20.0.0.2 R1_R2
ovn-nbctl lr-route-add R2 192.168.1.0/24 20.0.0.1 ovn-nbctl lr-route-add R2 192.168.1.0/24 20.0.0.1
# Create logical port foo1 in foo # Create logical port foo1 in foo
ovn-nbctl lport-add foo foo1 \ ovn-nbctl lsp-add foo foo1 \
-- lport-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2" -- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
# Create logical port alice1 in alice # Create logical port alice1 in alice
ovn-nbctl lport-add alice alice1 \ ovn-nbctl lsp-add alice alice1 \
-- lport-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2" -- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
# Create logical port bob1 in bob # Create logical port bob1 in bob
ovn-nbctl lport-add bob bob1 \ ovn-nbctl lsp-add bob bob1 \
-- lport-set-addresses bob1 "f0:00:00:01:02:05 172.16.2.2" -- lsp-set-addresses bob1 "f0:00:00:01:02:05 172.16.2.2"
# Create two hypervisor and create OVS ports corresponding to logical ports. # Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1 net_add n1
@ -2542,15 +2548,15 @@ AT_CHECK([ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1
AT_CHECK([ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv/snoopvif-tx.pcap options:rxq_pcap=hv/snoopvif-rx.pcap]) AT_CHECK([ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv/snoopvif-tx.pcap options:rxq_pcap=hv/snoopvif-rx.pcap])
# Create a vif. # Create a vif.
AT_CHECK([ovn-nbctl lport-add lsw0 localvif1]) AT_CHECK([ovn-nbctl lsp-add lsw0 localvif1])
AT_CHECK([ovn-nbctl lport-set-addresses localvif1 "f0:00:00:00:00:01 192.168.1.2"]) AT_CHECK([ovn-nbctl lsp-set-addresses localvif1 "f0:00:00:00:00:01 192.168.1.2"])
AT_CHECK([ovn-nbctl lport-set-port-security localvif1 "f0:00:00:00:00:01"]) AT_CHECK([ovn-nbctl lsp-set-port-security localvif1 "f0:00:00:00:00:01"])
# Create a localnet port. # Create a localnet port.
AT_CHECK([ovn-nbctl lport-add lsw0 ln_port]) AT_CHECK([ovn-nbctl lsp-add lsw0 ln_port])
AT_CHECK([ovn-nbctl lport-set-addresses ln_port unknown]) AT_CHECK([ovn-nbctl lsp-set-addresses ln_port unknown])
AT_CHECK([ovn-nbctl lport-set-type ln_port localnet]) AT_CHECK([ovn-nbctl lsp-set-type ln_port localnet])
AT_CHECK([ovn-nbctl lport-set-options ln_port network_name=physnet1]) AT_CHECK([ovn-nbctl lsp-set-options ln_port network_name=physnet1])
AT_CHECK([ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 external_ids:iface-id=localvif1]) AT_CHECK([ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 external_ids:iface-id=localvif1])
@ -2567,7 +2573,7 @@ cat packets
# Delete the localnet ports. # Delete the localnet ports.
AT_CHECK([ovs-vsctl del-port localvif1]) AT_CHECK([ovs-vsctl del-port localvif1])
AT_CHECK([ovn-nbctl lport-del ln_port]) AT_CHECK([ovn-nbctl lsp-del ln_port])
as hv as hv
OVS_APP_EXIT_AND_WAIT([ovn-controller]) OVS_APP_EXIT_AND_WAIT([ovn-controller])
@ -2611,32 +2617,32 @@ ovn-nbctl lswitch-add join
# Connect foo to R1 # Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24 ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lport-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \ ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
options:router-port=foo addresses=\"00:00:01:01:02:03\" options:router-port=foo addresses=\"00:00:01:01:02:03\"
# Connect alice to R2 # Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24 ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24
ovn-nbctl lport-add alice rp-alice -- set Logical_Switch_Port rp-alice \ ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
type=router options:router-port=alice addresses=\"00:00:02:01:02:03\" type=router options:router-port=alice addresses=\"00:00:02:01:02:03\"
# Connect bob to R3 # Connect bob to R3
ovn-nbctl lrp-add R3 bob 00:00:03:01:02:03 10.32.1.1/24 ovn-nbctl lrp-add R3 bob 00:00:03:01:02:03 10.32.1.1/24
ovn-nbctl lport-add bob rp-bob -- set Logical_Switch_Port rp-bob \ ovn-nbctl lsp-add bob rp-bob -- set Logical_Switch_Port rp-bob \
type=router options:router-port=bob addresses=\"00:00:03:01:02:03\" type=router options:router-port=bob addresses=\"00:00:03:01:02:03\"
# Connect R1 to join # Connect R1 to join
ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24 ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24
ovn-nbctl lport-add join r1-join -- set Logical_Switch_Port r1-join \ ovn-nbctl lsp-add join r1-join -- set Logical_Switch_Port r1-join \
type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"' type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"'
# Connect R2 to join # Connect R2 to join
ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24 ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24
ovn-nbctl lport-add join r2-join -- set Logical_Switch_Port r2-join \ ovn-nbctl lsp-add join r2-join -- set Logical_Switch_Port r2-join \
type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"' type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"'
# Connect R3 to join # Connect R3 to join
ovn-nbctl lrp-add R3 R3_join 00:00:04:01:02:05 20.0.0.3/24 ovn-nbctl lrp-add R3 R3_join 00:00:04:01:02:05 20.0.0.3/24
ovn-nbctl lport-add join r3-join -- set Logical_Switch_Port r3-join \ ovn-nbctl lsp-add join r3-join -- set Logical_Switch_Port r3-join \
type=router options:router-port=R3_join addresses='"00:00:04:01:02:05"' type=router options:router-port=R3_join addresses='"00:00:04:01:02:05"'
#install static routes #install static routes
@ -2650,16 +2656,16 @@ ovn-nbctl lr-route-add R3 192.168.1.0/24 20.0.0.1
ovn-nbctl lr-route-add R3 172.16.1.0/24 20.0.0.2 ovn-nbctl lr-route-add R3 172.16.1.0/24 20.0.0.2
# Create logical port foo1 in foo # Create logical port foo1 in foo
ovn-nbctl lport-add foo foo1 \ ovn-nbctl lsp-add foo foo1 \
-- lport-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2" -- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
# Create logical port alice1 in alice # Create logical port alice1 in alice
ovn-nbctl lport-add alice alice1 \ ovn-nbctl lsp-add alice alice1 \
-- lport-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2" -- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
# Create logical port bob1 in bob # Create logical port bob1 in bob
ovn-nbctl lport-add bob bob1 \ ovn-nbctl lsp-add bob bob1 \
-- lport-set-addresses bob1 "f0:00:00:01:02:05 10.32.1.2" -- lsp-set-addresses bob1 "f0:00:00:01:02:05 10.32.1.2"
# Create two hypervisor and create OVS ports corresponding to logical ports. # Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1 net_add n1
@ -2844,22 +2850,22 @@ ovn-nbctl lswitch-add join
# Connect foo to R1 # Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24 ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lport-add foo rp-foo -- set Logical_Switch_Port rp-foo \ ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \
type=router options:router-port=foo addresses=\"00:00:01:01:02:03\" type=router options:router-port=foo addresses=\"00:00:01:01:02:03\"
# Connect alice to R2 # Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24 ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24
ovn-nbctl lport-add alice rp-alice -- set Logical_Switch_Port rp-alice \ ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
type=router options:router-port=alice addresses=\"00:00:02:01:02:03\" type=router options:router-port=alice addresses=\"00:00:02:01:02:03\"
# Connect R1 to join # Connect R1 to join
ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24 ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24
ovn-nbctl lport-add join r1-join -- set Logical_Switch_Port r1-join \ ovn-nbctl lsp-add join r1-join -- set Logical_Switch_Port r1-join \
type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"' type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"'
# Connect R2 to join # Connect R2 to join
ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24 ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24
ovn-nbctl lport-add join r2-join -- set Logical_Switch_Port r2-join \ ovn-nbctl lsp-add join r2-join -- set Logical_Switch_Port r2-join \
type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"' type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"'
@ -2873,12 +2879,12 @@ ip_prefix=192.168.1.0/24 nexthop=20.0.0.1 -- add Logical_Router \
R2 static_routes @lrt R2 static_routes @lrt
# Create logical port foo1 in foo # Create logical port foo1 in foo
ovn-nbctl lport-add foo foo1 \ ovn-nbctl lsp-add foo foo1 \
-- lport-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2" -- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
# Create logical port alice1 in alice # Create logical port alice1 in alice
ovn-nbctl lport-add alice alice1 \ ovn-nbctl lsp-add alice alice1 \
-- lport-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2" -- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
# Allow some time for ovn-northd and ovn-controller to catch up. # Allow some time for ovn-northd and ovn-controller to catch up.
@ -2979,21 +2985,21 @@ ovn-nbctl lswitch-add ls2
# Connect ls1 to R1 # Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:f1 192.168.1.1/24 ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:f1 192.168.1.1/24
ovn-nbctl lport-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 \ ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 \
type=router options:router-port=ls1 addresses=\"00:00:00:01:02:f1\" type=router options:router-port=ls1 addresses=\"00:00:00:01:02:f1\"
# Connect ls2 to R1 # Connect ls2 to R1
ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:f2 172.16.1.1/24 ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:f2 172.16.1.1/24
ovn-nbctl lport-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 \ ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 \
type=router options:router-port=ls2 addresses=\"00:00:00:01:02:f2\" type=router options:router-port=ls2 addresses=\"00:00:00:01:02:f2\"
# Create logical port ls1-lp1 in ls1 # Create logical port ls1-lp1 in ls1
ovn-nbctl lport-add ls1 ls1-lp1 \ ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lport-set-addresses ls1-lp1 "00:00:00:01:02:03 192.168.1.2" -- lsp-set-addresses ls1-lp1 "00:00:00:01:02:03 192.168.1.2"
# Create logical port ls2-lp1 in ls2 # Create logical port ls2-lp1 in ls2
ovn-nbctl lport-add ls2 ls2-lp1 \ ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lport-set-addresses ls2-lp1 "00:00:00:01:02:04 172.16.1.2" -- lsp-set-addresses ls2-lp1 "00:00:00:01:02:04 172.16.1.2"
# Create one hypervisor and create OVS ports corresponding to logical ports. # Create one hypervisor and create OVS ports corresponding to logical ports.
net_add n1 net_add n1

View File

@ -65,9 +65,9 @@ You can use the `ovn-nbctl` utility to see an overview of the logical topology.
$ ovn-nbctl show $ ovn-nbctl show
lswitch 78687d53-e037-4555-bcd3-f4f8eaf3f2aa (sw0) lswitch 78687d53-e037-4555-bcd3-f4f8eaf3f2aa (sw0)
lport sw0-port1 port sw0-port1
addresses: 00:00:00:00:00:01 addresses: 00:00:00:00:00:01
lport sw0-port2 port sw0-port2
addresses: 00:00:00:00:00:02 addresses: 00:00:00:00:00:02
The `ovn-sbctl` utility can be used to see into the state stored in the The `ovn-sbctl` utility can be used to see into the state stored in the
@ -238,14 +238,14 @@ View the logical topology with `ovn-nbctl`.
$ ovn-nbctl show $ ovn-nbctl show
lswitch e3190dc2-89d1-44ed-9308-e7077de782b3 (sw0) lswitch e3190dc2-89d1-44ed-9308-e7077de782b3 (sw0)
lport sw0-port1 port sw0-port1
addresses: 00:00:00:00:00:01 addresses: 00:00:00:00:00:01
lport sw0-port2 port sw0-port2
addresses: 00:00:00:00:00:02 addresses: 00:00:00:00:00:02
lswitch c8ed4c5f-9733-43f6-93da-795b1aabacb1 (sw1) lswitch c8ed4c5f-9733-43f6-93da-795b1aabacb1 (sw1)
lport sw1-port1 port sw1-port1
addresses: 00:00:00:00:00:03 addresses: 00:00:00:00:00:03
lport sw1-port2 port sw1-port2
addresses: 00:00:00:00:00:04 addresses: 00:00:00:00:00:04
Physically, all ports reside on the same chassis. Physically, all ports reside on the same chassis.
@ -349,13 +349,13 @@ You can start by viewing the logical topology with `ovn-nbctl`.
$ ovn-nbctl show $ ovn-nbctl show
lswitch b977dc03-79a5-41ba-9665-341a80e1abfd (sw0) lswitch b977dc03-79a5-41ba-9665-341a80e1abfd (sw0)
lport sw0-port1 port sw0-port1
addresses: 00:00:00:00:00:01 addresses: 00:00:00:00:00:01
lport sw0-port2 port sw0-port2
addresses: 00:00:00:00:00:02 addresses: 00:00:00:00:00:02
lport sw0-port4 port sw0-port4
addresses: 00:00:00:00:00:04 addresses: 00:00:00:00:00:04
lport sw0-port3 port sw0-port3
addresses: 00:00:00:00:00:03 addresses: 00:00:00:00:00:03
Using `ovn-sbctl` to view the state of the system, we can see that there are two Using `ovn-sbctl` to view the state of the system, we can see that there are two
@ -464,34 +464,34 @@ The logical topology from `ovn-nbctl` should look like this.
$ ovn-nbctl show $ ovn-nbctl show
lswitch 5a652488-cfba-4f3e-929d-00010cdfde40 (provnet1-2) lswitch 5a652488-cfba-4f3e-929d-00010cdfde40 (provnet1-2)
lport provnet1-2-physnet1 port provnet1-2-physnet1
addresses: unknown addresses: unknown
lport provnet1-2-port1 port provnet1-2-port1
addresses: 00:00:00:00:00:02 addresses: 00:00:00:00:00:02
lswitch 5829b60a-eda8-4d78-94f6-7017ff9efcf0 (provnet1-4) lswitch 5829b60a-eda8-4d78-94f6-7017ff9efcf0 (provnet1-4)
lport provnet1-4-port1 port provnet1-4-port1
addresses: 00:00:00:00:00:04 addresses: 00:00:00:00:00:04
lport provnet1-4-physnet1 port provnet1-4-physnet1
addresses: unknown addresses: unknown
lswitch 06cbbcb6-38e3-418d-a81e-634ec9b54ad6 (provnet1-1) lswitch 06cbbcb6-38e3-418d-a81e-634ec9b54ad6 (provnet1-1)
lport provnet1-1-port1 port provnet1-1-port1
addresses: 00:00:00:00:00:01 addresses: 00:00:00:00:00:01
lport provnet1-1-physnet1 port provnet1-1-physnet1
addresses: unknown addresses: unknown
lswitch 9cba3b3b-59ae-4175-95f5-b6f1cd9c2afb (provnet1-3) lswitch 9cba3b3b-59ae-4175-95f5-b6f1cd9c2afb (provnet1-3)
lport provnet1-3-physnet1 port provnet1-3-physnet1
addresses: unknown addresses: unknown
lport provnet1-3-port1 port provnet1-3-port1
addresses: 00:00:00:00:00:03 addresses: 00:00:00:00:00:03
`port1` on each logical switch represents a regular logical port for a VIF on a `port1` on each logical switch represents a regular logical port for a VIF on a
hypervisor. `physnet1` on each logical switch is the special `localnet` port. hypervisor. `physnet1` on each logical switch is the special `localnet` port.
You can use `ovn-nbctl` to see that this port has a `type` and `options` set. You can use `ovn-nbctl` to see that this port has a `type` and `options` set.
$ ovn-nbctl lport-get-type provnet1-1-physnet1 $ ovn-nbctl lsp-get-type provnet1-1-physnet1
localnet localnet
$ ovn-nbctl lport-get-options provnet1-1-physnet1 $ ovn-nbctl lsp-get-options provnet1-1-physnet1
network_name=physnet1 network_name=physnet1
The physical topology should reflect that there are two regular ports on each The physical topology should reflect that there are two regular ports on each
@ -617,47 +617,47 @@ set to `101`.
$ ovn-nbctl show $ ovn-nbctl show
lswitch 12ea93d0-694b-48e9-adef-d0ddd3ec4ac9 (provnet1-7-101) lswitch 12ea93d0-694b-48e9-adef-d0ddd3ec4ac9 (provnet1-7-101)
lport provnet1-7-physnet1-101 port provnet1-7-physnet1-101
parent: , tag:101 parent: , tag:101
addresses: unknown addresses: unknown
lport provnet1-7-101-port1 port provnet1-7-101-port1
addresses: 00:00:00:00:00:07 addresses: 00:00:00:00:00:07
lswitch c9a5ce3a-15ec-48ea-a898-416013463589 (provnet1-4) lswitch c9a5ce3a-15ec-48ea-a898-416013463589 (provnet1-4)
lport provnet1-4-port1 port provnet1-4-port1
addresses: 00:00:00:00:00:04 addresses: 00:00:00:00:00:04
lport provnet1-4-physnet1 port provnet1-4-physnet1
addresses: unknown addresses: unknown
lswitch e07d4f7a-2085-4fbb-9937-d6192b79a397 (provnet1-1) lswitch e07d4f7a-2085-4fbb-9937-d6192b79a397 (provnet1-1)
lport provnet1-1-physnet1 port provnet1-1-physnet1
addresses: unknown addresses: unknown
lport provnet1-1-port1 port provnet1-1-port1
addresses: 00:00:00:00:00:01 addresses: 00:00:00:00:00:01
lswitch 6c098474-0509-4219-bc9b-eb4e28dd1aeb (provnet1-2) lswitch 6c098474-0509-4219-bc9b-eb4e28dd1aeb (provnet1-2)
lport provnet1-2-physnet1 port provnet1-2-physnet1
addresses: unknown addresses: unknown
lport provnet1-2-port1 port provnet1-2-port1
addresses: 00:00:00:00:00:02 addresses: 00:00:00:00:00:02
lswitch 723c4684-5d58-4202-b8e3-4ba99ad5ed9e (provnet1-8-101) lswitch 723c4684-5d58-4202-b8e3-4ba99ad5ed9e (provnet1-8-101)
lport provnet1-8-101-port1 port provnet1-8-101-port1
addresses: 00:00:00:00:00:08 addresses: 00:00:00:00:00:08
lport provnet1-8-physnet1-101 port provnet1-8-physnet1-101
parent: , tag:101 parent: , tag:101
addresses: unknown addresses: unknown
lswitch 8444e925-ceb2-4b02-ac20-eb2e4cfb954d (provnet1-6-101) lswitch 8444e925-ceb2-4b02-ac20-eb2e4cfb954d (provnet1-6-101)
lport provnet1-6-physnet1-101 port provnet1-6-physnet1-101
parent: , tag:101 parent: , tag:101
addresses: unknown addresses: unknown
lport provnet1-6-101-port1 port provnet1-6-101-port1
addresses: 00:00:00:00:00:06 addresses: 00:00:00:00:00:06
lswitch e11e5605-7c46-4395-b28d-cff57451fc7e (provnet1-3) lswitch e11e5605-7c46-4395-b28d-cff57451fc7e (provnet1-3)
lport provnet1-3-port1 port provnet1-3-port1
addresses: 00:00:00:00:00:03 addresses: 00:00:00:00:00:03
lport provnet1-3-physnet1 port provnet1-3-physnet1
addresses: unknown addresses: unknown
lswitch 0706b697-6c92-4d54-bc0a-db5bababb74a (provnet1-5-101) lswitch 0706b697-6c92-4d54-bc0a-db5bababb74a (provnet1-5-101)
lport provnet1-5-101-port1 port provnet1-5-101-port1
addresses: 00:00:00:00:00:05 addresses: 00:00:00:00:00:05
lport provnet1-5-physnet1-101 port provnet1-5-physnet1-101
parent: , tag:101 parent: , tag:101
addresses: unknown addresses: unknown

View File

@ -15,7 +15,7 @@
set -o xtrace set -o xtrace
ovn-nbctl lport-add sw0 sw0-port3 ovn-nbctl lsp-add sw0 sw0-port3
ovn-nbctl lport-set-addresses sw0-port3 00:00:00:00:00:03 ovn-nbctl lsp-set-addresses sw0-port3 00:00:00:00:00:03
ovn-nbctl lport-set-port-security sw0-port3 00:00:00:00:00:03 ovn-nbctl lsp-set-port-security sw0-port3 00:00:00:00:00:03
ovs-vsctl add-port br-int lport3 -- set Interface lport3 external_ids:iface-id=sw0-port3 ovs-vsctl add-port br-int lport3 -- set Interface lport3 external_ids:iface-id=sw0-port3

View File

@ -23,18 +23,18 @@ set -o xtrace
ovn-nbctl lswitch-add sw0 ovn-nbctl lswitch-add sw0
# Create two logical ports on "sw0". # Create two logical ports on "sw0".
ovn-nbctl lport-add sw0 sw0-port1 ovn-nbctl lsp-add sw0 sw0-port1
ovn-nbctl lport-add sw0 sw0-port2 ovn-nbctl lsp-add sw0 sw0-port2
# Set a MAC address for each of the two logical ports. # Set a MAC address for each of the two logical ports.
ovn-nbctl lport-set-addresses sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-addresses sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
# Set up port security for the two logical ports. This ensures that # Set up port security for the two logical ports. This ensures that
# the logical port mac address we have configured is the only allowed # the logical port mac address we have configured is the only allowed
# source and destination mac address for these ports. # source and destination mac address for these ports.
ovn-nbctl lport-set-port-security sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-port-security sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
# Create ports on the local OVS bridge, br-int. When ovn-controller # Create ports on the local OVS bridge, br-int. When ovn-controller
# sees these ports show up with an "iface-id" that matches the OVN # sees these ports show up with an "iface-id" that matches the OVN

View File

@ -17,18 +17,18 @@ set -o xtrace
ovn-nbctl lswitch-add sw0 ovn-nbctl lswitch-add sw0
ovn-nbctl lswitch-add sw1 ovn-nbctl lswitch-add sw1
ovn-nbctl lport-add sw0 sw0-port1 ovn-nbctl lsp-add sw0 sw0-port1
ovn-nbctl lport-add sw0 sw0-port2 ovn-nbctl lsp-add sw0 sw0-port2
ovn-nbctl lport-add sw1 sw1-port1 ovn-nbctl lsp-add sw1 sw1-port1
ovn-nbctl lport-add sw1 sw1-port2 ovn-nbctl lsp-add sw1 sw1-port2
ovn-nbctl lport-set-addresses sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-addresses sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
ovn-nbctl lport-set-addresses sw1-port1 00:00:00:00:00:03 ovn-nbctl lsp-set-addresses sw1-port1 00:00:00:00:00:03
ovn-nbctl lport-set-addresses sw1-port2 00:00:00:00:00:04 ovn-nbctl lsp-set-addresses sw1-port2 00:00:00:00:00:04
ovn-nbctl lport-set-port-security sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-port-security sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
ovn-nbctl lport-set-port-security sw1-port1 00:00:00:00:00:03 ovn-nbctl lsp-set-port-security sw1-port1 00:00:00:00:00:03
ovn-nbctl lport-set-port-security sw1-port2 00:00:00:00:00:04 ovn-nbctl lsp-set-port-security sw1-port2 00:00:00:00:00:04
ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=sw0-port1 ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=sw0-port1
ovs-vsctl add-port br-int lport2 -- set Interface lport2 external_ids:iface-id=sw0-port2 ovs-vsctl add-port br-int lport2 -- set Interface lport2 external_ids:iface-id=sw0-port2

View File

@ -17,20 +17,20 @@ set -o xtrace
ovn-nbctl lswitch-add sw0 ovn-nbctl lswitch-add sw0
ovn-nbctl lport-add sw0 sw0-port1 ovn-nbctl lsp-add sw0 sw0-port1
ovn-nbctl lport-add sw0 sw0-port2 ovn-nbctl lsp-add sw0 sw0-port2
ovn-nbctl lport-add sw0 sw0-port3 ovn-nbctl lsp-add sw0 sw0-port3
ovn-nbctl lport-add sw0 sw0-port4 ovn-nbctl lsp-add sw0 sw0-port4
ovn-nbctl lport-set-addresses sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-addresses sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
ovn-nbctl lport-set-addresses sw0-port3 00:00:00:00:00:03 ovn-nbctl lsp-set-addresses sw0-port3 00:00:00:00:00:03
ovn-nbctl lport-set-addresses sw0-port4 00:00:00:00:00:04 ovn-nbctl lsp-set-addresses sw0-port4 00:00:00:00:00:04
ovn-nbctl lport-set-port-security sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-port-security sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
ovn-nbctl lport-set-port-security sw0-port3 00:00:00:00:00:03 ovn-nbctl lsp-set-port-security sw0-port3 00:00:00:00:00:03
ovn-nbctl lport-set-port-security sw0-port4 00:00:00:00:00:04 ovn-nbctl lsp-set-port-security sw0-port4 00:00:00:00:00:04
# Bind sw0-port1 and sw0-port2 to the local chassis # Bind sw0-port1 and sw0-port2 to the local chassis
ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=sw0-port1 ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=sw0-port1

View File

@ -30,14 +30,14 @@ ovn-sbctl chassis-add fakechassis geneve 127.0.0.1
for n in 1 2 3 4; do for n in 1 2 3 4; do
ovn-nbctl lswitch-add provnet1-$n ovn-nbctl lswitch-add provnet1-$n
ovn-nbctl lport-add provnet1-$n provnet1-$n-port1 ovn-nbctl lsp-add provnet1-$n provnet1-$n-port1
ovn-nbctl lport-set-addresses provnet1-$n-port1 00:00:00:00:00:0$n ovn-nbctl lsp-set-addresses provnet1-$n-port1 00:00:00:00:00:0$n
ovn-nbctl lport-set-port-security provnet1-$n-port1 00:00:00:00:00:0$n ovn-nbctl lsp-set-port-security provnet1-$n-port1 00:00:00:00:00:0$n
ovn-nbctl lport-add provnet1-$n provnet1-$n-physnet1 ovn-nbctl lsp-add provnet1-$n provnet1-$n-physnet1
ovn-nbctl lport-set-addresses provnet1-$n-physnet1 unknown ovn-nbctl lsp-set-addresses provnet1-$n-physnet1 unknown
ovn-nbctl lport-set-type provnet1-$n-physnet1 localnet ovn-nbctl lsp-set-type provnet1-$n-physnet1 localnet
ovn-nbctl lport-set-options provnet1-$n-physnet1 network_name=physnet1 ovn-nbctl lsp-set-options provnet1-$n-physnet1 network_name=physnet1
done done
ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1 ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1

View File

@ -33,27 +33,27 @@ ovn-sbctl chassis-add fakechassis geneve 127.0.0.1
for n in 1 2 3 4 5 6 7 8; do for n in 1 2 3 4 5 6 7 8; do
if [ $n -gt 4 ] ; then if [ $n -gt 4 ] ; then
lswitch_name="provnet1-$n-101" lswitch_name="provnet1-$n-101"
lport_name="$lswitch_name-port1" lsp_name="$lswitch_name-port1"
else else
lswitch_name="provnet1-$n" lswitch_name="provnet1-$n"
fi fi
ovn-nbctl lswitch-add $lswitch_name ovn-nbctl lswitch-add $lswitch_name
lport_name="$lswitch_name-port1" lsp_name="$lswitch_name-port1"
ovn-nbctl lport-add $lswitch_name $lport_name ovn-nbctl lsp-add $lswitch_name $lsp_name
ovn-nbctl lport-set-addresses $lport_name 00:00:00:00:00:0$n ovn-nbctl lsp-set-addresses $lsp_name 00:00:00:00:00:0$n
ovn-nbctl lport-set-port-security $lport_name 00:00:00:00:00:0$n ovn-nbctl lsp-set-port-security $lsp_name 00:00:00:00:00:0$n
if [ $n -gt 4 ] ; then if [ $n -gt 4 ] ; then
lport_name="provnet1-$n-physnet1-101" lsp_name="provnet1-$n-physnet1-101"
ovn-nbctl lport-add $lswitch_name $lport_name "" 101 ovn-nbctl lsp-add $lswitch_name $lsp_name "" 101
else else
lport_name="provnet1-$n-physnet1" lsp_name="provnet1-$n-physnet1"
ovn-nbctl lport-add $lswitch_name $lport_name ovn-nbctl lsp-add $lswitch_name $lsp_name
fi fi
ovn-nbctl lport-set-addresses $lport_name unknown ovn-nbctl lsp-set-addresses $lsp_name unknown
ovn-nbctl lport-set-type $lport_name localnet ovn-nbctl lsp-set-type $lsp_name localnet
ovn-nbctl lport-set-options $lport_name network_name=physnet1 ovn-nbctl lsp-set-options $lsp_name network_name=physnet1
done done
ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1 ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1

View File

@ -23,18 +23,18 @@ set -o xtrace
ovn-nbctl lswitch-add sw0 ovn-nbctl lswitch-add sw0
# Create two logical ports on "sw0". # Create two logical ports on "sw0".
ovn-nbctl lport-add sw0 sw0-port1 ovn-nbctl lsp-add sw0 sw0-port1
ovn-nbctl lport-add sw0 sw0-port2 ovn-nbctl lsp-add sw0 sw0-port2
# Set a MAC address for each of the two logical ports. # Set a MAC address for each of the two logical ports.
ovn-nbctl lport-set-addresses sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-addresses sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
# Set up port security for the two logical ports. This ensures that # Set up port security for the two logical ports. This ensures that
# the logical port mac address we have configured is the only allowed # the logical port mac address we have configured is the only allowed
# source and destination mac address for these ports. # source and destination mac address for these ports.
ovn-nbctl lport-set-port-security sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-port-security sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
# Create ports on the local OVS bridge, br-int. When ovn-controller # Create ports on the local OVS bridge, br-int. When ovn-controller
# sees these ports show up with an "iface-id" that matches the OVN # sees these ports show up with an "iface-id" that matches the OVN

View File

@ -19,14 +19,14 @@ set -o xtrace
ovn-nbctl lswitch-add csw0 ovn-nbctl lswitch-add csw0
# create a container port with parent set to sw0-port1 # create a container port with parent set to sw0-port1
ovn-nbctl lport-add csw0 csw0-cport1 sw0-port1 42 ovn-nbctl lsp-add csw0 csw0-cport1 sw0-port1 42
ovn-nbctl lport-set-addresses csw0-cport1 00:00:00:00:01:01 ovn-nbctl lsp-set-addresses csw0-cport1 00:00:00:00:01:01
ovn-nbctl lport-set-port-security csw0-cport1 00:00:00:00:01:01 ovn-nbctl lsp-set-port-security csw0-cport1 00:00:00:00:01:01
# create another container port with parent set to sw0-port1 # create another container port with parent set to sw0-port1
ovn-nbctl lport-add csw0 csw0-cport2 sw0-port2 43 ovn-nbctl lsp-add csw0 csw0-cport2 sw0-port2 43
ovn-nbctl lport-set-addresses csw0-cport2 00:00:00:00:01:02 ovn-nbctl lsp-set-addresses csw0-cport2 00:00:00:00:01:02
ovn-nbctl lport-set-port-security csw0-cport2 00:00:00:00:01:02 ovn-nbctl lsp-set-port-security csw0-cport2 00:00:00:00:01:02
# Make lport1 as a patch port, other end connected to br-vmport1 # Make lport1 as a patch port, other end connected to br-vmport1

View File

@ -19,17 +19,17 @@ set -o xtrace
ovn-nbctl lswitch-add sw0 ovn-nbctl lswitch-add sw0
# Create two logical ports on "sw0". # Create two logical ports on "sw0".
ovn-nbctl lport-add sw0 sw0-port1 ovn-nbctl lsp-add sw0 sw0-port1
ovn-nbctl lport-add sw0 sw0-port2 ovn-nbctl lsp-add sw0 sw0-port2
ovn-nbctl lport-add sw0 sw0-port3 ovn-nbctl lsp-add sw0 sw0-port3
ovn-nbctl lport-set-addresses sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-addresses sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
ovn-nbctl lport-set-addresses sw0-port3 00:00:00:00:00:03 ovn-nbctl lsp-set-addresses sw0-port3 00:00:00:00:00:03
ovn-nbctl lport-set-port-security sw0-port1 00:00:00:00:00:01 ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01
ovn-nbctl lport-set-port-security sw0-port2 00:00:00:00:00:02 ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
ovn-nbctl lport-set-port-security sw0-port3 00:00:00:00:00:03 ovn-nbctl lsp-set-port-security sw0-port3 00:00:00:00:00:03
ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=sw0-port1 ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=sw0-port1
ovs-vsctl add-port br-int lport2 -- set Interface lport2 external_ids:iface-id=sw0-port2 ovs-vsctl add-port br-int lport2 -- set Interface lport2 external_ids:iface-id=sw0-port2

View File

@ -275,8 +275,8 @@ for i in 0 1; do
ovs-vsctl add-br br-phys ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.`expr $i + 1` ovn_attach n1 br-phys 192.168.0.`expr $i + 1`
ovs-vsctl add-port br-int vif$i -- set Interface vif$i external-ids:iface-id=lp$i ovs-vsctl add-port br-int vif$i -- set Interface vif$i external-ids:iface-id=lp$i
ovn-nbctl lport-add lsw0 lp$i ovn-nbctl lsp-add lsw0 lp$i
ovn-nbctl lport-set-addresses lp$i f0:00:00:00:00:0$i ovn-nbctl lsp-set-addresses lp$i f0:00:00:00:00:0$i
done done
</pre> </pre>
@ -306,8 +306,8 @@ wait
for i in `seq $n`; do for i in `seq $n`; do
yy=$(printf %02x $(expr $i / 256)) yy=$(printf %02x $(expr $i / 256))
xx=$(printf $02x $(expr $i % 256)) xx=$(printf $02x $(expr $i % 256))
ovn-nbctl lport-add br0 lp$i ovn-nbctl lsp-add br0 lp$i
ovn-nbctl lport-set-addresses lp$i f0:00:00:00:$yy:$xx ovn-nbctl lsp-set-addresses lp$i f0:00:00:00:$yy:$xx
done done
</pre> </pre>
@ -317,7 +317,7 @@ done
</p> </p>
<pre> <pre>
watch 'for i in `seq $n`; do if test `ovn-nbctl lport-get-up lp$i` != up; then echo $i; fi; done' watch 'for i in `seq $n`; do if test `ovn-nbctl lsp-get-up lp$i` != up; then echo $i; fi; done'
</pre> </pre>
</manpage> </manpage>