def test_get_ea_for_reverse_zone(self):
     network = {'id': mock.Mock(),
                'name': mock.Mock(),
                'provider:segmentation_id': mock.Mock(),
                'provider:physical_network': mock.Mock(),
                'provider:network_type': mock.Mock()}
     subnet = {'id': mock.Mock(),
               'name': mock.Mock()}
     expected_ea = {'Subnet ID': subnet['id'],
                    'Subnet Name': subnet['name'],
                    'Network ID': network['id'],
                    'Network Name': network['name'],
                    'Network Encap': network['provider:network_type'],
                    'Segmentation ID': network['provider:segmentation_id'],
                    'Physical Network Name': (
                        network['provider:physical_network']),
                    'Tenant ID': self.tenant_id,
                    'Tenant Name': self.context.tenant_name,
                    'Account': self.user_id,
                    'CMP Type': 'OpenStack',
                    'Cloud API Owned': str(True)}
     ea = ea_manager.get_ea_for_reverse_zone(self.user_id, self.tenant_id,
                                             self.tenant_name, network,
                                             subnet)
     self.assertEqual(expected_ea, ea.ea_dict)
 def test_get_ea_for_reverse_zone(self):
     network = {
         'id': mock.Mock(),
         'name': mock.Mock(),
         'provider:segmentation_id': mock.Mock(),
         'provider:physical_network': mock.Mock(),
         'provider:network_type': mock.Mock()
     }
     subnet = {'id': mock.Mock(), 'name': mock.Mock()}
     expected_ea = {
         'Subnet ID': subnet['id'],
         'Subnet Name': subnet['name'],
         'Network ID': network['id'],
         'Network Name': network['name'],
         'Network Encap': network['provider:network_type'],
         'Segmentation ID': network['provider:segmentation_id'],
         'Physical Network Name': (network['provider:physical_network']),
         'Tenant ID': self.tenant_id,
         'Tenant Name': self.context.tenant_name,
         'Account': self.user_id,
         'CMP Type': 'OpenStack',
         'Cloud API Owned': str(True)
     }
     ea = ea_manager.get_ea_for_reverse_zone(self.user_id, self.tenant_id,
                                             self.tenant_name, network,
                                             subnet)
     self.assertEqual(expected_ea, ea.ea_dict)
 def test_get_ea_for_zones_without_net(self):
     # Test that None values is acceptable for network/subnet parameters
     expected_ea = {'Tenant ID': self.tenant_id,
                    'Tenant Name': self.context.tenant_name,
                    'Account': self.user_id,
                    'CMP Type': 'OpenStack',
                    'Cloud API Owned': str(True)}
     ea = ea_manager.get_ea_for_reverse_zone(self.user_id, self.tenant_id,
                                             self.tenant_name, None, None)
     self.assertEqual(expected_ea, ea.ea_dict)
     ea = ea_manager.get_ea_for_forward_zone(self.user_id, self.tenant_id,
                                             self.tenant_name, None, None,
                                             '{subnet_id}.infoblox.com')
     self.assertEqual(expected_ea, ea.ea_dict)
 def test_get_ea_for_zones_without_net(self):
     # Test that None values is acceptable for network/subnet parameters
     expected_ea = {
         'Tenant ID': self.tenant_id,
         'Tenant Name': self.context.tenant_name,
         'Account': self.user_id,
         'CMP Type': 'OpenStack',
         'Cloud API Owned': str(True)
     }
     ea = ea_manager.get_ea_for_reverse_zone(self.user_id, self.tenant_id,
                                             self.tenant_name, None, None)
     self.assertEqual(expected_ea, ea.ea_dict)
     ea = ea_manager.get_ea_for_forward_zone(self.user_id, self.tenant_id,
                                             self.tenant_name, None, None,
                                             '{subnet_id}.infoblox.com')
     self.assertEqual(expected_ea, ea.ea_dict)
Beispiel #5
0
 def _update_strategy_and_eas(self):
     self.need_forward = (constants.ZONE_CREATION_STRATEGY_FORWARD in
                          self.grid_config.zone_creation_strategy)
     if self.need_forward:
         self.forward_zone_eas = eam.get_ea_for_forward_zone(
             self.ib_cxt.user_id, self.ib_cxt.tenant_id,
             self.ib_cxt.tenant_name, self.ib_cxt.network,
             self.ib_cxt.subnet,
             self.pattern_builder.get_zone_name(
                 is_external=self.ib_cxt.network_is_external))
     self.need_reverse = (constants.ZONE_CREATION_STRATEGY_REVERSE in
                          self.grid_config.zone_creation_strategy)
     if self.need_reverse:
         self.reverse_zone_eas = eam.get_ea_for_reverse_zone(
             self.ib_cxt.user_id, self.ib_cxt.tenant_id,
             self.ib_cxt.tenant_name, self.ib_cxt.network,
             self.ib_cxt.subnet)
Beispiel #6
0
 def _update_strategy_and_eas(self):
     self.need_forward = (constants.ZONE_CREATION_STRATEGY_FORWARD
                          in self.grid_config.zone_creation_strategy)
     if self.need_forward:
         self.forward_zone_eas = eam.get_ea_for_forward_zone(
             self.ib_cxt.user_id, self.ib_cxt.tenant_id,
             self.ib_cxt.tenant_name, self.ib_cxt.network,
             self.ib_cxt.subnet,
             self.pattern_builder.get_zone_name(
                 is_external=self.ib_cxt.network_is_external))
     self.need_reverse = (constants.ZONE_CREATION_STRATEGY_REVERSE
                          in self.grid_config.zone_creation_strategy)
     if self.need_reverse:
         self.reverse_zone_eas = eam.get_ea_for_reverse_zone(
             self.ib_cxt.user_id, self.ib_cxt.tenant_id,
             self.ib_cxt.tenant_name, self.ib_cxt.network,
             self.ib_cxt.subnet)