Beispiel #1
0
 def resume_service(self, service_id):
     """
     서비스 재실행
     :param service_id:
     :return:
     """
     url = self.CTRL_URL + "/service/" + service_id + "/resume"
     response = CustomHTTPClient.post_method(url, headers=self.HEADER)
     return self.confirm_status(response)
Beispiel #2
0
 def pause_sfc(self, service_id, sfc_id):
     """
     SFC 중지
     :param service_id:
     :param sfc_id:
     :return:
     """
     url = self.CTRL_URL + "/service/" + service_id + "/sfc/" + sfc_id + "/pause"
     response = CustomHTTPClient.post_method(url, headers=self.HEADER)
     return self.confirm_status(response)
Beispiel #3
0
 def create_route_src_rule_path(self, route_id, netnodeip, data):
     """
     송신지 기반 라우팅 테이블 추가 및 규칙 추가 (type1과 type2가 나뉘어져 있으며, type1 실행후 type2가 실행되어야 함)
     :param data: {"type":"type1", "src":"172.16.10/24"} or {"type":"type2", "dest":"default", "via":"192.168.132.1","dev":"qr-b37c13d4-d1"}
     :param route_id: qrouter-7dbafe64-7d18-4e82-b361-814036d26f43
     :return: {"message": "Success", "code": 200, "result": [{"PBR_TABLE": "local", "order": "0", "target": "from all lookup"}, {"PBR_TABLE": "7dbafe64", "order": "32765", "target": "from 172.16.10.0/24 lookup"}, {"PBR_TABLE": "main", "order": "32766", "target": "from all lookup"}, {"PBR_TABLE": "default", "order": "32767", "target": "from all lookup"}]}
     {"success": {"result": ["..."]}} 로 변환해서 return
     """
     url = self.CTRL_URL + "/route/src_rule/" + netnodeip + "/" + route_id
     response = CustomHTTPClient.post_method(url, headers=self.HEADER, body=data)
     return self.confirm_status(response)
Beispiel #4
0
 def create_route_dst_rule_path(self, route_id, netnodeip, data):
     """
     목적지 기반 라우터 경로 등록
     :param data: {"dest":"172.16.1.0/24", "via":"192.168.124.1","dev":"qr-90ce90aa-cb"}
     :param route_id: qrouter-fb4feaff-93b1-4564-8698-2ca8a67db277
     :return: {"message": "Success", "code": 200, "result": [{"Use": "0", "Iface": "qg-9f4212b2-d1", "Metric": "0", "Destination": "0.0.0.0", "Genmask": "0.0.0.0", "Flags": "UG", "Ref": "0", "Gateway": "10.10.200.1"}, {"Use": "0", "Iface": "qg-9f4212b2-d1", "Metric": "0", "Destination": "10.10.200.0", "Genmask": "255.255.255.0", "Flags": "U", "Ref": "0", "Gateway": "0.0.0.0"}, {"Use": "0", "Iface": "qr-90ce90aa-cb", "Metric": "0", "Destination": "172.16.1.0", "Genmask": "255.255.255.0", "Flags": "UG", "Ref": "0", "Gateway": "192.168.124.1"}, {"Use": "0", "Iface": "qr-90ce90aa-cb", "Metric": "0", "Destination": "192.168.124.0", "Genmask": "255.255.255.0", "Flags": "U", "Ref": "0", "Gateway": "0.0.0.0"}]}
     {"success": {"result": ["..."]}} 로 변환해서 return
     """
     url = self.CTRL_URL + "/route/dst_rule/" + netnodeip + "/" + route_id
     response = CustomHTTPClient.post_method(url, headers=self.HEADER, body=data)
     return self.confirm_status(response)
Beispiel #5
0
    def create_map(self, service_id, map_data):
        """
        Map 생성
        :param service_id:
        :param map_data:
        :return:
        """
        url = self.CTRL_URL + "/service/" + service_id + "/map"
        response = CustomHTTPClient.post_method(url, headers=self.HEADER, body=map_data)

        return self.confirm_status(response)
Beispiel #6
0
    def update_service(self, template, service_id=None):
        """
        서비스 수정, service_id 가 None 이면 생성
        :param template:
        :param service_id:
        :return:
        """
        url = self.CTRL_URL + "/service"
        if service_id:
            url += "/" + service_id
            response = CustomHTTPClient.patch_method(url, headers=self.HEADER, body=template)
        else:
            response = CustomHTTPClient.post_method(url, headers=self.HEADER, body=template)

        return self.confirm_status(response)
Beispiel #7
0
    def create_sfc(self, service_id, sfc_template):
        """
        SFC 생성
        :param service_id:
        :param sfc_template:
        :return:
            id(String): SFC ID
            chain_id(String): CHAIN ID
            sfc_status(String ): SFC 상태
            message(String): 전달 메시지
            code(Integer): Response Code

        """
        url = self.CTRL_URL + "/service/" + service_id + "/sfc"
        response = CustomHTTPClient.post_method(url, headers=self.HEADER, body=sfc_template)
        return self.confirm_status(response)