¡@

Home 

OpenStack Study: usage_audit.py

OpenStack Index

**** CubicPower OpenStack Study ****

def main():

    cfg.CONF(project='neutron')

    config.setup_logging(cfg.CONF)

    cxt = context.get_admin_context()

    plugin = manager.NeutronManager.get_plugin()

    for network in plugin.get_networks(cxt):

        notifier_api.notify(cxt,

                            notifier_api.publisher_id('network'),

                            'network.exists',

                            notifier_api.INFO,

                            {'network': network})

    for subnet in plugin.get_subnets(cxt):

        notifier_api.notify(cxt,

                            notifier_api.publisher_id('network'),

                            'subnet.exists',

                            notifier_api.INFO,

                            {'subnet': subnet})

    for port in plugin.get_ports(cxt):

        notifier_api.notify(cxt,

                            notifier_api.publisher_id('network'),

                            'port.exists',

                            notifier_api.INFO,

                            {'port': port})

    for router in plugin.get_routers(cxt):

        notifier_api.notify(cxt,

                            notifier_api.publisher_id('network'),

                            'router.exists',

                            notifier_api.INFO,

                            {'router': router})

    for floatingip in plugin.get_floatingips(cxt):

        notifier_api.notify(cxt,

                            notifier_api.publisher_id('network'),

                            'floatingip.exists',

                            notifier_api.INFO,

                            {'floatingip': floatingip})