Example #1
0
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()
Example #2
0
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')
        formats = [
            '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(domain)s',
            '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.X.%(domain)s'
        ]
        self.config(format=formats, group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()
Example #3
0
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        zone = self.create_zone()
        self.zone_id = zone['id']
        self.config(zone_id=zone['id'], group='handler:neutron_floatingip')
        formats = [
            '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s',
            '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.X.%(zone)s'
        ]
        self.config(format=formats, group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()
class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        self.central_service = self.start_service('central')

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()

    def test_floatingip_associate(self):
        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture(
            'neutron', event_type + '_associate')

        self.assertIn(event_type, self.plugin.get_event_types())

        # Ensure we start with 0 records
        records = self.central_service.find_records(self.admin_context,
                                                    self.domain_id)

        self.assertEqual(0, len(records))

        self.plugin.process_notification(event_type, fixture['payload'])

        # Ensure we now have exactly 1 record
        records = self.central_service.find_records(self.admin_context,
                                                    self.domain_id)

        self.assertEqual(len(records), 1)

    def test_floatingip_disassociate(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture(
            'neutron', event_type + '_disassociate')

        self.assertIn(event_type, self.plugin.get_event_types())

        # Ensure we start with at least 1 record
        records = self.central_service.find_records(self.admin_context,
                                                    self.domain_id)

        self.assertTrue(len(records) >= 1)

        self.plugin.process_notification(event_type, fixture['payload'])

        records = self.central_service.find_records(self.admin_context,
                                                    self.domain_id)

        self.assertEqual(0, len(records))
Example #5
0
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()
Example #6
0
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        zone = self.create_zone()
        self.zone_id = zone['id']
        self.config(zone_id=zone['id'], group='handler:neutron_floatingip')
        formats = ['%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s',
                   '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.X.%(zone)s']
        self.config(format=formats, group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()
Example #7
0
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')
        formats = ['%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(domain)s',
                   '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.X.%(domain)s']
        self.config(format=formats, group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()
Example #8
0
class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        self.central_service = self.start_service('central')

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()

    def test_floatingip_associate(self):
        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture('neutron',
                                                event_type + '_associate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with 0 records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(0, len(records))

        self.plugin.process_notification(event_type, fixture['payload'])

        # Ensure we now have exactly 1 record
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(1, len(records))

    def test_floatingip_disassociate(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture('neutron',
                                                event_type + '_disassociate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with at least 1 record
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(1, len(records))

        self.plugin.process_notification(event_type, fixture['payload'])

        # Ensure we now have exactly 0 records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(0, len(records))

    def test_floatingip_delete(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.delete.start'
        fixture = self.get_notification_fixture('neutron', event_type)

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with at least 1 record
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)
        self.assertEqual(1, len(records))

        self.plugin.process_notification(event_type, fixture['payload'])

        # Ensure we now have exactly 0 records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(0, len(records))
Example #9
0
class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')
        formats = [
            '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(domain)s',
            '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.X.%(domain)s'
        ]
        self.config(format=formats, group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()

    def test_floatingip_associate(self):
        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture('neutron',
                                                event_type + '_associate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with only SOA and NS records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))

        self.plugin.process_notification(self.admin_context, event_type,
                                         fixture['payload'])

        # Ensure we now have exactly 1 record, plus SOA & NS
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(4, len(records))

    def test_floatingip_disassociate(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(self.admin_context, start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture('neutron',
                                                event_type + '_disassociate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with at least 1 record, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(4, len(records))

        self.plugin.process_notification(self.admin_context, event_type,
                                         fixture['payload'])

        # Simulate the record having been deleted on the backend
        domain_serial = self.central_service.get_domain(
            self.admin_context, self.domain_id).serial
        self.central_service.update_status(self.admin_context, self.domain_id,
                                           "SUCCESS", domain_serial)

        # Ensure we now have exactly 0 records, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))

    def test_floatingip_delete(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(self.admin_context, start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.delete.start'
        fixture = self.get_notification_fixture('neutron', event_type)

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with at least 1 record, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)
        self.assertEqual(4, len(records))

        self.plugin.process_notification(self.admin_context, event_type,
                                         fixture['payload'])

        # Simulate the record having been deleted on the backend
        domain_serial = self.central_service.get_domain(
            self.admin_context, self.domain_id).serial
        self.central_service.update_status(self.admin_context, self.domain_id,
                                           "SUCCESS", domain_serial)

        # Ensure we now have exactly 0 records, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))
Example #10
0
class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        zone = self.create_zone()
        self.zone_id = zone['id']
        self.config(zone_id=zone['id'], group='handler:neutron_floatingip')
        formats = ['%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s',
                   '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.X.%(zone)s']
        self.config(format=formats, group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()

    def test_floatingip_associate(self):
        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture(
            'neutron', event_type + '_associate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'zone_id': self.zone_id}

        # Ensure we start with only SOA and NS records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))

        self.plugin.process_notification(
            self.admin_context, event_type, fixture['payload'])

        # Ensure we now have exactly 1 record, plus SOA & NS
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(4, len(records))

    def test_floatingip_disassociate(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(self.admin_context,
                                         start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture(
            'neutron', event_type + '_disassociate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'zone_id': self.zone_id}

        # Ensure we start with at least 1 record, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(4, len(records))

        self.plugin.process_notification(
            self.admin_context, event_type, fixture['payload'])

        # Simulate the record having been deleted on the backend
        zone_serial = self.central_service.get_zone(
            self.admin_context, self.zone_id).serial
        self.central_service.update_status(
            self.admin_context, self.zone_id, "SUCCESS", zone_serial)

        # Ensure we now have exactly 0 records, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))

    def test_floatingip_delete(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(self.admin_context,
                                         start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.delete.start'
        fixture = self.get_notification_fixture(
            'neutron', event_type)

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'zone_id': self.zone_id}

        # Ensure we start with at least 1 record, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)
        self.assertEqual(4, len(records))

        self.plugin.process_notification(
            self.admin_context, event_type, fixture['payload'])

        # Simulate the record having been deleted on the backend
        zone_serial = self.central_service.get_zone(
            self.admin_context, self.zone_id).serial
        self.central_service.update_status(
            self.admin_context, self.zone_id, "SUCCESS", zone_serial)

        # Ensure we now have exactly 0 records, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))
Example #11
0
class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
    def setUp(self):
        super(NeutronFloatingHandlerTest, self).setUp()

        domain = self.create_domain()
        self.domain_id = domain['id']
        self.config(domain_id=domain['id'], group='handler:neutron_floatingip')

        self.plugin = NeutronFloatingHandler()

    def test_floatingip_associate(self):
        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture(
            'neutron', event_type + '_associate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with only SOA and NS records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))

        self.plugin.process_notification(
            self.admin_context, event_type, fixture['payload'])

        # Ensure we now have exactly 1 record, plus SOA & NS
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(3, len(records))

    def test_floatingip_disassociate(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(self.admin_context,
                                         start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.update.end'
        fixture = self.get_notification_fixture(
            'neutron', event_type + '_disassociate')

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with at least 1 record, plus NS and SOA
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(3, len(records))

        self.plugin.process_notification(
            self.admin_context, event_type, fixture['payload'])

        # Ensure we now have exactly 0 records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))

    def test_floatingip_delete(self):
        start_event_type = 'floatingip.update.end'
        start_fixture = self.get_notification_fixture(
            'neutron', start_event_type + '_associate')
        self.plugin.process_notification(self.admin_context,
                                         start_event_type,
                                         start_fixture['payload'])

        event_type = 'floatingip.delete.start'
        fixture = self.get_notification_fixture(
            'neutron', event_type)

        self.assertIn(event_type, self.plugin.get_event_types())

        criterion = {'domain_id': self.domain_id}

        # Ensure we start with at least 1 record, plus SOA & NS
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)
        self.assertEqual(3, len(records))

        self.plugin.process_notification(
            self.admin_context, event_type, fixture['payload'])

        # Ensure we now have exactly 0 records
        records = self.central_service.find_records(self.admin_context,
                                                    criterion)

        self.assertEqual(2, len(records))