2 * Copyright (C) 2013 Red Hat, Inc.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.ovsdb.openstack.netvirt.providers.mdsalopenflow13;
12 import java.math.BigInteger;
13 import java.util.ArrayList;
14 import java.util.List;
16 import org.opendaylight.ovsdb.openstack.netvirt.providers.OF13Provider;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagMatchBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg0;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg1;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg2;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg3;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg4;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg5;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg6;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlow;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlowBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.ExtensionBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionList;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionListBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg0Key;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg1Key;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg2Key;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg3Key;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg4Key;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg5Key;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg6Key;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg7Key;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIdKey;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.reg.grouping.NxmNxRegBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.id.grouping.NxmNxTunIdBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxmNxNspKey;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.nxm.nx.nsp.grouping.NxmNxNspBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxmNxNsiKey;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.nxm.nx.nsi.grouping.NxmNxNsiBuilder;
68 import org.slf4j.Logger;
69 import org.slf4j.LoggerFactory;
71 import com.google.common.collect.ImmutableList;
72 import com.google.common.collect.Lists;
74 public class OF13MdSalMatch extends OF13Provider {
75 private static final Logger logger = LoggerFactory.getLogger(OF13MdSalMatch.class);
78 * Create Ingress Port Match dpidLong, inPort
80 * @param matchBuilder Map matchBuilder MatchBuilder Object without a match
81 * @param dpidLong Long the datapath ID of a switch/node
82 * @param inPort Long ingress port on a switch
83 * @return matchBuilder Map MatchBuilder Object with a match
85 public static MatchBuilder createInPortMatch(MatchBuilder matchBuilder, Long dpidLong, Long inPort) {
87 NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + inPort);
88 logger.debug("createInPortMatch() Node Connector ID is - Type=openflow: DPID={} inPort={} ", dpidLong, inPort);
89 matchBuilder.setInPort(NodeConnectorId.getDefaultInstance(ncid.getValue()));
90 matchBuilder.setInPort(ncid);
96 * Create EtherType Match
98 * @param matchBuilder Map matchBuilder MatchBuilder Object without a match
99 * @param etherType Long EtherType
100 * @return matchBuilder Map MatchBuilder Object with a match
102 public static MatchBuilder createEtherTypeMatch(MatchBuilder matchBuilder, EtherType etherType) {
104 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
105 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
106 ethTypeBuilder.setType(new EtherType(etherType));
107 ethernetMatch.setEthernetType(ethTypeBuilder.build());
108 matchBuilder.setEthernetMatch(ethernetMatch.build());
114 * Create Ethernet Source Match
116 * @param matchBuilder MatchBuilder Object without a match yet
117 * @param sMacAddr String representing a source MAC
118 * @return matchBuilder Map MatchBuilder Object with a match
120 public static MatchBuilder createEthSrcMatch(MatchBuilder matchBuilder, MacAddress sMacAddr) {
122 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
123 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
124 ethSourceBuilder.setAddress(new MacAddress(sMacAddr));
125 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
126 matchBuilder.setEthernetMatch(ethernetMatch.build());
132 * Create Ethernet Destination Match
134 * @param matchBuilder MatchBuilder Object without a match yet
135 * @param vlanId Integer representing a VLAN ID Integer representing a VLAN ID
136 * @return matchBuilder Map MatchBuilder Object with a match
138 public static MatchBuilder createVlanIdMatch(MatchBuilder matchBuilder, VlanId vlanId) {
139 VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
140 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
141 vlanIdBuilder.setVlanId(new VlanId(vlanId));
142 vlanIdBuilder.setVlanIdPresent(true);
143 vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
144 matchBuilder.setVlanMatch(vlanMatchBuilder.build());
150 * Create Ethernet Destination Match
152 * @param matchBuilder MatchBuilder Object without a match yet
153 * @param dMacAddr String representing a destination MAC
154 * @return matchBuilder Map MatchBuilder Object with a match
156 public static MatchBuilder createDestEthMatch(MatchBuilder matchBuilder, MacAddress dMacAddr, MacAddress mask) {
158 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
159 EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
160 ethDestinationBuilder.setAddress(new MacAddress(dMacAddr));
162 ethDestinationBuilder.setMask(mask);
164 ethernetMatch.setEthernetDestination(ethDestinationBuilder.build());
165 matchBuilder.setEthernetMatch(ethernetMatch.build());
171 * Tunnel ID Match Builder
173 * @param matchBuilder MatchBuilder Object without a match yet
174 * @param tunnelId BigInteger representing a tunnel ID
175 * @return matchBuilder Map MatchBuilder Object with a match
177 public static MatchBuilder createTunnelIDMatch(MatchBuilder matchBuilder, BigInteger tunnelId) {
179 TunnelBuilder tunnelBuilder = new TunnelBuilder();
180 tunnelBuilder.setTunnelId(tunnelId);
181 matchBuilder.setTunnel(tunnelBuilder.build());
187 * Match ICMP code and type
189 * @param matchBuilder MatchBuilder Object without a match yet
190 * @param type short representing an ICMP type
191 * @param code short representing an ICMP code
192 * @return matchBuilder Map MatchBuilder Object with a match
194 public static MatchBuilder createICMPv4Match(MatchBuilder matchBuilder, short type, short code) {
196 EthernetMatchBuilder eth = new EthernetMatchBuilder();
197 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
198 ethTypeBuilder.setType(new EtherType(0x0800L));
199 eth.setEthernetType(ethTypeBuilder.build());
200 matchBuilder.setEthernetMatch(eth.build());
202 // Build the IPv4 Match requied per OVS Syntax
203 IpMatchBuilder ipmatch = new IpMatchBuilder();
204 ipmatch.setIpProtocol((short) 1);
205 matchBuilder.setIpMatch(ipmatch.build());
207 // Build the ICMPv4 Match
208 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
209 icmpv4match.setIcmpv4Type(type);
210 icmpv4match.setIcmpv4Code(code);
211 matchBuilder.setIcmpv4Match(icmpv4match.build());
217 * @param matchBuilder MatchBuilder Object without a match yet
218 * @param dstip String containing an IPv4 prefix
219 * @return matchBuilder Map Object with a match
221 public static MatchBuilder createDstL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix dstip) {
223 EthernetMatchBuilder eth = new EthernetMatchBuilder();
224 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
225 ethTypeBuilder.setType(new EtherType(0x0800L));
226 eth.setEthernetType(ethTypeBuilder.build());
227 matchBuilder.setEthernetMatch(eth.build());
229 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
230 ipv4match.setIpv4Destination(dstip);
232 matchBuilder.setLayer3Match(ipv4match.build());
239 * @param matchBuilder MatchBuilder Object without a match yet
240 * @param srcip String containing an IPv4 prefix
241 * @return matchBuilder Map Object with a match
243 public static MatchBuilder createSrcL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix srcip) {
245 EthernetMatchBuilder eth = new EthernetMatchBuilder();
246 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
247 ethTypeBuilder.setType(new EtherType(0x0800L));
248 eth.setEthernetType(ethTypeBuilder.build());
249 matchBuilder.setEthernetMatch(eth.build());
251 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
252 ipv4match.setIpv4Source(srcip);
253 matchBuilder.setLayer3Match(ipv4match.build());
260 * Create Source TCP Port Match
262 * @param matchBuilder @param matchbuilder MatchBuilder Object without a match yet
263 * @param tcpport Integer representing a source TCP port
264 * @return matchBuilder Map MatchBuilder Object with a match
266 public static MatchBuilder createSetSrcTcpMatch(MatchBuilder matchBuilder, PortNumber tcpport) {
268 EthernetMatchBuilder ethType = new EthernetMatchBuilder();
269 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
270 ethTypeBuilder.setType(new EtherType(0x0800L));
271 ethType.setEthernetType(ethTypeBuilder.build());
272 matchBuilder.setEthernetMatch(ethType.build());
274 IpMatchBuilder ipmatch = new IpMatchBuilder();
275 ipmatch.setIpProtocol((short) 6);
276 matchBuilder.setIpMatch(ipmatch.build());
278 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
279 tcpmatch.setTcpSourcePort(tcpport);
280 matchBuilder.setLayer4Match(tcpmatch.build());
287 * Create Destination TCP Port Match
289 * @param matchBuilder MatchBuilder Object without a match yet
290 * @param tcpDstPort Integer representing a destination TCP port
291 * @return matchBuilder Map MatchBuilder Object with a match
293 public static MatchBuilder createSetDstTcpMatch(MatchBuilder matchBuilder, PortNumber tcpDstPort) {
295 EthernetMatchBuilder ethType = new EthernetMatchBuilder();
296 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
297 ethTypeBuilder.setType(new EtherType(0x0800L));
298 ethType.setEthernetType(ethTypeBuilder.build());
299 matchBuilder.setEthernetMatch(ethType.build());
301 IpMatchBuilder ipmatch = new IpMatchBuilder();
302 ipmatch.setIpProtocol((short) 6);
303 matchBuilder.setIpMatch(ipmatch.build());
305 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
306 tcpmatch.setTcpDestinationPort(tcpDstPort);
307 matchBuilder.setLayer4Match(tcpmatch.build());
313 * Test match for TCP_Flags
315 * @return match containing TCP_Flag (), IP Protocol (TCP), TCP_Flag (SYN)
317 * Defined TCP Flag values in OVS v2.1+
318 * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
319 * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
320 * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
322 public static MatchBuilder createTcpFlagMatch(MatchBuilder matchBuilder, int tcpFlag) {
325 EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
326 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
327 ethTypeBuilder.setType(new EtherType(0x0800L));
328 ethernetType.setEthernetType(ethTypeBuilder.build());
329 matchBuilder.setEthernetMatch(ethernetType.build());
331 // TCP Protocol Match
332 IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
333 ipMatch.setIpProtocol((short) 6);
334 matchBuilder.setIpMatch(ipMatch.build());
337 PortNumber dstPort = new PortNumber(80);
338 TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
339 tcpMatch.setTcpDestinationPort(dstPort);
340 matchBuilder.setLayer4Match(tcpMatch.build());
342 TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
343 tcpFlagMatch.setTcpFlag(0x002);
344 matchBuilder.setTcpFlagMatch(tcpFlagMatch.build());
349 public static class RegMatch {
350 final Class<? extends NxmNxReg> reg;
352 public RegMatch(Class<? extends NxmNxReg> reg, Long value) {
357 public static RegMatch of(Class<? extends NxmNxReg> reg, Long value) {
358 return new RegMatch(reg, value);
362 public static void addNxRegMatch(MatchBuilder match,
363 RegMatch... matches) {
364 ArrayList<ExtensionList> extensions = new ArrayList<>();
365 for (RegMatch rm : matches) {
366 Class<? extends ExtensionKey> key;
367 if (NxmNxReg0.class.equals(rm.reg)) {
368 key = NxmNxReg0Key.class;
369 } else if (NxmNxReg1.class.equals(rm.reg)) {
370 key = NxmNxReg1Key.class;
371 } else if (NxmNxReg2.class.equals(rm.reg)) {
372 key = NxmNxReg2Key.class;
373 } else if (NxmNxReg3.class.equals(rm.reg)) {
374 key = NxmNxReg3Key.class;
375 } else if (NxmNxReg4.class.equals(rm.reg)) {
376 key = NxmNxReg4Key.class;
377 } else if (NxmNxReg5.class.equals(rm.reg)) {
378 key = NxmNxReg5Key.class;
379 } else if (NxmNxReg6.class.equals(rm.reg)) {
380 key = NxmNxReg6Key.class;
382 key = NxmNxReg7Key.class;
384 NxAugMatchNodesNodeTableFlow am =
385 new NxAugMatchNodesNodeTableFlowBuilder()
386 .setNxmNxReg(new NxmNxRegBuilder()
391 extensions.add(new ExtensionListBuilder()
392 .setExtensionKey(key)
393 .setExtension(new ExtensionBuilder()
394 .addAugmentation(NxAugMatchNodesNodeTableFlow.class, am)
398 GeneralAugMatchNodesNodeTableFlow m =
399 new GeneralAugMatchNodesNodeTableFlowBuilder()
400 .setExtensionList(extensions)
402 match.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, m);
405 public static void addNxTunIdMatch(MatchBuilder match,
407 NxAugMatchNodesNodeTableFlow am =
408 new NxAugMatchNodesNodeTableFlowBuilder()
409 .setNxmNxTunId(new NxmNxTunIdBuilder()
410 .setValue(BigInteger.valueOf(tunId))
413 GeneralAugMatchNodesNodeTableFlow m =
414 new GeneralAugMatchNodesNodeTableFlowBuilder()
415 .setExtensionList(ImmutableList.of(new ExtensionListBuilder()
416 .setExtensionKey(NxmNxTunIdKey.class)
417 .setExtension(new ExtensionBuilder()
418 .addAugmentation(NxAugMatchNodesNodeTableFlow.class, am)
422 match.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, m);
425 public static void addNxNsp(MatchBuilder match, long nsp) {
426 org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxAugMatchNodesNodeTableFlow am =
427 new org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder()
428 .setNxmNxNsp(new NxmNxNspBuilder()
432 addExtension(match, NxmNxNspKey.class, am);
435 public static void addNxNsi(MatchBuilder match, short nsi) {
436 org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxAugMatchNodesNodeTableFlow am =
437 new org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder()
438 .setNxmNxNsi(new NxmNxNsiBuilder()
442 addExtension(match, NxmNxNsiKey.class, am);
445 private static void addExtension (MatchBuilder match, Class<? extends ExtensionKey> extensionKey, org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxAugMatchNodesNodeTableFlow am) {
446 GeneralAugMatchNodesNodeTableFlow existingAugmentations = match.getAugmentation(GeneralAugMatchNodesNodeTableFlow.class);
447 List<ExtensionList> extensions = null;
448 if (existingAugmentations != null ) {
449 extensions = existingAugmentations.getExtensionList();
451 if (extensions == null) {
452 extensions = Lists.newArrayList();
455 extensions.add(new ExtensionListBuilder()
456 .setExtensionKey(extensionKey)
457 .setExtension(new ExtensionBuilder()
458 .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.ovs.nx.sal.match.rev140714.NxAugMatchNodesNodeTableFlow.class, am)
462 GeneralAugMatchNodesNodeTableFlow m = new GeneralAugMatchNodesNodeTableFlowBuilder()
463 .setExtensionList(extensions)
465 match.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, m);
468 public static EthernetMatch ethernetMatch(MacAddress srcMac,
471 EthernetMatchBuilder emb = new EthernetMatchBuilder();
473 emb.setEthernetSource(new EthernetSourceBuilder()
477 emb.setEthernetDestination(new EthernetDestinationBuilder()
480 if (etherType != null)
481 emb.setEthernetType(new EthernetTypeBuilder()
482 .setType(new EtherType(etherType))