Пример #1
0
    def __init__(self, workspace=None):
        """
        Initialize the Validator.
        A workspace may be provided for an easy parameter configuration,
        such as location and extension of descriptors, verbosity level, etc.
        :param workspace: SONATA workspace object
        """
        self._workspace = workspace
        self._syntax = True
        self._integrity = True
        self._topology = True

        # create "virtual" workspace if not provided (don't actually create
        # file structure)
        if not self._workspace:
            self._workspace = Workspace('.', log_level='info')

        # load configurations from workspace
        self._dext = self._workspace.default_descriptor_extension
        self._dpath = '.'
        self._log_level = self._workspace.log_level

        # configure logs
        coloredlogs.install(level=self._log_level)

        # descriptors storage
        self._storage = DescriptorStorage()

        # syntax validation
        self._schema_validator = SchemaValidator(self._workspace)

        # reset event logger
        evtlog.reset()
Пример #2
0
    def __init__(self,
                 workspace,
                 project=None,
                 services=None,
                 functions=None,
                 dst_path=None,
                 generate_pd=True,
                 version="1.0"):

        # Assign parameters
        coloredlogs.install(level=workspace.log_level)
        self._version = version
        self._package_descriptor = None
        self._workspace = workspace
        self._project = project
        self._services = services
        self._functions = functions

        # Create a son-access client
        self._access = AccessClient(self._workspace,
                                    log_level=self._workspace.log_level)

        # Create a validator
        self._validator = Validator(workspace=workspace)
        self._validator.configure(syntax=True, integrity=False, topology=False)

        # Create a schema validator
        self._schema_validator = SchemaValidator(workspace)

        # Keep track of VNF packaging referenced in NS
        self._ns_vnf_registry = {}

        # location to write the package
        self._dst_path = dst_path if dst_path else '.'

        # temporary working directory
        self._workdir = '.package-' + str(time.time())

        # Specifies THE service template of this package
        self._entry_service_template = None

        # Keep a list of repositories and
        # catalogue servers that this package depend on.
        # This will be included in the Package Resolver Section
        self._package_resolvers = []

        # Keep a list of external artifact
        # dependencies that this package depends up on
        # This will be included in the Artifact Dependencies Section
        self._artifact_dependencies = []

        # States if this package is self-contained,
        # i.e. if contains all its relevant artifacts
        self._sealed = True

        # Clear and create package specific folder
        if generate_pd:
            self.init_package_skeleton()
            self.build_package()
Пример #3
0
    def __init__(self,
                 workspace,
                 project,
                 dst_path=None,
                 generate_pd=True,
                 version="1.0"):

        # Assign parameters
        coloredlogs.install(level=workspace.log_level)
        self._version = version
        self._package_descriptor = None
        self._workspace = workspace
        self._project = project

        # Create a schema validator
        self._schema_validator = SchemaValidator(workspace)

        self._catalogueClients = []

        # Read catalogue servers from workspace
        # configfile and create clients
        for cat in workspace.catalogue_servers:
            self._catalogueClients.append(CatalogueClient(cat['url']))

        # Keep track of VNF packaging referenced in NS
        self._ns_vnf_registry = {}

        self._dst_path = dst_path

        # Specifies THE service template of this package
        self._entry_service_template = None

        # Keep a list of repositories and
        # catalogue servers that this package depend on.
        # This will be included in the Package Resolver Section
        self._package_resolvers = []

        # Keep a list of external artifact
        # dependencies that this package depends up on
        # This will be included in the Artifact Dependencies Section
        self._artifact_dependencies = []

        # States if this package is self-contained,
        # i.e. if contains all its relevant artifacts
        self._sealed = True

        # Clear and create package specific folder
        if generate_pd:
            self.init_package_skeleton(dst_path)
            self.package_descriptor = self._project
Пример #4
0
    def __init__(self,
                 workspace,
                 project=None,
                 component=None,
                 catalogue=None):

        # Assign parameters
        coloredlogs.install(level=workspace.log_level)
        self._workspace = workspace
        self._project = project
        self._component = component
        self._catalogue = catalogue
        self._catalogue_clients = []

        # Instantiate catalogue clients
        self.create_catalogue_clients()

        # Create a schema validator
        self._schema_validator = SchemaValidator(workspace)