Frank Wang | 5733c38 | 2017-03-28 10:15:18 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Frank Wang | 5733c38 | 2017-03-28 10:15:18 +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.driver.extensions; |
| 17 | |
| 18 | import org.onlab.util.KryoNamespace; |
| 19 | import org.onosproject.net.flow.AbstractExtension; |
| 20 | import org.onosproject.net.flow.instructions.ExtensionTreatment; |
| 21 | import org.onosproject.net.flow.instructions.ExtensionTreatmentType; |
| 22 | |
| 23 | /** |
| 24 | * Nicira conntrack clear extension instruction. |
| 25 | */ |
| 26 | public class NiciraCtClear extends AbstractExtension implements ExtensionTreatment { |
| 27 | |
| 28 | private final KryoNamespace appKryo = new KryoNamespace.Builder().build(); |
| 29 | |
| 30 | /** |
| 31 | * Creates a conntrack clear instruction. |
| 32 | */ |
| 33 | public NiciraCtClear() { |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | public ExtensionTreatmentType type() { |
| 38 | return ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_CT_CLEAR.type(); |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | public void deserialize(byte[] data) { |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public byte[] serialize() { |
| 47 | return appKryo.serialize(0); |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public int hashCode() { |
| 52 | return 1; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public boolean equals(Object obj) { |
| 57 | if (this == obj) { |
| 58 | return true; |
| 59 | } |
| 60 | if (obj instanceof NiciraCtClear) { |
| 61 | return true; |
| 62 | } |
| 63 | return false; |
| 64 | } |
| 65 | } |