BUG-196 : support graceful restart
[bgpcep.git] / bgp / parser-impl / src / test / java / org / opendaylight / protocol / bgp / parser / impl / OpenTest.java
index 008932446164a63640cb5c1387b8d87e1dfb4b18..e2c6ca87b0556797ce1496252757baedb280968f 100644 (file)
@@ -28,19 +28,25 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.bgp.parameters.OptionalCapabilitiesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.As4BytesCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.as4.bytes._case.As4BytesCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.GracefulRestartCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.graceful.restart._case.GracefulRestartCapabilityBuilder;
 
 public class OpenTest {
 
     private final byte[] result = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00,
-        (byte) 0x25, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x1e, (byte) 0x00, (byte) 0x03, (byte) 0x7f, (byte) 0x00, (byte) 0x00,
-        (byte) 0x01, (byte) 0x08, (byte) 0x02, (byte) 0x06, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0xe8 };
+        (byte) 0x29, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x1e, (byte) 0x00, (byte) 0x03, (byte) 0x7f, (byte) 0x00, (byte) 0x00,
+        (byte) 0x01, (byte) 0x0c, (byte) 0x02, (byte) 0x0a, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0xe8,
+        (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0x00};
 
     @Test
     public void testSerializeOpen() throws Exception {
         final List<OptionalCapabilities> optionalCapas = Lists.newArrayList();
         optionalCapas.add(new OptionalCapabilitiesBuilder().setCParameters(
                 new As4BytesCaseBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(1000L)).build()).build()).build());
+        optionalCapas.add(new OptionalCapabilitiesBuilder().setCParameters(
+            new GracefulRestartCaseBuilder().setGracefulRestartCapability(
+                new GracefulRestartCapabilityBuilder().build()).build()).build());
         final List<BgpParameters> tlvs = Lists.newArrayList(new BgpParametersBuilder().setOptionalCapabilities(optionalCapas).build());
         final Open open = new OpenBuilder().setBgpIdentifier(new Ipv4Address("127.0.0.1")).setMyAsNumber(30).setHoldTimer(3).setVersion(
                 new ProtocolVersion((short) 4)).setBgpParameters(tlvs).build();