~landscape/charms/trusty/neutron-api-leadership-election/trunk

« back to all changes in this revision

Viewing changes to unit_tests/test_neutron_api_hooks.py

  • Committer: james.page at ubuntu
  • Date: 2015-01-13 15:18:43 UTC
  • mfrom: (62.2.5 neutron-api)
  • Revision ID: james.page@ubuntu.com-20150113151843-kc03wjl3zhd3r1w2
[james-page,r=gnuoy] Add fallback configuration options for vip cidr and iface for non-standard deployments

Show diffs side-by-side

added added

removed removed

Lines of Context:
324
324
        )
325
325
 
326
326
    @patch.object(hooks, 'get_hacluster_config')
 
327
    def test_ha_joined_no_bound_ip(self, _get_ha_config):
 
328
        _ha_config = {
 
329
            'vip': '10.0.0.1',
 
330
            'ha-bindiface': 'eth1',
 
331
            'ha-mcastport': '5405',
 
332
        }
 
333
        vip_params = 'params ip="10.0.0.1" cidr_netmask="21" nic="eth120"'
 
334
        _get_ha_config.return_value = _ha_config
 
335
        self.test_config.set('vip_iface', 'eth120')
 
336
        self.test_config.set('vip_cidr', '21')
 
337
        self.get_iface_for_address.return_value = None
 
338
        self.get_netmask_for_address.return_value = None
 
339
        _relation_data = {
 
340
            'init_services': {'res_neutron_haproxy': 'haproxy'},
 
341
            'corosync_bindiface': _ha_config['ha-bindiface'],
 
342
            'corosync_mcastport': _ha_config['ha-mcastport'],
 
343
            'resources': {
 
344
                'res_neutron_eth120_vip': 'ocf:heartbeat:IPaddr2',
 
345
                'res_neutron_haproxy': 'lsb:haproxy'
 
346
            },
 
347
            'resource_params': {
 
348
                'res_neutron_eth120_vip': vip_params,
 
349
                'res_neutron_haproxy': 'op monitor interval="5s"'
 
350
            },
 
351
            'clones': {'cl_nova_haproxy': 'res_neutron_haproxy'}
 
352
        }
 
353
        self._call_hook('ha-relation-joined')
 
354
        self.relation_set.assert_called_with(
 
355
            **_relation_data
 
356
        )
 
357
 
 
358
    @patch.object(hooks, 'get_hacluster_config')
327
359
    def test_ha_joined_with_ipv6(self, _get_ha_config):
328
360
        self.test_config.set('prefer-ipv6', 'True')
329
361
        _ha_config = {