X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-compability%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcompability%2FToSalConversionsUtils.java;h=702bd31aeb72651edfb1619531f41980c3158d1c;hb=0e4aa6c7f5a4c66c3778d4eaa488eaa91f964fac;hp=ad1a2f93872df143a84ffbfe338d7f8d11649ae9;hpb=27b812571223282220de1b4b065a3d13bdb45daa;p=controller.git diff --git a/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalConversionsUtils.java b/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalConversionsUtils.java index ad1a2f9387..702bd31aeb 100644 --- a/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalConversionsUtils.java +++ b/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalConversionsUtils.java @@ -1,5 +1,9 @@ package org.opendaylight.controller.sal.compability; +import static org.opendaylight.controller.sal.compability.ProtocolConstants.ETHERNET_ARP; +import static org.opendaylight.controller.sal.compability.ProtocolConstants.SCTP; +import static org.opendaylight.controller.sal.compability.ProtocolConstants.TCP; +import static org.opendaylight.controller.sal.compability.ProtocolConstants.UDP; import static org.opendaylight.controller.sal.match.MatchType.DL_DST; import static org.opendaylight.controller.sal.match.MatchType.DL_SRC; import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE; @@ -13,9 +17,9 @@ import static org.opendaylight.controller.sal.match.MatchType.TP_DST; import static org.opendaylight.controller.sal.match.MatchType.TP_SRC; import java.net.InetAddress; -import java.util.HashSet; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; -import java.util.Set; import org.opendaylight.controller.sal.action.*; import org.opendaylight.controller.sal.core.NodeConnector; @@ -23,25 +27,28 @@ import org.opendaylight.controller.sal.flowprogrammer.Flow; import org.opendaylight.controller.sal.match.Match; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.*; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.VlanCfi; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.*; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv6; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.ActionList; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.VlanCfi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.*; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.MacAddressFilter; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.*; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.ArpMatch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv4Match; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv6Match; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.SctpMatch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.TcpMatch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.UdpMatch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.vlan.match.fields.VlanId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.MacAddressFilter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.*; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId; import com.google.common.net.InetAddresses; @@ -51,7 +58,7 @@ public class ToSalConversionsUtils { } - public static Flow flowFrom(NodeFlow source) { + public static Flow toFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) { final Flow target = new Flow(); Integer hardTimeout = source.getHardTimeout(); @@ -69,163 +76,167 @@ public class ToSalConversionsUtils { target.setPriority(priority.shortValue()); } - target.setMatch(matchFrom(source.getMatch())); + target.setMatch(toMatch(source.getMatch())); - List actions = source.getAction(); + List actions = getAction(source); if (actions != null) { - for (Action sourceAction : actions) { - Set targetActions = actionFrom(sourceAction); - for (org.opendaylight.controller.sal.action.Action targetAction : targetActions) { - target.addAction(targetAction); - } - } + target.setActions(actionFrom(actions)); } target.setId(source.getCookie().longValue()); return target; } - public static Set actionFrom(Action source) { - org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.Action sourceAction = source - .getAction(); - Set targetAction = new HashSet<>(); - if (sourceAction instanceof ControllerAction) { - targetAction.add(new Controller()); - } else if (sourceAction instanceof OutputAction) { - - List nodeConnectors = ((OutputAction) sourceAction).getOutputNodeConnector(); - for (Uri uri : nodeConnectors) { - targetAction.add(new Output(fromNodeConnectorRef(uri))); - } - } else if (sourceAction instanceof PopMplsAction) { - // TODO: define maping - } else if (sourceAction instanceof PushMplsAction) { - // TODO: define maping - } else if (sourceAction instanceof PushPbbAction) { - // TODO: define maping - } else if (sourceAction instanceof PushVlanAction) { - // TODO: define maping - // PushVlanAction vlanAction = (PushVlanAction) sourceAction; - // targetAction.add(new PushVlan(vlanAction., pcp, cfi, vlanId); - } else if (sourceAction instanceof SetMplsTtlAction) { - // TODO: define maping - // targetAction = //no action to map - } else if (sourceAction instanceof SetNwTtlAction) { - // TODO: define maping - } else if (sourceAction instanceof SetQueueAction) { - // TODO: define maping - // targetAction = //no action to map - } else if (sourceAction instanceof DropAction) { - targetAction.add(new Drop()); - } else if (sourceAction instanceof FloodAction) { - targetAction.add(new Flood()); - } else if (sourceAction instanceof FloodAllAction) { - targetAction.add(new FloodAll()); - } else if (sourceAction instanceof HwPathAction) { - targetAction.add(new HwPath()); - } else if (sourceAction instanceof LoopbackAction) { - targetAction.add(new Loopback()); - } else if (sourceAction instanceof PopVlanAction) { - targetAction.add(new PopVlan()); - } else if (sourceAction instanceof PushVlanAction) { - PushVlanAction pushVlanAction = (PushVlanAction) sourceAction; - PushVlan pushVlan = pushVlanFrom(pushVlanAction); - if (pushVlan != null) { - targetAction.add(pushVlan); - } - } else if (sourceAction instanceof SetDlDstAction) { - MacAddress addressL2Dest = ((SetDlDstAction) sourceAction).getAddress(); - if (addressL2Dest != null) { - String addressValue = addressL2Dest.getValue(); - if (addressValue != null) { - targetAction.add(new SetDlDst(addressValue.getBytes())); + public static List getAction( + org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) { + if (source.getInstructions() != null) { + for (Instruction instruction : source.getInstructions().getInstruction()) { + if (instruction.getInstruction() instanceof ActionList) { + return (((ActionList) instruction.getInstruction()).getAction()); } } - } else if (sourceAction instanceof SetDlSrcAction) { - MacAddress addressL2Src = ((SetDlSrcAction) sourceAction).getAddress(); - if (addressL2Src != null) { - String addressValue = addressL2Src.getValue(); - if (addressValue != null) { - targetAction.add(new SetDlSrc(addressValue.getBytes())); + } + // TODO Auto-generated method stub + return Collections.emptyList(); + } + + public static List actionFrom(List actions) { + List targetAction = new ArrayList<>(); + for (Action action : actions) { + org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.Action sourceAction = action + .getAction(); + + if (sourceAction instanceof ControllerAction) { + targetAction.add(new Controller()); + } else if (sourceAction instanceof OutputAction) { + + List nodeConnectors = ((OutputAction) sourceAction).getOutputNodeConnector(); + if (nodeConnectors != null) { + for (Uri uri : nodeConnectors) { + targetAction.add(new Output(fromNodeConnectorRef(uri))); + } } - } - } else if (sourceAction instanceof SetDlTypeAction) { - EtherType dlType = ((SetDlTypeAction) sourceAction).getDlType(); - if (dlType != null) { - Long dlTypeValue = dlType.getValue(); - if (dlTypeValue != null) { - targetAction.add(new SetDlType(dlTypeValue.intValue())); + } else if (sourceAction instanceof PopMplsAction) { + // TODO: define maping + } else if (sourceAction instanceof PushMplsAction) { + // TODO: define maping + } else if (sourceAction instanceof PushPbbAction) { + // TODO: define maping + } else if (sourceAction instanceof SetMplsTtlAction) { + // TODO: define maping + // targetAction = //no action to map + } else if (sourceAction instanceof SetNwTtlAction) { + // TODO: define maping + } else if (sourceAction instanceof SetQueueAction) { + // TODO: define maping + // targetAction = //no action to map + } else if (sourceAction instanceof DropAction) { + targetAction.add(new Drop()); + } else if (sourceAction instanceof FloodAction) { + targetAction.add(new Flood()); + } else if (sourceAction instanceof FloodAllAction) { + targetAction.add(new FloodAll()); + } else if (sourceAction instanceof HwPathAction) { + targetAction.add(new HwPath()); + } else if (sourceAction instanceof LoopbackAction) { + targetAction.add(new Loopback()); + } else if (sourceAction instanceof PopVlanAction) { + targetAction.add(new PopVlan()); + } else if (sourceAction instanceof PushVlanAction) { + PushVlanAction pushVlanAction = (PushVlanAction) sourceAction; + PushVlan pushVlan = pushVlanFrom(pushVlanAction); + if (pushVlan != null) { + targetAction.add(pushVlan); } - } - } else if (sourceAction instanceof SetNextHopAction) { - Address addressL3 = ((SetNextHopAction) sourceAction).getAddress(); + } else if (sourceAction instanceof SetDlDstAction) { + MacAddress addressL2Dest = ((SetDlDstAction) sourceAction).getAddress(); + if (addressL2Dest != null) { + targetAction.add(new SetDlDst(bytesFrom(addressL2Dest))); + } + } else if (sourceAction instanceof SetDlSrcAction) { + MacAddress addressL2Src = ((SetDlSrcAction) sourceAction).getAddress(); + if (addressL2Src != null) { + targetAction.add(new SetDlSrc(bytesFrom(addressL2Src))); - InetAddress inetAddress = inetAddressFrom(addressL3); - if (inetAddress != null) { - targetAction.add(new SetNextHop(inetAddress)); - } - } else if (sourceAction instanceof SetNwDstAction) { - Address addressL3 = ((SetNwDstAction) sourceAction).getAddress(); + } + } else if (sourceAction instanceof SetDlTypeAction) { + EtherType dlType = ((SetDlTypeAction) sourceAction).getDlType(); + if (dlType != null) { + Long dlTypeValue = dlType.getValue(); + if (dlTypeValue != null) { + targetAction.add(new SetDlType(dlTypeValue.intValue())); + } + } + } else if (sourceAction instanceof SetNextHopAction) { + Address addressL3 = ((SetNextHopAction) sourceAction).getAddress(); - InetAddress inetAddress = inetAddressFrom(addressL3); - if (inetAddress != null) { - targetAction.add(new SetNwDst(inetAddress)); - } - } else if (sourceAction instanceof SetNwSrcAction) { - Address addressL3 = ((SetNwDstAction) sourceAction).getAddress(); + InetAddress inetAddress = inetAddressFrom(addressL3); + if (inetAddress != null) { + targetAction.add(new SetNextHop(inetAddress)); + } + } else if (sourceAction instanceof SetNwDstAction) { + Address addressL3 = ((SetNwDstAction) sourceAction).getAddress(); - InetAddress inetAddress = inetAddressFrom(addressL3); - if (inetAddress != null) { - targetAction.add(new SetNwSrc(inetAddress)); - } - } else if (sourceAction instanceof SetNwTosAction) { - Integer tos = ((SetNwTosAction) sourceAction).getTos(); - if (tos != null) { - targetAction.add(new SetNwTos(tos)); - } - } else if (sourceAction instanceof SetTpDstAction) { - PortNumber port = ((SetTpDstAction) sourceAction).getPort(); - if (port != null) { - Integer portValue = port.getValue(); - if (port.getValue() != null) { - targetAction.add(new SetTpDst(portValue)); + InetAddress inetAddress = inetAddressFrom(addressL3); + if (inetAddress != null) { + targetAction.add(new SetNwDst(inetAddress)); } - } - } else if (sourceAction instanceof SetTpSrcAction) { - PortNumber port = ((SetTpSrcAction) sourceAction).getPort(); - if (port != null) { - Integer portValue = port.getValue(); - if (port.getValue() != null) { - targetAction.add(new SetTpSrc(portValue)); + } else if (sourceAction instanceof SetNwSrcAction) { + Address addressL3 = ((SetNwSrcAction) sourceAction).getAddress(); + + InetAddress inetAddress = inetAddressFrom(addressL3); + if (inetAddress != null) { + targetAction.add(new SetNwSrc(inetAddress)); } - } - } else if (sourceAction instanceof SetVlanCfiAction) { - VlanCfi vlanCfi = ((SetVlanCfiAction) sourceAction).getVlanCfi(); - if (vlanCfi != null) { - Integer vlanCfiValue = vlanCfi.getValue(); - if (vlanCfiValue != null) { - targetAction.add(new SetVlanCfi(vlanCfiValue)); + } else if (sourceAction instanceof SetNwTosAction) { + Integer tos = ((SetNwTosAction) sourceAction).getTos(); + if (tos != null) { + targetAction.add(new SetNwTos(tos)); } - } - } else if (sourceAction instanceof SetVlanIdAction) { - org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanID = ((SetVlanIdAction) sourceAction) - .getVlanId(); - if (vlanID != null) { - Integer vlanIdValue = vlanID.getValue(); - if (vlanIdValue != null) { - targetAction.add(new SetVlanId(vlanIdValue)); + } else if (sourceAction instanceof SetTpDstAction) { + PortNumber port = ((SetTpDstAction) sourceAction).getPort(); + if (port != null) { + Integer portValue = port.getValue(); + if (port.getValue() != null) { + targetAction.add(new SetTpDst(portValue)); + } } - } - } else if (sourceAction instanceof SetVlanPcpAction) { - VlanPcp vlanPcp = ((SetVlanPcpAction) sourceAction).getVlanPcp(); - if (vlanPcp != null) { - Short vlanPcpValue = vlanPcp.getValue(); - if (vlanPcpValue != null) { - targetAction.add(new SetVlanPcp(vlanPcpValue)); + } else if (sourceAction instanceof SetTpSrcAction) { + PortNumber port = ((SetTpSrcAction) sourceAction).getPort(); + if (port != null) { + Integer portValue = port.getValue(); + if (port.getValue() != null) { + targetAction.add(new SetTpSrc(portValue)); + } + } + } else if (sourceAction instanceof SetVlanCfiAction) { + VlanCfi vlanCfi = ((SetVlanCfiAction) sourceAction).getVlanCfi(); + if (vlanCfi != null) { + Integer vlanCfiValue = vlanCfi.getValue(); + if (vlanCfiValue != null) { + targetAction.add(new SetVlanCfi(vlanCfiValue)); + } + } + } else if (sourceAction instanceof SetVlanIdAction) { + org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanID = ((SetVlanIdAction) sourceAction) + .getVlanId(); + if (vlanID != null) { + Integer vlanIdValue = vlanID.getValue(); + if (vlanIdValue != null) { + targetAction.add(new SetVlanId(vlanIdValue)); + } } + } else if (sourceAction instanceof SetVlanPcpAction) { + VlanPcp vlanPcp = ((SetVlanPcpAction) sourceAction).getVlanPcp(); + if (vlanPcp != null) { + Short vlanPcpValue = vlanPcp.getValue(); + if (vlanPcpValue != null) { + targetAction.add(new SetVlanPcp(vlanPcpValue)); + } + } + } else if (sourceAction instanceof SwPathAction) { + targetAction.add(new SwPath()); } - } else if (sourceAction instanceof SwPathAction) { - targetAction.add(new SwPath()); } return targetAction; @@ -275,7 +286,7 @@ public class ToSalConversionsUtils { return null; } - public static Match matchFrom(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Match source) { + public static Match toMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match source) { Match target = new Match(); if (source != null) { fillFrom(target, source.getVlanMatch()); @@ -314,7 +325,8 @@ public class ToSalConversionsUtils { private static void fillFrom(Match target, IpMatch ipMatch) { if (ipMatch != null) { Short ipProtocol = ipMatch.getIpProtocol(); - if (ipProtocol != null) { + + if (ipProtocol != null && target.getField(NW_PROTO) == null) { target.setField(NW_PROTO, ipProtocol.byteValue()); } Dscp dscp = ipMatch.getIpDscp(); @@ -356,6 +368,8 @@ public class ToSalConversionsUtils { target.setField(TP_DST, udpDestPortValue.shortValue()); } } + + target.setField(NW_PROTO, UDP); } private static void fillTransportLayer(Match target, TcpMatch source) { @@ -374,6 +388,8 @@ public class ToSalConversionsUtils { target.setField(TP_DST, tcpDestPortValue.shortValue()); } } + + target.setField(NW_PROTO, TCP); } private static void fillTransportLayer(Match target, SctpMatch source) { @@ -391,6 +407,9 @@ public class ToSalConversionsUtils { target.setField(TP_DST, sctpDestPortValue.shortValue()); } } + + target.setField(NW_PROTO, SCTP); + } private static void fillFrom(Match target, Layer3Match source) { @@ -410,10 +429,21 @@ public class ToSalConversionsUtils { if (sourceAddress != null) { target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null); } - Ipv4Prefix destAddress = source.getArpSourceTransportAddress(); + Ipv4Prefix destAddress = source.getArpTargetTransportAddress(); if (destAddress != null) { target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null); } + ArpSourceHardwareAddress sourceHwAddress = source.getArpSourceHardwareAddress(); + if (sourceHwAddress != null) { + target.setField(DL_SRC, bytesFrom(sourceHwAddress.getAddress())); + } + ArpTargetHardwareAddress targetHwAddress = source.getArpTargetHardwareAddress(); + if (targetHwAddress != null) { + target.setField(DL_DST, bytesFrom(targetHwAddress.getAddress())); + } + + target.setField(DL_TYPE, new Short(ETHERNET_ARP)); + } private static void fillFromIpv6(Match target, Ipv6Match source) { @@ -421,7 +451,7 @@ public class ToSalConversionsUtils { if (sourceAddress != null) { target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null); } - Ipv6Prefix destAddress = source.getIpv6Source(); + Ipv6Prefix destAddress = source.getIpv6Destination(); if (destAddress != null) { target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null); } @@ -432,7 +462,7 @@ public class ToSalConversionsUtils { if (sourceAddress != null) { target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null); } - Ipv4Prefix destAddress = source.getIpv4Source(); + Ipv4Prefix destAddress = source.getIpv4Destination(); if (destAddress != null) { target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null); } @@ -460,7 +490,7 @@ public class ToSalConversionsUtils { EthernetType ethType = source.getEthernetType(); if (ethType != null) { EtherType ethInnerType = ethType.getType(); - if (ethInnerType != null) { + if (ethInnerType != null && target.getField(DL_TYPE) == null) { Long value = ethInnerType.getValue(); target.setField(DL_TYPE, value.shortValue()); } @@ -478,9 +508,11 @@ public class ToSalConversionsUtils { } private static byte[] bytesFrom(MacAddress address) { - if (address != null) { - return address.getValue().getBytes(); + String[] mac = address.getValue().split(":"); + byte[] macAddress = new byte[6]; // mac.length == 6 bytes + for (int i = 0; i < mac.length; i++) { + macAddress[i] = Integer.decode("0x" + mac[i]).byteValue(); } - return null; + return macAddress; } }