We have both logical switch and router ports. Router ports are referenced in "Logical_Router_Port" table, so this make it more consistent.
Also change internal use of "lport" to "lsp". Signed-off-by: Justin Pettit <jpet...@ovn.org> --- ovn/CONTAINERS.OpenStack.md | 13 +- ovn/controller/pinctrl.c | 2 +- ovn/lib/ovn-util.c | 4 +- ovn/lib/ovn-util.h | 4 +- ovn/northd/ovn-northd.8.xml | 8 +- ovn/northd/ovn-northd.c | 55 +++--- ovn/ovn-architecture.7.xml | 38 ++-- ovn/ovn-nb.ovsschema | 8 +- ovn/ovn-nb.xml | 17 +- ovn/ovn-sb.xml | 24 +-- ovn/utilities/ovn-docker-overlay-driver | 11 +- ovn/utilities/ovn-nbctl.8.xml | 6 +- ovn/utilities/ovn-nbctl.c | 306 ++++++++++++++++---------------- tests/ovn-controller-vtep.at | 14 +- tests/ovn-nbctl.at | 2 +- tests/ovn.at | 67 ++++--- 16 files changed, 294 insertions(+), 285 deletions(-) diff --git a/ovn/CONTAINERS.OpenStack.md b/ovn/CONTAINERS.OpenStack.md index f7aed21..d640d7c 100644 --- a/ovn/CONTAINERS.OpenStack.md +++ b/ovn/CONTAINERS.OpenStack.md @@ -65,11 +65,11 @@ Neutron that are currently needed, it sends the vif-id and the VLAN tag as inputs. * Neutron in turn will verify that the vif-id belongs to the tenant in question -and then uses the OVN specific plugin to create a new row in the Logical_Port -table of the OVN Northbound Database. Neutron responds back with an -IP address and MAC address for that network interface. So Neutron becomes -the IPAM system and provides unique IP and MAC addresses across VMs and -containers in the same logical network. +and then uses the OVN specific plugin to create a new row in the +Logical_Switch_Port table of the OVN Northbound Database. Neutron +responds back with an IP address and MAC address for that network +interface. So Neutron becomes the IPAM system and provides unique IP +and MAC addresses across VMs and containers in the same logical network. * The Neutron API call above to create a logical port for the container could add a relatively significant amount of time to container creation. @@ -80,7 +80,8 @@ port needs to be attached to a different logical network. * When a container is eventually deleted, the network plugin in that VM may make a call to Neutron to delete that port. Neutron in turn will -delete the entry in the Logical_Port table of the OVN Northbound Database. +delete the entry in the Logical_Switch_Port table of the OVN Northbound +Database. As an example, consider Docker containers. Since Docker currently does not have a network plugin feature, this example uses a hypothetical wrapper diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index bc57c40..116397e 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -563,7 +563,7 @@ send_garp_update(const struct sbrec_port_binding *binding_rec, int i; for (i = 0; i < binding_rec->n_mac; i++) { struct lport_addresses laddrs; - if (!extract_lport_addresses(binding_rec->mac[i], &laddrs, false) + if (!extract_lsp_addresses(binding_rec->mac[i], &laddrs, false) || !laddrs.n_ipv4_addrs) { continue; } diff --git a/ovn/lib/ovn-util.c b/ovn/lib/ovn-util.c index 5a1dcb6..6113087 100644 --- a/ovn/lib/ovn-util.c +++ b/ovn/lib/ovn-util.c @@ -42,8 +42,8 @@ VLOG_DEFINE_THIS_MODULE(ovn_util); * returns true with laddrs->n_ipv4_addrs = 1 and laddrs->n_ipv6_addrs = 0. */ bool -extract_lport_addresses(char *address, struct lport_addresses *laddrs, - bool store_ipv6) +extract_lsp_addresses(char *address, struct lport_addresses *laddrs, + bool store_ipv6) { char *buf = address; int buf_index = 0; diff --git a/ovn/lib/ovn-util.h b/ovn/lib/ovn-util.h index f475e6f..d23f4af 100644 --- a/ovn/lib/ovn-util.h +++ b/ovn/lib/ovn-util.h @@ -39,8 +39,8 @@ struct lport_addresses { }; bool -extract_lport_addresses(char *address, struct lport_addresses *laddrs, - bool store_ipv6); +extract_lsp_addresses(char *address, struct lport_addresses *laddrs, + bool store_ipv6); char * alloc_nat_zone_key(const struct sbrec_port_binding *port_binding, diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml index 1983812..0e59125 100644 --- a/ovn/northd/ovn-northd.8.xml +++ b/ovn/northd/ovn-northd.8.xml @@ -760,10 +760,10 @@ icmp4 { data in the <code>OVN_Northbound</code> database. For router ports connected to logical switches, MAC bindings can be known statically from the <code>addresses</code> column in the - <code>Logical_Port</code> table. For router ports connected to other - logical routers, MAC bindings can be known statically from the - <code>mac</code> and <code>network</code> column in the - <code>Logical_Router_Port</code> table. + <code>Logical_Switch_Port</code> table. For router ports + connected to other logical routers, MAC bindings can be known + statically from the <code>mac</code> and <code>network</code> + column in the <code>Logical_Router_Port</code> table. </p> <p> diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index cac0148..d53fca9 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -483,7 +483,7 @@ struct ovn_port { char *key; /* nbs->name, nbr->name, sb->logical_port. */ char *json_key; /* 'key', quoted for use in JSON. */ - const struct nbrec_logical_port *nbs; /* May be NULL. */ + const struct nbrec_logical_switch_port *nbs; /* May be NULL. */ const struct nbrec_logical_router_port *nbr; /* May be NULL. */ const struct sbrec_port_binding *sb; /* May be NULL. */ @@ -501,7 +501,7 @@ struct ovn_port { static struct ovn_port * ovn_port_create(struct hmap *ports, const char *key, - const struct nbrec_logical_port *nbs, + const struct nbrec_logical_switch_port *nbs, const struct nbrec_logical_router_port *nbr, const struct sbrec_port_binding *sb) { @@ -575,7 +575,7 @@ join_logical_ports(struct northd_context *ctx, HMAP_FOR_EACH (od, key_node, datapaths) { if (od->nbs) { for (size_t i = 0; i < od->nbs->n_ports; i++) { - const struct nbrec_logical_port *nbs = od->nbs->ports[i]; + const struct nbrec_logical_switch_port *nbs = od->nbs->ports[i]; struct ovn_port *op = ovn_port_find(ports, nbs->name); if (op) { if (op->nbs || op->nbr) { @@ -752,7 +752,7 @@ ovn_port_update_sbrec(const struct ovn_port *op) } /* Updates the southbound Port_Binding table so that it contains the logical - * ports specified by the northbound database. + * switch ports specified by the northbound database. * * Initializes 'ports' to contain a "struct ovn_port" for every logical port, * using the "struct ovn_datapath"s in 'datapaths' to look up logical @@ -989,7 +989,7 @@ ovn_lflow_destroy(struct hmap *lflows, struct ovn_lflow *lflow) /* Appends port security constraints on L2 address field 'eth_addr_field' * (e.g. "eth.src" or "eth.dst") to 'match'. 'port_security', with * 'n_port_security' elements, is the collection of port_security constraints - * from an OVN_NB Logical_Port row. */ + * from an OVN_NB Logical_Switch_Port row. */ static void build_port_security_l2(const char *eth_addr_field, char **port_security, size_t n_port_security, @@ -1103,7 +1103,7 @@ build_port_security_nd(struct ovn_port *op, struct hmap *lflows) { for (size_t i = 0; i < op->nbs->n_port_security; i++) { struct lport_addresses ps; - if (!extract_lport_addresses(op->nbs->port_security[i], &ps, true)) { + if (!extract_lsp_addresses(op->nbs->port_security[i], &ps, true)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); VLOG_INFO_RL(&rl, "invalid syntax '%s' in port security. No MAC" " address found", op->nbs->port_security[i]); @@ -1198,7 +1198,7 @@ build_port_security_ip(enum ovn_pipeline pipeline, struct ovn_port *op, for (size_t i = 0; i < op->nbs->n_port_security; i++) { struct lport_addresses ps; - if (!extract_lport_addresses(op->nbs->port_security[i], &ps, true)) { + if (!extract_lsp_addresses(op->nbs->port_security[i], &ps, true)) { continue; } @@ -1301,15 +1301,15 @@ build_port_security_ip(enum ovn_pipeline pipeline, struct ovn_port *op, } static bool -lport_is_enabled(const struct nbrec_logical_port *lport) +lsp_is_enabled(const struct nbrec_logical_switch_port *lsp) { - return !lport->enabled || *lport->enabled; + return !lsp->enabled || *lsp->enabled; } static bool -lport_is_up(const struct nbrec_logical_port *lport) +lsp_is_up(const struct nbrec_logical_switch_port *lsp) { - return !lport->up || *lport->up; + return !lsp->up || *lsp->up; } static bool @@ -1525,7 +1525,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, continue; } - if (!lport_is_enabled(op->nbs)) { + if (!lsp_is_enabled(op->nbs)) { /* Drop packets from disabled logical ports (since logical flow * tables are default-drop). */ continue; @@ -1584,14 +1584,14 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, * - port is up or * - port type is router */ - if (!lport_is_up(op->nbs) && strcmp(op->nbs->type, "router")) { + if (!lsp_is_up(op->nbs) && strcmp(op->nbs->type, "router")) { continue; } for (size_t i = 0; i < op->nbs->n_addresses; i++) { struct lport_addresses laddrs; - if (!extract_lport_addresses(op->nbs->addresses[i], &laddrs, - false)) { + if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs, + false)) { continue; } for (size_t j = 0; j < laddrs.n_ipv4_addrs; j++) { @@ -1639,7 +1639,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, continue; } - if (lport_is_enabled(op->nbs)) { + if (lsp_is_enabled(op->nbs)) { ovn_multicast_add(mcgroups, &mc_flood, op); } } @@ -1675,7 +1675,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, ds_destroy(&actions); ds_destroy(&match); } else if (!strcmp(op->nbs->addresses[i], "unknown")) { - if (lport_is_enabled(op->nbs)) { + if (lsp_is_enabled(op->nbs)) { ovn_multicast_add(mcgroups, &mc_unknown, op); op->od->has_unknown = true; } @@ -1730,7 +1730,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, struct ds match = DS_EMPTY_INITIALIZER; ds_put_format(&match, "outport == %s", op->json_key); - if (lport_is_enabled(op->nbs)) { + if (lsp_is_enabled(op->nbs)) { build_port_security_l2("eth.dst", op->nbs->port_security, op->nbs->n_port_security, &match); ovn_lflow_add(lflows, op->od, S_SWITCH_OUT_PORT_SEC_L2, 50, @@ -2080,16 +2080,17 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, for (size_t i = 0; i < op->nbs->n_addresses; i++) { struct lport_addresses laddrs; - if (!extract_lport_addresses(op->nbs->addresses[i], &laddrs, - false)) { + if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs, + false)) { continue; } for (size_t k = 0; k < laddrs.n_ipv4_addrs; k++) { ovs_be32 ip = laddrs.ipv4_addrs[k].addr; for (size_t j = 0; j < op->od->n_router_ports; j++) { - /* Get the Logical_Router_Port that the Logical_Port is - * connected to, as 'peer'. */ + /* Get the Logical_Router_Port that the + * Logical_Switch_Port is connected to, as + * 'peer'. */ const char *peer_name = smap_get( &op->od->router_ports[j]->nbs->options, "router-port"); @@ -2351,16 +2352,16 @@ ovnsb_db_run(struct northd_context *ctx) } struct hmap lports_hmap; const struct sbrec_port_binding *sb; - const struct nbrec_logical_port *nb; + const struct nbrec_logical_switch_port *nb; struct lport_hash_node { struct hmap_node node; - const struct nbrec_logical_port *nb; + const struct nbrec_logical_switch_port *nb; } *hash_node; hmap_init(&lports_hmap); - NBREC_LOGICAL_PORT_FOR_EACH(nb, ctx->ovnnb_idl) { + NBREC_LOGICAL_SWITCH_PORT_FOR_EACH(nb, ctx->ovnnb_idl) { hash_node = xzalloc(sizeof *hash_node); hash_node->nb = nb; hmap_insert(&lports_hmap, &hash_node->node, hash_string(nb->name, 0)); @@ -2386,10 +2387,10 @@ ovnsb_db_run(struct northd_context *ctx) if (sb->chassis && (!nb->up || !*nb->up)) { bool up = true; - nbrec_logical_port_set_up(nb, &up, 1); + nbrec_logical_switch_port_set_up(nb, &up, 1); } else if (!sb->chassis && (!nb->up || *nb->up)) { bool up = false; - nbrec_logical_port_set_up(nb, &up, 1); + nbrec_logical_switch_port_set_up(nb, &up, 1); } } diff --git a/ovn/ovn-architecture.7.xml b/ovn/ovn-architecture.7.xml index 553c2e5..f8a348b 100644 --- a/ovn/ovn-architecture.7.xml +++ b/ovn/ovn-architecture.7.xml @@ -340,10 +340,11 @@ <li> The CMS plugin updates the OVN Northbound database to include the new - VIF, by adding a row to the <code>Logical_Port</code> table. In the new - row, <code>name</code> is <var>vif-id</var>, <code>mac</code> is - <var>mac</var>, <code>switch</code> points to the OVN logical switch's - Logical_Switch record, and other columns are initialized appropriately. + VIF, by adding a row to the <code>Logical_Switch_Port</code> + table. In the new row, <code>name</code> is <var>vif-id</var>, + <code>mac</code> is <var>mac</var>, <code>switch</code> points to + the OVN logical switch's Logical_Switch record, and other columns + are initialized appropriately. </li> <li> @@ -394,11 +395,11 @@ networking is ready. To support this, <code>ovn-northd</code> notices the <code>chassis</code> column updated for the row in <code>Binding</code> table and pushes this upward by updating the - <ref column="up" table="Logical_Port" db="OVN_NB"/> column in the OVN - Northbound database's <ref table="Logical_Port" db="OVN_NB"/> table to - indicate that the VIF is now up. The CMS, if it uses this feature, can - then - react by allowing the VM's execution to proceed. + <ref column="up" table="Logical_Switch_Port" db="OVN_NB"/> column + in the OVN Northbound database's <ref table="Logical_Switch_Port" + db="OVN_NB"/> table to indicate that the VIF is now up. The CMS, + if it uses this feature, can then react by allowing the VM's + execution to proceed. </li> <li> @@ -440,7 +441,7 @@ <li> The CMS plugin removes the VIF from the OVN Northbound database, - by deleting its row in the <code>Logical_Port</code> table. + by deleting its row in the <code>Logical_Switch_Port</code> table. </li> <li> @@ -533,10 +534,11 @@ The container spawning entity (either directly or through the CMS that manages the underlying infrastructure) updates the OVN Northbound database to include the new CIF, by adding a row to the - <code>Logical_Port</code> table. In the new row, <code>name</code> is - any unique identifier, <code>parent_name</code> is the <var>vif-id</var> - of the VM through which the CIF's network traffic is expected to go - through and the <code>tag</code> is the VLAN tag that identifies the + <code>Logical_Switch_Port</code> table. In the new row, + <code>name</code> is any unique identifier, + <code>parent_name</code> is the <var>vif-id</var> of the VM + through which the CIF's network traffic is expected to go through + and the <code>tag</code> is the VLAN tag that identifies the network traffic of that CIF. </li> @@ -567,9 +569,9 @@ One can only start the application inside the container after the underlying network is ready. To support this, <code>ovn-northd</code> notices the updated <code>chassis</code> column in <code>Binding</code> - table and updates the <ref column="up" table="Logical_Port" + table and updates the <ref column="up" table="Logical_Switch_Port" db="OVN_NB"/> column in the OVN Northbound database's - <ref table="Logical_Port" db="OVN_NB"/> table to indicate that the + <ref table="Logical_Switch_Port" db="OVN_NB"/> table to indicate that the CIF is now up. The entity responsible to start the container application queries this value and starts the application. </li> @@ -577,7 +579,7 @@ <li> Eventually the entity that created and started the container, stops it. The entity, through the CMS (or directly) deletes its row in the - <code>Logical_Port</code> table. + <code>Logical_Switch_Port</code> table. </li> <li> @@ -943,7 +945,7 @@ <li> Now, the administrator can use the CMS to add a VTEP logical switch to the OVN logical network. To do that, the CMS must first create a - new <code>Logical_Port</code> table entry in the <code> + new <code>Logical_Switch_Port</code> table entry in the <code> OVN_Northbound</code> database. Then, the <var>type</var> column of this entry must be set to "vtep". Next, the <var> vtep-logical-switch</var> and <var>vtep-physical-switch</var> keys diff --git a/ovn/ovn-nb.ovsschema b/ovn/ovn-nb.ovsschema index fa21b30..f62904b 100644 --- a/ovn/ovn-nb.ovsschema +++ b/ovn/ovn-nb.ovsschema @@ -1,13 +1,13 @@ { "name": "OVN_Northbound", - "version": "2.1.2", - "cksum": "429668869 5325", + "version": "2.2.0", + "cksum": "1966325204 5339", "tables": { "Logical_Switch": { "columns": { "name": {"type": "string"}, "ports": {"type": {"key": {"type": "uuid", - "refTable": "Logical_Port", + "refTable": "Logical_Switch_Port", "refType": "strong"}, "min": 0, "max": "unlimited"}}, @@ -20,7 +20,7 @@ "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}}}, "isRoot": true}, - "Logical_Port": { + "Logical_Switch_Port": { "columns": { "name": {"type": "string"}, "type": {"type": "string"}, diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index 41092f1..399b0e4 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -80,7 +80,7 @@ </group> </table> - <table name="Logical_Port" title="L2 logical switch port"> + <table name="Logical_Switch_Port" title="L2 logical switch port"> <p> A port within an L2 logical switch. </p> @@ -227,7 +227,7 @@ <column name="parent_name"> The VM interface through which the nested container sends its network traffic. This must match the <ref column="name"/> column for some - other <ref table="Logical_Port"/>. + other <ref table="Logical_Switch_Port"/>. </column> <column name="tag"> @@ -671,8 +671,8 @@ <p> In addition to provide convenience for human interaction with the ovn-nb database, this column is used as reference by its patch port in - <ref table="Logical_Port"/> or another logical router port in <ref - table="Logical_Router_Port"/>. + <ref table="Logical_Switch_Port"/> or another logical router port in + <ref table="Logical_Router_Port"/>. </p> </column> @@ -703,10 +703,11 @@ <li> To attach a logical switch to a logical router. A logical router port of this type is referenced by exactly one <ref - table="Logical_Port"/> of type <code>router</code>. The value of - <ref column="name"/> is set as <code>router-port</code> in column - <ref column="options"/> of <ref table="Logical_Port"/>. - In this case <ref column="peer"/> column is empty. + table="Logical_Switch_Port"/> of type <code>router</code>. + The value of <ref column="name"/> is set as + <code>router-port</code> in column <ref column="options"/> of + <ref table="Logical_Switch_Port"/>. In this case <ref + column="peer"/> column is empty. </li> <li> diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml index 1231b4e..d877f76 100644 --- a/ovn/ovn-sb.xml +++ b/ovn/ovn-sb.xml @@ -1207,10 +1207,11 @@ tcp.flags = RST; </p> <p> - For every <code>Logical_Port</code> record in <code>OVN_Northbound</code> - database, <code>ovn-northd</code> creates a record in this table. - <code>ovn-northd</code> populates and maintains every column except - the <code>chassis</code> column, which it leaves empty in new records. + For every <code>Logical_Switch_Port</code> record in + <code>OVN_Northbound</code> database, <code>ovn-northd</code> + creates a record in this table. <code>ovn-northd</code> populates + and maintains every column except the <code>chassis</code> column, + which it leaves empty in new records. </p> <p> @@ -1245,10 +1246,11 @@ tcp.flags = RST; </column> <column name="logical_port"> - A logical port, taken from <ref table="Logical_Port" column="name" - db="OVN_Northbound"/> in the OVN_Northbound database's <ref - table="Logical_Port" db="OVN_Northbound"/> table. OVN does not - prescribe a particular format for the logical port ID. + A logical port, taken from <ref table="Logical_Switch_Port" + column="name" db="OVN_Northbound"/> in the OVN_Northbound + database's <ref table="Logical_Switch_Port" db="OVN_Northbound"/> + table. OVN does not prescribe a particular format for the + logical port ID. </column> <column name="chassis"> @@ -1445,9 +1447,9 @@ tcp.flags = RST; <column name="parent_port"> This is taken from - <ref table="Logical_Port" column="parent_name" db="OVN_Northbound"/> - in the OVN_Northbound database's <ref table="Logical_Port" - db="OVN_Northbound"/> table. + <ref table="Logical_Switch_Port" column="parent_name" + db="OVN_Northbound"/> in the OVN_Northbound database's + <ref table="Logical_Switch_Port" db="OVN_Northbound"/> table. </column> <column name="tag"> diff --git a/ovn/utilities/ovn-docker-overlay-driver b/ovn/utilities/ovn-docker-overlay-driver index e4b7d95..38255e7 100755 --- a/ovn/utilities/ovn-docker-overlay-driver +++ b/ovn/utilities/ovn-docker-overlay-driver @@ -261,8 +261,9 @@ def create_endpoint(): }}) -def get_logical_port_addresses(eid): - ret = ovn_nbctl("--if-exists", "get", "Logical_port", eid, "addresses") +def get_lsp_addresses(eid): + ret = ovn_nbctl("--if-exists", "get", "Logical_Switch_Port", eid, + "addresses") if not ret: error = "endpoint not found in OVN database" return (None, None, error) @@ -290,11 +291,11 @@ def show_endpoint(): abort(400) try: - (mac_address, ip_address, error) = get_logical_port_addresses(eid) + (mac_address, ip_address, error) = get_lsp_addresses(eid) if error: jsonify({'Err': error}) except Exception as e: - error = "show_endpoint: get Logical_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] @@ -351,7 +352,7 @@ def network_join(): vm_id = sboxkey.rsplit('/')[-1] try: - (mac_address, ip_address, error) = get_logical_port_addresses(eid) + (mac_address, ip_address, error) = get_lsp_addresses(eid) if error: jsonify({'Err': error}) except Exception as e: diff --git a/ovn/utilities/ovn-nbctl.8.xml b/ovn/utilities/ovn-nbctl.8.xml index ba6a1ed..fc132f7 100644 --- a/ovn/utilities/ovn-nbctl.8.xml +++ b/ovn/utilities/ovn-nbctl.8.xml @@ -187,8 +187,8 @@ Port security limits the addresses from which a logical port may send packets and to which it may receive packets. See the <code>ovn-nb</code>(5) documentation for the <ref - column="port_security" table="Logical_Port"/> column in the <ref - table="Logical_Port"/> table for details. + column="port_security" table="Logical_Switch_Port"/> column in + the <ref table="Logical_Switch_Port"/> table for details. </p> </dd> @@ -377,7 +377,7 @@ An L2 logical switch. Records may be identified by name. </dd> - <dt><code>Logical_Port</code></dt> + <dt><code>Logical_Switch_Port</code></dt> <dd> A port within an L2 logical switch. Records may be identified by name. </dd> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index eeed70f..86ddc50 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -307,7 +307,7 @@ ACL commands:\n\ remove ACLs from LSWITCH\n\ acl-list LSWITCH print ACLs for LSWITCH\n\ \n\ -Logical port commands:\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\ @@ -473,21 +473,21 @@ print_lswitch(const struct nbrec_logical_switch *lswitch, struct ds *s) UUID_ARGS(&lswitch->header_.uuid), lswitch->name); for (size_t i = 0; i < lswitch->n_ports; i++) { - const struct nbrec_logical_port *lport = lswitch->ports[i]; + const struct nbrec_logical_switch_port *lsp = lswitch->ports[i]; - ds_put_format(s, " lport %s\n", lport->name); - if (lport->parent_name) { - ds_put_format(s, " parent: %s\n", lport->parent_name); + ds_put_format(s, " port %s\n", lsp->name); + if (lsp->parent_name) { + ds_put_format(s, " parent: %s\n", lsp->parent_name); } - if (lport->n_tag) { - ds_put_format(s, " tag: %"PRIu64"\n", lport->tag[0]); + if (lsp->n_tag) { + ds_put_format(s, " tag: %"PRIu64"\n", lsp->tag[0]); } - if (lport->n_addresses) { + if (lsp->n_addresses) { ds_put_cstr(s, " addresses: ["); - for (size_t j = 0; j < lport->n_addresses; j++) { + for (size_t j = 0; j < lsp->n_addresses; j++) { ds_put_format(s, "%s\"%s\"", j == 0 ? "" : ", ", - lport->addresses[j]); + lsp->addresses[j]); } ds_put_cstr(s, "]\n"); } @@ -595,42 +595,42 @@ nbctl_lswitch_list(struct ctl_context *ctx) free(nodes); } -static const struct nbrec_logical_port * -lport_by_name_or_uuid(struct ctl_context *ctx, const char *id, - bool must_exist) +static const struct nbrec_logical_switch_port * +lsp_by_name_or_uuid(struct ctl_context *ctx, const char *id, + bool must_exist) { - const struct nbrec_logical_port *lport = NULL; + const struct nbrec_logical_switch_port *lsp = NULL; - struct uuid lport_uuid; - bool is_uuid = uuid_from_string(&lport_uuid, id); + struct uuid lsp_uuid; + bool is_uuid = uuid_from_string(&lsp_uuid, id); if (is_uuid) { - lport = nbrec_logical_port_get_for_uuid(ctx->idl, &lport_uuid); + lsp = nbrec_logical_switch_port_get_for_uuid(ctx->idl, &lsp_uuid); } - if (!lport) { - NBREC_LOGICAL_PORT_FOR_EACH(lport, ctx->idl) { - if (!strcmp(lport->name, id)) { + if (!lsp) { + NBREC_LOGICAL_SWITCH_PORT_FOR_EACH(lsp, ctx->idl) { + if (!strcmp(lsp->name, id)) { break; } } } - if (!lport && must_exist) { - ctl_fatal("%s: lport %s not found", id, is_uuid ? "UUID" : "name"); + if (!lsp && must_exist) { + ctl_fatal("%s: port %s not found", id, is_uuid ? "UUID" : "name"); } - return lport; + return lsp; } -/* Returns the lswitch that contains 'lport'. */ +/* Returns the lswitch that contains 'lsp'. */ static const struct nbrec_logical_switch * -lport_to_lswitch(const struct ovsdb_idl *idl, - const struct nbrec_logical_port *lport) +lsp_to_lswitch(const struct ovsdb_idl *idl, + const struct nbrec_logical_switch_port *lsp) { const struct nbrec_logical_switch *lswitch; NBREC_LOGICAL_SWITCH_FOR_EACH (lswitch, idl) { for (size_t i = 0; i < lswitch->n_ports; i++) { - if (lswitch->ports[i] == lport) { + if (lswitch->ports[i] == lsp) { return lswitch; } } @@ -638,7 +638,7 @@ lport_to_lswitch(const struct ovsdb_idl *idl, /* Can't happen because of the database schema */ ctl_fatal("logical port %s is not part of any logical switch", - lport->name); + lsp->name); } static const char * @@ -653,7 +653,7 @@ lswitch_get_name(const struct nbrec_logical_switch *lswitch, } static void -nbctl_lport_add(struct ctl_context *ctx) +nbctl_lsp_add(struct ctl_context *ctx) { bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL; @@ -676,43 +676,43 @@ nbctl_lport_add(struct ctl_context *ctx) ctl_fatal("lport-add with parent must also specify a tag"); } - const char *lport_name = ctx->argv[2]; - const struct nbrec_logical_port *lport; - lport = lport_by_name_or_uuid(ctx, lport_name, false); - if (lport) { + const char *lsp_name = ctx->argv[2]; + const struct nbrec_logical_switch_port *lsp; + 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", - lport_name); + lsp_name); } const struct nbrec_logical_switch *lsw; - lsw = lport_to_lswitch(ctx->idl, lport); + 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", lport_name, + ctl_fatal("%s: lport already exists but in lswitch %s", lsp_name, lswitch_get_name(lsw, uuid_s, sizeof uuid_s)); } if (parent_name) { - if (!lport->parent_name) { + if (!lsp->parent_name) { ctl_fatal("%s: lport already exists but has no parent", - lport_name); - } else if (strcmp(parent_name, lport->parent_name)) { + lsp_name); + } else if (strcmp(parent_name, lsp->parent_name)) { ctl_fatal("%s: lport already exists with different parent %s", - lport_name, lport->parent_name); + lsp_name, lsp->parent_name); } - if (!lport->n_tag) { + if (!lsp->n_tag) { ctl_fatal("%s: lport already exists but has no tag", - lport_name); - } else if (lport->tag[0] != tag) { + lsp_name); + } else if (lsp->tag[0] != tag) { ctl_fatal("%s: lport already exists with different " - "tag %"PRId64, lport_name, lport->tag[0]); + "tag %"PRId64, lsp_name, lsp->tag[0]); } } else { - if (lport->parent_name) { + if (lsp->parent_name) { ctl_fatal("%s: lport already exists but has parent %s", - lport_name, lport->parent_name); + lsp_name, lsp->parent_name); } } @@ -720,63 +720,64 @@ nbctl_lport_add(struct ctl_context *ctx) } /* Create the logical port. */ - lport = nbrec_logical_port_insert(ctx->txn); - nbrec_logical_port_set_name(lport, lport_name); + lsp = nbrec_logical_switch_port_insert(ctx->txn); + nbrec_logical_switch_port_set_name(lsp, lsp_name); if (tag >= 0) { - nbrec_logical_port_set_parent_name(lport, parent_name); - nbrec_logical_port_set_tag(lport, &tag, 1); + nbrec_logical_switch_port_set_parent_name(lsp, parent_name); + nbrec_logical_switch_port_set_tag(lsp, &tag, 1); } /* Insert the logical port into the logical switch. */ nbrec_logical_switch_verify_ports(lswitch); - struct nbrec_logical_port **new_ports = xmalloc(sizeof *new_ports * + struct nbrec_logical_switch_port **new_ports = xmalloc(sizeof *new_ports * (lswitch->n_ports + 1)); memcpy(new_ports, lswitch->ports, sizeof *new_ports * lswitch->n_ports); - new_ports[lswitch->n_ports] = CONST_CAST(struct nbrec_logical_port *, - lport); + new_ports[lswitch->n_ports] = CONST_CAST(struct nbrec_logical_switch_port *, + lsp); nbrec_logical_switch_set_ports(lswitch, new_ports, lswitch->n_ports + 1); free(new_ports); } -/* Removes lport 'lswitch->ports[idx]'. */ +/* Removes logical switch port 'lswitch->ports[idx]'. */ static void -remove_lport(const struct nbrec_logical_switch *lswitch, size_t idx) +remove_lsp(const struct nbrec_logical_switch *lswitch, size_t idx) { - const struct nbrec_logical_port *lport = lswitch->ports[idx]; + const struct nbrec_logical_switch_port *lsp = lswitch->ports[idx]; - /* First remove 'lport' from the array of ports. This is what will + /* First remove 'lsp' from the array of ports. This is what will * actually cause the logical port to be deleted when the transaction is * sent to the database server (due to garbage collection). */ - struct nbrec_logical_port **new_ports + struct nbrec_logical_switch_port **new_ports = xmemdup(lswitch->ports, sizeof *new_ports * lswitch->n_ports); new_ports[idx] = new_ports[lswitch->n_ports - 1]; nbrec_logical_switch_verify_ports(lswitch); nbrec_logical_switch_set_ports(lswitch, new_ports, lswitch->n_ports - 1); free(new_ports); - /* Delete 'lport' from the IDL. This won't have a real effect on the + /* Delete 'lsp' from the IDL. This won't have a real effect on the * database server (the IDL will suppress it in fact) but it means that it - * won't show up when we iterate with NBREC_LOGICAL_PORT_FOR_EACH later. */ - nbrec_logical_port_delete(lport); + * won't show up when we iterate with NBREC_LOGICAL_SWITCH_PORT_FOR_EACH + * later. */ + nbrec_logical_switch_port_delete(lsp); } static void -nbctl_lport_del(struct ctl_context *ctx) +nbctl_lsp_del(struct ctl_context *ctx) { bool must_exist = !shash_find(&ctx->options, "--if-exists"); - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, ctx->argv[1], must_exist); - if (!lport) { + lsp = lsp_by_name_or_uuid(ctx, ctx->argv[1], must_exist); + if (!lsp) { return; } - /* Find the switch that contains 'lport', then delete it. */ + /* Find the switch that contains 'lsp', then delete it. */ const struct nbrec_logical_switch *lswitch; NBREC_LOGICAL_SWITCH_FOR_EACH (lswitch, ctx->idl) { for (size_t i = 0; i < lswitch->n_ports; i++) { - if (lswitch->ports[i] == lport) { - remove_lport(lswitch, i); + if (lswitch->ports[i] == lsp) { + remove_lsp(lswitch, i); return; } } @@ -788,59 +789,59 @@ nbctl_lport_del(struct ctl_context *ctx) } static void -nbctl_lport_list(struct ctl_context *ctx) +nbctl_lsp_list(struct ctl_context *ctx) { const char *id = ctx->argv[1]; const struct nbrec_logical_switch *lswitch; - struct smap lports; + struct smap lsps; size_t i; lswitch = lswitch_by_name_or_uuid(ctx, id, true); - smap_init(&lports); + smap_init(&lsps); for (i = 0; i < lswitch->n_ports; i++) { - const struct nbrec_logical_port *lport = lswitch->ports[i]; - smap_add_format(&lports, lport->name, UUID_FMT " (%s)", - UUID_ARGS(&lport->header_.uuid), lport->name); + const struct nbrec_logical_switch_port *lsp = lswitch->ports[i]; + smap_add_format(&lsps, lsp->name, UUID_FMT " (%s)", + UUID_ARGS(&lsp->header_.uuid), lsp->name); } - const struct smap_node **nodes = smap_sort(&lports); - for (i = 0; i < smap_count(&lports); i++) { + const struct smap_node **nodes = smap_sort(&lsps); + for (i = 0; i < smap_count(&lsps); i++) { const struct smap_node *node = nodes[i]; ds_put_format(&ctx->output, "%s\n", node->value); } - smap_destroy(&lports); + smap_destroy(&lsps); free(nodes); } static void -nbctl_lport_get_parent(struct ctl_context *ctx) +nbctl_lsp_get_parent(struct ctl_context *ctx) { - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, ctx->argv[1], true); - if (lport->parent_name) { - ds_put_format(&ctx->output, "%s\n", lport->parent_name); + lsp = lsp_by_name_or_uuid(ctx, ctx->argv[1], true); + if (lsp->parent_name) { + ds_put_format(&ctx->output, "%s\n", lsp->parent_name); } } static void -nbctl_lport_get_tag(struct ctl_context *ctx) +nbctl_lsp_get_tag(struct ctl_context *ctx) { - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, ctx->argv[1], true); - if (lport->n_tag > 0) { - ds_put_format(&ctx->output, "%"PRId64"\n", lport->tag[0]); + lsp = lsp_by_name_or_uuid(ctx, ctx->argv[1], true); + if (lsp->n_tag > 0) { + ds_put_format(&ctx->output, "%"PRId64"\n", lsp->tag[0]); } } static void -nbctl_lport_set_addresses(struct ctl_context *ctx) +nbctl_lsp_set_addresses(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, id, true); + lsp = lsp_by_name_or_uuid(ctx, id, true); int i; for (i = 2; i < ctx->argc; i++) { @@ -856,24 +857,24 @@ nbctl_lport_set_addresses(struct ctl_context *ctx) } } - nbrec_logical_port_set_addresses(lport, + nbrec_logical_switch_port_set_addresses(lsp, (const char **) ctx->argv + 2, ctx->argc - 2); } static void -nbctl_lport_get_addresses(struct ctl_context *ctx) +nbctl_lsp_get_addresses(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; struct svec addresses; const char *mac; size_t i; - lport = lport_by_name_or_uuid(ctx, id, true); + lsp = lsp_by_name_or_uuid(ctx, id, true); svec_init(&addresses); - for (i = 0; i < lport->n_addresses; i++) { - svec_add(&addresses, lport->addresses[i]); + for (i = 0; i < lsp->n_addresses; i++) { + svec_add(&addresses, lsp->addresses[i]); } svec_sort(&addresses); SVEC_FOR_EACH(i, mac, &addresses) { @@ -883,29 +884,29 @@ nbctl_lport_get_addresses(struct ctl_context *ctx) } static void -nbctl_lport_set_port_security(struct ctl_context *ctx) +nbctl_lsp_set_port_security(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, id, true); - nbrec_logical_port_set_port_security(lport, + lsp = lsp_by_name_or_uuid(ctx, id, true); + nbrec_logical_switch_port_set_port_security(lsp, (const char **) ctx->argv + 2, ctx->argc - 2); } static void -nbctl_lport_get_port_security(struct ctl_context *ctx) +nbctl_lsp_get_port_security(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; struct svec addrs; const char *addr; size_t i; - lport = lport_by_name_or_uuid(ctx, id, true); + lsp = lsp_by_name_or_uuid(ctx, id, true); svec_init(&addrs); - for (i = 0; i < lport->n_port_security; i++) { - svec_add(&addrs, lport->port_security[i]); + for (i = 0; i < lsp->n_port_security; i++) { + svec_add(&addrs, lsp->port_security[i]); } svec_sort(&addrs); SVEC_FOR_EACH(i, addr, &addrs) { @@ -915,14 +916,14 @@ nbctl_lport_get_port_security(struct ctl_context *ctx) } static void -nbctl_lport_get_up(struct ctl_context *ctx) +nbctl_lsp_get_up(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, id, true); + lsp = lsp_by_name_or_uuid(ctx, id, true); ds_put_format(&ctx->output, - "%s\n", (lport->up && *lport->up) ? "up" : "down"); + "%s\n", (lsp->up && *lsp->up) ? "up" : "down"); } static bool @@ -938,58 +939,58 @@ parse_enabled(const char *state) } static void -nbctl_lport_set_enabled(struct ctl_context *ctx) +nbctl_lsp_set_enabled(struct ctl_context *ctx) { const char *id = ctx->argv[1]; const char *state = ctx->argv[2]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, id, true); + lsp = lsp_by_name_or_uuid(ctx, id, true); bool enabled = parse_enabled(state); - nbrec_logical_port_set_enabled(lport, &enabled, 1); + nbrec_logical_switch_port_set_enabled(lsp, &enabled, 1); } static void -nbctl_lport_get_enabled(struct ctl_context *ctx) +nbctl_lsp_get_enabled(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, id, true); + lsp = lsp_by_name_or_uuid(ctx, id, true); ds_put_format(&ctx->output, "%s\n", - !lport->enabled || *lport->enabled ? "enabled" : "disabled"); + !lsp->enabled || *lsp->enabled ? "enabled" : "disabled"); } static void -nbctl_lport_set_type(struct ctl_context *ctx) +nbctl_lsp_set_type(struct ctl_context *ctx) { const char *id = ctx->argv[1]; const char *type = ctx->argv[2]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, id, true); - nbrec_logical_port_set_type(lport, type); + lsp = lsp_by_name_or_uuid(ctx, id, true); + nbrec_logical_switch_port_set_type(lsp, type); } static void -nbctl_lport_get_type(struct ctl_context *ctx) +nbctl_lsp_get_type(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; - lport = lport_by_name_or_uuid(ctx, id, true); - ds_put_format(&ctx->output, "%s\n", lport->type); + lsp = lsp_by_name_or_uuid(ctx, id, true); + ds_put_format(&ctx->output, "%s\n", lsp->type); } static void -nbctl_lport_set_options(struct ctl_context *ctx) +nbctl_lsp_set_options(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; size_t i; struct smap options = SMAP_INITIALIZER(&options); - lport = lport_by_name_or_uuid(ctx, id, true); + lsp = lsp_by_name_or_uuid(ctx, id, true); for (i = 2; i < ctx->argc; i++) { char *key, *value; value = xstrdup(ctx->argv[i]); @@ -1000,20 +1001,20 @@ nbctl_lport_set_options(struct ctl_context *ctx) free(key); } - nbrec_logical_port_set_options(lport, &options); + nbrec_logical_switch_port_set_options(lsp, &options); smap_destroy(&options); } static void -nbctl_lport_get_options(struct ctl_context *ctx) +nbctl_lsp_get_options(struct ctl_context *ctx) { const char *id = ctx->argv[1]; - const struct nbrec_logical_port *lport; + const struct nbrec_logical_switch_port *lsp; struct smap_node *node; - lport = lport_by_name_or_uuid(ctx, id, true); - SMAP_FOR_EACH(node, &lport->options) { + lsp = lsp_by_name_or_uuid(ctx, id, true); + SMAP_FOR_EACH(node, &lsp->options) { ds_put_format(&ctx->output, "%s=%s\n", node->key, node->value); } } @@ -1708,8 +1709,9 @@ static const struct ctl_table_class tables[] = { {{&nbrec_table_logical_switch, &nbrec_logical_switch_col_name, NULL}, {NULL, NULL, NULL}}}, - {&nbrec_table_logical_port, - {{&nbrec_table_logical_port, &nbrec_logical_port_col_name, NULL}, + {&nbrec_table_logical_switch_port, + {{&nbrec_table_logical_switch_port, &nbrec_logical_switch_port_col_name, + NULL}, {NULL, NULL, NULL}}}, {&nbrec_table_acl, @@ -1949,37 +1951,37 @@ static const struct ctl_command_syntax nbctl_commands[] = { nbctl_acl_del, NULL, "", RW }, { "acl-list", 1, 1, "LSWITCH", NULL, nbctl_acl_list, NULL, "", RO }, - /* lport commands. */ - { "lport-add", 2, 4, "LSWITCH LPORT [PARENT] [TAG]", NULL, nbctl_lport_add, + /* logical switch port commands. */ + { "lport-add", 2, 4, "LSWITCH LPORT [PARENT] [TAG]", NULL, nbctl_lsp_add, NULL, "--may-exist", RW }, - { "lport-del", 1, 1, "LPORT", NULL, nbctl_lport_del, NULL, "--if-exists", + { "lport-del", 1, 1, "LPORT", NULL, nbctl_lsp_del, NULL, "--if-exists", RW }, - { "lport-list", 1, 1, "LSWITCH", NULL, nbctl_lport_list, NULL, "", RO }, - { "lport-get-parent", 1, 1, "LPORT", NULL, nbctl_lport_get_parent, NULL, + { "lport-list", 1, 1, "LSWITCH", NULL, nbctl_lsp_list, NULL, "", RO }, + { "lport-get-parent", 1, 1, "LPORT", NULL, nbctl_lsp_get_parent, NULL, "", RO }, - { "lport-get-tag", 1, 1, "LPORT", NULL, nbctl_lport_get_tag, NULL, "", + { "lport-get-tag", 1, 1, "LPORT", NULL, nbctl_lsp_get_tag, NULL, "", RO }, { "lport-set-addresses", 1, INT_MAX, "LPORT [ADDRESS]...", NULL, - nbctl_lport_set_addresses, NULL, "", RW }, + nbctl_lsp_set_addresses, NULL, "", RW }, { "lport-get-addresses", 1, 1, "LPORT", NULL, - nbctl_lport_get_addresses, NULL, + nbctl_lsp_get_addresses, NULL, "", RO }, { "lport-set-port-security", 0, INT_MAX, "LPORT [ADDRS]...", NULL, - nbctl_lport_set_port_security, NULL, "", RW }, + nbctl_lsp_set_port_security, NULL, "", RW }, { "lport-get-port-security", 1, 1, "LPORT", NULL, - nbctl_lport_get_port_security, NULL, "", RO }, - { "lport-get-up", 1, 1, "LPORT", NULL, nbctl_lport_get_up, NULL, "", RO }, - { "lport-set-enabled", 2, 2, "LPORT STATE", NULL, nbctl_lport_set_enabled, + 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, NULL, "", RW }, - { "lport-get-enabled", 1, 1, "LPORT", NULL, nbctl_lport_get_enabled, NULL, + { "lport-get-enabled", 1, 1, "LPORT", NULL, nbctl_lsp_get_enabled, NULL, "", RO }, - { "lport-set-type", 2, 2, "LPORT TYPE", NULL, nbctl_lport_set_type, NULL, + { "lport-set-type", 2, 2, "LPORT TYPE", NULL, nbctl_lsp_set_type, NULL, "", RW }, - { "lport-get-type", 1, 1, "LPORT", NULL, nbctl_lport_get_type, NULL, "", + { "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, - nbctl_lport_set_options, NULL, "", RW }, - { "lport-get-options", 1, 1, "LPORT", NULL, nbctl_lport_get_options, NULL, + nbctl_lsp_set_options, NULL, "", RW }, + { "lport-get-options", 1, 1, "LPORT", NULL, nbctl_lsp_get_options, NULL, "", RO }, /* logical router commands. */ diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at index 956205b..0a1149e 100644 --- a/tests/ovn-controller-vtep.at +++ b/tests/ovn-controller-vtep.at @@ -183,7 +183,7 @@ OVN_CONTROLLER_VTEP_START # adds logical switch 'lswitch0' and vlan_bindings. AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p1 300 lswitch0]) -# adds lport in ovn-nb database, and sets the type and options. +# adds logical switch port in ovn-nb database, and sets the type and options. OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0]) OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep br-vtep_lswitch0`"]) # should see one binding, associated to chassis of 'br-vtep'. @@ -194,7 +194,7 @@ ${chassis_uuid} # adds another logical switch 'lswitch1' and vlan_bindings. AT_CHECK([vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 200 lswitch1]) -# adds lport in ovn-nb database for lswitch1. +# adds logical switch port in ovn-nb database for lswitch1. OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch1], [br-vtep], [lswitch1]) OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep -- br-vtep_lswitch1`"]) # This is allowed, but not recommended, to have two vlan_bindings (to different vtep logical switches) @@ -205,7 +205,7 @@ ${chassis_uuid} ${chassis_uuid} ]) -# adds another lport in ovn-nb database for lswitch0. +# adds another logical switch port in ovn-nb database for lswitch0. OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0_dup], [br-vtep], [lswitch0]) OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep -- br-vtep_lswitch0_dup`"]) # it is not allowed to have more than one ovn-nb logical port for the same @@ -247,7 +247,7 @@ OVN_CONTROLLER_VTEP_START # adds logical switch 'lswitch0' and vlan_bindings. AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0]) -# adds lport in ovn-nb database, and sets the type and options. +# adds logical switch port in ovn-nb database, and sets the type and options. OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0]) OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep br-vtep_lswitch0`"]) @@ -376,7 +376,7 @@ AT_CHECK([ovs-vsctl --columns=options list Interface bfd1.2.3.5 | cut -d ':' -f2 {remote_ip="1.2.3.5"} ]) -# adds another mac to lport. +# 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]) 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 @@ -385,14 +385,14 @@ AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr - "f0:ab:cd:ef:01:03" ]) -# removes one mac to lport. +# removes one mac to logical switch port. AT_CHECK([ovn-nbctl lport-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 lport 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 lport-set-addresses vif1 f0:ab:cd:ef:01:03]) OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 03`"]) diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index 73792b3..fd9fc89 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -129,7 +129,7 @@ AT_CHECK([ovn-nbctl --may-exist lport-add ls0 lp2 lp4 5], [1], [], 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 clear Logical_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], [], [ovn-nbctl: lp2: lport already exists but has no tag ]) diff --git a/tests/ovn.at b/tests/ovn.at index 652f0a6..b14203f 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1270,13 +1270,13 @@ for i in 1 2 3; do 192.168.$i$j.254/24 lrp$i$j-attachment ovn-nbctl \ -- lport-add ls$i lrp$i$j-attachment \ - -- set Logical_Port lrp$i$j-attachment type=router \ + -- set Logical_Switch_Port lrp$i$j-attachment type=router \ options:router-port=lrp$i$j \ addresses='"00:00:00:00:ff:'$i$j'"' done done -ovn-nbctl set Logical_Port lrp33-attachment \ +ovn-nbctl set Logical_Switch_Port lrp33-attachment \ addresses='"00:00:00:00:ff:33 192.168.33.254"' # Physical network: @@ -2084,13 +2084,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_port rp-ls1 type=router \ +ovn-nbctl lport-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_port rp-ls2 type=router \ +ovn-nbctl lport-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 @@ -2227,12 +2227,12 @@ 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_port rp-ls1 type=router \ +ovn-nbctl lport-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_port rp-ls2 type=router \ +ovn-nbctl lport-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 @@ -2366,17 +2366,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_port rp-foo type=router \ +ovn-nbctl lport-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_port rp-alice type=router \ - options:router-port=alice addresses=\"00:00:00:01:02:04\" +ovn-nbctl lport-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_port rp-bob type=router \ +ovn-nbctl lport-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 @@ -2611,34 +2611,33 @@ 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_port rp-foo type=router \ +ovn-nbctl lport-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_port rp-alice type=router \ - options:router-port=alice addresses=\"00:00:02:01:02:03\" +ovn-nbctl lport-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_port rp-bob type=router \ - options:router-port=bob addresses=\"00:00:03:01:02:03\" +ovn-nbctl lport-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_port r1-join type=router \ - options:router-port=R1_join addresses='"00:00:04:01:02:03"' +ovn-nbctl lport-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_port r2-join type=router \ - options:router-port=R2_join addresses='"00:00:04:01:02:04"' - +ovn-nbctl lport-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_port r3-join type=router \ - options:router-port=R3_join addresses='"00:00:04:01:02:05"' +ovn-nbctl lport-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 ovn-nbctl lr-route-add R1 172.16.1.0/24 20.0.0.2 @@ -2845,23 +2844,23 @@ 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_port rp-foo type=router \ - options:router-port=foo addresses=\"00:00:01:01:02:03\" +ovn-nbctl lport-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_port rp-alice type=router \ - options:router-port=alice addresses=\"00:00:02:01:02:03\" +ovn-nbctl lport-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_port r1-join type=router \ - options:router-port=R1_join addresses='"00:00:04:01:02:03"' +ovn-nbctl lport-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_port r2-join type=router \ - options:router-port=R2_join addresses='"00:00:04:01:02:04"' +ovn-nbctl lport-add join r2-join -- set Logical_Switch_Port r2-join \ + type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"' #install static routes @@ -2980,13 +2979,13 @@ 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_port rp-ls1 type=router \ - options:router-port=ls1 addresses=\"00:00:00:01:02:f1\" +ovn-nbctl lport-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_port rp-ls2 type=router \ - options:router-port=ls2 addresses=\"00:00:00:01:02:f2\" +ovn-nbctl lport-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 \ -- 1.9.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev