@Test public void testGetMessage() throws Exception { helloPacket = new HelloPacket(); helloPacket.setAuthType(1); helloPacket.setOspftype(1); helloPacket.setRouterId(Ip4Address.valueOf("10.226.165.164")); helloPacket.setAreaId(Ip4Address.valueOf("10.226.165.100")); helloPacket.setChecksum(201); helloPacket.setAuthentication(2); helloPacket.setOspfPacLength(48); helloPacket.setOspfVer(2); helloPacket.setNetworkMask(Ip4Address.valueOf("255.255.255.255")); helloPacket.setOptions(2); helloPacket.setHelloInterval(10); helloPacket.setRouterPriority(1); helloPacket.setRouterDeadInterval(40); helloPacket.setDr(Ip4Address.valueOf("1.1.1.1")); helloPacket.setBdr(Ip4Address.valueOf("2.2.2.2")); helloPacket.addNeighbor(Ip4Address.valueOf("8.8.8.8")); helloPacket.setDestinationIp(Ip4Address.valueOf("5.5.5.5")); ospfMessageWriter.getMessage(helloPacket, 7, 1); assertThat(ospfMessageWriter, is(notNullValue())); }
public byte[] getMessage(OspfMessage ospfMessage, int interfaceIndex, int interfaceState) { byte[] buf = null; switch (ospfMessage.ospfMessageType().value()) { case OspfParameters.HELLO: case OspfParameters.LSACK: case OspfParameters.DD: case OspfParameters.LSREQUEST: case OspfParameters.LSUPDATE: buf = writeMessageToBytes(ospfMessage, interfaceIndex, interfaceState); break; default: log.debug("Message Writer[Encoder] - Unknown Message to encode..!!!"); break; } return buf; }
OspfMessageWriter { public byte[] getMessage(OspfMessage ospfMessage, int interfaceIndex, int interfaceState) { byte[] buf = null; switch (ospfMessage.ospfMessageType().value()) { case OspfParameters.HELLO: case OspfParameters.LSACK: case OspfParameters.DD: case OspfParameters.LSREQUEST: case OspfParameters.LSUPDATE: buf = writeMessageToBytes(ospfMessage, interfaceIndex, interfaceState); break; default: log.debug("Message Writer[Encoder] - Unknown Message to encode..!!!"); break; } return buf; } }
OspfMessageWriter { public byte[] getMessage(OspfMessage ospfMessage, int interfaceIndex, int interfaceState) { byte[] buf = null; switch (ospfMessage.ospfMessageType().value()) { case OspfParameters.HELLO: case OspfParameters.LSACK: case OspfParameters.DD: case OspfParameters.LSREQUEST: case OspfParameters.LSUPDATE: buf = writeMessageToBytes(ospfMessage, interfaceIndex, interfaceState); break; default: log.debug("Message Writer[Encoder] - Unknown Message to encode..!!!"); break; } return buf; }  }
OspfMessageWriter { public byte[] getMessage(OspfMessage ospfMessage, int interfaceIndex, int interfaceState) { byte[] buf = null; switch (ospfMessage.ospfMessageType().value()) { case OspfParameters.HELLO: case OspfParameters.LSACK: case OspfParameters.DD: case OspfParameters.LSREQUEST: case OspfParameters.LSUPDATE: buf = writeMessageToBytes(ospfMessage, interfaceIndex, interfaceState); break; default: log.debug("Message Writer[Encoder] - Unknown Message to encode..!!!"); break; } return buf; }  byte[] getMessage(OspfMessage ospfMessage, int interfaceIndex, int interfaceState); }
OspfMessageWriter { public byte[] getMessage(OspfMessage ospfMessage, int interfaceIndex, int interfaceState) { byte[] buf = null; switch (ospfMessage.ospfMessageType().value()) { case OspfParameters.HELLO: case OspfParameters.LSACK: case OspfParameters.DD: case OspfParameters.LSREQUEST: case OspfParameters.LSUPDATE: buf = writeMessageToBytes(ospfMessage, interfaceIndex, interfaceState); break; default: log.debug("Message Writer[Encoder] - Unknown Message to encode..!!!"); break; } return buf; }  byte[] getMessage(OspfMessage ospfMessage, int interfaceIndex, int interfaceState);  }