func newLLDPEtherFrame(deviceID string, port openflow.Port) ([]byte, error) { lldp := &protocol.LLDP{ ChassisID: protocol.LLDPChassisID{ SubType: 7, // Locally assigned alpha-numeric string Data: []byte(deviceID), }, PortID: protocol.LLDPPortID{ SubType: 5, // Interface Name Data: []byte(fmt.Sprintf("cherry/%v", port.Number())), }, TTL: 120, } payload, err := lldp.MarshalBinary() if err != nil { return nil, err } ethernet := &protocol.Ethernet{ SrcMAC: port.MAC(), // LLDP multicast MAC address DstMAC: []byte{0x01, 0x80, 0xC2, 0x00, 0x00, 0x0E}, // LLDP ethertype Type: 0x88CC, Payload: payload, } frame, err := ethernet.MarshalBinary() if err != nil { return nil, err } return frame, nil }