import org.junit.Test;\r
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;\r
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
+import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;\r
import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;\r
PortModInputBuilder builder = new PortModInputBuilder();\r
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
builder.setPortNo(new PortNumber(9L));\r
- builder.setHwAddress(new MacAddress("08002700B0EB"));\r
+ builder.setHwAddress(new MacAddress("08:00:27:00:B0:EB"));\r
builder.setConfig(new PortConfig(true, false, true, false));\r
builder.setMask(new PortConfig(false, true, false, true));\r
builder.setAdvertise(new PortFeatures(true, false, false, false,\r
BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);\r
Assert.assertEquals("Wrong PortNo", message.getPortNo().getValue().longValue(), out.readUnsignedInt());\r
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_01);\r
- Assert.assertEquals("Wrong MacAddress", message.getHwAddress().getValue(), new MacAddress(makeMacAddress(out)).getValue());\r
+ byte[] address = new byte[6];\r
+ out.readBytes(address);\r
+ Assert.assertEquals("Wrong MacAddress", message.getHwAddress().getValue(),\r
+ new MacAddress(ByteBufUtils.macAddressToString(address)).getValue());\r
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_02);\r
Assert.assertEquals("Wrong config", message.getConfig(), createPortConfig(out.readInt()));\r
Assert.assertEquals("Wrong mask", message.getMask(), createPortConfig(out.readInt()));\r
_1gbFd, _1gbHd, _1tbFd, _40gbFd, _autoneg, _copper, _fiber, _other, _pause, _pauseAsym);\r
}\r
\r
- private static String makeMacAddress(ByteBuf input) {\r
- final int macAddressLength = 6;\r
- StringBuffer macToString = new StringBuffer();\r
- \r
- for(int i=0; i<macAddressLength; i++){\r
- short mac = 0;\r
- mac = input.readUnsignedByte();\r
- macToString.append(String.format("%02X", mac));\r
- }\r
- return macToString.toString();\r
- }\r
}\r