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