use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Inline 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.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Inline in project bgpcep by opendaylight.
the class SetExtCommunityHandler method setExtComm.
private Attributes setExtComm(final Attributes attributes, final SetExtCommunityMethod setExtCommunityMethod, final BgpSetCommunityOptionType options) {
if (setExtCommunityMethod instanceof Inline) {
final Inline inline = (Inline) setExtCommunityMethod;
final List<ExtendedCommunities> list = inline.getExtCommunityMember().stream().map(ge -> new ExtendedCommunitiesBuilder().setExtendedCommunity(ge.getExtendedCommunity()).setTransitive(ge.isTransitive()).build()).collect(Collectors.toList());
return inlineSetExtComm(attributes, list, options);
}
return referenceSetExtComm(attributes, ((Reference) setExtCommunityMethod).getExtCommunitySetRef(), options);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Inline in project bgpcep by opendaylight.
the class SetCommunityTest method testInlineReplace.
@Test
public void testInlineReplace() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-community-inline-replace-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertEquals(this.multipleCom, result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Inline in project bgpcep by opendaylight.
the class SetCommunityTest method testInlineAdd.
@Test
public void testInlineAdd() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-community-inline-add-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertEquals(this.multipleCom, result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Inline in project bgpcep by opendaylight.
the class SetExtCommunityTest method testInlineAdd.
@Test
public void testInlineAdd() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-ext-community-inline-add-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertEquals(this.multipleExtCom, result.getAttributes());
}
Aggregations