use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class PMSITunnelAttributeHandlerTestUtil method buildMldpMP2mpLspWrongAttribute.
static Attributes buildMldpMP2mpLspWrongAttribute() {
final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE).build()).build());
return buildAttribute(pmsiTunnelBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class ClientAttributePrependHandlerTest method testPreprendClientAttribute.
@Test
public void testPreprendClientAttribute() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("client-attribute-append-test")).findFirst().get();
final Attributes att = new AttributesBuilder().setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(IPV4).build()).build()).build();
final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(att);
doReturn(Collections.emptyList()).when(this.exportParameters).getClientRouteTargetContrainCache();
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertEquals(att, result.getAttributes());
final Attributes expected = new AttributesBuilder().setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4AddressNoZone("2.2.2.2")).build()).build()).build();
final String rk = "testRoute";
final Route rtRoute = new RouteTargetConstrainRouteBuilder().setRouteKey(rk).setPathId(new PathId(Uint32.ZERO)).setAttributes(expected).build();
doReturn(Collections.singletonList(rtRoute)).when(this.exportParameters).getClientRouteTargetContrainCache();
doReturn(rk).when(this.exportParameters).getRouteKey();
result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertEquals(expected, result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class RouteTargetConstrainRIBSupportTest method testBuildMpReachNlriUpdate.
@Test
public void testBuildMpReachNlriUpdate() {
final Collection<MapEntryNode> routes = createRoutes(RT_ROUTES);
final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri().getAdvertizedRoutes().getDestinationType());
assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class SetCommunityHandler method setComm.
private Attributes setComm(final Attributes attributes, final SetCommunityMethod setCommunityMethod, final BgpSetCommunityOptionType options) {
if (setCommunityMethod instanceof Inline) {
final Inline inline = (Inline) setCommunityMethod;
final List<Communities> list = inline.getCommunities().stream().map(ge -> new CommunitiesBuilder().setAsNumber(ge.getAsNumber()).setSemantics(ge.getSemantics()).build()).collect(Collectors.toList());
return inlineSetComm(attributes, list, options);
}
return referenceSetComm(attributes, ((Reference) setCommunityMethod).getCommunitySetRef(), options);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class SetCommunityHandler method inlineSetComm.
private static Attributes inlineSetComm(final Attributes attributes, final List<Communities> actionCommunities, final BgpSetCommunityOptionType options) {
final AttributesBuilder newAtt = new AttributesBuilder(attributes);
if (options.equals(BgpSetCommunityOptionType.REPLACE)) {
return newAtt.setCommunities(actionCommunities).build();
}
final List<Communities> actualComm;
if (attributes.getCommunities() != null) {
actualComm = new ArrayList<>(attributes.getCommunities());
} else {
actualComm = new ArrayList<>();
}
switch(options) {
case ADD:
actualComm.addAll(actionCommunities);
break;
case REMOVE:
actualComm.removeAll(actionCommunities);
break;
default:
throw new IllegalArgumentException("Option Type not Recognized!");
}
return newAtt.setCommunities(actualComm).build();
}
Aggregations