Skip to content

Basic usage example #34

Description

@nleiva

Hi, first of all, really cool and useful project!

Second, in the example you reference naming. What's that?

dev := &entname.DeviceParams{
    Vendor: naming.JUNIPER,
    HardwareModel: "PTX10008",
}

Here is a simple example I put together. Is this how you expect users to interact with it?

package main

import (
	"fmt"
	"github.com/openconfig/entity-naming/entname"
)

func main() {
	dp := &entname.DeviceParams{
		Vendor:        entname.VendorJuniper,
		HardwareModel: "PTX10008",
	}

	aggName, err := entname.AggregateInterface(dp, 0)
	if err != nil {
		panic(err)
	}
	fmt.Println(aggName)

	LoName, err := entname.LoopbackInterface(dp, 0)
	if err != nil {
		panic(err)
	}
	fmt.Println(LoName)

	pp := &entname.PortParams{
		SlotIndex: 1,
		PICIndex:  2,
		PortIndex: 3,
		// Unchannelized, Channelized, Unchannelizable
		ChannelState: 0,
		// IfEthernet_ETHERNET_SPEED_SPEED_100GB E_IfEthernet_ETHERNET_SPEED = 1
		Speed: 1,
	}

	PoName, err := entname.Port(dp, pp)
	if err != nil {
		panic(err)
	}
	fmt.Println(PoName)

}

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions