use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.DestinationPortCase 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();
}
Aggregations