use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec in project bgpcep by opendaylight.
the class AbstractFlowspecL3vpnNlriParser method stringNlri.
@Override
public String stringNlri(final DataContainerNode<?> flowspec) {
final StringBuilder buffer = new StringBuilder();
final RouteDistinguisher rd = extractRouteDistinguisher(flowspec, RD_NID);
if (rd != null) {
buffer.append("[l3vpn with route-distinguisher ").append(rd.getValue()).append("] ");
}
buffer.append(super.stringNlri(flowspec));
return buffer.toString();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method encodeFlow.
@VisibleForTesting
final String encodeFlow(final Flowspec flow) {
final StringBuilder buffer = new StringBuilder();
final FlowspecType value = flow.getFlowspecType();
if (value instanceof PortCase) {
buffer.append("where port ");
buffer.append(NumericTwoByteOperandParser.INSTANCE.toString(((PortCase) value).getPorts()));
} else if (value instanceof DestinationPortCase) {
buffer.append("where destination port ");
buffer.append(NumericTwoByteOperandParser.INSTANCE.toString(((DestinationPortCase) value).getDestinationPorts()));
} else if (value instanceof SourcePortCase) {
buffer.append("where source port ");
buffer.append(NumericTwoByteOperandParser.INSTANCE.toString(((SourcePortCase) value).getSourcePorts()));
} else if (value instanceof IcmpTypeCase) {
buffer.append("where ICMP type ");
buffer.append(NumericOneByteOperandParser.INSTANCE.toString(((IcmpTypeCase) value).getTypes()));
} else if (value instanceof IcmpCodeCase) {
buffer.append("where ICMP code ");
buffer.append(NumericOneByteOperandParser.INSTANCE.toString(((IcmpCodeCase) value).getCodes()));
} else if (value instanceof TcpFlagsCase) {
buffer.append(stringTcpFlags(((TcpFlagsCase) value).getTcpFlags()));
} else if (value instanceof PacketLengthCase) {
buffer.append("where packet length ");
buffer.append(NumericTwoByteOperandParser.INSTANCE.toString(((PacketLengthCase) value).getPacketLengths()));
} else if (value instanceof DscpCase) {
buffer.append(stringDscp(((DscpCase) value).getDscps()));
} else if (value instanceof FragmentCase) {
buffer.append(stringFragment(((FragmentCase) value).getFragments()));
} else {
stringSpecificFSNlriType(value, buffer);
}
return buffer.toString();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec in project bgpcep by opendaylight.
the class AbstractFlowspecL3vpnNlriParser method stringNlri.
@Override
public String stringNlri(final DataContainerNode flowspec) {
final StringBuilder buffer = new StringBuilder();
final RouteDistinguisher rd = extractRouteDistinguisher(flowspec, RD_NID);
if (rd != null) {
buffer.append("[l3vpn with route-distinguisher ").append(rd.stringValue()).append("] ");
}
buffer.append(super.stringNlri(flowspec));
return buffer.toString();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec in project bgpcep by opendaylight.
the class AbstractFlowspecL3vpnNlriParser method readRouteDistinguisher.
/**
* For flowspec-l3vpn, there is a route distinguisher field at the beginning of NLRI (8 bytes).
*/
private static RouteDistinguisher readRouteDistinguisher(final ByteBuf nlri) {
final RouteDistinguisher rd = RouteDistinguisherUtil.parseRouteDistinguisher(nlri);
LOG.trace("Route Distinguisher read from NLRI: {}", rd);
return rd;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec in project bgpcep by opendaylight.
the class AbstractFlowspecL3vpnNlriParser method parseL3vpnNlriFlowspecList.
protected final List<Flowspec> parseL3vpnNlriFlowspecList(final ByteBuf nlri) {
if (!nlri.isReadable()) {
return null;
}
final List<Flowspec> fss = new ArrayList<>();
while (nlri.isReadable()) {
final FlowspecBuilder builder = new FlowspecBuilder();
builder.setFlowspecType(flowspecTypeRegistry.parseFlowspecType(nlri));
fss.add(builder.build());
}
return fss;
}
Aggregations