def test_04_startup(self):
        '''
        This test starts redis,vizd,opserver and qed
        It uses the test class' cassandra instance
        Then it sends flow stats to the collector
        and checks if flow stats can be accessed from
        QE.
        '''
        logging.info("*** test_04_startup ***")
        if AnalyticsTest._check_skip_test() == True:
            return True

        # set the start time in analytics db 1 hour earlier than
        # the current time. For flow series test, we need to create
        # flow samples older than the current time.
        start_time = UTCTimestampUsec() - 3600 * 1000 * 1000
        self._update_analytics_start_time(start_time)
        vizd_obj = self.useFixture(AnalyticsFixture(logging, \
            vizdtestdir + '/../../../../build/debug', self.__class__.cassandra_port))
        assert vizd_obj.verify_on_setup()
        assert vizd_obj.verify_collector_obj_count()
        generator_obj = self.useFixture(
            GeneratorFixture("VRouterAgent",
                             ("127.0.0.1", vizd_obj.get_collector_port()),
                             logging, vizd_obj.get_opserver_port(),
                             start_time))
        assert generator_obj.verify_on_setup()
        generator_obj.generate_flow_samples()
        assert vizd_obj.verify_flow_samples(generator_obj)
        assert vizd_obj.verify_flow_table(generator_obj)
        assert vizd_obj.verify_flow_series_aggregation_binning(generator_obj)
        return True
 def setUp(self):
     super(GeneratorFixture, self).setUp()
     self._sandesh_instance = Sandesh()
     self._http_port = AnalyticsFixture.get_free_port()
     self._sandesh_instance.init_generator(
         self._name, socket.gethostname(), self._collectors,
         '', self._http_port, sandesh_req_uve_pkg_list=['sandesh'])
     self._sandesh_instance.set_logging_params(enable_local_log=True,
                                               level=SandeshLevel.UT_DEBUG)
 def setUp(self):
     super(GeneratorFixture, self).setUp()
     self._sandesh_instance = Sandesh()
     self._http_port = AnalyticsFixture.get_free_port()
     self._sandesh_instance.init_generator(
         self._name, self._hostname, self._node_type, "0", self._collectors,
         '', self._http_port, sandesh_req_uve_pkg_list=['sandesh'])
     self._sandesh_instance.set_logging_params(enable_local_log=True,
                                               level=SandeshLevel.UT_DEBUG)
 def setUp(self):
     super(StatsFixture, self).setUp()
     #import pdb; pdb.set_trace()
     self._sandesh_instance = Sandesh()
     self._http_port = AnalyticsFixture.get_free_port()
     self._sandesh_instance.init_generator(
         self._name, self._hostname, self._node_type, "0", self._collectors,
         '', self._http_port, sandesh_req_uve_pkg_list=['sandesh'])
     self._sandesh_instance.set_logging_params(enable_local_log=True,
                                               level=SandeshLevel.UT_DEBUG)
 def setUp(self):
     super(GeneratorFixture, self).setUp()
     self._sandesh_instance = Sandesh()
     self._http_port = AnalyticsFixture.get_free_port()
     sandesh_pkg = ['opserver.sandesh.alarmgen_ctrl', 'sandesh']
     self._sandesh_instance.init_generator(
         self._name, self._hostname, self._node_type, "0", self._collectors,
         '', self._http_port, sandesh_req_uve_pkg_list=sandesh_pkg)
     self._sandesh_instance.set_logging_params(enable_local_log=True,
                                               level=SandeshLevel.UT_DEBUG)
Ejemplo n.º 6
0
 def setUp(self):
     super(GeneratorFixture, self).setUp()
     self._sandesh_instance = Sandesh()
     self._http_port = AnalyticsFixture.get_free_port()
     sandesh_pkg = ['opserver.sandesh.alarmgen_ctrl.sandesh_alarm_base',
                    'sandesh']
     self._sandesh_instance.init_generator(
         self._name, self._hostname, self._node_type, self._inst, self._collectors,
         '', self._http_port, sandesh_req_uve_pkg_list=sandesh_pkg)
     self._sandesh_instance.set_logging_params(enable_local_log=True,
                                               level=SandeshLevel.UT_DEBUG)
    def test_00_startup_nocass(self):
        '''
        This test starts redis,vizd,opserver and qed
        Then it checks that the collector UVE (via redis)
        can be accessed from opserver.
        '''
        logging.info("*** test_00_startup_nocass ***")
        if AnalyticsTest._check_skip_test() == True:
            return True

        vizd_obj = self.useFixture(AnalyticsFixture(logging, \
            vizdtestdir + '/../../../../build/debug', 0))
        assert vizd_obj.verify_on_setup()
        assert vizd_obj.verify_collector_obj_count()
        return True
    def test_01_startup(self):
        '''
        This test starts redis,vizd,opserver and qed
        It uses the test class' cassandra instance
        Then it checks that the collector UVE (via redis)
        and syslog (via cassandra) can be accessed from
        opserver.
        '''
        logging.info("*** test_01_startup ***")
        if AnalyticsTest._check_skip_test() == True:
            return True

        vizd_obj = self.useFixture(AnalyticsFixture(logging, \
            vizdtestdir + '/../../../../build/debug', self.__class__.cassandra_port))
        assert vizd_obj.verify_on_setup()
        assert vizd_obj.verify_collector_obj_count()
        return True
    def test_03_vm_uve(self):
        '''
        This test starts redis, vizd, opserver, qed, and a python generator 
        that simulates vrouter and sends UveVirtualMachineAgentTrace messages.
        It uses the test class' cassandra instance. Then it checks that the 
        VM UVE (via redis) can be accessed from opserver.
        '''
        logging.info("*** test_03_vm_uve ***")
        if AnalyticsTest._check_skip_test() == True:
            return True

        vizd_obj = self.useFixture(AnalyticsFixture(logging, \
            vizdtestdir + '/../../../../build/debug', 0))
        assert vizd_obj.verify_on_setup()
        generator_obj = self.useFixture(
            GeneratorFixture("VRouterAgent",
                             ("127.0.0.1", vizd_obj.get_collector_port()),
                             logging, vizd_obj.get_opserver_port()))
        assert generator_obj.verify_on_setup()
        generator_obj.send_vm_uve(vm_id='abcd', num_vm_ifs=5, msg_count=5)
        assert generator_obj.verify_vm_uve(vm_id='abcd',
                                           num_vm_ifs=5,
                                           msg_count=5)
        return True