armando-migliaccio | cabc60c | 2013-05-09 11:33:16 -0700 | [diff] [blame^] | 1 | # Nicira NVP |
| 2 | # ---------- |
| 3 | |
| 4 | # This third-party addition can be used to configure connectivity between a DevStack instance |
| 5 | # and an NVP Gateway in dev/test environments. In order to use this correctly, the following |
| 6 | # env variables need to be set (e.g. in your localrc file): |
| 7 | # |
| 8 | # * enable_service nicira --> to execute this third-party addition |
| 9 | # * PUBLIC_BRIDGE --> bridge used for external connectivity, typically br-ex |
| 10 | # * NVP_GATEWAY_NETWORK_INTERFACE --> interface used to communicate with the NVP Gateway |
| 11 | # * NVP_GATEWAY_NETWORK_CIDR --> CIDR to configure br-ex, e.g. 172.24.4.211/24 |
| 12 | |
| 13 | # Save trace setting |
| 14 | MY_XTRACE=$(set +o | grep xtrace) |
| 15 | set +o xtrace |
| 16 | |
| 17 | # This is the interface that connects the Devstack instance |
| 18 | # to an network that allows it to talk to the gateway for |
| 19 | # testing purposes |
| 20 | NVP_GATEWAY_NETWORK_INTERFACE=${NVP_GATEWAY_NETWORK_INTERFACE:-eth2} |
| 21 | |
| 22 | function configure_nicira() { |
| 23 | : |
| 24 | } |
| 25 | |
| 26 | function init_nicira() { |
| 27 | die_if_not_set $LINENO NVP_GATEWAY_NETWORK_CIDR "Please, specify CIDR for the gateway network interface." |
| 28 | # Make sure the interface is up, but not configured |
| 29 | sudo ifconfig $NVP_GATEWAY_NETWORK_INTERFACE up |
| 30 | sudo ip addr flush $NVP_GATEWAY_NETWORK_INTERFACE |
| 31 | # Use the PUBLIC Bridge to route traffic to the NVP gateway |
| 32 | # NOTE(armando-migliaccio): if running in a nested environment this will work |
| 33 | # only with mac learning enabled, portsecurity and security profiles disabled |
| 34 | sudo ovs-vsctl -- --may-exist add-port $PUBLIC_BRIDGE $NVP_GATEWAY_NETWORK_INTERFACE |
| 35 | nvp_gw_net_if_mac=$(ip link show $NVP_GATEWAY_NETWORK_INTERFACE | awk '/ether/ {print $2}') |
| 36 | sudo ifconfig $PUBLIC_BRIDGE $NVP_GATEWAY_NETWORK_CIDR hw ether $nvp_gw_net_if_mac |
| 37 | } |
| 38 | |
| 39 | function install_nicira() { |
| 40 | : |
| 41 | } |
| 42 | |
| 43 | function start_nicira() { |
| 44 | : |
| 45 | } |
| 46 | |
| 47 | function stop_nicira() { |
| 48 | : |
| 49 | } |
| 50 | |
| 51 | # Restore xtrace |
| 52 | $MY_XTRACE |