ovn: Connect to remote lports through localnet port.
[cascardo/ovs.git] / ovn / controller / ovn-controller.h
1 /* Copyright (c) 2015 Nicira, Inc.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16
17 #ifndef OVN_CONTROLLER_H
18 #define OVN_CONTROLLER_H 1
19
20 #include "simap.h"
21 #include "ovn/lib/ovn-sb-idl.h"
22
23 /* Linux supports a maximum of 64K zones, which seems like a fine default. */
24 #define MAX_CT_ZONES 65535
25
26 struct controller_ctx {
27     struct ovsdb_idl *ovnsb_idl;
28     struct ovsdb_idl_txn *ovnsb_idl_txn;
29
30     struct ovsdb_idl *ovs_idl;
31     struct ovsdb_idl_txn *ovs_idl_txn;
32 };
33
34 /* Contains hmap_node whose hash values are the tunnel_key of datapaths
35  * with at least one local port binding. It also stores the port binding of
36  * "localnet" port if such a port exists on the datapath, which indicates
37  * physical network should be used for inter-chassis communication through
38  * the localnet port */
39 struct local_datapath {
40     struct hmap_node hmap_node;
41     const struct sbrec_port_binding *localnet_port;
42 };
43
44 const struct ovsrec_bridge *get_bridge(struct ovsdb_idl *,
45                                        const char *br_name);
46
47 const struct sbrec_chassis *get_chassis(struct ovsdb_idl *,
48                                         const char *chassis_id);
49
50 /* Must be a bit-field ordered from most-preferred (higher number) to
51  * least-preferred (lower number). */
52 enum chassis_tunnel_type {
53     GENEVE = 1 << 2,
54     STT    = 1 << 1,
55     VXLAN  = 1 << 0
56 };
57
58 uint32_t get_tunnel_type(const char *name);
59
60
61 #endif /* ovn/ovn-controller.h */