# License for the specific language governing permissions and limitations # under the License. from dao.common import config from dao.control import exceptions from dao.control import server_helper from dao.control.worker import provisioning from dao.control.worker.hooks import base as hook_base from dao.control.worker.dhcp import base as dhcp_base from dao.control.worker.openstack import ironic_helper from dao.control.worker.openstack import nova_helper opts = [ config.StrOpt('openstack', 'image_name_kernel', default='vi-ipa.kernel', help='Ironic python agent kernel image UUID'), config.StrOpt('openstack', 'image_name_ram', default='vi-ipa.initramfs', help='Ironic python agent ram image UUID'), ] config.register(opts) CONF = config.get_config() def ram2mb(_sku): multiplier = {'GB': 1024, 'MB': 1} return int(_sku.ram[:-2]) * multiplier[_sku.ram[-2:]]
from pysnmp.smi import builder, view from dao.common import config from dao.common import log from dao.common import utils from dao.control import exceptions cmdgen = eventlet.import_patched('pysnmp.entity.rfc3413.oneliner.cmdgen') opts = [ config.BoolOpt('worker', 'ipmi_timeout', default=20 * 60, help='Timeout for IPMI operation.'), config.StrOpt('worker', 'snmp_community', default='public', help='SNMP community data field for snmpv1'), config.IntOpt('worker', 'snmp_port', default=161, help='SNMP port to use') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) mib_builder = builder.MibBuilder() mib_builder.loadModules('SNMPv2-MIB') mib_view = view.MibViewController(mib_builder) class IPMIHelper(object): user = CONF.worker.ipmi_login
# License for the specific language governing permissions and limitations # under the License. import os from eventlet.green import subprocess from dao.common import log from dao.common import config from dao.control import exceptions LOG = log.getLogger(__name__) opts = [config.StrOpt('worker', 'validation_scripts_path', default='/opt/dell-scripts', help='Path to scripts to validate ipmi'), config.StrOpt('worker', 'validation_scripts', default='dummy', help='Comma separated list of scripts to run') ] config.register(opts) CONF = config.get_config() def pre_validation(server): if server.asset.status != 'New': idrac_ip = server.asset.ip LOG.info('Validating server %s (iDrac: %s)', server.name, idrac_ip) script_names = CONF.worker.validation_scripts.split(',')
# 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. import eventlet from dao.common import config from dao.common import log opts = [ config.StrOpt( 'worker', 'switch_lib', default='dao.control.worker.switch.switchconf_helper.SwitchConf', help='Default switch library') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) class Base(object): name2cls = dict() cls_obj = None def __init__(self, db): self.db = db
# # 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. import abc import eventlet from dao.common import config from dao.common import log opts = [config.StrOpt('dhcp', 'driver', default='dao.control.worker.dhcp.neutron.NeutronHelper', help='Path to DHCP helper') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) class DHCPBase(object): instance = None @classmethod def get_helper(cls, worker=None): """
import eventlet import os import time import sqlalchemy.orm from sqlalchemy import exc as sqla_exc from sqlalchemy.pool import NullPool, StaticPool from dao.common import config as cfg from dao.common import exceptions as exception from dao.common import log sql_opts = [ cfg.StrOpt( 'db', 'sql_connection', default='sqlite:///' + os.path.abspath( os.path.join(os.path.dirname(__file__), '../', '$sqlite_db')), help='The SQLAlchemy connection string used to connect to the ' 'database'), cfg.StrOpt('db', 'sqlite_db', default='dao.sqlite', help='the filename to use with sqlite'), cfg.IntOpt('db', 'sql_idle_timeout', default=3600, help='timeout before idle sql connections are reaped'), cfg.BoolOpt('db', 'sqlite_synchronous', default=True, help='If passed, use synchronous mode for sqlite'),
# # 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. import eventlet from dao.common import config from dao.common import log from dao.control import server_helper opts = [ config.StrOpt('worker', 'hook', default='dao.control.worker.hooks.base.HookBase', help='Hook class to be used on server state change.') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) class HookBase(object): name2cls = dict() cls_obj = None def __init__(self, server, db): self.server = server self.db = db
# 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. import eventlet from dao.common import config from dao.common import log opts = [ config.StrOpt('worker', 'orchestration_driver', default='dao.control.worker.orchestration.' 'driver.DummyDriver', help='Back-end module for orchestration.') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) def get_driver(): module, obj = CONF.worker.orchestration_driver.rsplit('.', 1) LOG.info('Load %s from %s', obj, module) module = eventlet.import_patched(module) return getattr(module, obj)()
import traceback from dao.common import config from dao.common import log from dao.common import utils as dao_utils from dao.control import exceptions from dao.control import server_helper from dao.control.worker.switch import base from switchconf import introspector from switchconf import utils from switchconf import validator from switchconf.db import driver from switchconf.switch import manager opts = [ config.StrOpt('switchconf', 'switch_user', help=''), config.StrOpt('switchconf', 'switch_password', help=''), config.StrOpt('switchconf', 'vrf_mapping', help=''), config.StrOpt('switchconf', 'dhcp_relays', help=''), config.StrOpt('switchconf', 'required_features', help=''), config.StrOpt('switchconf', 'default_vlans', help=''), config.StrOpt('switchconf', 'service_port_speed', help=''), config.BoolOpt('switchconf', 'enabled', default=True, help='Turn on Switch configuration validation.'), ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__)
# # 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. import eventlet from dao.common import config from dao.common import log opts = [ config.StrOpt('worker', 'provision_driver', default='dao.control.worker.provisioning.pxe.PxeDriver', help='Backend module for provisioning') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) def get_driver(worker_url=None): """ :rtype: dao.control.worker.provisioning.foreman.ForemanDriver """ module, obj = CONF.worker.provision_driver.rsplit('.', 1) LOG.info('Load %s from %s', obj, module)
# under the License. import socket from dao.common import config from dao.common import log from dao.control import exceptions from dao.control import server_helper from dao.control.worker.dhcp import agent from dao.control.worker.openstack import neutron_helper opts = [ config.BoolOpt('dhcp', 'all_neutron', default=True, help='Use both neutron and DAO DHCPs if False'), config.StrOpt('dhcp', 'tftp', default='', help='TFTP address') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) class NeutronHelper(agent.DHCPHelper): """ Class implements DHCP interface to neutron. Base DHCPHelper is still used to support IPMI and gen2 hardware """ pxe_net = 'mgmt' isc_nets = ['ipmi'] device_owner = 'DAO'
# License for the specific language governing permissions and limitations # under the License. import eventlet import json import requests from dao.common import config from dao.common import log from dao.common import utils from dao.control import exceptions from dao.control import ipmi_helper from dao.control import server_helper from dao.control.worker import dns_helper opts = [ config.StrOpt('foreman', 'proxy_tftp', help='Foreman TFTP proxy address.'), config.StrOpt('foreman', 'dhcp_proxy_url', default='tcp://0.0.0.0:5557'), config.StrOpt('foreman', 's1_environment', default='verification', help='Foreman environment name used for host validation.'), config.StrOpt('foreman', 's2_environment', default='production', help='Foreman environment name used for host provisioning.'), config.StrOpt('foreman', 's1_os_name', default='verifying', help='Foreman hostgroup name for host validation.'), ]
# 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. from dao.common import config from dao.dhcp.db.session_api import get_session opts = [ config.StrOpt('common', 'location', help='Abbreviation for environment location. ' 'Common values are ASH, etc.'), ] config.register(opts) CONF = config.get_config() class API(object): @staticmethod def networks_list(): session = get_session() try: sstr = ('SELECT * FROM subnet WHERE location="{0}" AND deleted=0'. format(CONF.common.location)) query = session.query('id', 'vlan_tag', 'ip', 'mask', 'gateway',
# 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. import requests from dao.common import config from dao.common import log from dao.common import utils from dao.control import exceptions from dao.control.worker.orchestration import driver opts = [ config.StrOpt('salt', 'master_port', default='8080', help='Port of Salt master RPC API.'), config.StrOpt('salt', 'username', default='salt', help='Username to access SALT API'), config.StrOpt('salt', 'password', help='Password to access SALT API'), config.StrOpt('salt', 'master_minion_id', help='ID of the Salt minion running at Salt master host.') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__)
# # 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. from dao.common import config conf_opts = [ config.BoolOpt('common', 'debug', default=False, help='Include debugging information in logs.'), config.StrOpt('common', 'log_config', default='/etc/dao/logger.cfg', help='Path to config file for logging subsystem.'), config.StrOpt('common', 'location', help='Abbreviation for environment geographical location. ' 'Like PHX, etc.'), config.StrOpt('common', 'log_config', default='/etc/dao/logger.cfg', help='Path to config file for logging subsystem.'), config.StrOpt('salt', 'master_host', help='Salt master host IP or hostname.'), config.StrOpt('master', 'url', default='http://localhost:5000/v1.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. import abc import eventlet from dao.common import config from dao.common import exceptions from dao.common import log opts = [ config.StrOpt( 'rpc', 'ip', help='IP Address of the current host on management network.'), config.StrOpt('rpc', 'url_pattern', default='tcp://{ip}:{port}', help='URL pattern to be used by RPC'), config.IntOpt('rpc', 'rcv_timeout', default=20, help='Receive message timeout'), config.IntOpt('rpc', 'send_timeout', default=20, help='Send message timeout'), config.StrOpt('rpc', 'driver',
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import netaddr import time import os from dao.common import config from dao.common import log from dao.common import utils from dao.dhcp.db import api from dao.dhcp import base opts = [ config.StrOpt('dhcp', 'leases_dir', '/etc/dhcp/conf.d', help='Path to the directory with static leases'), config.IntOpt('dhcp', 'restart_delay', default=4, help='Delay before restarting dhcp') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) Subnet = base.Subnet class DHCPController(object):
# under the License. import amqpy import eventlet import yaml import uuid import time from dao.common import config from dao.common import exceptions from dao.common import log from dao.common.rpc_driver import base opts = [ config.StrOpt('rabbit', 'host', default='127.0.0.1', help='IP Address of the rabbit'), config.StrOpt('rabbit', 'user', default='guest', help='Rabbit user to use'), config.StrOpt('rabbit', 'password', default='guest', help='Rabbit password to use'), config.IntOpt('rabbit', 'port', default=5672, help='Rabbit port to use'), config.IntOpt('rabbit', 'keep_alive', default=60, help='Keep alive heardbeat'), config.IntOpt('rabbit', 'reconnect_on', default=2,