final Ipv4RouteBuilder ipv4RouteBuilder = new Ipv4RouteBuilder();
ipv4RouteBuilder.setRouteKey(routeKey.getRouteKey());
ipv4RouteBuilder.setPrefix(new Ipv4Prefix(routeKey.getRouteKey()));
- ipv4RouteBuilder.setKey(routeKey);
+ ipv4RouteBuilder.withKey(routeKey);
ipv4RouteBuilder.setAttributes(attributes);
final Ipv4Route ipv4Route = ipv4RouteBuilder.build();
wt.put(LogicalDatastoreType.CONFIGURATION, routeIId,
} else {
if (neighbor != null) {
globalBgp.getNeighbors().getNeighbor().stream()
- .filter(neig -> Ipv4Util.toStringIP(neig.getKey().getNeighborAddress()).matches(neighbor))
+ .filter(neig -> Ipv4Util.toStringIP(neig.key().getNeighborAddress()).matches(neighbor))
.findFirst()
.ifPresent(neighbor1 -> displayNeighborOperationalState(neighbor, neighbor1, stream));
} else {
private static void displayAfiSafi(final AfiSafi afiSafi, final ShellTable table) {
final GlobalAfiSafiStateAugmentation state = afiSafi.getState()
- .getAugmentation(GlobalAfiSafiStateAugmentation.class);
+ .augmentation(GlobalAfiSafiStateAugmentation.class);
addHeader(table, "AFI/SAFI state");
table.addRow().addContent("Family", afiSafi.getAfiSafiName().getSimpleName());
if (state == null) {
table.column("Value").alignLeft();
table.addRow().addContent("Neighbor Address", neighborId);
- final NeighborStateAugmentation stateAug = neighborState.getAugmentation(NeighborStateAugmentation.class);
+ final NeighborStateAugmentation stateAug = neighborState.augmentation(NeighborStateAugmentation.class);
if (stateAug != null) {
table.addRow().addContent("Session State", stateAug.getSessionState());
printCapabilitiesState(stateAug.getSupportedCapabilities(), table);
private static void printAfiSafiState(final AfiSafi afiSafi, final ShellTable table) {
final NeighborAfiSafiStateAugmentation state = afiSafi.getState()
- .getAugmentation(NeighborAfiSafiStateAugmentation.class);
+ .augmentation(NeighborAfiSafiStateAugmentation.class);
addHeader(table, "AFI state");
table.addRow().addContent("Family", afiSafi.getAfiSafiName().getSimpleName());
table.addRow().addContent("Active", state.isActive());
}
private static void printMessagesState(final State neighborState, final ShellTable table) {
- final BgpNeighborStateAugmentation state = neighborState.getAugmentation(BgpNeighborStateAugmentation.class);
+ final BgpNeighborStateAugmentation state = neighborState.augmentation(BgpNeighborStateAugmentation.class);
if (state == null) {
return;
}
return;
}
final NeighborTransportStateAugmentation state = transport.getState()
- .getAugmentation(NeighborTransportStateAugmentation.class);
+ .augmentation(NeighborTransportStateAugmentation.class);
if (state == null) {
return;
}
}
final NeighborTimersStateAugmentation state = timers.getState()
- .getAugmentation(NeighborTimersStateAugmentation.class);
+ .augmentation(NeighborTimersStateAugmentation.class);
if (state == null) {
return;
}
if (state == null) {
return;
}
- final PeerGroupStateAugmentation aug = state.getAugmentation(PeerGroupStateAugmentation.class);
+ final PeerGroupStateAugmentation aug = state.augmentation(PeerGroupStateAugmentation.class);
table.addRow().addContent("Total Prefixes", aug.getTotalPrefixes());
}
}
} else {
builder = new EvpnRouteBuilder();
}
- return builder.setKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes).build();
+ return builder.withKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes).build();
}
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (routes != null && routes.getDestinationType() instanceof DestinationEvpnCase) {
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(),
createRoutes(EVPN_ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri()
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri()
.getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(
createRoutes(EVPN_ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
-}
\ No newline at end of file
+}
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
static synchronized FlowspecIpv4RIBSupport getInstance(
SimpleFlowspecExtensionProviderContext context,
final BindingNormalizedNodeSerializer mappingService) {
- if(SINGLETON == null){
+ if (SINGLETON == null){
SINGLETON = new FlowspecIpv4RIBSupport(context, mappingService);
}
- return SINGLETON; }
+ return SINGLETON;
+ }
@Override
public FlowspecRoute createRoute(final FlowspecRoute route, final String routeKey, final long pathId,
} else {
builder = new FlowspecRouteBuilder();
}
- return builder.setKey(new FlowspecRouteKey(new PathId(pathId), routeKey)).setAttributes(attributes).build();
+ return builder.withKey(new FlowspecRouteKey(new PathId(pathId), routeKey)).setAttributes(attributes).build();
}
@Override
static synchronized FlowspecIpv6RIBSupport getInstance(
SimpleFlowspecExtensionProviderContext context,
final BindingNormalizedNodeSerializer mappingService) {
- if(SINGLETON == null){
+ if (SINGLETON == null) {
SINGLETON = new FlowspecIpv6RIBSupport(context, mappingService);
}
return SINGLETON;
} else {
builder = new FlowspecRouteBuilder();
}
- return builder.setKey(new FlowspecRouteKey(new PathId(pathId), routeKey)).setAttributes(attributes).build();
+ return builder.withKey(new FlowspecRouteKey(new PathId(pathId), routeKey)).setAttributes(attributes).build();
}
@Override
} else {
builder = new FlowspecL3vpnRouteBuilder();
}
- return builder.setKey(new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey))
+ return builder.withKey(new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey))
.setAttributes(attributes).build();
}
} else {
builder = new FlowspecL3vpnRouteBuilder();
}
- return builder.setKey(new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey))
+ return builder.withKey(new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey))
.setAttributes(attributes).build();
}
SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
- this.route = new FlowspecRouteBuilder().setKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
+ this.route = new FlowspecRouteBuilder().withKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
.setAttributes(new AttributesBuilder().build()).build();
this.routes = new FlowspecRoutesBuilder().setFlowspecRoute(Collections.singletonList(this.route)).build();
setUpTestCustomizer(this.ribSupport);
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(routes), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(routes), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
-}
\ No newline at end of file
+}
fsContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
- this.route = new FlowspecRouteBuilder().setKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
+ this.route = new FlowspecRouteBuilder().withKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
.setAttributes(new AttributesBuilder().build()).build();
this.routes = new FlowspecIpv6RoutesBuilder().setFlowspecRoute(Collections.singletonList(this.route)).build();
this.ribSupport = FlowspecIpv6RIBSupport.getInstance(fsContext, this.mappingService);
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(),
createRoutes(this.routes), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(this.routes),
Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
-}
\ No newline at end of file
+}
static {
ROUTE_KEY = new FlowspecL3vpnRouteKey(PATH_ID,
"[l3vpn with route-distinguisher 0:5:3] all packets to 172.17.1.0/24");
- ROUTE = new FlowspecL3vpnRouteBuilder().setKey(ROUTE_KEY).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
+ ROUTE = new FlowspecL3vpnRouteBuilder().withKey(ROUTE_KEY).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
.setAttributes(new AttributesBuilder().build()).setRouteDistinguisher(RD).build();
}
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(
new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(
new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()), Collections.emptyList(), ATTRIBUTES);
- final AdvertizedRoutes advertised = update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes();
+ final AdvertizedRoutes advertised = update.getAttributes().augmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes();
assertEquals(REACH_NLRI, advertised.getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
static {
ROUTE_KEY = new FlowspecL3vpnRouteKey(PATH_ID,
"[l3vpn with route-distinguisher 0:5:3] all packets to 2001:db8:1:2::/64");
- ROUTE = new FlowspecL3vpnRouteBuilder().setKey(ROUTE_KEY).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
+ ROUTE = new FlowspecL3vpnRouteBuilder().withKey(ROUTE_KEY).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
.setAttributes(new AttributesBuilder().build()).setRouteDistinguisher(RD).build();
}
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(
new FlowspecL3vpnIpv6RoutesBuilder()
.setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()),
Collections.emptyList(), ATTRIBUTES);
final AdvertizedRoutes advertised
- = update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes();
+ = update.getAttributes().augmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes();
assertEquals(REACH_NLRI, advertised.getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
-}
\ No newline at end of file
+}
} else {
builder = new Ipv4RouteBuilder();
}
- builder.setKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes);
+ builder.withKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes);
return builder.build();
}
} else {
builder = new Ipv6RouteBuilder();
}
- return builder.setKey(new Ipv6RouteKey(new PathId(pathId), routeKey)).setAttributes(attributes).build();
+ return builder.withKey(new Ipv6RouteKey(new PathId(pathId), routeKey)).setAttributes(attributes).build();
}
@Override
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv4Case) {
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv6Case) {
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri()
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri()
.getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class)
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class)
.getMpReachNlri().getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
paBuilder.addAugmentation(Attributes1.class, new Attributes1Builder()
.setMpReachNlri(mpBuilder.build()).build());
- assertEquals(paBuilder.getAugmentation(Attributes1.class).getMpReachNlri(),
- attrs.getAugmentation(Attributes1.class).getMpReachNlri());
+ assertEquals(paBuilder.augmentation(Attributes1.class).getMpReachNlri(),
+ attrs.augmentation(Attributes1.class).getMpReachNlri());
paBuilder.setUnrecognizedAttributes(Collections.emptyList());
// check API message
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
List<VpnDestination> vpnDst = null;
boolean isWithdrawnRoute = false;
if (pathAttributes1 != null) {
} else {
builder = new VpnRouteBuilder();
}
- return builder.setKey(new VpnRouteKey(new PathId(pathId), vpnRouteKey)).setAttributes(attributes).build();
+ return builder.withKey(new VpnRouteKey(new PathId(pathId), vpnRouteKey)).setAttributes(attributes).build();
}
@Override
private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(NON_PATH_ID)
.setAttributes(ATTRIBUTES).setPrefix(IPV4_PREFIX)
- .setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).setKey(ROUTE_KEY).build();
+ .setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).withKey(ROUTE_KEY).build();
private static final VpnIpv4Routes ROUTES = new VpnIpv4RoutesBuilder()
.setVpnRoute(Collections.singletonList(ROUTE)).build();
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
-}
\ No newline at end of file
+}
private static final VpnRouteKey ROUTE_KEY = new VpnRouteKey(new PathId(0L), "cAABAQIDBAECIAEjRVaJ");
private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(NON_PATH_ID)
.setAttributes(ATTRIBUTES).setPrefix(IPV6PREFIX)
- .setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).setKey(ROUTE_KEY).build();
+ .setLabelStack(LABEL_STACK).setRouteDistinguisher(DISTINGUISHER).withKey(ROUTE_KEY).build();
private static final VpnIpv6Routes ROUTES = new VpnIpv6RoutesBuilder()
.setVpnRoute(Collections.singletonList(ROUTE)).build();
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
-}
\ No newline at end of file
+}
} else {
builder = new LabeledUnicastRouteBuilder();
}
- return builder.setKey(new LabeledUnicastRouteKey(new PathId(pathId), routeKey))
+ return builder.withKey(new LabeledUnicastRouteKey(new PathId(pathId), routeKey))
.setAttributes(attributes).build();
}
}
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
- final AdvertizedRoutes routes = (pathAttributes1.getMpReachNlri()).getAdvertizedRoutes();
+ final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (routes != null) {
final DestinationType destinationType = routes.getDestinationType();
if ( destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
final IpPrefix prefix = dest.getPrefix();
// Serialize the length field
// Length field contains one Byte which represents the length of label stack and prefix in bits
- nlriByteBuf.writeByte(((LABEL_LENGTH * (!isUnreachNlri ? labelStack.size() : 1)) + getPrefixLength(prefix)) * Byte.SIZE);
+ nlriByteBuf.writeByte((LABEL_LENGTH * (!isUnreachNlri ? labelStack.size() : 1) + getPrefixLength(prefix)) * Byte.SIZE);
serializeLabelStackEntries(labelStack, isUnreachNlri, nlriByteBuf);
serializePrefixField(prefix, nlriByteBuf);
final List<LabelStack> labels = parseLabel(nlri);
builder.setLabelStack(labels);
final int labelNum = labels != null ? labels.size() : 1;
- final int prefixLen = length - (LABEL_LENGTH * Byte.SIZE * labelNum);
+ final int prefixLen = length - LABEL_LENGTH * Byte.SIZE * labelNum;
builder.setPrefix(parseIpPrefix(nlri, prefixLen, afi));
dests.add(builder.build());
}
}
public static IpPrefix parseIpPrefix(final ByteBuf nlri, final int prefixLen, final Class<? extends AddressFamily> afi) {
- final int prefixLenInByte = (prefixLen / Byte.SIZE) + (((prefixLen % Byte.SIZE) == 0) ? 0 : 1);
+ final int prefixLenInByte = prefixLen / Byte.SIZE + (prefixLen % Byte.SIZE == 0 ? 0 : 1);
if (afi.equals(Ipv4AddressFamily.class)) {
return new IpPrefix(Ipv4Util.prefixForBytes(ByteArray.readBytes(nlri, prefixLenInByte), prefixLen));
} else if (afi.equals(Ipv6AddressFamily.class)) {
LABEL_KEY = ByteArray.encodeBase64(buffer);
ROUTE_KEY = new LabeledUnicastRouteKey(PATH_ID, LABEL_KEY);
ROUTE = new LabeledUnicastRouteBuilder()
- .setKey(ROUTE_KEY)
+ .withKey(ROUTE_KEY)
.setPrefix(IPv4_PREFIX)
.setPathId(PATH_ID)
.setLabelStack(LABEL_STACK)
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
LUNlriParser.serializeNlri(LABELED_DESTINATION_LIST, false, buffer);
LABEL_KEY = ByteArray.encodeBase64(buffer);
ROUTE_KEY = new LabeledUnicastRouteKey(PATH_ID, LABEL_KEY);
- ROUTE = new LabeledUnicastRouteBuilder().setKey(ROUTE_KEY)
+ ROUTE = new LabeledUnicastRouteBuilder().withKey(ROUTE_KEY)
.setPrefix(IPv6_PREFIX).setPathId(PATH_ID).setLabelStack(LABEL_STACK)
.setAttributes(new AttributesBuilder().build()).build();
ROUTES = new LabeledUnicastIpv6RoutesBuilder().setLabeledUnicastRoute(Collections.singletonList(ROUTE)).build();
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
} else {
builder = new LinkstateRouteBuilder();
}
- return builder.setKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes).build();
+ return builder.withKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes).build();
}
@Override
}
private static CLinkstateDestination getNlriType(final AttributesBuilder pab) {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1 mpr = pab.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1.class);
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1 mpr = pab.augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1.class);
if (mpr != null && mpr.getMpReachNlri() != null) {
final DestinationType dt = mpr.getMpReachNlri().getAdvertizedRoutes().getDestinationType();
if (dt instanceof DestinationLinkstateCase) {
}
}
}
- final Attributes2 mpu = pab.getAugmentation(Attributes2.class);
+ final Attributes2 mpu = pab.augmentation(Attributes2.class);
if (mpu != null && mpu.getMpUnreachNlri() != null) {
final DestinationType dt = mpu.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType();
if (dt instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase) {
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
- final Attributes1 pathAttributes1 = ((Attributes) attribute).getAugmentation(Attributes1.class);
+ final Attributes1 pathAttributes1 = ((Attributes) attribute).augmentation(Attributes1.class);
if (pathAttributes1 == null) {
return;
}
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
serializeAdvertisedRoutes(pathAttributes1.getMpReachNlri().getAdvertizedRoutes(), byteAggregator);
} else if (pathAttributes2 != null) {
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+
import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public void testPositiveLinks() throws BGPParsingException {
final AttributesBuilder builder = createBuilder(new LinkCaseBuilder().build());
this.parser.parseAttribute(Unpooled.copiedBuffer(LINK_ATTR), builder);
- final Attributes1 attrs = builder.getAugmentation(Attributes1.class);
+ final Attributes1 attrs = builder.augmentation(Attributes1.class);
final LinkAttributes ls = ((LinkAttributesCase) attrs.getLinkStateAttribute()).getLinkAttributes();
assertNotNull(ls);
final AttributesBuilder builder = createBuilder(new NodeCaseBuilder().build());
this.parser.parseAttribute(Unpooled.copiedBuffer(NODE_ATTR), builder);
- final Attributes1 attrs = builder.getAugmentation(Attributes1.class);
+ final Attributes1 attrs = builder.augmentation(Attributes1.class);
final NodeAttributes ls = ((NodeAttributesCase) attrs.getLinkStateAttribute()).getNodeAttributes();
assertNotNull(ls);
new PrefixDescriptorsBuilder().setIpReachabilityInformation(new IpPrefix(new Ipv4Prefix("127.0.0.1/32"))).build()).build());
this.parser.parseAttribute(Unpooled.copiedBuffer(P4_ATTR), builder);
- final Attributes1 attrs = builder.getAugmentation(Attributes1.class);
+ final Attributes1 attrs = builder.augmentation(Attributes1.class);
final PrefixAttributes ls = ((PrefixAttributesCase) attrs.getLinkStateAttribute()).getPrefixAttributes();
assertNotNull(ls);
final AttributesBuilder builder = createBuilder(new TeLspCaseBuilder().build());
this.parser.parseAttribute(Unpooled.copiedBuffer(TE_LSP_ATTR), builder);
- final Attributes1 attrs = builder.getAugmentation(Attributes1.class);
+ final Attributes1 attrs = builder.augmentation(Attributes1.class);
final TeLspAttributes teLspAttributes = ((TeLspAttributesCase) attrs.getLinkStateAttribute()).getTeLspAttributes();
assertNotNull(teLspAttributes);
final TspecObject tSpec = teLspAttributes.getTspecObject();
SimpleNlriTypeRegistry.getInstance().serializeNlriType(LINKSTATE_DESTINATION, buffer);
final byte[] arrayKey = ByteArray.readAllBytes(buffer);
ROUTE_KEY = new LinkstateRouteKey(PATH_ID, Arrays.toString(arrayKey));
- ROUTE = new LinkstateRouteBuilder().setKey(ROUTE_KEY).setRouteDistinguisher(RD)
+ ROUTE = new LinkstateRouteBuilder().withKey(ROUTE_KEY).setRouteDistinguisher(RD)
.setIdentifier(ID).setObjectType(OBJECT_TYPE2)
.setProtocolId(ProtocolId.IsisLevel1).setAttributes(new AttributesBuilder().build()).build();
ROUTES = new LinkstateRoutesBuilder().setLinkstateRoute(Collections.singletonList(ROUTE)).build();
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class)
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class)
.getMpReachNlri().getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
-}
\ No newline at end of file
+}
final Update message = ParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength);
final Class<? extends AddressFamily> afi = message.getAttributes()
- .getAugmentation(Attributes2.class).getMpUnreachNlri().getAfi();
+ .augmentation(Attributes2.class).getMpUnreachNlri().getAfi();
final Class<? extends SubsequentAddressFamily> safi = message.getAttributes()
- .getAugmentation(Attributes2.class).getMpUnreachNlri().getSafi();
+ .augmentation(Attributes2.class).getMpUnreachNlri().getSafi();
assertEquals(LinkstateAddressFamily.class, afi);
assertEquals(LinkstateSubsequentAddressFamily.class, safi);
paBuilder.setLocalPref(new LocalPrefBuilder().setPref(100L).build());
assertEquals(paBuilder.getLocalPref(), attrs.getLocalPref());
- final MpReachNlri mp = attrs.getAugmentation(Attributes1.class).getMpReachNlri();
+ final MpReachNlri mp = attrs.augmentation(Attributes1.class).getMpReachNlri();
assertEquals(mpBuilder.getAfi(), mp.getAfi());
assertEquals(mpBuilder.getSafi(), mp.getSafi());
assertEquals(mpBuilder.getCNextHop(), mp.getCNextHop());
assertEquals(
lsAttrBuilder.build(),
- attrs.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ attrs.augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
.linkstate.rev180329.Attributes1.class));
final List<CLinkstateDestination> dests = ((DestinationLinkstateCase) mp.getAdvertizedRoutes()
paBuilder.addAugmentation(Attributes1.class, lsBuilder.build());
paBuilder.setUnrecognizedAttributes(Collections.emptyList());
- final MpReachNlri mp = attrs.getAugmentation(Attributes1.class).getMpReachNlri();
+ final MpReachNlri mp = attrs.augmentation(Attributes1.class).getMpReachNlri();
assertEquals(mpBuilder.getAfi(), mp.getAfi());
assertEquals(mpBuilder.getSafi(), mp.getSafi());
assertEquals(mpBuilder.getCNextHop(), mp.getCNextHop());
for (final BgpParameters param : open.getBgpParameters()) {
for (final OptionalCapabilities optCapa : param.getOptionalCapabilities()) {
final CParameters cParam = optCapa.getCParameters();
- if(cParam != null && cParam.getAugmentation(CParameters1.class) != null && cParam.getAugmentation
- (CParameters1.class).getMultiprotocolCapability() != null) {
- final MultiprotocolCapability mp = cParam
- .getAugmentation(CParameters1.class).getMultiprotocolCapability();
+ if(cParam != null && cParam.augmentation(CParameters1.class) != null
+ && cParam.augmentation(CParameters1.class).getMultiprotocolCapability() != null) {
+ final MultiprotocolCapability mp = cParam.augmentation(CParameters1.class)
+ .getMultiprotocolCapability();
final BgpTableType type = new BgpTableTypeImpl(mp.getAfi(), mp.getSafi());
types.add(type);
}
} else {
builder = new MvpnRouteBuilder();
}
- return builder.setKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes).build();
+ return builder.withKey(createRouteListKey(pathId, routeKey)).setAttributes(attributes).build();
}
@Override
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final PeDistinguisherLabelsAttributeAugmentation att =
- ((Attributes) attribute).getAugmentation(PeDistinguisherLabelsAttributeAugmentation.class);
+ ((Attributes) attribute).augmentation(PeDistinguisherLabelsAttributeAugmentation.class);
if (att == null) {
return;
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final PmsiTunnelAugmentation pmsiTunnelAugmentation = ((Attributes) attribute)
- .getAugmentation(PmsiTunnelAugmentation.class);
+ .augmentation(PmsiTunnelAugmentation.class);
if (pmsiTunnelAugmentation == null) {
return;
}
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (routes != null && routes.getDestinationType() instanceof DestinationMvpnIpv4AdvertizedCase) {
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (routes != null && routes.getDestinationType() instanceof DestinationMvpnIpv6AdvertizedCase) {
public void testBuildMpUnreachNlriUpdate() {
final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), routes, ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri()
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri()
.getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
public void testBuildMpUnreachNlriUpdate() {
final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), routes, ATTRIBUTES);
- assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri()
+ assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri()
.getWithdrawnRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes1.class));
+ assertNull(update.getAttributes().augmentation(Attributes1.class));
}
@Test
public void testBuildMpReachNlriUpdate() {
final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
- assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+ assertEquals(REACH_NLRI, update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
.getAdvertizedRoutes().getDestinationType());
- assertNull(update.getAttributes().getAugmentation(Attributes2.class));
+ assertNull(update.getAttributes().augmentation(Attributes2.class));
}
@Test
return null;
}
Attributes attributesUpdated = attributes;
- final Actions1 augmentation = actions.getAugmentation(Actions1.class);
+ final Actions1 augmentation = actions.augmentation(Actions1.class);
if (augmentation != null && augmentation.getBgpActions() != null) {
final BgpActions bgpAction = augmentation.getBgpActions();
return null;
}
Attributes attributesUpdated = attributes;
- final Actions1 augmentation = actions.getAugmentation(Actions1.class);
+ final Actions1 augmentation = actions.augmentation(Actions1.class);
if (augmentation != null && augmentation.getBgpActions() != null) {
final BgpActions bgpAction = augmentation.getBgpActions();
final BGPRouteEntryExportParameters routeEntryExportParameters,
final Attributes attributes,
final Conditions conditions) {
- final Conditions1 bgpConditionsAug = conditions.getAugmentation(Conditions1.class);
+ final Conditions1 bgpConditionsAug = conditions.augmentation(Conditions1.class);
if (bgpConditionsAug != null) {
final BgpConditions bgpConditions = bgpConditionsAug.getBgpConditions();
final Attributes attributes,
final Conditions conditions) {
- final Conditions1 bgpConditionsAug = conditions.getAugmentation(Conditions1.class);
+ final Conditions1 bgpConditionsAug = conditions.augmentation(Conditions1.class);
if (bgpConditionsAug != null) {
final BgpConditions bgpConditions = bgpConditionsAug.getBgpConditions();
synchronized (this) {
assertEquals(expectedTimers, neighborResult.getTimers());
final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
.State stateResult = neighborResult.getState();
- assertEquals(expectedBgpNeighborState, stateResult.getAugmentation(BgpNeighborStateAugmentation.class));
+ assertEquals(expectedBgpNeighborState, stateResult.augmentation(BgpNeighborStateAugmentation.class));
assertEquals(BgpNeighborState.SessionState.ESTABLISHED, stateResult
- .getAugmentation(NeighborStateAugmentation.class).getSessionState());
+ .augmentation(NeighborStateAugmentation.class).getSessionState());
final List<Class<? extends BgpCapability>> supportedCapabilitiesResult = stateResult
- .getAugmentation(NeighborStateAugmentation.class).getSupportedCapabilities();
+ .augmentation(NeighborStateAugmentation.class).getSupportedCapabilities();
Assert.assertTrue(supportedCapabilitiesResult.containsAll(this.supportedCap));
return bgpRib;
});
@Override
public void serializeCapability(final CParameters capability, final ByteBuf byteAggregator) {
- if ( (capability.getAugmentation(CParameters1.class) == null)
- || (capability.getAugmentation(CParameters1.class).getAddPathCapability() == null) ) {
+ final CParameters1 aug = capability.augmentation(CParameters1.class);
+ if (aug == null) {
+ return;
+ }
+ final AddPathCapability addPathCap = aug.getAddPathCapability();
+ if (addPathCap == null) {
return;
}
- final AddPathCapability addPathCap = capability.getAugmentation(CParameters1.class).getAddPathCapability();
final List<AddressFamilies> families = addPathCap.getAddressFamilies();
if (families != null) {
private ByteBuf serializeCapability(final GracefulRestartCapability grace) {
final List<Tables> tables = grace.getTables();
- final int tablesSize = (tables != null) ? tables.size() : 0;
- final ByteBuf bytes = Unpooled.buffer(HEADER_SIZE + (PER_AFI_SAFI_SIZE * tablesSize));
+ final int tablesSize = tables != null ? tables.size() : 0;
+ final ByteBuf bytes = Unpooled.buffer(HEADER_SIZE + PER_AFI_SAFI_SIZE * tablesSize);
int timeval = 0;
Integer time = grace.getRestartTime();
if (time == null) {
@Override
public void serializeCapability(final CParameters capability, final ByteBuf byteAggregator) {
- if (capability.getAugmentation(CParameters1.class) == null
- || capability.getAugmentation(CParameters1.class).getGracefulRestartCapability() == null) {
+ final CParameters1 aug = capability.augmentation(CParameters1.class);
+ if (aug == null) {
return;
}
- final GracefulRestartCapability grace = capability.getAugmentation(CParameters1.class).getGracefulRestartCapability();
-
- final ByteBuf bytes = serializeCapability(grace);
-
- CapabilityUtil.formatCapability(CODE, bytes, byteAggregator);
+ final GracefulRestartCapability grace = aug.getGracefulRestartCapability();
+ if (grace != null) {
+ final ByteBuf bytes = serializeCapability(grace);
+ CapabilityUtil.formatCapability(CODE, bytes, byteAggregator);
+ }
}
@Override
public CParameters parseCapability(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final GracefulRestartCapabilityBuilder cb = new GracefulRestartCapabilityBuilder();
- final int flagBits = (buffer.getByte(0) >> RESTART_FLAGS_SIZE);
+ final int flagBits = buffer.getByte(0) >> RESTART_FLAGS_SIZE;
cb.setRestartFlags(new RestartFlags((flagBits & Byte.SIZE) != 0));
final int timer = ((buffer.readUnsignedByte() & TIMER_TOPBITS_MASK) << Byte.SIZE) + buffer.readUnsignedByte();
@Override
public void serializeCapability(final CParameters capability, final ByteBuf byteAggregator) {
- if ( capability.getAugmentation(CParameters1.class) == null
- || capability.getAugmentation(CParameters1.class).getMultiprotocolCapability() == null ) {
+ final CParameters1 aug = capability.augmentation(CParameters1.class);
+ if (aug == null) {
+ return;
+ }
+ final MultiprotocolCapability mp = aug.getMultiprotocolCapability();
+ if (mp == null) {
return;
}
- final MultiprotocolCapability mp = capability.getAugmentation(CParameters1.class).getMultiprotocolCapability();
final ByteBuf capBuffer = Unpooled.buffer();
MultiprotocolCapabilitiesUtil.serializeMPAfiSafi(this.afiReg, this.safiReg, mp.getAfi(),
@Override
public void serializeCapability(final CParameters capability, final ByteBuf byteAggregator) {
- if (capability == null || (capability.getAugmentation(CParameters1.class) == null) ||
- (capability.getAugmentation(CParameters1.class).getRouteRefreshCapability() == null) ) {
- return;
+ if (capability != null) {
+ final CParameters1 aug = capability.augmentation(CParameters1.class);
+ if (aug != null && aug.getRouteRefreshCapability() != null) {
+ CapabilityUtil.formatCapability(CODE, Unpooled.EMPTY_BUFFER, byteAggregator);
+ }
}
- CapabilityUtil.formatCapability(CODE, Unpooled.EMPTY_BUFFER, byteAggregator);
}
@Override
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
+ final Attributes1 pathAttributes1 = pathAttributes.augmentation(Attributes1.class);
if (pathAttributes1 == null) {
return;
}
Preconditions.checkArgument(attribute instanceof Attributes,
"Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
- final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
+ final Attributes2 pathAttributes2 = pathAttributes.augmentation(Attributes2.class);
if (pathAttributes2 == null) {
return;
}
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(6), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength);
- final Class<? extends AddressFamily> afi = message.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getAfi();
- final Class<? extends SubsequentAddressFamily> safi = message.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getSafi();
+ final Class<? extends AddressFamily> afi = message.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri().getAfi();
+ final Class<? extends SubsequentAddressFamily> safi = message.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri().getSafi();
assertEquals(Ipv6AddressFamily.class, afi);
assertEquals(UnicastSubsequentAddressFamily.class, safi);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(6), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength);
- final Class<? extends AddressFamily> afi = message.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getAfi();
- final Class<? extends SubsequentAddressFamily> safi = message.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getSafi();
+ final Class<? extends AddressFamily> afi = message.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri().getAfi();
+ final Class<? extends SubsequentAddressFamily> safi = message.getAttributes().augmentation(Attributes2.class).getMpUnreachNlri().getSafi();
assertEquals(Ipv6AddressFamily.class, afi);
assertEquals(UnicastSubsequentAddressFamily.class, safi);
assertEquals(open.getBgpParameters().get(0).getOptionalCapabilities().get(0).getCParameters().getAs4BytesCapability(),
openResult.getBgpParameters().get(0).getOptionalCapabilities().get(!grace ? 1 : 0).getCParameters().getAs4BytesCapability());
assertEquals(open.getBgpParameters().get(0).getOptionalCapabilities().get(0).getCParameters()
- .getAugmentation(CParameters1.class)
+ .augmentation(CParameters1.class)
.getGracefulRestartCapability(), openResult.getBgpParameters().get(0).getOptionalCapabilities().get(grace ? 1 : 0).getCParameters()
- .getAugmentation(CParameters1.class).getGracefulRestartCapability());
+ .augmentation(CParameters1.class).getGracefulRestartCapability());
}
}
.getBgpParameters()) {
for (final OptionalCapabilities capa : p.getOptionalCapabilities()) {
final CParameters cp = capa.getCParameters();
- if (cp.getAugmentation(CParameters1.class) != null && cp.getAugmentation(CParameters1.class)
+ if (cp.augmentation(CParameters1.class) != null && cp.augmentation(CParameters1.class)
.getMultiprotocolCapability() != null) {
- final BgpTableType t = new BgpTableTypeImpl(cp.getAugmentation(CParameters1.class)
+ final BgpTableType t = new BgpTableTypeImpl(cp.augmentation(CParameters1.class)
.getMultiprotocolCapability().getAfi(),
- cp.getAugmentation(CParameters1.class).getMultiprotocolCapability().getSafi());
+ cp.augmentation(CParameters1.class).getMultiprotocolCapability().getSafi());
result.add(t);
}
}
* @return MP-REACH-NLRI if present in the attributes, null otherwise
*/
public static MpReachNlri getMpReachNlri(final Attributes attrs) {
- if (attrs != null && attrs.getAugmentation(Attributes1.class) != null) {
- return attrs.getAugmentation(Attributes1.class).getMpReachNlri();
+ if (attrs != null) {
+ final Attributes1 aug = attrs.augmentation(Attributes1.class);
+ if (aug != null) {
+ return aug.getMpReachNlri();
+ }
}
return null;
* @return MP-UNREACH-NLRI if present in the attributes, null otherwise
*/
public static MpUnreachNlri getMpUnreachNlri(final Attributes attrs) {
- if (attrs != null && attrs.getAugmentation(Attributes2.class) != null) {
- return attrs.getAugmentation(Attributes2.class).getMpUnreachNlri();
+ if (attrs != null) {
+ final Attributes2 aug = attrs.augmentation(Attributes2.class);
+ if (aug != null) {
+ return aug.getMpUnreachNlri();
+ }
}
return null;
throws BGPDocumentedException {
final BitArray flags = BitArray.valueOf(buffer.readByte());
final int type = buffer.readUnsignedByte();
- final int len = (flags.get(EXTENDED_LENGTH_BIT)) ? buffer.readUnsignedShort() : buffer.readUnsignedByte();
+ final int len = flags.get(EXTENDED_LENGTH_BIT) ? buffer.readUnsignedShort() : buffer.readUnsignedByte();
if (!attributes.containsKey(type)) {
final AttributeParser parser = this.handlers.getParser(type);
if (parser == null) {
throw new BGPDocumentedException("Well known attribute not recognized.", BGPError.WELL_KNOWN_ATTR_NOT_RECOGNIZED);
}
final UnrecognizedAttributes unrecognizedAttribute = new UnrecognizedAttributesBuilder()
- .setKey(new UnrecognizedAttributesKey((short) type))
+ .withKey(new UnrecognizedAttributesKey((short) type))
.setPartial(flags.get(PARTIAL_BIT))
.setTransitive(flags.get(TRANSITIVE_BIT))
.setType((short) type)
assertTrue(unrecogAttrib.isTransitive());
assertArrayEquals(ByteArray.cutBytes(attributeBytes, NON_VALUE_BYTES), unrecogAttrib.getValue());
assertEquals(NON_EXISTENT_TYPE, unrecogAttrib.getType().shortValue());
- assertEquals(expectedAttribKey, unrecogAttrib.getKey());
+ assertEquals(expectedAttribKey, unrecogAttrib.key());
}
}
this.channel = requireNonNull(channel);
this.limiter = new ChannelOutputLimiter(this);
this.channel.pipeline().addLast(this.limiter);
- this.holdTimerValue = (remoteOpen.getHoldTimer() < localHoldTimer) ? remoteOpen.getHoldTimer() : localHoldTimer;
+ this.holdTimerValue = remoteOpen.getHoldTimer() < localHoldTimer ? remoteOpen.getHoldTimer() : localHoldTimer;
LOG.info("BGP HoldTimer new value: {}", this.holdTimerValue);
this.keepAlive = this.holdTimerValue / KA_TO_DEADTIMER_RATIO;
this.asNumber = AsNumberUtil.advertizedAsNumber(remoteOpen);
for (final BgpParameters param : remoteOpen.getBgpParameters()) {
for (final OptionalCapabilities optCapa : param.getOptionalCapabilities()) {
final CParameters cParam = optCapa.getCParameters();
- if (cParam.getAugmentation(CParameters1.class) == null) {
+ if (cParam.augmentation(CParameters1.class) == null) {
continue;
}
- if (cParam.getAugmentation(CParameters1.class).getMultiprotocolCapability() != null) {
- final MultiprotocolCapability multi = cParam.getAugmentation(CParameters1.class).getMultiprotocolCapability();
+ if (cParam.augmentation(CParameters1.class).getMultiprotocolCapability() != null) {
+ final MultiprotocolCapability multi = cParam.augmentation(CParameters1.class).getMultiprotocolCapability();
final TablesKey tt = new TablesKey(multi.getAfi(), multi.getSafi());
LOG.trace("Added table type to sync {}", tt);
tts.add(tt);
tats.add(new BgpTableTypeImpl(tt.getAfi(), tt.getSafi()));
- } else if (cParam.getAugmentation(CParameters1.class).getAddPathCapability() != null) {
- final AddPathCapability addPathCap = cParam.getAugmentation(CParameters1.class).getAddPathCapability();
+ } else if (cParam.augmentation(CParameters1.class).getAddPathCapability() != null) {
+ final AddPathCapability addPathCap = cParam.augmentation(CParameters1.class).getAddPathCapability();
addPathCapabilitiesList.addAll(addPathCap.getAddressFamilies());
}
}
boolean isEOR = false;
if (msg.getNlri() == null && msg.getWithdrawnRoutes() == null) {
if (msg.getAttributes() != null) {
- if (msg.getAttributes().getAugmentation(Attributes1.class) != null) {
- final Attributes1 pa = msg.getAttributes().getAugmentation(Attributes1.class);
+ if (msg.getAttributes().augmentation(Attributes1.class) != null) {
+ final Attributes1 pa = msg.getAttributes().augmentation(Attributes1.class);
if (pa.getMpReachNlri() != null) {
type = new TablesKey(pa.getMpReachNlri().getAfi(), pa.getMpReachNlri().getSafi());
}
- } else if (msg.getAttributes().getAugmentation(Attributes2.class) != null) {
- final Attributes2 pa = msg.getAttributes().getAugmentation(Attributes2.class);
+ } else if (msg.getAttributes().augmentation(Attributes2.class) != null) {
+ final Attributes2 pa = msg.getAttributes().augmentation(Attributes2.class);
if (pa.getMpUnreachNlri() != null) {
type = new TablesKey(pa.getMpUnreachNlri().getAfi(), pa.getMpUnreachNlri().getSafi());
}
switch (modificationType) {
case DELETE:
final Tables removeTable = table.getDataBefore();
- final TablesKey tableKey = removeTable.getKey();
+ final TablesKey tableKey = removeTable.key();
final KeyedInstanceIdentifier<Tables, TablesKey> effectiveTablePath
= this.effRibTables.child(Tables.class, tableKey);
LOG.debug("Delete Effective Table {} modification type {}, "
case SUBTREE_MODIFIED:
final Tables before = table.getDataBefore();
final Tables after = table.getDataAfter();
- final TablesKey tk = after.getKey();
+ final TablesKey tk = after.key();
LOG.debug("Process table {} type {}, dataAfter {}, dataBefore {}",
tk, modificationType, after, before);
if (newTable == null) {
return;
}
- final TablesKey tableKey = newTable.getKey();
+ final TablesKey tableKey = newTable.key();
final KeyedInstanceIdentifier<Tables, TablesKey> tablePath
= this.effRibTables.child(Tables.class, tableKey);
@Override
public synchronized Boolean containsEqualConfiguration(final Neighbor neighbor) {
- return Objects.equals(this.currentConfiguration.getKey(), neighbor.getKey())
+ return Objects.equals(this.currentConfiguration.key(), neighbor.key())
&& OpenConfigMappingUtil.isApplicationPeer(neighbor);
}
private synchronized void onNeighborModified(final Neighbor neighbor) {
//restart peer instance with a new configuration
- final PeerBean bgpPeer = this.peers.get(getNeighborInstanceIdentifier(this.bgpIid, neighbor.getKey()));
+ final PeerBean bgpPeer = this.peers.get(getNeighborInstanceIdentifier(this.bgpIid, neighbor.key()));
if (bgpPeer == null) {
onNeighborCreated(neighbor);
} else if (!bgpPeer.containsEqualConfiguration(neighbor)) {
bgpPeer = (PeerBean) this.container.getComponentInstance(InstanceType.PEER.getBeanName());
}
final InstanceIdentifier<Neighbor> neighborInstanceIdentifier =
- getNeighborInstanceIdentifier(this.bgpIid, neighbor.getKey());
+ getNeighborInstanceIdentifier(this.bgpIid, neighbor.key());
initiatePeerInstance(neighborInstanceIdentifier, neighbor, bgpPeer);
this.peers.put(neighborInstanceIdentifier, bgpPeer);
if (config == null) {
return null;
}
- final NeighborPeerGroupConfig aug = config.getAugmentation(NeighborPeerGroupConfig.class);
+ final NeighborPeerGroupConfig aug = config.augmentation(NeighborPeerGroupConfig.class);
return aug == null ? null : aug.getPeerGroup();
}
closePeer(bgpPeer);
final InstanceIdentifier<Neighbor> neighborInstanceIdentifier
- = getNeighborInstanceIdentifier(this.bgpIid, neighbor.getKey());
+ = getNeighborInstanceIdentifier(this.bgpIid, neighbor.key());
initiatePeerInstance(neighborInstanceIdentifier, neighbor, bgpPeer);
LOG.debug("Peer instance updated {}", bgpPeer);
}
private synchronized void onNeighborRemoved(final Neighbor neighbor) {
LOG.debug("Removing Peer instance: {}", neighbor);
- final PeerBean bgpPeer = this.peers.remove(getNeighborInstanceIdentifier(this.bgpIid, neighbor.getKey()));
+ final PeerBean bgpPeer = this.peers.remove(getNeighborInstanceIdentifier(this.bgpIid, neighbor.key()));
final String groupName = getPeerGroupName(neighbor.getConfig());
if (groupName != null) {
String peerGroupName = null;
final Config neighborConfig = neighbor.getConfig();
if (neighborConfig != null) {
- final NeighborPeerGroupConfig pgConfig = neighborConfig.getAugmentation(NeighborPeerGroupConfig.class);
+ final NeighborPeerGroupConfig pgConfig = neighborConfig.augmentation(NeighborPeerGroupConfig.class);
if (pgConfig != null) {
peerGroupName = StringUtils.substringBetween(pgConfig.getPeerGroup(), "=\"", "\"");
peerGroup = peerGroupLoader.getPeerGroup(bgpIid, peerGroupName);
if (transport != null) {
final Config config = transport.getConfig();
if (config != null) {
- final NeighborTransportConfig peerTc = config.getAugmentation(NeighborTransportConfig.class);
+ final NeighborTransportConfig peerTc = config.augmentation(NeighborTransportConfig.class);
if (peerTc != null) {
return peerTc.getRemotePort();
}
- final PeerGroupTransportConfig peerGroupTc = config.getAugmentation(PeerGroupTransportConfig.class);
+ final PeerGroupTransportConfig peerGroupTc = config.augmentation(PeerGroupTransportConfig.class);
if (peerGroupTc != null) {
return peerGroupTc.getRemotePort();
}
public static ClusterIdentifier getGlobalClusterIdentifier(final org.opendaylight.yang.gen.v1.http.openconfig.net
.yang.bgp.rev151009.bgp.global.base.Config globalConfig) {
final GlobalConfigAugmentation globalConfigAugmentation
- = globalConfig.getAugmentation(GlobalConfigAugmentation.class);
+ = globalConfig.augmentation(GlobalConfigAugmentation.class);
if (globalConfigAugmentation != null && globalConfigAugmentation.getRouteReflectorClusterId() != null) {
return new ClusterIdentifier(globalConfigAugmentation.getRouteReflectorClusterId().getIpv4Address());
}
final BGPTableTypeRegistryConsumer tableTypeRegistry, final BGPPeerTracker peerTracker) {
final Map<BgpTableType, PathSelectionMode> pathSelectionModes = new HashMap<>();
for (final AfiSafi afiSafi : afiSafis) {
- final BgpNeighborAddPathsConfig afiSafi2 = afiSafi.getAugmentation(GlobalAddPathsConfig.class);
+ final BgpNeighborAddPathsConfig afiSafi2 = afiSafi.augmentation(GlobalAddPathsConfig.class);
if (afiSafi2 != null) {
final Optional<BgpTableType> bgpTableType = tableTypeRegistry.getTableType(afiSafi.getAfiSafiName());
if (bgpTableType.isPresent()) {
final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
.Config config = neighbor.getConfig();
if (config != null) {
- final NeighborPeerGroupConfig config1 = config.getAugmentation(NeighborPeerGroupConfig.class);
+ final NeighborPeerGroupConfig config1 = config.augmentation(NeighborPeerGroupConfig.class);
if (config1 != null) {
final String peerGroup = config1.getPeerGroup();
return peerGroup != null && peerGroup.equals(APPLICATION_PEER_GROUP_NAME);
final BGPTableTypeRegistryConsumer tableTypeRegistry) {
final List<AddressFamilies> addPathCapability = new ArrayList<>();
for (final AfiSafi afiSafi : afiSafis) {
- final BgpNeighborAddPathsConfig afiSafi1 = afiSafi.getAugmentation(NeighborAddPathsConfig.class);
+ final BgpNeighborAddPathsConfig afiSafi1 = afiSafi.augmentation(NeighborAddPathsConfig.class);
final Optional<BgpTableType> bgpTableType = tableTypeRegistry.getTableType(afiSafi.getAfiSafiName());
if (afiSafi1 != null && bgpTableType.isPresent()) {
final AddressFamiliesBuilder builder = new AddressFamiliesBuilder(bgpTableType.get());
for (final BgpParameters parameters : bgpParameters) {
for (final OptionalCapabilities optionalCapabilities : parameters.getOptionalCapabilities()) {
final CParameters cParam = optionalCapabilities.getCParameters();
- final CParameters1 capabilities = cParam.getAugmentation(CParameters1.class);
+ final CParameters1 capabilities = cParam.augmentation(CParameters1.class);
if (capabilities != null) {
final MultiprotocolCapability mc = capabilities.getMultiprotocolCapability();
if (mc != null) {
}
@Override
- public synchronized void setSessionState(@Nonnull State state) {
+ public synchronized void setSessionState(@Nonnull final State state) {
if (state == State.IDLE) {
this.sessionStopwatch.reset();
} else if (state == State.UP) {
for (final BgpParameters param : ((Open) message).getBgpParameters()) {
for (final OptionalCapabilities capa : param.getOptionalCapabilities()) {
final CParameters cParam = capa.getCParameters();
- if (cParam.getAugmentation(CParameters1.class) == null) {
+ final CParameters1 aug = cParam.augmentation(CParameters1.class);
+ if (aug == null) {
continue;
}
- if (cParam.getAugmentation(CParameters1.class).getMultiprotocolCapability() != null) {
- final MultiprotocolCapability p = cParam.getAugmentation(CParameters1.class)
- .getMultiprotocolCapability();
+ if (aug.getMultiprotocolCapability() != null) {
+ final MultiprotocolCapability p = aug.getMultiprotocolCapability();
LOG.debug("Adding open parameter {}", p);
final BgpTableType type = new BgpTableTypeImpl(p.getAfi(), p.getSafi());
tts.add(type);
- } else if (cParam.getAugmentation(CParameters1.class).getAddPathCapability() != null) {
- final AddPathCapability addPathCap = cParam.getAugmentation(CParameters1.class)
- .getAddPathCapability();
+ } else if (aug.getAddPathCapability() != null) {
+ final AddPathCapability addPathCap = aug.getAddPathCapability();
addPathCapabilitiesList.addAll(addPathCap.getAddressFamilies());
}
}
this.tk = new TablesKey(afiClass, safiClass);
//FIXME Use Route Case IId instead of Tables IId.
this.emptyRoutes = (ChoiceNode) ((MapEntryNode) this.mappingService
- .toNormalizedNode(TABLES_II, new TablesBuilder().setKey(tk)
+ .toNormalizedNode(TABLES_II, new TablesBuilder().withKey(tk)
.setRoutes(emptyRoutesCase()).build()).getValue())
.getChild(new NodeIdentifier(BindingReflections.findQName(Routes.class))).get();
this.afiClass = afiClass;
}
protected final ChoiceNode createRoutes(final Routes routes) {
- final Tables tables = new TablesBuilder().setKey(getTablesKey()).setRoutes(routes).build();
+ final Tables tables = new TablesBuilder().withKey(getTablesKey()).setRoutes(routes).build();
return (ChoiceNode) ((MapEntryNode) this.mappingService.toNormalizedNode(tablesIId(), tables).getValue())
.getChild(new NodeIdentifier(BindingReflections.findQName(Routes.class))).get();
}
final InstanceIdentifier<IgpNodeAttributes> ret = nii.builder().augmentation(Node1.class)
.child(IgpNodeAttributes.class).build();
- trans.merge(LogicalDatastoreType.OPERATIONAL, nii, new NodeBuilder().setKey(nii.getKey()).setNodeId(ni)
+ trans.merge(LogicalDatastoreType.OPERATIONAL, nii, new NodeBuilder().withKey(nii.getKey()).setNodeId(ni)
.addAugmentation(Node1.class, new Node1Builder().setIgpNodeAttributes(
new IgpNodeAttributesBuilder().setPrefix(Collections.emptyList()).build()).build()).build());
final PrefixKey pk = new PrefixKey(prefix);
trans.put(LogicalDatastoreType.OPERATIONAL,
- nii.child(Prefix.class, pk), new PrefixBuilder().setKey(pk).setPrefix(prefix).build());
+ nii.child(Prefix.class, pk), new PrefixBuilder().withKey(pk).setPrefix(prefix).build());
}
@Override
requireNonNull(this.chain, "A valid transaction chain must be provided.");
final WriteTransaction trans = this.chain.newWriteOnlyTransaction();
trans.put(LogicalDatastoreType.OPERATIONAL, this.topology,
- new TopologyBuilder().setKey(this.topologyKey).setServerProvided(Boolean.TRUE)
+ new TopologyBuilder().withKey(this.topologyKey).setServerProvided(Boolean.TRUE)
.setTopologyTypes(this.topologyTypes)
.setLink(Collections.emptyList()).setNode(Collections.emptyList()).build(), true);
trans.commit().addCallback(new FutureCallback<CommitInfo>() {
private NodeHolder(final NodeId id) {
this.inab = new IgpNodeAttributesBuilder();
- this.nb = new NodeBuilder().setKey(new NodeKey(id)).setNodeId(id);
+ this.nb = new NodeBuilder().withKey(new NodeKey(id)).setNodeId(id);
}
/**
* @return True if the node has been purged, false otherwise.
*/
private boolean syncState(final WriteTransaction trans) {
- final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.getKey());
+ final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.key());
/*
* Transaction's putOperationalData() does a merge. Force it onto a replace
}
private boolean checkForRemoval(final WriteTransaction trans) {
- final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.getKey());
+ final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.key());
if (!this.advertized) {
if (this.tps.isEmpty() && this.prefixes.isEmpty()) {
}
private void addPrefix(final Prefix pfx) {
- this.prefixes.put(pfx.getKey(), pfx);
+ this.prefixes.put(pfx.key(), pfx);
}
private void removePrefix(final PrefixCase prefixCase) {
private void unadvertized() {
this.inab = new IgpNodeAttributesBuilder();
- this.nb = new NodeBuilder().setKey(this.nb.getKey()).setNodeId(this.nb.getNodeId());
+ this.nb = new NodeBuilder().withKey(this.nb.key()).setNodeId(this.nb.getNodeId());
this.advertized = false;
LOG.debug("Node {} is unadvertized", this.nb.getNodeId());
}
private static TerminationPoint buildTp(final TpId id, final TerminationPointType type) {
final TerminationPointBuilder stpb = new TerminationPointBuilder();
- stpb.setKey(new TerminationPointKey(id));
+ stpb.withKey(new TerminationPointKey(id));
stpb.setTpId(id);
if (type != null) {
final LinkstateRoute value, final LinkCase linkCase, final Attributes attributes) {
// defensive lookup
final LinkAttributes la;
- final Attributes1 attr = attributes.getAugmentation(Attributes1.class);
+ final Attributes1 attr = attributes.augmentation(Attributes1.class);
if (attr != null) {
final LinkStateAttribute attrType = attr.getLinkStateAttribute();
if (attrType != null) {
} else {
snh.addTp(srcTp, lb.getLinkId(), false);
final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(new NodeKey(snh.getNodeId()));
- trans.put(LogicalDatastoreType.OPERATIONAL, nid.child(TerminationPoint.class, srcTp.getKey()), srcTp);
+ trans.put(LogicalDatastoreType.OPERATIONAL, nid.child(TerminationPoint.class, srcTp.key()), srcTp);
}
LOG.debug("Created TP {} as link destination", dstTp);
final InstanceIdentifier<Node> nid = getInstanceIdentifier().child(
org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network
.topology.topology.Node.class, new NodeKey(dnh.getNodeId()));
- trans.put(LogicalDatastoreType.OPERATIONAL, nid.child(TerminationPoint.class, dstTp.getKey()), dstTp);
+ trans.put(LogicalDatastoreType.OPERATIONAL, nid.child(TerminationPoint.class, dstTp.key()), dstTp);
}
final InstanceIdentifier<Link> lid = buildLinkIdentifier(lb.getLinkId());
final LinkstateRoute value, final NodeCase nodeCase, final Attributes attributes) {
final NodeAttributes na;
//defensive lookup
- final Attributes1 attr = attributes.getAugmentation(Attributes1.class);
+ final Attributes1 attr = attributes.augmentation(Attributes1.class);
if (attr != null) {
final LinkStateAttribute attrType = attr.getLinkStateAttribute();
if (attrType != null) {
*/
final NodeBuilder nb = new NodeBuilder();
nb.setNodeId(nid);
- nb.setKey(new NodeKey(nb.getNodeId()));
+ nb.withKey(new NodeKey(nb.getNodeId()));
nh.advertized(nb, inab);
putNode(trans, nh);
}
final PrefixBuilder pb = new PrefixBuilder();
final PrefixKey pk = new PrefixKey(ippfx);
- pb.setKey(pk);
+ pb.withKey(pk);
pb.setPrefix(ippfx);
final PrefixAttributes pa;
// Very defensive lookup
- final Attributes1 attr = attributes.getAugmentation(Attributes1.class);
+ final Attributes1 attr = attributes.augmentation(Attributes1.class);
if (attr != null) {
final LinkStateAttribute attrType = attr.getLinkStateAttribute();
if (attrType != null) {
for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329
.UnreservedBandwidth bandwidth : input) {
ret.add(new UnreservedBandwidthBuilder().setBandwidth(bandwidthToBigDecimal(bandwidth.getBandwidth()))
- .setKey(new UnreservedBandwidthKey(bandwidth.getPriority())).build());
+ .withKey(new UnreservedBandwidthKey(bandwidth.getPriority())).build());
}
return ret;
private TopologyReferenceSingletonService createInstance(final Topology topology) {
final RibReference ribReference = new DefaultRibReference(InstanceIdentifier.create(BgpRib.class)
- .child(Rib.class, new RibKey(topology.getAugmentation(Topology1.class).getRibId())));
+ .child(Rib.class, new RibKey(topology.augmentation(Topology1.class).getRibId())));
final AbstractTopologyBuilder<?> topologyBuilder = createTopologyBuilder(this.dataBroker,
ribReference, topology.getTopologyId());
return new TopologyReferenceSingletonServiceImpl(topologyBuilder, this.deployer, topology);
abstract AbstractTopologyBuilder<?> createTopologyBuilder(DataBroker dataProvider, RibReference locRibReference,
TopologyId topologyId);
- final TopologyTypes1 getTopologyAug(final Topology topology) {
+ static final TopologyTypes1 getTopologyAug(final Topology topology) {
final TopologyTypes topologyTypes = topology.getTopologyTypes();
if (topologyTypes == null) {
return null;
}
- return topologyTypes.getAugmentation(TopologyTypes1.class);
+ return topologyTypes.augmentation(TopologyTypes1.class);
}
}
updateIpv4Route(createIpv4Route(NEXT_HOP));
readDataOperational(getDataBroker(), this.ipv4TopoBuilder.getInstanceIdentifier(), topology -> {
- final TopologyTypes1 topologyTypes = topology.getTopologyTypes().getAugmentation(TopologyTypes1.class);
+ final TopologyTypes1 topologyTypes = topology.getTopologyTypes().augmentation(TopologyTypes1.class);
assertNotNull(topologyTypes);
assertNotNull(topologyTypes.getBgpIpv4ReachabilityTopology());
assertEquals(1, topology.getNode().size());
final Node node = topology.getNode().get(0);
assertEquals(NEXT_HOP, node.getNodeId().getValue());
- assertEquals(ROUTE_IP4PREFIX, node.getAugmentation(Node1.class).getIgpNodeAttributes().getPrefix().get(0)
+ assertEquals(ROUTE_IP4PREFIX, node.augmentation(Node1.class).getIgpNodeAttributes().getPrefix().get(0)
.getPrefix().getIpv4Prefix().getValue());
return topology;
});
assertEquals(1, topology.getNode().size());
final Node nodeUpdated = topology.getNode().get(0);
assertEquals(NEW_NEXT_HOP, nodeUpdated.getNodeId().getValue());
- assertEquals(ROUTE_IP4PREFIX, nodeUpdated.getAugmentation(Node1.class).getIgpNodeAttributes()
+ assertEquals(ROUTE_IP4PREFIX, nodeUpdated.augmentation(Node1.class).getIgpNodeAttributes()
.getPrefix().get(0).getPrefix().getIpv4Prefix().getValue());
return topology;
});
.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build())
.setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
.setGlobal(new Ipv4Address(nextHop)).build()).build()).build();
- return new Ipv4RouteBuilder().setKey(new Ipv4RouteKey(new PathId(PATH_ID), ROUTE_IP4PREFIX))
+ return new Ipv4RouteBuilder().withKey(new Ipv4RouteKey(new PathId(PATH_ID), ROUTE_IP4PREFIX))
.setPrefix(new Ipv4Prefix(ROUTE_IP4PREFIX)).setAttributes(attribute).build();
}
updateIpv6Route(createIpv6Route(NEXT_HOP));
readDataOperational(getDataBroker(), this.ipv6TopoBuilder.getInstanceIdentifier(), topology -> {
- final TopologyTypes1 topologyType = topology.getTopologyTypes().getAugmentation(TopologyTypes1.class);
+ final TopologyTypes1 topologyType = topology.getTopologyTypes().augmentation(TopologyTypes1.class);
assertNotNull(topologyType);
assertNotNull(topologyType.getBgpIpv6ReachabilityTopology());
assertEquals(1, topology.getNode().size());
final Node node = topology.getNode().get(0);
assertEquals(NEXT_HOP, node.getNodeId().getValue());
- assertEquals(ROUTE_IP6PREFIX, node.getAugmentation(Node1.class).getIgpNodeAttributes().getPrefix()
+ assertEquals(ROUTE_IP6PREFIX, node.augmentation(Node1.class).getIgpNodeAttributes().getPrefix()
.get(0).getPrefix().getIpv6Prefix().getValue());
return topology;
});
assertEquals(1, topology.getNode().size());
final Node nodeUpdated = topology.getNode().get(0);
assertEquals(NEW_NEXT_HOP, nodeUpdated.getNodeId().getValue());
- assertEquals(ROUTE_IP6PREFIX, nodeUpdated.getAugmentation(Node1.class).getIgpNodeAttributes().getPrefix()
+ assertEquals(ROUTE_IP6PREFIX, nodeUpdated.augmentation(Node1.class).getIgpNodeAttributes().getPrefix()
.get(0).getPrefix().getIpv6Prefix().getValue());
return topology;
});
.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build())
.setCNextHop(new Ipv6NextHopCaseBuilder().setIpv6NextHop(
new Ipv6NextHopBuilder().setGlobal(new Ipv6Address(netxHop)).build()).build()).build();
- return new Ipv6RouteBuilder().setKey(new Ipv6RouteKey(new PathId(PATH_ID), ROUTE_IP6PREFIX))
+ return new Ipv6RouteBuilder().withKey(new Ipv6RouteKey(new PathId(PATH_ID), ROUTE_IP6PREFIX))
.setPrefix(new Ipv6Prefix(ROUTE_IP6PREFIX)).setAttributes(attribute).build();
}
}
@Test
public void testLinkstateTopologyBuilderTopologyTypes() throws ReadFailedException {
readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
- assertNotNull(topology.getTopologyTypes().getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight
+ assertNotNull(topology.getTopologyTypes().augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight
.params.xml.ns.yang.odl.bgp.topology.types.rev160524.TopologyTypes1.class));
- assertNotNull(topology.getTopologyTypes().getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight
+ assertNotNull(topology.getTopologyTypes().augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight
.params.xml.ns.yang.odl.bgp.topology.types.rev160524.TopologyTypes1.class)
.getBgpLinkstateTopology());
return topology;
assertEquals(1, topology.getNode().size());
final Node node1 = topology.getNode().get(0);
assertEquals(NODE_1_ISIS_ID, node1.getNodeId().getValue());
- final IgpNodeAttributes igpNode1 = node1.getAugmentation(Node1.class).getIgpNodeAttributes();
+ final IgpNodeAttributes igpNode1 = node1.augmentation(Node1.class).getIgpNodeAttributes();
assertEquals(ROUTER_1_ID, igpNode1.getRouterId().get(0).getIpv4Address().getValue());
assertEquals("node1", igpNode1.getName().getValue());
- final IgpNodeAttributes1 igpNodeAttributes1 = igpNode1.getAugmentation(IgpNodeAttributes1.class);
+ final IgpNodeAttributes1 igpNodeAttributes1 = igpNode1.augmentation(IgpNodeAttributes1.class);
assertEquals("0000.0102.0304", igpNodeAttributes1.getIsisNodeAttributes().getIso().getIsoSystemId()
.getValue());
assertEquals(ROUTER_1_ID, igpNodeAttributes1.getIsisNodeAttributes().getTed().getTeRouterIdIpv4()
.getValue());
assertEquals("47.0000.0000.0000.0000.0102.0304", igpNodeAttributes1.getIsisNodeAttributes()
.getNet().get(0).getValue());
- assertNull(igpNode1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf
+ assertNull(igpNode1.augmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf
.topology.rev131021.IgpNodeAttributes1.class));
return topology;
});
+ "=2&mt=1", link1.getLinkId().getValue());
assertEquals(NODE_1_ISIS_ID, link1.getSource().getSourceNode().getValue());
assertEquals(NODE_2_ISIS_ID, link1.getDestination().getDestNode().getValue());
- final IgpLinkAttributes igpLink1 = link1.getAugmentation(Link1.class).getIgpLinkAttributes();
+ final IgpLinkAttributes igpLink1 = link1.augmentation(Link1.class).getIgpLinkAttributes();
assertEquals("link1", igpLink1.getName());
- assertEquals((short) 1, igpLink1.getAugmentation(IgpLinkAttributes1.class).getIsisLinkAttributes()
+ assertEquals((short) 1, igpLink1.augmentation(IgpLinkAttributes1.class).getIsisLinkAttributes()
.getMultiTopologyId().shortValue());
- assertNull(igpLink1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf
+ assertNull(igpLink1.augmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf
.topology.rev131021.IgpLinkAttributes1.class));
return topology;
});
NODE_1_AS, ROUTER_2_ID));
readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
assertEquals(1, topology.getNode().size());
- final IgpNodeAttributes igpNode2 = topology.getNode().get(0).getAugmentation(Node1.class)
+ final IgpNodeAttributes igpNode2 = topology.getNode().get(0).augmentation(Node1.class)
.getIgpNodeAttributes();
assertEquals(ROUTER_2_ID, igpNode2.getRouterId().get(0).getIpv4Address().getValue());
assertEquals("updated-node", igpNode2.getName().getValue());
assertEquals(1, topology.getNode().size());
final Node node1 = topology.getNode().get(0);
assertEquals(NODE_1_OSPF_ID, node1.getNodeId().getValue());
- final IgpNodeAttributes igpNode1 = node1.getAugmentation(Node1.class).getIgpNodeAttributes();
+ final IgpNodeAttributes igpNode1 = node1.augmentation(Node1.class).getIgpNodeAttributes();
assertEquals(ROUTER_1_ID, igpNode1.getRouterId().get(0).getIpv4Address().getValue());
assertEquals("node1", igpNode1.getName().getValue());
- assertNull(igpNode1.getAugmentation(IgpNodeAttributes1.class));
- assertEquals(ROUTER_1_ID, igpNode1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns
+ assertNull(igpNode1.augmentation(IgpNodeAttributes1.class));
+ assertEquals(ROUTER_1_ID, igpNode1.augmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns
.yang.ospf.topology.rev131021.IgpNodeAttributes1.class).getOspfNodeAttributes().getTed()
.getTeRouterIdIpv4().getValue());
return topology;
updateLinkstateRoute(createLinkstatePrefixRoute(ProtocolId.Ospf, NODE_1_AS, NODE_1_PREFIX,
500L, ROUTER_1_ID));
readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
- final IgpNodeAttributes igpNode2 = topology.getNode().get(0)
- .getAugmentation(Node1.class).getIgpNodeAttributes();
+ final IgpNodeAttributes igpNode2 = topology.getNode().get(0).augmentation(Node1.class)
+ .getIgpNodeAttributes();
assertEquals(1, igpNode2.getPrefix().size());
final Prefix prefix = igpNode2.getPrefix().get(0);
assertEquals(NODE_1_PREFIX, prefix.getPrefix().getIpv4Prefix().getValue());
link1.getLinkId().getValue());
assertEquals(NODE_1_OSPF_ID, link1.getSource().getSourceNode().getValue());
assertEquals(NODE_2_OSPF_ID, link1.getDestination().getDestNode().getValue());
- final IgpLinkAttributes igpLink1 = link1.getAugmentation(Link1.class).getIgpLinkAttributes();
+ final IgpLinkAttributes igpLink1 = link1.augmentation(Link1.class).getIgpLinkAttributes();
assertEquals("link1", igpLink1.getName());
- assertNull(igpLink1.getAugmentation(IgpLinkAttributes1.class));
- assertEquals((short) 1, igpLink1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang
+ assertNull(igpLink1.augmentation(IgpLinkAttributes1.class));
+ assertEquals((short) 1, igpLink1.augmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang
.ospf.topology.rev131021.IgpLinkAttributes1.class).getOspfLinkAttributes().getMultiTopologyId()
.shortValue());
- assertEquals(2, igpLink1.getAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns
+ assertEquals(2, igpLink1.augmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns
.yang.ospf.topology.rev131021.IgpLinkAttributes1.class).getOspfLinkAttributes().getTed().getSrlg()
.getSrlgValues().size());
return topology;
.setMaxReservableBandwidth(
new Bandwidth(new byte[]{0x00, 0x00, (byte) 0xff, (byte) 0x1f}))
.setUnreservedBandwidth(Lists.newArrayList(new UnreservedBandwidthBuilder()
- .setKey(new UnreservedBandwidthKey((short) 1))
+ .withKey(new UnreservedBandwidthKey((short) 1))
.setBandwidth(new Bandwidth(new byte[]{0x00, 0x00, 0x00, (byte) 0xff}))
.build()))
.setTeMetric(new TeMetric(100L)).setLinkName(linkName).build()).build())
private static LinkstateRouteBuilder createBaseBuilder(final ProtocolId protocolId) {
return new LinkstateRouteBuilder()
.setIdentifier(IDENTIFIER)
- .setKey(new LinkstateRouteKey(new PathId(0L), LINKSTATE_ROUTE_KEY))
+ .withKey(new LinkstateRouteKey(new PathId(0L), LINKSTATE_ROUTE_KEY))
.setRouteKey(LINKSTATE_ROUTE_KEY)
.setProtocolId(protocolId);
}
MpReachNlri mpReach = null;
if (message.getNlri() != null) {
mpReach = prefixesToMpReach(message);
- } else if (attrs != null && attrs.getAugmentation(Attributes1.class) != null) {
- mpReach = attrs.getAugmentation(Attributes1.class).getMpReachNlri();
+ } else if (attrs != null && attrs.augmentation(Attributes1.class) != null) {
+ mpReach = attrs.augmentation(Attributes1.class).getMpReachNlri();
}
if (mpReach != null) {
addRoutes(mpReach, attrs);
MpUnreachNlri mpUnreach = null;
if (message.getWithdrawnRoutes() != null) {
mpUnreach = prefixesToMpUnreach(message);
- } else if (attrs != null && attrs.getAugmentation(Attributes2.class) != null) {
- mpUnreach = attrs.getAugmentation(Attributes2.class).getMpUnreachNlri();
+ } else if (attrs != null && attrs.augmentation(Attributes2.class) != null) {
+ mpUnreach = attrs.augmentation(Attributes2.class).getMpUnreachNlri();
}
if (mpUnreach != null) {
removeRoutes(mpUnreach);
boolean isEOR = false;
if (msg.getNlri() == null && msg.getWithdrawnRoutes() == null) {
if (msg.getAttributes() != null) {
- if (msg.getAttributes().getAugmentation(Attributes1.class) != null) {
- final Attributes1 pa = msg.getAttributes().getAugmentation(Attributes1.class);
+ if (msg.getAttributes().augmentation(Attributes1.class) != null) {
+ final Attributes1 pa = msg.getAttributes().augmentation(Attributes1.class);
if (pa.getMpReachNlri() != null) {
type = new TablesKey(pa.getMpReachNlri().getAfi(), pa.getMpReachNlri().getSafi());
}
- } else if (msg.getAttributes().getAugmentation(Attributes2.class) != null) {
- final Attributes2 pa = msg.getAttributes().getAugmentation(Attributes2.class);
+ } else if (msg.getAttributes().augmentation(Attributes2.class) != null) {
+ final Attributes2 pa = msg.getAttributes().augmentation(Attributes2.class);
if (pa.getMpUnreachNlri() != null) {
type = new TablesKey(pa.getMpUnreachNlri().getAfi(), pa.getMpUnreachNlri().getSafi());
}
for (final BgpParameters param : open.getBgpParameters()) {
for (final OptionalCapabilities optCapa : param.getOptionalCapabilities()) {
final CParameters cParam = optCapa.getCParameters();
- if (cParam.getAugmentation(CParameters1.class) == null
- || cParam.getAugmentation(CParameters1.class).getMultiprotocolCapability() == null) {
+ if (cParam.augmentation(CParameters1.class) == null
+ || cParam.augmentation(CParameters1.class).getMultiprotocolCapability() == null) {
continue;
}
- final MultiprotocolCapability multi = cParam.getAugmentation(CParameters1.class)
+ final MultiprotocolCapability multi = cParam.augmentation(CParameters1.class)
.getMultiprotocolCapability();
final TablesKey tt = new TablesKey(multi.getAfi(), multi.getSafi());
tables.add(tt);
private static void processBmpMonitorConfig(final BmpMonitorConfig bmpConfig, final WriteTransaction wtx) {
final KeyedInstanceIdentifier<BmpMonitorConfig, BmpMonitorConfigKey> iid = ODL_BMP_MONITORS_IID
- .child(BmpMonitorConfig.class, bmpConfig.getKey());
+ .child(BmpMonitorConfig.class, bmpConfig.key());
wtx.merge(LogicalDatastoreType.CONFIGURATION, iid, bmpConfig, true);
}
private static void processProtocol(final Protocol protocol, final WriteTransaction wtx) {
final KeyedInstanceIdentifier<Protocol, ProtocolKey> topologyIIdKeyed =
- BGP_PROTOCOLS_IID.child(Protocol.class, protocol.getKey());
+ BGP_PROTOCOLS_IID.child(Protocol.class, protocol.key());
wtx.merge(LogicalDatastoreType.CONFIGURATION, topologyIIdKeyed, protocol, true);
}
private static void processTopology(final Topology topology, final WriteTransaction wtx) {
LOG.info("Storing Topology {}", topology);
final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIIdKeyed =
- InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, topology.getKey());
+ InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, topology.key());
wtx.merge(LogicalDatastoreType.CONFIGURATION, topologyIIdKeyed, topology, true);
}
}
protected void serializeObject(final Object object, final ByteBuf buffer) {
super.serializeObject(object, buffer);
if (object instanceof Bandwidth) {
- final Bandwidth1 bw = ((Bandwidth) object).getAugmentation(Bandwidth1.class);
+ final Bandwidth1 bw = ((Bandwidth) object).augmentation(Bandwidth1.class);
if (bw != null) {
super.serializeObject(new BandwidthUsageBuilder().setBwSample(bw.getBwSample()).build(), buffer);
}
final Ero ero = new EroBuilder().build();
final List<Object> objects = Lists.newArrayList(lsp, ero, bw);
final Reports validReports = codec.getValidReports(objects, Collections.emptyList());
- assertNotNull(validReports.getPath().getBandwidth().getAugmentation(Bandwidth1.class));
+ assertNotNull(validReports.getPath().getBandwidth().augmentation(Bandwidth1.class));
assertTrue(objects.isEmpty());
}
final Pcrpt msg = (Pcrpt) this.ctx.getMessageHandlerRegistry().parseMessage(10,
Unpooled.wrappedBuffer(parseHexBinary), Collections.emptyList());
Assert.assertNotNull(msg.getPcrptMessage().getReports().get(0).getPath()
- .getBandwidth().getAugmentation(Bandwidth1.class));
+ .getBandwidth().augmentation(Bandwidth1.class));
}
}
flags.set(REMOVE, specObj.isRemove());
flags.set(SYNC, specObj.isSync());
flags.set(ADMINISTRATIVE, specObj.isAdministrative());
- if (specObj.getAugmentation(Lsp1.class) != null) {
- flags.set(CREATE_FLAG_OFFSET, specObj.getAugmentation(Lsp1.class).isCreate());
+ if (specObj.augmentation(Lsp1.class) != null) {
+ flags.set(CREATE_FLAG_OFFSET, specObj.augmentation(Lsp1.class).isCreate());
}
return flags;
}
@Override
protected void serializeFlags(final Srp srp, final ByteBuf body) {
final BitArray flags = new BitArray(FLAGS_SIZE);
- if (srp.getAugmentation(Srp1.class) != null) {
- flags.set(REMOVE_FLAG, srp.getAugmentation(Srp1.class).isRemove());
+ if (srp.augmentation(Srp1.class) != null) {
+ flags.set(REMOVE_FLAG, srp.augmentation(Srp1.class).isRemove());
}
flags.toByteBuf(body);
}
@Override
protected BitArray serializeFlags(final Stateful sct) {
final BitArray flags = new BitArray(FLAGS_F_LENGTH);
- final Stateful1 sfi = sct.getAugmentation(Stateful1.class);
+ final Stateful1 sfi = sct.augmentation(Stateful1.class);
if (sfi != null) {
flags.set(I_FLAG_OFFSET, sfi.isInitiation());
}
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs2Builder nameBuilder = new Tlvs2Builder();
- if (tbuilder.getAugmentation(Tlvs2.class) != null) {
- final Tlvs2 t = tbuilder.getAugmentation(Tlvs2.class);
+ if (tbuilder.augmentation(Tlvs2.class) != null) {
+ final Tlvs2 t = tbuilder.augmentation(Tlvs2.class);
if (t.getSymbolicPathName() != null) {
nameBuilder.setSymbolicPathName(t.getSymbolicPathName());
}
return;
}
super.serializeTlvs(tlvs, body);
- if (tlvs.getAugmentation(Tlvs2.class) != null) {
- final Tlvs2 nameTlvs = tlvs.getAugmentation(Tlvs2.class);
+ if (tlvs.augmentation(Tlvs2.class) != null) {
+ final Tlvs2 nameTlvs = tlvs.augmentation(Tlvs2.class);
if (nameTlvs.getSymbolicPathName() != null) {
serializeTlv(nameTlvs.getSymbolicPathName(), body);
}
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder statefulBuilder = new Tlvs1Builder();
- if (tbuilder.getAugmentation(Tlvs1.class) != null) {
- final Tlvs1 t = tbuilder.getAugmentation(Tlvs1.class);
+ if (tbuilder.augmentation(Tlvs1.class) != null) {
+ final Tlvs1 t = tbuilder.augmentation(Tlvs1.class);
if (t.getStateful() != null) {
statefulBuilder.setStateful(t.getStateful());
}
if (tlvs.getOfList() != null) {
serializeTlv(tlvs.getOfList(), body);
}
- if (tlvs.getAugmentation(Tlvs1.class) != null) {
- final Tlvs1 statefulTlvs = tlvs.getAugmentation(Tlvs1.class);
+ if (tlvs.augmentation(Tlvs1.class) != null) {
+ final Tlvs1 statefulTlvs = tlvs.augmentation(Tlvs1.class);
if (statefulTlvs.getStateful() != null) {
serializeTlv(statefulTlvs.getStateful(), body);
}
@Override
protected BitArray serializeFlags(final Stateful sct) {
final BitArray flags = new BitArray(FLAGS_F_LENGTH);
- final Stateful1 sfi = sct.getAugmentation(Stateful1.class);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 sf2 = sct.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1.class);
+ final Stateful1 sfi = sct.augmentation(Stateful1.class);
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1 sf2 = sct.augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1.class);
if (sf2 != null) {
flags.set(F_FLAG_OFFSET, sf2.isTriggeredInitialSync());
flags.set(D_FLAG_OFFSET, sf2.isDeltaLspSyncCapability());
public void serializeTlvs(final Tlvs tlvs, final ByteBuf body) {
if (tlvs != null) {
super.serializeTlvs(tlvs, body);
- serializeAugmentation(tlvs.getAugmentation(Tlvs1.class), body);
+ serializeAugmentation(tlvs.augmentation(Tlvs1.class), body);
}
}
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder syncOptTlvsBuilder = new Tlvs1Builder();
- if (tbuilder.getAugmentation(Tlvs1.class) != null) {
- final Tlvs1 t = tbuilder.getAugmentation(Tlvs1.class);
+ if (tbuilder.augmentation(Tlvs1.class) != null) {
+ final Tlvs1 t = tbuilder.augmentation(Tlvs1.class);
if (t.getLspDbVersion() != null) {
syncOptTlvsBuilder.setLspDbVersion(t.getLspDbVersion());
}
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs3Builder syncOptTlvsBuilder = new Tlvs3Builder();
- if (tbuilder.getAugmentation(Tlvs3.class) != null) {
- final Tlvs3 t = tbuilder.getAugmentation(Tlvs3.class);
+ if (tbuilder.augmentation(Tlvs3.class) != null) {
+ final Tlvs3 t = tbuilder.augmentation(Tlvs3.class);
if (t.getLspDbVersion() != null) {
syncOptTlvsBuilder.setLspDbVersion(t.getLspDbVersion());
}
return;
}
super.serializeTlvs(tlvs, body);
- if (tlvs.getAugmentation(Tlvs3.class) != null) {
- final Tlvs3 syncOptTlvs = tlvs.getAugmentation(Tlvs3.class);
+ if (tlvs.augmentation(Tlvs3.class) != null) {
+ final Tlvs3 syncOptTlvs = tlvs.augmentation(Tlvs3.class);
if (syncOptTlvs.getLspDbVersion() != null) {
serializeTlv(syncOptTlvs.getLspDbVersion(), body);
}
// Tlvs container does not contain toString
final Object o = parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4));
- assertEquals(tlv, ((Lspa) o).getTlvs().getAugmentation(Tlvs2.class).getSymbolicPathName());
+ assertEquals(tlv, ((Lspa) o).getTlvs().augmentation(Tlvs2.class).getSymbolicPathName());
// assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), ByteArray.cutBytes(result,
// 4)));
final ByteBuf buf = Unpooled.buffer();
private static LspDbVersion getLspDbVersion(final Tlvs openTlvs) {
if (openTlvs != null) {
- final Tlvs3 tlvs3 = openTlvs.getAugmentation(Tlvs3.class);
+ final Tlvs3 tlvs3 = openTlvs.augmentation(Tlvs3.class);
if (tlvs3 != null && tlvs3.getLspDbVersion() != null
&& tlvs3.getLspDbVersion().getLspDbVersionValue() != null) {
return tlvs3.getLspDbVersion();
private static Stateful1 getStateful1(final Tlvs openTlvs) {
if (openTlvs != null) {
- final Tlvs1 tlvs1 = openTlvs.getAugmentation(Tlvs1.class);
+ final Tlvs1 tlvs1 = openTlvs.augmentation(Tlvs1.class);
if (tlvs1 != null && tlvs1.getStateful() != null) {
- return tlvs1.getStateful().getAugmentation(Stateful1.class);
+ return tlvs1.getStateful().augmentation(Stateful1.class);
}
}
return null;
@Override
public void onMessagePcInitiate(@Nonnull final Requests request, @Nonnull final PCCSession session) {
- if ((request.getSrp().getAugmentation(Srp1.class) != null)
- && request.getSrp().getAugmentation(Srp1.class).isRemove()) {
+ if ((request.getSrp().augmentation(Srp1.class) != null)
+ && request.getSrp().augmentation(Srp1.class).isRemove()) {
//remove LSP
removeTunnel(request, session);
} else if ((request.getLsp().isDelegate() != null) && request.getLsp().isDelegate()
final PCEPSession session = pceSessionListener.getSession();
checkSession(session, DEAD_TIMER, KEEP_ALIVE);
- assertTrue(session.getRemoteTlvs().getAugmentation(Tlvs1.class).getStateful()
- .getAugmentation(Stateful1.class).isInitiation());
- assertNull(session.getLocalTlvs().getAugmentation(Tlvs3.class)
+ assertTrue(session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful()
+ .augmentation(Stateful1.class).isInitiation());
+ assertNull(session.getLocalTlvs().augmentation(Tlvs3.class)
.getLspDbVersion().getLspDbVersionValue());
}
checkSession(session, DEAD_TIMER, KEEP_ALIVE);
- assertTrue(session.getRemoteTlvs().getAugmentation(Tlvs1.class).getStateful()
- .getAugmentation(Stateful1.class).isInitiation());
- final BigInteger pceDBVersion = session.getLocalTlvs().getAugmentation(Tlvs3.class)
+ assertTrue(session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful()
+ .augmentation(Stateful1.class).isInitiation());
+ final BigInteger pceDBVersion = session.getLocalTlvs().augmentation(Tlvs3.class)
.getLspDbVersion().getLspDbVersionValue();
assertEquals(startingDBVersion, pceDBVersion);
}
assertNotNull(session);
assertEquals(expectedDeadTimer, session.getPeerPref().getDeadtimer().shortValue());
assertEquals(expectedKeepAlive, session.getPeerPref().getKeepalive().shortValue());
- final Stateful1 stateful = session.getRemoteTlvs().getAugmentation(Tlvs1.class)
- .getStateful().getAugmentation(Stateful1.class);
+ final Stateful1 stateful = session.getRemoteTlvs().augmentation(Tlvs1.class)
+ .getStateful().augmentation(Stateful1.class);
assertTrue(stateful.isInitiation());
}
} else {
assertEquals(true, lsp.isSync());
}
- final BigInteger actuaLspDBVersion = lsp.getTlvs().getAugmentation(org.opendaylight.yang.gen
+ final BigInteger actuaLspDBVersion = lsp.getTlvs().augmentation(org.opendaylight.yang.gen
.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs1.class)
.getLspDbVersion().getLspDbVersionValue();
assertEquals(expectedDbVersion, actuaLspDBVersion);
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder tlvBuilder = new Tlvs1Builder();
- if (tbuilder.getAugmentation(Tlvs1.class) != null) {
- final Tlvs1 tlvs = tbuilder.getAugmentation(Tlvs1.class);
+ if (tbuilder.augmentation(Tlvs1.class) != null) {
+ final Tlvs1 tlvs = tbuilder.augmentation(Tlvs1.class);
if (tlvs.getSrPceCapability() != null) {
tlvBuilder.setSrPceCapability(tlvs.getSrPceCapability());
}
return;
}
super.serializeTlvs(tlvs, body);
- if (tlvs.getAugmentation(Tlvs1.class) != null) {
- final Tlvs1 spcTlvs = tlvs.getAugmentation(Tlvs1.class);
+ if (tlvs.augmentation(Tlvs1.class) != null) {
+ final Tlvs1 spcTlvs = tlvs.augmentation(Tlvs1.class);
if (spcTlvs.getSrPceCapability() != null) {
serializeTlv(spcTlvs.getSrPceCapability(), body);
}
assertEquals(1, reportedLsps.size());
final ReportedLsp lsp = reportedLsps.get(0);
assertEquals("sr-path1", lsp.getName());
- assertEquals(1, lsp.getPath().get(0).getAugmentation(Path1.class).getPathSetupType()
+ assertEquals(1, lsp.getPath().get(0).augmentation(Path1.class).getPathSetupType()
.getPst().intValue());
final List<Subobject> subobjects = lsp.getPath().get(0).getEro().getSubobject();
assertEquals(1, subobjects.size());
stream.println(String.format("Node [%s] not found", nodeId));
return;
}
- final PcepTopologyNodeStatsAug state = node.getAugmentation(PcepTopologyNodeStatsAug.class);
+ final PcepTopologyNodeStatsAug state = node.augmentation(PcepTopologyNodeStatsAug.class);
if (state == null) {
stream.println(String.format("State not found for [%s]", nodeId));
return;
addHeader(table, "Local preferences");
final LocalPref localPref = pcepSessionState.getLocalPref();
showPreferences(table, localPref);
- final PcepEntityIdStatsAug entAug = localPref.getAugmentation(PcepEntityIdStatsAug.class);
+ final PcepEntityIdStatsAug entAug = localPref.augmentation(PcepEntityIdStatsAug.class);
if (entAug != null) {
table.addRow().addContent("Speaker Entity Identifier",
Arrays.toString(entAug.getSpeakerEntityIdValue()));
if (capa == null) {
return;
}
- final StatefulCapabilitiesStatsAug stateFulCapa = capa.getAugmentation(StatefulCapabilitiesStatsAug.class);
+ final StatefulCapabilitiesStatsAug stateFulCapa = capa.augmentation(StatefulCapabilitiesStatsAug.class);
if (stateFulCapa != null) {
addHeader(table, "Stateful Capabilities");
table.addRow().addContent("Stateful", stateFulCapa.isStateful());
table.addRow().addContent("Sent Msg Count", messages.getSentMsgCount());
table.addRow().addContent("Unknown Msg Received", messages.getUnknownMsgReceived());
- final StatefulMessagesStatsAug statefulMessages = messages.getAugmentation(StatefulMessagesStatsAug.class);
+ final StatefulMessagesStatsAug statefulMessages = messages.augmentation(StatefulMessagesStatsAug.class);
if (statefulMessages == null) {
return;
}
final boolean isNodePresent = isLspDbRetreived() && initialNodeState != null;
if (isNodePresent) {
loadLspData(initialNodeState, this.lspData, this.lsps, isIncrementalSynchro());
- pccBuilder.setReportedLsp(initialNodeState.getAugmentation(Node1.class)
+ pccBuilder.setReportedLsp(initialNodeState.augmentation(Node1.class)
.getPathComputationClient().getReportedLsp());
}
state.storeNode(topologyAugment,
}
rlb.setPath(updatedPaths);
}
- rlb.setKey(new ReportedLspKey(name));
+ rlb.withKey(new ReportedLspKey(name));
rlb.setName(name);
// If this is an unsolicited update. We need to make sure we retain the metadata already present
}
final ReportedLsp rl = rlb.build();
- ctx.trans.put(LogicalDatastoreType.OPERATIONAL, this.pccIdentifier.child(ReportedLsp.class, rlb.getKey()), rl);
+ ctx.trans.put(LogicalDatastoreType.OPERATIONAL, this.pccIdentifier.child(ReportedLsp.class, rlb.key()), rl);
LOG.debug("LSP {} updated to MD-SAL", name);
this.lspData.put(name, rl);
.map(ReportedLsp::getPath).filter(Objects::nonNull).filter(pathList -> !pathList.isEmpty())
// pick the first path, as delegate status should be same in each path
.map(pathList -> pathList.get(0))
- .map(path -> path.getAugmentation(Path1.class)).filter(Objects::nonNull)
+ .map(path -> path.augmentation(Path1.class)).filter(Objects::nonNull)
.map(LspObject::getLsp).filter(Objects::nonNull)
.filter(Lsp::isDelegate)
.count());
}
private static boolean isSynOptimizationEnabled(final TlvsBuilder openTlvsBuilder) {
- final Tlvs1 statefulTlv = openTlvsBuilder.getAugmentation(Tlvs1.class);
+ final Tlvs1 statefulTlv = openTlvsBuilder.augmentation(Tlvs1.class);
if (statefulTlv != null && statefulTlv.getStateful() != null) {
- return statefulTlv.getStateful().getAugmentation(Stateful1.class) != null;
+ return statefulTlv.getStateful().augmentation(Stateful1.class) != null;
}
return false;
}
final TopologyKey key = InstanceIdentifier.keyOf(this.topology);
final TopologyId topologyId = key.getTopologyId();
final WriteTransaction tx = this.dependenciesProvider.getDataBroker().newWriteOnlyTransaction();
- tx.put(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().setKey(key)
+ tx.put(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().withKey(key)
.setTopologyId(topologyId).setTopologyTypes(new TopologyTypesBuilder()
.addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyPcep(
new TopologyPcepBuilder().build()).build()).build())
private static LspDbVersion geLspDbVersionTlv(final Lsp lsp) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object
.lsp.Tlvs tlvs = lsp.getTlvs();
- if (tlvs != null && tlvs.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ if (tlvs != null && tlvs.augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
.controller.pcep.sync.optimizations.rev171025.Tlvs1.class) != null) {
- return tlvs.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller
+ return tlvs.augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller
.pcep.sync.optimizations.rev171025.Tlvs1.class).getLspDbVersion();
}
return null;
final InetAddress peerAddress = session.getRemoteAddress();
final Tlvs tlvs = session.getRemoteTlvs();
- if (tlvs != null && tlvs.getAugmentation(Tlvs1.class) != null) {
- final Stateful stateful = tlvs.getAugmentation(Tlvs1.class).getStateful();
+ if (tlvs != null && tlvs.augmentation(Tlvs1.class) != null) {
+ final Stateful stateful = tlvs.augmentation(Tlvs1.class).getStateful();
if (stateful != null) {
setStatefulCapabilities(stateful);
pccBuilder.setReportedLsp(Collections.emptyList());
pccBuilder.setStateSync(PccSyncState.InitialResync);
}
pccBuilder.setStatefulTlv(new StatefulTlvBuilder().addAugmentation(StatefulTlv1.class,
- new StatefulTlv1Builder(tlvs.getAugmentation(Tlvs1.class)).build()).build());
+ new StatefulTlv1Builder(tlvs.augmentation(Tlvs1.class)).build()).build());
} else {
LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
}
solicited = isSolicited(srp, lsp, ctx, rlb);
// if remove flag is set in SRP object, remove the tunnel immediately
- if (solicited && srp.getAugmentation(Srp1.class) != null) {
- final Srp1 initiatedSrp = srp.getAugmentation(Srp1.class);
+ if (solicited && srp.augmentation(Srp1.class) != null) {
+ final Srp1 initiatedSrp = srp.augmentation(Srp1.class);
if (initiatedSrp.isRemove()) {
super.removeLsp(ctx, plspid);
return false;
ub.setUpdates(Collections.singletonList(rb.build()));
msg = new PcupdBuilder().setPcupdMessage(ub.build()).build();
} else {
- final Lsp1 lspCreateFlag = reportedLsp.getAugmentation(Lsp1.class);
+ final Lsp1 lspCreateFlag = reportedLsp.augmentation(Lsp1.class);
// we only retake delegation for PCE initiated tunnels
if (lspCreateFlag != null && !lspCreateFlag.isCreate()) {
LOG.warn("Unable to retake delegation of PCC-initiated tunnel: {}", reportedLsp);
Preconditions.checkArgument(input != null && input.getName() != null && input.getNode() != null
&& input.getArguments() != null, MISSING_XML_TAG);
final OperationalStatus op;
- final Arguments1 aa = input.getArguments().getAugmentation(Arguments1.class);
+ final Arguments1 aa = input.getArguments().augmentation(Arguments1.class);
if (aa != null) {
op = aa.getOperational();
} else {
}
// check if at least one of the paths has the same status as requested
for (final Path p : rep.get().getPath()) {
- final Path1 p1 = p.getAugmentation(Path1.class);
+ final Path1 p1 = p.augmentation(Path1.class);
if (p1 == null) {
LOG.warn("Node {} LSP {} does not contain data", input.getNode(), input.getName());
return OperationResults.UNSENT;
return null;
}
// it doesn't matter how many lsps there are in the path list, we only need data that is the same in each path
- final Path1 ra = rep.get().getPath().get(0).getAugmentation(Path1.class);
+ final Path1 ra = rep.get().getPath().get(0).augmentation(Path1.class);
Preconditions.checkState(ra != null, "Reported LSP reported null from data-store.");
final Lsp reportedLsp = ra.getLsp();
Preconditions.checkState(reportedLsp != null, "Reported LSP does not contain LSP object.");
private Optional<PathSetupType> getPST(final Optional<ReportedLsp> rep) {
if (rep.isPresent()) {
- final Path1 path1 = rep.get().getPath().get(0).getAugmentation(Path1.class);
+ final Path1 path1 = rep.get().getPath().get(0).augmentation(Path1.class);
if (path1 != null) {
final PathSetupType pst = path1.getPathSetupType();
if (!PSTUtil.isDefaultPST(pst)) {
protected synchronized void loadLspData(final Node node, final Map<String, ReportedLsp> lspData,
final Map<PlspId, String> lsps, final boolean incrementalSynchro) {
//load node's lsps from DS
- final PathComputationClient pcc = node.getAugmentation(Node1.class).getPathComputationClient();
+ final PathComputationClient pcc = node.augmentation(Node1.class).getPathComputationClient();
final List<ReportedLsp> reportedLsps = pcc.getReportedLsp();
for (final ReportedLsp reportedLsp : reportedLsps) {
final String lspName = reportedLsp.getName();
lspData.put(lspName, reportedLsp);
if (!reportedLsp.getPath().isEmpty()) {
- final Path1 path1 = reportedLsp.getPath().get(0).getAugmentation(Path1.class);
+ final Path1 path1 = reportedLsp.getPath().get(0).augmentation(Path1.class);
if (path1 != null) {
final PlspId plspId = path1.getLsp().getPlspId();
if (!incrementalSynchro) {
if (stateful.isLspUpdateCapability() != null) {
this.lspUpdateCapability.set(stateful.isLspUpdateCapability());
}
- final Stateful1 stateful1 = stateful.getAugmentation(Stateful1.class);
+ final Stateful1 stateful1 = stateful.augmentation(Stateful1.class);
if (stateful1 != null && stateful1.isInitiation() != null) {
this.initiationCapability.set(stateful1.isInitiation());
}
// mark lsp as stale
final ReportedLsp staleLsp = rep.get();
if (!staleLsp.getPath().isEmpty()) {
- final Path1 path1 = staleLsp.getPath().get(0).getAugmentation(Path1.class);
+ final Path1 path1 = staleLsp.getPath().get(0).augmentation(Path1.class);
if (path1 != null) {
Stateful07TopologySessionListener.this.staleLsps.add(path1.getLsp().getPlspId());
}
// Build the request
final RequestsBuilder rb = new RequestsBuilder();
- final Arguments2 args = this.input.getArguments().getAugmentation(Arguments2.class);
+ final Arguments2 args = this.input.getArguments().augmentation(Arguments2.class);
final Lsp inputLsp = (args != null) ? args.getLsp() : null;
if (inputLsp == null) {
return OperationResults.createUnsent(PCEPErrors.LSP_MISSING).future();
return OperationResults.createUnsent(PCEPErrors.UNKNOWN_PLSP_ID).future();
}
// create mandatory objects
- final Arguments3 args = this.input.getArguments().getAugmentation(Arguments3.class);
+ final Arguments3 args = this.input.getArguments().augmentation(Arguments3.class);
final SrpBuilder srpBuilder = new SrpBuilder();
srpBuilder.setOperationId(nextRequest());
srpBuilder.setProcessingRule(Boolean.TRUE);
private static LspDbVersion getLspDbVersion(final Tlvs openTlvs) {
if (openTlvs != null) {
- final Tlvs3 tlvs3 = openTlvs.getAugmentation(Tlvs3.class);
+ final Tlvs3 tlvs3 = openTlvs.augmentation(Tlvs3.class);
if (tlvs3 != null && tlvs3.getLspDbVersion() != null
&& tlvs3.getLspDbVersion().getLspDbVersionValue() != null) {
return tlvs3.getLspDbVersion();
private static Stateful1 getStateful1(final Tlvs openTlvs) {
if (openTlvs != null) {
- final Tlvs1 tlvs1 = openTlvs.getAugmentation(Tlvs1.class);
+ final Tlvs1 tlvs1 = openTlvs.augmentation(Tlvs1.class);
if (tlvs1 != null && tlvs1.getStateful() != null) {
- return tlvs1.getStateful().getAugmentation(Stateful1.class);
+ return tlvs1.getStateful().augmentation(Stateful1.class);
}
}
return null;
}
private synchronized void putTopologyNode() {
- final Node node = new NodeBuilder().setKey(this.nodeId.getKey())
+ final Node node = new NodeBuilder().withKey(this.nodeId.getKey())
.setNodeId(this.nodeId.getKey().getNodeId()).build();
final WriteTransaction t = this.chain.newWriteOnlyTransaction();
LOG.trace("Put topology Node {}, value {}", this.nodeId, node);
LOG.info("Creating Topology {}", topologyId);
LOG.trace("Topology {}.", topology);
- final SessionConfig config = topology.getAugmentation(PcepTopologyTypeConfig.class).getSessionConfig();
+ final SessionConfig config = topology.augmentation(PcepTopologyTypeConfig.class).getSessionConfig();
final InstructionScheduler instructionScheduler = this.instructionSchedulerFactory
.createInstructionScheduler(topologyId.getValue());
final KeyMapping ret = KeyMapping.getKeyMapping();
topology.getNode().stream()
.filter(Objects::nonNull)
- .filter(node -> node.getAugmentation(PcepNodeConfig.class) != null)
- .filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig() != null)
- .filter(node -> node.getAugmentation(PcepNodeConfig.class)
+ .filter(node -> node.augmentation(PcepNodeConfig.class) != null)
+ .filter(node -> node.augmentation(PcepNodeConfig.class).getSessionConfig() != null)
+ .filter(node -> node.augmentation(PcepNodeConfig.class)
.getSessionConfig().getPassword() != null)
- .filter(node -> !node.getAugmentation(PcepNodeConfig.class)
+ .filter(node -> !node.augmentation(PcepNodeConfig.class)
.getSessionConfig().getPassword().getValue().isEmpty())
.forEach(node -> {
- final PcepNodeConfig config = node.getAugmentation(PcepNodeConfig.class);
+ final PcepNodeConfig config = node.augmentation(PcepNodeConfig.class);
final Rfc2385Key rfc2385KeyPassword = config.getSessionConfig().getPassword();
final InetAddress address = InetAddresses.forString(node.getNodeId().getValue());
ret.put(address, rfc2385KeyPassword.getValue().getBytes(StandardCharsets.US_ASCII));
if (topologyTypes == null) {
return false;
}
- final TopologyTypes1 aug = topologyTypes.getAugmentation(TopologyTypes1.class);
+ final TopologyTypes1 aug = topologyTypes.augmentation(TopologyTypes1.class);
return aug != null && aug.getTopologyPcep() != null;
}
final SpeakerIdMapping ret = SpeakerIdMapping.getSpeakerIdMap();
topology.getNode().stream()
.filter(Objects::nonNull)
- .filter(node -> node.getAugmentation(PcepNodeConfig.class) != null)
- .filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig() != null)
- .filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig()
- .getAugmentation(PcepNodeSyncConfig.class) != null)
+ .filter(node -> node.augmentation(PcepNodeConfig.class) != null)
+ .filter(node -> node.augmentation(PcepNodeConfig.class).getSessionConfig() != null)
+ .filter(node -> node.augmentation(PcepNodeConfig.class).getSessionConfig()
+ .augmentation(PcepNodeSyncConfig.class) != null)
.forEach(node -> {
- final PcepNodeConfig config = node.getAugmentation(PcepNodeConfig.class);
+ final PcepNodeConfig config = node.augmentation(PcepNodeConfig.class);
final PcepNodeSyncConfig nodeSyncConfig = config.getSessionConfig()
- .getAugmentation(PcepNodeSyncConfig.class);
+ .augmentation(PcepNodeSyncConfig.class);
final InetAddress address = InetAddresses.forString(node.getNodeId().getValue());
ret.put(address, nodeSyncConfig.getSpeakerEntityIdValue());
});
this.pcepSessionState = session;
final Open localOpen = session.getLocalOpen();
- if (localOpen.getTlvs() != null && localOpen.getTlvs().getAugmentation(Tlvs3.class) != null) {
- final SpeakerEntityId entityId = localOpen.getTlvs().getAugmentation(Tlvs3.class).getSpeakerEntityId();
+ if (localOpen.getTlvs() != null && localOpen.getTlvs().augmentation(Tlvs3.class) != null) {
+ final SpeakerEntityId entityId = localOpen.getTlvs().augmentation(Tlvs3.class).getSpeakerEntityId();
if (entityId != null) {
this.localPref = new LocalPrefBuilder(session.getLocalPref())
.addAugmentation(PcepEntityIdStatsAug.class,
final PCEPStatefulPeerProposal peerProposal = PCEPStatefulPeerProposal
.createStatefulPeerProposal(this.dataBroker, TOPOLOGY_IID);
peerProposal.setPeerProposal(NODE_ID, this.tlvsBuilder, null);
- assertEquals(LSP_DB_VERSION, this.tlvsBuilder.getAugmentation(Tlvs3.class).getLspDbVersion());
+ assertEquals(LSP_DB_VERSION, this.tlvsBuilder.augmentation(Tlvs3.class).getLspDbVersion());
}
@Test
final PCEPStatefulPeerProposal peerProposal = PCEPStatefulPeerProposal
.createStatefulPeerProposal(this.dataBroker, TOPOLOGY_IID);
peerProposal.setPeerProposal(NODE_ID, this.tlvsBuilder, SPEAKER_ID);
- final Tlvs3 aug = this.tlvsBuilder.getAugmentation(Tlvs3.class);
+ final Tlvs3 aug = this.tlvsBuilder.augmentation(Tlvs3.class);
assertEquals(LSP_DB_VERSION, aug.getLspDbVersion());
assertArrayEquals(SPEAKER_ID, aug.getSpeakerEntityId().getSpeakerEntityIdValue());
}
final PCEPStatefulPeerProposal peerProposal = PCEPStatefulPeerProposal
.createStatefulPeerProposal(this.dataBroker, TOPOLOGY_IID);
peerProposal.setPeerProposal(NODE_ID, this.tlvsBuilder, null);
- assertNull(this.tlvsBuilder.getAugmentation(Tlvs3.class));
+ assertNull(this.tlvsBuilder.augmentation(Tlvs3.class));
}
@Test
final PCEPStatefulPeerProposal peerProposal = PCEPStatefulPeerProposal
.createStatefulPeerProposal(this.dataBroker, TOPOLOGY_IID);
peerProposal.setPeerProposal(NODE_ID, this.tlvsBuilder, null);
- assertNull(this.tlvsBuilder.getAugmentation(Tlvs3.class));
+ assertNull(this.tlvsBuilder.augmentation(Tlvs3.class));
}
}
checkEquals(() -> assertEquals(1, listenerState.getDelegatedLspsCount().intValue()));
checkEquals(() -> assertTrue(this.listener.isSessionSynchronized()));
checkEquals(() -> assertTrue(listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
+ .augmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
checkEquals(() -> assertEquals(2, listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
+ .augmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
checkEquals(() -> assertEquals(1, listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getSentInitMsgCount().intValue()));
+ .augmentation(StatefulMessagesStatsAug.class).getSentInitMsgCount().intValue()));
checkEquals(() -> assertEquals(0, listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getSentUpdMsgCount().intValue()));
+ .augmentation(StatefulMessagesStatsAug.class).getSentUpdMsgCount().intValue()));
// update-lsp
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp.args
assertEquals(1, listenerState.getDelegatedLspsCount().intValue());
assertTrue(this.listener.isSessionSynchronized());
final StatefulMessagesStatsAug statefulstate = listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class);
+ .augmentation(StatefulMessagesStatsAug.class);
assertTrue(statefulstate.getLastReceivedRptMsgTimestamp() > 0);
assertEquals(3, statefulstate.getReceivedRptMsgCount().intValue());
assertEquals(1, statefulstate.getSentInitMsgCount().intValue());
assertTrue(replyTime.getAverageTime() > 0);
assertTrue(replyTime.getMaxTime() > 0);
final StatefulCapabilitiesStatsAug statefulCapabilities = listenerState
- .getPeerCapabilities().getAugmentation(StatefulCapabilitiesStatsAug.class);
+ .getPeerCapabilities().augmentation(StatefulCapabilitiesStatsAug.class);
assertFalse(statefulCapabilities.isActive());
assertTrue(statefulCapabilities.isInstantiation());
assertTrue(statefulCapabilities.isStateful());
checkEquals(() -> assertEquals(0, listenerState.getDelegatedLspsCount().intValue()));
checkEquals(() -> assertTrue(this.listener.isSessionSynchronized()));
checkEquals(() -> assertTrue(listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
+ .augmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
checkEquals(() -> assertEquals(4, listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
+ .augmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
checkEquals(() -> assertEquals(2, listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getSentInitMsgCount().intValue()));
+ .augmentation(StatefulMessagesStatsAug.class).getSentInitMsgCount().intValue()));
checkEquals(() -> assertEquals(1, listenerState.getMessages()
- .getAugmentation(StatefulMessagesStatsAug.class).getSentUpdMsgCount().intValue()));
+ .augmentation(StatefulMessagesStatsAug.class).getSentUpdMsgCount().intValue()));
}
@Test
private static AddressFamily buildAddressFamily(final TerminationPoint sp, final TerminationPoint dp) {
// We need the IGP augmentation -- it has IP addresses
- final TerminationPoint1 sp1 = requireNonNull(sp.getAugmentation(TerminationPoint1.class));
- final TerminationPoint1 dp1 = requireNonNull(dp.getAugmentation(TerminationPoint1.class));
+ final TerminationPoint1 sp1 = requireNonNull(sp.augmentation(TerminationPoint1.class));
+ final TerminationPoint1 dp1 = requireNonNull(dp.augmentation(TerminationPoint1.class));
// Get the types
final TerminationPointType spt = sp1.getIgpTerminationPointAttributes().getTerminationPointType();
args.setEro(TunelProgrammingUtil.buildEro(this.p2pTunnelInput.getExplicitHops()));
args.setLspa(new LspaBuilder(this.p2pTunnelInput).build());
- final AdministrativeStatus adminStatus = this.p2pTunnelInput.getAugmentation(PcepCreateP2pTunnelInput1.class)
+ final AdministrativeStatus adminStatus = this.p2pTunnelInput.augmentation(PcepCreateP2pTunnelInput1.class)
.getAdministrativeStatus();
if (adminStatus != null) {
args.addAugmentation(Arguments2.class, new Arguments2Builder().setLsp(new LspBuilder()
return TunelProgrammingUtil.RESULT;
}
final RemoveLspInputBuilder ab = new RemoveLspInputBuilder();
- ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
- ab.setNode(node.getSupportingNode().get(0).getKey().getNodeRef());
+ ab.setName(link.augmentation(Link1.class).getSymbolicPathName());
+ ab.setNode(node.getSupportingNode().get(0).key().getNodeRef());
return Futures.transform(
(ListenableFuture<RpcResult<RemoveLspOutput>>) this.topologyService.removeLsp(ab.build()),
RpcResult::getResult, MoreExecutors.directExecutor());
LOG.trace("Skipping null node", id);
return;
}
- final Node1 pccnode = node.getAugmentation(Node1.class);
+ final Node1 pccnode = node.augmentation(Node1.class);
if (pccnode == null) {
LOG.trace("Skipping non-PCEP-enabled node {}", id);
return;
for (final ReportedLsp l : pccnode.getPathComputationClient().getReportedLsp()) {
lsps.add(id.builder().augmentation(Node1.class).child(PathComputationClient.class)
- .child(ReportedLsp.class, l.getKey()).build());
+ .child(ReportedLsp.class, l.key()).build());
}
}
final SupportingNodeKey sk = new SupportingNodeKey(sni, this.source);
final SupportingNodeBuilder snb = new SupportingNodeBuilder();
snb.setNodeRef(sni);
- snb.setKey(sk);
+ snb.withKey(sk);
snb.addAugmentation(SupportingNode1.class, new SupportingNode1Builder().setPathComputationClient(
new PathComputationClientBuilder().setControlling(inControl).build()).build());
}
if (!have) {
final SupportingNode sn = createSupportingNode(k.getNodeId(), inControl);
- trans.put(LogicalDatastoreType.OPERATIONAL, this.target.child(Node.class, node.getKey()).child(
- SupportingNode.class, sn.getKey()), sn);
+ trans.put(LogicalDatastoreType.OPERATIONAL, this.target.child(Node.class, node.key()).child(
+ SupportingNode.class, sn.key()), sn);
}
}
}
for (final Node n : topo.getNode()) {
if (n.getTerminationPoint() != null) {
for (final TerminationPoint tp : n.getTerminationPoint()) {
- final TerminationPoint1 tpa = tp.getAugmentation(TerminationPoint1.class);
+ final TerminationPoint1 tpa = tp.augmentation(TerminationPoint1.class);
if (tpa != null) {
final TerminationPointType tpt = tpa.getIgpTerminationPointAttributes()
.getTerminationPointType();
for (final IpAddress address : ((Ip) tpt).getIpAddress()) {
if (addr.equals(address)) {
handleSni(sni, n, inControl, trans);
- return this.target.builder().child(Node.class, n.getKey())
- .child(TerminationPoint.class, tp.getKey()).build();
+ return this.target.builder().child(Node.class, n.key())
+ .child(TerminationPoint.class, tp.key()).build();
}
}
} else {
final String url = "ip://" + addr.toString();
final TerminationPointKey tpk = new TerminationPointKey(new TpId(url));
final TerminationPointBuilder tpb = new TerminationPointBuilder();
- tpb.setKey(tpk).setTpId(tpk.getTpId());
+ tpb.withKey(tpk).setTpId(tpk.getTpId());
tpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(
new IgpTerminationPointAttributesBuilder().setTerminationPointType(
new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()).build()).build());
final NodeKey nk = new NodeKey(new NodeId(url));
final NodeBuilder nb = new NodeBuilder();
- nb.setKey(nk).setNodeId(nk.getNodeId());
+ nb.withKey(nk).setNodeId(nk.getNodeId());
nb.setTerminationPoint(Lists.newArrayList(tpb.build()));
if (sni != null) {
nb.setSupportingNode(Lists.newArrayList(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(),
inControl)));
}
- final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.getKey());
+ final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.key());
trans.put(LogicalDatastoreType.OPERATIONAL, nid, nb.build());
- return nid.child(TerminationPoint.class, tpb.getKey());
+ return nid.child(TerminationPoint.class, tpb.key());
}
private void create(final ReadWriteTransaction trans, final InstanceIdentifier<ReportedLsp> identifier,
final ReportedLsp value) throws ReadFailedException {
final InstanceIdentifier<Node> ni = identifier.firstIdentifierOf(Node.class);
- final Path1 rl = value.getPath().get(0).getAugmentation(Path1.class);
+ final Path1 rl = value.getPath().get(0).augmentation(Path1.class);
final AddressFamily af = rl.getLsp().getTlvs().getLspIdentifiers().getAddressFamily();
final List<Subobject> subobjs = new ArrayList<>(explicitHops.size());
for (final ExplicitHops h : explicitHops) {
- final ExplicitHops1 h1 = h.getAugmentation(ExplicitHops1.class);
+ final ExplicitHops1 h1 = h.augmentation(ExplicitHops1.class);
if (h1 != null) {
final SubobjectBuilder sb = new SubobjectBuilder();
sb.fieldsFrom(h1);
public static NodeId supportingNode(final Node node) {
for (final SupportingNode n : node.getSupportingNode()) {
- final SupportingNode1 n1 = n.getAugmentation(SupportingNode1.class);
+ final SupportingNode1 n1 = n.augmentation(SupportingNode1.class);
if (n1 != null && n1.getPathComputationClient().isControlling()) {
- return n.getKey().getNodeRef();
+ return n.key().getNodeRef();
}
}
if (topologyTypes == null) {
return false;
}
- final TopologyTypes1 aug = topologyTypes.getAugmentation(TopologyTypes1.class);
+ final TopologyTypes1 aug = topologyTypes.augmentation(TopologyTypes1.class);
return aug != null && aug.getTopologyTunnelPcep() != null;
}
}
LOG.debug("Create Tunnel Topology {}", topologyId);
- final PcepTunnelTopologyConfig config = topology.getAugmentation(PcepTunnelTopologyConfig.class);
+ final PcepTunnelTopologyConfig config = topology.augmentation(PcepTunnelTopologyConfig.class);
final String pcepTopoID = StringUtils
.substringBetween(config.getPcepTopologyReference().getValue(), "=\"", "\"");
final InstanceIdentifier<Topology> pcepTopoRef = InstanceIdentifier.builder(NetworkTopology.class)
private UpdateLspInput buildUpdateInput(final Link link, final Node node) {
final UpdateLspInputBuilder ab = new UpdateLspInputBuilder();
- ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
+ ab.setName(link.augmentation(Link1.class).getSymbolicPathName());
ab.setNode(requireNonNull(TunelProgrammingUtil.supportingNode(node)));
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp
args.setEro(TunelProgrammingUtil.buildEro(this.updateTunnelInput.getExplicitHops()));
args.setLspa(new LspaBuilder(this.updateTunnelInput).build());
- final AdministrativeStatus adminStatus = this.updateTunnelInput.getAugmentation(PcepUpdateTunnelInput1.class)
+ final AdministrativeStatus adminStatus = this.updateTunnelInput.augmentation(PcepUpdateTunnelInput1.class)
.getAdministrativeStatus();
if (adminStatus != null) {
args.addAugmentation(Arguments3.class, new Arguments3Builder().setLsp(new LspBuilder()
public void setUp() throws InterruptedException, ExecutionException {
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID, new TopologyBuilder()
- .setKey(new TopologyKey(PCEP_TOPOLOGY_ID)).setNode(Lists.newArrayList())
+ .withKey(new TopologyKey(PCEP_TOPOLOGY_ID)).setNode(Lists.newArrayList())
.setTopologyId(PCEP_TOPOLOGY_ID).build(), true);
wTx.put(LogicalDatastoreType.OPERATIONAL, TUNNEL_TOPO_IID, new TopologyBuilder()
- .setKey(new TopologyKey(TUNNEL_TOPOLOGY_ID)).setTopologyId(TUNNEL_TOPOLOGY_ID).build(), true);
+ .withKey(new TopologyKey(TUNNEL_TOPOLOGY_ID)).setTopologyId(TUNNEL_TOPOLOGY_ID).build(), true);
wTx.commit().get();
final NodeChangedListener nodeListener = new NodeChangedListener(getDataBroker(),
PCEP_TOPOLOGY_ID, TUNNEL_TOPO_IID);
Assert.assertEquals(1, src.getSupportingNode().size());
Assert.assertNull(dst.getSupportingNode());
final SupportingNode sNode = src.getSupportingNode().get(0);
- Assert.assertEquals(NODE1_ID, sNode.getKey().getNodeRef());
+ Assert.assertEquals(NODE1_ID, sNode.key().getNodeRef());
Assert.assertEquals(1, tunnelTopo.getLink().size());
final Link link = tunnelTopo.getLink().get(0);
private void createNode(final NodeId nodeId, final String ipv4Address, final String lspName, final long lspId,
final String dstIpv4Address) throws InterruptedException, ExecutionException {
final NodeBuilder nodeBuilder = new NodeBuilder();
- nodeBuilder.setKey(new NodeKey(nodeId));
+ nodeBuilder.withKey(new NodeKey(nodeId));
nodeBuilder.setNodeId(nodeId);
final PathBuilder pathBuilder = new PathBuilder();
- pathBuilder.setKey(new PathKey(new LspId(lspId)));
+ pathBuilder.withKey(new PathKey(new LspId(lspId)));
pathBuilder.setBandwidth(new BandwidthBuilder().setBandwidth(
new Bandwidth(new byte[]{0x00, 0x00, (byte) 0xff, (byte) 0xff})).build());
pathBuilder.addAugmentation(Path1.class, new Path1Builder().setLsp(new LspBuilder().setTlvs(new TlvsBuilder()
.setIpv4TunnelEndpointAddress(new Ipv4Address(dstIpv4Address))
.build()).build()).build()).build()).setAdministrative(true)
.setDelegate(true).build()).build());
- final ReportedLsp reportedLps = new ReportedLspBuilder().setKey(new ReportedLspKey(lspName)).setPath(
+ final ReportedLsp reportedLps = new ReportedLspBuilder().withKey(new ReportedLspKey(lspName)).setPath(
Collections.singletonList(pathBuilder.build())).build();
final Node1Builder node1Builder = new Node1Builder();
node1Builder.setPathComputationClient(new PathComputationClientBuilder()
private static Node createNode(final NodeId nodeId, final TpId tpId, final String ipv4Address) {
final TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setTpId(tpId);
- tpBuilder.setKey(new TerminationPointKey(tpId));
+ tpBuilder.withKey(new TerminationPointKey(tpId));
tpBuilder.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder()
.setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder()
.setTerminationPointType(new IpBuilder()
.build()).build()).build());
final NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setNodeId(nodeId);
- nodeBuilder.setKey(new NodeKey(nodeId));
+ nodeBuilder.withKey(new NodeKey(nodeId));
nodeBuilder.setTerminationPoint(Lists.newArrayList(tpBuilder.build()));
final SupportingNode supportingNode = new SupportingNodeBuilder()
- .setKey(new SupportingNodeKey(nodeId, new TopologyId("dummy")))
+ .withKey(new SupportingNodeKey(nodeId, new TopologyId("dummy")))
.addAugmentation(SupportingNode1.class, new SupportingNode1Builder()
.setPathComputationClient(new PathComputationClientBuilder()
.setControlling(true).build()).build()).build();
private void createInitialTopology() throws InterruptedException, ExecutionException {
final TopologyBuilder topologyBuilder = new TopologyBuilder();
- topologyBuilder.setKey(new TopologyKey(TOPOLOGY_ID));
+ topologyBuilder.withKey(new TopologyKey(TOPOLOGY_ID));
topologyBuilder.setServerProvided(true);
topologyBuilder.setTopologyId(TOPOLOGY_ID);
topologyBuilder.setNode(Lists.newArrayList(createNode(NODE1_ID, TP1_ID, NODE1_IPV4),
linkBuilder.setDestination(new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology
.rev131021.link.attributes.DestinationBuilder().setDestNode(NODE2_ID).setDestTp(TP2_ID).build());
linkBuilder.setLinkId(LINK1_ID);
- linkBuilder.setKey(new LinkKey(LINK1_ID));
+ linkBuilder.withKey(new LinkKey(LINK1_ID));
linkBuilder.addAugmentation(Link1.class, new Link1Builder().setSymbolicPathName(LINK1_ID.getValue()).build());
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
wTx.put(LogicalDatastoreType.OPERATIONAL, TOPO_IID.builder().child(Link.class, new LinkKey(LINK1_ID)).build(),
InstructionPusher(final InstructionId id, final Nanotime deadline) {
this.builder.setDeadline(deadline);
this.builder.setId(id);
- this.builder.setKey(new InstructionKey(id));
+ this.builder.withKey(new InstructionKey(id));
this.builder.setStatus(InstructionStatus.Queued);
}
final WriteTransaction wt = this.dataProvider.newWriteOnlyTransaction();
wt.put(LogicalDatastoreType.OPERATIONAL, this.qid, new InstructionsQueueBuilder()
- .setKey(new InstructionsQueueKey(this.instructionId)).setInstruction(Collections.emptyList()).build());
+ .withKey(new InstructionsQueueKey(this.instructionId)).setInstruction(Collections.emptyList()).build());
wt.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
import static junit.framework.TestCase.assertNull;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import io.netty.channel.ChannelFuture;
import io.netty.util.concurrent.GenericFutureListener;
import java.util.concurrent.ExecutionException;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@Test(expected = AssertionError.class)
public void testCheckEquals() throws Exception {
- checkEquals(() -> fail(), TIMEOUT);
+ checkEquals(Assert::fail, TIMEOUT);
}
@Test(expected = AssertionError.class)
doReturn(1).when(this.listenerCheck).getListMessageSize();
checkReceivedMessages(this.listenerCheck, 1, TIMEOUT);
}
-}
\ No newline at end of file
+}