Example #1
0
    def counters(self, **kwargs):
        '''
            Statistics >> Counters
            format:
            {
                "vips": [
                    {
                        "vip": "192.168.200.200",
                        "port": 443,
                        "connections": 0,
                        "inbound_packets": 0,
                        "inbound_bytes": 0,
                        "outbound_packets": 0,
                        "outbound_bytes": 0,
                        "rips": [
                            {
                                "rip": "192.168.200.200",
                                "port": 443,
                                "connections": 0,
                                "inbound_packets": 0,
                                "inbound_bytes": 0,
                                "outbound_packets": 0,
                                "outbound_bytes": 0
                            },
                            ...
                        ]
                    },
                    ...
                ]
            }
        '''
        import libs.login
        if False == libs.login.cklogin():
            raise _.HTTPRedirect('/')

        import ml_w_counters as wcn
        import json
        import libs.tools

        if "counters" in kwargs:
            pass
        else:
            data = wcn.get()
            return json.dumps(data)
	def test_counters_g01(self):
		""" counters_g01 """
		e = ml_w_counters.get(None, threading.RLock())
		self.assertTrue(e[0], e[1])