blob: 7a99db85e4d9bb36015a3c7b8326ec479aff23f8 [file] [log] [blame]
Frank Wang5733c382017-03-28 10:15:18 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Frank Wang5733c382017-03-28 10:15:18 +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.driver.extensions;
17
18import org.onlab.util.KryoNamespace;
19import org.onosproject.net.flow.AbstractExtension;
20import org.onosproject.net.flow.instructions.ExtensionTreatment;
21import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
22
23/**
24 * Nicira conntrack clear extension instruction.
25 */
26public 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}