From 585ec95d26aadeb528a6311732a7d1f9d15e59db Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Fri, 28 Aug 2015 16:32:51 +0200 Subject: [PATCH] Add neutron agent ovs with ml2 plugin resource Signed-off-by: Bogdan Dobrelya --- .../neutron_agents_ml2_ovs_puppet/README.md | 74 +++++++++++++++++++ .../actions/remove.pp | 4 + .../actions/run.pp | 45 +++++++++++ .../neutron_agents_ml2_ovs_puppet/meta.yaml | 66 +++++++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 resources/neutron_agents_ml2_ovs_puppet/README.md create mode 100644 resources/neutron_agents_ml2_ovs_puppet/actions/remove.pp create mode 100644 resources/neutron_agents_ml2_ovs_puppet/actions/run.pp create mode 100644 resources/neutron_agents_ml2_ovs_puppet/meta.yaml diff --git a/resources/neutron_agents_ml2_ovs_puppet/README.md b/resources/neutron_agents_ml2_ovs_puppet/README.md new file mode 100644 index 0000000..b9ea2e2 --- /dev/null +++ b/resources/neutron_agents_ml2_ovs_puppet/README.md @@ -0,0 +1,74 @@ +# Neutron OVS agent with ML2 plugin puppet resource + +Setups OVS neutron agent when using ML2 plugin + +# === Parameters + +source https://github.com/openstack/puppet-neutron/blob/5.1.0/manifests/agents/ml2/ovs.pp + + ``package_ensure`` + (optional) The state of the package + Defaults to 'present' + + ``enabled`` + (required) Whether or not to enable the OVS Agent + Defaults to true + + ``bridge_uplinks`` + (optional) List of interfaces to connect to the bridge when doing + bridge mapping. + Defaults to empty list + + ``bridge_mapping`` + (optional) List of : + Defaults to empty list + + ``integration_bridge`` + (optional) Integration bridge in OVS + Defaults to 'br-int' + + ``enable_tunneling`` + (optional) Enable or not tunneling + Defaults to false + + ``tunnel_types`` + (optional) List of types of tunnels to use when utilizing tunnels, + either 'gre' or 'vxlan'. + Defaults to false + + ``local_ip`` + (optional) Local IP address of GRE tunnel endpoints. + Required when enabling tunneling + Defaults to false + + ``tunnel_bridge`` + (optional) Bridge used to transport tunnels + Defaults to 'br-tun' + + ``vxlan_udp_port`` + (optional) The UDP port to use for VXLAN tunnels. + Defaults to '4789' + + ``polling_interval`` + (optional) The number of seconds the agent will wait between + polling for local device changes. + Defaults to '2" + + ``l2_population`` + (optional) Extension to use alongside ml2 plugin's l2population + mechanism driver. + Defaults to false + + ``arp_responder`` + (optional) Enable or not the ARP responder. + Recommanded when using l2 population mechanism driver. + Defaults to false + + ``firewall_driver`` + (optional) Firewall driver for realizing neutron security group function. + Defaults to 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver'. + + ``enable_distributed_routing`` + (optional) Set to True on L2 agents to enable support + for distributed virtual routing. + Defaults to false \ No newline at end of file diff --git a/resources/neutron_agents_ml2_ovs_puppet/actions/remove.pp b/resources/neutron_agents_ml2_ovs_puppet/actions/remove.pp new file mode 100644 index 0000000..7a19791 --- /dev/null +++ b/resources/neutron_agents_ml2_ovs_puppet/actions/remove.pp @@ -0,0 +1,4 @@ +class { 'neutron::agents::ml2::ovs': + package_ensure => 'absent', + enabled => false, +} \ No newline at end of file diff --git a/resources/neutron_agents_ml2_ovs_puppet/actions/run.pp b/resources/neutron_agents_ml2_ovs_puppet/actions/run.pp new file mode 100644 index 0000000..20e3813 --- /dev/null +++ b/resources/neutron_agents_ml2_ovs_puppet/actions/run.pp @@ -0,0 +1,45 @@ +$resource = hiera($::resource_name) + +$ip = $resource['input']['ip']['value'] + +$package_ensure = $resource['input']['package_ensure']['value'] +$enabled = $resource['input']['enabled']['value'] +$bridge_uplinks = $resource['input']['bridge_uplinks']['value'] +$bridge_mappings = $resource['input']['bridge_mappings']['value'] +$integration_bridge = $resource['input']['integration_bridge']['value'] +$enable_tunneling = $resource['input']['enable_tunneling']['value'] +$tunnel_types = $resource['input']['tunnel_types']['value'] +$local_ip = $resource['input']['local_ip']['value'] +$tunnel_bridge = $resource['input']['tunnel_bridge']['value'] +$vxlan_udp_port = $resource['input']['vxlan_udp_port']['value'] +$polling_interval = $resource['input']['polling_interval']['value'] +$l2_population = $resource['input']['l2_population']['value'] +$arp_responder = $resource['input']['arp_responder']['value'] +$firewall_driver = $resource['input']['firewall_driver']['value'] +$enable_distributed_routing = $resource['input']['enable_distributed_routing']['value'] + +class { 'neutron::agents::ml2::ovs': + enabled => true, + package_ensure => $package_ensure, + bridge_uplinks => $bridge_uplinks, + bridge_mappings => $bridge_mappings, + integration_bridge => $integration_bridge, + enable_tunneling => $enable_tunneling, + tunnel_types => $tunnel_types, + local_ip => $local_ip, + tunnel_bridge => $tunnel_bridge, + vxlan_udp_port => $vxlan_udp_port, + polling_interval => $polling_interval, + l2_population => $l2_population, + arp_responder => $arp_responder, + firewall_driver => $firewall_driver, + enable_distributed_routing => $enable_distributed_routing, +} + +# Remove external class dependency and restore required ones +Service <| title == 'neutron-ovs-agent-service' |> { + require => undef +} +Neutron_plugin_ml2<||> ~> Service['neutron-ovs-agent-service'] +File['/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini'] ~> +Service<| title == 'neutron-ovs-agent-service' |> \ No newline at end of file diff --git a/resources/neutron_agents_ml2_ovs_puppet/meta.yaml b/resources/neutron_agents_ml2_ovs_puppet/meta.yaml new file mode 100644 index 0000000..25fa89e --- /dev/null +++ b/resources/neutron_agents_ml2_ovs_puppet/meta.yaml @@ -0,0 +1,66 @@ +handler: puppet +id: 'neutron_agents_ml2_ovs_puppet' +input: + ip: + schema: str! + value: + ssh_key: + schema: str! + value: + ssh_user: + schema: str! + value: + + package_ensure: + schema: str + value: 'present' + enabled: + schema: bool + value: true + bridge_uplinks: + schema: [str] + value: [] + bridge_mappings: + schema: [str] + value: [] + integration_bridge: + schema: str + value: 'br-int' + enable_tunneling: + schema: bool + value: false + tunnel_types: + schema: [str] + value: [] + local_ip: + schema: bool + value: false + tunnel_bridge: + schema: str + value: 'br-tun' + vxlan_udp_port: + schema: int + value: 4789 + polling_interval: + schema: int + value: 2 + l2_population: + schema: bool + value: false + arp_responder: + schema: bool + value: false + firewall_driver: + schema: str + value: 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver' + enable_distributed_routing: + schema: bool + value: false + + git: + schema: {repository: str!, branch: str!} + value: {repository: 'https://github.com/openstack/puppet-neutron', branch: '5.1.0'} + +puppet_module: 'neutron' +tags: [resource/neutron, resource/neutron_agents_ml2_ovs] +version: 1.0.0