BUG-47 : PCEP migration to generated DTOs.
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / subobject / RROUnnumberedInterfaceSubobject.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.protocol.pcep.subobject;
10
11 import org.opendaylight.protocol.concepts.IPv4Address;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.UnnumberedSubobject;
13
14 /**
15  * Structure of unnumbered Iterface Subobject.
16  * 
17  * @see <a href="http://tools.ietf.org/html/rfc3477">Section 4: Signalling Unnumbered Links in EROs</a>
18  */
19 public class RROUnnumberedInterfaceSubobject extends ReportedRouteSubobject {
20         private final UnnumberedSubobject interfaceID;
21         private final IPv4Address routerID;
22
23         /**
24          * Constructs new Unnumbered Interface Subobject.
25          * 
26          * @param routerID IPv4Address
27          * @param interfaceID UnnumberedInterfaceIdentifier
28          */
29         public RROUnnumberedInterfaceSubobject(final IPv4Address routerID, final UnnumberedSubobject interfaceID) {
30                 super();
31                 this.routerID = routerID;
32                 this.interfaceID = interfaceID;
33         }
34
35         /**
36          * Gets {@link IPv4Address} representation of router ID.
37          * 
38          * @return IPv4Address
39          */
40         public IPv4Address getRouterID() {
41                 return this.routerID;
42         }
43
44         /**
45          * Gets {@link UnnumberedSubobject} representation of Interface ID.
46          * 
47          * @return UnnumberedSubobject
48          */
49         public UnnumberedSubobject getInterfaceID() {
50                 return this.interfaceID;
51         }
52
53         @Override
54         public int hashCode() {
55                 final int prime = 31;
56                 int result = 1;
57                 result = prime * result + ((this.interfaceID == null) ? 0 : this.interfaceID.hashCode());
58                 result = prime * result + ((this.routerID == null) ? 0 : this.routerID.hashCode());
59                 return result;
60         }
61
62         @Override
63         public boolean equals(final Object obj) {
64                 if (this == obj)
65                         return true;
66                 if (obj == null)
67                         return false;
68                 if (this.getClass() != obj.getClass())
69                         return false;
70                 final RROUnnumberedInterfaceSubobject other = (RROUnnumberedInterfaceSubobject) obj;
71                 if (this.interfaceID == null) {
72                         if (other.interfaceID != null)
73                                 return false;
74                 } else if (!this.interfaceID.equals(other.interfaceID))
75                         return false;
76                 if (this.routerID == null) {
77                         if (other.routerID != null)
78                                 return false;
79                 } else if (!this.routerID.equals(other.routerID))
80                         return false;
81                 return true;
82         }
83
84         @Override
85         public String toString() {
86                 final StringBuilder builder = new StringBuilder();
87                 builder.append("RROUnnumberedInterfaceSubobject [interfaceID=");
88                 builder.append(this.interfaceID);
89                 builder.append(", routerID=");
90                 builder.append(this.routerID);
91                 builder.append("]");
92                 return builder.toString();
93         }
94
95 }