@@ -211,6 +211,7 @@ Steffen Gebert
steffen.gebert@informatik.uni-wuerzburg.de
Sten Spans sten@blinkenlights.nl
Stephane A. Sezer sas@cd80.net
Stephen Finucane stephen.finucane@intel.com
+Steve Ruan ruansx@cn.ibm.com
SUGYO Kazushi sugyo.org@gmail.com
Tadaaki Nagao nagao@stratosphere.co.jp
Terry Wilson twilson@redhat.com
@@ -1828,70 +1828,65 @@ add_route(struct hmap *lflows, const struct
ovn_port *op,
static void
build_static_route_flow(struct hmap *lflows, struct ovn_datapath *od,
- struct hmap *ports,
- const struct nbrec_logical_router_static_route *route)
+ struct hmap *ports,
+ const struct nbrec_logical_router_static_route
*route)
{
struct ovn_port *out_port, *op;
ovs_be32 prefix, next_hop, mask;
int len;
- /* verify nexthop */
+ /* Verify nexthop ip address. */
char *error = ip_parse_masked(route->nexthop, &next_hop, &mask);
if (error || mask != OVS_BE32_MAX) {
- static struct vlog_rate_limit rl
- = VLOG_RATE_LIMIT_INIT(5, 1);
- VLOG_WARN_RL(&rl, "bad next hop ip address %s",
- route->nexthop);
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
+ VLOG_WARN_RL(&rl, "bad next hop ip address %s", route->nexthop);
free(error);
return;
}
- /* verify prefix */
- error = ip_parse_masked(route->prefix, &prefix, &mask);
+ /* Verify IP prefix. */
+ error = ip_parse_masked(route->ip_prefix, &prefix, &mask);
if (error || !ip_is_cidr(mask)) {
- static struct vlog_rate_limit rl
- = VLOG_RATE_LIMIT_INIT(5, 1);
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
VLOG_WARN_RL(&rl, "bad 'network' in static routes %s",
- route->prefix);
+ route->ip_prefix);
free(error);
return;
}
- /* find the outgoing port */
+ /* Find the outgoing port. */
out_port = NULL;
len = 0;
- if (route->output_port){
+ if (route->output_port) {
out_port = ovn_port_find(ports, route->output_port);
- if (!out_port){
- static struct vlog_rate_limit rl
- = VLOG_RATE_LIMIT_INIT(5, 1);
+ if (!out_port) {
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
VLOG_WARN_RL(&rl, "bad 'out port' in static routes %s",
- route->output_port);
+ route->output_port);
return;
}
- }
- else{ /* output_port is not specified, then find the
- * router port with longest net mask match */
- for (int i = 0; i < od->nbr->n_ports; i++){
-
+ } else {
+ /* Since output_port is not specified, find the
+ * router port with longest prefix match */
+ for (int i = 0; i < od->nbr->n_ports; i++) {
struct nbrec_logical_router_port *lrp = od->nbr->ports[i];
op = ovn_port_find(ports, lrp->name);
- if (!op){ /* this should not happen */
+ if (!op) {
+ /* This should not happen. */
continue;
}
- if (op->network && !((op->network ^ next_hop) & op->mask)){
- if (ip_count_cidr_bits(op->mask) > len){
+ if (op->network && !((op->network ^ next_hop) & op->mask)) {
+ if (ip_count_cidr_bits(op->mask) > len) {
len = ip_count_cidr_bits(op->mask);
out_port = op;
}
}
}
- if (!out_port){
- static struct vlog_rate_limit rl
- = VLOG_RATE_LIMIT_INIT(5, 1);
- VLOG_WARN_RL(&rl, "no matched out port for next hop %s",
- route->nexthop);
+ if (!out_port) {
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
+ VLOG_WARN_RL(&rl, "no matched outport for next hop %s",
+ route->nexthop);
return;
}
}
@@ -2068,8 +2063,8 @@ build_lrouter_flows(struct hmap *datapaths, struct
hmap *ports,
continue;
}
- /* convert the routing table to flow */
- for (int i = 0; i < od->nbr->n_static_routes; i++){
+ /* Convert the static routes to flows. */
+ for (int i = 0; i < od->nbr->n_static_routes; i++) {
const struct nbrec_logical_router_static_route *route;
route = od->nbr->static_routes[i];
@@ -1,7 +1,7 @@
{
"name": "OVN_Northbound",
"version": "2.1.1",
- "cksum": "1773273858 5105",
+ "cksum": "2615511875 5108",
"tables": {
"Logical_Switch": {
"columns": {
@@ -96,7 +96,7 @@
"isRoot": false},
"Logical_Router_Static_Route": {
"columns": {
- "prefix": {"type": "string"},
+ "ip_prefix": {"type": "string"},
"nexthop": {"type": "string"},
"output_port": {"type": {"key": "string", "min": 0, "max":
1}}},
"isRoot": false}
@@ -624,7 +624,7 @@
</column>
<column name="static_routes">
- One or more static routes, refer to Logical_Router_Static_Route
table.
+ One or more static routes for the router.
</column>
<column name="default_gw">
@@ -729,28 +729,29 @@
</group>
</table>
- <table name="Logical_Router_Static_Route" title="logical router static
routes">
+ <table name="Logical_Router_Static_Route" title="Logical router static
routes">
<p>
- Each route represents a static route.
+ Each record represents a static route.
</p>
- <column name="prefix">
+ <column name="ip_prefix">
<p>
- Prefix of this route, example 192.168.100.0/24.
+ IP prefix of this route (e.g. 192.168.100.0/24).
</p>
</column>
-
+
<column name="nexthop">
<p>
- Nexthop of this route, nexthop can be a IP address of neutron
port, or
- IP address which has been learnt by dynamic ARP.
+ Nexthop IP address for this route. Nexthop IP address should be
the IP
+ address of a connected router port.
</p>
</column>
-
+
<column name="output_port">
<p>
- Port name of the logical router port table. It may be configured
or may
- not be configured.
+ The name of the <ref table="Logical_router_port"/> via which the
packet
+ needs to be sent out. This is optional and when not specified, OVN
will
+ automatically figure this out based on the <ref column="nexthop"/>.
</p>
</column>
</table>
@@ -2398,15 +2398,15 @@ ovn-nbctl set logical_router_port $lrp2_uuid
peer="R1_R2"
#install static routes
ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \
-prefix=172.16.1.0/24 nexthop=20.0.0.2 -- add Logical_Router \
+ip_prefix=172.16.1.0/24 nexthop=20.0.0.2 -- add Logical_Router \
R1 static_routes @lrt
ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \
-prefix=172.16.2.0/24 nexthop=20.0.0.2 -- add Logical_Router \
+ip_prefix=172.16.2.0/24 nexthop=20.0.0.2 -- add Logical_Router \
R1 static_routes @lrt
ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \
-prefix=192.168.1.0/24 nexthop=20.0.0.1 -- add Logical_Router \
+ip_prefix=192.168.1.0/24 nexthop=20.0.0.1 -- add Logical_Router \
R2 static_routes @lrt