dba51b39917746b3c46c5eff8141f81b840db990
[fuel.git] / mcp / salt-formulas / opendaylight / client.sls
1 ##############################################################################
2 # Copyright (c) 2017 Mirantis Inc. and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 {%- from "opendaylight/map.jinja" import client with context %}
9 {%- if client.get('enabled', True) %}
10
11 opendaylight_client_packages:
12   pkg.installed:
13   - pkgs: {{ client.pkgs }}
14
15 {%- if pillar.linux.network.bridge is defined and pillar.linux.network.bridge == 'openvswitch' %}
16 ovs_set_manager:
17   cmd.run:
18   - name: "ovs-vsctl set-manager {{ client.ovsdb_server_iface }} {{ client.ovsdb_odl_iface }}"
19   - unless: "ovs-vsctl get-manager | grep -Fx {{ client.ovsdb_odl_iface }}"
20
21 ovs_set_tunnel_endpoint:
22   cmd.run:
23   - name: "ovs-vsctl set Open_vSwitch . other_config:local_ip={{ client.tunnel_ip }}"
24   - unless: "ovs-vsctl get Open_vSwitch . other_config | fgrep local_ip"
25   - require:
26     - cmd: ovs_set_manager
27
28 {%- if client.provider_mappings is defined %}
29 ovs_set_provider_mapping:
30   cmd.run:
31   - name: "ovs-vsctl set Open_vSwitch . other_config:provider_mappings={{ client.provider_mappings }}"
32   - unless: "ovs-vsctl get Open_vSwitch . other_config | fgrep provider_mappings"
33   - require:
34     - cmd: ovs_set_manager
35 {%- endif %}
36
37 {%- endif %}
38 {%- endif %}