@Test public void testGetOspfLsaType() throws Exception { lsaHeader.setLsType(1); ospflsaType = lsaHeader.getOspfLsaType(); assertThat(ospflsaType, is(notNullValue())); assertThat(ospflsaType, is(OspfLsaType.ROUTER)); lsaHeader.setLsType(2); ospflsaType = lsaHeader.getOspfLsaType(); assertThat(ospflsaType, is(notNullValue())); assertThat(ospflsaType, is(OspfLsaType.NETWORK)); lsaHeader.setLsType(3); ospflsaType = lsaHeader.getOspfLsaType(); assertThat(ospflsaType, is(notNullValue())); assertThat(ospflsaType, is(OspfLsaType.SUMMARY)); lsaHeader.setLsType(4); ospflsaType = lsaHeader.getOspfLsaType(); assertThat(ospflsaType, is(notNullValue())); assertThat(ospflsaType, is(OspfLsaType.ASBR_SUMMARY)); lsaHeader.setLsType(5); ospflsaType = lsaHeader.getOspfLsaType(); assertThat(ospflsaType, is(notNullValue())); assertThat(ospflsaType, is(OspfLsaType.EXTERNAL_LSA)); lsaHeader.setLsType(6); ospflsaType = lsaHeader.getOspfLsaType(); assertThat(ospflsaType, is(notNullValue())); assertThat(ospflsaType, is(OspfLsaType.UNDEFINED)); }
@Override public OspfLsaType getOspfLsaType() { if (lsType == OspfLsaType.ROUTER.value()) { return OspfLsaType.ROUTER; } else if (lsType == OspfLsaType.NETWORK.value()) { return OspfLsaType.NETWORK; } else if (lsType == OspfLsaType.SUMMARY.value()) { return OspfLsaType.SUMMARY; } else if (lsType == OspfLsaType.ASBR_SUMMARY.value()) { return OspfLsaType.ASBR_SUMMARY; } else if (lsType == OspfLsaType.EXTERNAL_LSA.value()) { return OspfLsaType.EXTERNAL_LSA; } else if (lsType == OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.LINK_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.AREA_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AS_OPAQUE_LSA.value()) { return OspfLsaType.AS_OPAQUE_LSA; } return OspfLsaType.UNDEFINED; }
LsaHeader implements OspfLsa { @Override public OspfLsaType getOspfLsaType() { if (lsType == OspfLsaType.ROUTER.value()) { return OspfLsaType.ROUTER; } else if (lsType == OspfLsaType.NETWORK.value()) { return OspfLsaType.NETWORK; } else if (lsType == OspfLsaType.SUMMARY.value()) { return OspfLsaType.SUMMARY; } else if (lsType == OspfLsaType.ASBR_SUMMARY.value()) { return OspfLsaType.ASBR_SUMMARY; } else if (lsType == OspfLsaType.EXTERNAL_LSA.value()) { return OspfLsaType.EXTERNAL_LSA; } else if (lsType == OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.LINK_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.AREA_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AS_OPAQUE_LSA.value()) { return OspfLsaType.AS_OPAQUE_LSA; } return OspfLsaType.UNDEFINED; } }
LsaHeader implements OspfLsa { @Override public OspfLsaType getOspfLsaType() { if (lsType == OspfLsaType.ROUTER.value()) { return OspfLsaType.ROUTER; } else if (lsType == OspfLsaType.NETWORK.value()) { return OspfLsaType.NETWORK; } else if (lsType == OspfLsaType.SUMMARY.value()) { return OspfLsaType.SUMMARY; } else if (lsType == OspfLsaType.ASBR_SUMMARY.value()) { return OspfLsaType.ASBR_SUMMARY; } else if (lsType == OspfLsaType.EXTERNAL_LSA.value()) { return OspfLsaType.EXTERNAL_LSA; } else if (lsType == OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.LINK_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.AREA_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AS_OPAQUE_LSA.value()) { return OspfLsaType.AS_OPAQUE_LSA; } return OspfLsaType.UNDEFINED; }  }
LsaHeader implements OspfLsa { @Override public OspfLsaType getOspfLsaType() { if (lsType == OspfLsaType.ROUTER.value()) { return OspfLsaType.ROUTER; } else if (lsType == OspfLsaType.NETWORK.value()) { return OspfLsaType.NETWORK; } else if (lsType == OspfLsaType.SUMMARY.value()) { return OspfLsaType.SUMMARY; } else if (lsType == OspfLsaType.ASBR_SUMMARY.value()) { return OspfLsaType.ASBR_SUMMARY; } else if (lsType == OspfLsaType.EXTERNAL_LSA.value()) { return OspfLsaType.EXTERNAL_LSA; } else if (lsType == OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.LINK_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.AREA_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AS_OPAQUE_LSA.value()) { return OspfLsaType.AS_OPAQUE_LSA; } return OspfLsaType.UNDEFINED; }  int age(); void setAge(int age); int options(); void setOptions(int options); int lsType(); void setLsType(int lsType); String linkStateId(); void setLinkStateId(String linkStateId); Ip4Address advertisingRouter(); void setAdvertisingRouter(Ip4Address advertisingRouter); long lsSequenceNo(); void setLsSequenceNo(long lsSequenceNo); int lsCheckSum(); void setLsCheckSum(int lsCheckSum); int lsPacketLen(); void setLsPacketLen(int lsPacketLen); @Override OspfLsaType getOspfLsaType(); @Override OspfLsa lsaHeader(); byte[] getLsaHeaderAsByteArray(); void populateHeader(LsaHeader lsaHeader); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
LsaHeader implements OspfLsa { @Override public OspfLsaType getOspfLsaType() { if (lsType == OspfLsaType.ROUTER.value()) { return OspfLsaType.ROUTER; } else if (lsType == OspfLsaType.NETWORK.value()) { return OspfLsaType.NETWORK; } else if (lsType == OspfLsaType.SUMMARY.value()) { return OspfLsaType.SUMMARY; } else if (lsType == OspfLsaType.ASBR_SUMMARY.value()) { return OspfLsaType.ASBR_SUMMARY; } else if (lsType == OspfLsaType.EXTERNAL_LSA.value()) { return OspfLsaType.EXTERNAL_LSA; } else if (lsType == OspfLsaType.LINK_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.LINK_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value()) { return OspfLsaType.AREA_LOCAL_OPAQUE_LSA; } else if (lsType == OspfLsaType.AS_OPAQUE_LSA.value()) { return OspfLsaType.AS_OPAQUE_LSA; } return OspfLsaType.UNDEFINED; }  int age(); void setAge(int age); int options(); void setOptions(int options); int lsType(); void setLsType(int lsType); String linkStateId(); void setLinkStateId(String linkStateId); Ip4Address advertisingRouter(); void setAdvertisingRouter(Ip4Address advertisingRouter); long lsSequenceNo(); void setLsSequenceNo(long lsSequenceNo); int lsCheckSum(); void setLsCheckSum(int lsCheckSum); int lsPacketLen(); void setLsPacketLen(int lsPacketLen); @Override OspfLsaType getOspfLsaType(); @Override OspfLsa lsaHeader(); byte[] getLsaHeaderAsByteArray(); void populateHeader(LsaHeader lsaHeader); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }