|
1
|
1
|
new file mode 100644
|
|
...
|
...
|
@@ -0,0 +1,94 @@
|
|
|
0
|
+# OpenFlow Agent plugin
|
|
|
1
|
+# ----------------------
|
|
|
2
|
+
|
|
|
3
|
+# Save trace setting
|
|
|
4
|
+MY_XTRACE=$(set +o | grep xtrace)
|
|
|
5
|
+set +o xtrace
|
|
|
6
|
+
|
|
|
7
|
+source $TOP_DIR/lib/neutron_plugins/ovs_base
|
|
|
8
|
+source $TOP_DIR/lib/neutron_thirdparty/ryu # for RYU_DIR, install_ryu, etc
|
|
|
9
|
+
|
|
|
10
|
+function neutron_plugin_create_nova_conf {
|
|
|
11
|
+ _neutron_ovs_base_configure_nova_vif_driver
|
|
|
12
|
+}
|
|
|
13
|
+
|
|
|
14
|
+function neutron_plugin_install_agent_packages {
|
|
|
15
|
+ _neutron_ovs_base_install_agent_packages
|
|
|
16
|
+
|
|
|
17
|
+ # This agent uses ryu to talk with switches
|
|
|
18
|
+ install_package $(get_packages "ryu")
|
|
|
19
|
+ install_ryu
|
|
|
20
|
+ configure_ryu
|
|
|
21
|
+}
|
|
|
22
|
+
|
|
|
23
|
+function neutron_plugin_configure_debug_command {
|
|
|
24
|
+ _neutron_ovs_base_configure_debug_command
|
|
|
25
|
+}
|
|
|
26
|
+
|
|
|
27
|
+function neutron_plugin_configure_dhcp_agent {
|
|
|
28
|
+ iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
|
|
|
29
|
+}
|
|
|
30
|
+
|
|
|
31
|
+function neutron_plugin_configure_l3_agent {
|
|
|
32
|
+ _neutron_ovs_base_configure_l3_agent
|
|
|
33
|
+ iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
|
|
|
34
|
+}
|
|
|
35
|
+
|
|
|
36
|
+function neutron_plugin_configure_plugin_agent {
|
|
|
37
|
+ # Set up integration bridge
|
|
|
38
|
+ _neutron_ovs_base_setup_bridge $OVS_BRIDGE
|
|
|
39
|
+ _neutron_ovs_base_configure_firewall_driver
|
|
|
40
|
+
|
|
|
41
|
+ # Check a supported openflow version
|
|
|
42
|
+ OF_VERSION=`ovs-ofctl --version | grep "OpenFlow versions" | awk '{print $3}' | cut -d':' -f2`
|
|
|
43
|
+ if [ `vercmp_numbers "$OF_VERSION" "0x3"` -lt "0" ]; then
|
|
|
44
|
+ die $LINENO "This agent requires OpenFlow 1.3+ capable switch."
|
|
|
45
|
+ fi
|
|
|
46
|
+
|
|
|
47
|
+ # Enable tunnel networks if selected
|
|
|
48
|
+ if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then
|
|
|
49
|
+ # Verify tunnels are supported
|
|
|
50
|
+ # REVISIT - also check kernel module support for GRE and patch ports
|
|
|
51
|
+ OVS_VERSION=`ovs-vsctl --version | head -n 1 | grep -E -o "[0-9]+\.[0-9]+"`
|
|
|
52
|
+ if [ `vercmp_numbers "$OVS_VERSION" "1.4"` -lt "0" ]; then
|
|
|
53
|
+ die $LINENO "You are running OVS version $OVS_VERSION. OVS 1.4+ is required for tunneling between multiple hosts."
|
|
|
54
|
+ fi
|
|
|
55
|
+ iniset /$Q_PLUGIN_CONF_FILE ovs enable_tunneling True
|
|
|
56
|
+ iniset /$Q_PLUGIN_CONF_FILE ovs local_ip $HOST_IP
|
|
|
57
|
+ fi
|
|
|
58
|
+
|
|
|
59
|
+ # Setup physical network bridge mappings. Override
|
|
|
60
|
+ # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more
|
|
|
61
|
+ # complex physical network configurations.
|
|
|
62
|
+ if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then
|
|
|
63
|
+ OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE
|
|
|
64
|
+
|
|
|
65
|
+ # Configure bridge manually with physical interface as port for multi-node
|
|
|
66
|
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE
|
|
|
67
|
+ fi
|
|
|
68
|
+ if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then
|
|
|
69
|
+ iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS
|
|
|
70
|
+ fi
|
|
|
71
|
+ AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-ofagent-agent"
|
|
|
72
|
+
|
|
|
73
|
+ # Define extra "AGENT" configuration options when q-agt is configured by defining
|
|
|
74
|
+ # defining the array ``Q_AGENT_EXTRA_AGENT_OPTS``.
|
|
|
75
|
+ # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)``
|
|
|
76
|
+ for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do
|
|
|
77
|
+ # Replace the first '=' with ' ' for iniset syntax
|
|
|
78
|
+ iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ }
|
|
|
79
|
+ done
|
|
|
80
|
+}
|
|
|
81
|
+
|
|
|
82
|
+function neutron_plugin_setup_interface_driver {
|
|
|
83
|
+ local conf_file=$1
|
|
|
84
|
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
|
|
|
85
|
+ iniset $conf_file DEFAULT ovs_use_veth True
|
|
|
86
|
+}
|
|
|
87
|
+
|
|
|
88
|
+function neutron_plugin_check_adv_test_requirements {
|
|
|
89
|
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
|
|
|
90
|
+}
|
|
|
91
|
+
|
|
|
92
|
+# Restore xtrace
|
|
|
93
|
+$MY_XTRACE
|