Skip to content

Implementing Line Card Port function #33

@nleiva

Description

@nleiva

Hi,

How do you envision implementing other Line Cards for a given vendor? Do you expand the Vendor Port function matching on HardwareModel?

Let's say I want to add support for other Juniper interfaces:

  • et—Ethernet interfaces (10-, 25-, 40-, 50-, 100-, 200-, and 400-Gigabit Ethernet interface).
  • ge—Gigabit Ethernet interface
  • xe—10-Gigabit Ethernet interface. Some older 10-Gigabit Ethernet interfaces use the ge media type (rather than xe) to identify the physical part of the network device (XENPAK 10-Gigabit Ethernet interface PIC, which is supported only on M series routers).

Then, I'd have to check HardwareModel before nameBuilder.WriteString("et-") and also change nameBuilder.WriteString("/0") to nameBuilder.WriteString(fmt.Sprintf("%d", pp.PICIndex)). Does that sound correct to you?

unc (n *Namer) Port(pp *namer.PortParams) (string, error) {
	if !pp.Channelizable {
		return "", fmt.Errorf("Juniper does not support unchannelizable ports")
	}

	var nameBuilder strings.Builder
	nameBuilder.WriteString("et-")
	if pp.SlotIndex == nil {
		nameBuilder.WriteString("0/")
		nameBuilder.WriteString(fmt.Sprintf("%d", pp.PICIndex))
	} else {
		nameBuilder.WriteString(fmt.Sprintf("%d", *pp.SlotIndex))
		nameBuilder.WriteString("/0")
	}
	nameBuilder.WriteString(fmt.Sprintf("/%d", pp.PortIndex))
	if pp.ChannelIndex != nil {
		nameBuilder.WriteString(fmt.Sprintf(":%d", *pp.ChannelIndex))
	}
	return nameBuilder.String(), nil
}

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