Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic usage example #34

Open
nleiva opened this issue Jun 27, 2024 · 2 comments
Open

Basic usage example #34

nleiva opened this issue Jun 27, 2024 · 2 comments
Assignees

Comments

@nleiva
Copy link

nleiva commented Jun 27, 2024

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

@lgomez9
Copy link

lgomez9 commented Jul 22, 2024

Hi Nicolas - taking over for Greg on this library.

Re: on your first question - I think naming is supposed to be entname, as you noted in your example.

Your example looks exactly as we'd expect users to interact with it.

@nleiva
Copy link
Author

nleiva commented Jul 24, 2024

Thanks @lgomez9. Looking forward to collaborating on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants