def test_08_postapinodedata(self):
     '''批批量提交机器节点多维数据[post] /api/node/data'''
     url = config.base_url + "/api/node/data"
     headers = {'Content-Type': 'application/json'}
     data = {
         "auto_create": True,
         "data": [
             {
                 "node_key": self.node_key,
                 "header": ["time", "CPU_Usage", "Mem_Usage", "Idle_Process"],
                 "values": [
                     [int(time.time()), 34, 10000000, 12],
                     [int(time.time()), 40, 11000000, 10],
                     [int(time.time()), 40, 11000000, 10],
                     [int(time.time()), 40, 11000000, 10],
                     [int(time.time()), 40, 11000000, 10],
                     [int(time.time()), 40, 11000000, 10],
                     [int(time.time()), 40, 11000000, 10],
                     [int(time.time()), 40, 11000000, 10],
                     [int(time.time()), 40, 11000000, 10]
                 ]
             },
         ]
     }
     r = requests.post(url, data=json.dumps(data), headers=headers)
     jobs = r.json()
     config.pprint(url, jobs, data)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #2
0
    def update(self):
        xy_dist = G.euclid_distance(self.pos[:2], self._current_line[1][:2])
        z_dist = np.abs(self.pos[2] - self._current_line[1][2])
        if xy_dist <= config.LINE_END_XY_THRESHOLD and z_dist <= config.LINE_END_Z_THRESHOLD:
            config.pprint('LINE CHANGED')
            # reached the target, request to follow the next line
            self._wps = self._wps[1:]
            try:
                self._current_line = [self._wps[0], self._wps[1]]
            except IndexError:
                config.pprint('Out of waypoints!')
                sys.exit()

        # create a Path message with whatever frame we received the localisation in
        path = Path()
        path.header.frame_id = self._frame_id

        # Path.poses is a PoseStamped list
        # so we have to create these objects
        ps1 = PoseStamped()
        ps1.header.frame_id = self._frame_id
        ps1.pose.position.x = self._current_line[0][0]
        ps1.pose.position.y = self._current_line[0][1]
        ps1.pose.position.z = self._current_line[0][2]
        path.poses.append(ps1)

        ps2 = PoseStamped()
        ps2.header.frame_id = self._frame_id
        ps2.pose.position.x = self._current_line[1][0]
        ps2.pose.position.y = self._current_line[1][1]
        ps2.pose.position.z = self._current_line[1][2]
        path.poses.append(ps2)

        self.publisher.publish(path)
예제 #3
0
 def test_05_deleteevent(self):
     '''在告警列表中 - 查询告警事件 - 点击删除按钮'''
     url = config.base_url + "/api/event/" + config.event_id
     headers = {'Content-Type': 'application/json'}
     r = requests.delete(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #4
0
 def test_04_getmodules(self):
     '''在告警列表中 --查询告警事件 - 点击查看按钮'''
     url = config.base_url + "/api/service/" + config.service_id + "/modules"
     headers = {'Content-Type': 'application/json'}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
    def test_08_getservice_id(self):
        '''(验证删除是否成功)获获取业务系统信息[get] /api/service/:service_id'''
        url = config.base_url + "/api/service/" + config.service_id
        headers = {'Content-Type': 'application/json'}

        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 404
예제 #6
0
    def test_06_getmodule_id(self):
        '''(验证删除模块是否成功)获取指定模块[get] /api/module/:module_id'''
        url = config.base_url + "/api/module/" + config.module_id
        headers = {'Content-Type': 'application/json'}

        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 404
예제 #7
0
 def test_05_deletemodule_id(self):
     '''删除模块[delete] /api/module/:module_id'''
     url = config.base_url + "/api/module/" + config.module_id
     headers = {'Content-Type': 'application/json'}
     data = {"name": self.name, "nodes": ["node.MOBSDB01", "node.MOBSDB02"]}
     r = requests.delete(url, data=json.dumps(data), headers=headers)
     jobs = r.json()
     config.pprint(url, jobs, data)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #8
0
    def test_13_deleteapievent_id(self) -> object:
        '''删除事件[delete] /api/event/:event_id'''
        url = config.base_url + "/api/event/" + config.event_id
        headers = {'Content-Type': 'application/json'}

        r = requests.delete(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
예제 #9
0
 def test_09_getevent(self):
     '''查询event [get] /api/event?services=5bc9bd155210e6104d6bafad&duration=1571048005,1571134405'''
     url = config.base_url + "/api/event?services=" + config.service_id + "&duration=1571048005,1571134405"
     headers = {'Content-Type': 'application/json'}
     # data = {"kpi_keys":[]}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #10
0
 def test_03_getmodule(self):
     '''查询module[get] /api/service/5da58b8f9f62af470efa0456/modules'''
     url = config.base_url + "/api/service/" + config.service_id + "/modules"
     headers = {'Content-Type': 'application/json'}
     # data = {"name":self.name}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #11
0
 def test_07_deleteservice(self) -> object:
     '''删除新建业务 [delete] /api/service/5da591489f62af470efa045e'''
     url = config.base_url + "/api/service/" + config.service_id
     headers = {'Content-Type': 'application/json'}
     # data = {"kpi_keys":[]}
     r = requests.delete(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #12
0
 def test_08_getmodulepage(self):
     '''查询module page[get] /api/module/page?page=1&size=10'''
     url = config.base_url + "/api/module/page?page=1&size=10"
     headers = {'Content-Type': 'application/json'}
     # data = {"kpi_keys":[]}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #13
0
 def test_04_getModulePage(self):
     '''查询module 【get】/api/module/page?page=1&size=100'''
     url = config.base_url + "/api/module/page?page=1&size=100"
     headers = {'Content-Type': 'application/json'}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
     assert len(jobs["data"]) != 0
예제 #14
0
 def test_02_geteventid(self):
     '''查询告警事件'''
     url = config.base_url + "/api/event/" + config.event_id
     headers = {'Content-Type': 'application/json'}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
     assert len(jobs["data"]) != 0
    def test_10_deleteapinode(self):
        '''删除机器节点[delete] /api/node/:node_key'''
        url = config.base_url + "/api/node/" + self.node_key
        headers = {'Content-Type': 'application/json'}

        r = requests.delete(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
    def test_06_deleteservice_id(self):
        '''删除业务系统[delete] /api/service/:service_id'''
        url = config.base_url + "/api/service/" + config.service_id
        headers = {'Content-Type': 'application/json'}

        r = requests.delete(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
예제 #17
0
 def test_06_postkpinames(self):
     '''查询kpi name [post] /api/kpi/names'''
     url = config.base_url + "/api/kpi/names"
     headers = {'Content-Type': 'application/json'}
     data = {"kpi_keys": []}
     r = requests.post(url, data=json.dumps(data), headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
예제 #18
0
 def test_04_getkpi(self):
     '''查询kpi[get] /api/kpi/extremelySimplified?query=&limit=100'''
     url = config.base_url + "/api/kpi/extremelySimplified?query=&limit=100"
     headers = {'Content-Type': 'application/json'}
     # data = {"name":self.name}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
     assert len(jobs["data"]) != 0
 def test_09_getapinodedata(self):
     '''批量获取机器节点多维数据表头[get] /api/node/data/metric'''
     url = config.base_url + "/api/node/data/metric"
     headers = {'Content-Type': 'application/json'}
     data = {"nodes": [self.node_key]}
     r = requests.post(url, data=json.dumps(data), headers=headers)
     jobs = r.json()
     config.pprint(url, jobs, data)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
     assert len(jobs["data"]) != 0
    def test_01_getapiservicepage(self):
        '''获取业务系统列表[get] /api/service'''
        url = config.base_url + "/api/service?page=1&size=10&type=top&name=ATM&level=A"
        headers = {'Content-Type': 'application/json'}

        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
        assert len(jobs["data"]) != 0
    def test_05_geteventid_graph(self):
        '''(民生调用链) [get] /api/event/{eventId}/graph'''
        test_04_EventObjectOperatingInterface.TestEventInterface.test_02_postapievent(self)
        url = config.base_url + "/api/event/" + config.event_id + "/graph"
        headers = {'Content-Type': 'application/x-www-form-urlencoded'}

        r = requests.get(url, headers=headers)
        test_04_EventObjectOperatingInterface.TestEventInterface.test_13_deleteapievent_id(self)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
    def test_04_getapinodedata(self):
        '''获取机器节点多维数据[get] /api/node/:node_key/data'''
        url = config.base_url + "/api/node/" + self.node_key + "/data?time=" + str(int(time.time()))
        headers = {'Content-Type': 'application/json'}

        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
        assert len(jobs["data"]) != 0
    def test_13_getapinodepage(self):
        '''(获取机器指标列表)获取机器节点列表[get] /api/node/page'''
        url = config.base_url + "/api/node/page?query=node&page=1&size=1"
        headers = {'Content-Type': 'application/json'}

        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
        assert len(jobs["data"]) != 0
예제 #24
0
 def test_05_getkpi(self):
     '''查询module page [get] /api/module/page?page=1&size=100'''
     url = config.base_url + "/api/module/page?page=1&size=100"
     headers = {'Content-Type': 'application/json'}
     # data = {"name":self.name}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
     assert len(jobs["data"]) != 0
예제 #25
0
 def test_07_getclass(self):
     '''模块机器指标查询-class [post] /api/node/data/metric/class'''
     url = config.base_url + "/api/node/data/metric/class"
     headers = {'Content-Type': 'application/json'}
     data = {"nodes": ["node.BDEPAP01"]}
     r = requests.post(url, data=json.dumps(data), headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
     assert len(jobs["data"]) != 0
예제 #26
0
 def test_05_postnodedata(self):
     '''重新分析 [put] /api/task/fluxrank'''
     url = config.base_url + "/api/task/fluxrank"
     headers = {'Content-Type': 'application/json'}
     data = {"details": {"events": [{"event_id": "5da6b5421a870b4165bb7bcc", "time": 1524689580}]}}
     r = requests.put(url, data=json.dumps(data), headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 202
     assert jobs["msg"] == "Accepted"
     assert len(jobs["data"]) != 0
예제 #27
0
    def test_02_getServiceModule(self):
        '''查询服务模块'''
        test_01_BM_new_business.TestNewBusiness().test_01_postservice()

        url = config.base_url + "/api/service/" + config.service_id + "/modules"
        headers = {'Content-Type': 'application/json'}
        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
예제 #28
0
    def test_01_getmodulepage(self):
        '''获获取模块列表[get] /api/module/page'''
        url = config.base_url + "/api/module/page?query=mod&page=1&size=10"
        headers = {'Content-Type': 'application/json'}

        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
        assert len(jobs["data"]) != 0
예제 #29
0
 def test_06_getmodule(self):
     '''模块机器指标查询-module [get] /api/module/5da6af651a870b4165bb7b94/nodes'''
     url = config.base_url + "/api/module/5da6af651a870b4165bb7b94/nodes"
     headers = {'Content-Type': 'application/json'}
     # data = {"details": {"events": [{"event_id": "5da6b5421a870b4165bb7bcc", "time": 1524689580}]}}
     r = requests.get(url, headers=headers)
     jobs = r.json()
     config.pprint(url, jobs)
     assert jobs["code"] == 200
     assert jobs["msg"] == "OK"
     assert len(jobs["data"]) != 0
    def test_01_getapinode(self):
        '''获取机器节点列表[get] /api/node'''
        url = config.base_url + "/api/node"
        headers = {'Content-Type': 'application/json'}

        r = requests.get(url, headers=headers)
        jobs = r.json()
        config.pprint(url, jobs)
        assert jobs["code"] == 200
        assert jobs["msg"] == "OK"
        assert len(jobs["data"]) != 0