Bug 1764 - created new bundle responsible for default OF switch configuration
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / md / core / session / SwitchSessionKeyOF.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.api.openflow.md.core.session;
10
11 import java.math.BigInteger;
12
13 /**
14  * @author mirehak
15  */
16 public class SwitchSessionKeyOF {
17
18     private BigInteger datapathId;
19
20     /**
21      * default ctor
22      */
23     public SwitchSessionKeyOF() {
24         // NOOP
25     }
26     
27     /**
28      * @param datapathId the datapathId to set
29      */
30     public void setDatapathId(BigInteger datapathId) {
31         this.datapathId = datapathId;
32     }
33     
34     /**
35      * @return the datapathId
36      */
37     public byte[] getId() {
38         return datapathId.toByteArray();
39     }
40
41     @Override
42     public int hashCode() {
43         final int prime = 31;
44         int result = 1;
45         result = prime * result
46                 + ((datapathId == null) ? 0 : datapathId.hashCode());
47         return result;
48     }
49
50     @Override
51     public boolean equals(Object obj) {
52         if (this == obj)
53             return true;
54         if (obj == null)
55             return false;
56         if (getClass() != obj.getClass())
57             return false;
58         SwitchSessionKeyOF other = (SwitchSessionKeyOF) obj;
59         if (datapathId == null) {
60             if (other.datapathId != null)
61                 return false;
62         } else if (!datapathId.equals(other.datapathId))
63             return false;
64         return true;
65     }
66 }