Ray Milkey | 4bf8a58 | 2015-11-04 08:26:19 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Ray Milkey | 4bf8a58 | 2015-11-04 08:26:19 -0800 | [diff] [blame] | 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.openflow; |
| 17 | |
Jimmy Jin | e9b7a02 | 2016-08-12 16:56:48 -0700 | [diff] [blame] | 18 | import io.netty.buffer.ByteBuf; |
Ray Milkey | 4bf8a58 | 2015-11-04 08:26:19 -0800 | [diff] [blame] | 19 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 20 | import org.projectfloodlight.openflow.protocol.OFType; |
| 21 | import org.projectfloodlight.openflow.protocol.OFVersion; |
| 22 | |
| 23 | import com.google.common.hash.PrimitiveSink; |
| 24 | |
| 25 | /** |
| 26 | * Adapter for testing against an OpenFlow message. |
| 27 | */ |
| 28 | public class OfMessageAdapter implements OFMessage { |
Ray Milkey | 7ec0d1b | 2015-11-13 08:51:35 -0800 | [diff] [blame] | 29 | OFType type; |
| 30 | |
| 31 | private OfMessageAdapter() {} |
| 32 | |
| 33 | public OfMessageAdapter(OFType type) { |
| 34 | this.type = type; |
Ray Milkey | 4bf8a58 | 2015-11-04 08:26:19 -0800 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public OFType getType() { |
Ray Milkey | 7ec0d1b | 2015-11-13 08:51:35 -0800 | [diff] [blame] | 39 | return type; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public OFVersion getVersion() { |
Ray Milkey | 4bf8a58 | 2015-11-04 08:26:19 -0800 | [diff] [blame] | 44 | return null; |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public long getXid() { |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | @Override |
Jimmy Jin | e9b7a02 | 2016-08-12 16:56:48 -0700 | [diff] [blame] | 53 | 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 Milkey | 4bf8a58 | 2015-11-04 08:26:19 -0800 | [diff] [blame] | 66 | |
| 67 | @Override |
| 68 | public Builder createBuilder() { |
| 69 | return null; |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public void putTo(PrimitiveSink sink) { } |
| 74 | } |