diff options
Diffstat (limited to 'mcp/salt-formulas')
-rw-r--r-- | mcp/salt-formulas/opendaylight/client.sls | 27 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/files/jetty.xml | 107 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/files/setenv.shell | 15 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/init.sls | 5 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/map.jinja | 27 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/server.sls | 49 |
6 files changed, 230 insertions, 0 deletions
diff --git a/mcp/salt-formulas/opendaylight/client.sls b/mcp/salt-formulas/opendaylight/client.sls new file mode 100644 index 000000000..1abe8743f --- /dev/null +++ b/mcp/salt-formulas/opendaylight/client.sls @@ -0,0 +1,27 @@ +{%- from "opendaylight/map.jinja" import client with context %} +{%- if client.get('enabled', True) %} + +opendaylight_client_packages: + pkg.installed: + - pkgs: {{ client.pkgs }} + +ovs_set_manager: + cmd.run: + - name: "ovs-vsctl set-manager {{ client.ovsdb_server_iface }} {{ client.ovsdb_odl_iface }}" + - unless: "ovs-vsctl get-manager | fgrep -x {{ client.ovsdb_odl_iface }}" + +ovs_set_tunnel_endpoint: + cmd.run: + - name: "ovs-vsctl set Open_vSwitch . other_config:local_ip={{ client.tunnel_ip }}" + - unless: "ovs-vsctl get Open_vSwitch . other_config | fgrep local_ip" + - require: + - cmd: ovs_set_manager + +ovs_set_provider_mapping: + cmd.run: + - name: "ovs-vsctl set Open_vSwitch . other_config:provider_mappings={{ client.provider_mappings }}" + - unless: "ovs-vsctl get Open_vSwitch . other_config | fgrep provider_mappings" + - require: + - cmd: ovs_set_manager + +{%- endif %} diff --git a/mcp/salt-formulas/opendaylight/files/jetty.xml b/mcp/salt-formulas/opendaylight/files/jetty.xml new file mode 100644 index 000000000..062568c54 --- /dev/null +++ b/mcp/salt-formulas/opendaylight/files/jetty.xml @@ -0,0 +1,107 @@ +{%- from "opendaylight/map.jinja" import server with context -%} +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting// +DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> + +<Configure class="org.eclipse.jetty.server.Server"> + + <!-- =========================================================== --> + <!-- Set connectors --> + <!-- =========================================================== --> + <!-- One of each type! --> + <!-- =========================================================== --> + + <!-- Use this connector for many frequently idle connections and for + threadless continuations. --> + <Call name="addConnector"> + <Arg> + <New class="org.eclipse.jetty.server.nio.SelectChannelConnector"> + <Set name="host">{{ server.odl_bind_ip }} + <Property name="jetty.host" /> + </Set> + <Set name="port"> + <Property name="jetty.port" default="8181" /> + </Set> + <Set name="maxIdleTime">300000</Set> + <Set name="Acceptors">2</Set> + <Set name="statsOn">false</Set> + <Set name="confidentialPort">8543</Set> + <Set name="lowResourcesConnections">20000</Set> + <Set name="lowResourcesMaxIdleTime">5000</Set> + </New> + </Arg> + </Call> + <Call name="addConnector"> + <Arg> + <New class="org.eclipse.jetty.server.nio.SelectChannelConnector"> + <Set name="host">{{ server.odl_bind_ip }} + <Property name="jetty.host" /> + </Set> + <Set name="port"> + <Property name="jetty.port" default="{{ server.odl_rest_port }}" /> + </Set> + <Set name="maxIdleTime">300000</Set> + <Set name="Acceptors">2</Set> + <Set name="statsOn">false</Set> + <Set name="confidentialPort">8443</Set> + <Set name="lowResourcesConnections">20000</Set> + <Set name="lowResourcesMaxIdleTime">5000</Set> + </New> + </Arg> + </Call> + + <!-- =========================================================== --> + <!-- Configure Authentication Realms --> + <!-- Realms may be configured for the entire server here, or --> + <!-- they can be configured for a specific web app in a context --> + <!-- configuration (see $(jetty.home)/contexts/test.xml for an --> + <!-- example). --> + <!-- =========================================================== --> + <Call name="addBean"> + <Arg> + <New class="org.eclipse.jetty.plus.jaas.JAASLoginService"> + <Set name="name">karaf</Set> + <Set name="loginModuleName">karaf</Set> + <Set name="roleClassNames"> + <Array type="java.lang.String"> + <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal + </Item> + </Array> + </Set> + </New> + </Arg> + </Call> + <Call name="addBean"> + <Arg> + <New class="org.eclipse.jetty.plus.jaas.JAASLoginService"> + <Set name="name">default</Set> + <Set name="loginModuleName">karaf</Set> + <Set name="roleClassNames"> + <Array type="java.lang.String"> + <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal + </Item> + </Array> + </Set> + </New> + </Arg> + </Call> + +</Configure> diff --git a/mcp/salt-formulas/opendaylight/files/setenv.shell b/mcp/salt-formulas/opendaylight/files/setenv.shell new file mode 100644 index 000000000..972bbeff4 --- /dev/null +++ b/mcp/salt-formulas/opendaylight/files/setenv.shell @@ -0,0 +1,15 @@ +{%- from "opendaylight/map.jinja" import server with context -%} +# export JAVA_HOME # Location of Java installation +export JAVA_MIN_MEM={{ server.java_min_mem }} # Minimum memory for the JVM +export JAVA_MAX_MEM={{ server.java_max_mem }} # Maximum memory for the JVM +# export JAVA_PERM_MEM # Minimum perm memory for the JVM +export JAVA_MAX_PERM_MEM=512m # Maximum perm memory for the JVM +export EXTRA_JAVA_OPTS='{{ server.java_extra_opts }}' # Additional JVM options +# export KARAF_HOME # Karaf home folder +# export KARAF_DATA # Karaf data folder +# export KARAF_BASE # Karaf base folder +# export KARAF_ETC # Karaf etc folder +# export KARAF_OPTS # Additional available Karaf options +# export KARAF_DEBUG # Enable debug mode +# export KARAF_REDIRECT # Enable/set the std/err redirection when using bin/start + diff --git a/mcp/salt-formulas/opendaylight/init.sls b/mcp/salt-formulas/opendaylight/init.sls new file mode 100644 index 000000000..17feb15e7 --- /dev/null +++ b/mcp/salt-formulas/opendaylight/init.sls @@ -0,0 +1,5 @@ + +include: +{% if pillar.opendaylight.server is defined %} +- opendaylight.server +{% endif %} diff --git a/mcp/salt-formulas/opendaylight/map.jinja b/mcp/salt-formulas/opendaylight/map.jinja new file mode 100644 index 000000000..0f6bf3c7e --- /dev/null +++ b/mcp/salt-formulas/opendaylight/map.jinja @@ -0,0 +1,27 @@ + +{% set server = salt['grains.filter_by']({ + 'Debian': { + 'karaf_features': {'default': ['config', 'standard', 'region', 'package', 'kar', 'ssh', 'management']}, + 'odl_rest_port': '8282', + 'odl_bind_ip': '0.0.0.0', + 'repo': 'odl-team/carbon', + 'log_levels': {}, + 'enable_ha': false, + 'ha_node_ips': [], + 'ha_node_index': 0, + 'security_group_mode': 'stateful', + 'vpp_routing_node': '', + 'java_extra_opts': '-Djava.net.preferIPv4Stack=true -XX:+UseG1GC', + 'java_min_mem': '1g', + 'java_max_mem': '2g', + }, + 'RedHat': { + 'repo': 'opendaylight-6-testing' + }, +}, merge=salt['pillar.get']('opendaylight:server')) %} + +{%- set client = salt['grains.filter_by']({ + 'Debian': { + 'pkgs': ['python-networking-odl'], + }, +}, merge=salt['pillar.get']('opendaylight:client')) %} diff --git a/mcp/salt-formulas/opendaylight/server.sls b/mcp/salt-formulas/opendaylight/server.sls new file mode 100644 index 000000000..cb5b3120c --- /dev/null +++ b/mcp/salt-formulas/opendaylight/server.sls @@ -0,0 +1,49 @@ +{% from "opendaylight/map.jinja" import server with context %} + +{%- if server.enabled %} + +opendaylight_repo: + pkgrepo.managed: + - ppa: {{ server.repo }} + +opendaylight: + pkg.installed: + - require: + - pkgrepo: opendaylight_repo + - require_in: + - file: /opt/opendaylight/etc/jetty.xml + - file: /opt/opendaylight/bin/setenv + - file: /opt/opendaylight/etc/org.apache.karaf.features.cfg + service.running: + - enable: true + - watch: + - file: /opt/opendaylight/etc/jetty.xml + - file: /opt/opendaylight/bin/setenv + - file: /opt/opendaylight/etc/org.apache.karaf.features.cfg + +/opt/opendaylight/etc/jetty.xml: + file.managed: + - source: salt://opendaylight/files/jetty.xml + - template: jinja + - user: odl + - group: odl + +/opt/opendaylight/bin/setenv: + file.managed: + - source: salt://opendaylight/files/setenv.shell + - mode: 0755 + - use: + - file: /opt/opendaylight/etc/jetty.xml + +{% set features %} +{%- for f in server.karaf_features.itervalues() -%} +{{ f | join(',') }}{%- if not loop.last %},{%- endif %} +{%- endfor %} +{% endset %} + +/opt/opendaylight/etc/org.apache.karaf.features.cfg: + file.replace: + - pattern: ^featuresBoot=.*$ + - repl: "featuresBoot={{ features }}" + +{%- endif %} |