mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 01:51:26 +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:
parent
80f408f4cf
commit
31ed1192e2
@ -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:
|
||||
|
||||
```
|
||||
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.
|
||||
|
@ -228,9 +228,9 @@ def create_endpoint():
|
||||
mac_address_output = ""
|
||||
|
||||
try:
|
||||
ovn_nbctl("lport-add", nid, eid)
|
||||
ovn_nbctl("lsp-add", nid, eid)
|
||||
except Exception as e:
|
||||
error = "create_endpoint: lport-add (%s)" % (str(e))
|
||||
error = "create_endpoint: lsp-add (%s)" % (str(e))
|
||||
return jsonify({'Err': error})
|
||||
|
||||
if not mac_address_input:
|
||||
@ -243,10 +243,10 @@ def create_endpoint():
|
||||
mac_address = mac_address_input
|
||||
|
||||
try:
|
||||
ovn_nbctl("lport-set-addresses", eid,
|
||||
ovn_nbctl("lsp-set-addresses", eid,
|
||||
mac_address + " " + ip_address)
|
||||
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})
|
||||
|
||||
# Only return a mac address if one did not come as request.
|
||||
@ -295,7 +295,8 @@ def show_endpoint():
|
||||
if error:
|
||||
jsonify({'Err': error})
|
||||
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})
|
||||
|
||||
veth_outside = eid[0:15]
|
||||
@ -321,9 +322,9 @@ def delete_endpoint():
|
||||
abort(400)
|
||||
|
||||
try:
|
||||
ovn_nbctl("lport-del", eid)
|
||||
ovn_nbctl("lsp-del", eid)
|
||||
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({})
|
||||
|
@ -94,17 +94,17 @@
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h1>Logical Port Commands</h1>
|
||||
<h1>Logical Switch Port Commands</h1>
|
||||
<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>
|
||||
<p>
|
||||
Creates on <var>lswitch</var> a new logical port named
|
||||
<var>lport</var>.
|
||||
Creates on <var>lswitch</var> a new logical switch port named
|
||||
<var>port</var>.
|
||||
</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
|
||||
<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
|
||||
@ -112,19 +112,19 @@
|
||||
</p>
|
||||
</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>
|
||||
<p>
|
||||
Creates on <var>lswitch</var> a logical port named <var>lport</var>
|
||||
that is a child of <var>parent</var> that is identifed with VLAN ID
|
||||
<var>tag</var>. This is useful in cases such as virtualized
|
||||
container environments where Open vSwitch does not have a direct
|
||||
connection to the container's port and it must be shared with
|
||||
the virtual machine's port.
|
||||
Creates on <var>lswitch</var> a logical switch port named
|
||||
<var>port</var> that is a child of <var>parent</var> that is
|
||||
identifed with VLAN ID <var>tag</var>. This is useful in
|
||||
cases such as virtualized container environments where Open
|
||||
vSwitch does not have a direct connection to the container's
|
||||
port and it must be shared with the virtual machine's port.
|
||||
</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
|
||||
<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
|
||||
@ -132,55 +132,55 @@
|
||||
</p>
|
||||
</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>
|
||||
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.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-list</code> <var>lswitch</var></dt>
|
||||
<dt><code>lsp-list</code> <var>lswitch</var></dt>
|
||||
<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.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-parent</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-parent</code> <var>port</var></dt>
|
||||
<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.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-tag</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-tag</code> <var>port</var></dt>
|
||||
<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.
|
||||
</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>
|
||||
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
|
||||
Ethernet address or an Ethernet address followed by an IP address
|
||||
(separated by a space and quoted to form a single command-line
|
||||
argument). The special form <code>unknown</code> is also valid.
|
||||
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.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-addresses</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-addresses</code> <var>port</var></dt>
|
||||
<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.
|
||||
</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>
|
||||
<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
|
||||
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>
|
||||
@ -192,47 +192,47 @@
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-port-security</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-port-security</code> <var>port</var></dt>
|
||||
<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.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-up</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-up</code> <var>port</var></dt>
|
||||
<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>.
|
||||
</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>
|
||||
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 out of the port.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-enabled</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-enabled</code> <var>port</var></dt>
|
||||
<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>.
|
||||
</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>
|
||||
Set the type for the logical port. No special types have been implemented yet.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-type</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-type</code> <var>port</var></dt>
|
||||
<dd>
|
||||
Get the type for the logical port.
|
||||
</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>
|
||||
Set type-specific key-value options for the logical port.
|
||||
</dd>
|
||||
|
||||
<dt><code>lport-get-options</code> <var>lport</var></dt>
|
||||
<dt><code>lsp-get-options</code> <var>port</var></dt>
|
||||
<dd>
|
||||
Get the type-specific options for the logical port.
|
||||
</dd>
|
||||
|
@ -308,31 +308,31 @@ ACL commands:\n\
|
||||
acl-list LSWITCH print ACLs for LSWITCH\n\
|
||||
\n\
|
||||
Logical switch port commands:\n\
|
||||
lport-add LSWITCH LPORT add logical port LPORT on LSWITCH\n\
|
||||
lport-add LSWITCH LPORT PARENT TAG\n\
|
||||
add logical port LPORT on LSWITCH with PARENT\n\
|
||||
lsp-add LSWITCH PORT add logical port PORT on LSWITCH\n\
|
||||
lsp-add LSWITCH PORT PARENT TAG\n\
|
||||
add logical port PORT on LSWITCH with PARENT\n\
|
||||
on TAG\n\
|
||||
lport-del LPORT delete LPORT from its attached switch\n\
|
||||
lport-list LSWITCH print the names of all logical ports on LSWITCH\n\
|
||||
lport-get-parent LPORT get the parent of LPORT if set\n\
|
||||
lport-get-tag LPORT get the LPORT's tag if set\n\
|
||||
lport-set-addresses LPORT [ADDRESS]...\n\
|
||||
set MAC or MAC+IP addresses for LPORT.\n\
|
||||
lport-get-addresses LPORT get a list of MAC addresses on LPORT\n\
|
||||
lport-set-port-security LPORT [ADDRS]...\n\
|
||||
set port security addresses for LPORT.\n\
|
||||
lport-get-port-security LPORT get LPORT's port security addresses\n\
|
||||
lport-get-up LPORT get state of LPORT ('up' or 'down')\n\
|
||||
lport-set-enabled LPORT STATE\n\
|
||||
set administrative state LPORT\n\
|
||||
lsp-del PORT delete PORT from its attached switch\n\
|
||||
lsp-list LSWITCH print the names of all logical ports on LSWITCH\n\
|
||||
lsp-get-parent PORT get the parent of PORT if set\n\
|
||||
lsp-get-tag PORT get the PORT's tag if set\n\
|
||||
lsp-set-addresses PORT [ADDRESS]...\n\
|
||||
set MAC or MAC+IP addresses for PORT.\n\
|
||||
lsp-get-addresses PORT get a list of MAC addresses on PORT\n\
|
||||
lsp-set-port-security PORT [ADDRS]...\n\
|
||||
set port security addresses for PORT.\n\
|
||||
lsp-get-port-security PORT get PORT's port security addresses\n\
|
||||
lsp-get-up PORT get state of PORT ('up' or 'down')\n\
|
||||
lsp-set-enabled PORT STATE\n\
|
||||
set administrative state PORT\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\
|
||||
lport-set-type LPORT TYPE Set the type for LPORT\n\
|
||||
lport-get-type LPORT Get the type for LPORT\n\
|
||||
lport-set-options LPORT KEY=VALUE [KEY=VALUE]...\n\
|
||||
Set options related to the type of LPORT\n\
|
||||
lport-get-options LPORT Get the type specific options for LPORT\n\
|
||||
lsp-set-type PORT TYPE set the type for PORT\n\
|
||||
lsp-get-type PORT get the type for PORT\n\
|
||||
lsp-set-options PORT KEY=VALUE [KEY=VALUE]...\n\
|
||||
set options related to the type of PORT\n\
|
||||
lsp-get-options PORT get the type specific options for PORT\n\
|
||||
\n\
|
||||
Logical router commands:\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]);
|
||||
}
|
||||
} 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];
|
||||
@ -681,7 +681,7 @@ nbctl_lsp_add(struct ctl_context *ctx)
|
||||
lsp = lsp_by_name_or_uuid(ctx, lsp_name, false);
|
||||
if (lsp) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -689,29 +689,29 @@ nbctl_lsp_add(struct ctl_context *ctx)
|
||||
lsw = lsp_to_lswitch(ctx->idl, lsp);
|
||||
if (lsw != lswitch) {
|
||||
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));
|
||||
}
|
||||
|
||||
if (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);
|
||||
} 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);
|
||||
}
|
||||
|
||||
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);
|
||||
} 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]);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -2084,36 +2084,32 @@ static const struct ctl_command_syntax nbctl_commands[] = {
|
||||
{ "acl-list", 1, 1, "LSWITCH", NULL, nbctl_acl_list, NULL, "", RO },
|
||||
|
||||
/* 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 },
|
||||
{ "lport-del", 1, 1, "LPORT", NULL, nbctl_lsp_del, NULL, "--if-exists",
|
||||
RW },
|
||||
{ "lport-list", 1, 1, "LSWITCH", NULL, nbctl_lsp_list, NULL, "", RO },
|
||||
{ "lport-get-parent", 1, 1, "LPORT", NULL, nbctl_lsp_get_parent, NULL,
|
||||
{ "lsp-del", 1, 1, "PORT", NULL, nbctl_lsp_del, NULL, "--if-exists", RW },
|
||||
{ "lsp-list", 1, 1, "LSWITCH", NULL, nbctl_lsp_list, NULL, "", RO },
|
||||
{ "lsp-get-parent", 1, 1, "PORT", NULL, nbctl_lsp_get_parent, NULL,
|
||||
"", RO },
|
||||
{ "lport-get-tag", 1, 1, "LPORT", NULL, nbctl_lsp_get_tag, NULL, "",
|
||||
RO },
|
||||
{ "lport-set-addresses", 1, INT_MAX, "LPORT [ADDRESS]...", NULL,
|
||||
{ "lsp-get-tag", 1, 1, "PORT", NULL, nbctl_lsp_get_tag, NULL, "", RO },
|
||||
{ "lsp-set-addresses", 1, INT_MAX, "PORT [ADDRESS]...", NULL,
|
||||
nbctl_lsp_set_addresses, NULL, "", RW },
|
||||
{ "lport-get-addresses", 1, 1, "LPORT", NULL,
|
||||
nbctl_lsp_get_addresses, NULL,
|
||||
{ "lsp-get-addresses", 1, 1, "PORT", NULL, nbctl_lsp_get_addresses, NULL,
|
||||
"", 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 },
|
||||
{ "lport-get-port-security", 1, 1, "LPORT", NULL,
|
||||
{ "lsp-get-port-security", 1, 1, "PORT", NULL,
|
||||
nbctl_lsp_get_port_security, NULL, "", RO },
|
||||
{ "lport-get-up", 1, 1, "LPORT", NULL, nbctl_lsp_get_up, NULL, "", RO },
|
||||
{ "lport-set-enabled", 2, 2, "LPORT STATE", NULL, nbctl_lsp_set_enabled,
|
||||
{ "lsp-get-up", 1, 1, "PORT", NULL, nbctl_lsp_get_up, NULL, "", RO },
|
||||
{ "lsp-set-enabled", 2, 2, "PORT STATE", NULL, nbctl_lsp_set_enabled,
|
||||
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 },
|
||||
{ "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 },
|
||||
{ "lport-get-type", 1, 1, "LPORT", NULL, nbctl_lsp_get_type, NULL, "",
|
||||
RO },
|
||||
{ "lport-set-options", 1, INT_MAX, "LPORT KEY=VALUE [KEY=VALUE]...", NULL,
|
||||
{ "lsp-get-type", 1, 1, "PORT", NULL, nbctl_lsp_get_type, NULL, "", RO },
|
||||
{ "lsp-set-options", 1, INT_MAX, "PORT KEY=VALUE [KEY=VALUE]...", NULL,
|
||||
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 },
|
||||
|
||||
/* logical router commands. */
|
||||
|
@ -102,10 +102,10 @@ m4_define([OVN_CONTROLLER_VTEP_STOP],
|
||||
# $3: physical vtep gateway name
|
||||
# $4: logical switch name on vtep gateway chassis
|
||||
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 lport-set-options $2 vtep-physical-switch=$3 vtep-logical-switch=$4])
|
||||
AT_CHECK([ovn-nbctl lsp-set-type $2 vtep])
|
||||
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
|
||||
# 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`"])
|
||||
# now should see the tunnel key reset.
|
||||
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
|
||||
# 'ch0'.
|
||||
AT_CHECK([ovn-nbctl lport-add br-test vif0])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02])
|
||||
AT_CHECK([ovn-nbctl lsp-add br-test vif0])
|
||||
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 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.
|
||||
AT_CHECK([ovn-nbctl lswitch-add br-void])
|
||||
# adds fake hv chassis 'ch1'.
|
||||
AT_CHECK([ovn-nbctl lport-add br-void vif1])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:02])
|
||||
AT_CHECK([ovn-nbctl lsp-add br-void vif1])
|
||||
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 lport-bind vif1 ch1])
|
||||
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.
|
||||
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`"])
|
||||
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.
|
||||
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`"])
|
||||
AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl
|
||||
"f0:ab:cd:ef:01:03"
|
||||
])
|
||||
|
||||
# migrates mac to logical switch port vif1 on 'br-void'.
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif0])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:03])
|
||||
AT_CHECK([ovn-nbctl lsp-set-addresses vif0])
|
||||
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`"])
|
||||
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
|
||||
# 'ch0'.
|
||||
AT_CHECK([ovn-nbctl lport-add br-test vif0])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02])
|
||||
AT_CHECK([ovn-nbctl lsp-add br-test vif0])
|
||||
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 lport-bind vif0 ch0])
|
||||
|
||||
# creates another vif in the same logical switch with duplicate mac.
|
||||
AT_CHECK([ovn-nbctl lport-add br-test vif1])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:02])
|
||||
AT_CHECK([ovn-nbctl lsp-add br-test vif1])
|
||||
AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02])
|
||||
AT_CHECK([ovn-sbctl lport-bind vif1 ch0])
|
||||
|
||||
# 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.
|
||||
AT_CHECK([ovn-nbctl lport-del vif1])
|
||||
AT_CHECK([ovn-nbctl lsp-del vif1])
|
||||
|
||||
# adds another lswitch 'br-void' in ovn-nb database.
|
||||
AT_CHECK([ovn-nbctl lswitch-add br-void])
|
||||
# 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 lport-set-addresses vif1 f0:ab:cd:ef:01:02])
|
||||
AT_CHECK([ovn-nbctl lsp-add br-void vif1])
|
||||
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 lport-bind vif1 ch1])
|
||||
OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep vif1`"])
|
||||
|
@ -87,51 +87,51 @@ AT_CLEANUP
|
||||
|
||||
dnl ---------------------------------------------------------------------
|
||||
|
||||
AT_SETUP([ovn-nbctl - basic lport commands])
|
||||
AT_SETUP([ovn-nbctl - basic logical switch port commands])
|
||||
OVN_NBCTL_TEST_START
|
||||
|
||||
AT_CHECK([ovn-nbctl lswitch-add ls0])
|
||||
AT_CHECK([ovn-nbctl lport-add ls0 lp0])
|
||||
AT_CHECK([ovn-nbctl lport-add ls0 lp0], [1], [],
|
||||
[ovn-nbctl: lp0: an lport with this name already exists
|
||||
AT_CHECK([ovn-nbctl lsp-add ls0 lp0])
|
||||
AT_CHECK([ovn-nbctl lsp-add ls0 lp0], [1], [],
|
||||
[ovn-nbctl: lp0: a port with this name already exists
|
||||
])
|
||||
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp0])
|
||||
AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp0])
|
||||
AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
|
||||
<0> (lp0)
|
||||
])
|
||||
|
||||
AT_CHECK([ovn-nbctl lport-add ls0 lp1])
|
||||
AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl lsp-add ls0 lp1])
|
||||
AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
|
||||
<0> (lp0)
|
||||
<1> (lp1)
|
||||
])
|
||||
|
||||
AT_CHECK([ovn-nbctl lswitch-add ls1])
|
||||
AT_CHECK([ovn-nbctl lport-add ls0 lp1], [1], [],
|
||||
[ovn-nbctl: lp1: an lport with this name already exists
|
||||
AT_CHECK([ovn-nbctl lsp-add ls0 lp1], [1], [],
|
||||
[ovn-nbctl: lp1: a port with this name already exists
|
||||
])
|
||||
AT_CHECK([ovn-nbctl --may-exist lport-add ls1 lp1], [1], [],
|
||||
[ovn-nbctl: lp1: lport already exists but in lswitch ls0
|
||||
AT_CHECK([ovn-nbctl --may-exist lsp-add ls1 lp1], [1], [],
|
||||
[ovn-nbctl: lp1: port already exists but in lswitch ls0
|
||||
])
|
||||
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp1 lp0 5], [1], [],
|
||||
[ovn-nbctl: lp1: lport already exists but has no parent
|
||||
AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp1 lp0 5], [1], [],
|
||||
[ovn-nbctl: lp1: port already exists but has no parent
|
||||
])
|
||||
|
||||
AT_CHECK([ovn-nbctl lport-del lp1])
|
||||
AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl lsp-del lp1])
|
||||
AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
|
||||
<0> (lp0)
|
||||
])
|
||||
|
||||
AT_CHECK([ovn-nbctl lport-add ls0 lp2 lp3 5])
|
||||
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp2 lp4 5], [1], [],
|
||||
[ovn-nbctl: lp2: lport already exists with different parent lp3
|
||||
AT_CHECK([ovn-nbctl lsp-add ls0 lp2 lp3 5])
|
||||
AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp4 5], [1], [],
|
||||
[ovn-nbctl: lp2: port already exists with different parent lp3
|
||||
])
|
||||
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp2 lp3 10], [1], [],
|
||||
[ovn-nbctl: lp2: lport already exists with different tag 5
|
||||
AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 10], [1], [],
|
||||
[ovn-nbctl: lp2: port already exists with different tag 5
|
||||
])
|
||||
AT_CHECK([ovn-nbctl clear Logical_Switch_Port lp2 tag])
|
||||
AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp2 lp3 5], [1], [],
|
||||
[ovn-nbctl: lp2: lport already exists but has no tag
|
||||
AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 5], [1], [],
|
||||
[ovn-nbctl: lp2: port already exists but has no tag
|
||||
])
|
||||
|
||||
OVN_NBCTL_TEST_STOP
|
||||
@ -143,18 +143,18 @@ AT_SETUP([ovn-nbctl - lport addresses])
|
||||
OVN_NBCTL_TEST_START
|
||||
|
||||
AT_CHECK([ovn-nbctl lswitch-add ls0])
|
||||
AT_CHECK([ovn-nbctl lport-add ls0 lp0])
|
||||
AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl lsp-add ls0 lp0])
|
||||
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 lport-get-addresses lp0], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl lsp-set-addresses lp0 00:11:22:33:44:55 unknown])
|
||||
AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl
|
||||
00:11:22:33:44:55
|
||||
unknown
|
||||
])
|
||||
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses lp0])
|
||||
AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl lsp-set-addresses lp0])
|
||||
AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl
|
||||
])
|
||||
|
||||
OVN_NBCTL_TEST_STOP
|
||||
@ -166,18 +166,18 @@ AT_SETUP([ovn-nbctl - port security])
|
||||
OVN_NBCTL_TEST_START
|
||||
|
||||
AT_CHECK([ovn-nbctl lswitch-add ls0])
|
||||
AT_CHECK([ovn-nbctl lport-add ls0 lp0])
|
||||
AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl lsp-add ls0 lp0])
|
||||
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 lport-get-port-security lp0], [0], [dnl
|
||||
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 lsp-get-port-security lp0], [0], [dnl
|
||||
00:11:22:33:44:55
|
||||
aa:bb:cc:dd:ee:ff
|
||||
])
|
||||
|
||||
AT_CHECK([ovn-nbctl lport-set-port-security lp0])
|
||||
AT_CHECK([ovn-nbctl lport-get-port-security lp0], [0], [dnl
|
||||
AT_CHECK([ovn-nbctl lsp-set-port-security lp0])
|
||||
AT_CHECK([ovn-nbctl lsp-get-port-security lp0], [0], [dnl
|
||||
])
|
||||
|
||||
OVN_NBCTL_TEST_STOP
|
||||
|
@ -80,8 +80,8 @@ AT_SETUP([ovn-sbctl])
|
||||
OVN_SBCTL_TEST_START
|
||||
|
||||
AT_CHECK([ovn-nbctl lswitch-add br-test])
|
||||
AT_CHECK([ovn-nbctl lport-add br-test vif0])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02])
|
||||
AT_CHECK([ovn-nbctl lsp-add br-test vif0])
|
||||
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 lport-bind vif0 ch0])
|
||||
|
||||
@ -93,8 +93,8 @@ Chassis "ch0"
|
||||
])
|
||||
|
||||
# adds another 'vif1'
|
||||
AT_CHECK([ovn-nbctl lport-add br-test vif1])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:03])
|
||||
AT_CHECK([ovn-nbctl lsp-add br-test vif1])
|
||||
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 show | sed 's/vif[[0-9]]/vif/'], [0], [dnl
|
||||
@ -106,7 +106,7 @@ Chassis "ch0"
|
||||
])
|
||||
|
||||
# deletes 'vif1'
|
||||
AT_CHECK([ovn-nbctl lport-del vif1])
|
||||
AT_CHECK([ovn-nbctl lsp-del vif1])
|
||||
|
||||
AT_CHECK([ovn-sbctl show], [0], [dnl
|
||||
Chassis "ch0"
|
||||
@ -123,9 +123,9 @@ chassis : ${uuid}
|
||||
])
|
||||
|
||||
# test the passing down of logical port type and options.
|
||||
AT_CHECK([ovn-nbctl lport-add br-test vtep0])
|
||||
AT_CHECK([ovn-nbctl lport-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-add br-test vtep0])
|
||||
AT_CHECK([ovn-nbctl lsp-set-type vtep0 vtep])
|
||||
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`" ])
|
||||
AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0], [0], [dnl
|
||||
|
268
tests/ovn.at
268
tests/ovn.at
@ -565,17 +565,17 @@ for i 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
|
||||
ovn-nbctl lport-add lsw0 lp$i$j
|
||||
ovn-nbctl lsp-add lsw0 lp$i$j
|
||||
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
|
||||
if test $j = 3; then
|
||||
ip_addrs="192.168.0.$i$j fe80::ea2a:eaff:fe28:$i$j/64 192.169.0.$i$j"
|
||||
else
|
||||
ip_addrs="192.168.0.$i$j"
|
||||
fi
|
||||
ovn-nbctl lport-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-addresses lp$i$j "f0:00:00:00:00:$i$j $ip_addrs"
|
||||
ovn-nbctl lsp-set-port-security lp$i$j f0:00:00:00:00:$i$j
|
||||
fi
|
||||
done
|
||||
done
|
||||
@ -604,7 +604,7 @@ vif_to_hv() {
|
||||
# content has Ethernet destination DST and source SRC (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 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() {
|
||||
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
|
||||
# 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.
|
||||
# SPA and TPA are each 8 hex digits.
|
||||
test_arp() {
|
||||
@ -663,10 +663,11 @@ ip_to_hex() {
|
||||
|
||||
# Send packets between all pairs of source and destination ports:
|
||||
#
|
||||
# 1. Unicast packets are delivered to exactly one lport (except that packets
|
||||
# destined to their input ports are dropped).
|
||||
# 1. Unicast packets are delivered to exactly one logical switch port
|
||||
# (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
|
||||
# MAC address.
|
||||
@ -677,8 +678,9 @@ ip_to_hex() {
|
||||
# affects behavior when port security is turned off, since otherwise port
|
||||
# security would drop the packet anyway.)
|
||||
#
|
||||
# 6. The lswitch delivers packets with an unknown destination to lports with
|
||||
# "unknown" among their MAC addresses (and port security disabled).
|
||||
# 6. The lswitch delivers packets with an unknown destination to logical
|
||||
# switch ports with "unknown" among their MAC addresses (and port
|
||||
# security disabled).
|
||||
#
|
||||
# 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
|
||||
|
||||
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`
|
||||
test_arp $s f000000000$s $sip $tip f000000000$d #9
|
||||
fi
|
||||
@ -761,7 +763,7 @@ done
|
||||
|
||||
# set address for lp13 with invalid characters.
|
||||
# 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`
|
||||
tip=`ip_to_hex 192 168 0 13`
|
||||
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.
|
||||
# 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:
|
||||
# - untagged
|
||||
# - lports: lp11, lp12, lp21, lp22
|
||||
@ -857,13 +859,13 @@ for i in 1 2 3; do
|
||||
ovn-nbctl lswitch-add $lswitch_name
|
||||
ln_port_name=ln$i
|
||||
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
|
||||
ovn-nbctl lport-add $lswitch_name $ln_port_name
|
||||
ovn-nbctl lsp-add $lswitch_name $ln_port_name
|
||||
fi
|
||||
ovn-nbctl lport-set-addresses $ln_port_name unknown
|
||||
ovn-nbctl lport-set-type $ln_port_name localnet
|
||||
ovn-nbctl lport-set-options $ln_port_name network_name=phys
|
||||
ovn-nbctl lsp-set-addresses $ln_port_name unknown
|
||||
ovn-nbctl lsp-set-type $ln_port_name localnet
|
||||
ovn-nbctl lsp-set-options $ln_port_name network_name=phys
|
||||
done
|
||||
|
||||
net_add n1
|
||||
@ -881,7 +883,7 @@ for i in 1 2; do
|
||||
options:rxq_pcap=hv$i/vif$i$j-rx.pcap \
|
||||
ofport-request=$i$j
|
||||
|
||||
lport_name=lp$i$j
|
||||
lsp_name=lp$i$j
|
||||
if test $j -le 2; then
|
||||
lswitch_name=ls1
|
||||
elif test $j -le 4; then
|
||||
@ -890,11 +892,11 @@ for i in 1 2; do
|
||||
lswitch_name=ls3
|
||||
fi
|
||||
|
||||
ovn-nbctl lport-add $lswitch_name $lport_name
|
||||
ovn-nbctl lport-set-addresses $lport_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-add $lswitch_name $lsp_name
|
||||
ovn-nbctl lsp-set-addresses $lsp_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
|
||||
|
||||
@ -914,7 +916,7 @@ vif_to_hv() {
|
||||
# content has Ethernet destination DST and source SRC (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 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() {
|
||||
sed 's/\(00\)\{1,\}$//'
|
||||
}
|
||||
@ -1034,16 +1036,16 @@ ovn_start
|
||||
# Configure the Northbound database
|
||||
ovn-nbctl lswitch-add lsw0
|
||||
|
||||
ovn-nbctl lport-add lsw0 lp1
|
||||
ovn-nbctl lport-set-addresses lp1 f0:00:00:00:00:01
|
||||
ovn-nbctl lsp-add lsw0 lp1
|
||||
ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01
|
||||
|
||||
ovn-nbctl lport-add lsw0 lp2
|
||||
ovn-nbctl lport-set-addresses lp2 f0:00:00:00:00:02
|
||||
ovn-nbctl lsp-add lsw0 lp2
|
||||
ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02
|
||||
|
||||
ovn-nbctl lport-add lsw0 lp-vtep
|
||||
ovn-nbctl lport-set-type lp-vtep vtep
|
||||
ovn-nbctl lport-set-options lp-vtep vtep-physical-switch=br-vtep vtep-logical-switch=lsw0
|
||||
ovn-nbctl lport-set-addresses lp-vtep unknown
|
||||
ovn-nbctl lsp-add lsw0 lp-vtep
|
||||
ovn-nbctl lsp-set-type lp-vtep vtep
|
||||
ovn-nbctl lsp-set-options lp-vtep vtep-physical-switch=br-vtep vtep-logical-switch=lsw0
|
||||
ovn-nbctl lsp-set-addresses lp-vtep unknown
|
||||
|
||||
net_add n1 # Network to connect hv1, hv2, and vtep
|
||||
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
|
||||
# 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
|
||||
# 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() {
|
||||
sed 's/\(00\)\{1,\}$//'
|
||||
}
|
||||
@ -1137,13 +1139,15 @@ test_packet() {
|
||||
|
||||
# Send packets between all pairs of source and destination ports:
|
||||
#
|
||||
# 1. Unicast packets are delivered to exactly one lport (except that packets
|
||||
# destined to their input ports are dropped).
|
||||
# 1. Unicast packets are delivered to exactly one logical switch port
|
||||
# (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
|
||||
# "unknown" among their MAC addresses (and port security disabled).
|
||||
# 3. The lswitch delivers packets with an unknown destination to logical
|
||||
# switch ports with "unknown" among their MAC addresses (and port
|
||||
# security disabled).
|
||||
for s in 1 2 3; do
|
||||
bcast=
|
||||
unknown=
|
||||
@ -1252,13 +1256,14 @@ for i in 1 2 3; do
|
||||
ovn-nbctl lswitch-add ls$i
|
||||
for j in 1 2 3; do
|
||||
for k in 1 2 3; do
|
||||
# Add "unknown" to MAC addresses for lp?11, so packets for
|
||||
# MAC-IP bindings discovered via ARP later have somewhere to go.
|
||||
if test $j$k = 11; then unknown=unknown; else unknown=; fi
|
||||
# Add "unknown" to MAC addresses for lp?11, so packets for
|
||||
# MAC-IP bindings discovered via ARP later have somewhere to go.
|
||||
if test $j$k = 11; then unknown=unknown; else unknown=; fi
|
||||
|
||||
ovn-nbctl \
|
||||
-- lport-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
|
||||
ovn-nbctl \
|
||||
-- lsp-add ls$i lp$i$j$k \
|
||||
-- lsp-set-addresses lp$i$j$k "f0:00:00:00:0$i:$j$k \
|
||||
192.168.$i$j.$k" $unknown
|
||||
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 \
|
||||
192.168.$i$j.254/24 lrp$i$j-attachment
|
||||
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 \
|
||||
options:router-port=lrp$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
|
||||
# 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
|
||||
# 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() {
|
||||
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:
|
||||
#
|
||||
# 1. Unicast IP packets are delivered to exactly one lport (except
|
||||
# that packets destined to their input ports are dropped).
|
||||
# 1. Unicast IP packets are delivered to exactly one logical switch port
|
||||
# (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() {
|
||||
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
|
||||
# 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.
|
||||
# SPA and TPA are each 8 hex digits.
|
||||
test_arp() {
|
||||
@ -1676,16 +1682,16 @@ for i 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
|
||||
ovn-nbctl lport-add lsw0 lp$i$j
|
||||
ovn-nbctl lsp-add lsw0 lp$i$j
|
||||
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
|
||||
ovn-nbctl lport-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-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j"
|
||||
ovn-nbctl lsp-set-port-security lp$i$j f0:00:00:00:00:$i$j
|
||||
else
|
||||
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 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-addresses 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
|
||||
done
|
||||
done
|
||||
@ -1721,8 +1727,8 @@ done
|
||||
# The packet's content has Ethernet destination DST and source SRC
|
||||
# (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
|
||||
# be received. INPORT and the OUTPORTs are specified as lport numbers,
|
||||
# e.g. 11 for vif11.
|
||||
# be received. INPORT and the OUTPORTs are specified as logical switch
|
||||
# port numbers, e.g. 11 for vif11.
|
||||
test_ip() {
|
||||
# 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
|
||||
@ -1743,7 +1749,7 @@ test_ip() {
|
||||
# it should be the hardware address of the target to expect to receive in an
|
||||
# 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.
|
||||
# SPA and TPA are each 8 hex digits.
|
||||
test_arp() {
|
||||
@ -1954,56 +1960,56 @@ for i in 1 2 3; do
|
||||
test_ipv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip $tip
|
||||
done
|
||||
|
||||
# configure lport13 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"
|
||||
# configure lsp13 to send and received IPv4 packets with an address range
|
||||
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
|
||||
|
||||
sip=`ip_to_hex 10 0 0 13`
|
||||
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
|
||||
|
||||
sip=`ip_to_hex 10 0 0 14`
|
||||
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
|
||||
test_ip 13 f00000000013 f00000000023 $sip $tip 23
|
||||
|
||||
sip=`ip_to_hex 192 168 0 33`
|
||||
tip=`ip_to_hex 10 0 0 15`
|
||||
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13
|
||||
# with dst ip 10.0.0.15 should be received by 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 lsp13
|
||||
test_ip 33 f00000000033 f00000000013 $sip $tip 13
|
||||
|
||||
sip=`ip_to_hex 192 168 0 33`
|
||||
tip=`ip_to_hex 20 0 0 4`
|
||||
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13
|
||||
# with dst ip 20.0.0.4 should be received by 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 lsp13
|
||||
test_ip 33 f00000000033 f00000000013 $sip $tip 13
|
||||
|
||||
sip=`ip_to_hex 192 168 0 33`
|
||||
tip=`ip_to_hex 20 0 0 5`
|
||||
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13
|
||||
# with dst ip 20.0.0.5 should not be received by 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 lsp13
|
||||
test_ip 33 f00000000033 f00000000013 $sip $tip
|
||||
|
||||
sip=`ip_to_hex 192 168 0 33`
|
||||
tip=`ip_to_hex 20 0 0 255`
|
||||
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13
|
||||
# with dst ip 20.0.0.255 should be received by 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 lsp13
|
||||
test_ip 33 f00000000033 f00000000013 $sip $tip 13
|
||||
|
||||
sip=`ip_to_hex 192 168 0 33`
|
||||
tip=`ip_to_hex 192 168 0 255`
|
||||
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13
|
||||
# with dst ip 192.168.0.255 should not be received by 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 lsp13
|
||||
test_ip 33 f00000000033 f00000000013 $sip $tip
|
||||
|
||||
sip=`ip_to_hex 192 168 0 33`
|
||||
tip=`ip_to_hex 224 0 0 4`
|
||||
# IPv4 packet from lport33 with src ip 192.168.0.33 destined to lport13
|
||||
# with dst ip 224.0.0.4 should be received by 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 lsp13
|
||||
test_ip 33 f00000000033 f00000000013 $sip $tip 13
|
||||
|
||||
# Allow some time for packet forwarding.
|
||||
@ -2084,13 +2090,13 @@ ovn-nbctl lswitch-add ls2
|
||||
# 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 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\"
|
||||
|
||||
# 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 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\"
|
||||
|
||||
# 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"
|
||||
|
||||
# Create logical port ls1-lp1 in ls1
|
||||
ovn-nbctl lport-add ls1 ls1-lp1 \
|
||||
-- lport-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
ovn-nbctl lsp-add ls1 ls1-lp1 \
|
||||
-- lsp-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
|
||||
# Create logical port ls2-lp1 in ls2
|
||||
ovn-nbctl lport-add ls2 ls2-lp1 \
|
||||
-- lport-set-addresses ls2-lp1 "f0:00:00:01:02:04 172.16.1.2"
|
||||
ovn-nbctl lsp-add ls2 ls2-lp1 \
|
||||
-- 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.
|
||||
net_add n1
|
||||
@ -2227,21 +2233,21 @@ ovn-nbctl lswitch-add ls2
|
||||
|
||||
# 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 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\"
|
||||
|
||||
# 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 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\"
|
||||
|
||||
# Create logical port ls1-lp1 in ls1
|
||||
ovn-nbctl lport-add ls1 ls1-lp1 \
|
||||
-- lport-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
ovn-nbctl lsp-add ls1 ls1-lp1 \
|
||||
-- lsp-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
|
||||
# Create logical port ls2-lp1 in ls2
|
||||
ovn-nbctl lport-add ls2 ls2-lp1 \
|
||||
-- lport-set-addresses ls2-lp1 "f0:00:00:01:02:04 172.16.1.2"
|
||||
ovn-nbctl lsp-add ls2 ls2-lp1 \
|
||||
-- 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.
|
||||
net_add n1
|
||||
@ -2366,17 +2372,17 @@ ovn-nbctl lswitch-add bob
|
||||
|
||||
# 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 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\"
|
||||
|
||||
# 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 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\"
|
||||
|
||||
# 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 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\"
|
||||
|
||||
# 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
|
||||
|
||||
# Create logical port foo1 in foo
|
||||
ovn-nbctl lport-add foo foo1 \
|
||||
-- lport-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
ovn-nbctl lsp-add foo foo1 \
|
||||
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
|
||||
# Create logical port alice1 in alice
|
||||
ovn-nbctl lport-add alice alice1 \
|
||||
-- lport-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
|
||||
ovn-nbctl lsp-add alice alice1 \
|
||||
-- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
|
||||
|
||||
# Create logical port bob1 in bob
|
||||
ovn-nbctl lport-add bob bob1 \
|
||||
-- lport-set-addresses bob1 "f0:00:00:01:02:05 172.16.2.2"
|
||||
ovn-nbctl lsp-add bob bob1 \
|
||||
-- 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.
|
||||
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])
|
||||
|
||||
# Create a vif.
|
||||
AT_CHECK([ovn-nbctl lport-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 lport-set-port-security localvif1 "f0:00:00:00:00:01"])
|
||||
AT_CHECK([ovn-nbctl lsp-add lsw0 localvif1])
|
||||
AT_CHECK([ovn-nbctl lsp-set-addresses localvif1 "f0:00:00:00:00:01 192.168.1.2"])
|
||||
AT_CHECK([ovn-nbctl lsp-set-port-security localvif1 "f0:00:00:00:00:01"])
|
||||
|
||||
# Create a localnet port.
|
||||
AT_CHECK([ovn-nbctl lport-add lsw0 ln_port])
|
||||
AT_CHECK([ovn-nbctl lport-set-addresses ln_port unknown])
|
||||
AT_CHECK([ovn-nbctl lport-set-type ln_port localnet])
|
||||
AT_CHECK([ovn-nbctl lport-set-options ln_port network_name=physnet1])
|
||||
AT_CHECK([ovn-nbctl lsp-add lsw0 ln_port])
|
||||
AT_CHECK([ovn-nbctl lsp-set-addresses ln_port unknown])
|
||||
AT_CHECK([ovn-nbctl lsp-set-type ln_port localnet])
|
||||
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])
|
||||
|
||||
@ -2567,7 +2573,7 @@ cat packets
|
||||
|
||||
# Delete the localnet ports.
|
||||
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
|
||||
OVS_APP_EXIT_AND_WAIT([ovn-controller])
|
||||
@ -2611,32 +2617,32 @@ ovn-nbctl lswitch-add join
|
||||
|
||||
# Connect foo to R1
|
||||
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\"
|
||||
|
||||
# Connect alice to R2
|
||||
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\"
|
||||
|
||||
# Connect bob to R3
|
||||
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\"
|
||||
|
||||
# Connect R1 to join
|
||||
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"'
|
||||
|
||||
# Connect R2 to join
|
||||
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"'
|
||||
|
||||
# Connect R3 to join
|
||||
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"'
|
||||
|
||||
#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
|
||||
|
||||
# Create logical port foo1 in foo
|
||||
ovn-nbctl lport-add foo foo1 \
|
||||
-- lport-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
ovn-nbctl lsp-add foo foo1 \
|
||||
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
|
||||
# Create logical port alice1 in alice
|
||||
ovn-nbctl lport-add alice alice1 \
|
||||
-- lport-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
|
||||
ovn-nbctl lsp-add alice alice1 \
|
||||
-- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
|
||||
|
||||
# Create logical port bob1 in bob
|
||||
ovn-nbctl lport-add bob bob1 \
|
||||
-- lport-set-addresses bob1 "f0:00:00:01:02:05 10.32.1.2"
|
||||
ovn-nbctl lsp-add bob bob1 \
|
||||
-- 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.
|
||||
net_add n1
|
||||
@ -2844,22 +2850,22 @@ ovn-nbctl lswitch-add join
|
||||
|
||||
# Connect foo to R1
|
||||
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\"
|
||||
|
||||
# Connect alice to R2
|
||||
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\"
|
||||
|
||||
# Connect R1 to join
|
||||
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"'
|
||||
|
||||
# Connect R2 to join
|
||||
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"'
|
||||
|
||||
|
||||
@ -2873,12 +2879,12 @@ ip_prefix=192.168.1.0/24 nexthop=20.0.0.1 -- add Logical_Router \
|
||||
R2 static_routes @lrt
|
||||
|
||||
# Create logical port foo1 in foo
|
||||
ovn-nbctl lport-add foo foo1 \
|
||||
-- lport-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
ovn-nbctl lsp-add foo foo1 \
|
||||
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"
|
||||
|
||||
# Create logical port alice1 in alice
|
||||
ovn-nbctl lport-add alice alice1 \
|
||||
-- lport-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"
|
||||
ovn-nbctl lsp-add alice alice1 \
|
||||
-- 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.
|
||||
@ -2979,21 +2985,21 @@ ovn-nbctl lswitch-add ls2
|
||||
|
||||
# Connect ls1 to R1
|
||||
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\"
|
||||
|
||||
# Connect ls2 to R1
|
||||
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\"
|
||||
|
||||
# Create logical port ls1-lp1 in ls1
|
||||
ovn-nbctl lport-add ls1 ls1-lp1 \
|
||||
-- lport-set-addresses ls1-lp1 "00:00:00:01:02:03 192.168.1.2"
|
||||
ovn-nbctl lsp-add ls1 ls1-lp1 \
|
||||
-- lsp-set-addresses ls1-lp1 "00:00:00:01:02:03 192.168.1.2"
|
||||
|
||||
# Create logical port ls2-lp1 in ls2
|
||||
ovn-nbctl lport-add ls2 ls2-lp1 \
|
||||
-- lport-set-addresses ls2-lp1 "00:00:00:01:02:04 172.16.1.2"
|
||||
ovn-nbctl lsp-add ls2 ls2-lp1 \
|
||||
-- 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.
|
||||
net_add n1
|
||||
|
@ -65,9 +65,9 @@ You can use the `ovn-nbctl` utility to see an overview of the logical topology.
|
||||
|
||||
$ ovn-nbctl show
|
||||
lswitch 78687d53-e037-4555-bcd3-f4f8eaf3f2aa (sw0)
|
||||
lport sw0-port1
|
||||
port sw0-port1
|
||||
addresses: 00:00:00:00:00:01
|
||||
lport sw0-port2
|
||||
port sw0-port2
|
||||
addresses: 00:00:00:00:00:02
|
||||
|
||||
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
|
||||
lswitch e3190dc2-89d1-44ed-9308-e7077de782b3 (sw0)
|
||||
lport sw0-port1
|
||||
port sw0-port1
|
||||
addresses: 00:00:00:00:00:01
|
||||
lport sw0-port2
|
||||
port sw0-port2
|
||||
addresses: 00:00:00:00:00:02
|
||||
lswitch c8ed4c5f-9733-43f6-93da-795b1aabacb1 (sw1)
|
||||
lport sw1-port1
|
||||
port sw1-port1
|
||||
addresses: 00:00:00:00:00:03
|
||||
lport sw1-port2
|
||||
port sw1-port2
|
||||
addresses: 00:00:00:00:00:04
|
||||
|
||||
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
|
||||
lswitch b977dc03-79a5-41ba-9665-341a80e1abfd (sw0)
|
||||
lport sw0-port1
|
||||
port sw0-port1
|
||||
addresses: 00:00:00:00:00:01
|
||||
lport sw0-port2
|
||||
port sw0-port2
|
||||
addresses: 00:00:00:00:00:02
|
||||
lport sw0-port4
|
||||
port sw0-port4
|
||||
addresses: 00:00:00:00:00:04
|
||||
lport sw0-port3
|
||||
port sw0-port3
|
||||
addresses: 00:00:00:00:00:03
|
||||
|
||||
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
|
||||
lswitch 5a652488-cfba-4f3e-929d-00010cdfde40 (provnet1-2)
|
||||
lport provnet1-2-physnet1
|
||||
port provnet1-2-physnet1
|
||||
addresses: unknown
|
||||
lport provnet1-2-port1
|
||||
port provnet1-2-port1
|
||||
addresses: 00:00:00:00:00:02
|
||||
lswitch 5829b60a-eda8-4d78-94f6-7017ff9efcf0 (provnet1-4)
|
||||
lport provnet1-4-port1
|
||||
port provnet1-4-port1
|
||||
addresses: 00:00:00:00:00:04
|
||||
lport provnet1-4-physnet1
|
||||
port provnet1-4-physnet1
|
||||
addresses: unknown
|
||||
lswitch 06cbbcb6-38e3-418d-a81e-634ec9b54ad6 (provnet1-1)
|
||||
lport provnet1-1-port1
|
||||
port provnet1-1-port1
|
||||
addresses: 00:00:00:00:00:01
|
||||
lport provnet1-1-physnet1
|
||||
port provnet1-1-physnet1
|
||||
addresses: unknown
|
||||
lswitch 9cba3b3b-59ae-4175-95f5-b6f1cd9c2afb (provnet1-3)
|
||||
lport provnet1-3-physnet1
|
||||
port provnet1-3-physnet1
|
||||
addresses: unknown
|
||||
lport provnet1-3-port1
|
||||
port provnet1-3-port1
|
||||
addresses: 00:00:00:00:00:03
|
||||
|
||||
`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.
|
||||
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
|
||||
|
||||
$ ovn-nbctl lport-get-options provnet1-1-physnet1
|
||||
$ ovn-nbctl lsp-get-options provnet1-1-physnet1
|
||||
network_name=physnet1
|
||||
|
||||
The physical topology should reflect that there are two regular ports on each
|
||||
@ -617,47 +617,47 @@ set to `101`.
|
||||
|
||||
$ ovn-nbctl show
|
||||
lswitch 12ea93d0-694b-48e9-adef-d0ddd3ec4ac9 (provnet1-7-101)
|
||||
lport provnet1-7-physnet1-101
|
||||
port provnet1-7-physnet1-101
|
||||
parent: , tag:101
|
||||
addresses: unknown
|
||||
lport provnet1-7-101-port1
|
||||
port provnet1-7-101-port1
|
||||
addresses: 00:00:00:00:00:07
|
||||
lswitch c9a5ce3a-15ec-48ea-a898-416013463589 (provnet1-4)
|
||||
lport provnet1-4-port1
|
||||
port provnet1-4-port1
|
||||
addresses: 00:00:00:00:00:04
|
||||
lport provnet1-4-physnet1
|
||||
port provnet1-4-physnet1
|
||||
addresses: unknown
|
||||
lswitch e07d4f7a-2085-4fbb-9937-d6192b79a397 (provnet1-1)
|
||||
lport provnet1-1-physnet1
|
||||
port provnet1-1-physnet1
|
||||
addresses: unknown
|
||||
lport provnet1-1-port1
|
||||
port provnet1-1-port1
|
||||
addresses: 00:00:00:00:00:01
|
||||
lswitch 6c098474-0509-4219-bc9b-eb4e28dd1aeb (provnet1-2)
|
||||
lport provnet1-2-physnet1
|
||||
port provnet1-2-physnet1
|
||||
addresses: unknown
|
||||
lport provnet1-2-port1
|
||||
port provnet1-2-port1
|
||||
addresses: 00:00:00:00:00:02
|
||||
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
|
||||
lport provnet1-8-physnet1-101
|
||||
port provnet1-8-physnet1-101
|
||||
parent: , tag:101
|
||||
addresses: unknown
|
||||
lswitch 8444e925-ceb2-4b02-ac20-eb2e4cfb954d (provnet1-6-101)
|
||||
lport provnet1-6-physnet1-101
|
||||
port provnet1-6-physnet1-101
|
||||
parent: , tag:101
|
||||
addresses: unknown
|
||||
lport provnet1-6-101-port1
|
||||
port provnet1-6-101-port1
|
||||
addresses: 00:00:00:00:00:06
|
||||
lswitch e11e5605-7c46-4395-b28d-cff57451fc7e (provnet1-3)
|
||||
lport provnet1-3-port1
|
||||
port provnet1-3-port1
|
||||
addresses: 00:00:00:00:00:03
|
||||
lport provnet1-3-physnet1
|
||||
port provnet1-3-physnet1
|
||||
addresses: unknown
|
||||
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
|
||||
lport provnet1-5-physnet1-101
|
||||
port provnet1-5-physnet1-101
|
||||
parent: , tag:101
|
||||
addresses: unknown
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
set -o xtrace
|
||||
|
||||
ovn-nbctl lport-add sw0 sw0-port3
|
||||
ovn-nbctl lport-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-add sw0 sw0-port3
|
||||
ovn-nbctl lsp-set-addresses 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
|
||||
|
@ -23,18 +23,18 @@ set -o xtrace
|
||||
ovn-nbctl lswitch-add sw0
|
||||
|
||||
# Create two logical ports on "sw0".
|
||||
ovn-nbctl lport-add sw0 sw0-port1
|
||||
ovn-nbctl lport-add sw0 sw0-port2
|
||||
ovn-nbctl lsp-add sw0 sw0-port1
|
||||
ovn-nbctl lsp-add sw0 sw0-port2
|
||||
|
||||
# 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 lport-set-addresses sw0-port2 00:00:00:00:00:02
|
||||
ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
|
||||
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
|
||||
# the logical port mac address we have configured is the only allowed
|
||||
# source and destination mac address for these ports.
|
||||
ovn-nbctl lport-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-port1 00:00:00:00:00:01
|
||||
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
|
||||
# sees these ports show up with an "iface-id" that matches the OVN
|
||||
|
@ -17,18 +17,18 @@ set -o xtrace
|
||||
|
||||
ovn-nbctl lswitch-add sw0
|
||||
ovn-nbctl lswitch-add sw1
|
||||
ovn-nbctl lport-add sw0 sw0-port1
|
||||
ovn-nbctl lport-add sw0 sw0-port2
|
||||
ovn-nbctl lport-add sw1 sw1-port1
|
||||
ovn-nbctl lport-add sw1 sw1-port2
|
||||
ovn-nbctl lport-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 lport-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 lport-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 lport-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-add sw0 sw0-port1
|
||||
ovn-nbctl lsp-add sw0 sw0-port2
|
||||
ovn-nbctl lsp-add sw1 sw1-port1
|
||||
ovn-nbctl lsp-add sw1 sw1-port2
|
||||
ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
|
||||
ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
|
||||
ovn-nbctl lsp-set-addresses sw1-port1 00:00:00:00:00:03
|
||||
ovn-nbctl lsp-set-addresses sw1-port2 00:00:00:00:00:04
|
||||
ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01
|
||||
ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
|
||||
ovn-nbctl lsp-set-port-security sw1-port1 00:00:00:00:00:03
|
||||
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 lport2 -- set Interface lport2 external_ids:iface-id=sw0-port2
|
||||
|
@ -17,20 +17,20 @@ set -o xtrace
|
||||
|
||||
ovn-nbctl lswitch-add sw0
|
||||
|
||||
ovn-nbctl lport-add sw0 sw0-port1
|
||||
ovn-nbctl lport-add sw0 sw0-port2
|
||||
ovn-nbctl lport-add sw0 sw0-port3
|
||||
ovn-nbctl lport-add sw0 sw0-port4
|
||||
ovn-nbctl lsp-add sw0 sw0-port1
|
||||
ovn-nbctl lsp-add sw0 sw0-port2
|
||||
ovn-nbctl lsp-add sw0 sw0-port3
|
||||
ovn-nbctl lsp-add sw0 sw0-port4
|
||||
|
||||
ovn-nbctl lport-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 lport-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-port1 00:00:00:00:00:01
|
||||
ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
|
||||
ovn-nbctl lsp-set-addresses sw0-port3 00:00:00:00:00:03
|
||||
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 lport-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 lport-set-port-security sw0-port4 00:00:00:00:00:04
|
||||
ovn-nbctl lsp-set-port-security sw0-port1 00:00:00:00:00:01
|
||||
ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
|
||||
ovn-nbctl lsp-set-port-security sw0-port3 00:00:00:00:00:03
|
||||
ovn-nbctl lsp-set-port-security sw0-port4 00:00:00:00:00:04
|
||||
|
||||
# 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
|
||||
|
@ -30,14 +30,14 @@ ovn-sbctl chassis-add fakechassis geneve 127.0.0.1
|
||||
for n in 1 2 3 4; do
|
||||
ovn-nbctl lswitch-add provnet1-$n
|
||||
|
||||
ovn-nbctl lport-add provnet1-$n provnet1-$n-port1
|
||||
ovn-nbctl lport-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-add provnet1-$n provnet1-$n-port1
|
||||
ovn-nbctl lsp-set-addresses 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 lport-set-addresses provnet1-$n-physnet1 unknown
|
||||
ovn-nbctl lport-set-type provnet1-$n-physnet1 localnet
|
||||
ovn-nbctl lport-set-options provnet1-$n-physnet1 network_name=physnet1
|
||||
ovn-nbctl lsp-add provnet1-$n provnet1-$n-physnet1
|
||||
ovn-nbctl lsp-set-addresses provnet1-$n-physnet1 unknown
|
||||
ovn-nbctl lsp-set-type provnet1-$n-physnet1 localnet
|
||||
ovn-nbctl lsp-set-options provnet1-$n-physnet1 network_name=physnet1
|
||||
done
|
||||
|
||||
ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1
|
||||
|
@ -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
|
||||
if [ $n -gt 4 ] ; then
|
||||
lswitch_name="provnet1-$n-101"
|
||||
lport_name="$lswitch_name-port1"
|
||||
lsp_name="$lswitch_name-port1"
|
||||
else
|
||||
lswitch_name="provnet1-$n"
|
||||
fi
|
||||
ovn-nbctl lswitch-add $lswitch_name
|
||||
|
||||
lport_name="$lswitch_name-port1"
|
||||
ovn-nbctl lport-add $lswitch_name $lport_name
|
||||
ovn-nbctl lport-set-addresses $lport_name 00:00:00:00:00:0$n
|
||||
ovn-nbctl lport-set-port-security $lport_name 00:00:00:00:00:0$n
|
||||
lsp_name="$lswitch_name-port1"
|
||||
ovn-nbctl lsp-add $lswitch_name $lsp_name
|
||||
ovn-nbctl lsp-set-addresses $lsp_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
|
||||
lport_name="provnet1-$n-physnet1-101"
|
||||
ovn-nbctl lport-add $lswitch_name $lport_name "" 101
|
||||
lsp_name="provnet1-$n-physnet1-101"
|
||||
ovn-nbctl lsp-add $lswitch_name $lsp_name "" 101
|
||||
else
|
||||
lport_name="provnet1-$n-physnet1"
|
||||
ovn-nbctl lport-add $lswitch_name $lport_name
|
||||
lsp_name="provnet1-$n-physnet1"
|
||||
ovn-nbctl lsp-add $lswitch_name $lsp_name
|
||||
fi
|
||||
ovn-nbctl lport-set-addresses $lport_name unknown
|
||||
ovn-nbctl lport-set-type $lport_name localnet
|
||||
ovn-nbctl lport-set-options $lport_name network_name=physnet1
|
||||
ovn-nbctl lsp-set-addresses $lsp_name unknown
|
||||
ovn-nbctl lsp-set-type $lsp_name localnet
|
||||
ovn-nbctl lsp-set-options $lsp_name network_name=physnet1
|
||||
done
|
||||
|
||||
ovs-vsctl add-port br-int lport1 -- set Interface lport1 external_ids:iface-id=provnet1-1-port1
|
||||
|
@ -23,18 +23,18 @@ set -o xtrace
|
||||
ovn-nbctl lswitch-add sw0
|
||||
|
||||
# Create two logical ports on "sw0".
|
||||
ovn-nbctl lport-add sw0 sw0-port1
|
||||
ovn-nbctl lport-add sw0 sw0-port2
|
||||
ovn-nbctl lsp-add sw0 sw0-port1
|
||||
ovn-nbctl lsp-add sw0 sw0-port2
|
||||
|
||||
# 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 lport-set-addresses sw0-port2 00:00:00:00:00:02
|
||||
ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
|
||||
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
|
||||
# the logical port mac address we have configured is the only allowed
|
||||
# source and destination mac address for these ports.
|
||||
ovn-nbctl lport-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-port1 00:00:00:00:00:01
|
||||
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
|
||||
# sees these ports show up with an "iface-id" that matches the OVN
|
||||
|
@ -19,14 +19,14 @@ set -o xtrace
|
||||
ovn-nbctl lswitch-add csw0
|
||||
|
||||
# create a container port with parent set to sw0-port1
|
||||
ovn-nbctl lport-add csw0 csw0-cport1 sw0-port1 42
|
||||
ovn-nbctl lport-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-add csw0 csw0-cport1 sw0-port1 42
|
||||
ovn-nbctl lsp-set-addresses 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
|
||||
ovn-nbctl lport-add csw0 csw0-cport2 sw0-port2 43
|
||||
ovn-nbctl lport-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-add csw0 csw0-cport2 sw0-port2 43
|
||||
ovn-nbctl lsp-set-addresses 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
|
||||
|
@ -19,17 +19,17 @@ set -o xtrace
|
||||
ovn-nbctl lswitch-add sw0
|
||||
|
||||
# Create two logical ports on "sw0".
|
||||
ovn-nbctl lport-add sw0 sw0-port1
|
||||
ovn-nbctl lport-add sw0 sw0-port2
|
||||
ovn-nbctl lport-add sw0 sw0-port3
|
||||
ovn-nbctl lsp-add sw0 sw0-port1
|
||||
ovn-nbctl lsp-add sw0 sw0-port2
|
||||
ovn-nbctl lsp-add sw0 sw0-port3
|
||||
|
||||
ovn-nbctl lport-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 lport-set-addresses sw0-port3 00:00:00:00:00:03
|
||||
ovn-nbctl lsp-set-addresses sw0-port1 00:00:00:00:00:01
|
||||
ovn-nbctl lsp-set-addresses sw0-port2 00:00:00:00:00:02
|
||||
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 lport-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-port1 00:00:00:00:00:01
|
||||
ovn-nbctl lsp-set-port-security sw0-port2 00:00:00:00:00:02
|
||||
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 lport2 -- set Interface lport2 external_ids:iface-id=sw0-port2
|
||||
|
@ -275,8 +275,8 @@ for i in 0 1; do
|
||||
ovs-vsctl add-br br-phys
|
||||
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
|
||||
ovn-nbctl lport-add lsw0 lp$i
|
||||
ovn-nbctl lport-set-addresses lp$i f0:00:00:00:00:0$i
|
||||
ovn-nbctl lsp-add lsw0 lp$i
|
||||
ovn-nbctl lsp-set-addresses lp$i f0:00:00:00:00:0$i
|
||||
done
|
||||
</pre>
|
||||
|
||||
@ -306,8 +306,8 @@ wait
|
||||
for i in `seq $n`; do
|
||||
yy=$(printf %02x $(expr $i / 256))
|
||||
xx=$(printf $02x $(expr $i % 256))
|
||||
ovn-nbctl lport-add br0 lp$i
|
||||
ovn-nbctl lport-set-addresses lp$i f0:00:00:00:$yy:$xx
|
||||
ovn-nbctl lsp-add br0 lp$i
|
||||
ovn-nbctl lsp-set-addresses lp$i f0:00:00:00:$yy:$xx
|
||||
done
|
||||
</pre>
|
||||
|
||||
@ -317,7 +317,7 @@ done
|
||||
</p>
|
||||
|
||||
<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>
|
||||
|
||||
</manpage>
|
||||
|
Loading…
x
Reference in New Issue
Block a user