#!/usr/bin/env python
##############################################################################
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
##############################################################################
import logging as std_logging
import time

from oslo.config import cfg
from libra.openstack.common import log as logging
from libra.common.api.mnb import update_mnb
from libra import __version__


CONF = cfg.CONF
LOG = logging.getLogger(__name__)

CONF.register_opts([
    cfg.IntOpt('testcount',
               metavar='COUNT',
               default=1,
               help='Number of messages to send')
])


def main():
    CONF(project='mnbtest', version=__version__)
    logging.setup('mnbtest')
    LOG.debug('Configuration:')

    print "Starting Test"
    print "LOG FILE = {0}".format(CONF.log_file)
    LOG.info('STARTING MNBTEST')
    CONF.log_opt_values(LOG, std_logging.DEBUG)

    LOG.info("Calling update_mnb with {0} messages".format(CONF.testcount))
    update_mnb('lbaas.instance.test', CONF.testcount, 456)

    time.sleep(30)

if __name__ == "__main__":
    main()
