blob: f0737e5997ad601d95d22ddde310fb6427bfe5e6 [file] [log] [blame]
Ray Milkey4bf8a582015-11-04 08:26:19 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Ray Milkey4bf8a582015-11-04 08:26:19 -08003 *
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 */
16package org.onosproject.openflow;
17
Jimmy Jine9b7a022016-08-12 16:56:48 -070018import io.netty.buffer.ByteBuf;
Ray Milkey4bf8a582015-11-04 08:26:19 -080019import org.projectfloodlight.openflow.protocol.OFMessage;
20import org.projectfloodlight.openflow.protocol.OFType;
21import org.projectfloodlight.openflow.protocol.OFVersion;
22
23import com.google.common.hash.PrimitiveSink;
24
25/**
26 * Adapter for testing against an OpenFlow message.
27 */
28public class OfMessageAdapter implements OFMessage {
Ray Milkey7ec0d1b2015-11-13 08:51:35 -080029 OFType type;
30
31 private OfMessageAdapter() {}
32
33 public OfMessageAdapter(OFType type) {
34 this.type = type;
Ray Milkey4bf8a582015-11-04 08:26:19 -080035 }
36
37 @Override
38 public OFType getType() {
Ray Milkey7ec0d1b2015-11-13 08:51:35 -080039 return type;
40 }
41
42 @Override
43 public OFVersion getVersion() {
Ray Milkey4bf8a582015-11-04 08:26:19 -080044 return null;
45 }
46
47 @Override
48 public long getXid() {
49 return 0;
50 }
51
52 @Override
Jimmy Jine9b7a022016-08-12 16:56:48 -070053 public void writeTo(ByteBuf byteBuf) { }
54
55 @Override
56 public boolean equalsIgnoreXid(Object obj) {
57 // Do nothing here for now
58 return true;
59 }
60
61 @Override
62 public int hashCodeIgnoreXid() {
63 // Do nothing here for now
64 return 0;
65 }
Ray Milkey4bf8a582015-11-04 08:26:19 -080066
67 @Override
68 public Builder createBuilder() {
69 return null;
70 }
71
72 @Override
73 public void putTo(PrimitiveSink sink) { }
74}