def prepair_ha_pair_member(self, update_ports=True):
     tmpl = copy.deepcopy(grid_member_template)
     props = tmpl['resources']['my_member']['properties']
     props['update_allowed_address_pairs'] = update_ports
     props['admin_password'] = '******'
     props['ha_pair'] = True
     props['virtual_router_id'] = 123
     props['licenses'] = ['dns', 'dhcp', 'grid']
     ports = {
         'VIP': {
             'ipv4': {
                 'address': '1.1.1.6',
                 'subnet_mask': '255.255.255.0',
                 'gateway': '1.1.1.1'
             }
         },
         'LAN1': {
             'ipv4': {
                 'address': '1.1.1.4',
                 'subnet_mask': '255.255.255.0',
                 'gateway': '1.1.1.1'
             }
         },
         'HA': {
             'ipv4': {
                 'address': '1.1.1.2',
                 'subnet_mask': '255.255.255.0',
                 'gateway': '1.1.1.1'
             }
         },
         'node2_LAN1': {
             'ipv4': {
                 'address': '1.1.1.5',
                 'subnet_mask': '255.255.255.0',
                 'gateway': '1.1.1.1'
             }
         },
         'node2_HA': {
             'ipv4': {
                 'address': '1.1.1.3',
                 'subnet_mask': '255.255.255.0',
                 'gateway': '1.1.1.1'
             }
         },
     }
     for port in ports.keys():
         props[port] = port
     self.set_stack(tmpl)
     self.set_member_obj(self.ipv4_ha_member)
     self.my_member.client = mock.MagicMock()
     make_net_settings = mock.MagicMock()
     make_net_settings.side_effect = create_side_effect(ports)
     self.my_member._make_port_network_settings = make_net_settings
     self.my_member.resource_id = None
     clients = {'neutron': mock.MagicMock()}
     self.my_member.client.side_effect = create_side_effect(clients)
     return (props, clients, ports)
 def prepair_ha_pair_member(self, update_ports=True):
     tmpl = copy.deepcopy(grid_member_template)
     props = tmpl['resources']['my_member']['properties']
     props['update_allowed_address_pairs'] = update_ports
     props['admin_password'] = '******'
     props['ha_pair'] = True
     props['virtual_router_id'] = 123
     props['licenses'] = ['dns', 'dhcp', 'grid']
     ports = {
         'VIP': {
             'ipv4': {'address': '1.1.1.6', 'subnet_mask': '255.255.255.0',
                      'gateway': '1.1.1.1'
                      }
             },
         'LAN1': {
             'ipv4': {'address': '1.1.1.4', 'subnet_mask': '255.255.255.0',
                      'gateway': '1.1.1.1'
                      }
             },
         'HA': {
             'ipv4': {'address': '1.1.1.2', 'subnet_mask': '255.255.255.0',
                      'gateway': '1.1.1.1'
                      }
             },
         'node2_LAN1': {
             'ipv4': {'address': '1.1.1.5', 'subnet_mask': '255.255.255.0',
                      'gateway': '1.1.1.1'
                      }
             },
         'node2_HA': {
             'ipv4': {'address': '1.1.1.3', 'subnet_mask': '255.255.255.0',
                      'gateway': '1.1.1.1'
                      }
             },
         }
     for port in ports.keys():
         props[port] = port
     self.set_stack(tmpl)
     self.set_member_obj(self.ipv4_ha_member)
     self.my_member.client = mock.MagicMock()
     make_net_settings = mock.MagicMock()
     make_net_settings.side_effect = create_side_effect(ports)
     self.my_member._make_port_network_settings = make_net_settings
     self.my_member.resource_id = None
     clients = {'neutron': mock.MagicMock()}
     self.my_member.client.side_effect = create_side_effect(clients)
     return (props, clients, ports)
示例#3
0
 def prepair_ha_pair(self, update_ports=True):
     props = ha_pair_template['resources']['my_ha_pair']['properties']
     props['update_allowed_address_pairs'] = update_ports
     self.set_stack(ha_pair_template)
     self.my_ha_pair.client = mock.MagicMock()
     get_first_ip = mock.MagicMock()
     ports = {
         'vip': {
             'ip_address': '1.1.1.6',
             'subnet_id': 'vip_subnet'
         },
         'node1_lan1': {
             'ip_address': '1.1.1.4'
         },
         'node1_ha': {
             'ip_address': '1.1.1.2'
         },
         'node2_lan1': {
             'ip_address': '1.1.1.5'
         },
         'node2_ha': {
             'ip_address': '1.1.1.3'
         },
     }
     get_first_ip.side_effect = create_side_effect(ports)
     self.my_ha_pair._get_first_ip = get_first_ip
     self.my_ha_pair.node = mock.MagicMock()
     self.my_ha_pair.wait_for_https = mock.MagicMock()
     show_subnet = mock.MagicMock()
     show_subnet.return_value = {
         'subnet': {
             'cidr': '1.1.1.0/24',
             'gateway_ip': '1.1.1.1'
         }
     }
     neutron = mock.MagicMock()
     neutron.show_subnet = show_subnet
     self.my_ha_pair.client = mock.MagicMock(return_value=neutron)
     return (props, neutron, ports)
 def prepair_ha_pair(self, update_ports=True):
     props = ha_pair_template['resources']['my_ha_pair']['properties']
     props['update_allowed_address_pairs'] = update_ports
     self.set_stack(ha_pair_template)
     self.my_ha_pair.client = mock.MagicMock()
     get_first_ip = mock.MagicMock()
     ports = {
         'vip': {'ip_address': '1.1.1.6', 'subnet_id': 'vip_subnet'},
         'node1_lan1': {'ip_address': '1.1.1.4'},
         'node1_ha': {'ip_address': '1.1.1.2'},
         'node2_lan1': {'ip_address': '1.1.1.5'},
         'node2_ha': {'ip_address': '1.1.1.3'},
         }
     get_first_ip.side_effect = create_side_effect(ports)
     self.my_ha_pair._get_first_ip = get_first_ip
     self.my_ha_pair.node = mock.MagicMock()
     self.my_ha_pair.wait_for_https = mock.MagicMock()
     show_subnet = mock.MagicMock()
     show_subnet.return_value = {'subnet': {'cidr': '1.1.1.0/24',
                                            'gateway_ip': '1.1.1.1'}}
     neutron = mock.MagicMock()
     neutron.show_subnet = show_subnet
     self.my_ha_pair.client = mock.MagicMock(return_value=neutron)
     return (props, neutron, ports)