diff options
Diffstat (limited to 'mcp/salt-formulas/salt-formula-opendaylight/opendaylight')
9 files changed, 445 insertions, 0 deletions
diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/config.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/config.sls new file mode 100644 index 000000000..3f1f81348 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/config.sls @@ -0,0 +1,94 @@ +############################################################################## +# Copyright (c) 2019 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{% from "opendaylight/map.jinja" import server with context %} + +/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 + - template: jinja + - mode: 0755 + - user: odl + - group: odl + +{%- set features = [] %} +{%- for f in server.karaf_features.itervalues() %} + {%- do features.extend(f) %} +{%- endfor %} + +/opt/opendaylight/etc/org.apache.karaf.features.cfg: + ini.options_present: + - sections: + featuresBoot: {{ features|join(',') }} + +/opt/opendaylight/etc/org.ops4j.pax.web.cfg: + ini.options_present: + - sections: + org.ops4j.pax.web.listening.addresses: {{ server.odl_bind_ip }} + org.osgi.service.http.port: {{ server.odl_rest_port }} + +{%- if not server.pax_logging_enabled|d(false) %} + {%- + set pax_logging_opts = [ + 'log4j2.rootLogger.appenderRef.PaxOsgi.ref', + 'log4j2.appender.osgi.type', + 'log4j2.appender.osgi.name', + 'log4j2.appender.osgi.filter' + ] + %} + + {%- for opt in pax_logging_opts %} +pax.logging.cfg.{{ opt }}: + file.comment: + - name: /opt/opendaylight/etc/org.ops4j.pax.logging.cfg + - regex: ^{{ opt }}\s*= + - backup: false + {%- endfor %} +{%- endif %} + +/opt/opendaylight/etc/org.opendaylight.openflowplugin.cfg: + file.managed: + - user: odl + - group: odl + ini.options_present: + - sections: + is-statistics-polling-on: {{ server.stats_polling_enabled }} + +{%- if server.get('router_enabled', false) %} +/opt/opendaylight/etc/custom.properties: + ini.options_present: + - sections: + ovsdb.l3.fwd.enabled: 'yes' + ovsdb.of.version: 1.3 +{%- endif %} + +{%- if server.netvirt_natservice is defined %} +/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml: + file.managed: + - source: salt://opendaylight/files/netvirt-natservice-config.xml + - template: jinja + - makedirs: true + - user: odl + - group: odl +{%- endif %} + +{%- if server.dhcp.enabled %} +/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-dhcpservice-config.xml: + file.managed: + - source: salt://opendaylight/files/netvirt-dhcpservice-config.xml + - template: jinja + - makedirs: true + - user: odl + - group: odl +{%- endif %} diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml new file mode 100644 index 000000000..de2ac677d --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml @@ -0,0 +1,132 @@ +{%- 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 id="Server" class="org.eclipse.jetty.server.Server"> + + <!-- =========================================================== --> + <!-- Set connectors --> + <!-- =========================================================== --> + <!-- One of each type! --> + <!-- =========================================================== --> + + <!-- Use this connector for many frequently idle connections and for + threadless continuations. --> + <New id="http-default" class="org.eclipse.jetty.server.HttpConfiguration"> + <Set name="secureScheme">https</Set> + <Set name="securePort"> + <Property name="jetty.secure.port" default="8543" /> + </Set> + <Set name="outputBufferSize">32768</Set> + <Set name="requestHeaderSize">8192</Set> + <Set name="responseHeaderSize">8192</Set> + + <!-- Default security setting: do not leak our version --> + <Set name="sendServerVersion">false</Set> + + <Set name="sendDateHeader">false</Set> + <Set name="headerCacheSize">512</Set> + </New> + + <New id="http-legacy" class="org.eclipse.jetty.server.HttpConfiguration"> + <Set name="secureScheme">https</Set> + <Set name="securePort"> + <Property name="jetty.secure.port" default="8443" /> + </Set> + <Set name="outputBufferSize">32768</Set> + <Set name="requestHeaderSize">8192</Set> + <Set name="responseHeaderSize">8192</Set> + + <!-- Default security setting: do not leak our version --> + <Set name="sendServerVersion">false</Set> + + <Set name="sendDateHeader">false</Set> + <Set name="headerCacheSize">512</Set> + </New> + + <Call name="addConnector"> + <Arg> + <New class="org.eclipse.jetty.server.ServerConnector"> + <Arg name="server"> + <Ref refid="Server" /> + </Arg> + <Arg name="factories"> + <Array type="org.eclipse.jetty.server.ConnectionFactory"> + <Item> + <New class="org.eclipse.jetty.server.HttpConnectionFactory"> + <Arg name="config"> + <Ref refid="http-default"/> + </Arg> + </New> + </Item> + </Array> + </Arg> + <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="idleTimeout"> + <Property name="http.timeout" default="300000"/> + </Set> + <Set name="name">jetty-default</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.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.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/salt-formula-opendaylight/opendaylight/files/netvirt-dhcpservice-config.xml b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-dhcpservice-config.xml new file mode 100644 index 000000000..336957fd1 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-dhcpservice-config.xml @@ -0,0 +1,23 @@ +{%- from "opendaylight/map.jinja" import server with context -%} +<!-- + 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. +--> +<dhcpservice-config xmlns="urn:opendaylight:params:xml:ns:yang:dhcpservice:config"> + <controller-dhcp-enabled>{{ server.dhcp.enabled }}</controller-dhcp-enabled> + <dhcp-dynamic-allocation-pool-enabled>{{ server.dhcp.dynamic_allocation_pool_enabled }}</dhcp-dynamic-allocation-pool-enabled> +</dhcpservice-config> diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-natservice-config.xml b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-natservice-config.xml new file mode 100644 index 000000000..35994e51d --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-natservice-config.xml @@ -0,0 +1,23 @@ +{%- from "opendaylight/map.jinja" import server with context -%} +<!-- + 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. +--> +<natservice-config xmlns="urn:opendaylight:netvirt:natservice:config"> + <nat-mode>{{ server.netvirt_natservice.nat_mode|d('controller') }}</nat-mode> + <snat-punt-timeout>{{ server.netvirt_natservice.snat_punt_timeout|d('5') }}</snat-punt-timeout> +</natservice-config> diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell new file mode 100644 index 000000000..2921ade14 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell @@ -0,0 +1,21 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{%- 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/salt-formula-opendaylight/opendaylight/init.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls new file mode 100644 index 000000000..132f69b33 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls @@ -0,0 +1,12 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +include: +{% if pillar.opendaylight.server is defined %} +- opendaylight.server +{% endif %} diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja new file mode 100644 index 000000000..44f2685d0 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja @@ -0,0 +1,33 @@ +############################################################################## +# Copyright (c) 2019 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +{%- set pkgs = ['opendaylight'] %} +{%- do pkgs.append('opendaylight-leveldbjni') if grains['cpuarch'] == 'aarch64' %} + +{% set server = salt['grains.filter_by']({ + 'Debian': { + 'pkgs': pkgs, + 'karaf_features': {'default': ['standard', 'wrap', 'ssh']}, + 'odl_rest_port': '8282', + 'odl_bind_ip': '0.0.0.0', + 'repo': 'odl-team/oxygen', + 'log_levels': {}, + 'cluster_enabled': false, + 'seed_nodes_list': [], + 'stats_polling_enabled': false, + 'dhcp': { + 'enabled': false, + 'dynamic_allocation_pool_enabled': false, + }, + 'security_group_mode': 'stateful', + 'vpp_routing_node': '', + 'java_extra_opts': '-Djava.net.preferIPv4Stack=true -XX:+UseG1GC', + 'java_min_mem': '1g', + 'java_max_mem': '2g', + } +}, merge=salt['pillar.get']('opendaylight:server')) %} diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/repo.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/repo.sls new file mode 100644 index 000000000..1f322c53f --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/repo.sls @@ -0,0 +1,56 @@ +############################################################################## +# Copyright (c) 2019 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{% from "opendaylight/map.jinja" import server with context %} + +# NOTE: starting with Salt 2018.3, key_text might be used instead +opendaylight_repo_key: + # Launchpad PPA for ODL Team + # pub 4096R/44C05248 2017-01-26 + cmd.run: + - name: | + cat <<-EOF | sudo apt-key add - + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: GnuPG v1 + + mQINBFiKaBEBEADpCtIj8utf/bUfN6iQ+sxGiOPLnXVYoYyKifHDazD4o1Jevfiu + EpcDIx9EdnhrCpvKTU+jaw2B7K3pkdqbjbzjZY+2CDENSQXfRHuuI/nWDaYI0stx + Tf/evip3cxdutnZNAklzkxppHP+4UZm9HAd7uZsEyff4H9DIsHzZIA4Z++Hx2+lt + w9K0iCKh2k6Pon/VVo8Bir3JuKIIdLRAuHmyniYlHDswQnu+1nQHE0F/oboD0Q9Z + hOvXAr1L7LWu0hkLV7BqmeI0SPcRA3b5MU3dfaTK8MaPAo8anQTpCyYUnoIBqX8h + y324T/dvpFKq2/X3RL+wOSYTA8TLgyhH0fhdIKZg3G8m9kx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ZmmrT4AH09Yt2RzmY0FBWValqpoPagheQqeU+2W + FKnV9Lw1SKMtWZbYMvIlB0rwts3k9lE= + =xkZ9 + -----END PGP PUBLIC KEY BLOCK----- + EOF + - unless: apt-key list | grep -qF '4096R/44C05248 2017-01-26' + +opendaylight_repo: + pkgrepo.managed: + # NOTE(armband): PPA handling behind proxy broken, define it explicitly + # https://github.com/saltstack/salt/pull/45224 + # - ppa: {{ server.repo }} + - human_name: opendaylight-ppa + - name: deb http://ppa.launchpad.net/{{ server.repo }}/ubuntu {{ grains.oscodename }} main + - file: /etc/apt/sources.list.d/odl-team-{{ server.version }}.list diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls new file mode 100644 index 000000000..6e31ffb3f --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls @@ -0,0 +1,51 @@ +############################################################################## +# Copyright (c) 2019 Mirantis Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{% from "opendaylight/map.jinja" import server with context %} + +{%- if server.enabled %} + +include: + - opendaylight.config + - opendaylight.repo + +{%- if grains['saltversioninfo'] < [2017, 7] %} +service.mask: + module.run: + - m_name: opendaylight +{%- else %} +opendaylight_service_mask: + service.masked: + - name: opendaylight +{%- endif %} + - prereq: + - pkg: opendaylight + +{%- if server.cluster_enabled %} +configure_cluster: + cmd.run: + - name: /opt/opendaylight/bin/configure-cluster-ipdetect.sh {{ server.seed_nodes_list }} + - require: + - pkg: opendaylight +{%- endif %} + +opendaylight: + pkg.installed: + - names: {{ server.pkgs }} + - require: + - sls: opendaylight.repo + - require_in: + - sls: opendaylight.config + service.running: + - enable: true +{%- if grains['saltversioninfo'] >= [2017, 7] %} + - unmask: true +{%- endif %} + - watch: + - sls: opendaylight.config + +{%- endif %} |