From b34f82bf11934fc6b938ef997d536a7ccea76c36 Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Thu, 5 Nov 2015 14:00:42 -0800 Subject: Updates ONOS tree to checkin id ca9cc8e28eba18da77f4fa021fb7c3a3f76e5d44 upstream. Change-Id: I49f8e41733afea8101ec50c0102213c8d18949ae Signed-off-by: Ashlee Young --- .../pcepio/AdministrativeGroupTlvTest.java | 38 - .../pcepio/AutonomousSystemTlvTest.java | 38 - .../onosproject/pcepio/BGPLSidentifierTlvTest.java | 38 - .../onosproject/pcepio/GmplsCapabilityTlvTest.java | 38 - .../org/onosproject/pcepio/IGPMetricTlvTest.java | 40 - .../pcepio/IPv4InterfaceAddressTlvTest.java | 39 - .../pcepio/IPv4NeighborAddressTlvTest.java | 39 - .../org/onosproject/pcepio/IPv4SubObjectTest.java | 39 - .../pcepio/IPv4TERouterIdOfLocalNodeTlvTest.java | 39 - .../pcepio/IPv4TERouterIdOfRemoteNodeTlvTest.java | 39 - .../pcepio/IPv6InterfaceAddressTlvTest.java | 44 - .../pcepio/IPv6NeighborAddressTlvTest.java | 44 - .../org/onosproject/pcepio/IPv6SubObjectTest.java | 41 - .../pcepio/IPv6TERouterIdofLocalNodeTlvTest.java | 44 - .../pcepio/IPv6TERouterIdofRemoteNodeTlvTest.java | 44 - .../pcepio/ISISAreaIdentifierTlvTest.java | 42 - .../org/onosproject/pcepio/LabelSubObjectTest.java | 39 - .../pcepio/LinkLocalRemoteIdentifiersTlvTest.java | 39 - .../org/onosproject/pcepio/LinkNameTlvTest.java | 41 - .../pcepio/LinkProtectionTypeTlvTest.java | 41 - .../pcepio/LocalTENodeDescriptorsTlvTest.java | 56 - .../pcepio/MPLSProtocolMaskTlvTest.java | 41 - .../pcepio/MaximumLinkBandwidthTlvTest.java | 41 - .../MaximumReservableLinkBandwidthTlvTest.java | 41 - .../pcepio/NexthopIPv4addressTlvTest.java | 39 - .../pcepio/NexthopIPv6addressTlvTest.java | 43 - .../pcepio/NexthopUnnumberedIPv4IDTlvTest.java | 39 - .../onosproject/pcepio/NodeFlagBitsTlvTest.java | 41 - .../org/onosproject/pcepio/NodeNameTlvTest.java | 41 - .../onosproject/pcepio/OSPFareaIDsubTlvTest.java | 38 - .../pcepio/OpaqueLinkAttributeTlvTest.java | 41 - .../onosproject/pcepio/PathKeySubObjectTest.java | 39 - .../onosproject/pcepio/PathSetupTypeTlvTest.java | 36 - .../onosproject/pcepio/PceccCapabilityTlvTest.java | 41 - .../org/onosproject/pcepio/PcepCloseMsgTest.java | 60 - .../org/onosproject/pcepio/PcepErrorMsgTest.java | 739 --------- .../onosproject/pcepio/PcepInitiateMsgExtTest.java | 1686 -------------------- .../onosproject/pcepio/PcepInitiateMsgTest.java | 1335 ---------------- .../onosproject/pcepio/PcepKeepaliveMsgTest.java | 63 - .../onosproject/pcepio/PcepLabelUpdateMsgTest.java | 406 ----- .../pcepio/PcepNaiIpv4AdjacencyTest.java | 38 - .../onosproject/pcepio/PcepNaiIpv4NodeIdTest.java | 36 - .../pcepio/PcepNaiIpv6AdjacencyTest.java | 39 - .../onosproject/pcepio/PcepNaiIpv6NodeIdTest.java | 45 - .../pcepio/PcepNaiUnnumberedAdjacencyIpv4Test.java | 51 - .../org/onosproject/pcepio/PcepOpenMsgTest.java | 562 ------- .../onosproject/pcepio/PcepReportMsgExtTest.java | 221 --- .../org/onosproject/pcepio/PcepReportMsgTest.java | 1601 ------------------- .../onosproject/pcepio/PcepTEReportMsgTest.java | 1600 ------------------- .../onosproject/pcepio/PcepUpdateMsgExtTest.java | 1275 --------------- .../org/onosproject/pcepio/PcepUpdateMsgTest.java | 1427 ----------------- .../pcepio/RemoteTENodeDescriptorsTlvTest.java | 57 - .../org/onosproject/pcepio/RouterIDSubTlvTest.java | 44 - .../onosproject/pcepio/RoutingUniverseTlvTest.java | 37 - .../pcepio/SharedRiskLinkGroupTlvTest.java | 43 - .../org/onosproject/pcepio/SrEroSubObjectTest.java | 61 - .../pcepio/StatefulIPv4LspIdentidiersTlvTest.java | 57 - .../pcepio/StatefulLspDbVerTlvTest.java | 37 - .../pcepio/StatefulLspErrorCodeTlvTest.java | 32 - .../pcepio/StatefulPceCapabilityTlvTest.java | 35 - .../pcepio/SymbolicPathNameTlvTest.java | 45 - .../onosproject/pcepio/TEDefaultMetricTlvTest.java | 36 - .../pcepio/TELinkAttributesTlvTest.java | 59 - .../pcepio/TELinkDescriptorsTlvTest.java | 57 - .../pcepio/TENodeAttributesTlvTest.java | 59 - .../onosproject/pcepio/TedCapabilityTlvTest.java | 36 - .../pcepio/UnreservedBandwidthTlvTest.java | 37 - .../pcepio/protocol/PcepCloseMsgTest.java | 56 + .../pcepio/protocol/PcepErrorMsgTest.java | 735 +++++++++ .../pcepio/protocol/PcepInitiateMsgExtTest.java | 1683 +++++++++++++++++++ .../pcepio/protocol/PcepInitiateMsgTest.java | 1331 +++++++++++++++ .../pcepio/protocol/PcepKeepaliveMsgTest.java | 59 + .../pcepio/protocol/PcepLabelUpdateMsgTest.java | 402 +++++ .../pcepio/protocol/PcepOpenMsgTest.java | 558 +++++++ .../pcepio/protocol/PcepReportMsgExtTest.java | 218 +++ .../pcepio/protocol/PcepReportMsgTest.java | 1597 ++++++++++++++++++ .../pcepio/protocol/PcepTEReportMsgTest.java | 1596 ++++++++++++++++++ .../pcepio/protocol/PcepUpdateMsgExtTest.java | 1269 +++++++++++++++ .../pcepio/protocol/PcepUpdateMsgTest.java | 1423 +++++++++++++++++ .../pcepio/types/AdministrativeGroupTlvTest.java | 36 + .../pcepio/types/AutonomousSystemTlvTest.java | 36 + .../pcepio/types/BGPLSidentifierTlvTest.java | 36 + .../pcepio/types/GmplsCapabilityTlvTest.java | 36 + .../onosproject/pcepio/types/IGPMetricTlvTest.java | 38 + .../pcepio/types/IPv4InterfaceAddressTlvTest.java | 37 + .../pcepio/types/IPv4NeighborAddressTlvTest.java | 37 + .../pcepio/types/IPv4SubObjectTest.java | 37 + .../types/IPv4TERouterIdOfLocalNodeTlvTest.java | 37 + .../types/IPv4TERouterIdOfRemoteNodeTlvTest.java | 37 + .../pcepio/types/IPv6InterfaceAddressTlvTest.java | 42 + .../pcepio/types/IPv6NeighborAddressTlvTest.java | 42 + .../pcepio/types/IPv6SubObjectTest.java | 39 + .../types/IPv6TERouterIdofLocalNodeTlvTest.java | 42 + .../types/IPv6TERouterIdofRemoteNodeTlvTest.java | 42 + .../pcepio/types/ISISAreaIdentifierTlvTest.java | 40 + .../pcepio/types/LabelSubObjectTest.java | 37 + .../types/LinkLocalRemoteIdentifiersTlvTest.java | 37 + .../onosproject/pcepio/types/LinkNameTlvTest.java | 39 + .../pcepio/types/LinkProtectionTypeTlvTest.java | 39 + .../types/LocalTENodeDescriptorsTlvTest.java | 50 + .../pcepio/types/MPLSProtocolMaskTlvTest.java | 39 + .../pcepio/types/MaximumLinkBandwidthTlvTest.java | 39 + .../MaximumReservableLinkBandwidthTlvTest.java | 39 + .../pcepio/types/NexthopIPv4addressTlvTest.java | 37 + .../pcepio/types/NexthopIPv6addressTlvTest.java | 41 + .../types/NexthopUnnumberedIPv4IDTlvTest.java | 37 + .../pcepio/types/NodeFlagBitsTlvTest.java | 39 + .../onosproject/pcepio/types/NodeNameTlvTest.java | 39 + .../pcepio/types/OSPFareaIDsubTlvTest.java | 36 + .../pcepio/types/OpaqueLinkAttributeTlvTest.java | 39 + .../pcepio/types/PathKeySubObjectTest.java | 37 + .../pcepio/types/PathSetupTypeTlvTest.java | 34 + .../pcepio/types/PceccCapabilityTlvTest.java | 39 + .../pcepio/types/PcepNaiIpv4AdjacencyTest.java | 36 + .../pcepio/types/PcepNaiIpv4NodeIdTest.java | 34 + .../pcepio/types/PcepNaiIpv6AdjacencyTest.java | 37 + .../pcepio/types/PcepNaiIpv6NodeIdTest.java | 43 + .../types/PcepNaiUnnumberedAdjacencyIpv4Test.java | 49 + .../types/RemoteTENodeDescriptorsTlvTest.java | 52 + .../pcepio/types/RouterIDSubTlvTest.java | 42 + .../pcepio/types/RoutingUniverseTlvTest.java | 35 + .../pcepio/types/SharedRiskLinkGroupTlvTest.java | 41 + .../pcepio/types/SrEroSubObjectTest.java | 59 + .../types/StatefulIPv4LspIdentidiersTlvTest.java | 55 + .../pcepio/types/StatefulLspDbVerTlvTest.java | 35 + .../pcepio/types/StatefulLspErrorCodeTlvTest.java | 31 + .../pcepio/types/StatefulPceCapabilityTlvTest.java | 34 + .../pcepio/types/SymbolicPathNameTlvTest.java | 43 + .../pcepio/types/TEDefaultMetricTlvTest.java | 34 + .../pcepio/types/TELinkAttributesTlvTest.java | 54 + .../pcepio/types/TELinkDescriptorsTlvTest.java | 52 + .../pcepio/types/TENodeAttributesTlvTest.java | 54 + .../pcepio/types/TedCapabilityTlvTest.java | 34 + .../pcepio/types/UnreservedBandwidthTlvTest.java | 36 + 134 files changed, 13128 insertions(+), 13299 deletions(-) delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AdministrativeGroupTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AutonomousSystemTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/BGPLSidentifierTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/GmplsCapabilityTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4InterfaceAddressTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4NeighborAddressTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4SubObjectTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfLocalNodeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfRemoteNodeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6InterfaceAddressTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6NeighborAddressTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6SubObjectTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofLocalNodeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofRemoteNodeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LabelSubObjectTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkLocalRemoteIdentifiersTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkNameTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkProtectionTypeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LocalTENodeDescriptorsTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MPLSProtocolMaskTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumLinkBandwidthTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumReservableLinkBandwidthTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv4addressTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv6addressTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopUnnumberedIPv4IDTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeFlagBitsTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeNameTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OSPFareaIDsubTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OpaqueLinkAttributeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathKeySubObjectTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PceccCapabilityTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepCloseMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepErrorMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgExtTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepKeepaliveMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepLabelUpdateMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4AdjacencyTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4NodeIdTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6AdjacencyTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6NodeIdTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiUnnumberedAdjacencyIpv4Test.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepOpenMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgExtTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepTEReportMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgExtTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RoutingUniverseTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SrEroSubObjectTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulIPv4LspIdentidiersTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspDbVerTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspErrorCodeTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulPceCapabilityTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SymbolicPathNameTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TEDefaultMetricTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TedCapabilityTlvTest.java delete mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/UnreservedBandwidthTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepCloseMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepErrorMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgExtTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepKeepaliveMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepLabelUpdateMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepOpenMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgExtTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepTEReportMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgExtTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AdministrativeGroupTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AutonomousSystemTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/BGPLSidentifierTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/GmplsCapabilityTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IGPMetricTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4InterfaceAddressTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4NeighborAddressTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4SubObjectTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfLocalNodeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfRemoteNodeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6InterfaceAddressTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6NeighborAddressTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6SubObjectTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofLocalNodeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofRemoteNodeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/ISISAreaIdentifierTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LabelSubObjectTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkLocalRemoteIdentifiersTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkNameTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkProtectionTypeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LocalTENodeDescriptorsTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MPLSProtocolMaskTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumLinkBandwidthTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumReservableLinkBandwidthTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv4addressTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv6addressTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopUnnumberedIPv4IDTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeFlagBitsTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeNameTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OSPFareaIDsubTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OpaqueLinkAttributeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathKeySubObjectTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathSetupTypeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PceccCapabilityTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4AdjacencyTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeIdTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6AdjacencyTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6NodeIdTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiUnnumberedAdjacencyIpv4Test.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RemoteTENodeDescriptorsTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RouterIDSubTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RoutingUniverseTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SharedRiskLinkGroupTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SrEroSubObjectTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulIPv4LspIdentidiersTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspDbVerTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspErrorCodeTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulPceCapabilityTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SymbolicPathNameTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TEDefaultMetricTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkAttributesTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkDescriptorsTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TENodeAttributesTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TedCapabilityTlvTest.java create mode 100644 framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/UnreservedBandwidthTlvTest.java (limited to 'framework/src/onos/pcep/pcepio') diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AdministrativeGroupTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AdministrativeGroupTlvTest.java deleted file mode 100644 index b3ff2cbb..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AdministrativeGroupTlvTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.AdministrativeGroupTlv; - -/** - * Test of the AdministrativeGroupTlv. - */ -public class AdministrativeGroupTlvTest { - private final AdministrativeGroupTlv tlv1 = AdministrativeGroupTlv.of(1); - private final AdministrativeGroupTlv sameAsTlv1 = AdministrativeGroupTlv.of(1); - private final AdministrativeGroupTlv tlv2 = AdministrativeGroupTlv.of(2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AutonomousSystemTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AutonomousSystemTlvTest.java deleted file mode 100644 index 7a0078f9..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/AutonomousSystemTlvTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.AutonomousSystemTlv; - -/** - * Test of the AutonomousSystemTlv. - */ -public class AutonomousSystemTlvTest { - private final AutonomousSystemTlv tlv1 = AutonomousSystemTlv.of(1); - private final AutonomousSystemTlv sameAsTlv1 = AutonomousSystemTlv.of(1); - private final AutonomousSystemTlv tlv2 = AutonomousSystemTlv.of(2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/BGPLSidentifierTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/BGPLSidentifierTlvTest.java deleted file mode 100644 index d7a1f852..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/BGPLSidentifierTlvTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.BGPLSidentifierTlv; - -/** - * Test of the BGPLSidentifierTlv. - */ -public class BGPLSidentifierTlvTest { - private final BGPLSidentifierTlv tlv1 = BGPLSidentifierTlv.of(1); - private final BGPLSidentifierTlv sameAsTlv1 = BGPLSidentifierTlv.of(1); - private final BGPLSidentifierTlv tlv2 = BGPLSidentifierTlv.of(2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/GmplsCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/GmplsCapabilityTlvTest.java deleted file mode 100644 index 3a5c972b..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/GmplsCapabilityTlvTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.GmplsCapabilityTlv; - -/** - * Test of the GmplsCapabilityTlv. - */ -public class GmplsCapabilityTlvTest { - private final GmplsCapabilityTlv tlv1 = GmplsCapabilityTlv.of(1); - private final GmplsCapabilityTlv sameAsTlv1 = GmplsCapabilityTlv.of(1); - private final GmplsCapabilityTlv tlv2 = GmplsCapabilityTlv.of(2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java deleted file mode 100644 index 583b7049..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IGPMetricTlv; - -/** - * Test of the IGPMetricTlv. - */ -public class IGPMetricTlvTest { - private final byte[] b1 = new byte[] {0x01, 0x02}; - private final byte[] b2 = new byte[] {0x01, 0x02}; - private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2); - private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2); - private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4InterfaceAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4InterfaceAddressTlvTest.java deleted file mode 100644 index c25a6b5b..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4InterfaceAddressTlvTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv4InterfaceAddressTlv; - -/** - * Test of the IPv4InterfaceAddressTlv. - */ -public class IPv4InterfaceAddressTlvTest { - - private final IPv4InterfaceAddressTlv tlv1 = IPv4InterfaceAddressTlv.of(2); - private final IPv4InterfaceAddressTlv sameAsTlv1 = IPv4InterfaceAddressTlv.of(2); - private final IPv4InterfaceAddressTlv tlv2 = IPv4InterfaceAddressTlv.of(3); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4NeighborAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4NeighborAddressTlvTest.java deleted file mode 100644 index 60a4f120..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4NeighborAddressTlvTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv4NeighborAddressTlv; - -/** - * Test of the IPv4NeighborAddressTlv. - */ -public class IPv4NeighborAddressTlvTest { - - private final IPv4NeighborAddressTlv tlv1 = IPv4NeighborAddressTlv.of(2); - private final IPv4NeighborAddressTlv sameAsTlv1 = IPv4NeighborAddressTlv.of(2); - private final IPv4NeighborAddressTlv tlv2 = IPv4NeighborAddressTlv.of(3); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4SubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4SubObjectTest.java deleted file mode 100644 index 08b49879..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4SubObjectTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv4SubObject; - -/** - * Test of the IPv4SubObject. - */ -public class IPv4SubObjectTest { - - private final IPv4SubObject subObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); - private final IPv4SubObject sameAsSubObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); - private final IPv4SubObject subObj2 = IPv4SubObject.of(3, (byte) 16, (byte) 0); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(subObj1, sameAsSubObj1) - .addEqualityGroup(subObj2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfLocalNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfLocalNodeTlvTest.java deleted file mode 100644 index d04be239..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfLocalNodeTlvTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv4TERouterIdOfLocalNodeTlv; - -/** - * Test of the IPv4TERouterIdOfLocalNodeTlv. - */ -public class IPv4TERouterIdOfLocalNodeTlvTest { - - private final IPv4TERouterIdOfLocalNodeTlv tlv1 = IPv4TERouterIdOfLocalNodeTlv.of(2); - private final IPv4TERouterIdOfLocalNodeTlv sameAsTlv1 = IPv4TERouterIdOfLocalNodeTlv.of(2); - private final IPv4TERouterIdOfLocalNodeTlv tlv2 = IPv4TERouterIdOfLocalNodeTlv.of(3); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfRemoteNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfRemoteNodeTlvTest.java deleted file mode 100644 index fb8c9653..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv4TERouterIdOfRemoteNodeTlvTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv4TERouterIdOfRemoteNodeTlv; - -/** - * Test of the IPv4TERouterIdOfRemoteNodeTlv. - */ -public class IPv4TERouterIdOfRemoteNodeTlvTest { - - private final IPv4TERouterIdOfRemoteNodeTlv tlv1 = IPv4TERouterIdOfRemoteNodeTlv.of(2); - private final IPv4TERouterIdOfRemoteNodeTlv sameAsTlv1 = IPv4TERouterIdOfRemoteNodeTlv.of(2); - private final IPv4TERouterIdOfRemoteNodeTlv tlv2 = IPv4TERouterIdOfRemoteNodeTlv.of(3); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6InterfaceAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6InterfaceAddressTlvTest.java deleted file mode 100644 index 6eb771da..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6InterfaceAddressTlvTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv6InterfaceAddressTlv; - -/** - * Test of the IPv6InterfaceAddressTlv. - */ -public class IPv6InterfaceAddressTlvTest { - - private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; - - private final IPv6InterfaceAddressTlv tlv1 = IPv6InterfaceAddressTlv.of(b1); - private final IPv6InterfaceAddressTlv sameAsTlv1 = IPv6InterfaceAddressTlv.of(b1); - private final IPv6InterfaceAddressTlv tlv2 = IPv6InterfaceAddressTlv.of(b2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6NeighborAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6NeighborAddressTlvTest.java deleted file mode 100644 index 17fa9a3b..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6NeighborAddressTlvTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv6NeighborAddressTlv; - -/** - * Test of the IPv6NeighborAddressTlv. - */ -public class IPv6NeighborAddressTlvTest { - - private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; - - private final IPv6NeighborAddressTlv tlv1 = IPv6NeighborAddressTlv.of(b1); - private final IPv6NeighborAddressTlv sameAsTlv1 = IPv6NeighborAddressTlv.of(b1); - private final IPv6NeighborAddressTlv tlv2 = IPv6NeighborAddressTlv.of(b2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6SubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6SubObjectTest.java deleted file mode 100644 index 08a47237..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6SubObjectTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv6SubObject; - -/** - * Test of the IPv6SubObject. - */ -public class IPv6SubObjectTest { - - private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; - - private final IPv6SubObject subObj1 = IPv6SubObject.of(b1); - private final IPv6SubObject sameAsSubObj1 = IPv6SubObject.of(b1); - private final IPv6SubObject subObj2 = IPv6SubObject.of(b2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(subObj1, sameAsSubObj1).addEqualityGroup(subObj2).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofLocalNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofLocalNodeTlvTest.java deleted file mode 100644 index b37cb3d8..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofLocalNodeTlvTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv6TERouterIdofLocalNodeTlv; - -/** - * Test of the IPv6TERouterIdofLocalNodeTlv. - */ -public class IPv6TERouterIdofLocalNodeTlvTest { - - private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; - - private final IPv6TERouterIdofLocalNodeTlv tlv1 = IPv6TERouterIdofLocalNodeTlv.of(b1); - private final IPv6TERouterIdofLocalNodeTlv sameAsTlv1 = IPv6TERouterIdofLocalNodeTlv.of(b1); - private final IPv6TERouterIdofLocalNodeTlv tlv2 = IPv6TERouterIdofLocalNodeTlv.of(b2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofRemoteNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofRemoteNodeTlvTest.java deleted file mode 100644 index e572e358..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/IPv6TERouterIdofRemoteNodeTlvTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv6TERouterIdofRemoteNodeTlv; - -/** - * Test of the IPv6TERouterIdofRemoteNodeTlv. - */ -public class IPv6TERouterIdofRemoteNodeTlvTest { - - private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; - - private final IPv6TERouterIdofRemoteNodeTlv tlv1 = IPv6TERouterIdofRemoteNodeTlv.of(b1); - private final IPv6TERouterIdofRemoteNodeTlv sameAsTlv1 = IPv6TERouterIdofRemoteNodeTlv.of(b1); - private final IPv6TERouterIdofRemoteNodeTlv tlv2 = IPv6TERouterIdofRemoteNodeTlv.of(b2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java deleted file mode 100644 index 7bea1a9b..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.ISISAreaIdentifierTlv; - -/** - * Test of the ISISAreaIdentifierTlv. - */ -public class ISISAreaIdentifierTlvTest { - - private final byte[] b1 = new byte[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - private final byte[] b2 = new byte[] {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; - - private final ISISAreaIdentifierTlv tlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20); - private final ISISAreaIdentifierTlv sameAsTlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20); - private final ISISAreaIdentifierTlv tlv2 = ISISAreaIdentifierTlv.of(b2, (short) 20); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LabelSubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LabelSubObjectTest.java deleted file mode 100644 index 41d1f4ba..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LabelSubObjectTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.LabelSubObject; - -/** - * Test of the LabelSubObject. - */ -public class LabelSubObjectTest { - - private final LabelSubObject subObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); - private final LabelSubObject sameAsSubObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); - private final LabelSubObject subObj2 = LabelSubObject.of((byte) 0, (byte) 1, 30); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(subObj1, sameAsSubObj1) - .addEqualityGroup(subObj2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkLocalRemoteIdentifiersTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkLocalRemoteIdentifiersTlvTest.java deleted file mode 100644 index 1d04b47c..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkLocalRemoteIdentifiersTlvTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.LinkLocalRemoteIdentifiersTlv; - -/** - * Test of the LinkLocalRemoteIdentifiersTlv. - */ -public class LinkLocalRemoteIdentifiersTlvTest { - - private final LinkLocalRemoteIdentifiersTlv tlv1 = LinkLocalRemoteIdentifiersTlv.of(10, 20); - private final LinkLocalRemoteIdentifiersTlv sameAsTlv1 = LinkLocalRemoteIdentifiersTlv.of(10, 20); - private final LinkLocalRemoteIdentifiersTlv tlv2 = LinkLocalRemoteIdentifiersTlv.of(20, 30); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkNameTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkNameTlvTest.java deleted file mode 100644 index 5236be9d..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkNameTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.LinkNameTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Equality test for LinkNameTlv. - */ -public class LinkNameTlvTest { - private final byte[] rawValue1 = new byte[] {0x01, 0x00}; - private final byte[] rawValue2 = new byte[] {0x02, 0x00}; - - private final LinkNameTlv tlv1 = new LinkNameTlv(rawValue1, (short) rawValue1.length); - private final LinkNameTlv sameAsTlv1 = LinkNameTlv.of(tlv1.getValue(), tlv1.getLength()); - private final LinkNameTlv tlv2 = new LinkNameTlv(rawValue2, (short) 0); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkProtectionTypeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkProtectionTypeTlvTest.java deleted file mode 100644 index 4eea1b00..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LinkProtectionTypeTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.LinkProtectionTypeTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the LinkProtectionTypeTlv. - */ -public class LinkProtectionTypeTlvTest { - private final byte rawValue1 = 0x0A; - private final byte rawValue2 = 0x0B; - - private final LinkProtectionTypeTlv tlv1 = new LinkProtectionTypeTlv(rawValue1); - private final LinkProtectionTypeTlv sameAsTlv1 = new LinkProtectionTypeTlv(rawValue1); - private final LinkProtectionTypeTlv tlv2 = new LinkProtectionTypeTlv(rawValue2, (byte) 0); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LocalTENodeDescriptorsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LocalTENodeDescriptorsTlvTest.java deleted file mode 100644 index 3311a96c..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/LocalTENodeDescriptorsTlvTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; - -import java.util.LinkedList; - -import org.onosproject.pcepio.types.LocalTENodeDescriptorsTlv; -import org.onosproject.pcepio.types.AutonomousSystemTlv; -import org.onosproject.pcepio.types.BGPLSidentifierTlv; -import org.onosproject.pcepio.types.PcepValueType; - -/** - * Test of the LocalTENodeDescriptorsTlv. - */ -public class LocalTENodeDescriptorsTlvTest { - - private final AutonomousSystemTlv baAutoSysTlvRawValue1 = new AutonomousSystemTlv(1); - private final BGPLSidentifierTlv baBgplsIdRawValue1 = new BGPLSidentifierTlv(1); - - private final AutonomousSystemTlv baAutoSysTlvRawValue2 = new AutonomousSystemTlv(2); - private final BGPLSidentifierTlv baBgplsIdRawValue2 = new BGPLSidentifierTlv(2); - - private final LinkedList llNodeDescriptorSubTLVs1 = new LinkedList(); - private final boolean a = llNodeDescriptorSubTLVs1.add(baAutoSysTlvRawValue1); - private final boolean b = llNodeDescriptorSubTLVs1.add(baBgplsIdRawValue1); - - private final LinkedList llNodeDescriptorSubTLVs2 = new LinkedList(); - private final boolean c = llNodeDescriptorSubTLVs2.add(baAutoSysTlvRawValue2); - private final boolean d = llNodeDescriptorSubTLVs2.add(baBgplsIdRawValue2); - - private final LocalTENodeDescriptorsTlv tlv1 = LocalTENodeDescriptorsTlv.of(llNodeDescriptorSubTLVs1); - private final LocalTENodeDescriptorsTlv sameAstlv1 = LocalTENodeDescriptorsTlv.of(llNodeDescriptorSubTLVs1); - private final LocalTENodeDescriptorsTlv tlv2 = LocalTENodeDescriptorsTlv.of(llNodeDescriptorSubTLVs2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MPLSProtocolMaskTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MPLSProtocolMaskTlvTest.java deleted file mode 100644 index eda99a38..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MPLSProtocolMaskTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.MPLSProtocolMaskTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the MPLSProtocolMaskTlv. - */ -public class MPLSProtocolMaskTlvTest { - private final byte rawValue1 = 0x0A; - private final byte rawValue2 = 0x0B; - - private final MPLSProtocolMaskTlv tlv1 = new MPLSProtocolMaskTlv(rawValue1); - private final MPLSProtocolMaskTlv sameAsTlv1 = new MPLSProtocolMaskTlv(rawValue1); - private final MPLSProtocolMaskTlv tlv2 = MPLSProtocolMaskTlv.of(rawValue2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumLinkBandwidthTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumLinkBandwidthTlvTest.java deleted file mode 100644 index 50902acb..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumLinkBandwidthTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.MaximumLinkBandwidthTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the MaximumLinkBandwidthTlv. - */ -public class MaximumLinkBandwidthTlvTest { - private final int rawValue1 = 0x0A; - private final int rawValue2 = 0x0B; - - private final MaximumLinkBandwidthTlv tlv1 = new MaximumLinkBandwidthTlv(rawValue1); - private final MaximumLinkBandwidthTlv sameAsTlv1 = new MaximumLinkBandwidthTlv(rawValue1); - private final MaximumLinkBandwidthTlv tlv2 = MaximumLinkBandwidthTlv.of(rawValue2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumReservableLinkBandwidthTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumReservableLinkBandwidthTlvTest.java deleted file mode 100644 index da72c5ff..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/MaximumReservableLinkBandwidthTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.MaximumReservableLinkBandwidthTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the MaximumReservableLinkBandwidthTlv. - */ -public class MaximumReservableLinkBandwidthTlvTest { - private final int rawValue1 = 0x0A; - private final int rawValue2 = 0x0B; - - private final MaximumReservableLinkBandwidthTlv tlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1); - private final MaximumReservableLinkBandwidthTlv sameAsTlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1); - private final MaximumReservableLinkBandwidthTlv tlv2 = MaximumReservableLinkBandwidthTlv.of(rawValue2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv4addressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv4addressTlvTest.java deleted file mode 100644 index 27539fae..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv4addressTlvTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.NexthopIPv4addressTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Equality test for NexthopIPv4addressTlv. - */ -public class NexthopIPv4addressTlvTest { - - private final NexthopIPv4addressTlv tlv1 = new NexthopIPv4addressTlv(0x0A); - private final NexthopIPv4addressTlv sameAsTlv1 = new NexthopIPv4addressTlv(0x0A); - private final NexthopIPv4addressTlv tlv2 = NexthopIPv4addressTlv.of(0x0B); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv6addressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv6addressTlvTest.java deleted file mode 100644 index a543d651..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopIPv6addressTlvTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.NexthopIPv6addressTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Equality test for NexthopIPv6addressTlv. - */ -public class NexthopIPv6addressTlvTest { - - private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00 }; - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; - - private final NexthopIPv6addressTlv tlv1 = NexthopIPv6addressTlv.of(b1); - private final NexthopIPv6addressTlv sameAsTlv1 = NexthopIPv6addressTlv.of(b1); - private final NexthopIPv6addressTlv tlv2 = NexthopIPv6addressTlv.of(b2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopUnnumberedIPv4IDTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopUnnumberedIPv4IDTlvTest.java deleted file mode 100644 index 457b9347..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NexthopUnnumberedIPv4IDTlvTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.NexthopUnnumberedIPv4IDTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Equality test for NexthopUnnumberedIPv4IDTlv. - */ -public class NexthopUnnumberedIPv4IDTlvTest { - - private final NexthopUnnumberedIPv4IDTlv tlv1 = new NexthopUnnumberedIPv4IDTlv(0x0A, 0x0A); - private final NexthopUnnumberedIPv4IDTlv sameAsTlv1 = new NexthopUnnumberedIPv4IDTlv(0x0A, 0x0A); - private final NexthopUnnumberedIPv4IDTlv tlv2 = NexthopUnnumberedIPv4IDTlv.of(0x0B, 0x0B); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeFlagBitsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeFlagBitsTlvTest.java deleted file mode 100644 index a50062ae..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeFlagBitsTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.NodeFlagBitsTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the NodeFlagBitsTlv. - */ -public class NodeFlagBitsTlvTest { - private final byte rawValue1 = 0x0A; - private final byte rawValue2 = 0x0B; - - private final NodeFlagBitsTlv tlv1 = new NodeFlagBitsTlv(rawValue1); - private final NodeFlagBitsTlv sameAsTlv1 = new NodeFlagBitsTlv(rawValue1); - private final NodeFlagBitsTlv tlv2 = NodeFlagBitsTlv.of(rawValue2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeNameTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeNameTlvTest.java deleted file mode 100644 index bb35ed90..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/NodeNameTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.NodeNameTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the NodeNameTlv. - */ -public class NodeNameTlvTest { - private final byte[] rawValue1 = new byte[] {0x01, 0x02}; - private final byte[] rawValue2 = new byte[] {0x14, 0x15}; - - private final NodeNameTlv tlv1 = new NodeNameTlv(rawValue1, (short) rawValue1.length); - private final NodeNameTlv sameAsTlv1 = NodeNameTlv.of(tlv1.getValue(), tlv1.getLength()); - private final NodeNameTlv tlv2 = new NodeNameTlv(rawValue2, (short) 0); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OSPFareaIDsubTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OSPFareaIDsubTlvTest.java deleted file mode 100644 index 4b67a900..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OSPFareaIDsubTlvTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import com.google.common.testing.EqualsTester; - -import org.junit.Test; -import org.onosproject.pcepio.types.OSPFareaIDsubTlv; - -/** - * Test of the OSPFareaIDsubTlv. - */ -public class OSPFareaIDsubTlvTest { - private final int rawValue1 = 0x0A; - - private final OSPFareaIDsubTlv tlv1 = new OSPFareaIDsubTlv(rawValue1); - private final OSPFareaIDsubTlv tlv2 = OSPFareaIDsubTlv.of(tlv1.getInt()); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OpaqueLinkAttributeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OpaqueLinkAttributeTlvTest.java deleted file mode 100644 index cda77a02..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/OpaqueLinkAttributeTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.OpaqueLinkAttributeTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the OpaqueLinkAttributeTlv. - */ -public class OpaqueLinkAttributeTlvTest { - private final byte[] rawValue1 = new byte[] {0x01, 0x02}; - private final byte[] rawValue2 = new byte[] {0x14, 0x15}; - - private final OpaqueLinkAttributeTlv tlv1 = new OpaqueLinkAttributeTlv(rawValue1, (short) rawValue1.length); - private final OpaqueLinkAttributeTlv sameAsTlv1 = OpaqueLinkAttributeTlv.of(tlv1.getValue(), tlv1.getLength()); - private final OpaqueLinkAttributeTlv tlv2 = new OpaqueLinkAttributeTlv(rawValue2, (short) 0); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathKeySubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathKeySubObjectTest.java deleted file mode 100644 index cab43794..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathKeySubObjectTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PathKeySubObject; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the PathKeySubObject. - */ -public class PathKeySubObjectTest { - - private final PathKeySubObject tlv1 = new PathKeySubObject((short) 0x0A, 0x0A); - private final PathKeySubObject sameAsTlv1 = PathKeySubObject.of((short) 0x0A, 0x0A); - private final PathKeySubObject tlv2 = new PathKeySubObject((short) 0x0B, 0x0B); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java deleted file mode 100644 index e56c96e5..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PathSetupTypeTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the PathSetupTypeTlv. - */ -public class PathSetupTypeTlvTest { - - private final PathSetupTypeTlv tlv1 = PathSetupTypeTlv.of(0x0A); - private final PathSetupTypeTlv sameAsTlv1 = PathSetupTypeTlv.of(0x0A); - private final PathSetupTypeTlv tlv2 = PathSetupTypeTlv.of(0x0B); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PceccCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PceccCapabilityTlvTest.java deleted file mode 100644 index a8d521a9..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PceccCapabilityTlvTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PceccCapabilityTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the PceccCapabilityTlv. - */ -public class PceccCapabilityTlvTest { - private final int rawValue1 = 0x0A; - private final int rawValue2 = 0x0B; - - private final PceccCapabilityTlv tlv1 = new PceccCapabilityTlv(rawValue1); - private final PceccCapabilityTlv sameAsTlv1 = new PceccCapabilityTlv(rawValue1); - private final PceccCapabilityTlv tlv2 = PceccCapabilityTlv.of(rawValue2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepCloseMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepCloseMsgTest.java deleted file mode 100644 index 8faab559..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepCloseMsgTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepCloseMsg; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -public class PcepCloseMsgTest { - - /** - * Common header, reason to close. - */ - @Test - public void closeMessageTest1() throws PcepParseException { - - byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, 0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 }; - - byte[] testCloseMsg = {0 }; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(closeMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message; - - message = reader.readFrom(buffer); - assertThat(message, instanceOf(PcepCloseMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testCloseMsg = buf.array(); - - int readLen = buf.writerIndex(); - testCloseMsg = new byte[readLen]; - buf.readBytes(testCloseMsg, 0, readLen); - assertThat(testCloseMsg, is(closeMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepErrorMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepErrorMsgTest.java deleted file mode 100644 index 2fc1fedf..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepErrorMsgTest.java +++ /dev/null @@ -1,739 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepErrorMsg; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -/** - * Test cases for PCEP ERROR Message. - */ -public class PcepErrorMsgTest { - - /** - * This test case checks for - * PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, - * PCECC-CAPABILITY-TLV, TED Capability TLV) - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest1() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x34, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x28, // OPEN object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV - 0x00, 0x00, 0x00, 0x00}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, - * PCECC-CAPABILITY-TLV, TED Capability TLV) - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest2() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x28, // OPEN object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV - 0x00, 0x00, 0x00, 0x00}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, - * PCECC-CAPABILITY-TLV) - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest3() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x34, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x20, // OPEN object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x03}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV) - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest4() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2c, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x18, // OPEN object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY) - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest5() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x10, // OPEN object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest6() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x1C, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x08, // OPEN object header - 0x20, 0x05, 0x1E, 0x01 // OPEN object - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, OPEN Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest7() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x08, // OPEN object header - 0x20, 0x05, 0x1E, 0x01 // OPEN object - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, RP Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest8() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x20, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest9() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest10() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * TE Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest11() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x18, // common header - 0x65, 0x13, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * RP Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest12() throws PcepParseException { - - //RP Object, PCEP-ERROR Object - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x18, // common header - 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * RP Object, RP Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest13() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header - 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * TE Object, TE Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest14() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header - 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, TE Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest15() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x20, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x03}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest16() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2C, // common header - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest17() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2C, // common header - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x03}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest18() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x06}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest19() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x03, 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x06}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } - - /** - * This test case checks for - * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object, - * TE Object, PCEP-ERROR Object - * in PcepErrorMsg message. - */ - @Test - public void errorMessageTest20() throws PcepParseException { - - byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x48, // common header - 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header - 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x06, 0x65, 0x10, 0x00, 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header - 0x00, 0x00, 0x01, 0x06}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(errorMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testErrorMsg = {0}; - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - assertThat(message, instanceOf(PcepErrorMsg.class)); - - message.writeTo(buf); - int iReadLen = buf.writerIndex(); - testErrorMsg = new byte[iReadLen]; - buf.readBytes(testErrorMsg, 0, iReadLen); - - assertThat(testErrorMsg, is(errorMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgExtTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgExtTest.java deleted file mode 100644 index 9da4c62e..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgExtTest.java +++ /dev/null @@ -1,1686 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepInitiateMsg; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.Matchers.instanceOf; - -public class PcepInitiateMsgExtTest { - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST objects in PcInitiate message. - */ - @Test - public void initiateMessageTest1() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, - * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA4, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, //Metric object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, - * StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest2() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, - * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x48, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv - 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, - * ERO, LSPA, BANDWIDTH objects in PcInitiate message. - */ - @Test - public void initiateMessageTest3() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, - * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - // 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv - //0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), - * END-POINTS, ERO, LSPA objects in PcInitiate message. - */ - @Test - public void initiateMessageTest4() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, - * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - // 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv - // 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest5() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, - * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, - * BANDWIDTH OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest6() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, - * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, - * LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest7() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, - * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x98, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest8() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x90, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest9() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest10() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest11() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), - * END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7C, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest12() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x78, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest13() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest14() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest15() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest16() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest17() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, - * BANDWIDTH OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest18() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, - * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest19() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, - * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest20() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, - * BANDWIDTH OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest21() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, - * LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest22() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest23() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINTS, ERO, LSPA BANDWIDTH OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest25() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, - * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest26() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, - * ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x6C, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, - * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest27() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, - * LSPA, BANDWIDTH OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest28() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), - * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest29() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4C, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), - * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest30() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5C, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest31() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest32() throws PcepParseException { - - /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA, BANDWIDTH, METRIC OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest33() throws PcepParseException { - - /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA, BANDWIDTH OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest34() throws PcepParseException { - - /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest35() throws PcepParseException { - - /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA OBJECT objects in PcInitiate message. - */ - @Test - public void initiateMessageTest36() throws PcepParseException { - - /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, - * ERO, LSPA OBJECT. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object - 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } -} - diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java deleted file mode 100644 index a27b781f..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java +++ /dev/null @@ -1,1335 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepInitiateMsg; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -public class PcepInitiateMsgTest { - - /** - * This test case checks for srp, lsp, end-point, ERO objects in PcInitiate message. - */ - @Test - public void initiateMessageTest1() throws PcepParseException { - - /* srp, lsp, end-point, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, 0x54, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp and lsp objects in PcInitiate message. - */ - @Test - public void initiateMessageTest2() throws PcepParseException { - /* srp, lsp. - */ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x20, 0x10, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - 0x01, 0x01, 0x01, 0x01, 0x00, 0x43, (byte) 0x83, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33}; //SymbolicPathTlv - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO objects - * in PcInitiate message. - */ - @Test - public void initiateMessageTest3() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), END-POINT, ERO objects in PcInitiate message. - */ - @Test - public void initiateMessageTest4() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), END-POINT, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * END-POINT, ERO objects in PcInitiate message. - */ - @Test - public void initiateMessageTest5() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * END-POINT, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * END-POINT, ERO objects in PcInitiate message. - */ - @Test - public void initiateMessageTest6() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * END-POINT, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINT, ERO objects in PcInitiate message. - */ - @Test - public void initiateMessageTest7() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * END-POINT, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * END-POINT, ERO objects in PcInitiate message. - */ - @Test - public void initiateMessageTest8() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * END-POINT, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * END-POINT, ERO objects in PcInitiate message. - */ - @Test - public void initiateMessageTest9() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * END-POINT, ERO. - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x3c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv) - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest10() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv). - */ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, - (byte) 0xb6, 0x02, 0x4e, 0x20, 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08 //StatefulLspErrorCodeTlv - }; - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv) objects in PcInitiate message. - */ - @Test - public void initiateMessageTest11() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - StatefulLspErrorCodeTlv).*/ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08}; //StatefulLspErrorCodeTlv - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest12() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv). - */ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00 //SymbolicPathNameTlv - }; - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest13() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv). - */ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00}; //SymbolicPathNameTlv - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest14() throws PcepParseException { - - /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv). - */ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20}; - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv) - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest15() throws PcepParseException { - - /* SRP, LSP (StatefulIPv4LspIdentidiersTlv). - */ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x2c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20}; - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest16() throws PcepParseException { - - //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest17() throws PcepParseException { - - //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest18() throws PcepParseException { - //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest19() throws PcepParseException { - //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x04, //ERO object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp, - * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) objects in PcInitiate message. - */ - @Test - public void initiateMessageTest20() throws PcepParseException { - /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp, - * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv). - */ - byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x64, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20}; - - byte[] testInitiateDeletionMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateDeletionMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateDeletionMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateDeletionMsg = new byte[iReadLen]; - buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); - - assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); - } - - /** - * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest21() throws PcepParseException { - /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, - * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x94, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest22() throws PcepParseException { - /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, - * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest23() throws PcepParseException { - /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, - * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth - */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xB0, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest24() throws PcepParseException { - /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, - * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth*/ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xBC, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth, - * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest25() throws PcepParseException { - - /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth, - * srp,lsp(StatefulIPv4LspIdentidiersTlv), - * end-point,ero,lspa,bandwidth,metric-list */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xC4, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list, - * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest26() throws PcepParseException { - - /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list, - * srp,lsp(StatefulIPv4LspIdentidiersTlv), - * end-point,ero,lspa,bandwidth,metric-list */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xD0, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } - - /** - * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list, - * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list - * objects in PcInitiate message. - */ - @Test - public void initiateMessageTest27() throws PcepParseException { - - /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list, - * srp,lsp(StatefulIPv4LspIdentidiersTlv), - * end-point,ero,lspa,bandwidth,metric-list */ - byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xE4, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testInitiateCreationMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(initiateCreationMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepInitiateMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testInitiateCreationMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testInitiateCreationMsg = new byte[iReadLen]; - buf.readBytes(testInitiateCreationMsg, 0, iReadLen); - - assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepKeepaliveMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepKeepaliveMsgTest.java deleted file mode 100644 index a35c8af5..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepKeepaliveMsgTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Assert; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -public class PcepKeepaliveMsgTest { - - /** - * Common header for keep alive message. - */ - @Test - public void keepaliveMessageTest1() throws PcepParseException { - - byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 }; - - byte[] testKeepaliveMsg = {0 }; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(keepaliveMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - assertThat(message, instanceOf(PcepKeepaliveMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - - message.writeTo(buf); - - testKeepaliveMsg = buf.array(); - - int iReadLen = buf.writerIndex(); - testKeepaliveMsg = new byte[iReadLen]; - buf.readBytes(testKeepaliveMsg, 0, iReadLen); - - Assert.assertThat(testKeepaliveMsg, is(keepaliveMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepLabelUpdateMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepLabelUpdateMsgTest.java deleted file mode 100644 index d6ec350c..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepLabelUpdateMsgTest.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepLabelUpdateMsg; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; - -public class PcepLabelUpdateMsgTest { - - /** - * This test case checks for - * SRP, LSP, LABEL Object. - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest1() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x24, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x01, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } - - /** - * This test case checks for - * SRP, LSP, LABEL Object, LABEL Object. - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest2() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x30, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x01, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x77}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } - - /** - * This test case checks for - * SRP, LABEL, FEC Object. - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest3() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x24, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x24, 0x10, 0x00, 0x08, // FEC Object Header - 0x0A, 0x0A, 0x0B, 0x0B}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } - - /** - * This test case checks for - * SRP, LSP, LABEL, LABEL, SRP, LSP, LABEL - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest4() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x50, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x01, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x77, - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x11, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x02, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x44}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } - - /** - * This test case checks for - * SRP, LABEL, FEC, SRP, LABEL, FEC. - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest5() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x44, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x66, - 0x24, 0x10, 0x00, 0x08, // FEC Object Header - 0x0A, 0x0A, 0x0B, 0x0B, - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x11, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x24, 0x10, 0x00, 0x08, // FEC Object Header - 0x0A, 0x0A, 0x0C, 0x0C}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } - - /** - * This test case checks for - * SRP, LSP, LABEL, LABEL, SRP, LABEL, FEC. - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest6() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x50, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x01, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x77, - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x12, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x24, 0x10, 0x00, 0x08, // FEC Object Header - 0x0A, 0x0A, 0x0D, 0x0D}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } - - /** - * This test case checks for - * SRP, LABEL, FEC, SRP, LSP, LABEL, LABEL. - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest7() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x50, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x12, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x24, 0x10, 0x00, 0x08, // FEC Object Header - 0x0A, 0x0A, 0x0D, 0x0D, - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x01, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x77}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } - - /** - * This test case checks for - * SRP, LABEL, FEC, SRP, LSP, LABEL, LABEL. - * SRP, LSP, LABEL, LABEL. - * in PcepLabelUpdate message. - */ - @Test - public void labelUpdateMessageTest8() throws PcepParseException { - - byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x7C, // common header - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x12, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x24, 0x10, 0x00, 0x08, // FEC Object Header - 0x0A, 0x0A, 0x0D, 0x0D, - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x01, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x77, - 0x21, 0x10, 0x00, 0x0C, // SRP Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, - 0x20, 0x10, 0x00, 0x08, // LSP Object Header - 0x00, 0x01, 0x00, 0x00, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x66, - 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x77}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(labelUpdate); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testLabelUpdateMsg = {0}; - - assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testLabelUpdateMsg = new byte[readLen]; - buf.readBytes(testLabelUpdateMsg, 0, readLen); - - assertThat(testLabelUpdateMsg, is(labelUpdate)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4AdjacencyTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4AdjacencyTest.java deleted file mode 100644 index 390f5738..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4AdjacencyTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PcepNaiIpv4Adjacency; - -import com.google.common.testing.EqualsTester; - -/** - * Equality test for PcepNaiIpv4Adjacency. - */ -public class PcepNaiIpv4AdjacencyTest { - - private final PcepNaiIpv4Adjacency obj1 = PcepNaiIpv4Adjacency.of(2, 16); - private final PcepNaiIpv4Adjacency sameAsObj1 = PcepNaiIpv4Adjacency.of(2, 16); - private final PcepNaiIpv4Adjacency obj2 = PcepNaiIpv4Adjacency.of(3, 16); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(obj1, sameAsObj1).addEqualityGroup(obj2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4NodeIdTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4NodeIdTest.java deleted file mode 100644 index bcd69bea..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv4NodeIdTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PcepNaiIpv4NodeId; - -import com.google.common.testing.EqualsTester; - -public class PcepNaiIpv4NodeIdTest { - - private final PcepNaiIpv4NodeId tlv1 = PcepNaiIpv4NodeId.of(1); - private final PcepNaiIpv4NodeId tlv2 = PcepNaiIpv4NodeId.of(1); - private final PcepNaiIpv4NodeId tlv3 = PcepNaiIpv4NodeId.of(3); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, tlv2) - .addEqualityGroup(tlv3) - .testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6AdjacencyTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6AdjacencyTest.java deleted file mode 100644 index 5b68193d..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6AdjacencyTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PcepNaiIpv6Adjacency; - -import com.google.common.testing.EqualsTester; - -public class PcepNaiIpv6AdjacencyTest { - private final byte[] localIpv6Addr1 = {(byte) 0x01010101 }; - private final byte[] remoteIpv6Addr1 = {(byte) 0x02020202 }; - private final byte[] localIpv6Addr2 = {(byte) 0x01010101 }; - private final byte[] remoteIpv6Addr2 = {(byte) 0x02020202 }; - private final byte[] localIpv6Addr3 = {(byte) 0x05050505 }; - private final byte[] remoteIpv6Addr3 = {(byte) 0x06060606 }; - - private final PcepNaiIpv6Adjacency tlv1 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); - private final PcepNaiIpv6Adjacency tlv2 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); - private final PcepNaiIpv6Adjacency tlv3 = PcepNaiIpv6Adjacency.of(localIpv6Addr3, remoteIpv6Addr3); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } -} \ No newline at end of file diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6NodeIdTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6NodeIdTest.java deleted file mode 100644 index bf458940..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiIpv6NodeIdTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PcepNaiIpv6NodeId; - -import com.google.common.testing.EqualsTester; - -/** - * Equality test for PcepNaiIpv6NodeId. - */ -public class PcepNaiIpv6NodeIdTest { - - private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, - 0x00, 0x00 }; - private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, - 0x00, 0x00 }; - - private final PcepNaiIpv6NodeId tlv1 = PcepNaiIpv6NodeId.of(b1); - private final PcepNaiIpv6NodeId sameAsTlv1 = PcepNaiIpv6NodeId.of(b1); - private final PcepNaiIpv6NodeId tlv2 = PcepNaiIpv6NodeId.of(b2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiUnnumberedAdjacencyIpv4Test.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiUnnumberedAdjacencyIpv4Test.java deleted file mode 100644 index d45bae8b..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepNaiUnnumberedAdjacencyIpv4Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.PcepNaiUnnumberedAdjacencyIpv4; - -import com.google.common.testing.EqualsTester; - -public class PcepNaiUnnumberedAdjacencyIpv4Test { - - private final int localNodeId1 = 1; - private final int localInterfaceId1 = 1; - private final int remoteNodeId1 = 1; - private final int remoteInterfaceId1 = 1; - private final PcepNaiUnnumberedAdjacencyIpv4 tlv1 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId1, - localInterfaceId1, remoteNodeId1, remoteInterfaceId1); - - private final int localNodeId2 = 1; - private final int localInterfaceId2 = 1; - private final int remoteNodeId2 = 1; - private final int remoteInterfaceId2 = 1; - private final PcepNaiUnnumberedAdjacencyIpv4 tlv2 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId2, - localInterfaceId2, remoteNodeId2, remoteInterfaceId2); - - private final int localNodeId3 = 2; - private final int localInterfaceId3 = 2; - private final int remoteNodeId3 = 2; - private final int remoteInterfaceId3 = 2; - - private final PcepNaiUnnumberedAdjacencyIpv4 tlv3 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId3, - localInterfaceId3, remoteNodeId3, remoteInterfaceId3); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepOpenMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepOpenMsgTest.java deleted file mode 100644 index 1aff4962..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepOpenMsgTest.java +++ /dev/null @@ -1,562 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; -import org.onosproject.pcepio.protocol.PcepOpenMsg; -/** - * Test cases for PCEP OPEN Message. - */ -public class PcepOpenMsgTest { - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, - * PCECC-CAPABILITY-TLV in Pcep Open message. - */ - @Test - public void openMessageTest1() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x10, 0x00, 0x20, 0x20, 0x1e, 0x78, (byte) 0xbd, - 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY - 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV - 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV - }; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY-TLV in Pcep Open message. - */ - @Test - public void openMessageTest2() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x14, // common header - 0x01, 0x10, 0x00, 0x10, // common object header - 0x20, 0x1E, 0x78, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f}; // STATEFUL-PCE-CAPABILITY - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with GmplsCapability tlv in Pcep Open message. - */ - @Test - public void openMessageTest3() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x14, // common header - 0x01, 0x10, 0x00, 0x10, // common object header - 0x20, 0x1E, 0x78, 0x01, // OPEN object - 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}; //GMPLS-CAPABILITY-TLV - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with StatefulLspDbVer Tlv in Pcep Open message. - */ - @Test - public void openMessageTest4() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x18, - 0x01, 0x10, 0x00, 0x14, 0x20, 0x1e, 0x78, 0x20, - 0x00, 0x17, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }; //StatefulLspDbVerTlv - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with no tlv's in Pcep Open message. - */ - @Test - public void openMessageTest5() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x0C, - 0x01, 0x10, 0x00, 0x08, 0x20, 0x1e, 0x78, (byte) 0xbd }; // no Tlvs in open messsage - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV - * with I bit set in Pcep Open message. - */ - @Test - public void openMessageTest6() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x11, 0x00, 0x20, //p bit not set & i bit set - 0x20, 0x1e, 0x78, (byte) 0xbd, - 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, // STATEFUL-PCE-CAPABILITY - 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV - 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV - }; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV - * with P bit set in Pcep Open message. - */ - @Test - public void openMessageTest7() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x12, 0x00, 0x20, //p bit set & i bit not set - 0x20, 0x1e, 0x78, (byte) 0xbd, - 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY - 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV - 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV - }; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV - * with P & I bits set in Pcep Open message. - */ - @Test - public void openMessageTest8() throws PcepParseException { - - /* OPEN OBJECT (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV) - with p bit set & i bit set. - */ - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x13, 0x00, 0x20, //p bit set & i bit set - 0x20, 0x1e, 0x78, (byte) 0xbd, - 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY - 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV - 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV - }; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV - * with P & I bits set and invalid session id in Pcep Open message. - */ - @Test - public void openMessageTest9() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x13, 0x00, 0x20, //p bit set & i bit set - 0x20, 0x1e, 0x78, 0x00, //invalid sessionID - 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY - 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV - 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV - }; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV - * in Pcep Open message. - */ - @Test - public void openMessageTest10() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x1C, // common header - 0x01, 0x10, 0x00, 0x18, // common object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, - 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00}; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, - * PCECC-CAPABILITY-TLV, TED Capability TLV in Pcep Open message. - */ - @Test - public void openMessageTest11() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x2C, // common header - 0x01, 0x10, 0x00, 0x28, // common object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV - 0x00, 0x00, 0x00, 0x00 }; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, - * PCECC-CAPABILITY-TLV in Pcep Open message. - */ - @Test - public void openMessageTest12() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, // common header - 0x01, 0x10, 0x00, 0x20, // common object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x03}; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV - * in Pcep Open message. - */ - @Test - public void openMessageTest13() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x1c, // common header - 0x01, 0x10, 0x00, 0x18, // common object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV - 0x00, 0x00, 0x00, 0x00}; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with STATEFUL-PCE-CAPABILITY in Pcep Open message. - */ - @Test - public void openMessageTest14() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x14, // common header - 0x01, 0x10, 0x00, 0x10, // common object header - 0x20, 0x05, 0x1E, 0x01, // OPEN object - 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY - 0x00, 0x00, 0x00, 0x05}; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - - assertThat(testOpenMsg, is(openMsg)); - - } - - /** - * This test case checks open object with no tlv Pcep Open message. - */ - @Test - public void openMessageTest15() throws PcepParseException { - - byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x0c, // common header - 0x01, 0x10, 0x00, 0x08, // common object header - 0x20, 0x05, 0x1E, 0x01 // OPEN object - }; - - byte[] testOpenMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(openMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepOpenMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testOpenMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testOpenMsg = new byte[readLen]; - buf.readBytes(testOpenMsg, 0, readLen); - assertThat(testOpenMsg, is(openMsg)); - - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgExtTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgExtTest.java deleted file mode 100644 index 346caf87..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgExtTest.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; -import org.onosproject.pcepio.protocol.PcepReportMsg; - -public class PcepReportMsgExtTest { - - /** - * This test case checks forSRP Object,LSP Object(symbolic path tlv),ERO Object - * SRP Object,LSP Object(symbolic path tlv,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest39() throws PcepParseException { - - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x98, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object - * SRP Object,LSP Object(symbolic path tlv),ERO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest40() throws PcepParseException { - - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object - * SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object - * in PcRpt message. - */ - @Test - public void reportMessageTest41() throws PcepParseException { - - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object, - * Metric-list SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object,Metric-list, - * RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest42() throws PcepParseException { - - byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xE8, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv - 0x07, 0x10, 0x00, 0x14, //ERO object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgTest.java deleted file mode 100644 index 237e617f..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepReportMsgTest.java +++ /dev/null @@ -1,1601 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; -import org.onosproject.pcepio.protocol.PcepReportMsg; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -public class PcepReportMsgTest { - - /** - * This test case checks for SRP object, LSP object(Symbolic path name tlv), ERO object - * in PcRpt message. - */ - @Test - public void reportMessageTest1() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, 0x24, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x04}; //ERO Object - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv - * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list, IRO object - * in PcRpt message. - */ - @Test - public void reportMessageTest2() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object // LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // IPv4SubObjects - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - }; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) - * ERO Object, LSPA Object, Metric-list, IRO object - * in PcRpt message. - */ - @Test - public void reportMessageTest3() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - }; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) - * ERO Object, LSPA Object, Metric-list - * in PcRpt message. - */ - @Test - public void reportMessageTest4() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv - * StatefulLspErrorCodeTlv) ERO Object, IRO object - * in PcRpt message. - */ - @Test - public void reportMessageTest5() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv - * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list. - * in PcRpt message. - */ - @Test - public void reportMessageTest6() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x04, //ERO Object - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - }; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object, ERO Object, LSPA Object, Metric-list, IRO object - * in PcRpt message. - */ - @Test - public void reportMessageTest7() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, // Metric objects - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP object, LSP object( StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv) ERO object, LSPA object, Metric object - * in PcRpt message. - */ - @Test - public void reportMessageTest8() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, - * StatefulLspErrorCodeTlv ),ERO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest9() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(StatefulIPv4LspIdentidiersTlv)ERO Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest10() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(SymbolicPathNameTlv)ERO Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest11() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object, ERO Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest12() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(StatefulLspErrorCodeTlv)ERO Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest13() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(StatefulRsvpErrorSpecTlv),ERO Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest14() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),LSPA Object,ERO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest15() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7C, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),BandWidth Object,ERO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest16() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest17() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object,ERO Object,BandWidth Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest18() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object,ERO Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest19() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6C, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest20() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x88, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, - * StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest21() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xac, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) - * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest22() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xA0, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) - * ERO Object,BandWidth Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest23() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) - * ERO Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest24() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x84, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) - * ERO Object,LSPA Object,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest25() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) - * ERO Object,LSPA Object - * in PcRpt message. - */ - @Test - public void reportMessageTest26() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv) - * ERO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest27() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) - * LSPA Object,BandWidth Object,Metric-list,ERO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest28() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest29() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object - * SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest30() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xE4, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object - * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) - * ERO Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest31() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object - * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) - * ERO Object,LSPA Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest32() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x14, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object - * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) - * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object - * in PcRpt message. - */ - @Test - public void reportMessageTest33() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x1c, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object(symbolic path Tlv),ERO Object,LSPA Object - * BandWidth Object,Metric-list,SRP Object,LSP Object(symbolic path tlv) - * ERO Object,LSPA Object,BandWidth Object,Metric-list - * in PcRpt message. - */ - @Test - public void reportMessageTest34() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xB4, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x04, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } - - /** - * This test case checks for SRP Object,LSP Object)Symbolic path tlv),ERO Object,SRP Object - * LSP Object(symbolic path tlv) ERO Object,LSPA Object, BandWidth Object,Metric-list - * in PcRpt message. - */ - @Test - public void reportMessageTest35() throws PcepParseException { - - byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8C, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, //ERO Object - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, - 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, //LSPA Object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object - - byte[] testReportMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(reportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(reportMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepTEReportMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepTEReportMsgTest.java deleted file mode 100644 index b800e05e..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepTEReportMsgTest.java +++ /dev/null @@ -1,1600 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; -import org.onosproject.pcepio.protocol.PcepTEReportMsg; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -public class PcepTEReportMsgTest { - - /** - * This test case checks for - * TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)). - * in PcTERpt message. - */ - @Test - public void teReportMessageTest1() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header - 0x0E, 0x10, 0x00, 0x24, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x08, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv - 0x00, 0x00, 0x00, 0x11}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID. - * in PcTERpt message. - */ - @Test - public void teReportMessageTest2() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header - 0x0E, 0x10, 0x00, 0x24, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x08, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for TE Object (Routing Universe TLV) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest3() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x1c, // common header - 0x0E, 0x10, 0x00, 0x18, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. - * OSPFareaIDsubTlv, RouterIDSubTlv)). - * in PcTERpt message. - */ - @Test - public void teReportMessageTest4() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x44, // common header - 0x0E, 0x10, 0x00, 0x40, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest5() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x3C, // common header - 0x0E, 0x10, 0x00, 0x38, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x1C, // Local TE Node Descriptors TLV - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv, - * RouterIDSubTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest6() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x34, // common header - 0x0E, 0x10, 0x00, 0x30, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x14, // Local TE Node Descriptors TLV - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)). - * in PcTERpt message. - */ - @Test - public void teReportMessageTest7() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x2C, // common header - 0x0E, 0x10, 0x00, 0x28, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11}; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest8() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x20, // common header - 0x0E, 0x10, 0x00, 0x1C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x00 // Local TE Node Descriptors TLV - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. - * OSPFareaIDsubTlv, RouterIDSubTlv)). - * in PcTERpt message. - */ - @Test - public void teReportMessageTest9() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x6C, // common header - 0x0E, 0x10, 0x00, 0x68, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest10() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x64, // common header - 0x0E, 0x10, 0x00, 0x60, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x1C, //RemoteTENodeDescriptorsTLV - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest11() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x5C, // common header - 0x0E, 0x10, 0x00, 0x58, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x14, //RemoteTENodeDescriptorsTLV - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest12() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x54, // common header - 0x0E, 0x10, 0x00, 0x50, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x0c, //RemoteTENodeDescriptorsTLV - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest13() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x48, // common header - 0x0E, 0x10, 0x00, 0x44, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x00, //RemoteTENodeDescriptorsTLV - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest14() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x8C, // common header - 0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV( - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest15() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x80, // common header - 0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x10, //TELinkDescriptorsTLV - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest16() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x78, // common header - 0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x08, //TELinkDescriptorsTLV - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest17() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x70, // common header - 0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x00, //TELinkDescriptorsTLV - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest18() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header - 0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x30, //TENodeAttributesTlv - 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv - (byte) 0x90, 0x00, 0x00, 0x00, - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv - 0x08, 0x00, 0x01, 0x09, - 0x08, 0x00, 0x01, 0x09, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv - * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest19() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header - 0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x30, //TENodeAttributesTlv - 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv - (byte) 0x90, 0x00, 0x00, 0x00, - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv - 0x08, 0x00, 0x01, 0x09, - 0x08, 0x00, 0x01, 0x09, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv - * NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest20() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xB8, // common header - 0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv - 0x08, 0x00, 0x01, 0x09, - 0x08, 0x00, 0x01, 0x09, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv - * ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest21() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xAC, // common header - 0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x1C, //TENodeAttributesTlv - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv. - * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv). - * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv. - * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv. - * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv. - * OpaqueLinkAttributeTlv, LinkNameTlv)). - * in PcTERpt message. - */ - @Test - public void teReportMessageTest22() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x120, // common header - 0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv - 0x08, 0x00, 0x01, 0x09, - 0x08, 0x00, 0x01, 0x09, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02, - 0x07, 0x69, 0x00, 0x64, //TELinkAttributesTlv - 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv - 0x00, 0x07, 0x08, 0x00, - 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv - 0x00, 0x09, 0x08, 0x00, - 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv - 0x00, 0x09, 0x00, 0x00, - 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv - 0x00, 0x10, 0x00, 0x00, - 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv - 0x00, 0x00, (byte) 0x90, 0x00, - 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv - 0x00, (byte) 0x99, 0x09, 0x00, - 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv - 0x09, 0x00, 0x00, 0x00, - 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv - (byte) 0x80, 0x00, 0x00, 0x00, - 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv - 0x09, (byte) 0x89, 0x07, 0x00, - 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv - 0x04, 0x47, 0x00, 0x03, - 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv - 0x04, 0x49, 0x00, 0x04, - 0x04, 0x47, 0x00, 0x03, - 0x04, 0x4A, 0x00, 0x04, //LinkNameTlv - 0x04, 0x47, 0x00, 0x03 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv - * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) - * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv - * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv - * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv - * OpaqueLinkAttributeTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest23() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x118, // common header - 0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv - 0x08, 0x00, 0x01, 0x09, - 0x08, 0x00, 0x01, 0x09, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02, - 0x07, 0x69, 0x00, 0x5C, //TELinkAttributesTlv - 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv - 0x00, 0x07, 0x08, 0x00, - 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv - 0x00, 0x09, 0x08, 0x00, - 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv - 0x00, 0x09, 0x00, 0x00, - 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv - 0x00, 0x10, 0x00, 0x00, - 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv - 0x00, 0x00, (byte) 0x90, 0x00, - 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv - 0x00, (byte) 0x99, 0x09, 0x00, - 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv - 0x09, 0x00, 0x00, 0x00, - 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv - (byte) 0x80, 0x00, 0x00, 0x00, - 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv - 0x09, (byte) 0x89, 0x07, 0x00, - 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv - 0x04, 0x47, 0x00, 0x03, - 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv - 0x04, 0x49, 0x00, 0x04, - 0x04, 0x47, 0x00, 0x03 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv - * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) - * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv - * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv - * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest24() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x110, // common header - 0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv - 0x08, 0x00, 0x01, 0x09, - 0x08, 0x00, 0x01, 0x09, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02, - 0x07, 0x69, 0x00, 0x54, //TELinkAttributesTlv - 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv - 0x00, 0x07, 0x08, 0x00, - 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv - 0x00, 0x09, 0x08, 0x00, - 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv - 0x00, 0x09, 0x00, 0x00, - 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv - 0x00, 0x10, 0x00, 0x00, - 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv - 0x00, 0x00, (byte) 0x90, 0x00, - 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv - 0x00, (byte) 0x99, 0x09, 0x00, - 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv - 0x09, 0x00, 0x00, 0x00, - 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv - (byte) 0x80, 0x00, 0x00, 0x00, - 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv - 0x09, (byte) 0x89, 0x07, 0x00, - 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv - 0x04, 0x47, 0x00, 0x03, - 0x04, 0x47, 0x00, 0x03 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } - - /** - * This test case checks for - * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv - * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv - * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv - * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) - * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv - * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv - * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv)) - * in PcTERpt message. - */ - @Test - public void teReportMessageTest25() throws PcepParseException { - - byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x104, // common header - 0x0E, 0x10, 0x01, 0x00, // TE Object Header - 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID - 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV - 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv - 0x00, 0x00, 0x00, 0x11, - 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv - 0x00, 0x00, 0x00, 0x11, - 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv - 0x00, 0x00, 0x00, 0x11, - 0x00, 0x00, 0x00, 0x11, - 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV - 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv - 0x01, 0x11, 0x00, 0x09, - 0x01, 0x21, 0x00, 0x09, - 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv - 0x01, 0x01, 0x01, 0x01, - 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv - 0x01, 0x011, 0x01, 0x10, - 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv - 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv - 0x01, 0x011, 0x01, 0x10, - 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv - 0x08, 0x00, 0x01, 0x09, - 0x08, 0x00, 0x01, 0x09, - 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv - 0x20, 0x01, 0x22, 0x01, - 0x20, 0x01, 0x22, 0x01, - 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv - 0x00, 0x01, 0x01, 0x02, - 0x07, 0x69, 0x00, 0x48, //TELinkAttributesTlv - 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv - 0x00, 0x07, 0x08, 0x00, - 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv - 0x00, 0x09, 0x08, 0x00, - 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv - 0x00, 0x09, 0x00, 0x00, - 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv - 0x00, 0x10, 0x00, 0x00, - 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv - 0x00, 0x00, (byte) 0x90, 0x00, - 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv - 0x00, (byte) 0x99, 0x09, 0x00, - 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv - 0x09, 0x00, 0x00, 0x00, - 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv - (byte) 0x80, 0x00, 0x00, 0x00, - 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv - 0x09, (byte) 0x89, 0x07, 0x00 - }; - - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(teReportMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - byte[] testReportMsg = {0}; - - assertThat(message, instanceOf(PcepTEReportMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - - int readLen = buf.writerIndex(); - testReportMsg = new byte[readLen]; - buf.readBytes(testReportMsg, 0, readLen); - - assertThat(testReportMsg, is(teReportMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgExtTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgExtTest.java deleted file mode 100644 index 1f956173..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgExtTest.java +++ /dev/null @@ -1,1275 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import static org.hamcrest.core.Is.is; -import static org.hamcrest.Matchers.instanceOf; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; - -import static org.hamcrest.MatcherAssert.assertThat; - -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; -import org.onosproject.pcepio.protocol.PcepUpdateMsg; - -/** - * Test cases for PCEP update message. - */ -public class PcepUpdateMsgExtTest { - - /** - * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object, - * Metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest1() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x8c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, - * LSPA, Bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest2() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSP object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object, ERO object, LSPA, bandwidth object - * Metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest3() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,bandwidth object - * Metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest4() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,bandwidth object - * Metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest5() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, LSPA, bandwidth object - * Metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest6() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, - * bandwidth object Metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest7() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest8() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest9() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x18, 0x00, 0x00, 0x10, 0x03, - 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv - 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest10() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPa object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest11() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest12() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,LSPA - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest13() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest14() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object, ERO object,LSPA - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest15() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //lspa object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,LSPA - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest16() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest17() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest18() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest19() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, - * Bandwidth , metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest20() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object, ERO object, - * Bandwidth , metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest21() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object, - * Bandwidth , metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest22() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object, - * Bandwidth , metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest23() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, - * Bandwidth , metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest24() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, - * Bandwidth , metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest25() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, - * LSPA object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest26() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object, ERO object, - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest27() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x34, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object, - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest28() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, - * lspa object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest29() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, - * bandwidth object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest30() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, - * metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest31() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object, - * Metric object in PcepUpdate message. - */ - @Test - public void pcepUpdateMsgTest32() throws PcepParseException { - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } -} - diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java deleted file mode 100644 index e965bfeb..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java +++ /dev/null @@ -1,1427 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.core.Is.is; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import static org.hamcrest.MatcherAssert.assertThat; -import org.junit.Test; -import org.onosproject.pcepio.exceptions.PcepParseException; -import org.onosproject.pcepio.protocol.PcepFactories; -import org.onosproject.pcepio.protocol.PcepMessage; -import org.onosproject.pcepio.protocol.PcepMessageReader; -import org.onosproject.pcepio.protocol.PcepUpdateMsg; - -public class PcepUpdateMsgTest { - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), ERO in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest1() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x30, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv - 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x04 }; //ERO object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP(SymbolicPathNameTlv), LSP (StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO, LSPA, Metric-list in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest2() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x94, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object // lsp object - 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv - 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x24, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, - 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), - * ERO objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest3() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x38, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x04 }; //ERO object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv), ERO objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest4() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x04 }; //ERO object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv), ERO objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest5() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x04 }; //ERO object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest6() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x04 }; - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest7() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x04}; //ERO object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO (IPv4SubObject) objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest8() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x0c, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00 }; - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject) objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest9() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00 }; - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject), LSPA objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest10() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x6c, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest11() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest12() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest13() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric Object objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest14() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), - * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest15() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest16() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject),LSPA objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest17() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x05, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject),Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest18() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject),Metric-list objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest19() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv),ERO (IPv4SubObject, IPv4SubObject),LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest20() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject), Bandwidth objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest21() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest22() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5C, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest23() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest24() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest25() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, - * Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest26() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, - * StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, - * Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest27() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, - * SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject), - * LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest28() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest29() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv - (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, - (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP, - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest30() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (StatefulLspErrorCodeTlv), - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest31() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP, - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest32() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x8, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv), - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest33() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, - 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } - - /** - * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), - * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. - */ - @Test - public void pcepUpdateMsgTest34() throws PcepParseException { - - byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, - 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object - 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv - 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object - 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, - 0x01, 0x01, 0x04, 0x00, - 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object - 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object - - byte[] testupdateMsg = {0}; - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); - buffer.writeBytes(updateMsg); - - PcepMessageReader reader = PcepFactories.getGenericReader(); - PcepMessage message = null; - - message = reader.readFrom(buffer); - - assertThat(message, instanceOf(PcepUpdateMsg.class)); - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); - message.writeTo(buf); - testupdateMsg = buf.array(); - - int readLen = buf.writerIndex() - 0; - testupdateMsg = new byte[readLen]; - buf.readBytes(testupdateMsg, 0, readLen); - - assertThat(testupdateMsg, is(updateMsg)); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTlvTest.java deleted file mode 100644 index 3b189c0b..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTlvTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import java.util.LinkedList; - -import org.junit.Test; -import org.onosproject.pcepio.types.AutonomousSystemTlv; -import org.onosproject.pcepio.types.BGPLSidentifierTlv; -import org.onosproject.pcepio.types.PcepValueType; -import org.onosproject.pcepio.types.RemoteTENodeDescriptorsTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for Remote TE Node Descriptors tlv. - */ -public class RemoteTENodeDescriptorsTlvTest { - - private final AutonomousSystemTlv autonomousSystemTlv1 = new AutonomousSystemTlv(10); - private final BGPLSidentifierTlv bGPLSidentifierTlv1 = new BGPLSidentifierTlv(20); - - private final AutonomousSystemTlv autonomousSystemTlv2 = new AutonomousSystemTlv(20); - private final BGPLSidentifierTlv bGPLSidentifierTlv2 = new BGPLSidentifierTlv(30); - - private final LinkedList llRemoteTENodeDescriptorSubTLV1 = new LinkedList<>(); - private final boolean a = llRemoteTENodeDescriptorSubTLV1.add(autonomousSystemTlv1); - private final boolean b = llRemoteTENodeDescriptorSubTLV1.add(bGPLSidentifierTlv1); - - private final LinkedList llRemoteTENodeDescriptorSubTLV2 = new LinkedList<>(); - private final boolean c = llRemoteTENodeDescriptorSubTLV2.add(autonomousSystemTlv2); - private final boolean d = llRemoteTENodeDescriptorSubTLV2.add(bGPLSidentifierTlv2); - - private final RemoteTENodeDescriptorsTlv tlv1 = RemoteTENodeDescriptorsTlv.of(llRemoteTENodeDescriptorSubTLV1); - private final RemoteTENodeDescriptorsTlv sameAsTlv1 = - RemoteTENodeDescriptorsTlv.of(llRemoteTENodeDescriptorSubTLV1); - private final RemoteTENodeDescriptorsTlv tlv2 = RemoteTENodeDescriptorsTlv.of(llRemoteTENodeDescriptorSubTLV2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java deleted file mode 100644 index 022fd414..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.RouterIDSubTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for Router ID Sub tlv. - */ -public class RouterIDSubTlvTest { - - private final byte[] value1 = {1, 2 }; - private final Short length1 = 2; - private final RouterIDSubTlv tlv1 = RouterIDSubTlv.of(value1, length1); - - private final Short length2 = 2; - private final RouterIDSubTlv tlv2 = RouterIDSubTlv.of(value1, length2); - - private final byte[] value3 = {1, 2, 3 }; - private final Short length3 = 3; - private final RouterIDSubTlv tlv3 = RouterIDSubTlv.of(value3, length3); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RoutingUniverseTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RoutingUniverseTlvTest.java deleted file mode 100644 index 9b119c90..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/RoutingUniverseTlvTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.RoutingUniverseTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Equality test for RoutingUniverseTlv. - */ -public class RoutingUniverseTlvTest { - - private final RoutingUniverseTlv tlv1 = RoutingUniverseTlv.of(2); - private final RoutingUniverseTlv tlv2 = RoutingUniverseTlv.of(2); - private final RoutingUniverseTlv tlv3 = RoutingUniverseTlv.of(3); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java deleted file mode 100644 index ad62f61b..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.SharedRiskLinkGroupTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for Shared Risk Link Group tlv. - */ -public class SharedRiskLinkGroupTlvTest { - - private final int[] raw = {1 }; - private final Short hLength = 2; - private final SharedRiskLinkGroupTlv tlv1 = SharedRiskLinkGroupTlv.of(raw, hLength); - - private final SharedRiskLinkGroupTlv sameAsTlv1 = SharedRiskLinkGroupTlv.of(raw, hLength); - - private final int[] raw2 = {2 }; - private final Short hLength2 = 3; - private final SharedRiskLinkGroupTlv tlv2 = SharedRiskLinkGroupTlv.of(raw2, hLength2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SrEroSubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SrEroSubObjectTest.java deleted file mode 100644 index 47ea5842..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SrEroSubObjectTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.protocol.PcepNai; -import org.onosproject.pcepio.types.SrEroSubObject; - -import com.google.common.testing.EqualsTester; - -public class SrEroSubObjectTest { - - private final boolean bFFlag = false; - private final boolean bSFlag = false; - private final boolean bCFlag = false; - private final boolean bMFlag = false; - private final byte st = 1; - private final int sID = 1; - private final PcepNai nai = null; - - private final SrEroSubObject tlv1 = SrEroSubObject.of(st, bFFlag, bSFlag, bCFlag, bMFlag, sID, nai); - - private final boolean bFFlag1 = false; - private final boolean bSFlag1 = false; - private final boolean bCFlag1 = false; - private final boolean bMFlag1 = false; - private final byte st1 = 1; - private final int sID1 = 1; - private final PcepNai nai1 = null; - - private final SrEroSubObject tlv2 = SrEroSubObject.of(st1, bFFlag1, bSFlag1, bCFlag1, bMFlag1, sID1, nai1); - - private final boolean bFFlag2 = true; - private final boolean bSFlag2 = true; - private final boolean bCFlag2 = true; - private final boolean bMFlag2 = true; - private final byte st2 = 2; - private final int sID2 = 2; - private final PcepNai nai2 = null; - - private final SrEroSubObject tlv3 = SrEroSubObject.of(st2, bFFlag2, bSFlag2, bCFlag2, bMFlag2, sID2, nai2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulIPv4LspIdentidiersTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulIPv4LspIdentidiersTlvTest.java deleted file mode 100644 index f03c8ba3..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulIPv4LspIdentidiersTlvTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.StatefulIPv4LspIdentidiersTlv; - -import com.google.common.testing.EqualsTester; - -public class StatefulIPv4LspIdentidiersTlvTest { - - private final int ipv4IngressAddress = 1; - private final short lspId = 1; - private final short tunnelId = 1; - private final int extendedTunnelId = 1; - private final int ipv4EgressAddress = 1; - - private final StatefulIPv4LspIdentidiersTlv tlv1 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress, lspId, - tunnelId, extendedTunnelId, ipv4EgressAddress); - - private final int ipv4IngressAddress1 = 1; - private final short lspId1 = 1; - private final short tunnelId1 = 1; - private final int extendedTunnelId1 = 1; - private final int ipv4EgressAddress1 = 1; - - private final StatefulIPv4LspIdentidiersTlv tlv2 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress1, lspId1, - tunnelId1, extendedTunnelId1, ipv4EgressAddress1); - - private final int ipv4IngressAddress2 = 2; - private final short lspId2 = 2; - private final short tunnelId2 = 2; - private final int extendedTunnelId2 = 2; - private final int ipv4EgressAddress2 = 2; - - private final StatefulIPv4LspIdentidiersTlv tlv3 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress2, lspId2, - tunnelId2, extendedTunnelId2, ipv4EgressAddress2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspDbVerTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspDbVerTlvTest.java deleted file mode 100644 index 21bb3468..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspDbVerTlvTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.StatefulLspDbVerTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for Stateful Lsp Db Ver tlv. - */ -public class StatefulLspDbVerTlvTest { - - private final StatefulLspDbVerTlv tlv1 = StatefulLspDbVerTlv.of(1); - private final StatefulLspDbVerTlv tlv2 = StatefulLspDbVerTlv.of(1); - private final StatefulLspDbVerTlv tlv3 = StatefulLspDbVerTlv.of(2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspErrorCodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspErrorCodeTlvTest.java deleted file mode 100644 index 8137ca0c..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulLspErrorCodeTlvTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.StatefulLspErrorCodeTlv; -import com.google.common.testing.EqualsTester; - -public class StatefulLspErrorCodeTlvTest { - - private final StatefulLspErrorCodeTlv tlv1 = StatefulLspErrorCodeTlv.of(1); - private final StatefulLspErrorCodeTlv tlv2 = StatefulLspErrorCodeTlv.of(1); - private final StatefulLspErrorCodeTlv tlv3 = StatefulLspErrorCodeTlv.of(2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulPceCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulPceCapabilityTlvTest.java deleted file mode 100644 index 29018d55..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/StatefulPceCapabilityTlvTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.StatefulPceCapabilityTlv; -import com.google.common.testing.EqualsTester; - -/** - * Test case for Stateful Pce Capability tlv. - */ -public class StatefulPceCapabilityTlvTest { - - private final StatefulPceCapabilityTlv tlv1 = StatefulPceCapabilityTlv.of(1); - private final StatefulPceCapabilityTlv tlv2 = StatefulPceCapabilityTlv.of(1); - private final StatefulPceCapabilityTlv tlv3 = StatefulPceCapabilityTlv.of(2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SymbolicPathNameTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SymbolicPathNameTlvTest.java deleted file mode 100644 index 718bbb66..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/SymbolicPathNameTlvTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.SymbolicPathNameTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for Symbolic path tlv. - */ -public class SymbolicPathNameTlvTest { - - private final byte[] value1 = {0x41 }; - private final Short length1 = 2; - private final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1); - - private final byte[] value2 = {0x41 }; - private final Short length2 = 2; - private final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2); - - private final byte[] value3 = {0x41, 0x43 }; - private final Short length3 = 3; - private final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TEDefaultMetricTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TEDefaultMetricTlvTest.java deleted file mode 100644 index 32fa0af8..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TEDefaultMetricTlvTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.TEDefaultMetricTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for TE Default Metric tlv. - */ -public class TEDefaultMetricTlvTest { - - private final TEDefaultMetricTlv tlv1 = TEDefaultMetricTlv.of(1); - private final TEDefaultMetricTlv tlv2 = TEDefaultMetricTlv.of(1); - private final TEDefaultMetricTlv tlv3 = TEDefaultMetricTlv.of(2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } -} \ No newline at end of file diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java deleted file mode 100644 index 1e2101a9..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import java.util.LinkedList; - -import org.junit.Test; -import org.onosproject.pcepio.types.AdministrativeGroupTlv; -import org.onosproject.pcepio.types.MaximumReservableLinkBandwidthTlv; -import org.onosproject.pcepio.types.PcepValueType; -import org.onosproject.pcepio.types.TELinkAttributesTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for TE Link Attribute Tlv. - */ -public class TELinkAttributesTlvTest { - - private final AdministrativeGroupTlv administrativeGroupTlv1 = new AdministrativeGroupTlv(10); - private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv1 = - new MaximumReservableLinkBandwidthTlv(20); - - private final AdministrativeGroupTlv administrativeGroupTlv2 = new AdministrativeGroupTlv(20); - private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv2 = - new MaximumReservableLinkBandwidthTlv(30); - - private final LinkedList llLinkAttributesSubTLV1 = new LinkedList<>(); - private final boolean a = llLinkAttributesSubTLV1.add(administrativeGroupTlv1); - private final boolean b = llLinkAttributesSubTLV1.add(maximumReservableLinkBandwidthTlv1); - - private final LinkedList llLinkAttributesSubTLV2 = new LinkedList<>(); - - private final boolean c = llLinkAttributesSubTLV2.add(administrativeGroupTlv2); - private final boolean d = llLinkAttributesSubTLV2.add(maximumReservableLinkBandwidthTlv2); - - private final TELinkAttributesTlv tlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1); - private final TELinkAttributesTlv sameAsTlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1); - private final TELinkAttributesTlv tlv2 = TELinkAttributesTlv.of(llLinkAttributesSubTLV2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTlvTest.java deleted file mode 100644 index 89565b3f..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTlvTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import java.util.LinkedList; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv4InterfaceAddressTlv; -import org.onosproject.pcepio.types.LinkLocalRemoteIdentifiersTlv; -import org.onosproject.pcepio.types.PcepValueType; -import org.onosproject.pcepio.types.TELinkDescriptorsTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for TE link descriptors Tlv. - */ -public class TELinkDescriptorsTlvTest { - private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv1 = new - LinkLocalRemoteIdentifiersTlv(10, 10); - private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv1 = new IPv4InterfaceAddressTlv(0x01010101); - - private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv2 = new - LinkLocalRemoteIdentifiersTlv(20, 20); - private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv2 = new IPv4InterfaceAddressTlv(0x02020202); - - private final LinkedList llLinkDescriptorsSubTLVs1 = new LinkedList<>(); - private final boolean a = llLinkDescriptorsSubTLVs1.add(linkLocalRemoteIdentifiersTlv1); - private final boolean b = llLinkDescriptorsSubTLVs1.add(iPv4InterfaceAddressTlv1); - - private final LinkedList llLinkDescriptorsSubTLVs2 = new LinkedList<>(); - private final boolean c = llLinkDescriptorsSubTLVs2.add(linkLocalRemoteIdentifiersTlv2); - private final boolean d = llLinkDescriptorsSubTLVs2.add(iPv4InterfaceAddressTlv2); - - private final TELinkDescriptorsTlv tlv1 = TELinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs1); - private final TELinkDescriptorsTlv sameAstlv1 = TELinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs1); - private final TELinkDescriptorsTlv tlv2 = TELinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java deleted file mode 100644 index 17d44091..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import java.util.LinkedList; - -import org.junit.Test; -import org.onosproject.pcepio.types.IPv4TERouterIdOfLocalNodeTlv; -import org.onosproject.pcepio.types.NodeFlagBitsTlv; -import org.onosproject.pcepio.types.PcepValueType; -import org.onosproject.pcepio.types.TENodeAttributesTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for TE Node Attribute tlv. - */ -public class TENodeAttributesTlvTest { - - private final NodeFlagBitsTlv nodeFlagBitsTlv1 = new NodeFlagBitsTlv((byte) 10); - private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv1 = new - IPv4TERouterIdOfLocalNodeTlv(0x01010101); - - private final NodeFlagBitsTlv nodeFlagBitsTlv2 = new NodeFlagBitsTlv((byte) 20); - private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv2 = new - IPv4TERouterIdOfLocalNodeTlv(0x02020202); - - private final LinkedList llNodeAttributesSubTLV1 = new LinkedList<>(); - private final boolean a = llNodeAttributesSubTLV1.add(nodeFlagBitsTlv1); - private final boolean b = llNodeAttributesSubTLV1.add(iPv4TERouterIdOfLocalNodeTlv1); - - private final LinkedList llNodeAttributesSubTLV2 = new LinkedList<>(); - - private final boolean c = llNodeAttributesSubTLV2.add(nodeFlagBitsTlv2); - private final boolean d = llNodeAttributesSubTLV2.add(iPv4TERouterIdOfLocalNodeTlv2); - - private final TENodeAttributesTlv tlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1); - private final TENodeAttributesTlv sameAsTlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1); - private final TENodeAttributesTlv tlv2 = TENodeAttributesTlv.of(llNodeAttributesSubTLV2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TedCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TedCapabilityTlvTest.java deleted file mode 100644 index 4e18e867..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/TedCapabilityTlvTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.TedCapabilityTlv; - -import com.google.common.testing.EqualsTester; - -/** - * Test case for TED Capability tlv. - */ -public class TedCapabilityTlvTest { - - private final TedCapabilityTlv tlv1 = TedCapabilityTlv.of(1); - private final TedCapabilityTlv tlv2 = TedCapabilityTlv.of(1); - private final TedCapabilityTlv tlv3 = TedCapabilityTlv.of(2); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/UnreservedBandwidthTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/UnreservedBandwidthTlvTest.java deleted file mode 100644 index e4cb9b15..00000000 --- a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/UnreservedBandwidthTlvTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.pcepio; - -import org.junit.Test; -import org.onosproject.pcepio.types.UnreservedBandwidthTlv; -import com.google.common.testing.EqualsTester; - -/** - * Unit Test case for Unreserved Bandwidth Tlv. - */ -public class UnreservedBandwidthTlvTest { - - // Objects of unreserved bandwidth tlv - private final UnreservedBandwidthTlv tlv1 = UnreservedBandwidthTlv.of(100); - private final UnreservedBandwidthTlv tlv2 = UnreservedBandwidthTlv.of(100); - private final UnreservedBandwidthTlv tlv3 = UnreservedBandwidthTlv.of(200); - - @Test - public void basics() { - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); - } - -} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepCloseMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepCloseMsgTest.java new file mode 100644 index 00000000..33c00ddf --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepCloseMsgTest.java @@ -0,0 +1,56 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepCloseMsgTest { + + /** + * Common header, reason to close. + */ + @Test + public void closeMessageTest1() throws PcepParseException { + + byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, 0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 }; + + byte[] testCloseMsg = {0 }; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(closeMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message; + + message = reader.readFrom(buffer); + assertThat(message, instanceOf(PcepCloseMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testCloseMsg = buf.array(); + + int readLen = buf.writerIndex(); + testCloseMsg = new byte[readLen]; + buf.readBytes(testCloseMsg, 0, readLen); + assertThat(testCloseMsg, is(closeMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepErrorMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepErrorMsgTest.java new file mode 100644 index 00000000..234cea67 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepErrorMsgTest.java @@ -0,0 +1,735 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +/** + * Test cases for PCEP ERROR Message. + */ +public class PcepErrorMsgTest { + + /** + * This test case checks for + * PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, + * PCECC-CAPABILITY-TLV, TED Capability TLV) + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest1() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x34, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x28, // OPEN object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV + 0x00, 0x00, 0x00, 0x00}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, + * PCECC-CAPABILITY-TLV, TED Capability TLV) + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest2() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x28, // OPEN object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV + 0x00, 0x00, 0x00, 0x00}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, + * PCECC-CAPABILITY-TLV) + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest3() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x34, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x20, // OPEN object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x03}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV) + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest4() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2c, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x18, // OPEN object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY) + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest5() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x10, // OPEN object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest6() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x1C, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x08, // OPEN object header + 0x20, 0x05, 0x1E, 0x01 // OPEN object + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, OPEN Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest7() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x08, // OPEN object header + 0x20, 0x05, 0x1E, 0x01 // OPEN object + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, RP Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest8() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x20, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest9() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest10() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * TE Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest11() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x18, // common header + 0x65, 0x13, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * RP Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest12() throws PcepParseException { + + //RP Object, PCEP-ERROR Object + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x18, // common header + 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * RP Object, RP Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest13() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header + 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * TE Object, TE Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest14() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header + 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, TE Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest15() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x20, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x03}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest16() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2C, // common header + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest17() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x2C, // common header + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01, 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x03}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest18() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x06}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, PCEP-ERROR Object, TE Object, TE Object, PCEP-ERROR Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest19() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x3C, // common header + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x03, 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x11, // TE-ID + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x06}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } + + /** + * This test case checks for + * PCEP-ERROR Object, RP Object, RP Object, PCEP-ERROR Object, PCEP-ERROR Object, + * TE Object, PCEP-ERROR Object + * in PcepErrorMsg message. + */ + @Test + public void errorMessageTest20() throws PcepParseException { + + byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x48, // common header + 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header + 0x00, 0x00, 0x01, 0x01, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x00, 0x0C, // RP Object Header + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x04, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x06, 0x65, 0x10, 0x00, 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header + 0x00, 0x00, 0x01, 0x06}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(errorMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testErrorMsg = {0}; + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + assertThat(message, instanceOf(PcepErrorMsg.class)); + + message.writeTo(buf); + int iReadLen = buf.writerIndex(); + testErrorMsg = new byte[iReadLen]; + buf.readBytes(testErrorMsg, 0, iReadLen); + + assertThat(testErrorMsg, is(errorMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgExtTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgExtTest.java new file mode 100644 index 00000000..9341f326 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgExtTest.java @@ -0,0 +1,1683 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepInitiateMsgExtTest { + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST objects in PcInitiate message. + */ + @Test + public void initiateMessageTest1() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, + * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA4, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, //Metric object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, + * StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest2() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, + * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x48, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv + 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, + * ERO, LSPA, BANDWIDTH objects in PcInitiate message. + */ + @Test + public void initiateMessageTest3() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, + * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + // 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv + //0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), + * END-POINTS, ERO, LSPA objects in PcInitiate message. + */ + @Test + public void initiateMessageTest4() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, + * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + // 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv + // 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest5() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, + * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, + * BANDWIDTH OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest6() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, + * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, + * LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest7() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv, + * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x98, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest8() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x90, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest9() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest10() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest11() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), + * END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7C, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest12() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x78, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest13() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest14() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest15() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest16() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest17() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, + * BANDWIDTH OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest18() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, + * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest19() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, + * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest20() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, + * BANDWIDTH OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest21() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, + * LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest22() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest23() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINTS, ERO, LSPA BANDWIDTH OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest25() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, + * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest26() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, + * ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x6C, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, + * BANDWIDTH, METRIC OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest27() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, + * LSPA, BANDWIDTH OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest28() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest29() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4C, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), + * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest30() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5C, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest31() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest32() throws PcepParseException { + + /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA, BANDWIDTH, METRIC OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest33() throws PcepParseException { + + /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA, BANDWIDTH OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest34() throws PcepParseException { + + /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest35() throws PcepParseException { + + /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA OBJECT objects in PcInitiate message. + */ + @Test + public void initiateMessageTest36() throws PcepParseException { + + /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, + * ERO, LSPA OBJECT. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object + 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } +} + diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgTest.java new file mode 100644 index 00000000..0f8bb7ba --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgTest.java @@ -0,0 +1,1331 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepInitiateMsgTest { + + /** + * This test case checks for srp, lsp, end-point, ERO objects in PcInitiate message. + */ + @Test + public void initiateMessageTest1() throws PcepParseException { + + /* srp, lsp, end-point, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, 0x54, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp and lsp objects in PcInitiate message. + */ + @Test + public void initiateMessageTest2() throws PcepParseException { + /* srp, lsp. + */ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x20, 0x10, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + 0x01, 0x01, 0x01, 0x01, 0x00, 0x43, (byte) 0x83, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33}; //SymbolicPathTlv + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO objects + * in PcInitiate message. + */ + @Test + public void initiateMessageTest3() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), END-POINT, ERO objects in PcInitiate message. + */ + @Test + public void initiateMessageTest4() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), END-POINT, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * END-POINT, ERO objects in PcInitiate message. + */ + @Test + public void initiateMessageTest5() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * END-POINT, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * END-POINT, ERO objects in PcInitiate message. + */ + @Test + public void initiateMessageTest6() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * END-POINT, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINT, ERO objects in PcInitiate message. + */ + @Test + public void initiateMessageTest7() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * END-POINT, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * END-POINT, ERO objects in PcInitiate message. + */ + @Test + public void initiateMessageTest8() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * END-POINT, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * END-POINT, ERO objects in PcInitiate message. + */ + @Test + public void initiateMessageTest9() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * END-POINT, ERO. + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x3c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv) + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest10() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv). + */ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, + (byte) 0xb6, 0x02, 0x4e, 0x20, 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08 //StatefulLspErrorCodeTlv + }; + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv) objects in PcInitiate message. + */ + @Test + public void initiateMessageTest11() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + StatefulLspErrorCodeTlv).*/ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08}; //StatefulLspErrorCodeTlv + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest12() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv). + */ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00 //SymbolicPathNameTlv + }; + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest13() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv). + */ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00}; //SymbolicPathNameTlv + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest14() throws PcepParseException { + + /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv). + */ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20}; + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv) + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest15() throws PcepParseException { + + /* SRP, LSP (StatefulIPv4LspIdentidiersTlv). + */ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x2c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20}; + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest16() throws PcepParseException { + + //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest17() throws PcepParseException { + + //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest18() throws PcepParseException { + //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest19() throws PcepParseException { + //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x04, //ERO object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp, + * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) objects in PcInitiate message. + */ + @Test + public void initiateMessageTest20() throws PcepParseException { + /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp, + * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv). + */ + byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x64, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20}; + + byte[] testInitiateDeletionMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateDeletionMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateDeletionMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateDeletionMsg = new byte[iReadLen]; + buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); + + assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); + } + + /** + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest21() throws PcepParseException { + /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, + * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x94, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest22() throws PcepParseException { + /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, + * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest23() throws PcepParseException { + /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, + * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth + */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xB0, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest24() throws PcepParseException { + /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, + * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth*/ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xBC, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth, + * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest25() throws PcepParseException { + + /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth, + * srp,lsp(StatefulIPv4LspIdentidiersTlv), + * end-point,ero,lspa,bandwidth,metric-list */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xC4, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list, + * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest26() throws PcepParseException { + + /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list, + * srp,lsp(StatefulIPv4LspIdentidiersTlv), + * end-point,ero,lspa,bandwidth,metric-list */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xD0, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } + + /** + * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list, + * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list + * objects in PcInitiate message. + */ + @Test + public void initiateMessageTest27() throws PcepParseException { + + /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list, + * srp,lsp(StatefulIPv4LspIdentidiersTlv), + * end-point,ero,lspa,bandwidth,metric-list */ + byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xE4, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testInitiateCreationMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(initiateCreationMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepInitiateMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testInitiateCreationMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testInitiateCreationMsg = new byte[iReadLen]; + buf.readBytes(testInitiateCreationMsg, 0, iReadLen); + + assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepKeepaliveMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepKeepaliveMsgTest.java new file mode 100644 index 00000000..56cf06b4 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepKeepaliveMsgTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Assert; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepKeepaliveMsgTest { + + /** + * Common header for keep alive message. + */ + @Test + public void keepaliveMessageTest1() throws PcepParseException { + + byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 }; + + byte[] testKeepaliveMsg = {0 }; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(keepaliveMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + assertThat(message, instanceOf(PcepKeepaliveMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + + message.writeTo(buf); + + testKeepaliveMsg = buf.array(); + + int iReadLen = buf.writerIndex(); + testKeepaliveMsg = new byte[iReadLen]; + buf.readBytes(testKeepaliveMsg, 0, iReadLen); + + Assert.assertThat(testKeepaliveMsg, is(keepaliveMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepLabelUpdateMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepLabelUpdateMsgTest.java new file mode 100644 index 00000000..e1947bd7 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepLabelUpdateMsgTest.java @@ -0,0 +1,402 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.is; + +public class PcepLabelUpdateMsgTest { + + /** + * This test case checks for + * SRP, LSP, LABEL Object. + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest1() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x24, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x01, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } + + /** + * This test case checks for + * SRP, LSP, LABEL Object, LABEL Object. + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest2() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x30, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x01, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x77}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } + + /** + * This test case checks for + * SRP, LABEL, FEC Object. + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest3() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x24, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x24, 0x10, 0x00, 0x08, // FEC Object Header + 0x0A, 0x0A, 0x0B, 0x0B}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } + + /** + * This test case checks for + * SRP, LSP, LABEL, LABEL, SRP, LSP, LABEL + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest4() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x50, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x01, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x77, + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x11, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x02, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x44}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } + + /** + * This test case checks for + * SRP, LABEL, FEC, SRP, LABEL, FEC. + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest5() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x44, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x66, + 0x24, 0x10, 0x00, 0x08, // FEC Object Header + 0x0A, 0x0A, 0x0B, 0x0B, + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x11, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x24, 0x10, 0x00, 0x08, // FEC Object Header + 0x0A, 0x0A, 0x0C, 0x0C}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } + + /** + * This test case checks for + * SRP, LSP, LABEL, LABEL, SRP, LABEL, FEC. + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest6() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x50, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x01, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x77, + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x12, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x24, 0x10, 0x00, 0x08, // FEC Object Header + 0x0A, 0x0A, 0x0D, 0x0D}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } + + /** + * This test case checks for + * SRP, LABEL, FEC, SRP, LSP, LABEL, LABEL. + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest7() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x50, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x12, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x24, 0x10, 0x00, 0x08, // FEC Object Header + 0x0A, 0x0A, 0x0D, 0x0D, + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x01, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x77}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } + + /** + * This test case checks for + * SRP, LABEL, FEC, SRP, LSP, LABEL, LABEL. + * SRP, LSP, LABEL, LABEL. + * in PcepLabelUpdate message. + */ + @Test + public void labelUpdateMessageTest8() throws PcepParseException { + + byte[] labelUpdate = new byte[]{0x20, 0x0D, 0x00, 0x7C, // common header + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x12, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x24, 0x10, 0x00, 0x08, // FEC Object Header + 0x0A, 0x0A, 0x0D, 0x0D, + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x01, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x77, + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, + 0x20, 0x10, 0x00, 0x08, // LSP Object Header + 0x00, 0x01, 0x00, 0x00, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x66, + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x77}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(labelUpdate); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testLabelUpdateMsg = {0}; + + assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testLabelUpdateMsg = new byte[readLen]; + buf.readBytes(testLabelUpdateMsg, 0, readLen); + + assertThat(testLabelUpdateMsg, is(labelUpdate)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepOpenMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepOpenMsgTest.java new file mode 100644 index 00000000..6e0a0596 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepOpenMsgTest.java @@ -0,0 +1,558 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; +/** + * Test cases for PCEP OPEN Message. + */ +public class PcepOpenMsgTest { + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, + * PCECC-CAPABILITY-TLV in Pcep Open message. + */ + @Test + public void openMessageTest1() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x10, 0x00, 0x20, 0x20, 0x1e, 0x78, (byte) 0xbd, + 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY + 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV + 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV + }; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY-TLV in Pcep Open message. + */ + @Test + public void openMessageTest2() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x14, // common header + 0x01, 0x10, 0x00, 0x10, // common object header + 0x20, 0x1E, 0x78, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f}; // STATEFUL-PCE-CAPABILITY + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with GmplsCapability tlv in Pcep Open message. + */ + @Test + public void openMessageTest3() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x14, // common header + 0x01, 0x10, 0x00, 0x10, // common object header + 0x20, 0x1E, 0x78, 0x01, // OPEN object + 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}; //GMPLS-CAPABILITY-TLV + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with StatefulLspDbVer Tlv in Pcep Open message. + */ + @Test + public void openMessageTest4() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x18, + 0x01, 0x10, 0x00, 0x14, 0x20, 0x1e, 0x78, 0x20, + 0x00, 0x17, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }; //StatefulLspDbVerTlv + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with no tlv's in Pcep Open message. + */ + @Test + public void openMessageTest5() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x0C, + 0x01, 0x10, 0x00, 0x08, 0x20, 0x1e, 0x78, (byte) 0xbd }; // no Tlvs in open messsage + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV + * with I bit set in Pcep Open message. + */ + @Test + public void openMessageTest6() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x11, 0x00, 0x20, //p bit not set & i bit set + 0x20, 0x1e, 0x78, (byte) 0xbd, + 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, // STATEFUL-PCE-CAPABILITY + 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV + 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV + }; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV + * with P bit set in Pcep Open message. + */ + @Test + public void openMessageTest7() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x12, 0x00, 0x20, //p bit set & i bit not set + 0x20, 0x1e, 0x78, (byte) 0xbd, + 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY + 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV + 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV + }; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV + * with P & I bits set in Pcep Open message. + */ + @Test + public void openMessageTest8() throws PcepParseException { + + /* OPEN OBJECT (STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV) + with p bit set & i bit set. + */ + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x13, 0x00, 0x20, //p bit set & i bit set + 0x20, 0x1e, 0x78, (byte) 0xbd, + 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY + 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV + 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV + }; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV + * with P & I bits set and invalid session id in Pcep Open message. + */ + @Test + public void openMessageTest9() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x13, 0x00, 0x20, //p bit set & i bit set + 0x20, 0x1e, 0x78, 0x00, //invalid sessionID + 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY + 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV + 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV + }; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV + * in Pcep Open message. + */ + @Test + public void openMessageTest10() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x1C, // common header + 0x01, 0x10, 0x00, 0x18, // common object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, + 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00}; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, + * PCECC-CAPABILITY-TLV, TED Capability TLV in Pcep Open message. + */ + @Test + public void openMessageTest11() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x2C, // common header + 0x01, 0x10, 0x00, 0x28, // common object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x03, 0x00, (byte) 0x84, 0x00, 0x04, // TED Capability TLV + 0x00, 0x00, 0x00, 0x00 }; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, + * PCECC-CAPABILITY-TLV in Pcep Open message. + */ + @Test + public void openMessageTest12() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, // common header + 0x01, 0x10, 0x00, 0x20, // common object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // PCECC-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x03}; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV + * in Pcep Open message. + */ + @Test + public void openMessageTest13() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x1c, // common header + 0x01, 0x10, 0x00, 0x18, // common object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV + 0x00, 0x00, 0x00, 0x00}; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with STATEFUL-PCE-CAPABILITY in Pcep Open message. + */ + @Test + public void openMessageTest14() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x14, // common header + 0x01, 0x10, 0x00, 0x10, // common object header + 0x20, 0x05, 0x1E, 0x01, // OPEN object + 0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY + 0x00, 0x00, 0x00, 0x05}; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + + assertThat(testOpenMsg, is(openMsg)); + + } + + /** + * This test case checks open object with no tlv Pcep Open message. + */ + @Test + public void openMessageTest15() throws PcepParseException { + + byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x0c, // common header + 0x01, 0x10, 0x00, 0x08, // common object header + 0x20, 0x05, 0x1E, 0x01 // OPEN object + }; + + byte[] testOpenMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(openMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepOpenMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testOpenMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testOpenMsg = new byte[readLen]; + buf.readBytes(testOpenMsg, 0, readLen); + assertThat(testOpenMsg, is(openMsg)); + + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgExtTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgExtTest.java new file mode 100644 index 00000000..f9921efd --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgExtTest.java @@ -0,0 +1,218 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepReportMsgExtTest { + + /** + * This test case checks forSRP Object,LSP Object(symbolic path tlv),ERO Object + * SRP Object,LSP Object(symbolic path tlv,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest39() throws PcepParseException { + + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x98, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object + * SRP Object,LSP Object(symbolic path tlv),ERO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest40() throws PcepParseException { + + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object + * SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object + * in PcRpt message. + */ + @Test + public void reportMessageTest41() throws PcepParseException { + + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object, + * Metric-list SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object,Metric-list, + * RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest42() throws PcepParseException { + + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xE8, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv + 0x07, 0x10, 0x00, 0x14, //ERO object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgTest.java new file mode 100644 index 00000000..c9e2bc8b --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgTest.java @@ -0,0 +1,1597 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepReportMsgTest { + + /** + * This test case checks for SRP object, LSP object(Symbolic path name tlv), ERO object + * in PcRpt message. + */ + @Test + public void reportMessageTest1() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, 0x24, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x04}; //ERO Object + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv + * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list, IRO object + * in PcRpt message. + */ + @Test + public void reportMessageTest2() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object // LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // IPv4SubObjects + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + }; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) + * ERO Object, LSPA Object, Metric-list, IRO object + * in PcRpt message. + */ + @Test + public void reportMessageTest3() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + }; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) + * ERO Object, LSPA Object, Metric-list + * in PcRpt message. + */ + @Test + public void reportMessageTest4() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv + * StatefulLspErrorCodeTlv) ERO Object, IRO object + * in PcRpt message. + */ + @Test + public void reportMessageTest5() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv + * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list. + * in PcRpt message. + */ + @Test + public void reportMessageTest6() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x04, //ERO Object + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + }; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object, ERO Object, LSPA Object, Metric-list, IRO object + * in PcRpt message. + */ + @Test + public void reportMessageTest7() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, // Metric objects + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP object, LSP object( StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv) ERO object, LSPA object, Metric object + * in PcRpt message. + */ + @Test + public void reportMessageTest8() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, + * StatefulLspErrorCodeTlv ),ERO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest9() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(StatefulIPv4LspIdentidiersTlv)ERO Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest10() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(SymbolicPathNameTlv)ERO Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest11() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object, ERO Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest12() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(StatefulLspErrorCodeTlv)ERO Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest13() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(StatefulRsvpErrorSpecTlv),ERO Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest14() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),LSPA Object,ERO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest15() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7C, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),BandWidth Object,ERO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest16() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest17() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object,ERO Object,BandWidth Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest18() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object,ERO Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest19() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6C, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest20() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x88, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, + * StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest21() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xac, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) + * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest22() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xA0, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) + * ERO Object,BandWidth Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest23() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) + * ERO Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest24() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x84, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) + * ERO Object,LSPA Object,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest25() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) + * ERO Object,LSPA Object + * in PcRpt message. + */ + @Test + public void reportMessageTest26() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv) + * ERO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest27() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) + * LSPA Object,BandWidth Object,Metric-list,ERO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest28() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest29() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object + * SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest30() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xE4, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object + * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) + * ERO Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest31() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object + * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) + * ERO Object,LSPA Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest32() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x14, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object + * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) + * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object + * in PcRpt message. + */ + @Test + public void reportMessageTest33() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x1c, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object(symbolic path Tlv),ERO Object,LSPA Object + * BandWidth Object,Metric-list,SRP Object,LSP Object(symbolic path tlv) + * ERO Object,LSPA Object,BandWidth Object,Metric-list + * in PcRpt message. + */ + @Test + public void reportMessageTest34() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xB4, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x04, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } + + /** + * This test case checks for SRP Object,LSP Object)Symbolic path tlv),ERO Object,SRP Object + * LSP Object(symbolic path tlv) ERO Object,LSPA Object, BandWidth Object,Metric-list + * in PcRpt message. + */ + @Test + public void reportMessageTest35() throws PcepParseException { + + byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8C, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, //ERO Object + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, //LSPA Object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object + + byte[] testReportMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(reportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(reportMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepTEReportMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepTEReportMsgTest.java new file mode 100644 index 00000000..e401c159 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepTEReportMsgTest.java @@ -0,0 +1,1596 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepTEReportMsgTest { + + /** + * This test case checks for + * TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)). + * in PcTERpt message. + */ + @Test + public void teReportMessageTest1() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header + 0x0E, 0x10, 0x00, 0x24, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x08, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv + 0x00, 0x00, 0x00, 0x11}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID. + * in PcTERpt message. + */ + @Test + public void teReportMessageTest2() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header + 0x0E, 0x10, 0x00, 0x24, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x08, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for TE Object (Routing Universe TLV) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest3() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x1c, // common header + 0x0E, 0x10, 0x00, 0x18, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. + * OSPFareaIDsubTlv, RouterIDSubTlv)). + * in PcTERpt message. + */ + @Test + public void teReportMessageTest4() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x44, // common header + 0x0E, 0x10, 0x00, 0x40, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest5() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x3C, // common header + 0x0E, 0x10, 0x00, 0x38, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x1C, // Local TE Node Descriptors TLV + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv, + * RouterIDSubTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest6() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x34, // common header + 0x0E, 0x10, 0x00, 0x30, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x14, // Local TE Node Descriptors TLV + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)). + * in PcTERpt message. + */ + @Test + public void teReportMessageTest7() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x2C, // common header + 0x0E, 0x10, 0x00, 0x28, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11}; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest8() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x20, // common header + 0x0E, 0x10, 0x00, 0x1C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x00 // Local TE Node Descriptors TLV + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. + * OSPFareaIDsubTlv, RouterIDSubTlv)). + * in PcTERpt message. + */ + @Test + public void teReportMessageTest9() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x6C, // common header + 0x0E, 0x10, 0x00, 0x68, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest10() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x64, // common header + 0x0E, 0x10, 0x00, 0x60, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x1C, //RemoteTENodeDescriptorsTLV + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest11() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x5C, // common header + 0x0E, 0x10, 0x00, 0x58, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x14, //RemoteTENodeDescriptorsTLV + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest12() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x54, // common header + 0x0E, 0x10, 0x00, 0x50, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x0c, //RemoteTENodeDescriptorsTLV + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest13() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x48, // common header + 0x0E, 0x10, 0x00, 0x44, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x00, //RemoteTENodeDescriptorsTLV + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest14() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x8C, // common header + 0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV( + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest15() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x80, // common header + 0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x10, //TELinkDescriptorsTLV + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest16() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x78, // common header + 0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x08, //TELinkDescriptorsTLV + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest17() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x70, // common header + 0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x00, //TELinkDescriptorsTLV + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest18() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header + 0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x30, //TENodeAttributesTlv + 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv + (byte) 0x90, 0x00, 0x00, 0x00, + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv + 0x08, 0x00, 0x01, 0x09, + 0x08, 0x00, 0x01, 0x09, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest19() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header + 0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x30, //TENodeAttributesTlv + 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv + (byte) 0x90, 0x00, 0x00, 0x00, + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv + 0x08, 0x00, 0x01, 0x09, + 0x08, 0x00, 0x01, 0x09, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv + * NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest20() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xB8, // common header + 0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv + 0x08, 0x00, 0x01, 0x09, + 0x08, 0x00, 0x01, 0x09, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv + * ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest21() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xAC, // common header + 0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x1C, //TENodeAttributesTlv + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv. + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv). + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv. + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv. + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv. + * OpaqueLinkAttributeTlv, LinkNameTlv)). + * in PcTERpt message. + */ + @Test + public void teReportMessageTest22() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x120, // common header + 0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv + 0x08, 0x00, 0x01, 0x09, + 0x08, 0x00, 0x01, 0x09, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02, + 0x07, 0x69, 0x00, 0x64, //TELinkAttributesTlv + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv + 0x00, 0x07, 0x08, 0x00, + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv + 0x00, 0x09, 0x08, 0x00, + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv + 0x00, 0x09, 0x00, 0x00, + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv + 0x00, 0x10, 0x00, 0x00, + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv + 0x00, 0x00, (byte) 0x90, 0x00, + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv + 0x00, (byte) 0x99, 0x09, 0x00, + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv + 0x09, 0x00, 0x00, 0x00, + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv + (byte) 0x80, 0x00, 0x00, 0x00, + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv + 0x09, (byte) 0x89, 0x07, 0x00, + 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv + 0x04, 0x47, 0x00, 0x03, + 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv + 0x04, 0x49, 0x00, 0x04, + 0x04, 0x47, 0x00, 0x03, + 0x04, 0x4A, 0x00, 0x04, //LinkNameTlv + 0x04, 0x47, 0x00, 0x03 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv + * OpaqueLinkAttributeTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest23() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x118, // common header + 0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv + 0x08, 0x00, 0x01, 0x09, + 0x08, 0x00, 0x01, 0x09, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02, + 0x07, 0x69, 0x00, 0x5C, //TELinkAttributesTlv + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv + 0x00, 0x07, 0x08, 0x00, + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv + 0x00, 0x09, 0x08, 0x00, + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv + 0x00, 0x09, 0x00, 0x00, + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv + 0x00, 0x10, 0x00, 0x00, + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv + 0x00, 0x00, (byte) 0x90, 0x00, + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv + 0x00, (byte) 0x99, 0x09, 0x00, + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv + 0x09, 0x00, 0x00, 0x00, + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv + (byte) 0x80, 0x00, 0x00, 0x00, + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv + 0x09, (byte) 0x89, 0x07, 0x00, + 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv + 0x04, 0x47, 0x00, 0x03, + 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv + 0x04, 0x49, 0x00, 0x04, + 0x04, 0x47, 0x00, 0x03 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest24() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x110, // common header + 0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv + 0x08, 0x00, 0x01, 0x09, + 0x08, 0x00, 0x01, 0x09, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02, + 0x07, 0x69, 0x00, 0x54, //TELinkAttributesTlv + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv + 0x00, 0x07, 0x08, 0x00, + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv + 0x00, 0x09, 0x08, 0x00, + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv + 0x00, 0x09, 0x00, 0x00, + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv + 0x00, 0x10, 0x00, 0x00, + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv + 0x00, 0x00, (byte) 0x90, 0x00, + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv + 0x00, (byte) 0x99, 0x09, 0x00, + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv + 0x09, 0x00, 0x00, 0x00, + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv + (byte) 0x80, 0x00, 0x00, 0x00, + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv + 0x09, (byte) 0x89, 0x07, 0x00, + 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv + 0x04, 0x47, 0x00, 0x03, + 0x04, 0x47, 0x00, 0x03 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } + + /** + * This test case checks for + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv)) + * in PcTERpt message. + */ + @Test + public void teReportMessageTest25() throws PcepParseException { + + byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x104, // common header + 0x0E, 0x10, 0x01, 0x00, // TE Object Header + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv + 0x00, 0x00, 0x00, 0x11, + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv + 0x00, 0x00, 0x00, 0x11, + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv + 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x11, + 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv + 0x01, 0x11, 0x00, 0x09, + 0x01, 0x21, 0x00, 0x09, + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv + 0x01, 0x01, 0x01, 0x01, + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv + 0x01, 0x011, 0x01, 0x10, + 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv + 0x01, 0x011, 0x01, 0x10, + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv + 0x08, 0x00, 0x01, 0x09, + 0x08, 0x00, 0x01, 0x09, + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv + 0x20, 0x01, 0x22, 0x01, + 0x20, 0x01, 0x22, 0x01, + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv + 0x00, 0x01, 0x01, 0x02, + 0x07, 0x69, 0x00, 0x48, //TELinkAttributesTlv + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv + 0x00, 0x07, 0x08, 0x00, + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv + 0x00, 0x09, 0x08, 0x00, + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv + 0x00, 0x09, 0x00, 0x00, + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv + 0x00, 0x10, 0x00, 0x00, + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv + 0x00, 0x00, (byte) 0x90, 0x00, + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv + 0x00, (byte) 0x99, 0x09, 0x00, + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv + 0x09, 0x00, 0x00, 0x00, + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv + (byte) 0x80, 0x00, 0x00, 0x00, + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv + 0x09, (byte) 0x89, 0x07, 0x00 + }; + + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(teReportMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + byte[] testReportMsg = {0}; + + assertThat(message, instanceOf(PcepTEReportMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + + int readLen = buf.writerIndex(); + testReportMsg = new byte[readLen]; + buf.readBytes(testReportMsg, 0, readLen); + + assertThat(testReportMsg, is(teReportMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgExtTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgExtTest.java new file mode 100644 index 00000000..40234a69 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgExtTest.java @@ -0,0 +1,1269 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +/** + * Test cases for PCEP update message. + */ +public class PcepUpdateMsgExtTest { + + /** + * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object, + * Metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest1() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x8c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, + * LSPA, Bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest2() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSP object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object, ERO object, LSPA, bandwidth object + * Metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest3() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,bandwidth object + * Metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest4() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,bandwidth object + * Metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest5() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, LSPA, bandwidth object + * Metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest6() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, + * bandwidth object Metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest7() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest8() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest9() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x18, 0x00, 0x00, 0x10, 0x03, + 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv + 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest10() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPa object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest11() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest12() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,LSPA + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest13() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest14() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object, ERO object,LSPA + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest15() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //lspa object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,LSPA + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest16() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest17() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest18() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest19() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, + * Bandwidth , metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest20() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object, ERO object, + * Bandwidth , metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest21() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object, + * Bandwidth , metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest22() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object, + * Bandwidth , metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest23() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, + * Bandwidth , metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest24() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, + * Bandwidth , metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest25() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, + * LSPA object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest26() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object, ERO object, + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest27() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x34, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object, + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest28() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, + * lspa object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest29() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, + * bandwidth object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest30() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, + * metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest31() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object, + * Metric object in PcepUpdate message. + */ + @Test + public void pcepUpdateMsgTest32() throws PcepParseException { + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } +} + diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgTest.java new file mode 100644 index 00000000..1db30641 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepUpdateMsgTest.java @@ -0,0 +1,1423 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Test; +import org.onosproject.pcepio.exceptions.PcepParseException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.core.Is.is; + +public class PcepUpdateMsgTest { + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), ERO in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest1() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x30, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv + 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x04 }; //ERO object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP(SymbolicPathNameTlv), LSP (StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO, LSPA, Metric-list in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest2() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x94, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object // lsp object + 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv + 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x24, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), + * ERO objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest3() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x38, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x04 }; //ERO object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv), ERO objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest4() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x04 }; //ERO object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv), ERO objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest5() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x04 }; //ERO object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest6() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x04 }; + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest7() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x04}; //ERO object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO (IPv4SubObject) objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest8() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x0c, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00 }; + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject) objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest9() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00 }; + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject), LSPA objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest10() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x6c, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest11() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest12() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest13() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric Object objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest14() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), + * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest15() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest16() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject),LSPA objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest17() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x05, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject),Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest18() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject),Metric-list objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest19() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv),ERO (IPv4SubObject, IPv4SubObject),LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest20() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject), Bandwidth objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest21() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest22() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5C, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest23() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest24() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv) + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest25() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, + * Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest26() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, + * StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, + * Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest27() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, + * SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject), + * LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest28() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest29() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP, + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest30() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (StatefulLspErrorCodeTlv), + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest31() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP, + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest32() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x8, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv), + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest33() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } + + /** + * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), + * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. + */ + @Test + public void pcepUpdateMsgTest34() throws PcepParseException { + + byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, + 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv + 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, + 0x01, 0x01, 0x04, 0x00, + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object + + byte[] testupdateMsg = {0}; + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); + buffer.writeBytes(updateMsg); + + PcepMessageReader reader = PcepFactories.getGenericReader(); + PcepMessage message = null; + + message = reader.readFrom(buffer); + + assertThat(message, instanceOf(PcepUpdateMsg.class)); + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + message.writeTo(buf); + testupdateMsg = buf.array(); + + int readLen = buf.writerIndex() - 0; + testupdateMsg = new byte[readLen]; + buf.readBytes(testupdateMsg, 0, readLen); + + assertThat(testupdateMsg, is(updateMsg)); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AdministrativeGroupTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AdministrativeGroupTlvTest.java new file mode 100644 index 00000000..41e88445 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AdministrativeGroupTlvTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the AdministrativeGroupTlv. + */ +public class AdministrativeGroupTlvTest { + private final AdministrativeGroupTlv tlv1 = AdministrativeGroupTlv.of(1); + private final AdministrativeGroupTlv sameAsTlv1 = AdministrativeGroupTlv.of(1); + private final AdministrativeGroupTlv tlv2 = AdministrativeGroupTlv.of(2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AutonomousSystemTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AutonomousSystemTlvTest.java new file mode 100644 index 00000000..904a71ef --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/AutonomousSystemTlvTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the AutonomousSystemTlv. + */ +public class AutonomousSystemTlvTest { + private final AutonomousSystemTlv tlv1 = AutonomousSystemTlv.of(1); + private final AutonomousSystemTlv sameAsTlv1 = AutonomousSystemTlv.of(1); + private final AutonomousSystemTlv tlv2 = AutonomousSystemTlv.of(2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/BGPLSidentifierTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/BGPLSidentifierTlvTest.java new file mode 100644 index 00000000..7ac6cea4 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/BGPLSidentifierTlvTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the BGPLSidentifierTlv. + */ +public class BGPLSidentifierTlvTest { + private final BGPLSidentifierTlv tlv1 = BGPLSidentifierTlv.of(1); + private final BGPLSidentifierTlv sameAsTlv1 = BGPLSidentifierTlv.of(1); + private final BGPLSidentifierTlv tlv2 = BGPLSidentifierTlv.of(2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/GmplsCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/GmplsCapabilityTlvTest.java new file mode 100644 index 00000000..7972712f --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/GmplsCapabilityTlvTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the GmplsCapabilityTlv. + */ +public class GmplsCapabilityTlvTest { + private final GmplsCapabilityTlv tlv1 = GmplsCapabilityTlv.of(1); + private final GmplsCapabilityTlv sameAsTlv1 = GmplsCapabilityTlv.of(1); + private final GmplsCapabilityTlv tlv2 = GmplsCapabilityTlv.of(2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IGPMetricTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IGPMetricTlvTest.java new file mode 100644 index 00000000..061a9cea --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IGPMetricTlvTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IGPMetricTlv. + */ +public class IGPMetricTlvTest { + private final byte[] b1 = new byte[] {0x01, 0x02}; + private final byte[] b2 = new byte[] {0x01, 0x02}; + private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2); + private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2); + private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4InterfaceAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4InterfaceAddressTlvTest.java new file mode 100644 index 00000000..eb3a16a8 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4InterfaceAddressTlvTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv4InterfaceAddressTlv. + */ +public class IPv4InterfaceAddressTlvTest { + + private final IPv4InterfaceAddressTlv tlv1 = IPv4InterfaceAddressTlv.of(2); + private final IPv4InterfaceAddressTlv sameAsTlv1 = IPv4InterfaceAddressTlv.of(2); + private final IPv4InterfaceAddressTlv tlv2 = IPv4InterfaceAddressTlv.of(3); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4NeighborAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4NeighborAddressTlvTest.java new file mode 100644 index 00000000..5f10b4c1 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4NeighborAddressTlvTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv4NeighborAddressTlv. + */ +public class IPv4NeighborAddressTlvTest { + + private final IPv4NeighborAddressTlv tlv1 = IPv4NeighborAddressTlv.of(2); + private final IPv4NeighborAddressTlv sameAsTlv1 = IPv4NeighborAddressTlv.of(2); + private final IPv4NeighborAddressTlv tlv2 = IPv4NeighborAddressTlv.of(3); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4SubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4SubObjectTest.java new file mode 100644 index 00000000..10f54015 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4SubObjectTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv4SubObject. + */ +public class IPv4SubObjectTest { + + private final IPv4SubObject subObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); + private final IPv4SubObject sameAsSubObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); + private final IPv4SubObject subObj2 = IPv4SubObject.of(3, (byte) 16, (byte) 0); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(subObj1, sameAsSubObj1) + .addEqualityGroup(subObj2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfLocalNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfLocalNodeTlvTest.java new file mode 100644 index 00000000..3880ca7f --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfLocalNodeTlvTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv4TERouterIdOfLocalNodeTlv. + */ +public class IPv4TERouterIdOfLocalNodeTlvTest { + + private final IPv4TERouterIdOfLocalNodeTlv tlv1 = IPv4TERouterIdOfLocalNodeTlv.of(2); + private final IPv4TERouterIdOfLocalNodeTlv sameAsTlv1 = IPv4TERouterIdOfLocalNodeTlv.of(2); + private final IPv4TERouterIdOfLocalNodeTlv tlv2 = IPv4TERouterIdOfLocalNodeTlv.of(3); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfRemoteNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfRemoteNodeTlvTest.java new file mode 100644 index 00000000..f40ede04 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv4TERouterIdOfRemoteNodeTlvTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv4TERouterIdOfRemoteNodeTlv. + */ +public class IPv4TERouterIdOfRemoteNodeTlvTest { + + private final IPv4TERouterIdOfRemoteNodeTlv tlv1 = IPv4TERouterIdOfRemoteNodeTlv.of(2); + private final IPv4TERouterIdOfRemoteNodeTlv sameAsTlv1 = IPv4TERouterIdOfRemoteNodeTlv.of(2); + private final IPv4TERouterIdOfRemoteNodeTlv tlv2 = IPv4TERouterIdOfRemoteNodeTlv.of(3); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6InterfaceAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6InterfaceAddressTlvTest.java new file mode 100644 index 00000000..aa2e5d9b --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6InterfaceAddressTlvTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv6InterfaceAddressTlv. + */ +public class IPv6InterfaceAddressTlvTest { + + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; + + private final IPv6InterfaceAddressTlv tlv1 = IPv6InterfaceAddressTlv.of(b1); + private final IPv6InterfaceAddressTlv sameAsTlv1 = IPv6InterfaceAddressTlv.of(b1); + private final IPv6InterfaceAddressTlv tlv2 = IPv6InterfaceAddressTlv.of(b2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6NeighborAddressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6NeighborAddressTlvTest.java new file mode 100644 index 00000000..65e257b0 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6NeighborAddressTlvTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv6NeighborAddressTlv. + */ +public class IPv6NeighborAddressTlvTest { + + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; + + private final IPv6NeighborAddressTlv tlv1 = IPv6NeighborAddressTlv.of(b1); + private final IPv6NeighborAddressTlv sameAsTlv1 = IPv6NeighborAddressTlv.of(b1); + private final IPv6NeighborAddressTlv tlv2 = IPv6NeighborAddressTlv.of(b2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6SubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6SubObjectTest.java new file mode 100644 index 00000000..f23b11d8 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6SubObjectTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv6SubObject. + */ +public class IPv6SubObjectTest { + + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; + + private final IPv6SubObject subObj1 = IPv6SubObject.of(b1); + private final IPv6SubObject sameAsSubObj1 = IPv6SubObject.of(b1); + private final IPv6SubObject subObj2 = IPv6SubObject.of(b2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(subObj1, sameAsSubObj1).addEqualityGroup(subObj2).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofLocalNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofLocalNodeTlvTest.java new file mode 100644 index 00000000..6516ed3d --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofLocalNodeTlvTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv6TERouterIdofLocalNodeTlv. + */ +public class IPv6TERouterIdofLocalNodeTlvTest { + + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; + + private final IPv6TERouterIdofLocalNodeTlv tlv1 = IPv6TERouterIdofLocalNodeTlv.of(b1); + private final IPv6TERouterIdofLocalNodeTlv sameAsTlv1 = IPv6TERouterIdofLocalNodeTlv.of(b1); + private final IPv6TERouterIdofLocalNodeTlv tlv2 = IPv6TERouterIdofLocalNodeTlv.of(b2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofRemoteNodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofRemoteNodeTlvTest.java new file mode 100644 index 00000000..f3828609 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/IPv6TERouterIdofRemoteNodeTlvTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the IPv6TERouterIdofRemoteNodeTlv. + */ +public class IPv6TERouterIdofRemoteNodeTlvTest { + + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; + + private final IPv6TERouterIdofRemoteNodeTlv tlv1 = IPv6TERouterIdofRemoteNodeTlv.of(b1); + private final IPv6TERouterIdofRemoteNodeTlv sameAsTlv1 = IPv6TERouterIdofRemoteNodeTlv.of(b1); + private final IPv6TERouterIdofRemoteNodeTlv tlv2 = IPv6TERouterIdofRemoteNodeTlv.of(b2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/ISISAreaIdentifierTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/ISISAreaIdentifierTlvTest.java new file mode 100644 index 00000000..17584ac1 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/ISISAreaIdentifierTlvTest.java @@ -0,0 +1,40 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the ISISAreaIdentifierTlv. + */ +public class ISISAreaIdentifierTlvTest { + + private final byte[] b1 = new byte[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; + private final byte[] b2 = new byte[] {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; + + private final ISISAreaIdentifierTlv tlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20); + private final ISISAreaIdentifierTlv sameAsTlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20); + private final ISISAreaIdentifierTlv tlv2 = ISISAreaIdentifierTlv.of(b2, (short) 20); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LabelSubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LabelSubObjectTest.java new file mode 100644 index 00000000..511d0a20 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LabelSubObjectTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the LabelSubObject. + */ +public class LabelSubObjectTest { + + private final LabelSubObject subObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); + private final LabelSubObject sameAsSubObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); + private final LabelSubObject subObj2 = LabelSubObject.of((byte) 0, (byte) 1, 30); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(subObj1, sameAsSubObj1) + .addEqualityGroup(subObj2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkLocalRemoteIdentifiersTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkLocalRemoteIdentifiersTlvTest.java new file mode 100644 index 00000000..e25bda02 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkLocalRemoteIdentifiersTlvTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the LinkLocalRemoteIdentifiersTlv. + */ +public class LinkLocalRemoteIdentifiersTlvTest { + + private final LinkLocalRemoteIdentifiersTlv tlv1 = LinkLocalRemoteIdentifiersTlv.of(10, 20); + private final LinkLocalRemoteIdentifiersTlv sameAsTlv1 = LinkLocalRemoteIdentifiersTlv.of(10, 20); + private final LinkLocalRemoteIdentifiersTlv tlv2 = LinkLocalRemoteIdentifiersTlv.of(20, 30); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkNameTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkNameTlvTest.java new file mode 100644 index 00000000..7d9dcb26 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkNameTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Equality test for LinkNameTlv. + */ +public class LinkNameTlvTest { + private final byte[] rawValue1 = new byte[] {0x01, 0x00}; + private final byte[] rawValue2 = new byte[] {0x02, 0x00}; + + private final LinkNameTlv tlv1 = new LinkNameTlv(rawValue1, (short) rawValue1.length); + private final LinkNameTlv sameAsTlv1 = LinkNameTlv.of(tlv1.getValue(), tlv1.getLength()); + private final LinkNameTlv tlv2 = new LinkNameTlv(rawValue2, (short) 0); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkProtectionTypeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkProtectionTypeTlvTest.java new file mode 100644 index 00000000..61928f22 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LinkProtectionTypeTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the LinkProtectionTypeTlv. + */ +public class LinkProtectionTypeTlvTest { + private final byte rawValue1 = 0x0A; + private final byte rawValue2 = 0x0B; + + private final LinkProtectionTypeTlv tlv1 = new LinkProtectionTypeTlv(rawValue1); + private final LinkProtectionTypeTlv sameAsTlv1 = new LinkProtectionTypeTlv(rawValue1); + private final LinkProtectionTypeTlv tlv2 = new LinkProtectionTypeTlv(rawValue2, (byte) 0); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LocalTENodeDescriptorsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LocalTENodeDescriptorsTlvTest.java new file mode 100644 index 00000000..e8b6abcc --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/LocalTENodeDescriptorsTlvTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +import java.util.LinkedList; + +/** + * Test of the LocalTENodeDescriptorsTlv. + */ +public class LocalTENodeDescriptorsTlvTest { + + private final AutonomousSystemTlv baAutoSysTlvRawValue1 = new AutonomousSystemTlv(1); + private final BGPLSidentifierTlv baBgplsIdRawValue1 = new BGPLSidentifierTlv(1); + + private final AutonomousSystemTlv baAutoSysTlvRawValue2 = new AutonomousSystemTlv(2); + private final BGPLSidentifierTlv baBgplsIdRawValue2 = new BGPLSidentifierTlv(2); + + private final LinkedList llNodeDescriptorSubTLVs1 = new LinkedList(); + private final boolean a = llNodeDescriptorSubTLVs1.add(baAutoSysTlvRawValue1); + private final boolean b = llNodeDescriptorSubTLVs1.add(baBgplsIdRawValue1); + + private final LinkedList llNodeDescriptorSubTLVs2 = new LinkedList(); + private final boolean c = llNodeDescriptorSubTLVs2.add(baAutoSysTlvRawValue2); + private final boolean d = llNodeDescriptorSubTLVs2.add(baBgplsIdRawValue2); + + private final LocalTENodeDescriptorsTlv tlv1 = LocalTENodeDescriptorsTlv.of(llNodeDescriptorSubTLVs1); + private final LocalTENodeDescriptorsTlv sameAstlv1 = LocalTENodeDescriptorsTlv.of(llNodeDescriptorSubTLVs1); + private final LocalTENodeDescriptorsTlv tlv2 = LocalTENodeDescriptorsTlv.of(llNodeDescriptorSubTLVs2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MPLSProtocolMaskTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MPLSProtocolMaskTlvTest.java new file mode 100644 index 00000000..5e79e284 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MPLSProtocolMaskTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the MPLSProtocolMaskTlv. + */ +public class MPLSProtocolMaskTlvTest { + private final byte rawValue1 = 0x0A; + private final byte rawValue2 = 0x0B; + + private final MPLSProtocolMaskTlv tlv1 = new MPLSProtocolMaskTlv(rawValue1); + private final MPLSProtocolMaskTlv sameAsTlv1 = new MPLSProtocolMaskTlv(rawValue1); + private final MPLSProtocolMaskTlv tlv2 = MPLSProtocolMaskTlv.of(rawValue2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumLinkBandwidthTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumLinkBandwidthTlvTest.java new file mode 100644 index 00000000..4e022b82 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumLinkBandwidthTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the MaximumLinkBandwidthTlv. + */ +public class MaximumLinkBandwidthTlvTest { + private final int rawValue1 = 0x0A; + private final int rawValue2 = 0x0B; + + private final MaximumLinkBandwidthTlv tlv1 = new MaximumLinkBandwidthTlv(rawValue1); + private final MaximumLinkBandwidthTlv sameAsTlv1 = new MaximumLinkBandwidthTlv(rawValue1); + private final MaximumLinkBandwidthTlv tlv2 = MaximumLinkBandwidthTlv.of(rawValue2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumReservableLinkBandwidthTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumReservableLinkBandwidthTlvTest.java new file mode 100644 index 00000000..7b370359 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/MaximumReservableLinkBandwidthTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the MaximumReservableLinkBandwidthTlv. + */ +public class MaximumReservableLinkBandwidthTlvTest { + private final int rawValue1 = 0x0A; + private final int rawValue2 = 0x0B; + + private final MaximumReservableLinkBandwidthTlv tlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1); + private final MaximumReservableLinkBandwidthTlv sameAsTlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1); + private final MaximumReservableLinkBandwidthTlv tlv2 = MaximumReservableLinkBandwidthTlv.of(rawValue2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv4addressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv4addressTlvTest.java new file mode 100644 index 00000000..39c699bc --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv4addressTlvTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Equality test for NexthopIPv4addressTlv. + */ +public class NexthopIPv4addressTlvTest { + + private final NexthopIPv4addressTlv tlv1 = new NexthopIPv4addressTlv(0x0A); + private final NexthopIPv4addressTlv sameAsTlv1 = new NexthopIPv4addressTlv(0x0A); + private final NexthopIPv4addressTlv tlv2 = NexthopIPv4addressTlv.of(0x0B); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv6addressTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv6addressTlvTest.java new file mode 100644 index 00000000..4621336e --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopIPv6addressTlvTest.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Equality test for NexthopIPv6addressTlv. + */ +public class NexthopIPv6addressTlvTest { + + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00 }; + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; + + private final NexthopIPv6addressTlv tlv1 = NexthopIPv6addressTlv.of(b1); + private final NexthopIPv6addressTlv sameAsTlv1 = NexthopIPv6addressTlv.of(b1); + private final NexthopIPv6addressTlv tlv2 = NexthopIPv6addressTlv.of(b2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopUnnumberedIPv4IDTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopUnnumberedIPv4IDTlvTest.java new file mode 100644 index 00000000..906c6526 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NexthopUnnumberedIPv4IDTlvTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Equality test for NexthopUnnumberedIPv4IDTlv. + */ +public class NexthopUnnumberedIPv4IDTlvTest { + + private final NexthopUnnumberedIPv4IDTlv tlv1 = new NexthopUnnumberedIPv4IDTlv(0x0A, 0x0A); + private final NexthopUnnumberedIPv4IDTlv sameAsTlv1 = new NexthopUnnumberedIPv4IDTlv(0x0A, 0x0A); + private final NexthopUnnumberedIPv4IDTlv tlv2 = NexthopUnnumberedIPv4IDTlv.of(0x0B, 0x0B); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeFlagBitsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeFlagBitsTlvTest.java new file mode 100644 index 00000000..fb90fedb --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeFlagBitsTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the NodeFlagBitsTlv. + */ +public class NodeFlagBitsTlvTest { + private final byte rawValue1 = 0x0A; + private final byte rawValue2 = 0x0B; + + private final NodeFlagBitsTlv tlv1 = new NodeFlagBitsTlv(rawValue1); + private final NodeFlagBitsTlv sameAsTlv1 = new NodeFlagBitsTlv(rawValue1); + private final NodeFlagBitsTlv tlv2 = NodeFlagBitsTlv.of(rawValue2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeNameTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeNameTlvTest.java new file mode 100644 index 00000000..d6d53d6f --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/NodeNameTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the NodeNameTlv. + */ +public class NodeNameTlvTest { + private final byte[] rawValue1 = new byte[] {0x01, 0x02}; + private final byte[] rawValue2 = new byte[] {0x14, 0x15}; + + private final NodeNameTlv tlv1 = new NodeNameTlv(rawValue1, (short) rawValue1.length); + private final NodeNameTlv sameAsTlv1 = NodeNameTlv.of(tlv1.getValue(), tlv1.getLength()); + private final NodeNameTlv tlv2 = new NodeNameTlv(rawValue2, (short) 0); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OSPFareaIDsubTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OSPFareaIDsubTlvTest.java new file mode 100644 index 00000000..3f741ed6 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OSPFareaIDsubTlvTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the OSPFareaIDsubTlv. + */ +public class OSPFareaIDsubTlvTest { + private final int rawValue1 = 0x0A; + + private final OSPFareaIDsubTlv tlv1 = new OSPFareaIDsubTlv(rawValue1); + private final OSPFareaIDsubTlv tlv2 = OSPFareaIDsubTlv.of(tlv1.getInt()); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OpaqueLinkAttributeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OpaqueLinkAttributeTlvTest.java new file mode 100644 index 00000000..f437fb57 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/OpaqueLinkAttributeTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the OpaqueLinkAttributeTlv. + */ +public class OpaqueLinkAttributeTlvTest { + private final byte[] rawValue1 = new byte[] {0x01, 0x02}; + private final byte[] rawValue2 = new byte[] {0x14, 0x15}; + + private final OpaqueLinkAttributeTlv tlv1 = new OpaqueLinkAttributeTlv(rawValue1, (short) rawValue1.length); + private final OpaqueLinkAttributeTlv sameAsTlv1 = OpaqueLinkAttributeTlv.of(tlv1.getValue(), tlv1.getLength()); + private final OpaqueLinkAttributeTlv tlv2 = new OpaqueLinkAttributeTlv(rawValue2, (short) 0); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathKeySubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathKeySubObjectTest.java new file mode 100644 index 00000000..64cda54e --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathKeySubObjectTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the PathKeySubObject. + */ +public class PathKeySubObjectTest { + + private final PathKeySubObject tlv1 = new PathKeySubObject((short) 0x0A, 0x0A); + private final PathKeySubObject sameAsTlv1 = PathKeySubObject.of((short) 0x0A, 0x0A); + private final PathKeySubObject tlv2 = new PathKeySubObject((short) 0x0B, 0x0B); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathSetupTypeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathSetupTypeTlvTest.java new file mode 100644 index 00000000..d82c943e --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PathSetupTypeTlvTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the PathSetupTypeTlv. + */ +public class PathSetupTypeTlvTest { + + private final PathSetupTypeTlv tlv1 = PathSetupTypeTlv.of(0x0A); + private final PathSetupTypeTlv sameAsTlv1 = PathSetupTypeTlv.of(0x0A); + private final PathSetupTypeTlv tlv2 = PathSetupTypeTlv.of(0x0B); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PceccCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PceccCapabilityTlvTest.java new file mode 100644 index 00000000..30892b18 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PceccCapabilityTlvTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test of the PceccCapabilityTlv. + */ +public class PceccCapabilityTlvTest { + private final int rawValue1 = 0x0A; + private final int rawValue2 = 0x0B; + + private final PceccCapabilityTlv tlv1 = new PceccCapabilityTlv(rawValue1); + private final PceccCapabilityTlv sameAsTlv1 = new PceccCapabilityTlv(rawValue1); + private final PceccCapabilityTlv tlv2 = PceccCapabilityTlv.of(rawValue2); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4AdjacencyTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4AdjacencyTest.java new file mode 100644 index 00000000..3ebc9a1e --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4AdjacencyTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Equality test for PcepNaiIpv4Adjacency. + */ +public class PcepNaiIpv4AdjacencyTest { + + private final PcepNaiIpv4Adjacency obj1 = PcepNaiIpv4Adjacency.of(2, 16); + private final PcepNaiIpv4Adjacency sameAsObj1 = PcepNaiIpv4Adjacency.of(2, 16); + private final PcepNaiIpv4Adjacency obj2 = PcepNaiIpv4Adjacency.of(3, 16); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(obj1, sameAsObj1).addEqualityGroup(obj2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeIdTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeIdTest.java new file mode 100644 index 00000000..5ea5edd6 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeIdTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +public class PcepNaiIpv4NodeIdTest { + + private final PcepNaiIpv4NodeId tlv1 = PcepNaiIpv4NodeId.of(1); + private final PcepNaiIpv4NodeId tlv2 = PcepNaiIpv4NodeId.of(1); + private final PcepNaiIpv4NodeId tlv3 = PcepNaiIpv4NodeId.of(3); + + @Test + public void basics() { + new EqualsTester() + .addEqualityGroup(tlv1, tlv2) + .addEqualityGroup(tlv3) + .testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6AdjacencyTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6AdjacencyTest.java new file mode 100644 index 00000000..52c40f94 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6AdjacencyTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +public class PcepNaiIpv6AdjacencyTest { + private final byte[] localIpv6Addr1 = {(byte) 0x01010101 }; + private final byte[] remoteIpv6Addr1 = {(byte) 0x02020202 }; + private final byte[] localIpv6Addr2 = {(byte) 0x01010101 }; + private final byte[] remoteIpv6Addr2 = {(byte) 0x02020202 }; + private final byte[] localIpv6Addr3 = {(byte) 0x05050505 }; + private final byte[] remoteIpv6Addr3 = {(byte) 0x06060606 }; + + private final PcepNaiIpv6Adjacency tlv1 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); + private final PcepNaiIpv6Adjacency tlv2 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); + private final PcepNaiIpv6Adjacency tlv3 = PcepNaiIpv6Adjacency.of(localIpv6Addr3, remoteIpv6Addr3); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6NodeIdTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6NodeIdTest.java new file mode 100644 index 00000000..29771a0f --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiIpv6NodeIdTest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Equality test for PcepNaiIpv6NodeId. + */ +public class PcepNaiIpv6NodeIdTest { + + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, + 0x00, 0x00 }; + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, + 0x00, 0x00 }; + + private final PcepNaiIpv6NodeId tlv1 = PcepNaiIpv6NodeId.of(b1); + private final PcepNaiIpv6NodeId sameAsTlv1 = PcepNaiIpv6NodeId.of(b1); + private final PcepNaiIpv6NodeId tlv2 = PcepNaiIpv6NodeId.of(b2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiUnnumberedAdjacencyIpv4Test.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiUnnumberedAdjacencyIpv4Test.java new file mode 100644 index 00000000..60ae22fd --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/PcepNaiUnnumberedAdjacencyIpv4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +public class PcepNaiUnnumberedAdjacencyIpv4Test { + + private final int localNodeId1 = 1; + private final int localInterfaceId1 = 1; + private final int remoteNodeId1 = 1; + private final int remoteInterfaceId1 = 1; + private final PcepNaiUnnumberedAdjacencyIpv4 tlv1 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId1, + localInterfaceId1, remoteNodeId1, remoteInterfaceId1); + + private final int localNodeId2 = 1; + private final int localInterfaceId2 = 1; + private final int remoteNodeId2 = 1; + private final int remoteInterfaceId2 = 1; + private final PcepNaiUnnumberedAdjacencyIpv4 tlv2 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId2, + localInterfaceId2, remoteNodeId2, remoteInterfaceId2); + + private final int localNodeId3 = 2; + private final int localInterfaceId3 = 2; + private final int remoteNodeId3 = 2; + private final int remoteInterfaceId3 = 2; + + private final PcepNaiUnnumberedAdjacencyIpv4 tlv3 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId3, + localInterfaceId3, remoteNodeId3, remoteInterfaceId3); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RemoteTENodeDescriptorsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RemoteTENodeDescriptorsTlvTest.java new file mode 100644 index 00000000..112e4a4e --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RemoteTENodeDescriptorsTlvTest.java @@ -0,0 +1,52 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +import java.util.LinkedList; + +/** + * Test case for Remote TE Node Descriptors tlv. + */ +public class RemoteTENodeDescriptorsTlvTest { + + private final AutonomousSystemTlv autonomousSystemTlv1 = new AutonomousSystemTlv(10); + private final BGPLSidentifierTlv bGPLSidentifierTlv1 = new BGPLSidentifierTlv(20); + + private final AutonomousSystemTlv autonomousSystemTlv2 = new AutonomousSystemTlv(20); + private final BGPLSidentifierTlv bGPLSidentifierTlv2 = new BGPLSidentifierTlv(30); + + private final LinkedList llRemoteTENodeDescriptorSubTLV1 = new LinkedList<>(); + private final boolean a = llRemoteTENodeDescriptorSubTLV1.add(autonomousSystemTlv1); + private final boolean b = llRemoteTENodeDescriptorSubTLV1.add(bGPLSidentifierTlv1); + + private final LinkedList llRemoteTENodeDescriptorSubTLV2 = new LinkedList<>(); + private final boolean c = llRemoteTENodeDescriptorSubTLV2.add(autonomousSystemTlv2); + private final boolean d = llRemoteTENodeDescriptorSubTLV2.add(bGPLSidentifierTlv2); + + private final RemoteTENodeDescriptorsTlv tlv1 = RemoteTENodeDescriptorsTlv.of(llRemoteTENodeDescriptorSubTLV1); + private final RemoteTENodeDescriptorsTlv sameAsTlv1 = + RemoteTENodeDescriptorsTlv.of(llRemoteTENodeDescriptorSubTLV1); + private final RemoteTENodeDescriptorsTlv tlv2 = RemoteTENodeDescriptorsTlv.of(llRemoteTENodeDescriptorSubTLV2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RouterIDSubTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RouterIDSubTlvTest.java new file mode 100644 index 00000000..2f9e18a9 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RouterIDSubTlvTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test case for Router ID Sub tlv. + */ +public class RouterIDSubTlvTest { + + private final byte[] value1 = {1, 2 }; + private final Short length1 = 2; + private final RouterIDSubTlv tlv1 = RouterIDSubTlv.of(value1, length1); + + private final Short length2 = 2; + private final RouterIDSubTlv tlv2 = RouterIDSubTlv.of(value1, length2); + + private final byte[] value3 = {1, 2, 3 }; + private final Short length3 = 3; + private final RouterIDSubTlv tlv3 = RouterIDSubTlv.of(value3, length3); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RoutingUniverseTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RoutingUniverseTlvTest.java new file mode 100644 index 00000000..18aa2851 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/RoutingUniverseTlvTest.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Equality test for RoutingUniverseTlv. + */ +public class RoutingUniverseTlvTest { + + private final RoutingUniverseTlv tlv1 = RoutingUniverseTlv.of(2); + private final RoutingUniverseTlv tlv2 = RoutingUniverseTlv.of(2); + private final RoutingUniverseTlv tlv3 = RoutingUniverseTlv.of(3); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SharedRiskLinkGroupTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SharedRiskLinkGroupTlvTest.java new file mode 100644 index 00000000..7c8ec570 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SharedRiskLinkGroupTlvTest.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test case for Shared Risk Link Group tlv. + */ +public class SharedRiskLinkGroupTlvTest { + + private final int[] raw = {1 }; + private final Short hLength = 2; + private final SharedRiskLinkGroupTlv tlv1 = SharedRiskLinkGroupTlv.of(raw, hLength); + + private final SharedRiskLinkGroupTlv sameAsTlv1 = SharedRiskLinkGroupTlv.of(raw, hLength); + + private final int[] raw2 = {2 }; + private final Short hLength2 = 3; + private final SharedRiskLinkGroupTlv tlv2 = SharedRiskLinkGroupTlv.of(raw2, hLength2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SrEroSubObjectTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SrEroSubObjectTest.java new file mode 100644 index 00000000..d91569b9 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SrEroSubObjectTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; +import org.onosproject.pcepio.protocol.PcepNai; + +public class SrEroSubObjectTest { + + private final boolean bFFlag = false; + private final boolean bSFlag = false; + private final boolean bCFlag = false; + private final boolean bMFlag = false; + private final byte st = 1; + private final int sID = 1; + private final PcepNai nai = null; + + private final SrEroSubObject tlv1 = SrEroSubObject.of(st, bFFlag, bSFlag, bCFlag, bMFlag, sID, nai); + + private final boolean bFFlag1 = false; + private final boolean bSFlag1 = false; + private final boolean bCFlag1 = false; + private final boolean bMFlag1 = false; + private final byte st1 = 1; + private final int sID1 = 1; + private final PcepNai nai1 = null; + + private final SrEroSubObject tlv2 = SrEroSubObject.of(st1, bFFlag1, bSFlag1, bCFlag1, bMFlag1, sID1, nai1); + + private final boolean bFFlag2 = true; + private final boolean bSFlag2 = true; + private final boolean bCFlag2 = true; + private final boolean bMFlag2 = true; + private final byte st2 = 2; + private final int sID2 = 2; + private final PcepNai nai2 = null; + + private final SrEroSubObject tlv3 = SrEroSubObject.of(st2, bFFlag2, bSFlag2, bCFlag2, bMFlag2, sID2, nai2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulIPv4LspIdentidiersTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulIPv4LspIdentidiersTlvTest.java new file mode 100644 index 00000000..d1798fa3 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulIPv4LspIdentidiersTlvTest.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +public class StatefulIPv4LspIdentidiersTlvTest { + + private final int ipv4IngressAddress = 1; + private final short lspId = 1; + private final short tunnelId = 1; + private final int extendedTunnelId = 1; + private final int ipv4EgressAddress = 1; + + private final StatefulIPv4LspIdentidiersTlv tlv1 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress, lspId, + tunnelId, extendedTunnelId, ipv4EgressAddress); + + private final int ipv4IngressAddress1 = 1; + private final short lspId1 = 1; + private final short tunnelId1 = 1; + private final int extendedTunnelId1 = 1; + private final int ipv4EgressAddress1 = 1; + + private final StatefulIPv4LspIdentidiersTlv tlv2 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress1, lspId1, + tunnelId1, extendedTunnelId1, ipv4EgressAddress1); + + private final int ipv4IngressAddress2 = 2; + private final short lspId2 = 2; + private final short tunnelId2 = 2; + private final int extendedTunnelId2 = 2; + private final int ipv4EgressAddress2 = 2; + + private final StatefulIPv4LspIdentidiersTlv tlv3 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress2, lspId2, + tunnelId2, extendedTunnelId2, ipv4EgressAddress2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspDbVerTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspDbVerTlvTest.java new file mode 100644 index 00000000..7076bc9e --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspDbVerTlvTest.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test case for Stateful Lsp Db Ver tlv. + */ +public class StatefulLspDbVerTlvTest { + + private final StatefulLspDbVerTlv tlv1 = StatefulLspDbVerTlv.of(1); + private final StatefulLspDbVerTlv tlv2 = StatefulLspDbVerTlv.of(1); + private final StatefulLspDbVerTlv tlv3 = StatefulLspDbVerTlv.of(2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspErrorCodeTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspErrorCodeTlvTest.java new file mode 100644 index 00000000..039108ae --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulLspErrorCodeTlvTest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +public class StatefulLspErrorCodeTlvTest { + + private final StatefulLspErrorCodeTlv tlv1 = StatefulLspErrorCodeTlv.of(1); + private final StatefulLspErrorCodeTlv tlv2 = StatefulLspErrorCodeTlv.of(1); + private final StatefulLspErrorCodeTlv tlv3 = StatefulLspErrorCodeTlv.of(2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulPceCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulPceCapabilityTlvTest.java new file mode 100644 index 00000000..8637024c --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulPceCapabilityTlvTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test case for Stateful Pce Capability tlv. + */ +public class StatefulPceCapabilityTlvTest { + + private final StatefulPceCapabilityTlv tlv1 = StatefulPceCapabilityTlv.of(1); + private final StatefulPceCapabilityTlv tlv2 = StatefulPceCapabilityTlv.of(1); + private final StatefulPceCapabilityTlv tlv3 = StatefulPceCapabilityTlv.of(2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SymbolicPathNameTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SymbolicPathNameTlvTest.java new file mode 100644 index 00000000..8d458f4e --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/SymbolicPathNameTlvTest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test case for Symbolic path tlv. + */ +public class SymbolicPathNameTlvTest { + + private final byte[] value1 = {0x41 }; + private final Short length1 = 2; + private final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1); + + private final byte[] value2 = {0x41 }; + private final Short length2 = 2; + private final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2); + + private final byte[] value3 = {0x41, 0x43 }; + private final Short length3 = 3; + private final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TEDefaultMetricTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TEDefaultMetricTlvTest.java new file mode 100644 index 00000000..c46b0af1 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TEDefaultMetricTlvTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test case for TE Default Metric tlv. + */ +public class TEDefaultMetricTlvTest { + + private final TEDefaultMetricTlv tlv1 = TEDefaultMetricTlv.of(1); + private final TEDefaultMetricTlv tlv2 = TEDefaultMetricTlv.of(1); + private final TEDefaultMetricTlv tlv3 = TEDefaultMetricTlv.of(2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkAttributesTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkAttributesTlvTest.java new file mode 100644 index 00000000..8504a87c --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkAttributesTlvTest.java @@ -0,0 +1,54 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +import java.util.LinkedList; + +/** + * Test case for TE Link Attribute Tlv. + */ +public class TELinkAttributesTlvTest { + + private final AdministrativeGroupTlv administrativeGroupTlv1 = new AdministrativeGroupTlv(10); + private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv1 = + new MaximumReservableLinkBandwidthTlv(20); + + private final AdministrativeGroupTlv administrativeGroupTlv2 = new AdministrativeGroupTlv(20); + private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv2 = + new MaximumReservableLinkBandwidthTlv(30); + + private final LinkedList llLinkAttributesSubTLV1 = new LinkedList<>(); + private final boolean a = llLinkAttributesSubTLV1.add(administrativeGroupTlv1); + private final boolean b = llLinkAttributesSubTLV1.add(maximumReservableLinkBandwidthTlv1); + + private final LinkedList llLinkAttributesSubTLV2 = new LinkedList<>(); + + private final boolean c = llLinkAttributesSubTLV2.add(administrativeGroupTlv2); + private final boolean d = llLinkAttributesSubTLV2.add(maximumReservableLinkBandwidthTlv2); + + private final TELinkAttributesTlv tlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1); + private final TELinkAttributesTlv sameAsTlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1); + private final TELinkAttributesTlv tlv2 = TELinkAttributesTlv.of(llLinkAttributesSubTLV2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkDescriptorsTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkDescriptorsTlvTest.java new file mode 100644 index 00000000..4e942097 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TELinkDescriptorsTlvTest.java @@ -0,0 +1,52 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +import java.util.LinkedList; + +/** + * Test case for TE link descriptors Tlv. + */ +public class TELinkDescriptorsTlvTest { + private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv1 = new + LinkLocalRemoteIdentifiersTlv(10, 10); + private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv1 = new IPv4InterfaceAddressTlv(0x01010101); + + private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv2 = new + LinkLocalRemoteIdentifiersTlv(20, 20); + private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv2 = new IPv4InterfaceAddressTlv(0x02020202); + + private final LinkedList llLinkDescriptorsSubTLVs1 = new LinkedList<>(); + private final boolean a = llLinkDescriptorsSubTLVs1.add(linkLocalRemoteIdentifiersTlv1); + private final boolean b = llLinkDescriptorsSubTLVs1.add(iPv4InterfaceAddressTlv1); + + private final LinkedList llLinkDescriptorsSubTLVs2 = new LinkedList<>(); + private final boolean c = llLinkDescriptorsSubTLVs2.add(linkLocalRemoteIdentifiersTlv2); + private final boolean d = llLinkDescriptorsSubTLVs2.add(iPv4InterfaceAddressTlv2); + + private final TELinkDescriptorsTlv tlv1 = TELinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs1); + private final TELinkDescriptorsTlv sameAstlv1 = TELinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs1); + private final TELinkDescriptorsTlv tlv2 = TELinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TENodeAttributesTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TENodeAttributesTlvTest.java new file mode 100644 index 00000000..28cf27d4 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TENodeAttributesTlvTest.java @@ -0,0 +1,54 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +import java.util.LinkedList; + +/** + * Test case for TE Node Attribute tlv. + */ +public class TENodeAttributesTlvTest { + + private final NodeFlagBitsTlv nodeFlagBitsTlv1 = new NodeFlagBitsTlv((byte) 10); + private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv1 = new + IPv4TERouterIdOfLocalNodeTlv(0x01010101); + + private final NodeFlagBitsTlv nodeFlagBitsTlv2 = new NodeFlagBitsTlv((byte) 20); + private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv2 = new + IPv4TERouterIdOfLocalNodeTlv(0x02020202); + + private final LinkedList llNodeAttributesSubTLV1 = new LinkedList<>(); + private final boolean a = llNodeAttributesSubTLV1.add(nodeFlagBitsTlv1); + private final boolean b = llNodeAttributesSubTLV1.add(iPv4TERouterIdOfLocalNodeTlv1); + + private final LinkedList llNodeAttributesSubTLV2 = new LinkedList<>(); + + private final boolean c = llNodeAttributesSubTLV2.add(nodeFlagBitsTlv2); + private final boolean d = llNodeAttributesSubTLV2.add(iPv4TERouterIdOfLocalNodeTlv2); + + private final TENodeAttributesTlv tlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1); + private final TENodeAttributesTlv sameAsTlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1); + private final TENodeAttributesTlv tlv2 = TENodeAttributesTlv.of(llNodeAttributesSubTLV2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); + } + +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TedCapabilityTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TedCapabilityTlvTest.java new file mode 100644 index 00000000..18677ca3 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/TedCapabilityTlvTest.java @@ -0,0 +1,34 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Test case for TED Capability tlv. + */ +public class TedCapabilityTlvTest { + + private final TedCapabilityTlv tlv1 = TedCapabilityTlv.of(1); + private final TedCapabilityTlv tlv2 = TedCapabilityTlv.of(1); + private final TedCapabilityTlv tlv3 = TedCapabilityTlv.of(2); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } +} diff --git a/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/UnreservedBandwidthTlvTest.java b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/UnreservedBandwidthTlvTest.java new file mode 100644 index 00000000..a50fd9f4 --- /dev/null +++ b/framework/src/onos/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/UnreservedBandwidthTlvTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.pcepio.types; + +import com.google.common.testing.EqualsTester; +import org.junit.Test; + +/** + * Unit Test case for Unreserved Bandwidth Tlv. + */ +public class UnreservedBandwidthTlvTest { + + // Objects of unreserved bandwidth tlv + private final UnreservedBandwidthTlv tlv1 = UnreservedBandwidthTlv.of(100); + private final UnreservedBandwidthTlv tlv2 = UnreservedBandwidthTlv.of(100); + private final UnreservedBandwidthTlv tlv3 = UnreservedBandwidthTlv.of(200); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); + } + +} -- cgit