conf

package
v0.0.0-...-d31791d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2021 License: MIT, MPL-2.0 Imports: 8 Imported by: 4

README

'Dot Component' file format

Introduction

'.component' files are used to provide information about a VCI component, including what models it provides, and which model sets are supported.

Format

An example component file is shown:

  [Vyatta Component]
  Name=net.vyatta.vci.config.exampled
  Description=Example component
  ExecName=/usr/sbin/exampled
  ConfigFile=/etc/vyatta/exampled.conf
  Before=net.vyatta.vci.config.componentThatRunsAfterMe
  After=net.vyatta.vci.config.componentThatRunsBeforeMe

  [Model net.vyatta.vci.config.exampled.v1]
  Modules=example-main-v1,example-extra-v1
  ModelSets=vyatta-v1,other-v1
  ImportsRequiredForCheck=foo-v1,bar-v2

  [Model net.vyatta.vci.config.exampled.v2]
  Modules=example-main-v1,example-extra-v2,example-new-v1
  ModelSets=vyatta-v2

This is for the 'exampled' component, which provides 2 different models.

'Vyatta Component' fields

Each '.component' file should contain exactly one of these sections. It contains basic information about the component.

Name

Name of the component that will be used to register with the VCI infrastructure. We follow the DBUS bus name spec, though note that this does not tie us to using DBUS. Name must match the component name used in the call to vci.NewComponent().

Description

Free-text description

ExecName

Name of the executable to be run when this component

ConfigFile

Fully-qualified path for the component's config file. This should typically live in /etc/vyatta/.

Before

Other components that this component should be started before, ie any component listed here is started after this component. Names here should match the names in the relevant component's 'Name' field, comma-separated.

After

Opposite of 'Before' - a list of components that must be started before this component. Names here should match the names in the 'Name' field, comma-separated.

DefaultComponent

This is used to provide support for one component to own all YANG modules that are not explicitly claimed by any VCI component. Obviously only one component may be the default. This is primarily to provide a way to assign ownership of legacy Vyatta-v1 modelset modules to provisiond.

The default component cannot list any modules explicitly.

'Model' fields

Each component may provide one or more models. These each represent a view (or interface) of the component that consists of a set of YANG modules.

Different models may contain the same YANG modules.

A model may belong to one or more Model sets, if it wishes to present the same interface for each model set. However, it may only provide a single model per model set.

model-name (part of Model header)

Unique name of the model. Must match name used in call to comp.RegisterModel()

Modules

Comma-separated list of YANG modules provided by this model.

ModelSets

Comma-separated list of model sets supported by this model.

ImportsRequiredForCheck

Optional field used when a component needs candidate configuration from other components to be able to carry out the check() function. Content is a comma- separated list of YANG modules required.

Documentation

Index

Constants

View Source
const (
	// 'Base' is used rather than default to avoid confusion with the
	// 'default' component which has NO explicitly assigned modules and
	// instead owns all unowned modules.
	BaseModelSet           = "vyatta-v1"
	BaseNameAndModelPrefix = "net.vyatta.test"
	BaseModulePrefix       = "vyatta-test"
	BaseVersion            = "v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbusService

type DbusService interface {
	FilePrefix() string
	GenerateDbusService() []byte
	GenerateDbusConfig() []byte
}

type MissingFieldError

type MissingFieldError error

type Model

type Model struct {
	Name            string
	ExecName        string
	ModelSets       []string
	Modules         []string
	ImportsForCheck []string
}

func (*Model) FilePrefix

func (mod *Model) FilePrefix() string

func (*Model) GenerateDbusConfig

func (mod *Model) GenerateDbusConfig() []byte

func (*Model) GenerateDbusService

func (mod *Model) GenerateDbusService() []byte

type ServiceConfig

type ServiceConfig struct {
	Description     string
	Name            string
	ExecName        string
	ConfigFiles     []string
	Before          []string // This service starts BEFORE services listed here
	After           []string // This service starts AFTER services listed here
	StartOnBoot     bool
	Ephemeral       bool
	DefaultComp     bool
	ModelByName     map[string]*Model
	ModelByModelSet map[string]*Model
}

func LoadComponentConfigDir

func LoadComponentConfigDir(dir string) ([]*ServiceConfig, error)

func ParseConfiguration

func ParseConfiguration(input []byte) (*ServiceConfig, error)

func (*ServiceConfig) FilePrefix

func (comp *ServiceConfig) FilePrefix() string

func (*ServiceConfig) GenerateDbusConfig

func (comp *ServiceConfig) GenerateDbusConfig() []byte

func (*ServiceConfig) GenerateDbusService

func (comp *ServiceConfig) GenerateDbusService() []byte

func (*ServiceConfig) GenerateSystemdService

func (comp *ServiceConfig) GenerateSystemdService() []byte

type TestComp

type TestComp struct {
	// contains filtered or unexported fields
}

func CreateTestDotComponentFile

func CreateTestDotComponentFile(desc string) *TestComp

func (*TestComp) AddBaseModel

func (tc *TestComp) AddBaseModel() *TestComp

func (*TestComp) AddModel

func (tc *TestComp) AddModel(
	name string,
	modules []string,
	modelSets []string,
) *TestComp

func (*TestComp) AddModelWithCheckImport

func (tc *TestComp) AddModelWithCheckImport(
	name string,
	modules []string,
	modelSets []string,
	checkOnlyImports []string,
) *TestComp

func (*TestComp) ServiceName

func (tc *TestComp) ServiceName() string

func (*TestComp) SetAfter

func (tc *TestComp) SetAfter(after ...string) *TestComp

func (*TestComp) SetBefore

func (tc *TestComp) SetBefore(before ...string) *TestComp

func (*TestComp) SetDefault

func (tc *TestComp) SetDefault() *TestComp

func (*TestComp) SetPrefix

func (tc *TestComp) SetPrefix(prefix string) *TestComp

func (*TestComp) String

func (tc *TestComp) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL