gnoigo

package module
v0.0.0-...-fee0fe3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: Apache-2.0 Imports: 17 Imported by: 9

README

Introduction

gnoigo is a go gNOI client library that provides convenience functions for constructing and running gNOI operations.

To build and execute the gnoigo unit tests, run the following:

go build ./...
go test ./...

Usage

Following is an example of how to use gnoigo API for performing a Ping Operation which is present in the System module.

  • Create the gnoigo clients object.

    conn, err := grpc.DialContext(ctx, "host")
    if err != nil {
        return err
    }
    clients := gnoigo.NewClients(conn)
    
  • Create the PingOperation object with inputs like source and destination.

    pingOp := system.NewPingOperation().Destination("1.2.3.4").Source("5.6.7.8")
    
  • Call the Execute operation to perform the Ping operation.

    response, err := gnoigo.Execute(ctx, clients, pingOp)
    

    In this example response will be of type PingResponse.

Documentation

Overview

Package gnoigo provides convenience functions for running gNOI operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute[T any](ctx context.Context, c Clients, op Operation[T]) (T, error)

Execute performs an operation and returns one or more response protos. For example, a PingOperation returns a slice of PingResponse messages.

Types

type Clients

type Clients interface {
	BGP() bpb.BGPClient
	CertificateManagement() cmpb.CertificateManagementClient
	Containerz() cpb.ContainerzClient
	Diag() dpb.DiagClient
	FactoryReset() frpb.FactoryResetClient
	File() fpb.FileClient
	Healthz() hpb.HealthzClient
	Layer2() lpb.Layer2Client
	LinkQualification() plqpb.LinkQualificationClient
	MPLS() mpb.MPLSClient
	OS() ospb.OSClient
	OTDR() otpb.OTDRClient
	System() spb.SystemClient
	WavelengthRouter() wrpb.WavelengthRouterClient
}

Clients is a set of gNOI clients.

func NewClients

func NewClients(conn *grpc.ClientConn) Clients

NewClients constructs all the gNOI clients.

type Operation

type Operation[T any] interface {
	Execute(context.Context, *internal.Clients) (T, error)
}

Operation represents any gNOI operation.

Directories

Path Synopsis
Package factoryreset provides gNOI factoryreset operations.
Package factoryreset provides gNOI factoryreset operations.
Package file provides gNOI file operations.
Package file provides gNOI file operations.
Package internal provides gnoigo structs that are not part of the public API.
Package internal provides gnoigo structs that are not part of the public API.
Package os provides gNOI os operations.
Package os provides gNOI os operations.
Package system provides gNOI system operations.
Package system provides gNOI system operations.

Jump to

Keyboard shortcuts

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