use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags in project bgpcep by opendaylight.
the class GracefulCapabilityHandlerTest method testUnhandledSafi.
@Test(expected = IllegalArgumentException.class)
public void testUnhandledSafi() {
final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(), this.ctx.getSubsequentAddressFamilyRegistry());
final GracefulRestartCapabilityBuilder capaBuilder = new GracefulRestartCapabilityBuilder();
capaBuilder.setRestartFlags(new RestartFlags(true));
capaBuilder.setRestartTime(50);
final TablesBuilder tablesBuilder = new TablesBuilder();
tablesBuilder.setAfiFlags(new AfiFlags(true));
tablesBuilder.setAfi(Ipv4AddressFamily.class);
tablesBuilder.setSafi(SubsequentAddressFamily.class);
capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
final ByteBuf buffer = Unpooled.buffer();
handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags in project bgpcep by opendaylight.
the class GracefulCapabilityHandlerTest method testUnhandledAfi.
@Test(expected = IllegalArgumentException.class)
public void testUnhandledAfi() {
final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(), this.ctx.getSubsequentAddressFamilyRegistry());
final GracefulRestartCapabilityBuilder capaBuilder = new GracefulRestartCapabilityBuilder();
capaBuilder.setRestartFlags(new RestartFlags(true));
capaBuilder.setRestartTime(50);
final TablesBuilder tablesBuilder = new TablesBuilder();
tablesBuilder.setAfiFlags(new AfiFlags(true));
tablesBuilder.setAfi(AddressFamily.class);
tablesBuilder.setSafi(UnicastSubsequentAddressFamily.class);
capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
final ByteBuf buffer = Unpooled.buffer();
handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags in project bgpcep by opendaylight.
the class ComplementaryTest method testBGPParameter.
@Test
public void testBGPParameter() {
final MultiprotocolCapability cap = new MultiprotocolCapabilityBuilder().setAfi(Ipv6AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build();
final CParameters tlv1 = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(cap).build()).build();
final MultiprotocolCapability cap1 = new MultiprotocolCapabilityBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build();
final CParameters tlv2 = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(cap1).build()).build();
final List<Tables> tt = new ArrayList<>();
tt.add(new TablesBuilder().setAfi(Ipv6AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build());
tt.add(new TablesBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build());
final GracefulRestartCapability tlv3 = new GracefulRestartCapabilityBuilder().setRestartFlags(new RestartFlags(Boolean.FALSE)).setRestartTime(0).setTables(tt).build();
final CParameters tlv4 = new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber((long) 40)).build()).build();
assertFalse(tlv3.getRestartFlags().isRestartState());
assertEquals(0, tlv3.getRestartTime().intValue());
assertFalse(tlv1.equals(tlv2));
assertNotSame(tlv1.hashCode(), tlv3.hashCode());
assertNotSame(tlv2.toString(), tlv3.toString());
assertEquals(tlv3.getTables(), tt);
assertEquals(cap.getSafi(), cap1.getSafi());
assertNotSame(cap.getAfi(), cap1.getAfi());
assertEquals(40, tlv4.getAs4BytesCapability().getAsNumber().getValue().longValue());
assertEquals(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber((long) 40)).build()).build(), tlv4);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags in project bgpcep by opendaylight.
the class GracefulCapabilityHandlerTest method testRestartTimeMaxValue.
@Test(expected = IllegalArgumentException.class)
public void testRestartTimeMaxValue() {
final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(), this.ctx.getSubsequentAddressFamilyRegistry());
final GracefulRestartCapabilityBuilder capaBuilder = new GracefulRestartCapabilityBuilder();
capaBuilder.setRestartFlags(new RestartFlags(true));
capaBuilder.setRestartTime(50 * 1000);
final TablesBuilder tablesBuilder = new TablesBuilder();
tablesBuilder.setAfiFlags(new AfiFlags(true));
tablesBuilder.setAfi(Ipv4AddressFamily.class);
tablesBuilder.setSafi(UnicastSubsequentAddressFamily.class);
capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
final ByteBuf buffer = Unpooled.buffer();
handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags in project bgpcep by opendaylight.
the class GracefulCapabilityHandlerTest method testRestartTimeMinValue.
@Test(expected = IllegalArgumentException.class)
public void testRestartTimeMinValue() {
final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(), this.ctx.getSubsequentAddressFamilyRegistry());
final GracefulRestartCapabilityBuilder capaBuilder = new GracefulRestartCapabilityBuilder();
capaBuilder.setRestartFlags(new RestartFlags(true));
capaBuilder.setRestartTime(-1);
final TablesBuilder tablesBuilder = new TablesBuilder();
tablesBuilder.setAfiFlags(new AfiFlags(true));
tablesBuilder.setAfi(Ipv4AddressFamily.class);
tablesBuilder.setSafi(UnicastSubsequentAddressFamily.class);
capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
final ByteBuf buffer = Unpooled.buffer();
handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
}
Aggregations