Documentation ¶
Index ¶
Constants ¶
const ( KB byteSize = 1 << (10 * iota) MB GB TB PB EB ZB YB )
constants representing human friendly data sizes as per https://www.socketloop.com/tutorials/golang-how-to-declare-kilobyte-megabyte-gigabyte-terabyte-and-so-on
const ( // OpenconfigInterfacesModel is the openconfig YANG model for interfaces. OpenconfigInterfacesModel = "openconfig-interfaces" // OpenconfigOpenflowModel is the openconfig YANG model for openflow. OpenconfigOpenflowModel = "openconfig-openflow" // OpenconfigPlatformModel is the openconfig YANG model for platform. OpenconfigPlatformModel = "openconfig-platform" // OpenconfigSystemModel is the openconfig YANG model for system. OpenconfigSystemModel = "openconfig-system" // OpenconfigAclModel is the openconfig YANG model for acl. OpenconfigAclModel = "openconfig-acl" // OpenconfigAclModel is the openconfig YANG model for network-instance. OpenconfigNetworkInstance = "openconfig-network-instance" )
nolint
Variables ¶
var ( // ModelData is a list of supported models. ModelData = []*gpb.ModelData{{ Name: OpenconfigInterfacesModel, Organization: "OpenConfig working group", Version: "2.0.0", }, { Name: OpenconfigOpenflowModel, Organization: "OpenConfig working group", Version: "0.1.0", }, { Name: OpenconfigPlatformModel, Organization: "OpenConfig working group", Version: "0.5.0", }, { Name: OpenconfigSystemModel, Organization: "OpenConfig working group", Version: "0.2.0", }, { Name: OpenconfigAclModel, Organization: "OpenConfig working group", Version: "0.2.0", }, { Name: OpenconfigNetworkInstance, Organization: "OpenConfig working group", Version: "0.2.0", }} )
nolint
Functions ¶
Types ¶
type Deployment ¶
Deployment contains a UUID, a name for the deployment, and its state.
func Generate ¶
func Generate(ctx context.Context, models []*gpb.ModelData, repository Repository, sbiType spb.Type) (Deployment, error)
Generate takes gnmi.ModelData, a Repository, and an southbound.Type It searches for the model contained in the models slice in the provided Repository. Assuming all necessary models are found Go code is generated and written to Disk. Depending on the southbound.Type additional files for either containerised or plugin mode are created.
type DeploymentStore ¶
type DeploymentStore struct {
// contains filtered or unexported fields
}
DeploymentStore is a collection of channels that are used to access Deployments to read or write them. Access to the elements in the store is safe for concurrent use. Each instance of the store has a garbage collector periodically cleaning up decommissioned deployments.
func NewDeploymentStore ¶
func NewDeploymentStore(garbageCollectionInterval ...time.Duration) DeploymentStore
NewDeploymentStore returns a DeploymentStore. It takes a time.Duration variable to configure the garbage collection interval
func (DeploymentStore) Delete ¶
func (store DeploymentStore) Delete(id uuid.UUID) error
Delete takes a UUID and marks the Deployment with this UUID as decommissioned and ready for garbage collection. If no Deployment with the specified UUID can be found an error is returned.
func (DeploymentStore) Get ¶
func (store DeploymentStore) Get(id uuid.UUID) (Deployment, error)
Get takes a UUID and returns a Deployment. If no Deployment with the specified UUID can be found an error is returned.
func (DeploymentStore) Set ¶
func (store DeploymentStore) Set(deployment Deployment)
Set takes a Deployment and saves it in the store.
func (DeploymentStore) Shutdown ¶
func (store DeploymentStore) Shutdown(ctx context.Context)
Shutdown holds a context which may contain a timeout and passes it to the stores state manager, where it forces a garbage collection.
type ErrorLine ¶
type ErrorLine struct { Error string `json:"error"` ErrorDetail ErrorDetail `json:"errorDetail"` }
nolint
type Filesystem ¶
The Filesystem interface defines the implementation required for any YANG model repository data source.
type GoMod ¶
type GoMod struct { ModuleName string `json:"name"` GoVersion string `json:"go_version"` Dependencies []Module `json:"dependencies"` }
GoMod represents a go.mod file used for templates.
type Orchestrator ¶
type Orchestrator interface { Build(ctx context.Context, model []*gpb.ModelData) (Deployment, error) Deploy(deployment Deployment) error Destroy(ctx context.Context, id uuid.UUID) error Get(id uuid.UUID) (Deployment, error) Shutdown(ctx context.Context) Repository() Repository }
Orchestrator manages the lifecycle of cSBI deployments
func NewOrchestrator ¶
func NewOrchestrator(flavour OrchestratorType) (Orchestrator, error)
NewOrchestrator returns an implementation of the Orchestrator interface depending on the passed OrchestratorTYpe. Returns an error if an invalid type is passed
type OrchestratorType ¶
type OrchestratorType int
OrchestratorType is used as a selector for the NewOrchestrator function and determines which implementation of the Orchestrator interface will be returned.
const (
Docker OrchestratorType = iota
)
nolint
type Repository ¶
type Repository interface { // FindYANGFiles returns all YANG files matching the provided ModelData FindYANGFiles(models []*gpb.ModelData) ([]string, []error) // YANGPathsWithSuffix returns all YANG search paths with a '...' suffix YANGPathsWithSuffix() ([]string, error) }
Repository provides access to yang model files.
func NewRepository ¶
func NewRepository(basePath string) Repository
NewRepository returns a implementation of the Repository interface