Jeffrey Townsend | 58106f8 | 2012-03-26 15:08:17 -0700 | [diff] [blame] | 1 | ############################################################################### |
| 2 | # |
| 3 | # ovs-ctl.py |
| 4 | # |
| 5 | ############################################################################### |
| 6 | |
| 7 | ovs-ctl manages the initialization and execution of OVS instances as targets |
| 8 | for OFTest execution. |
| 9 | |
| 10 | |
| 11 | ------------------------------------------------------------------------------- |
| 12 | INSTALLATION |
| 13 | ------------------------------------------------------------------------------- |
| 14 | |
| 15 | ovs-ctl requires OVS be built and installed on your local machine. |
| 16 | If you are new to OVS, the preferred method is: |
| 17 | |
| 18 | 1. Download openvswitch-X.Y.Z from http://openvswitch.org/releases |
| 19 | 2. Untar, configure, build, and install openvswitch into a useful location: |
| 20 | |
| 21 | # All OVS installations will go in to /opt/ovs: |
| 22 | > mkdir -p /opt/ovs |
| 23 | |
| 24 | # All OVS Source distributions will live in /opt/ovs/src: |
| 25 | > mkdir -p /opt/ovs/src |
| 26 | |
| 27 | # Download and untar source for openvswitch 1.4.0: |
| 28 | > curl http://openvswitch.org/releases/openvswitch-1.4.0.tar.gz | tar -xzC /opt/ovs/src |
| 29 | |
| 30 | # build and install: |
| 31 | > cd /opt/ovs/openvswitch-1.4.0 |
| 32 | > ./configure --prefix=/opt/ovs/1.4.0 --with-linux=/lib/modules/`uname -r`/build |
| 33 | > make |
| 34 | > sudo make install |
| 35 | |
| 36 | # Copy the OVS kernel module out of the build tree into the install tree: |
| 37 | > sudo cp /opt/ovs/src/openvswitch-1.4.0/datapath/linux/openvswitch_mod.ko /opt/ovs/1.4.0/sbin |
| 38 | |
| 39 | |
| 40 | 3. READ the comments and instructions in ovs-ctl-default.example.conf |
| 41 | |
| 42 | 4. Copy ovs-ctl-default.example.conf from the local directory to /opt/ovs: |
| 43 | |
| 44 | > sudo cp ovs-ctl-default.example.conf /opt/ovs/ovs-ctl-default.conf |
| 45 | |
| 46 | 5. Modify /opt/ovs/ovs-ctl-default.conf to match your existing installation(s). |
| 47 | If you followed the directions and used the paths suggested in Step 2, then the default |
| 48 | configuration file should work without modification. |
| 49 | Otherwise, edit to point to your installation directorie(s). |
| 50 | |
| 51 | |
| 52 | |
| 53 | ------------------------------------------------------------------------------- |
| 54 | EXAMPLE USAGE |
| 55 | ------------------------------------------------------------------------------- |
| 56 | |
| 57 | You can initialize and run your default configuration (as specified in the config files) as follows: |
| 58 | |
| 59 | > ./ovs-ctl |
| 60 | |
| 61 | You can stop a running configuration as follows: |
| 62 | |
| 63 | > ./ovs-ctl --kill |
| 64 | |
| 65 | You can initialize and run any configuration (as specified in the config files) as follows: |
| 66 | |
| 67 | > ./ovs-ctl --config 1.3.0 |
| 68 | > ./ovs-ctl --config 1.4.0 |
| 69 | > ./ovs-ctl --config MySomeOtherConfiguration |
| 70 | |
| 71 | You can output logging and verbose information with the --log and --verbose options. |
| 72 | |
| 73 | By default, OVS is initialized with 4 veth ports. You can change this with the --port-count option. |
| 74 | |
| 75 | |
| 76 | |
| 77 | CONFIG FILES |
| 78 | ------------ |
| 79 | |
| 80 | The configuration file options are just convenient methods of storing values for the command line |
| 81 | arguments. Every command line argument can be specified as a key in your configuration file. |
| 82 | |
| 83 | You do not need a configuration file at all -- you can specify all required paths and values |
| 84 | from the command line -- but this is not recommended for regular usage. |
| 85 | |
| 86 | The precedence for these settings is in the following order: |
| 87 | |
| 88 | 1. Command Line option, if specified, THEN |
| 89 | 2. The [ConfigName] section of all config files, both default, user, or command-line specified, THEN |
| 90 | 3. The [Defaults] section of all config files |
| 91 | |
| 92 | |
| 93 | Note that you may have a section defined in the ovs-ctl-default.conf file, AND in your ~/.ovs-ctl file. |
| 94 | The settings will be merged together, with the values in ~/.ovs-ctl taking precedence: |
| 95 | |
| 96 | So, for example, you can have the local installation information for 1.4.0 specified in /opt/ovs/ovs-ctl-default.conf as follows: |
| 97 | |
| 98 | [1.4.0] |
| 99 | # ovs-1.4.0, configured and built into /opt/ovs/1.4.0 |
| 100 | # Can be selected with 'ovs-ctl.py --config 1.4.0' |
| 101 | ovs_src_dir:/opt/ovs/src/openvswitch-1.4.0 |
| 102 | ovs_base_dir:/opt/ovs/1.4.0 |
| 103 | ovs_runtime_dir:/var/run/ovs/1.4.0 |
| 104 | |
| 105 | This can be used by everyone. |
| 106 | |
| 107 | You can also have user-specific settings in ~/.ovs-ctl for your own execution: |
| 108 | |
| 109 | [1.4.0] |
| 110 | # Put logfiles for my personal runs in my ~/ovs-logfiles directory: |
| 111 | ovs_vswitchd_log=~/.ovs-logfiles/vswitchd.log |
| 112 | |
| 113 | |
| 114 | |
| 115 | ------------------------------------------------------------------------------- |
| 116 | OPTIONS AND HELP |
| 117 | ------------------------------------------------------------------------------- |
| 118 | |
| 119 | This documentation is minimal. |
| 120 | |
| 121 | Please see ./ovs-ctl --help for a full list of options: |
| 122 | |
| 123 | usage: ovs-ctl.py [-h] [-cf FILE [FILE ...]] [-c CONFIG] [-d FILE] [-nd] |
| 124 | [--dump-config] [--ovs-vswitchd-schema OVS_VSWITCHD_SCHEMA] |
| 125 | [--ovs-vswitchd-log OVS_VSWITCHD_LOG] |
| 126 | [--ovs-vswitchd OVS_VSWITCHD] [--ovs-vsctl OVS_VSCTL] |
| 127 | [--ovs-ofctl OVS_OFCTL] [--ovsdb-tool OVSDB_TOOL] |
| 128 | [--ovsdb-server OVSDB_SERVER] [--ovs-kmod OVS_KMOD] |
| 129 | [--ovs-src-dir OVS_SRC_DIR] [--ovs-log-dir OVS_LOG_DIR] |
| 130 | [--ovs-version OVS_VERSION] [--ovs-base-dir OVS_BASE_DIR] |
| 131 | [--ovs-runtime-dir OVS_RUNTIME_DIR] |
| 132 | [--ovs-db-sock OVS_DB_SOCK] [--ovs-db-file OVS_DB_FILE] |
| 133 | [--dry] [--log] [--verbose] [--kill] [--keep-veths] |
| 134 | [--no-kmod] [--vlog] [-p PORT_COUNT] [--bridge BRIDGE] |
| 135 | [--cip CIP] [--cport CPORT] [--max_backoff MAX_BACKOFF] |
| 136 | [--keep-db] |
| 137 | |
| 138 | optional arguments: |
| 139 | -h, --help show this help message and exit |
| 140 | -cf FILE [FILE ...], --config-file FILE [FILE ...] |
| 141 | Load settings from the given config file |
| 142 | -c CONFIG, --config CONFIG |
| 143 | Use the specified configuration section |
| 144 | -d FILE, --default-config-file FILE |
| 145 | Location of the local default config file |
| 146 | -nd, --no-default Do not load the default config file |
| 147 | --dump-config Dump the loaded configuration settings |
| 148 | --ovs-vswitchd-schema OVS_VSWITCHD_SCHEMA |
| 149 | Path to the vswitchd.ovsschema file |
| 150 | --ovs-vswitchd-log OVS_VSWITCHD_LOG |
| 151 | Path to the vswitchd log file |
| 152 | --ovs-vswitchd OVS_VSWITCHD |
| 153 | Path to the target ovs-vswitchd binary |
| 154 | --ovs-vsctl OVS_VSCTL |
| 155 | Path to the target ovs-vsctl binary |
| 156 | --ovs-ofctl OVS_OFCTL |
| 157 | Path to the target ovs-ofctl binary |
| 158 | --ovsdb-tool OVSDB_TOOL |
| 159 | Path to the target ovsdb-tool binary |
| 160 | --ovsdb-server OVSDB_SERVER |
| 161 | Path to the target ovsdb-server binary |
| 162 | --ovs-kmod OVS_KMOD Path to the OVS kernel module |
| 163 | --ovs-src-dir OVS_SRC_DIR |
| 164 | Directory for the OVS Source Files |
| 165 | --ovs-log-dir OVS_LOG_DIR |
| 166 | Directory for the OVS Runtime Log Files |
| 167 | --ovs-version OVS_VERSION |
| 168 | --ovs-base-dir OVS_BASE_DIR |
| 169 | OVS Base Installation Directory |
| 170 | --ovs-runtime-dir OVS_RUNTIME_DIR |
| 171 | OVS Runtime Directory |
| 172 | --ovs-db-sock OVS_DB_SOCK |
| 173 | Domain Socket Location |
| 174 | --ovs-db-file OVS_DB_FILE |
| 175 | Location for the OVS database file |
| 176 | --dry Dry run only. Don't actually do anything |
| 177 | --log Enable logging |
| 178 | --verbose Enable verbose output information |
| 179 | --kill Kill running OVS |
| 180 | --keep-veths By default, all existing veths will be destroyed and |
| 181 | the veth module removed before initializing. If you |
| 182 | don't want the veth module removed, specify this |
| 183 | argument. Your mileage may vary if you use this. |
| 184 | --no-kmod Do not attempt to insert or remove the OVS kernel |
| 185 | module. Your mileage may vary. |
| 186 | --vlog Tail the running vswitch.log file in a new xterm |
| 187 | -p PORT_COUNT, --port-count PORT_COUNT |
| 188 | Number of veth ports to connect. |
| 189 | --bridge BRIDGE Name of OF OVS Bridge |
| 190 | --cip CIP Controller Connection |
| 191 | --cport CPORT Controller Port |
| 192 | --max_backoff MAX_BACKOFF |
| 193 | VSwitchD max backoff value |
| 194 | --keep-db By default, a new database is initialized at each |
| 195 | execution. If you want to keep and use the old |
| 196 | database (if it exists), use this option |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | ------------------------------------------------------------------------------- |
| 202 | TODO |
| 203 | ------------------------------------------------------------------------------- |
| 204 | |
| 205 | 1. Better documentation. |
| 206 | 2. Option for automatic downloading, configuration, and installation of OVS. |
| 207 | 3. Symlinks or alias generation for selecting the correct ovs-* tools for |
| 208 | debugging the running configuration. |
| 209 | |
| 210 | |
| 211 | |
| 212 | |