def test_get_ip_address_public_ipv6(self, ifaddresses_mock, interfaces_mock): CONF.set_override('ipv6', True, group='network') interfaces_mock.return_value = ['eth2'] ifaddresses_mock.return_value = { netifaces.AF_INET6: [{'addr': 'fe80::5054:ff:fe80:e42b%eth2'}] } ip_address = network_utils.get_ip_address(public=True) self.assertEqual('fe80::5054:ff:fe80:e42b%eth2', ip_address)
def test_get_ip_address_private_ipv6(self, ifaddresses_mock, interfaces_mock): CONF.set_override('ipv6', True, group='network') interfaces_mock.return_value = ['eth1'] ifaddresses_mock.return_value = { netifaces.AF_INET6: [{'addr': 'fe80::5054:ff:fefc:273e%eth1'}] } ip_address = network_utils.get_ip_address() self.assertEqual('fe80::5054:ff:fefc:273e%eth1', ip_address)
def test_get_ip_address_private_ipv4(self, ifaddresses_mock, interfaces_mock): CONF.set_override('ipv6', False, group='network') interfaces_mock.return_value = ['eth1'] ifaddresses_mock.return_value = { netifaces.AF_INET: [{'addr': '10.0.0.1'}] } ip_address = network_utils.get_ip_address() self.assertEqual('10.0.0.1', ip_address)
# 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. from oslo_config import cfg from kolla_mesos.common import network_utils MESOS_URL = 'http://{}:5050'.format(network_utils.get_ip_address()) CONF = cfg.CONF mesos_opts = [ cfg.StrOpt('host', default=MESOS_URL, help='Mesos connection URL (http://host:port)'), cfg.IntOpt('timeout', default=5, help='Timeout for the request to the Marathon API') ] mesos_opt_group = cfg.OptGroup(name='mesos', title='Options for Mesos') CONF.register_group(mesos_opt_group) CONF.register_cli_opts(mesos_opts, mesos_opt_group) CONF.register_opts(mesos_opts, mesos_opt_group)
# 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. from oslo_config import cfg from kolla_mesos.common import network_utils ZOOKEEPER_URL = '{}:2181'.format(network_utils.get_ip_address()) CONF = cfg.CONF zookeeper_opts = [ cfg.StrOpt('host', default=ZOOKEEPER_URL, help='ZooKeeper connection URL (host:port)') ] zookeeper_opt_group = cfg.OptGroup(name='zookeeper', title='Options for ZooKeeper') CONF.register_group(zookeeper_opt_group) CONF.register_cli_opts(zookeeper_opts, zookeeper_opt_group) CONF.register_opts(zookeeper_opts, zookeeper_opt_group)
# # 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 oslo_config import cfg from kolla_mesos.common import network_utils from kolla_mesos.common import utils CHRONOS_URL = 'http://{}:4400'.format(network_utils.get_ip_address()) CONF = cfg.CONF chronos_opts = [ cfg.StrOpt('host', default=utils.env('KM_CHRONOS_HOST', default=CHRONOS_URL), help='Chronos connection URL (http://host:port), ' '(Env: KM_CHRONOS_HOST)'), cfg.IntOpt('timeout', default=30, help='Timeout for the request to the Chronos API') ] chronos_opt_group = cfg.OptGroup(name='chronos', title='Options for Chronos') CONF.register_group(chronos_opt_group) CONF.register_cli_opts(chronos_opts, chronos_opt_group)
# 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. from oslo_config import cfg from kolla_mesos.common import network_utils MARATHON_URL = 'http://{}:8080'.format(network_utils.get_ip_address()) CONF = cfg.CONF marathon_opts = [ cfg.StrOpt('host', default=MARATHON_URL, help='Marathon connection URL (http://host:port)'), cfg.IntOpt('timeout', default=5, help='Timeout for the request to the Marathon API') ] marathon_opt_group = cfg.OptGroup(name='marathon', title='Options for Marathon') CONF.register_group(marathon_opt_group) CONF.register_cli_opts(marathon_opts, marathon_opt_group) CONF.register_opts(marathon_opts, marathon_opt_group)