def is_healthcheck_valid(healthcheck): if healthcheck['healthcheck_type'] != 'HTTP' and healthcheck['healthcheck_type'] != 'HTTPS': if healthcheck['healthcheck_expect'] != '': raise plugins_exceptions.ValueInvalid( 'healthcheck expect must be empty') if healthcheck['healthcheck_request'] != '': raise plugins_exceptions.ValueInvalid( 'healthcheck request must be empty') return True
def _flow(self, flow_id=0, method='', data=None, nodes_ids=[]): """ Generic implementation of the plugin communication with the remote controller through HTTP requests """ allowed_methods = ["get", "put", "delete"] if flow_id < 1 or method not in allowed_methods: log.error("Invalid parameters in OLDPlugin flow handler") raise exceptions.ValueInvalid() if nodes_ids == []: nodes_ids = self._get_nodes_ids() # if len(nodes_ids) < 1: # raise exceptions.ControllerInventoryIsEmpty(msg="No nodes found") return_flows = [] for node_id in nodes_ids: path = "/restconf/config/opendaylight-inventory:nodes/node/%s/" \ "flow-node-inventory:table/0/flow/%s" % (node_id, flow_id) return_flows.append( self._request(method=method, path=path, data=data, contentType='json')) return return_flows
def __init__(self, **kwargs): super(ODLPlugin, self).__init__(**kwargs) try: if not isinstance(self.equipment_access, EquipamentoAcesso): msg = 'equipment_access is not of EquipamentoAcesso type' log.info(msg) raise TypeError(msg) except (AttributeError, TypeError): # If AttributeError raised, equipment_access do not exists self.equipment_access = self._get_equipment_access() if self.version not in self.versions: log.error("Invalid version at ODL Controller initialization") raise exceptions.ValueInvalid(msg="Invalid version at ODL Controller initialization")