Exemplo n.º 1
0
func (u *NetLinkTopoUpdater) addGenericLinkToTopology(link netlink.Link) *Interface {
	u.linkCache[link.Attrs().Index] = *link.Attrs()

	/* create a port, attach it to the current container, then create attach
	   a single interface to this port */
	port := u.Container.Topology.NewPort(link.Attrs().Name, u.Container)
	intf := u.Container.Topology.NewInterface(link.Attrs().Name, port)

	/* TODO(safchain) Add more metadatas here */
	intf.Mac = link.Attrs().HardwareAddr.String()

	return intf
}
Exemplo n.º 2
0
func (u *NetLinkTopoUpdater) addLinkToTopology(link netlink.Link) {
	var intf *Interface

	switch link.Type() {
	/* ignore the openswitch interface as it will be handled
	   by the ovs updater */
	case "openvswitch":
	case "veth":
	case "bridge":
	default:
		intf = u.addGenericLinkToTopology(link)
	}

	if intf != nil {
		intf.Type = link.Type()
	}
}