Ejemplo n.º 1
0
    def get(self, ws_id, schema_id):
        """
        Get schema
        
        Returns the requested schema from the schema_master at schema_index from this workspace

        :param ws_id: The workspace ID
        :param schema_id: Either "ns" or "vnf"
        :return: The requested schema
        """
        schema_index = workspaceimpl.get_workspace(ws_id)['schema_index']
        return prepare_response(descriptorutil.get_schema(schema_index, schema_id))
def validate_service_descriptor(schema_index: int, descriptor: dict) -> None:
    """
    Validates the given descriptor with the schema loaded from the configuration
    :param schema_index: the workspace
    :param descriptor: the service descriptor
    :raises: InvalidArgument: if the validation fails
    """
    schema = get_schema(schema_index, SCHEMA_ID_NS)
    try:
        jsonschema.validate(descriptor, schema)
    except ValidationError as ve:
        raise InvalidArgument("Validation failed: <br/> Path: {} <br/> Error: {}".format(list(ve.path), ve.message))
    def get(self, ws_id, schema_id):
        """
        Return the requested schema
        :param ws_id:
        :param schema_id:
        :return:
        """
        if schema_id == SCHEMA_ID_VNF:
            schema_index = workspaceimpl.get_workspace(ws_id)['vnf_schema_index']
        else:
            schema_index = workspaceimpl.get_workspace(ws_id)['ns_schema_index']

        return prepare_response(descriptorutil.get_schema(schema_index, schema_id))
def validate_service_descriptor(schema_index: int, descriptor: dict) -> None:
    """
    Validates the given descriptor with the schema loaded from the configuration

    :param schema_index: the workspace
    :param descriptor: the service descriptor
    :raises: InvalidArgument: if the validation fails
    """
    schema = get_schema(schema_index, SCHEMA_ID_NS)
    try:
        jsonschema.validate(descriptor, schema)
    except ValidationError as ve:
        raise InvalidArgument("Validation failed: <br/> Path: {} <br/> Error: {}".format(list(ve.path), ve.message))
Ejemplo n.º 5
0
def validate_vnf(schema_index: int, descriptor: dict) -> None:
    """
    Validates the VNF against the VNF schema
    
    :param schema_index: The index of the schema repository
    :param descriptor: The descriptor to validate
    :return: Nothing if descriptor id valid
    :raises InvalidArgument: if the schema is not Valid
    """
    schema = get_schema(schema_index, SCHEMA_ID_VNF)
    try:
        jsonschema.validate(descriptor, schema)
    except ValidationError as ve:
        raise InvalidArgument("Validation failed: <br/> Path: {} <br/> Error: {}".format(list(ve.path), ve.message))
Ejemplo n.º 6
0
def validate_vnf(schema_index: int, descriptor: dict) -> None:
    """
    Validates the VNF against the VNF schema
    
    :param schema_index: The index of the schema repository
    :param descriptor: The descriptor to validate
    :return: Nothing if descriptor id valid
    :raises InvalidArgument: if the schema is not Valid
    """
    schema = get_schema(schema_index, SCHEMA_ID_VNF)
    try:
        jsonschema.validate(descriptor, schema)
    except ValidationError as ve:
        raise InvalidArgument(
            "Validation failed: <br/> Path: {} <br/> Error: {}".format(
                list(ve.path), ve.message))
    def get(self, ws_id, schema_id):
        """
        Return the requested schema
        :param ws_id:
        :param schema_id:
        :return:
        """
        if schema_id == SCHEMA_ID_VNF:
            schema_index = workspaceimpl.get_workspace(
                ws_id)['vnf_schema_index']
        else:
            schema_index = workspaceimpl.get_workspace(
                ws_id)['ns_schema_index']

        return prepare_response(
            descriptorutil.get_schema(schema_index, schema_id))
Ejemplo n.º 8
0
def validate_vnf(schema_index: int, descriptor: dict) -> None:
    schema = get_schema(schema_index, SCHEMA_ID_VNF)
    try:
        jsonschema.validate(descriptor, schema)
    except ValidationError as ve:
        raise InvalidArgument("Validation failed: <br/> Path: {} <br/> Error: {}".format(list(ve.path), ve.message))
def validate_vnf(schema_index: int, descriptor: dict) -> None:
    schema = get_schema(schema_index, SCHEMA_ID_VNF)
    try:
        jsonschema.validate(descriptor, schema)
    except ValidationError as ve:
        raise InvalidArgument("Validation failed: <br/> Path: {} <br/> Error: {}".format(list(ve.path), ve.message))