summaryrefslogtreecommitdiffstats
path: root/manifests/network/midonet/api.pp
blob: 33b22178ad2421cba9c663e35c42ffe8d77a01c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# Copyright (C) 2015 Midokura SARL
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: tripleo::network::midonet::api
#
# Configure the MidoNet API
#
# == Parameters:
#
# [*zookeeper_servers*]
#  (required) List IPs of the zookeeper server cluster. Zookeeper is the
#  backend database where MidoNet stores the virtual network topology.
#  Array of strings value.
#
# [*vip*]
#  (required) Public Virtual IP where the API will be exposed.
#  String (IPv4) value.
#
# [*keystone_ip*]
#  (required) MidoNet API is registered as an OpenStack service. Provide the
#  keystone ip address.
#  String (IPv4) value.
#
# [*keystone_admin_token*]
#  (required) MidoNet API is registered as an OpenStack service. It needs the
#  keystone admin token to perform some admin calls.
#  String value.
#
# [*bind_address*]
#  (required) MidoNet API uses a Tomcat instance to offer the REST service. The
#  ip address where to bind the tomcat service.
#  String (IPv4) value.
#
# [*admin_password*]
#  (required) OpenStack admin user password.
#  String value.
#
# [*keystone_port*]
#  (optional) MidoNet API is registered as an OpenStack service. Provide
#  the keystone port.
#  Defaults to 35357
#
# [*keystone_tenant_name*]
#  (optional) Tenant of the keystone service.
#  Defaults to 'admin'
#
# [*admin_user_name*]
#  (optional) OpenStack admin user name.
#  Defaults to 'admin'
#
# [*admin_tenant_name*]
#  (optional). OpenStack admin tenant name.
#  Defaults to 'admin'
#

class tripleo::network::midonet::api(
  $zookeeper_servers,
  $vip,
  $keystone_ip,
  $keystone_admin_token,
  $bind_address,
  $admin_password,
  $keystone_port         = 35357,
  $keystone_tenant_name  = 'admin',
  $admin_user_name       = 'admin',
  $admin_tenant_name     = 'admin'
)
{
  validate_array($zookeeper_servers)
  validate_ip_address($vip)
  validate_ip_address($keystone_ip)
  validate_ip_address($bind_address)

  # Run Tomcat and MidoNet API
  class {'::tomcat':
    install_from_source => false
  } ->

  package {'midonet-api':
    ensure => present
  } ->

  class {'::midonet::midonet_api::run':
    zk_servers           => list_to_zookeeper_hash($zookeeper_servers),
    keystone_auth        => true,
    tomcat_package       => 'tomcat',
    vtep                 => false,
    api_ip               => $vip,
    api_port             => '8081',
    keystone_host        => $keystone_ip,
    keystone_port        => $keystone_port,
    keystone_admin_token => $keystone_admin_token,
    keystone_tenant_name => $keystone_tenant_name,
    catalina_base        => '/usr/share/tomcat',
    bind_address         => $bind_address
  }

  # Configure the CLI
  class {'::midonet::midonet_cli':
    api_endpoint => "http://${vip}:8081/midonet-api",
    username     => $admin_user_name,
    password     => $admin_password,
    tenant_name  => $admin_tenant_name
  }
}