Thejaswi N K | 46f36d2 | 2016-06-13 21:02:50 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.bgpweb.web; |
| 17 | |
| 18 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| 19 | import org.onosproject.codec.CodecContext; |
| 20 | import org.onosproject.codec.JsonCodec; |
| 21 | import org.onosproject.flowapi.ExtFlowTypes; |
| 22 | import org.slf4j.Logger; |
| 23 | import org.slf4j.LoggerFactory; |
| 24 | |
| 25 | public final class BgpFlowExtensionCodec extends JsonCodec<ExtFlowTypes> { |
| 26 | |
| 27 | protected static final Logger log = |
| 28 | LoggerFactory.getLogger(BgpFlowExtensionCodec.class); |
| 29 | |
| 30 | protected static final String TYPE = "type"; |
| 31 | protected static final String NAME = "name"; |
| 32 | protected static final String PREFIX = "prefix"; |
| 33 | protected static final String PROTOCOLS = "protocols"; |
| 34 | protected static final String PORT = "port"; |
| 35 | protected static final String DST_PORT = "destinationPort"; |
| 36 | protected static final String SRC_PORT = "sourcePort"; |
| 37 | protected static final String ICMP_TYPE = "icmpType"; |
| 38 | protected static final String ICMP_CODE = "icmpCode"; |
| 39 | protected static final String TCP_FLAG = "tcpFlag"; |
| 40 | protected static final String PACKET_LENGTH = "packetLength"; |
| 41 | protected static final String DSCP_VALUE = "dscpValue"; |
| 42 | protected static final String FRAGMENT = "fragment"; |
| 43 | |
| 44 | protected static final String TRAFFIC_RATE = "trafficRate"; |
| 45 | protected static final String TRAFFIC_ACTION = "trafficAction"; |
| 46 | protected static final String TRAFFIC_REDIRECTION = "trafficRedirection"; |
| 47 | protected static final String TRAFFIC_MARKING = "trafficMarking"; |
| 48 | |
| 49 | protected static final String TRAFFIC_RATE_ASN = "asn"; |
| 50 | protected static final String TRAFFIC_RATE_RATE = "rate"; |
| 51 | protected static final String TRAFFIC_ACTION_TERMINAL = "terminal"; |
| 52 | protected static final String TRAFFIC_ACTION_SAMPLE = "sample"; |
| 53 | protected static final String TRAFFIC_ACTION_RPD = "rpd"; |
| 54 | |
| 55 | protected static final String WIDE_COMM_FLAGS = "widecommunityFlags"; |
| 56 | protected static final String WIDE_COMM_HOP_COUNT = "widecommunityHopCount"; |
| 57 | protected static final String WIDE_COMM_COMMUNITY = "widecommunityCommunity"; |
| 58 | protected static final String WIDE_COMM_CONTEXT_AS = "widecommunityContextAs"; |
| 59 | protected static final String WIDE_COMM_LOCAL_AS = "widecommunityLocalAs"; |
| 60 | protected static final String WIDE_COMM_TARGET = "widecommunityTarget"; |
| 61 | protected static final String WIDE_COMM_EXT_TARGET = "widecommunityExtTarget"; |
| 62 | protected static final String WIDE_COMM_PARAMETER = "widecommunityParameter"; |
| 63 | |
| 64 | protected static final String WIDE_COMM_TGT_LOCAL_SP = "localSpeaker"; |
| 65 | protected static final String WIDE_COMM_TGT_REMOTE_SP = "remoteSpeaker"; |
| 66 | |
| 67 | @Override |
| 68 | public ObjectNode encode(ExtFlowTypes flowTypes, CodecContext context) { |
| 69 | return null; |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public ExtFlowTypes decode(ObjectNode json, CodecContext context) { |
| 74 | DecodeBgpFlowExtnCodecHelper decoder = new DecodeBgpFlowExtnCodecHelper(json); |
| 75 | return decoder.decode(); |
| 76 | } |
| 77 | } |