Committed by
Ray Milkey
Use LF as line separator
Change-Id: Iaaed8d5bf5157ceba403f53cf86dd535a70f41f8
Showing
89 changed files
with
2572 additions
and
2572 deletions
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | -package org.onosproject.pcepio.protocol.ver1; | 1 | +package org.onosproject.pcepio.protocol.ver1; |
2 | - | 2 | + |
3 | -import org.jboss.netty.buffer.ChannelBuffer; | 3 | +import org.jboss.netty.buffer.ChannelBuffer; |
4 | -import org.onosproject.pcepio.exceptions.PcepParseException; | 4 | +import org.onosproject.pcepio.exceptions.PcepParseException; |
5 | -import org.onosproject.pcepio.protocol.PcepAttribute; | 5 | +import org.onosproject.pcepio.protocol.PcepAttribute; |
6 | -import org.onosproject.pcepio.protocol.PcepEroObject; | 6 | +import org.onosproject.pcepio.protocol.PcepEroObject; |
7 | -import org.onosproject.pcepio.protocol.PcepMsgPath; | 7 | +import org.onosproject.pcepio.protocol.PcepMsgPath; |
8 | -import org.slf4j.Logger; | 8 | +import org.slf4j.Logger; |
9 | -import org.slf4j.LoggerFactory; | 9 | +import org.slf4j.LoggerFactory; |
10 | - | 10 | + |
11 | -import com.google.common.base.MoreObjects; | 11 | +import com.google.common.base.MoreObjects; |
12 | - | 12 | + |
13 | -/** | 13 | +/** |
14 | - * Provides PCEP Message PAth for update message. | 14 | + * Provides PCEP Message PAth for update message. |
15 | - * Reference :PCE extensions for stateful draft-ietf-pce-stateful-pce-10. | 15 | + * Reference :PCE extensions for stateful draft-ietf-pce-stateful-pce-10. |
16 | - */ | 16 | + */ |
17 | -public class PcepMsgPathVer1 implements PcepMsgPath { | 17 | +public class PcepMsgPathVer1 implements PcepMsgPath { |
18 | - | 18 | + |
19 | - /* | 19 | + /* |
20 | - * <path> ::= <ERO><attribute-list> | 20 | + * <path> ::= <ERO><attribute-list> |
21 | - */ | 21 | + */ |
22 | - | 22 | + |
23 | - protected static final Logger log = LoggerFactory.getLogger(PcepMsgPathVer1.class); | 23 | + protected static final Logger log = LoggerFactory.getLogger(PcepMsgPathVer1.class); |
24 | - //PcepEroObject | 24 | + //PcepEroObject |
25 | - private PcepEroObject eroObj; | 25 | + private PcepEroObject eroObj; |
26 | - private boolean isEroObjectSet; | 26 | + private boolean isEroObjectSet; |
27 | - // PcepAttribute | 27 | + // PcepAttribute |
28 | - private PcepAttribute attrList; | 28 | + private PcepAttribute attrList; |
29 | - private boolean isAttributeListSet; | 29 | + private boolean isAttributeListSet; |
30 | - | 30 | + |
31 | - /** | 31 | + /** |
32 | - * constructor to initialize objects. | 32 | + * constructor to initialize objects. |
33 | - */ | 33 | + */ |
34 | - public PcepMsgPathVer1() { | 34 | + public PcepMsgPathVer1() { |
35 | - eroObj = null; | 35 | + eroObj = null; |
36 | - attrList = null; | 36 | + attrList = null; |
37 | - isEroObjectSet = false; | 37 | + isEroObjectSet = false; |
38 | - isAttributeListSet = false; | 38 | + isAttributeListSet = false; |
39 | - } | 39 | + } |
40 | - | 40 | + |
41 | - @Override | 41 | + @Override |
42 | - public PcepEroObject getEroObject() { | 42 | + public PcepEroObject getEroObject() { |
43 | - return eroObj; | 43 | + return eroObj; |
44 | - } | 44 | + } |
45 | - | 45 | + |
46 | - @Override | 46 | + @Override |
47 | - public PcepAttribute getPcepAttribute() { | 47 | + public PcepAttribute getPcepAttribute() { |
48 | - return attrList; | 48 | + return attrList; |
49 | - } | 49 | + } |
50 | - | 50 | + |
51 | - @Override | 51 | + @Override |
52 | - public void setEroObject(PcepEroObject eroObj) { | 52 | + public void setEroObject(PcepEroObject eroObj) { |
53 | - this.eroObj = eroObj; | 53 | + this.eroObj = eroObj; |
54 | - } | 54 | + } |
55 | - | 55 | + |
56 | - @Override | 56 | + @Override |
57 | - public void setPcepAttribute(PcepAttribute attrList) { | 57 | + public void setPcepAttribute(PcepAttribute attrList) { |
58 | - this.attrList = attrList; | 58 | + this.attrList = attrList; |
59 | - } | 59 | + } |
60 | - | 60 | + |
61 | - /** | 61 | + /** |
62 | - * constructor to initialize member variables. | 62 | + * constructor to initialize member variables. |
63 | - * | 63 | + * |
64 | - * @param eroObj pcep ero object | 64 | + * @param eroObj pcep ero object |
65 | - * @param attrList pcep attribute | 65 | + * @param attrList pcep attribute |
66 | - */ | 66 | + */ |
67 | - public PcepMsgPathVer1(PcepEroObject eroObj, PcepAttribute attrList) { | 67 | + public PcepMsgPathVer1(PcepEroObject eroObj, PcepAttribute attrList) { |
68 | - this.eroObj = eroObj; | 68 | + this.eroObj = eroObj; |
69 | - isEroObjectSet = true; | 69 | + isEroObjectSet = true; |
70 | - this.attrList = attrList; | 70 | + this.attrList = attrList; |
71 | - if (attrList == null) { | 71 | + if (attrList == null) { |
72 | - isAttributeListSet = false; | 72 | + isAttributeListSet = false; |
73 | - } else { | 73 | + } else { |
74 | - isAttributeListSet = true; | 74 | + isAttributeListSet = true; |
75 | - } | 75 | + } |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - @Override | 78 | + @Override |
79 | - public PcepMsgPath read(ChannelBuffer cb) throws PcepParseException { | 79 | + public PcepMsgPath read(ChannelBuffer cb) throws PcepParseException { |
80 | - PcepEroObject eroObj; | 80 | + PcepEroObject eroObj; |
81 | - PcepAttribute attrList; | 81 | + PcepAttribute attrList; |
82 | - | 82 | + |
83 | - eroObj = PcepEroObjectVer1.read(cb); | 83 | + eroObj = PcepEroObjectVer1.read(cb); |
84 | - attrList = PcepAttributeVer1.read(cb); | 84 | + attrList = PcepAttributeVer1.read(cb); |
85 | - | 85 | + |
86 | - return new PcepMsgPathVer1(eroObj, attrList); | 86 | + return new PcepMsgPathVer1(eroObj, attrList); |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - @Override | 89 | + @Override |
90 | - public int write(ChannelBuffer cb) throws PcepParseException { | 90 | + public int write(ChannelBuffer cb) throws PcepParseException { |
91 | - int iLenStartIndex = cb.writerIndex(); | 91 | + int iLenStartIndex = cb.writerIndex(); |
92 | - | 92 | + |
93 | - //write Object header | 93 | + //write Object header |
94 | - if (this.isEroObjectSet) { | 94 | + if (this.isEroObjectSet) { |
95 | - this.eroObj.write(cb); | 95 | + this.eroObj.write(cb); |
96 | - } | 96 | + } |
97 | - if (this.isAttributeListSet) { | 97 | + if (this.isAttributeListSet) { |
98 | - attrList.write(cb); | 98 | + attrList.write(cb); |
99 | - } | 99 | + } |
100 | - | 100 | + |
101 | - return cb.writerIndex() - iLenStartIndex; | 101 | + return cb.writerIndex() - iLenStartIndex; |
102 | - } | 102 | + } |
103 | - | 103 | + |
104 | - /** | 104 | + /** |
105 | - * Builder class for PCEP Message path. | 105 | + * Builder class for PCEP Message path. |
106 | - */ | 106 | + */ |
107 | - public static class Builder implements PcepMsgPath.Builder { | 107 | + public static class Builder implements PcepMsgPath.Builder { |
108 | - | 108 | + |
109 | - private boolean bIsEROObjectSet = false; | 109 | + private boolean bIsEROObjectSet = false; |
110 | - private boolean bIsPcepAttributeSet = false; | 110 | + private boolean bIsPcepAttributeSet = false; |
111 | - | 111 | + |
112 | - //PCEP ERO Object | 112 | + //PCEP ERO Object |
113 | - private PcepEroObject eroObject; | 113 | + private PcepEroObject eroObject; |
114 | - //PCEP Attribute list | 114 | + //PCEP Attribute list |
115 | - private PcepAttribute pcepAttribute; | 115 | + private PcepAttribute pcepAttribute; |
116 | - | 116 | + |
117 | - @Override | 117 | + @Override |
118 | - public PcepMsgPath build() throws PcepParseException { | 118 | + public PcepMsgPath build() throws PcepParseException { |
119 | - | 119 | + |
120 | - //PCEP ERO Object | 120 | + //PCEP ERO Object |
121 | - PcepEroObject eroObject = null; | 121 | + PcepEroObject eroObject = null; |
122 | - //PCEP Attribute list | 122 | + //PCEP Attribute list |
123 | - PcepAttribute pcepAttribute = null; | 123 | + PcepAttribute pcepAttribute = null; |
124 | - | 124 | + |
125 | - if (!this.bIsEROObjectSet) { | 125 | + if (!this.bIsEROObjectSet) { |
126 | - throw new PcepParseException("ERO Object NOT Set while building PcepMsgPath."); | 126 | + throw new PcepParseException("ERO Object NOT Set while building PcepMsgPath."); |
127 | - } else { | 127 | + } else { |
128 | - eroObject = this.eroObject; | 128 | + eroObject = this.eroObject; |
129 | - } | 129 | + } |
130 | - if (!this.bIsPcepAttributeSet) { | 130 | + if (!this.bIsPcepAttributeSet) { |
131 | - throw new PcepParseException("Pcep Attributes NOT Set while building PcepMsgPath."); | 131 | + throw new PcepParseException("Pcep Attributes NOT Set while building PcepMsgPath."); |
132 | - } else { | 132 | + } else { |
133 | - pcepAttribute = this.pcepAttribute; | 133 | + pcepAttribute = this.pcepAttribute; |
134 | - } | 134 | + } |
135 | - | 135 | + |
136 | - return new PcepMsgPathVer1(eroObject, pcepAttribute); | 136 | + return new PcepMsgPathVer1(eroObject, pcepAttribute); |
137 | - } | 137 | + } |
138 | - | 138 | + |
139 | - @Override | 139 | + @Override |
140 | - public PcepEroObject getEroObject() { | 140 | + public PcepEroObject getEroObject() { |
141 | - return this.eroObject; | 141 | + return this.eroObject; |
142 | - } | 142 | + } |
143 | - | 143 | + |
144 | - @Override | 144 | + @Override |
145 | - public PcepAttribute getPcepAttribute() { | 145 | + public PcepAttribute getPcepAttribute() { |
146 | - return this.pcepAttribute; | 146 | + return this.pcepAttribute; |
147 | - } | 147 | + } |
148 | - | 148 | + |
149 | - @Override | 149 | + @Override |
150 | - public Builder setEroObject(PcepEroObject eroObject) { | 150 | + public Builder setEroObject(PcepEroObject eroObject) { |
151 | - this.eroObject = eroObject; | 151 | + this.eroObject = eroObject; |
152 | - this.bIsEROObjectSet = true; | 152 | + this.bIsEROObjectSet = true; |
153 | - return this; | 153 | + return this; |
154 | - } | 154 | + } |
155 | - | 155 | + |
156 | - @Override | 156 | + @Override |
157 | - public Builder setPcepAttribute(PcepAttribute pcepAttribute) { | 157 | + public Builder setPcepAttribute(PcepAttribute pcepAttribute) { |
158 | - this.pcepAttribute = pcepAttribute; | 158 | + this.pcepAttribute = pcepAttribute; |
159 | - this.bIsPcepAttributeSet = true; | 159 | + this.bIsPcepAttributeSet = true; |
160 | - return this; | 160 | + return this; |
161 | - } | 161 | + } |
162 | - | 162 | + |
163 | - } | 163 | + } |
164 | - | 164 | + |
165 | - @Override | 165 | + @Override |
166 | - public String toString() { | 166 | + public String toString() { |
167 | - return MoreObjects.toStringHelper(getClass()).add("EroObject", eroObj).add("AttributeList", attrList) | 167 | + return MoreObjects.toStringHelper(getClass()).add("EroObject", eroObj).add("AttributeList", attrList) |
168 | - .toString(); | 168 | + .toString(); |
169 | - } | 169 | + } |
170 | } | 170 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provides Administrative Group Tlv which contains value (32 Bit ). | 28 | + * Provides Administrative Group Tlv which contains value (32 Bit ). |
29 | - */ | 29 | + */ |
30 | -public class AdministrativeGroupTlv implements PcepValueType { | 30 | +public class AdministrativeGroupTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* REFERENCE :[RFC5305]/3.1 | 32 | + /* REFERENCE :[RFC5305]/3.1 |
33 | - * 0 1 2 3 | 33 | + * 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=[TDB33] | Length=4 | | 36 | + | Type=[TDB33] | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | value (32 Bit ) | | 38 | + | value (32 Bit ) | |
39 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 39 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(AdministrativeGroupTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(AdministrativeGroupTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 3; //TDB33 | 44 | + public static final short TYPE = 3; //TDB33 |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize rawValue. | 50 | + * Constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue of Administrative-Group-Tlv. | 52 | + * @param rawValue of Administrative-Group-Tlv. |
53 | - */ | 53 | + */ |
54 | - public AdministrativeGroupTlv(int rawValue) { | 54 | + public AdministrativeGroupTlv(int rawValue) { |
55 | - this.rawValue = rawValue; | 55 | + this.rawValue = rawValue; |
56 | - } | 56 | + } |
57 | - | 57 | + |
58 | - /** | 58 | + /** |
59 | - * Returns newly created AdministrativeGroupTlv object. | 59 | + * Returns newly created AdministrativeGroupTlv object. |
60 | - * | 60 | + * |
61 | - * @param raw value. | 61 | + * @param raw value. |
62 | - * @return object of Administrative-Group-Tlv | 62 | + * @return object of Administrative-Group-Tlv |
63 | - */ | 63 | + */ |
64 | - public static AdministrativeGroupTlv of(final int raw) { | 64 | + public static AdministrativeGroupTlv of(final int raw) { |
65 | - return new AdministrativeGroupTlv(raw); | 65 | + return new AdministrativeGroupTlv(raw); |
66 | - } | 66 | + } |
67 | - | 67 | + |
68 | - /** | 68 | + /** |
69 | - * Returns raw value. | 69 | + * Returns raw value. |
70 | - * | 70 | + * |
71 | - * @return rawValue raw value | 71 | + * @return rawValue raw value |
72 | - */ | 72 | + */ |
73 | - public int getInt() { | 73 | + public int getInt() { |
74 | - return rawValue; | 74 | + return rawValue; |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - @Override | 77 | + @Override |
78 | - public PcepVersion getVersion() { | 78 | + public PcepVersion getVersion() { |
79 | - return PcepVersion.PCEP_1; | 79 | + return PcepVersion.PCEP_1; |
80 | - } | 80 | + } |
81 | - | 81 | + |
82 | - @Override | 82 | + @Override |
83 | - public short getType() { | 83 | + public short getType() { |
84 | - return TYPE; | 84 | + return TYPE; |
85 | - } | 85 | + } |
86 | - | 86 | + |
87 | - @Override | 87 | + @Override |
88 | - public short getLength() { | 88 | + public short getLength() { |
89 | - return LENGTH; | 89 | + return LENGTH; |
90 | - } | 90 | + } |
91 | - | 91 | + |
92 | - @Override | 92 | + @Override |
93 | - public int hashCode() { | 93 | + public int hashCode() { |
94 | - return Objects.hash(rawValue); | 94 | + return Objects.hash(rawValue); |
95 | - } | 95 | + } |
96 | - | 96 | + |
97 | - @Override | 97 | + @Override |
98 | - public boolean equals(Object obj) { | 98 | + public boolean equals(Object obj) { |
99 | - if (this == obj) { | 99 | + if (this == obj) { |
100 | - return true; | 100 | + return true; |
101 | - } | 101 | + } |
102 | - if (obj instanceof AdministrativeGroupTlv) { | 102 | + if (obj instanceof AdministrativeGroupTlv) { |
103 | - AdministrativeGroupTlv other = (AdministrativeGroupTlv) obj; | 103 | + AdministrativeGroupTlv other = (AdministrativeGroupTlv) obj; |
104 | - return Objects.equals(rawValue, other.rawValue); | 104 | + return Objects.equals(rawValue, other.rawValue); |
105 | - } | 105 | + } |
106 | - return false; | 106 | + return false; |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - @Override | 109 | + @Override |
110 | - public int write(ChannelBuffer c) { | 110 | + public int write(ChannelBuffer c) { |
111 | - int iLenStartIndex = c.writerIndex(); | 111 | + int iLenStartIndex = c.writerIndex(); |
112 | - c.writeShort(TYPE); | 112 | + c.writeShort(TYPE); |
113 | - c.writeShort(LENGTH); | 113 | + c.writeShort(LENGTH); |
114 | - c.writeInt(rawValue); | 114 | + c.writeInt(rawValue); |
115 | - return c.writerIndex() - iLenStartIndex; | 115 | + return c.writerIndex() - iLenStartIndex; |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - /** | 118 | + /** |
119 | - * Reads the channel buffer and returns object of Administrative-Group-Tlv. | 119 | + * Reads the channel buffer and returns object of Administrative-Group-Tlv. |
120 | - * | 120 | + * |
121 | - * @param c input channel buffer | 121 | + * @param c input channel buffer |
122 | - * @return object of Administrative-Group-Tlv | 122 | + * @return object of Administrative-Group-Tlv |
123 | - */ | 123 | + */ |
124 | - public static AdministrativeGroupTlv read(ChannelBuffer c) { | 124 | + public static AdministrativeGroupTlv read(ChannelBuffer c) { |
125 | - return AdministrativeGroupTlv.of(c.readInt()); | 125 | + return AdministrativeGroupTlv.of(c.readInt()); |
126 | - } | 126 | + } |
127 | - | 127 | + |
128 | - @Override | 128 | + @Override |
129 | - public String toString() { | 129 | + public String toString() { |
130 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 130 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
131 | - .toString(); | 131 | + .toString(); |
132 | - } | 132 | + } |
133 | -} | 133 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provides Autonomous-System-Tlv which contains opaque value (32 Bit AS Number). | 28 | + * Provides Autonomous-System-Tlv which contains opaque value (32 Bit AS Number). |
29 | - */ | 29 | + */ |
30 | -public class AutonomousSystemTlv implements PcepValueType { | 30 | +public class AutonomousSystemTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* Reference :RFC3209 | 32 | + /* Reference :RFC3209 |
33 | - * 0 1 2 3 | 33 | + * 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=[TBD10] | Length=4 | | 36 | + | Type=[TBD10] | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | opaque value (32 Bit AS Number) | | 38 | + | opaque value (32 Bit AS Number) | |
39 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 39 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 100; //TODD:change this TBD10 | 44 | + public static final short TYPE = 100; //TODD:change this TBD10 |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize rawValue. | 50 | + * Constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue Autonomous-System-Tlv | 52 | + * @param rawValue Autonomous-System-Tlv |
53 | - */ | 53 | + */ |
54 | - public AutonomousSystemTlv(int rawValue) { | 54 | + public AutonomousSystemTlv(int rawValue) { |
55 | - this.rawValue = rawValue; | 55 | + this.rawValue = rawValue; |
56 | - } | 56 | + } |
57 | - | 57 | + |
58 | - /** | 58 | + /** |
59 | - * Returns newly created AutonomousSystemTlv object. | 59 | + * Returns newly created AutonomousSystemTlv object. |
60 | - * | 60 | + * |
61 | - * @param raw value of opaque. | 61 | + * @param raw value of opaque. |
62 | - * @return object of Autonomous-System-Tlv | 62 | + * @return object of Autonomous-System-Tlv |
63 | - */ | 63 | + */ |
64 | - public static AutonomousSystemTlv of(final int raw) { | 64 | + public static AutonomousSystemTlv of(final int raw) { |
65 | - return new AutonomousSystemTlv(raw); | 65 | + return new AutonomousSystemTlv(raw); |
66 | - } | 66 | + } |
67 | - | 67 | + |
68 | - /** | 68 | + /** |
69 | - * Returns opaque value. | 69 | + * Returns opaque value. |
70 | - * | 70 | + * |
71 | - * @return rawValue opaque value. | 71 | + * @return rawValue opaque value. |
72 | - */ | 72 | + */ |
73 | - public int getInt() { | 73 | + public int getInt() { |
74 | - return rawValue; | 74 | + return rawValue; |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - @Override | 77 | + @Override |
78 | - public PcepVersion getVersion() { | 78 | + public PcepVersion getVersion() { |
79 | - return PcepVersion.PCEP_1; | 79 | + return PcepVersion.PCEP_1; |
80 | - } | 80 | + } |
81 | - | 81 | + |
82 | - @Override | 82 | + @Override |
83 | - public short getType() { | 83 | + public short getType() { |
84 | - return TYPE; | 84 | + return TYPE; |
85 | - } | 85 | + } |
86 | - | 86 | + |
87 | - @Override | 87 | + @Override |
88 | - public short getLength() { | 88 | + public short getLength() { |
89 | - return LENGTH; | 89 | + return LENGTH; |
90 | - } | 90 | + } |
91 | - | 91 | + |
92 | - @Override | 92 | + @Override |
93 | - public int hashCode() { | 93 | + public int hashCode() { |
94 | - return Objects.hash(rawValue); | 94 | + return Objects.hash(rawValue); |
95 | - } | 95 | + } |
96 | - | 96 | + |
97 | - @Override | 97 | + @Override |
98 | - public boolean equals(Object obj) { | 98 | + public boolean equals(Object obj) { |
99 | - if (this == obj) { | 99 | + if (this == obj) { |
100 | - return true; | 100 | + return true; |
101 | - } | 101 | + } |
102 | - if (obj instanceof AutonomousSystemTlv) { | 102 | + if (obj instanceof AutonomousSystemTlv) { |
103 | - AutonomousSystemTlv other = (AutonomousSystemTlv) obj; | 103 | + AutonomousSystemTlv other = (AutonomousSystemTlv) obj; |
104 | - return Objects.equals(rawValue, other.rawValue); | 104 | + return Objects.equals(rawValue, other.rawValue); |
105 | - } | 105 | + } |
106 | - return false; | 106 | + return false; |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - @Override | 109 | + @Override |
110 | - public int write(ChannelBuffer c) { | 110 | + public int write(ChannelBuffer c) { |
111 | - int iLenStartIndex = c.writerIndex(); | 111 | + int iLenStartIndex = c.writerIndex(); |
112 | - c.writeShort(TYPE); | 112 | + c.writeShort(TYPE); |
113 | - c.writeShort(LENGTH); | 113 | + c.writeShort(LENGTH); |
114 | - c.writeInt(rawValue); | 114 | + c.writeInt(rawValue); |
115 | - return c.writerIndex() - iLenStartIndex; | 115 | + return c.writerIndex() - iLenStartIndex; |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - /** | 118 | + /** |
119 | - * Reads the channel buffer and returns object of AutonomousSystemTlv. | 119 | + * Reads the channel buffer and returns object of AutonomousSystemTlv. |
120 | - * | 120 | + * |
121 | - * @param c input channel buffer | 121 | + * @param c input channel buffer |
122 | - * @return object of Autonomous-System-Tlv | 122 | + * @return object of Autonomous-System-Tlv |
123 | - */ | 123 | + */ |
124 | - public static AutonomousSystemTlv read(ChannelBuffer c) { | 124 | + public static AutonomousSystemTlv read(ChannelBuffer c) { |
125 | - return AutonomousSystemTlv.of(c.readInt()); | 125 | + return AutonomousSystemTlv.of(c.readInt()); |
126 | - } | 126 | + } |
127 | - | 127 | + |
128 | - @Override | 128 | + @Override |
129 | - public String toString() { | 129 | + public String toString() { |
130 | - return MoreObjects.toStringHelper(getClass()) | 130 | + return MoreObjects.toStringHelper(getClass()) |
131 | - .add("TYPE", TYPE) | 131 | + .add("TYPE", TYPE) |
132 | - .add("Length", LENGTH) | 132 | + .add("Length", LENGTH) |
133 | - .add("value", rawValue) | 133 | + .add("value", rawValue) |
134 | - .toString(); | 134 | + .toString(); |
135 | - } | 135 | + } |
136 | -} | 136 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provides BGP LS identifier which contains opaque value (32 Bit ID). | 28 | + * Provides BGP LS identifier which contains opaque value (32 Bit ID). |
29 | - */ | 29 | + */ |
30 | -public class BGPLSidentifierTlv implements PcepValueType { | 30 | +public class BGPLSidentifierTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* Reference :draft-ietf-idr-ls-distribution-10 | 32 | + /* Reference :draft-ietf-idr-ls-distribution-10 |
33 | - * 0 1 2 3 | 33 | + * 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=[TBD11] | Length=4 | | 36 | + | Type=[TBD11] | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | opaque value (32 Bit ID). | | 38 | + | opaque value (32 Bit ID). | |
39 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 39 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(BGPLSidentifierTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(BGPLSidentifierTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 17; //TODD:change this TBD11 | 44 | + public static final short TYPE = 17; //TODD:change this TBD11 |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * constructor to initialize rawValue. | 50 | + * constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue BGP LS identifier Tlv | 52 | + * @param rawValue BGP LS identifier Tlv |
53 | - */ | 53 | + */ |
54 | - public BGPLSidentifierTlv(int rawValue) { | 54 | + public BGPLSidentifierTlv(int rawValue) { |
55 | - this.rawValue = rawValue; | 55 | + this.rawValue = rawValue; |
56 | - } | 56 | + } |
57 | - | 57 | + |
58 | - /** | 58 | + /** |
59 | - * Returns newly created BGPLSidentifierTlv object. | 59 | + * Returns newly created BGPLSidentifierTlv object. |
60 | - * | 60 | + * |
61 | - * @param raw value | 61 | + * @param raw value |
62 | - * @return object of BGPLSidentifierTlv | 62 | + * @return object of BGPLSidentifierTlv |
63 | - */ | 63 | + */ |
64 | - public static BGPLSidentifierTlv of(final int raw) { | 64 | + public static BGPLSidentifierTlv of(final int raw) { |
65 | - return new BGPLSidentifierTlv(raw); | 65 | + return new BGPLSidentifierTlv(raw); |
66 | - } | 66 | + } |
67 | - | 67 | + |
68 | - /** | 68 | + /** |
69 | - * Returns opaque value. | 69 | + * Returns opaque value. |
70 | - * | 70 | + * |
71 | - * @return rawValue opaque value | 71 | + * @return rawValue opaque value |
72 | - */ | 72 | + */ |
73 | - public int getInt() { | 73 | + public int getInt() { |
74 | - return rawValue; | 74 | + return rawValue; |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - @Override | 77 | + @Override |
78 | - public PcepVersion getVersion() { | 78 | + public PcepVersion getVersion() { |
79 | - return PcepVersion.PCEP_1; | 79 | + return PcepVersion.PCEP_1; |
80 | - } | 80 | + } |
81 | - | 81 | + |
82 | - @Override | 82 | + @Override |
83 | - public short getType() { | 83 | + public short getType() { |
84 | - return TYPE; | 84 | + return TYPE; |
85 | - } | 85 | + } |
86 | - | 86 | + |
87 | - @Override | 87 | + @Override |
88 | - public short getLength() { | 88 | + public short getLength() { |
89 | - return LENGTH; | 89 | + return LENGTH; |
90 | - } | 90 | + } |
91 | - | 91 | + |
92 | - @Override | 92 | + @Override |
93 | - public int hashCode() { | 93 | + public int hashCode() { |
94 | - return Objects.hash(rawValue); | 94 | + return Objects.hash(rawValue); |
95 | - } | 95 | + } |
96 | - | 96 | + |
97 | - @Override | 97 | + @Override |
98 | - public boolean equals(Object obj) { | 98 | + public boolean equals(Object obj) { |
99 | - if (this == obj) { | 99 | + if (this == obj) { |
100 | - return true; | 100 | + return true; |
101 | - } | 101 | + } |
102 | - if (obj instanceof BGPLSidentifierTlv) { | 102 | + if (obj instanceof BGPLSidentifierTlv) { |
103 | - BGPLSidentifierTlv other = (BGPLSidentifierTlv) obj; | 103 | + BGPLSidentifierTlv other = (BGPLSidentifierTlv) obj; |
104 | - return Objects.equals(rawValue, other.rawValue); | 104 | + return Objects.equals(rawValue, other.rawValue); |
105 | - } | 105 | + } |
106 | - return false; | 106 | + return false; |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - @Override | 109 | + @Override |
110 | - public int write(ChannelBuffer c) { | 110 | + public int write(ChannelBuffer c) { |
111 | - int iLenStartIndex = c.writerIndex(); | 111 | + int iLenStartIndex = c.writerIndex(); |
112 | - c.writeShort(TYPE); | 112 | + c.writeShort(TYPE); |
113 | - c.writeShort(LENGTH); | 113 | + c.writeShort(LENGTH); |
114 | - c.writeInt(rawValue); | 114 | + c.writeInt(rawValue); |
115 | - return c.writerIndex() - iLenStartIndex; | 115 | + return c.writerIndex() - iLenStartIndex; |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - /** | 118 | + /** |
119 | - * Reads the channel buffer and returns object of BGPLSidentifierTlv. | 119 | + * Reads the channel buffer and returns object of BGPLSidentifierTlv. |
120 | - * | 120 | + * |
121 | - * @param c input channel buffer | 121 | + * @param c input channel buffer |
122 | - * @return object of BGP LS identifier Tlv | 122 | + * @return object of BGP LS identifier Tlv |
123 | - */ | 123 | + */ |
124 | - public static BGPLSidentifierTlv read(ChannelBuffer c) { | 124 | + public static BGPLSidentifierTlv read(ChannelBuffer c) { |
125 | - return BGPLSidentifierTlv.of(c.readInt()); | 125 | + return BGPLSidentifierTlv.of(c.readInt()); |
126 | - } | 126 | + } |
127 | - | 127 | + |
128 | - @Override | 128 | + @Override |
129 | - public String toString() { | 129 | + public String toString() { |
130 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 130 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
131 | - .toString(); | 131 | + .toString(); |
132 | - } | 132 | + } |
133 | -} | 133 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | - | 16 | + |
17 | -package org.onosproject.pcepio.types; | 17 | +package org.onosproject.pcepio.types; |
18 | - | 18 | + |
19 | -import java.util.Objects; | 19 | +import java.util.Objects; |
20 | - | 20 | + |
21 | -import org.jboss.netty.buffer.ChannelBuffer; | 21 | +import org.jboss.netty.buffer.ChannelBuffer; |
22 | -import org.onosproject.pcepio.protocol.PcepVersion; | 22 | +import org.onosproject.pcepio.protocol.PcepVersion; |
23 | -import org.slf4j.Logger; | 23 | +import org.slf4j.Logger; |
24 | -import org.slf4j.LoggerFactory; | 24 | +import org.slf4j.LoggerFactory; |
25 | - | 25 | + |
26 | -import com.google.common.base.MoreObjects; | 26 | +import com.google.common.base.MoreObjects; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * Provides GMPLS Capability Tlv. | 29 | + * Provides GMPLS Capability Tlv. |
30 | - */ | 30 | + */ |
31 | -public class GmplsCapabilityTlv implements PcepValueType { | 31 | +public class GmplsCapabilityTlv implements PcepValueType { |
32 | - | 32 | + |
33 | - /* | 33 | + /* |
34 | - * GMPLS-CAPABILITY TLV format | 34 | + * GMPLS-CAPABILITY TLV format |
35 | - * reference :draft-ietf-pce-gmpls-pcep-extensions -2.1.1 | 35 | + * reference :draft-ietf-pce-gmpls-pcep-extensions -2.1.1 |
36 | - 0 1 2 3 | 36 | + 0 1 2 3 |
37 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 37 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - | Type=14 | Length | | 39 | + | Type=14 | Length | |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - | Flags | | 41 | + | Flags | |
42 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 42 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
43 | - */ | 43 | + */ |
44 | - protected static final Logger log = LoggerFactory.getLogger(GmplsCapabilityTlv.class); | 44 | + protected static final Logger log = LoggerFactory.getLogger(GmplsCapabilityTlv.class); |
45 | - | 45 | + |
46 | - public static final short TYPE = 14; | 46 | + public static final short TYPE = 14; |
47 | - public static final short LENGTH = 4; | 47 | + public static final short LENGTH = 4; |
48 | - | 48 | + |
49 | - private final int rawValue; | 49 | + private final int rawValue; |
50 | - | 50 | + |
51 | - /** | 51 | + /** |
52 | - * Constructor to initialize raw value. | 52 | + * Constructor to initialize raw value. |
53 | - * | 53 | + * |
54 | - * @param rawValue of Gmpls-Capability-Tlv | 54 | + * @param rawValue of Gmpls-Capability-Tlv |
55 | - */ | 55 | + */ |
56 | - public GmplsCapabilityTlv(int rawValue) { | 56 | + public GmplsCapabilityTlv(int rawValue) { |
57 | - this.rawValue = rawValue; | 57 | + this.rawValue = rawValue; |
58 | - } | 58 | + } |
59 | - | 59 | + |
60 | - /** | 60 | + /** |
61 | - * Returns newly created GmplsCapabilityTlv object. | 61 | + * Returns newly created GmplsCapabilityTlv object. |
62 | - * | 62 | + * |
63 | - * @param raw Flags value | 63 | + * @param raw Flags value |
64 | - * @return object of Gmpls-Capability-Tlv | 64 | + * @return object of Gmpls-Capability-Tlv |
65 | - */ | 65 | + */ |
66 | - public static GmplsCapabilityTlv of(final int raw) { | 66 | + public static GmplsCapabilityTlv of(final int raw) { |
67 | - return new GmplsCapabilityTlv(raw); | 67 | + return new GmplsCapabilityTlv(raw); |
68 | - } | 68 | + } |
69 | - | 69 | + |
70 | - /** | 70 | + /** |
71 | - * Returns value of Flags. | 71 | + * Returns value of Flags. |
72 | - * | 72 | + * |
73 | - * @return rawValue Flags | 73 | + * @return rawValue Flags |
74 | - */ | 74 | + */ |
75 | - public int getInt() { | 75 | + public int getInt() { |
76 | - return rawValue; | 76 | + return rawValue; |
77 | - } | 77 | + } |
78 | - | 78 | + |
79 | - @Override | 79 | + @Override |
80 | - public PcepVersion getVersion() { | 80 | + public PcepVersion getVersion() { |
81 | - return PcepVersion.PCEP_1; | 81 | + return PcepVersion.PCEP_1; |
82 | - } | 82 | + } |
83 | - | 83 | + |
84 | - @Override | 84 | + @Override |
85 | - public short getType() { | 85 | + public short getType() { |
86 | - return TYPE; | 86 | + return TYPE; |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - @Override | 89 | + @Override |
90 | - public short getLength() { | 90 | + public short getLength() { |
91 | - return LENGTH; | 91 | + return LENGTH; |
92 | - } | 92 | + } |
93 | - | 93 | + |
94 | - @Override | 94 | + @Override |
95 | - public int hashCode() { | 95 | + public int hashCode() { |
96 | - return Objects.hash(rawValue); | 96 | + return Objects.hash(rawValue); |
97 | - } | 97 | + } |
98 | - | 98 | + |
99 | - @Override | 99 | + @Override |
100 | - public boolean equals(Object obj) { | 100 | + public boolean equals(Object obj) { |
101 | - if (this == obj) { | 101 | + if (this == obj) { |
102 | - return true; | 102 | + return true; |
103 | - } | 103 | + } |
104 | - if (obj instanceof GmplsCapabilityTlv) { | 104 | + if (obj instanceof GmplsCapabilityTlv) { |
105 | - GmplsCapabilityTlv other = (GmplsCapabilityTlv) obj; | 105 | + GmplsCapabilityTlv other = (GmplsCapabilityTlv) obj; |
106 | - return Objects.equals(rawValue, other.rawValue); | 106 | + return Objects.equals(rawValue, other.rawValue); |
107 | - } | 107 | + } |
108 | - return false; | 108 | + return false; |
109 | - } | 109 | + } |
110 | - | 110 | + |
111 | - @Override | 111 | + @Override |
112 | - public int write(ChannelBuffer c) { | 112 | + public int write(ChannelBuffer c) { |
113 | - int iLenStartIndex = c.writerIndex(); | 113 | + int iLenStartIndex = c.writerIndex(); |
114 | - c.writeShort(TYPE); | 114 | + c.writeShort(TYPE); |
115 | - c.writeShort(LENGTH); | 115 | + c.writeShort(LENGTH); |
116 | - c.writeInt(rawValue); | 116 | + c.writeInt(rawValue); |
117 | - return c.writerIndex() - iLenStartIndex; | 117 | + return c.writerIndex() - iLenStartIndex; |
118 | - } | 118 | + } |
119 | - | 119 | + |
120 | - /** | 120 | + /** |
121 | - * Reads the channel buffer and returns object of Gmpls-Capability-Tlv. | 121 | + * Reads the channel buffer and returns object of Gmpls-Capability-Tlv. |
122 | - * | 122 | + * |
123 | - * @param c input channel buffer | 123 | + * @param c input channel buffer |
124 | - * @return object of Gmpls-Capability-Tlv | 124 | + * @return object of Gmpls-Capability-Tlv |
125 | - */ | 125 | + */ |
126 | - public static GmplsCapabilityTlv read(ChannelBuffer c) { | 126 | + public static GmplsCapabilityTlv read(ChannelBuffer c) { |
127 | - return GmplsCapabilityTlv.of(c.readInt()); | 127 | + return GmplsCapabilityTlv.of(c.readInt()); |
128 | - } | 128 | + } |
129 | - | 129 | + |
130 | - @Override | 130 | + @Override |
131 | - public String toString() { | 131 | + public String toString() { |
132 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 132 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
133 | - .toString(); | 133 | + .toString(); |
134 | - } | 134 | + } |
135 | -} | 135 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | -import com.google.common.base.MoreObjects.ToStringHelper; | 26 | +import com.google.common.base.MoreObjects.ToStringHelper; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * Provides IGP Link Metric . | 29 | + * Provides IGP Link Metric . |
30 | - */ | 30 | + */ |
31 | -public class IGPMetricTlv implements PcepValueType { | 31 | +public class IGPMetricTlv implements PcepValueType { |
32 | - | 32 | + |
33 | - /* Reference :[I-D.ietf-idr-ls-distribution] /3.3.2.4 | 33 | + /* Reference :[I-D.ietf-idr-ls-distribution] /3.3.2.4 |
34 | - * 0 1 2 3 | 34 | + * 0 1 2 3 |
35 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 35 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
36 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 36 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
37 | - | Type=TDB40 | Length | | 37 | + | Type=TDB40 | Length | |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - // IGP Link Metric (variable length) // | 39 | + // IGP Link Metric (variable length) // |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - */ | 41 | + */ |
42 | - | 42 | + |
43 | - protected static final Logger log = LoggerFactory.getLogger(IGPMetricTlv.class); | 43 | + protected static final Logger log = LoggerFactory.getLogger(IGPMetricTlv.class); |
44 | - | 44 | + |
45 | - public static final short TYPE = 1095; //TODO:NEED TO HANDLE TDB40 | 45 | + public static final short TYPE = 1095; //TODO:NEED TO HANDLE TDB40 |
46 | - private short hLength; | 46 | + private short hLength; |
47 | - | 47 | + |
48 | - private final byte[] rawValue; | 48 | + private final byte[] rawValue; |
49 | - | 49 | + |
50 | - /** | 50 | + /** |
51 | - * Constructor to initialize raw value. | 51 | + * Constructor to initialize raw value. |
52 | - * | 52 | + * |
53 | - * @param rawValue IGP Link Metric | 53 | + * @param rawValue IGP Link Metric |
54 | - * @param hLength length | 54 | + * @param hLength length |
55 | - */ | 55 | + */ |
56 | - public IGPMetricTlv(byte[] rawValue, short hLength) { | 56 | + public IGPMetricTlv(byte[] rawValue, short hLength) { |
57 | - this.rawValue = rawValue; | 57 | + this.rawValue = rawValue; |
58 | - this.hLength = hLength; | 58 | + this.hLength = hLength; |
59 | - } | 59 | + } |
60 | - | 60 | + |
61 | - /** | 61 | + /** |
62 | - * Returns newly created IGPMetricTlv object. | 62 | + * Returns newly created IGPMetricTlv object. |
63 | - * | 63 | + * |
64 | - * @param raw value of IGP Link Metric | 64 | + * @param raw value of IGP Link Metric |
65 | - * @param hLength length | 65 | + * @param hLength length |
66 | - * @return object of IGPMetricTlv | 66 | + * @return object of IGPMetricTlv |
67 | - */ | 67 | + */ |
68 | - public static IGPMetricTlv of(final byte[] raw, short hLength) { | 68 | + public static IGPMetricTlv of(final byte[] raw, short hLength) { |
69 | - return new IGPMetricTlv(raw, hLength); | 69 | + return new IGPMetricTlv(raw, hLength); |
70 | - } | 70 | + } |
71 | - | 71 | + |
72 | - /** | 72 | + /** |
73 | - * Returns value of IGP Link Metric. | 73 | + * Returns value of IGP Link Metric. |
74 | - * | 74 | + * |
75 | - * @return rawValue of IGP Link Metric | 75 | + * @return rawValue of IGP Link Metric |
76 | - */ | 76 | + */ |
77 | - public byte[] getValue() { | 77 | + public byte[] getValue() { |
78 | - return rawValue; | 78 | + return rawValue; |
79 | - } | 79 | + } |
80 | - | 80 | + |
81 | - @Override | 81 | + @Override |
82 | - public PcepVersion getVersion() { | 82 | + public PcepVersion getVersion() { |
83 | - return PcepVersion.PCEP_1; | 83 | + return PcepVersion.PCEP_1; |
84 | - } | 84 | + } |
85 | - | 85 | + |
86 | - @Override | 86 | + @Override |
87 | - public short getType() { | 87 | + public short getType() { |
88 | - return TYPE; | 88 | + return TYPE; |
89 | - } | 89 | + } |
90 | - | 90 | + |
91 | - @Override | 91 | + @Override |
92 | - public short getLength() { | 92 | + public short getLength() { |
93 | - return hLength; | 93 | + return hLength; |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - @Override | 96 | + @Override |
97 | - public int hashCode() { | 97 | + public int hashCode() { |
98 | - return Objects.hash(rawValue); | 98 | + return Objects.hash(rawValue); |
99 | - } | 99 | + } |
100 | - | 100 | + |
101 | - @Override | 101 | + @Override |
102 | - public boolean equals(Object obj) { | 102 | + public boolean equals(Object obj) { |
103 | - if (this == obj) { | 103 | + if (this == obj) { |
104 | - return true; | 104 | + return true; |
105 | - } | 105 | + } |
106 | - if (obj instanceof IGPMetricTlv) { | 106 | + if (obj instanceof IGPMetricTlv) { |
107 | - IGPMetricTlv other = (IGPMetricTlv) obj; | 107 | + IGPMetricTlv other = (IGPMetricTlv) obj; |
108 | - return Objects.equals(rawValue, other.rawValue); | 108 | + return Objects.equals(rawValue, other.rawValue); |
109 | - } | 109 | + } |
110 | - return false; | 110 | + return false; |
111 | - } | 111 | + } |
112 | - | 112 | + |
113 | - @Override | 113 | + @Override |
114 | - public int write(ChannelBuffer c) { | 114 | + public int write(ChannelBuffer c) { |
115 | - int iLenStartIndex = c.writerIndex(); | 115 | + int iLenStartIndex = c.writerIndex(); |
116 | - c.writeShort(TYPE); | 116 | + c.writeShort(TYPE); |
117 | - c.writeShort(hLength); | 117 | + c.writeShort(hLength); |
118 | - c.writeBytes(rawValue); | 118 | + c.writeBytes(rawValue); |
119 | - return c.writerIndex() - iLenStartIndex; | 119 | + return c.writerIndex() - iLenStartIndex; |
120 | - } | 120 | + } |
121 | - | 121 | + |
122 | - /** | 122 | + /** |
123 | - * Reads the channel buffer and returns object of IGPMetricTlv. | 123 | + * Reads the channel buffer and returns object of IGPMetricTlv. |
124 | - * | 124 | + * |
125 | - * @param c input channel buffer | 125 | + * @param c input channel buffer |
126 | - * @param hLength length | 126 | + * @param hLength length |
127 | - * @return object of IGPMetricTlv | 127 | + * @return object of IGPMetricTlv |
128 | - */ | 128 | + */ |
129 | - public static PcepValueType read(ChannelBuffer c, short hLength) { | 129 | + public static PcepValueType read(ChannelBuffer c, short hLength) { |
130 | - byte[] iIGPMetric = new byte[hLength]; | 130 | + byte[] iIGPMetric = new byte[hLength]; |
131 | - c.readBytes(iIGPMetric, 0, hLength); | 131 | + c.readBytes(iIGPMetric, 0, hLength); |
132 | - return new IGPMetricTlv(iIGPMetric, hLength); | 132 | + return new IGPMetricTlv(iIGPMetric, hLength); |
133 | - } | 133 | + } |
134 | - | 134 | + |
135 | - @Override | 135 | + @Override |
136 | - public String toString() { | 136 | + public String toString() { |
137 | - ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass()); | 137 | + ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass()); |
138 | - | 138 | + |
139 | - toStrHelper.add("Type", TYPE); | 139 | + toStrHelper.add("Type", TYPE); |
140 | - toStrHelper.add("Length", hLength); | 140 | + toStrHelper.add("Length", hLength); |
141 | - | 141 | + |
142 | - StringBuffer result = new StringBuffer(); | 142 | + StringBuffer result = new StringBuffer(); |
143 | - for (byte b : rawValue) { | 143 | + for (byte b : rawValue) { |
144 | - result.append(String.format("%02X ", b)); | 144 | + result.append(String.format("%02X ", b)); |
145 | - } | 145 | + } |
146 | - toStrHelper.add("Value", result); | 146 | + toStrHelper.add("Value", result); |
147 | - | 147 | + |
148 | - return toStrHelper.toString(); | 148 | + return toStrHelper.toString(); |
149 | - } | 149 | + } |
150 | -} | 150 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provides IPv4 Interface Address . | 28 | + * Provides IPv4 Interface Address . |
29 | - */ | 29 | + */ |
30 | -public class IPv4InterfaceAddressTlv implements PcepValueType { | 30 | +public class IPv4InterfaceAddressTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* | 32 | + /* |
33 | - * reference :[RFC5305]/3.2 | 33 | + * reference :[RFC5305]/3.2 |
34 | - 0 1 2 3 | 34 | + 0 1 2 3 |
35 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 35 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
36 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 36 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
37 | - | Type=6 | Length=4 | | 37 | + | Type=6 | Length=4 | |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - | IPv4 Interface Address | | 39 | + | IPv4 Interface Address | |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - */ | 41 | + */ |
42 | - | 42 | + |
43 | - protected static final Logger log = LoggerFactory.getLogger(IPv4InterfaceAddressTlv.class); | 43 | + protected static final Logger log = LoggerFactory.getLogger(IPv4InterfaceAddressTlv.class); |
44 | - | 44 | + |
45 | - public static final short TYPE = 6; | 45 | + public static final short TYPE = 6; |
46 | - public static final short LENGTH = 4; | 46 | + public static final short LENGTH = 4; |
47 | - | 47 | + |
48 | - private final int rawValue; | 48 | + private final int rawValue; |
49 | - | 49 | + |
50 | - /** | 50 | + /** |
51 | - * Constructor to initialize rawValue. | 51 | + * Constructor to initialize rawValue. |
52 | - * | 52 | + * |
53 | - * @param rawValue of IPv4-Interface-Address. | 53 | + * @param rawValue of IPv4-Interface-Address. |
54 | - */ | 54 | + */ |
55 | - public IPv4InterfaceAddressTlv(int rawValue) { | 55 | + public IPv4InterfaceAddressTlv(int rawValue) { |
56 | - this.rawValue = rawValue; | 56 | + this.rawValue = rawValue; |
57 | - } | 57 | + } |
58 | - | 58 | + |
59 | - /** | 59 | + /** |
60 | - * Returns newly created IPv4InterfaceAddressTlv object. | 60 | + * Returns newly created IPv4InterfaceAddressTlv object. |
61 | - * | 61 | + * |
62 | - * @param raw value of IPv4-Interface-Address | 62 | + * @param raw value of IPv4-Interface-Address |
63 | - * @return object of IPv4-Interface-Address-Tlv | 63 | + * @return object of IPv4-Interface-Address-Tlv |
64 | - */ | 64 | + */ |
65 | - public static IPv4InterfaceAddressTlv of(final int raw) { | 65 | + public static IPv4InterfaceAddressTlv of(final int raw) { |
66 | - return new IPv4InterfaceAddressTlv(raw); | 66 | + return new IPv4InterfaceAddressTlv(raw); |
67 | - } | 67 | + } |
68 | - | 68 | + |
69 | - /** | 69 | + /** |
70 | - * Returns value of IPv4 Interface Address. | 70 | + * Returns value of IPv4 Interface Address. |
71 | - * | 71 | + * |
72 | - * @return rawValue IPv4 Interface Address | 72 | + * @return rawValue IPv4 Interface Address |
73 | - */ | 73 | + */ |
74 | - public int getInt() { | 74 | + public int getInt() { |
75 | - return rawValue; | 75 | + return rawValue; |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - @Override | 78 | + @Override |
79 | - public PcepVersion getVersion() { | 79 | + public PcepVersion getVersion() { |
80 | - return PcepVersion.PCEP_1; | 80 | + return PcepVersion.PCEP_1; |
81 | - } | 81 | + } |
82 | - | 82 | + |
83 | - @Override | 83 | + @Override |
84 | - public short getType() { | 84 | + public short getType() { |
85 | - return TYPE; | 85 | + return TYPE; |
86 | - } | 86 | + } |
87 | - | 87 | + |
88 | - @Override | 88 | + @Override |
89 | - public short getLength() { | 89 | + public short getLength() { |
90 | - return LENGTH; | 90 | + return LENGTH; |
91 | - } | 91 | + } |
92 | - | 92 | + |
93 | - @Override | 93 | + @Override |
94 | - public int hashCode() { | 94 | + public int hashCode() { |
95 | - return Objects.hash(rawValue); | 95 | + return Objects.hash(rawValue); |
96 | - } | 96 | + } |
97 | - | 97 | + |
98 | - @Override | 98 | + @Override |
99 | - public boolean equals(Object obj) { | 99 | + public boolean equals(Object obj) { |
100 | - if (this == obj) { | 100 | + if (this == obj) { |
101 | - return true; | 101 | + return true; |
102 | - } | 102 | + } |
103 | - if (obj instanceof IPv4InterfaceAddressTlv) { | 103 | + if (obj instanceof IPv4InterfaceAddressTlv) { |
104 | - IPv4InterfaceAddressTlv other = (IPv4InterfaceAddressTlv) obj; | 104 | + IPv4InterfaceAddressTlv other = (IPv4InterfaceAddressTlv) obj; |
105 | - return Objects.equals(rawValue, other.rawValue); | 105 | + return Objects.equals(rawValue, other.rawValue); |
106 | - } | 106 | + } |
107 | - return false; | 107 | + return false; |
108 | - } | 108 | + } |
109 | - | 109 | + |
110 | - @Override | 110 | + @Override |
111 | - public int write(ChannelBuffer c) { | 111 | + public int write(ChannelBuffer c) { |
112 | - int iLenStartIndex = c.writerIndex(); | 112 | + int iLenStartIndex = c.writerIndex(); |
113 | - c.writeShort(TYPE); | 113 | + c.writeShort(TYPE); |
114 | - c.writeShort(LENGTH); | 114 | + c.writeShort(LENGTH); |
115 | - c.writeInt(rawValue); | 115 | + c.writeInt(rawValue); |
116 | - return c.writerIndex() - iLenStartIndex; | 116 | + return c.writerIndex() - iLenStartIndex; |
117 | - } | 117 | + } |
118 | - | 118 | + |
119 | - /** | 119 | + /** |
120 | - * Reads the channel buffer and returns object of IPv4InterfaceAddressTlv. | 120 | + * Reads the channel buffer and returns object of IPv4InterfaceAddressTlv. |
121 | - * | 121 | + * |
122 | - * @param c input channel buffer | 122 | + * @param c input channel buffer |
123 | - * @return object of IPv4-Interface-Address-Tlv | 123 | + * @return object of IPv4-Interface-Address-Tlv |
124 | - */ | 124 | + */ |
125 | - public static IPv4InterfaceAddressTlv read(ChannelBuffer c) { | 125 | + public static IPv4InterfaceAddressTlv read(ChannelBuffer c) { |
126 | - return IPv4InterfaceAddressTlv.of(c.readInt()); | 126 | + return IPv4InterfaceAddressTlv.of(c.readInt()); |
127 | - } | 127 | + } |
128 | - | 128 | + |
129 | - @Override | 129 | + @Override |
130 | - public String toString() { | 130 | + public String toString() { |
131 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 131 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
132 | - .toString(); | 132 | + .toString(); |
133 | - } | 133 | + } |
134 | } | 134 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provides IPv4 Neighbor Address . | 28 | + * Provides IPv4 Neighbor Address . |
29 | - */ | 29 | + */ |
30 | -public class IPv4NeighborAddressTlv implements PcepValueType { | 30 | +public class IPv4NeighborAddressTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* Reference :[RFC5305]/3.3 | 32 | + /* Reference :[RFC5305]/3.3 |
33 | - 0 1 2 3 | 33 | + 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=8 | Length=4 | | 36 | + | Type=8 | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | IPv4 Neighbor Address | | 38 | + | IPv4 Neighbor Address | |
39 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 39 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(IPv4NeighborAddressTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(IPv4NeighborAddressTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 8; | 44 | + public static final short TYPE = 8; |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize rawValue. | 50 | + * Constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue IPv4-Neighbor-Address-Tlv | 52 | + * @param rawValue IPv4-Neighbor-Address-Tlv |
53 | - */ | 53 | + */ |
54 | - public IPv4NeighborAddressTlv(int rawValue) { | 54 | + public IPv4NeighborAddressTlv(int rawValue) { |
55 | - log.debug("IPv4NeighborAddressTlv"); | 55 | + log.debug("IPv4NeighborAddressTlv"); |
56 | - this.rawValue = rawValue; | 56 | + this.rawValue = rawValue; |
57 | - } | 57 | + } |
58 | - | 58 | + |
59 | - /** | 59 | + /** |
60 | - * Returns newly created IPv4NeighborAddressTlv object. | 60 | + * Returns newly created IPv4NeighborAddressTlv object. |
61 | - * | 61 | + * |
62 | - * @param raw value of IPv4-Neighbor-Address | 62 | + * @param raw value of IPv4-Neighbor-Address |
63 | - * @return object of IPv4NeighborAddressTlv | 63 | + * @return object of IPv4NeighborAddressTlv |
64 | - */ | 64 | + */ |
65 | - public static IPv4NeighborAddressTlv of(final int raw) { | 65 | + public static IPv4NeighborAddressTlv of(final int raw) { |
66 | - return new IPv4NeighborAddressTlv(raw); | 66 | + return new IPv4NeighborAddressTlv(raw); |
67 | - } | 67 | + } |
68 | - | 68 | + |
69 | - /** | 69 | + /** |
70 | - * Returns value of IPv4 Neighbor Address. | 70 | + * Returns value of IPv4 Neighbor Address. |
71 | - * | 71 | + * |
72 | - * @return rawValue IPv4 Neighbor Address | 72 | + * @return rawValue IPv4 Neighbor Address |
73 | - */ | 73 | + */ |
74 | - public int getInt() { | 74 | + public int getInt() { |
75 | - return rawValue; | 75 | + return rawValue; |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - @Override | 78 | + @Override |
79 | - public PcepVersion getVersion() { | 79 | + public PcepVersion getVersion() { |
80 | - return PcepVersion.PCEP_1; | 80 | + return PcepVersion.PCEP_1; |
81 | - } | 81 | + } |
82 | - | 82 | + |
83 | - @Override | 83 | + @Override |
84 | - public short getType() { | 84 | + public short getType() { |
85 | - return TYPE; | 85 | + return TYPE; |
86 | - } | 86 | + } |
87 | - | 87 | + |
88 | - @Override | 88 | + @Override |
89 | - public short getLength() { | 89 | + public short getLength() { |
90 | - return LENGTH; | 90 | + return LENGTH; |
91 | - } | 91 | + } |
92 | - | 92 | + |
93 | - @Override | 93 | + @Override |
94 | - public int hashCode() { | 94 | + public int hashCode() { |
95 | - return Objects.hash(rawValue); | 95 | + return Objects.hash(rawValue); |
96 | - } | 96 | + } |
97 | - | 97 | + |
98 | - @Override | 98 | + @Override |
99 | - public boolean equals(Object obj) { | 99 | + public boolean equals(Object obj) { |
100 | - if (this == obj) { | 100 | + if (this == obj) { |
101 | - return true; | 101 | + return true; |
102 | - } | 102 | + } |
103 | - if (obj instanceof IPv4NeighborAddressTlv) { | 103 | + if (obj instanceof IPv4NeighborAddressTlv) { |
104 | - IPv4NeighborAddressTlv other = (IPv4NeighborAddressTlv) obj; | 104 | + IPv4NeighborAddressTlv other = (IPv4NeighborAddressTlv) obj; |
105 | - return Objects.equals(rawValue, other.rawValue); | 105 | + return Objects.equals(rawValue, other.rawValue); |
106 | - } | 106 | + } |
107 | - return false; | 107 | + return false; |
108 | - } | 108 | + } |
109 | - | 109 | + |
110 | - @Override | 110 | + @Override |
111 | - public int write(ChannelBuffer c) { | 111 | + public int write(ChannelBuffer c) { |
112 | - int iLenStartIndex = c.writerIndex(); | 112 | + int iLenStartIndex = c.writerIndex(); |
113 | - c.writeShort(TYPE); | 113 | + c.writeShort(TYPE); |
114 | - c.writeShort(LENGTH); | 114 | + c.writeShort(LENGTH); |
115 | - c.writeInt(rawValue); | 115 | + c.writeInt(rawValue); |
116 | - return c.writerIndex() - iLenStartIndex; | 116 | + return c.writerIndex() - iLenStartIndex; |
117 | - } | 117 | + } |
118 | - | 118 | + |
119 | - /** | 119 | + /** |
120 | - * Reads the channel buffer and returns object of IPv4-Neighbor-Address-Tlv. | 120 | + * Reads the channel buffer and returns object of IPv4-Neighbor-Address-Tlv. |
121 | - * | 121 | + * |
122 | - * @param c input channel buffer | 122 | + * @param c input channel buffer |
123 | - * @return object of IPv4-Neighbor-Address-Tlv | 123 | + * @return object of IPv4-Neighbor-Address-Tlv |
124 | - */ | 124 | + */ |
125 | - public static IPv4NeighborAddressTlv read(ChannelBuffer c) { | 125 | + public static IPv4NeighborAddressTlv read(ChannelBuffer c) { |
126 | - return IPv4NeighborAddressTlv.of(c.readInt()); | 126 | + return IPv4NeighborAddressTlv.of(c.readInt()); |
127 | - } | 127 | + } |
128 | - | 128 | + |
129 | - @Override | 129 | + @Override |
130 | - public String toString() { | 130 | + public String toString() { |
131 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 131 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
132 | - .toString(); | 132 | + .toString(); |
133 | - } | 133 | + } |
134 | } | 134 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed. Click to expand it.
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provides IPv4 TE Router Id Of Local Node. | 28 | + * Provides IPv4 TE Router Id Of Local Node. |
29 | - */ | 29 | + */ |
30 | -public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType { | 30 | +public class IPv4TERouterIdOfLocalNodeTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* Reference:[RFC5305]/4.3 | 32 | + /* Reference:[RFC5305]/4.3 |
33 | - * 0 1 2 3 | 33 | + * 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=[TDB25] | Length=4 | | 36 | + | Type=[TDB25] | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | IPv4 TE Router Id Of Local Node | | 38 | + | IPv4 TE Router Id Of Local Node | |
39 | - +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- | 39 | + +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfLocalNodeTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfLocalNodeTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 134; //TDB25 | 44 | + public static final short TYPE = 134; //TDB25 |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize rawValue. | 50 | + * Constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue IPv4-TE-RouterId-Of-Local-Node-Tlv | 52 | + * @param rawValue IPv4-TE-RouterId-Of-Local-Node-Tlv |
53 | - */ | 53 | + */ |
54 | - public IPv4TERouterIdOfLocalNodeTlv(int rawValue) { | 54 | + public IPv4TERouterIdOfLocalNodeTlv(int rawValue) { |
55 | - this.rawValue = rawValue; | 55 | + this.rawValue = rawValue; |
56 | - } | 56 | + } |
57 | - | 57 | + |
58 | - /** | 58 | + /** |
59 | - * Returns newly created IPv4TERouterIdOfLocalNodeTlv object. | 59 | + * Returns newly created IPv4TERouterIdOfLocalNodeTlv object. |
60 | - * | 60 | + * |
61 | - * @param raw value of IPv4-TE-RouterId-Of-Local-Node | 61 | + * @param raw value of IPv4-TE-RouterId-Of-Local-Node |
62 | - * @return object of IPv4TERouterIdOfLocalNodeTlv | 62 | + * @return object of IPv4TERouterIdOfLocalNodeTlv |
63 | - */ | 63 | + */ |
64 | - public static IPv4TERouterIdOfLocalNodeTlv of(final int raw) { | 64 | + public static IPv4TERouterIdOfLocalNodeTlv of(final int raw) { |
65 | - return new IPv4TERouterIdOfLocalNodeTlv(raw); | 65 | + return new IPv4TERouterIdOfLocalNodeTlv(raw); |
66 | - } | 66 | + } |
67 | - | 67 | + |
68 | - /** | 68 | + /** |
69 | - * Returns value of IPv4 TE Router Id Of Local Node. | 69 | + * Returns value of IPv4 TE Router Id Of Local Node. |
70 | - * | 70 | + * |
71 | - * @return rawValue IPv4 TE Router Id Of Local Node | 71 | + * @return rawValue IPv4 TE Router Id Of Local Node |
72 | - */ | 72 | + */ |
73 | - public int getInt() { | 73 | + public int getInt() { |
74 | - return rawValue; | 74 | + return rawValue; |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - @Override | 77 | + @Override |
78 | - public PcepVersion getVersion() { | 78 | + public PcepVersion getVersion() { |
79 | - return PcepVersion.PCEP_1; | 79 | + return PcepVersion.PCEP_1; |
80 | - } | 80 | + } |
81 | - | 81 | + |
82 | - @Override | 82 | + @Override |
83 | - public short getType() { | 83 | + public short getType() { |
84 | - return TYPE; | 84 | + return TYPE; |
85 | - } | 85 | + } |
86 | - | 86 | + |
87 | - @Override | 87 | + @Override |
88 | - public short getLength() { | 88 | + public short getLength() { |
89 | - return LENGTH; | 89 | + return LENGTH; |
90 | - } | 90 | + } |
91 | - | 91 | + |
92 | - @Override | 92 | + @Override |
93 | - public int hashCode() { | 93 | + public int hashCode() { |
94 | - return Objects.hash(rawValue); | 94 | + return Objects.hash(rawValue); |
95 | - } | 95 | + } |
96 | - | 96 | + |
97 | - @Override | 97 | + @Override |
98 | - public boolean equals(Object obj) { | 98 | + public boolean equals(Object obj) { |
99 | - if (this == obj) { | 99 | + if (this == obj) { |
100 | - return true; | 100 | + return true; |
101 | - } | 101 | + } |
102 | - if (obj instanceof IPv4TERouterIdOfLocalNodeTlv) { | 102 | + if (obj instanceof IPv4TERouterIdOfLocalNodeTlv) { |
103 | - IPv4TERouterIdOfLocalNodeTlv other = (IPv4TERouterIdOfLocalNodeTlv) obj; | 103 | + IPv4TERouterIdOfLocalNodeTlv other = (IPv4TERouterIdOfLocalNodeTlv) obj; |
104 | - return Objects.equals(rawValue, other.rawValue); | 104 | + return Objects.equals(rawValue, other.rawValue); |
105 | - } | 105 | + } |
106 | - return false; | 106 | + return false; |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - @Override | 109 | + @Override |
110 | - public int write(ChannelBuffer c) { | 110 | + public int write(ChannelBuffer c) { |
111 | - int iLenStartIndex = c.writerIndex(); | 111 | + int iLenStartIndex = c.writerIndex(); |
112 | - c.writeShort(TYPE); | 112 | + c.writeShort(TYPE); |
113 | - c.writeShort(LENGTH); | 113 | + c.writeShort(LENGTH); |
114 | - c.writeInt(rawValue); | 114 | + c.writeInt(rawValue); |
115 | - return c.writerIndex() - iLenStartIndex; | 115 | + return c.writerIndex() - iLenStartIndex; |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - /** | 118 | + /** |
119 | - * Reads the channel buffer and returns object of IPv4TERouterIdOfLocalNodeTlv. | 119 | + * Reads the channel buffer and returns object of IPv4TERouterIdOfLocalNodeTlv. |
120 | - * | 120 | + * |
121 | - * @param c input channel buffer | 121 | + * @param c input channel buffer |
122 | - * @return object of IPv4TERouterIdOfLocalNodeTlv | 122 | + * @return object of IPv4TERouterIdOfLocalNodeTlv |
123 | - */ | 123 | + */ |
124 | - public static IPv4TERouterIdOfLocalNodeTlv read(ChannelBuffer c) { | 124 | + public static IPv4TERouterIdOfLocalNodeTlv read(ChannelBuffer c) { |
125 | - return IPv4TERouterIdOfLocalNodeTlv.of(c.readInt()); | 125 | + return IPv4TERouterIdOfLocalNodeTlv.of(c.readInt()); |
126 | - } | 126 | + } |
127 | - | 127 | + |
128 | - @Override | 128 | + @Override |
129 | - public String toString() { | 129 | + public String toString() { |
130 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 130 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
131 | - .toString(); | 131 | + .toString(); |
132 | - } | 132 | + } |
133 | -} | 133 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provides IPv4 TE Router Id Of Remote Node. | 28 | + * Provides IPv4 TE Router Id Of Remote Node. |
29 | - */ | 29 | + */ |
30 | -public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType { | 30 | +public class IPv4TERouterIdOfRemoteNodeTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* Reference :[RFC5305]/4.3 | 32 | + /* Reference :[RFC5305]/4.3 |
33 | - * 0 1 2 3 | 33 | + * 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=[TDB28] | Length=4 | | 36 | + | Type=[TDB28] | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | IPv4 TE Router Id Of Remote Node | | 38 | + | IPv4 TE Router Id Of Remote Node | |
39 | - +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- | 39 | + +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfRemoteNodeTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(IPv4TERouterIdOfRemoteNodeTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 1340; //TDB28 | 44 | + public static final short TYPE = 1340; //TDB28 |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize rawValue. | 50 | + * Constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue IPv4 TE RouterId Of Remote Node Tlv | 52 | + * @param rawValue IPv4 TE RouterId Of Remote Node Tlv |
53 | - */ | 53 | + */ |
54 | - public IPv4TERouterIdOfRemoteNodeTlv(int rawValue) { | 54 | + public IPv4TERouterIdOfRemoteNodeTlv(int rawValue) { |
55 | - log.debug("IPv4TERouterIdOfRemoteNodeTlv"); | 55 | + log.debug("IPv4TERouterIdOfRemoteNodeTlv"); |
56 | - this.rawValue = rawValue; | 56 | + this.rawValue = rawValue; |
57 | - } | 57 | + } |
58 | - | 58 | + |
59 | - /** | 59 | + /** |
60 | - * Returns newly created IPv4TERouterIdOfRemoteNodeTlv object. | 60 | + * Returns newly created IPv4TERouterIdOfRemoteNodeTlv object. |
61 | - * | 61 | + * |
62 | - * @param raw IPv4 TE RouterId Of Remote Node | 62 | + * @param raw IPv4 TE RouterId Of Remote Node |
63 | - * @return object of IPv4TERouterIdOfRemoteNodeTlv | 63 | + * @return object of IPv4TERouterIdOfRemoteNodeTlv |
64 | - */ | 64 | + */ |
65 | - public static IPv4TERouterIdOfRemoteNodeTlv of(final int raw) { | 65 | + public static IPv4TERouterIdOfRemoteNodeTlv of(final int raw) { |
66 | - return new IPv4TERouterIdOfRemoteNodeTlv(raw); | 66 | + return new IPv4TERouterIdOfRemoteNodeTlv(raw); |
67 | - } | 67 | + } |
68 | - | 68 | + |
69 | - /** | 69 | + /** |
70 | - * Returns value of IPv4 TE Router Id Of Remote Node. | 70 | + * Returns value of IPv4 TE Router Id Of Remote Node. |
71 | - * | 71 | + * |
72 | - * @return rawValue IPv4 TE Router Id Of Remote Node | 72 | + * @return rawValue IPv4 TE Router Id Of Remote Node |
73 | - */ | 73 | + */ |
74 | - public int getInt() { | 74 | + public int getInt() { |
75 | - return rawValue; | 75 | + return rawValue; |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - @Override | 78 | + @Override |
79 | - public PcepVersion getVersion() { | 79 | + public PcepVersion getVersion() { |
80 | - return PcepVersion.PCEP_1; | 80 | + return PcepVersion.PCEP_1; |
81 | - } | 81 | + } |
82 | - | 82 | + |
83 | - @Override | 83 | + @Override |
84 | - public short getType() { | 84 | + public short getType() { |
85 | - return TYPE; | 85 | + return TYPE; |
86 | - } | 86 | + } |
87 | - | 87 | + |
88 | - @Override | 88 | + @Override |
89 | - public short getLength() { | 89 | + public short getLength() { |
90 | - return LENGTH; | 90 | + return LENGTH; |
91 | - } | 91 | + } |
92 | - | 92 | + |
93 | - @Override | 93 | + @Override |
94 | - public int hashCode() { | 94 | + public int hashCode() { |
95 | - return Objects.hash(rawValue); | 95 | + return Objects.hash(rawValue); |
96 | - } | 96 | + } |
97 | - | 97 | + |
98 | - @Override | 98 | + @Override |
99 | - public boolean equals(Object obj) { | 99 | + public boolean equals(Object obj) { |
100 | - if (this == obj) { | 100 | + if (this == obj) { |
101 | - return true; | 101 | + return true; |
102 | - } | 102 | + } |
103 | - if (obj instanceof IPv4TERouterIdOfRemoteNodeTlv) { | 103 | + if (obj instanceof IPv4TERouterIdOfRemoteNodeTlv) { |
104 | - IPv4TERouterIdOfRemoteNodeTlv other = (IPv4TERouterIdOfRemoteNodeTlv) obj; | 104 | + IPv4TERouterIdOfRemoteNodeTlv other = (IPv4TERouterIdOfRemoteNodeTlv) obj; |
105 | - return Objects.equals(rawValue, other.rawValue); | 105 | + return Objects.equals(rawValue, other.rawValue); |
106 | - } | 106 | + } |
107 | - return false; | 107 | + return false; |
108 | - } | 108 | + } |
109 | - | 109 | + |
110 | - @Override | 110 | + @Override |
111 | - public int write(ChannelBuffer c) { | 111 | + public int write(ChannelBuffer c) { |
112 | - int iLenStartIndex = c.writerIndex(); | 112 | + int iLenStartIndex = c.writerIndex(); |
113 | - c.writeShort(TYPE); | 113 | + c.writeShort(TYPE); |
114 | - c.writeShort(LENGTH); | 114 | + c.writeShort(LENGTH); |
115 | - c.writeInt(rawValue); | 115 | + c.writeInt(rawValue); |
116 | - return c.writerIndex() - iLenStartIndex; | 116 | + return c.writerIndex() - iLenStartIndex; |
117 | - } | 117 | + } |
118 | - | 118 | + |
119 | - /** | 119 | + /** |
120 | - * Reads the channel buffer and returns object of IPv4TERouterIdOfRemoteNodeTlv. | 120 | + * Reads the channel buffer and returns object of IPv4TERouterIdOfRemoteNodeTlv. |
121 | - * | 121 | + * |
122 | - * @param c input channel buffer | 122 | + * @param c input channel buffer |
123 | - * @return object of IPv4TERouterIdOfRemoteNodeTlv | 123 | + * @return object of IPv4TERouterIdOfRemoteNodeTlv |
124 | - */ | 124 | + */ |
125 | - public static IPv4TERouterIdOfRemoteNodeTlv read(ChannelBuffer c) { | 125 | + public static IPv4TERouterIdOfRemoteNodeTlv read(ChannelBuffer c) { |
126 | - return IPv4TERouterIdOfRemoteNodeTlv.of(c.readInt()); | 126 | + return IPv4TERouterIdOfRemoteNodeTlv.of(c.readInt()); |
127 | - } | 127 | + } |
128 | - | 128 | + |
129 | - @Override | 129 | + @Override |
130 | - public String toString() { | 130 | + public String toString() { |
131 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 131 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
132 | - .toString(); | 132 | + .toString(); |
133 | - } | 133 | + } |
134 | -} | 134 | +} | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | -import com.google.common.base.MoreObjects.ToStringHelper; | 26 | +import com.google.common.base.MoreObjects.ToStringHelper; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * Provides ISIS Area Identifier. | 29 | + * Provides ISIS Area Identifier. |
30 | - */ | 30 | + */ |
31 | -public class ISISAreaIdentifierTlv implements PcepValueType { | 31 | +public class ISISAreaIdentifierTlv implements PcepValueType { |
32 | - | 32 | + |
33 | - /* Reference :[I-D.ietf-idr- ls-distribution]/3.3.1.2 | 33 | + /* Reference :[I-D.ietf-idr- ls-distribution]/3.3.1.2 |
34 | - * 0 1 2 3 | 34 | + * 0 1 2 3 |
35 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 35 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
36 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 36 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
37 | - | Type=[TBD24] | Length | | 37 | + | Type=[TBD24] | Length | |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - // Area Identifier (variable) // | 39 | + // Area Identifier (variable) // |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - */ | 41 | + */ |
42 | - | 42 | + |
43 | - protected static final Logger log = LoggerFactory.getLogger(ISISAreaIdentifierTlv.class); | 43 | + protected static final Logger log = LoggerFactory.getLogger(ISISAreaIdentifierTlv.class); |
44 | - | 44 | + |
45 | - public static final short TYPE = 107; //TODO:NEED TO HANDLE TBD24 | 45 | + public static final short TYPE = 107; //TODO:NEED TO HANDLE TBD24 |
46 | - private short hLength; | 46 | + private short hLength; |
47 | - | 47 | + |
48 | - private final byte[] rawValue; | 48 | + private final byte[] rawValue; |
49 | - | 49 | + |
50 | - /** | 50 | + /** |
51 | - * Constructor to initialize rawValue. | 51 | + * Constructor to initialize rawValue. |
52 | - * | 52 | + * |
53 | - * @param rawValue ISIS-Area-Identifier | 53 | + * @param rawValue ISIS-Area-Identifier |
54 | - * @param hLength length | 54 | + * @param hLength length |
55 | - */ | 55 | + */ |
56 | - public ISISAreaIdentifierTlv(byte[] rawValue, short hLength) { | 56 | + public ISISAreaIdentifierTlv(byte[] rawValue, short hLength) { |
57 | - log.debug("ISISAreaIdentifierTlv"); | 57 | + log.debug("ISISAreaIdentifierTlv"); |
58 | - this.rawValue = rawValue; | 58 | + this.rawValue = rawValue; |
59 | - if (0 == hLength) { | 59 | + if (0 == hLength) { |
60 | - this.hLength = (short) rawValue.length; | 60 | + this.hLength = (short) rawValue.length; |
61 | - } else { | 61 | + } else { |
62 | - this.hLength = hLength; | 62 | + this.hLength = hLength; |
63 | - } | 63 | + } |
64 | - } | 64 | + } |
65 | - | 65 | + |
66 | - /** | 66 | + /** |
67 | - * Returns newly created ISISAreaIdentifierTlv object. | 67 | + * Returns newly created ISISAreaIdentifierTlv object. |
68 | - * | 68 | + * |
69 | - * @param raw ISIS-Area-Identifier | 69 | + * @param raw ISIS-Area-Identifier |
70 | - * @param hLength length | 70 | + * @param hLength length |
71 | - * @return object of ISISAreaIdentifierTlv | 71 | + * @return object of ISISAreaIdentifierTlv |
72 | - */ | 72 | + */ |
73 | - public static ISISAreaIdentifierTlv of(final byte[] raw, short hLength) { | 73 | + public static ISISAreaIdentifierTlv of(final byte[] raw, short hLength) { |
74 | - return new ISISAreaIdentifierTlv(raw, hLength); | 74 | + return new ISISAreaIdentifierTlv(raw, hLength); |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - /** | 77 | + /** |
78 | - * Returns value of ISIS-Area-Identifier. | 78 | + * Returns value of ISIS-Area-Identifier. |
79 | - * | 79 | + * |
80 | - * @return byte array of rawValue | 80 | + * @return byte array of rawValue |
81 | - */ | 81 | + */ |
82 | - public byte[] getValue() { | 82 | + public byte[] getValue() { |
83 | - return rawValue; | 83 | + return rawValue; |
84 | - } | 84 | + } |
85 | - | 85 | + |
86 | - @Override | 86 | + @Override |
87 | - public PcepVersion getVersion() { | 87 | + public PcepVersion getVersion() { |
88 | - return PcepVersion.PCEP_1; | 88 | + return PcepVersion.PCEP_1; |
89 | - } | 89 | + } |
90 | - | 90 | + |
91 | - @Override | 91 | + @Override |
92 | - public short getType() { | 92 | + public short getType() { |
93 | - return TYPE; | 93 | + return TYPE; |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - @Override | 96 | + @Override |
97 | - public short getLength() { | 97 | + public short getLength() { |
98 | - return hLength; | 98 | + return hLength; |
99 | - } | 99 | + } |
100 | - | 100 | + |
101 | - @Override | 101 | + @Override |
102 | - public int hashCode() { | 102 | + public int hashCode() { |
103 | - return Objects.hash(rawValue); | 103 | + return Objects.hash(rawValue); |
104 | - } | 104 | + } |
105 | - | 105 | + |
106 | - @Override | 106 | + @Override |
107 | - public boolean equals(Object obj) { | 107 | + public boolean equals(Object obj) { |
108 | - if (this == obj) { | 108 | + if (this == obj) { |
109 | - return true; | 109 | + return true; |
110 | - } | 110 | + } |
111 | - if (obj instanceof ISISAreaIdentifierTlv) { | 111 | + if (obj instanceof ISISAreaIdentifierTlv) { |
112 | - ISISAreaIdentifierTlv other = (ISISAreaIdentifierTlv) obj; | 112 | + ISISAreaIdentifierTlv other = (ISISAreaIdentifierTlv) obj; |
113 | - return Objects.equals(hLength, other.hLength) && Objects.equals(rawValue, other.rawValue); | 113 | + return Objects.equals(hLength, other.hLength) && Objects.equals(rawValue, other.rawValue); |
114 | - } | 114 | + } |
115 | - return false; | 115 | + return false; |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - @Override | 118 | + @Override |
119 | - public int write(ChannelBuffer c) { | 119 | + public int write(ChannelBuffer c) { |
120 | - int iLenStartIndex = c.writerIndex(); | 120 | + int iLenStartIndex = c.writerIndex(); |
121 | - c.writeShort(TYPE); | 121 | + c.writeShort(TYPE); |
122 | - c.writeShort(hLength); | 122 | + c.writeShort(hLength); |
123 | - c.writeBytes(rawValue); | 123 | + c.writeBytes(rawValue); |
124 | - return c.writerIndex() - iLenStartIndex; | 124 | + return c.writerIndex() - iLenStartIndex; |
125 | - } | 125 | + } |
126 | - | 126 | + |
127 | - /** | 127 | + /** |
128 | - * Reads the channel buffer and returns object of ISISAreaIdentifierTlv. | 128 | + * Reads the channel buffer and returns object of ISISAreaIdentifierTlv. |
129 | - * | 129 | + * |
130 | - * @param c input channel buffer | 130 | + * @param c input channel buffer |
131 | - * @param hLength length | 131 | + * @param hLength length |
132 | - * @return object of ISISAreaIdentifierTlv | 132 | + * @return object of ISISAreaIdentifierTlv |
133 | - */ | 133 | + */ |
134 | - public static PcepValueType read(ChannelBuffer c, short hLength) { | 134 | + public static PcepValueType read(ChannelBuffer c, short hLength) { |
135 | - byte[] iISISAreaIdentifier = new byte[hLength]; | 135 | + byte[] iISISAreaIdentifier = new byte[hLength]; |
136 | - c.readBytes(iISISAreaIdentifier, 0, hLength); | 136 | + c.readBytes(iISISAreaIdentifier, 0, hLength); |
137 | - return new ISISAreaIdentifierTlv(iISISAreaIdentifier, hLength); | 137 | + return new ISISAreaIdentifierTlv(iISISAreaIdentifier, hLength); |
138 | - } | 138 | + } |
139 | - | 139 | + |
140 | - @Override | 140 | + @Override |
141 | - public String toString() { | 141 | + public String toString() { |
142 | - ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass()); | 142 | + ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass()); |
143 | - | 143 | + |
144 | - toStrHelper.add("Type", TYPE); | 144 | + toStrHelper.add("Type", TYPE); |
145 | - toStrHelper.add("Length", hLength); | 145 | + toStrHelper.add("Length", hLength); |
146 | - | 146 | + |
147 | - StringBuffer result = new StringBuffer(); | 147 | + StringBuffer result = new StringBuffer(); |
148 | - for (byte b : rawValue) { | 148 | + for (byte b : rawValue) { |
149 | - result.append(String.format("%02X ", b)); | 149 | + result.append(String.format("%02X ", b)); |
150 | - } | 150 | + } |
151 | - toStrHelper.add("Value", result); | 151 | + toStrHelper.add("Value", result); |
152 | - | 152 | + |
153 | - return toStrHelper.toString(); | 153 | + return toStrHelper.toString(); |
154 | - } | 154 | + } |
155 | -} | 155 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | - | 16 | + |
17 | -package org.onosproject.pcepio.types; | 17 | +package org.onosproject.pcepio.types; |
18 | - | 18 | + |
19 | -import java.util.Objects; | 19 | +import java.util.Objects; |
20 | - | 20 | + |
21 | -import org.jboss.netty.buffer.ChannelBuffer; | 21 | +import org.jboss.netty.buffer.ChannelBuffer; |
22 | -import org.onosproject.pcepio.protocol.PcepVersion; | 22 | +import org.onosproject.pcepio.protocol.PcepVersion; |
23 | -import org.slf4j.Logger; | 23 | +import org.slf4j.Logger; |
24 | -import org.slf4j.LoggerFactory; | 24 | +import org.slf4j.LoggerFactory; |
25 | - | 25 | + |
26 | -import com.google.common.base.MoreObjects; | 26 | +import com.google.common.base.MoreObjects; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * LabelSubObject: Provides a LabelSubObject. | 29 | + * LabelSubObject: Provides a LabelSubObject. |
30 | - */ | 30 | + */ |
31 | -public class LabelSubObject implements PcepValueType { | 31 | +public class LabelSubObject implements PcepValueType { |
32 | - | 32 | + |
33 | - /* Reference : RFC 3209 | 33 | + /* Reference : RFC 3209 |
34 | - * LABEL Sub Object | 34 | + * LABEL Sub Object |
35 | - * | 35 | + * |
36 | - 0 1 2 3 | 36 | + 0 1 2 3 |
37 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 37 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - | Type | Length | Flags | C-Type | | 39 | + | Type | Length | Flags | C-Type | |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - | Contents of Label Object | | 41 | + | Contents of Label Object | |
42 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 42 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
43 | - */ | 43 | + */ |
44 | - protected static final Logger log = LoggerFactory.getLogger(LabelSubObject.class); | 44 | + protected static final Logger log = LoggerFactory.getLogger(LabelSubObject.class); |
45 | - | 45 | + |
46 | - public static final short TYPE = 0x03; | 46 | + public static final short TYPE = 0x03; |
47 | - public static final short LENGTH = 8; | 47 | + public static final short LENGTH = 8; |
48 | - private final byte flags; | 48 | + private final byte flags; |
49 | - private final byte cType; | 49 | + private final byte cType; |
50 | - private final int contents; | 50 | + private final int contents; |
51 | - | 51 | + |
52 | - /** | 52 | + /** |
53 | - * constructor to initialize parameters for LabelSubObject. | 53 | + * constructor to initialize parameters for LabelSubObject. |
54 | - * | 54 | + * |
55 | - * @param flags flags | 55 | + * @param flags flags |
56 | - * @param cType C-Type | 56 | + * @param cType C-Type |
57 | - * @param contents Contents of label object | 57 | + * @param contents Contents of label object |
58 | - */ | 58 | + */ |
59 | - public LabelSubObject(byte flags, byte cType, int contents) { | 59 | + public LabelSubObject(byte flags, byte cType, int contents) { |
60 | - this.flags = flags; | 60 | + this.flags = flags; |
61 | - this.cType = cType; | 61 | + this.cType = cType; |
62 | - this.contents = contents; | 62 | + this.contents = contents; |
63 | - } | 63 | + } |
64 | - | 64 | + |
65 | - /** | 65 | + /** |
66 | - * Return an object of LabelSubObject. | 66 | + * Return an object of LabelSubObject. |
67 | - * | 67 | + * |
68 | - * @param flags flags | 68 | + * @param flags flags |
69 | - * @param cType C-type | 69 | + * @param cType C-type |
70 | - * @param contents contents of label objects | 70 | + * @param contents contents of label objects |
71 | - * @return object of LabelSubObject | 71 | + * @return object of LabelSubObject |
72 | - */ | 72 | + */ |
73 | - public static LabelSubObject of(byte flags, byte cType, int contents) { | 73 | + public static LabelSubObject of(byte flags, byte cType, int contents) { |
74 | - return new LabelSubObject(flags, cType, contents); | 74 | + return new LabelSubObject(flags, cType, contents); |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - /** | 77 | + /** |
78 | - * Returns Flags. | 78 | + * Returns Flags. |
79 | - * | 79 | + * |
80 | - * @return flags | 80 | + * @return flags |
81 | - */ | 81 | + */ |
82 | - public byte getFlags() { | 82 | + public byte getFlags() { |
83 | - return flags; | 83 | + return flags; |
84 | - } | 84 | + } |
85 | - | 85 | + |
86 | - /** | 86 | + /** |
87 | - * Returns cType. | 87 | + * Returns cType. |
88 | - * | 88 | + * |
89 | - * @return cType | 89 | + * @return cType |
90 | - */ | 90 | + */ |
91 | - public byte getCtype() { | 91 | + public byte getCtype() { |
92 | - return cType; | 92 | + return cType; |
93 | - } | 93 | + } |
94 | - | 94 | + |
95 | - /** | 95 | + /** |
96 | - * Returns contents. | 96 | + * Returns contents. |
97 | - * | 97 | + * |
98 | - * @return contents | 98 | + * @return contents |
99 | - */ | 99 | + */ |
100 | - public int getContents() { | 100 | + public int getContents() { |
101 | - return contents; | 101 | + return contents; |
102 | - } | 102 | + } |
103 | - | 103 | + |
104 | - @Override | 104 | + @Override |
105 | - public PcepVersion getVersion() { | 105 | + public PcepVersion getVersion() { |
106 | - return PcepVersion.PCEP_1; | 106 | + return PcepVersion.PCEP_1; |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - @Override | 109 | + @Override |
110 | - public short getType() { | 110 | + public short getType() { |
111 | - return TYPE; | 111 | + return TYPE; |
112 | - } | 112 | + } |
113 | - | 113 | + |
114 | - @Override | 114 | + @Override |
115 | - public short getLength() { | 115 | + public short getLength() { |
116 | - return LENGTH; | 116 | + return LENGTH; |
117 | - } | 117 | + } |
118 | - | 118 | + |
119 | - @Override | 119 | + @Override |
120 | - public int hashCode() { | 120 | + public int hashCode() { |
121 | - return Objects.hash(flags, cType, contents); | 121 | + return Objects.hash(flags, cType, contents); |
122 | - } | 122 | + } |
123 | - | 123 | + |
124 | - @Override | 124 | + @Override |
125 | - public boolean equals(Object obj) { | 125 | + public boolean equals(Object obj) { |
126 | - if (this == obj) { | 126 | + if (this == obj) { |
127 | - return true; | 127 | + return true; |
128 | - } | 128 | + } |
129 | - if (obj instanceof LabelSubObject) { | 129 | + if (obj instanceof LabelSubObject) { |
130 | - LabelSubObject other = (LabelSubObject) obj; | 130 | + LabelSubObject other = (LabelSubObject) obj; |
131 | - return Objects.equals(this.flags, other.flags) && Objects.equals(this.cType, other.cType) | 131 | + return Objects.equals(this.flags, other.flags) && Objects.equals(this.cType, other.cType) |
132 | - && Objects.equals(this.contents, other.contents); | 132 | + && Objects.equals(this.contents, other.contents); |
133 | - } | 133 | + } |
134 | - return false; | 134 | + return false; |
135 | - } | 135 | + } |
136 | - | 136 | + |
137 | - @Override | 137 | + @Override |
138 | - public int write(ChannelBuffer c) { | 138 | + public int write(ChannelBuffer c) { |
139 | - int iStartIndex = c.writerIndex(); | 139 | + int iStartIndex = c.writerIndex(); |
140 | - c.writeShort(TYPE); | 140 | + c.writeShort(TYPE); |
141 | - c.writeShort(LENGTH); | 141 | + c.writeShort(LENGTH); |
142 | - c.writeByte(flags); | 142 | + c.writeByte(flags); |
143 | - c.writeByte(cType); | 143 | + c.writeByte(cType); |
144 | - c.writeByte(contents); | 144 | + c.writeByte(contents); |
145 | - return c.writerIndex() - iStartIndex; | 145 | + return c.writerIndex() - iStartIndex; |
146 | - } | 146 | + } |
147 | - | 147 | + |
148 | - /** | 148 | + /** |
149 | - * Reads the channel buffer and returns object of LabelSubObject. | 149 | + * Reads the channel buffer and returns object of LabelSubObject. |
150 | - * | 150 | + * |
151 | - * @param c type of channel buffer | 151 | + * @param c type of channel buffer |
152 | - * @return object of LabelSubObject | 152 | + * @return object of LabelSubObject |
153 | - */ | 153 | + */ |
154 | - public static PcepValueType read(ChannelBuffer c) { | 154 | + public static PcepValueType read(ChannelBuffer c) { |
155 | - byte flags = c.readByte(); | 155 | + byte flags = c.readByte(); |
156 | - byte cType = c.readByte(); | 156 | + byte cType = c.readByte(); |
157 | - int contents = c.readInt(); | 157 | + int contents = c.readInt(); |
158 | - return new LabelSubObject(flags, cType, contents); | 158 | + return new LabelSubObject(flags, cType, contents); |
159 | - } | 159 | + } |
160 | - | 160 | + |
161 | - @Override | 161 | + @Override |
162 | - public String toString() { | 162 | + public String toString() { |
163 | - return MoreObjects.toStringHelper(getClass()).add("type", TYPE).add("Length", LENGTH).add("flags", flags) | 163 | + return MoreObjects.toStringHelper(getClass()).add("type", TYPE).add("Length", LENGTH).add("flags", flags) |
164 | - .add("C-type", cType).add("contents", contents).toString(); | 164 | + .add("C-type", cType).add("contents", contents).toString(); |
165 | - } | 165 | + } |
166 | -} | 166 | +} | ... | ... |
This diff is collapsed. Click to expand it.
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | -import com.google.common.base.MoreObjects.ToStringHelper; | 26 | +import com.google.common.base.MoreObjects.ToStringHelper; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * Provides the Link Name. | 29 | + * Provides the Link Name. |
30 | - */ | 30 | + */ |
31 | -public class LinkNameTlv implements PcepValueType { | 31 | +public class LinkNameTlv implements PcepValueType { |
32 | - | 32 | + |
33 | - /* Reference :[I-D.ietf-idr- ls-distribution] /3.3.2.7 | 33 | + /* Reference :[I-D.ietf-idr- ls-distribution] /3.3.2.7 |
34 | - * Link name tlv format. | 34 | + * Link name tlv format. |
35 | - 0 1 2 3 | 35 | + 0 1 2 3 |
36 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 36 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | Type=TDB43 | Length | | 38 | + | Type=TDB43 | Length | |
39 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 39 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
40 | - // Link Name (variable) // | 40 | + // Link Name (variable) // |
41 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 41 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
42 | - */ | 42 | + */ |
43 | - | 43 | + |
44 | - protected static final Logger log = LoggerFactory.getLogger(LinkNameTlv.class); | 44 | + protected static final Logger log = LoggerFactory.getLogger(LinkNameTlv.class); |
45 | - | 45 | + |
46 | - public static final short TYPE = 1098; //TODO:NEED TO HANDLE TDB43 | 46 | + public static final short TYPE = 1098; //TODO:NEED TO HANDLE TDB43 |
47 | - private short hLength; | 47 | + private short hLength; |
48 | - | 48 | + |
49 | - private final byte[] rawValue; | 49 | + private final byte[] rawValue; |
50 | - | 50 | + |
51 | - /** | 51 | + /** |
52 | - * Constructor to initialize rawValue. | 52 | + * Constructor to initialize rawValue. |
53 | - * | 53 | + * |
54 | - * @param rawValue Link-Name | 54 | + * @param rawValue Link-Name |
55 | - * @param hLength length | 55 | + * @param hLength length |
56 | - */ | 56 | + */ |
57 | - public LinkNameTlv(byte[] rawValue, short hLength) { | 57 | + public LinkNameTlv(byte[] rawValue, short hLength) { |
58 | - this.rawValue = rawValue; | 58 | + this.rawValue = rawValue; |
59 | - if (0 == hLength) { | 59 | + if (0 == hLength) { |
60 | - this.hLength = (short) rawValue.length; | 60 | + this.hLength = (short) rawValue.length; |
61 | - } else { | 61 | + } else { |
62 | - this.hLength = hLength; | 62 | + this.hLength = hLength; |
63 | - } | 63 | + } |
64 | - } | 64 | + } |
65 | - | 65 | + |
66 | - /** | 66 | + /** |
67 | - * Returns newly created LinkNameTlv object. | 67 | + * Returns newly created LinkNameTlv object. |
68 | - * | 68 | + * |
69 | - * @param raw Link-Name | 69 | + * @param raw Link-Name |
70 | - * @param hLength length | 70 | + * @param hLength length |
71 | - * @return object of LinkNameTlv | 71 | + * @return object of LinkNameTlv |
72 | - */ | 72 | + */ |
73 | - public static LinkNameTlv of(final byte[] raw, short hLength) { | 73 | + public static LinkNameTlv of(final byte[] raw, short hLength) { |
74 | - return new LinkNameTlv(raw, hLength); | 74 | + return new LinkNameTlv(raw, hLength); |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - /** | 77 | + /** |
78 | - * Returns value of Link-Name. | 78 | + * Returns value of Link-Name. |
79 | - * | 79 | + * |
80 | - * @return raw value | 80 | + * @return raw value |
81 | - */ | 81 | + */ |
82 | - public byte[] getValue() { | 82 | + public byte[] getValue() { |
83 | - return rawValue; | 83 | + return rawValue; |
84 | - } | 84 | + } |
85 | - | 85 | + |
86 | - @Override | 86 | + @Override |
87 | - public PcepVersion getVersion() { | 87 | + public PcepVersion getVersion() { |
88 | - return PcepVersion.PCEP_1; | 88 | + return PcepVersion.PCEP_1; |
89 | - } | 89 | + } |
90 | - | 90 | + |
91 | - @Override | 91 | + @Override |
92 | - public short getType() { | 92 | + public short getType() { |
93 | - return TYPE; | 93 | + return TYPE; |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - @Override | 96 | + @Override |
97 | - public short getLength() { | 97 | + public short getLength() { |
98 | - return hLength; | 98 | + return hLength; |
99 | - } | 99 | + } |
100 | - | 100 | + |
101 | - @Override | 101 | + @Override |
102 | - public int hashCode() { | 102 | + public int hashCode() { |
103 | - return Objects.hash(rawValue); | 103 | + return Objects.hash(rawValue); |
104 | - } | 104 | + } |
105 | - | 105 | + |
106 | - @Override | 106 | + @Override |
107 | - public boolean equals(Object obj) { | 107 | + public boolean equals(Object obj) { |
108 | - if (this == obj) { | 108 | + if (this == obj) { |
109 | - return true; | 109 | + return true; |
110 | - } | 110 | + } |
111 | - if (obj instanceof LinkNameTlv) { | 111 | + if (obj instanceof LinkNameTlv) { |
112 | - LinkNameTlv other = (LinkNameTlv) obj; | 112 | + LinkNameTlv other = (LinkNameTlv) obj; |
113 | - return Objects.equals(rawValue, other.rawValue); | 113 | + return Objects.equals(rawValue, other.rawValue); |
114 | - } | 114 | + } |
115 | - return false; | 115 | + return false; |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - @Override | 118 | + @Override |
119 | - public int write(ChannelBuffer c) { | 119 | + public int write(ChannelBuffer c) { |
120 | - int iLenStartIndex = c.writerIndex(); | 120 | + int iLenStartIndex = c.writerIndex(); |
121 | - c.writeShort(TYPE); | 121 | + c.writeShort(TYPE); |
122 | - c.writeShort(hLength); | 122 | + c.writeShort(hLength); |
123 | - c.writeBytes(rawValue); | 123 | + c.writeBytes(rawValue); |
124 | - return c.writerIndex() - iLenStartIndex; | 124 | + return c.writerIndex() - iLenStartIndex; |
125 | - } | 125 | + } |
126 | - | 126 | + |
127 | - /** | 127 | + /** |
128 | - * Reads the channel buffer and returns object of LinkNameTlv. | 128 | + * Reads the channel buffer and returns object of LinkNameTlv. |
129 | - * | 129 | + * |
130 | - * @param c input channel buffer | 130 | + * @param c input channel buffer |
131 | - * @param hLength length | 131 | + * @param hLength length |
132 | - * @return object of LinkNameTlv | 132 | + * @return object of LinkNameTlv |
133 | - */ | 133 | + */ |
134 | - public static PcepValueType read(ChannelBuffer c, short hLength) { | 134 | + public static PcepValueType read(ChannelBuffer c, short hLength) { |
135 | - byte[] linkName = new byte[hLength]; | 135 | + byte[] linkName = new byte[hLength]; |
136 | - c.readBytes(linkName, 0, hLength); | 136 | + c.readBytes(linkName, 0, hLength); |
137 | - return new LinkNameTlv(linkName, hLength); | 137 | + return new LinkNameTlv(linkName, hLength); |
138 | - } | 138 | + } |
139 | - | 139 | + |
140 | - @Override | 140 | + @Override |
141 | - public String toString() { | 141 | + public String toString() { |
142 | - ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass()); | 142 | + ToStringHelper toStrHelper = MoreObjects.toStringHelper(getClass()); |
143 | - | 143 | + |
144 | - toStrHelper.add("Type", TYPE); | 144 | + toStrHelper.add("Type", TYPE); |
145 | - toStrHelper.add("Length", hLength); | 145 | + toStrHelper.add("Length", hLength); |
146 | - | 146 | + |
147 | - StringBuffer result = new StringBuffer(); | 147 | + StringBuffer result = new StringBuffer(); |
148 | - for (byte b : rawValue) { | 148 | + for (byte b : rawValue) { |
149 | - result.append(String.format("%02X ", b)); | 149 | + result.append(String.format("%02X ", b)); |
150 | - } | 150 | + } |
151 | - toStrHelper.add("Value", result); | 151 | + toStrHelper.add("Value", result); |
152 | - | 152 | + |
153 | - return toStrHelper.toString(); | 153 | + return toStrHelper.toString(); |
154 | - } | 154 | + } |
155 | -} | 155 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provide Link Protection Type. | 28 | + * Provide Link Protection Type. |
29 | - */ | 29 | + */ |
30 | - | 30 | + |
31 | -public class LinkProtectionTypeTlv implements PcepValueType { | 31 | +public class LinkProtectionTypeTlv implements PcepValueType { |
32 | - | 32 | + |
33 | - /* Reference :[RFC5307]/1.2 | 33 | + /* Reference :[RFC5307]/1.2 |
34 | - * 0 1 2 3 | 34 | + * 0 1 2 3 |
35 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 35 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
36 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 36 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
37 | - | Type=[TDB38] | Length=2 | | 37 | + | Type=[TDB38] | Length=2 | |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - |Protection Cap | Reserved | | 39 | + |Protection Cap | Reserved | |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - */ | 41 | + */ |
42 | - protected static final Logger log = LoggerFactory.getLogger(LinkProtectionTypeTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(LinkProtectionTypeTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 20; //TDB38 | 44 | + public static final short TYPE = 20; //TDB38 |
45 | - public static final short LENGTH = 2; | 45 | + public static final short LENGTH = 2; |
46 | - private final byte protectionCap; | 46 | + private final byte protectionCap; |
47 | - private final byte reserved; | 47 | + private final byte reserved; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize protectionCap. | 50 | + * Constructor to initialize protectionCap. |
51 | - * | 51 | + * |
52 | - * @param protectionCap Protection Cap | 52 | + * @param protectionCap Protection Cap |
53 | - */ | 53 | + */ |
54 | - public LinkProtectionTypeTlv(byte protectionCap) { | 54 | + public LinkProtectionTypeTlv(byte protectionCap) { |
55 | - this.protectionCap = protectionCap; | 55 | + this.protectionCap = protectionCap; |
56 | - this.reserved = 0; | 56 | + this.reserved = 0; |
57 | - } | 57 | + } |
58 | - | 58 | + |
59 | - /** | 59 | + /** |
60 | - * Constructor to initialize protectionCap, reserved. | 60 | + * Constructor to initialize protectionCap, reserved. |
61 | - * | 61 | + * |
62 | - * @param protectionCap Protection Cap | 62 | + * @param protectionCap Protection Cap |
63 | - * @param reserved Reserved value | 63 | + * @param reserved Reserved value |
64 | - */ | 64 | + */ |
65 | - public LinkProtectionTypeTlv(byte protectionCap, byte reserved) { | 65 | + public LinkProtectionTypeTlv(byte protectionCap, byte reserved) { |
66 | - this.protectionCap = protectionCap; | 66 | + this.protectionCap = protectionCap; |
67 | - this.reserved = reserved; | 67 | + this.reserved = reserved; |
68 | - } | 68 | + } |
69 | - | 69 | + |
70 | - /** | 70 | + /** |
71 | - * Returns Protection Cap. | 71 | + * Returns Protection Cap. |
72 | - * | 72 | + * |
73 | - * @return protectionCap Protection Cap | 73 | + * @return protectionCap Protection Cap |
74 | - */ | 74 | + */ |
75 | - public byte getProtectionCap() { | 75 | + public byte getProtectionCap() { |
76 | - return protectionCap; | 76 | + return protectionCap; |
77 | - } | 77 | + } |
78 | - | 78 | + |
79 | - @Override | 79 | + @Override |
80 | - public PcepVersion getVersion() { | 80 | + public PcepVersion getVersion() { |
81 | - return PcepVersion.PCEP_1; | 81 | + return PcepVersion.PCEP_1; |
82 | - } | 82 | + } |
83 | - | 83 | + |
84 | - @Override | 84 | + @Override |
85 | - public short getType() { | 85 | + public short getType() { |
86 | - return TYPE; | 86 | + return TYPE; |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - @Override | 89 | + @Override |
90 | - public short getLength() { | 90 | + public short getLength() { |
91 | - return LENGTH; | 91 | + return LENGTH; |
92 | - } | 92 | + } |
93 | - | 93 | + |
94 | - @Override | 94 | + @Override |
95 | - public int hashCode() { | 95 | + public int hashCode() { |
96 | - return Objects.hash(protectionCap, reserved); | 96 | + return Objects.hash(protectionCap, reserved); |
97 | - } | 97 | + } |
98 | - | 98 | + |
99 | - @Override | 99 | + @Override |
100 | - public boolean equals(Object obj) { | 100 | + public boolean equals(Object obj) { |
101 | - if (this == obj) { | 101 | + if (this == obj) { |
102 | - return true; | 102 | + return true; |
103 | - } | 103 | + } |
104 | - if (obj instanceof LinkProtectionTypeTlv) { | 104 | + if (obj instanceof LinkProtectionTypeTlv) { |
105 | - LinkProtectionTypeTlv other = (LinkProtectionTypeTlv) obj; | 105 | + LinkProtectionTypeTlv other = (LinkProtectionTypeTlv) obj; |
106 | - return Objects.equals(protectionCap, other.protectionCap) && Objects.equals(reserved, other.reserved); | 106 | + return Objects.equals(protectionCap, other.protectionCap) && Objects.equals(reserved, other.reserved); |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - return false; | 109 | + return false; |
110 | - } | 110 | + } |
111 | - | 111 | + |
112 | - @Override | 112 | + @Override |
113 | - public int write(ChannelBuffer c) { | 113 | + public int write(ChannelBuffer c) { |
114 | - int iLenStartIndex = c.writerIndex(); | 114 | + int iLenStartIndex = c.writerIndex(); |
115 | - c.writeShort(TYPE); | 115 | + c.writeShort(TYPE); |
116 | - c.writeShort(LENGTH); | 116 | + c.writeShort(LENGTH); |
117 | - c.writeByte(protectionCap); | 117 | + c.writeByte(protectionCap); |
118 | - c.writeByte(reserved); | 118 | + c.writeByte(reserved); |
119 | - return c.writerIndex() - iLenStartIndex; | 119 | + return c.writerIndex() - iLenStartIndex; |
120 | - } | 120 | + } |
121 | - | 121 | + |
122 | - /** | 122 | + /** |
123 | - * Reads the channel buffer and returns object of LinkProtectionTypeTlv. | 123 | + * Reads the channel buffer and returns object of LinkProtectionTypeTlv. |
124 | - * | 124 | + * |
125 | - * @param c input channel buffer | 125 | + * @param c input channel buffer |
126 | - * @return object of LinkProtectionTypeTlv | 126 | + * @return object of LinkProtectionTypeTlv |
127 | - */ | 127 | + */ |
128 | - public static PcepValueType read(ChannelBuffer c) { | 128 | + public static PcepValueType read(ChannelBuffer c) { |
129 | - byte protectionCap = c.readByte(); | 129 | + byte protectionCap = c.readByte(); |
130 | - byte reserved = c.readByte(); | 130 | + byte reserved = c.readByte(); |
131 | - return new LinkProtectionTypeTlv(protectionCap, reserved); | 131 | + return new LinkProtectionTypeTlv(protectionCap, reserved); |
132 | - } | 132 | + } |
133 | - | 133 | + |
134 | - @Override | 134 | + @Override |
135 | - public String toString() { | 135 | + public String toString() { |
136 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH) | 136 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH) |
137 | - .add("ProtectionCap", protectionCap).toString(); | 137 | + .add("ProtectionCap", protectionCap).toString(); |
138 | - } | 138 | + } |
139 | } | 139 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provide the Maximum Link Bandwidth. | 28 | + * Provide the Maximum Link Bandwidth. |
29 | - */ | 29 | + */ |
30 | -public class MaximumLinkBandwidthTlv implements PcepValueType { | 30 | +public class MaximumLinkBandwidthTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* Reference :[RFC5305]/3.3. | 32 | + /* Reference :[RFC5305]/3.3. |
33 | - * 0 1 2 3 | 33 | + * 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=[TDB34] | Length=4 | | 36 | + | Type=[TDB34] | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | Maximum Link Bandwidth | | 38 | + | Maximum Link Bandwidth | |
39 | - +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- | 39 | + +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(MaximumLinkBandwidthTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(MaximumLinkBandwidthTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 9; //TDB34 | 44 | + public static final short TYPE = 9; //TDB34 |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize rawValue. | 50 | + * Constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue Maximum-Link-Bandwidth | 52 | + * @param rawValue Maximum-Link-Bandwidth |
53 | - */ | 53 | + */ |
54 | - | 54 | + |
55 | - public MaximumLinkBandwidthTlv(int rawValue) { | 55 | + public MaximumLinkBandwidthTlv(int rawValue) { |
56 | - this.rawValue = rawValue; | 56 | + this.rawValue = rawValue; |
57 | - } | 57 | + } |
58 | - | 58 | + |
59 | - /** | 59 | + /** |
60 | - * Returns newly created MaximumLinkBandwidthTlv object. | 60 | + * Returns newly created MaximumLinkBandwidthTlv object. |
61 | - * | 61 | + * |
62 | - * @param raw value of Maximum-Link-Bandwidth | 62 | + * @param raw value of Maximum-Link-Bandwidth |
63 | - * @return object of MaximumLinkBandwidthTlv | 63 | + * @return object of MaximumLinkBandwidthTlv |
64 | - */ | 64 | + */ |
65 | - public static MaximumLinkBandwidthTlv of(final int raw) { | 65 | + public static MaximumLinkBandwidthTlv of(final int raw) { |
66 | - return new MaximumLinkBandwidthTlv(raw); | 66 | + return new MaximumLinkBandwidthTlv(raw); |
67 | - } | 67 | + } |
68 | - | 68 | + |
69 | - /** | 69 | + /** |
70 | - * Returns value of Maximum Link Bandwidth. | 70 | + * Returns value of Maximum Link Bandwidth. |
71 | - * | 71 | + * |
72 | - * @return rawValue Maximum Link Bandwidth | 72 | + * @return rawValue Maximum Link Bandwidth |
73 | - */ | 73 | + */ |
74 | - public int getInt() { | 74 | + public int getInt() { |
75 | - return rawValue; | 75 | + return rawValue; |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - @Override | 78 | + @Override |
79 | - public PcepVersion getVersion() { | 79 | + public PcepVersion getVersion() { |
80 | - return PcepVersion.PCEP_1; | 80 | + return PcepVersion.PCEP_1; |
81 | - } | 81 | + } |
82 | - | 82 | + |
83 | - @Override | 83 | + @Override |
84 | - public short getType() { | 84 | + public short getType() { |
85 | - return TYPE; | 85 | + return TYPE; |
86 | - } | 86 | + } |
87 | - | 87 | + |
88 | - @Override | 88 | + @Override |
89 | - public short getLength() { | 89 | + public short getLength() { |
90 | - return LENGTH; | 90 | + return LENGTH; |
91 | - } | 91 | + } |
92 | - | 92 | + |
93 | - @Override | 93 | + @Override |
94 | - public int hashCode() { | 94 | + public int hashCode() { |
95 | - return Objects.hash(rawValue); | 95 | + return Objects.hash(rawValue); |
96 | - } | 96 | + } |
97 | - | 97 | + |
98 | - @Override | 98 | + @Override |
99 | - public boolean equals(Object obj) { | 99 | + public boolean equals(Object obj) { |
100 | - if (this == obj) { | 100 | + if (this == obj) { |
101 | - return true; | 101 | + return true; |
102 | - } | 102 | + } |
103 | - if (obj instanceof MaximumLinkBandwidthTlv) { | 103 | + if (obj instanceof MaximumLinkBandwidthTlv) { |
104 | - MaximumLinkBandwidthTlv other = (MaximumLinkBandwidthTlv) obj; | 104 | + MaximumLinkBandwidthTlv other = (MaximumLinkBandwidthTlv) obj; |
105 | - return Objects.equals(rawValue, other.rawValue); | 105 | + return Objects.equals(rawValue, other.rawValue); |
106 | - } | 106 | + } |
107 | - return false; | 107 | + return false; |
108 | - } | 108 | + } |
109 | - | 109 | + |
110 | - @Override | 110 | + @Override |
111 | - public int write(ChannelBuffer c) { | 111 | + public int write(ChannelBuffer c) { |
112 | - int iLenStartIndex = c.writerIndex(); | 112 | + int iLenStartIndex = c.writerIndex(); |
113 | - c.writeShort(TYPE); | 113 | + c.writeShort(TYPE); |
114 | - c.writeShort(LENGTH); | 114 | + c.writeShort(LENGTH); |
115 | - c.writeInt(rawValue); | 115 | + c.writeInt(rawValue); |
116 | - return c.writerIndex() - iLenStartIndex; | 116 | + return c.writerIndex() - iLenStartIndex; |
117 | - } | 117 | + } |
118 | - | 118 | + |
119 | - /** | 119 | + /** |
120 | - * Reads the channel buffer and returns object of MaximumLinkBandwidthTlv. | 120 | + * Reads the channel buffer and returns object of MaximumLinkBandwidthTlv. |
121 | - * | 121 | + * |
122 | - * @param c input channel buffer | 122 | + * @param c input channel buffer |
123 | - * @return object of MaximumLinkBandwidthTlv | 123 | + * @return object of MaximumLinkBandwidthTlv |
124 | - */ | 124 | + */ |
125 | - public static MaximumLinkBandwidthTlv read(ChannelBuffer c) { | 125 | + public static MaximumLinkBandwidthTlv read(ChannelBuffer c) { |
126 | - return MaximumLinkBandwidthTlv.of(c.readInt()); | 126 | + return MaximumLinkBandwidthTlv.of(c.readInt()); |
127 | - } | 127 | + } |
128 | - | 128 | + |
129 | - @Override | 129 | + @Override |
130 | - public String toString() { | 130 | + public String toString() { |
131 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 131 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
132 | - .toString(); | 132 | + .toString(); |
133 | - } | 133 | + } |
134 | -} | 134 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | -package org.onosproject.pcepio.types; | 16 | +package org.onosproject.pcepio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.pcepio.protocol.PcepVersion; | 21 | +import org.onosproject.pcepio.protocol.PcepVersion; |
22 | -import org.slf4j.Logger; | 22 | +import org.slf4j.Logger; |
23 | -import org.slf4j.LoggerFactory; | 23 | +import org.slf4j.LoggerFactory; |
24 | - | 24 | + |
25 | -import com.google.common.base.MoreObjects; | 25 | +import com.google.common.base.MoreObjects; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Provide the Maximum Reservable Link Bandwidth. | 28 | + * Provide the Maximum Reservable Link Bandwidth. |
29 | - */ | 29 | + */ |
30 | -public class MaximumReservableLinkBandwidthTlv implements PcepValueType { | 30 | +public class MaximumReservableLinkBandwidthTlv implements PcepValueType { |
31 | - | 31 | + |
32 | - /* Reference :[RFC5305]/3.5. | 32 | + /* Reference :[RFC5305]/3.5. |
33 | - * 0 1 2 3 | 33 | + * 0 1 2 3 |
34 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 34 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
35 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 35 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
36 | - | Type=[TDB35] | Length=4 | | 36 | + | Type=[TDB35] | Length=4 | |
37 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 37 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
38 | - | Maximum Reservable Link Bandwidth | | 38 | + | Maximum Reservable Link Bandwidth | |
39 | - +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- | 39 | + +-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-++-+-+-+- |
40 | - */ | 40 | + */ |
41 | - | 41 | + |
42 | - protected static final Logger log = LoggerFactory.getLogger(MaximumReservableLinkBandwidthTlv.class); | 42 | + protected static final Logger log = LoggerFactory.getLogger(MaximumReservableLinkBandwidthTlv.class); |
43 | - | 43 | + |
44 | - public static final short TYPE = 10; // TDB35 | 44 | + public static final short TYPE = 10; // TDB35 |
45 | - public static final short LENGTH = 4; | 45 | + public static final short LENGTH = 4; |
46 | - | 46 | + |
47 | - private final int rawValue; | 47 | + private final int rawValue; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * constructor to initialize rawValue. | 50 | + * constructor to initialize rawValue. |
51 | - * | 51 | + * |
52 | - * @param rawValue MaximumReservableLinkBandwidth | 52 | + * @param rawValue MaximumReservableLinkBandwidth |
53 | - */ | 53 | + */ |
54 | - public MaximumReservableLinkBandwidthTlv(int rawValue) { | 54 | + public MaximumReservableLinkBandwidthTlv(int rawValue) { |
55 | - log.debug("MaximumReservableLinkBandwidthTlv"); | 55 | + log.debug("MaximumReservableLinkBandwidthTlv"); |
56 | - this.rawValue = rawValue; | 56 | + this.rawValue = rawValue; |
57 | - } | 57 | + } |
58 | - | 58 | + |
59 | - /** | 59 | + /** |
60 | - * Returns newly created MaximumReservableLinkBandwidth object. | 60 | + * Returns newly created MaximumReservableLinkBandwidth object. |
61 | - * | 61 | + * |
62 | - * @param raw MaximumReservableLinkBandwidth | 62 | + * @param raw MaximumReservableLinkBandwidth |
63 | - * @return object of MaximumReservableLinkBandwidthTlv | 63 | + * @return object of MaximumReservableLinkBandwidthTlv |
64 | - */ | 64 | + */ |
65 | - public static MaximumReservableLinkBandwidthTlv of(final int raw) { | 65 | + public static MaximumReservableLinkBandwidthTlv of(final int raw) { |
66 | - return new MaximumReservableLinkBandwidthTlv(raw); | 66 | + return new MaximumReservableLinkBandwidthTlv(raw); |
67 | - } | 67 | + } |
68 | - | 68 | + |
69 | - /** | 69 | + /** |
70 | - * Returns value of Maximum Reservable Link Bandwidth. | 70 | + * Returns value of Maximum Reservable Link Bandwidth. |
71 | - * @return rawValue Maximum Reservable Link Bandwidth | 71 | + * @return rawValue Maximum Reservable Link Bandwidth |
72 | - */ | 72 | + */ |
73 | - public int getInt() { | 73 | + public int getInt() { |
74 | - return rawValue; | 74 | + return rawValue; |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - @Override | 77 | + @Override |
78 | - public PcepVersion getVersion() { | 78 | + public PcepVersion getVersion() { |
79 | - return PcepVersion.PCEP_1; | 79 | + return PcepVersion.PCEP_1; |
80 | - } | 80 | + } |
81 | - | 81 | + |
82 | - @Override | 82 | + @Override |
83 | - public short getType() { | 83 | + public short getType() { |
84 | - return TYPE; | 84 | + return TYPE; |
85 | - } | 85 | + } |
86 | - | 86 | + |
87 | - @Override | 87 | + @Override |
88 | - public short getLength() { | 88 | + public short getLength() { |
89 | - return LENGTH; | 89 | + return LENGTH; |
90 | - } | 90 | + } |
91 | - | 91 | + |
92 | - @Override | 92 | + @Override |
93 | - public int hashCode() { | 93 | + public int hashCode() { |
94 | - return Objects.hash(rawValue); | 94 | + return Objects.hash(rawValue); |
95 | - } | 95 | + } |
96 | - | 96 | + |
97 | - @Override | 97 | + @Override |
98 | - public boolean equals(Object obj) { | 98 | + public boolean equals(Object obj) { |
99 | - if (this == obj) { | 99 | + if (this == obj) { |
100 | - return true; | 100 | + return true; |
101 | - } | 101 | + } |
102 | - if (obj instanceof MaximumReservableLinkBandwidthTlv) { | 102 | + if (obj instanceof MaximumReservableLinkBandwidthTlv) { |
103 | - MaximumReservableLinkBandwidthTlv other = (MaximumReservableLinkBandwidthTlv) obj; | 103 | + MaximumReservableLinkBandwidthTlv other = (MaximumReservableLinkBandwidthTlv) obj; |
104 | - return Objects.equals(this.rawValue, other.rawValue); | 104 | + return Objects.equals(this.rawValue, other.rawValue); |
105 | - } | 105 | + } |
106 | - return false; | 106 | + return false; |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - @Override | 109 | + @Override |
110 | - public int write(ChannelBuffer c) { | 110 | + public int write(ChannelBuffer c) { |
111 | - int iLenStartIndex = c.writerIndex(); | 111 | + int iLenStartIndex = c.writerIndex(); |
112 | - c.writeShort(TYPE); | 112 | + c.writeShort(TYPE); |
113 | - c.writeShort(LENGTH); | 113 | + c.writeShort(LENGTH); |
114 | - c.writeInt(rawValue); | 114 | + c.writeInt(rawValue); |
115 | - return c.writerIndex() - iLenStartIndex; | 115 | + return c.writerIndex() - iLenStartIndex; |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - /** | 118 | + /** |
119 | - * Reads the channel buffer and returns object of MaximumReservableLinkBandwidthTlv. | 119 | + * Reads the channel buffer and returns object of MaximumReservableLinkBandwidthTlv. |
120 | - * | 120 | + * |
121 | - * @param c input channel buffer | 121 | + * @param c input channel buffer |
122 | - * @return object of MaximumReservableLinkBandwidthTlv | 122 | + * @return object of MaximumReservableLinkBandwidthTlv |
123 | - */ | 123 | + */ |
124 | - public static MaximumReservableLinkBandwidthTlv read(ChannelBuffer c) { | 124 | + public static MaximumReservableLinkBandwidthTlv read(ChannelBuffer c) { |
125 | - return MaximumReservableLinkBandwidthTlv.of(c.readInt()); | 125 | + return MaximumReservableLinkBandwidthTlv.of(c.readInt()); |
126 | - } | 126 | + } |
127 | - | 127 | + |
128 | - @Override | 128 | + @Override |
129 | - public String toString() { | 129 | + public String toString() { |
130 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) | 130 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("Value", rawValue) |
131 | - .toString(); | 131 | + .toString(); |
132 | - } | 132 | + } |
133 | -} | 133 | +} | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | - | 16 | + |
17 | -package org.onosproject.pcepio.types; | 17 | +package org.onosproject.pcepio.types; |
18 | - | 18 | + |
19 | -import java.util.Objects; | 19 | +import java.util.Objects; |
20 | - | 20 | + |
21 | -import org.jboss.netty.buffer.ChannelBuffer; | 21 | +import org.jboss.netty.buffer.ChannelBuffer; |
22 | -import org.onosproject.pcepio.protocol.PcepVersion; | 22 | +import org.onosproject.pcepio.protocol.PcepVersion; |
23 | -import org.slf4j.Logger; | 23 | +import org.slf4j.Logger; |
24 | -import org.slf4j.LoggerFactory; | 24 | +import org.slf4j.LoggerFactory; |
25 | - | 25 | + |
26 | -import com.google.common.base.MoreObjects; | 26 | +import com.google.common.base.MoreObjects; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * NexthopIPv6addressTlv provides Ipv4 address of next hop. | 29 | + * NexthopIPv6addressTlv provides Ipv4 address of next hop. |
30 | - */ | 30 | + */ |
31 | -public class NexthopIPv4addressTlv implements PcepValueType { | 31 | +public class NexthopIPv4addressTlv implements PcepValueType { |
32 | - | 32 | + |
33 | - /* | 33 | + /* |
34 | - Reference :draft-zhao-pce-pcep-extension-for-pce-controller-01 | 34 | + Reference :draft-zhao-pce-pcep-extension-for-pce-controller-01 |
35 | - | 35 | + |
36 | - 0 1 2 3 | 36 | + 0 1 2 3 |
37 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 37 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - | Type=TBD | Length = 8 | | 39 | + | Type=TBD | Length = 8 | |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - | nexthop IPv4 address | | 41 | + | nexthop IPv4 address | |
42 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 42 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
43 | - | 43 | + |
44 | - NEXTHOP-IPV4-ADDRESS TLV | 44 | + NEXTHOP-IPV4-ADDRESS TLV |
45 | - | 45 | + |
46 | - */ | 46 | + */ |
47 | - protected static final Logger log = LoggerFactory.getLogger(NexthopIPv4addressTlv.class); | 47 | + protected static final Logger log = LoggerFactory.getLogger(NexthopIPv4addressTlv.class); |
48 | - | 48 | + |
49 | - public static final short TYPE = 2; //to be defined | 49 | + public static final short TYPE = 2; //to be defined |
50 | - //Length is header + value | 50 | + //Length is header + value |
51 | - public static final short LENGTH = 8; | 51 | + public static final short LENGTH = 8; |
52 | - public static final short VALUE_LENGTH = 4; | 52 | + public static final short VALUE_LENGTH = 4; |
53 | - | 53 | + |
54 | - private final int rawValue; | 54 | + private final int rawValue; |
55 | - | 55 | + |
56 | - /** | 56 | + /** |
57 | - * Constructor to initialize next hop IPv4 address. | 57 | + * Constructor to initialize next hop IPv4 address. |
58 | - * | 58 | + * |
59 | - * @param rawValue next hop IPv4 address | 59 | + * @param rawValue next hop IPv4 address |
60 | - */ | 60 | + */ |
61 | - public NexthopIPv4addressTlv(int rawValue) { | 61 | + public NexthopIPv4addressTlv(int rawValue) { |
62 | - this.rawValue = rawValue; | 62 | + this.rawValue = rawValue; |
63 | - } | 63 | + } |
64 | - | 64 | + |
65 | - /** | 65 | + /** |
66 | - * Return next hop IPv4 address tlv. | 66 | + * Return next hop IPv4 address tlv. |
67 | - * | 67 | + * |
68 | - * @param raw of next hop IPv4 address | 68 | + * @param raw of next hop IPv4 address |
69 | - * @return object of NexthopIPv4addressTlv | 69 | + * @return object of NexthopIPv4addressTlv |
70 | - */ | 70 | + */ |
71 | - public static NexthopIPv4addressTlv of(final int raw) { | 71 | + public static NexthopIPv4addressTlv of(final int raw) { |
72 | - return new NexthopIPv4addressTlv(raw); | 72 | + return new NexthopIPv4addressTlv(raw); |
73 | - } | 73 | + } |
74 | - | 74 | + |
75 | - /** | 75 | + /** |
76 | - * Returns next hop IPv4 address. | 76 | + * Returns next hop IPv4 address. |
77 | - * | 77 | + * |
78 | - * @return next hop IPv4 address | 78 | + * @return next hop IPv4 address |
79 | - */ | 79 | + */ |
80 | - public int getInt() { | 80 | + public int getInt() { |
81 | - return rawValue; | 81 | + return rawValue; |
82 | - } | 82 | + } |
83 | - | 83 | + |
84 | - @Override | 84 | + @Override |
85 | - public PcepVersion getVersion() { | 85 | + public PcepVersion getVersion() { |
86 | - return PcepVersion.PCEP_1; | 86 | + return PcepVersion.PCEP_1; |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - @Override | 89 | + @Override |
90 | - public short getType() { | 90 | + public short getType() { |
91 | - return TYPE; | 91 | + return TYPE; |
92 | - } | 92 | + } |
93 | - | 93 | + |
94 | - @Override | 94 | + @Override |
95 | - public short getLength() { | 95 | + public short getLength() { |
96 | - return LENGTH; | 96 | + return LENGTH; |
97 | - } | 97 | + } |
98 | - | 98 | + |
99 | - @Override | 99 | + @Override |
100 | - public int hashCode() { | 100 | + public int hashCode() { |
101 | - return Objects.hash(rawValue); | 101 | + return Objects.hash(rawValue); |
102 | - } | 102 | + } |
103 | - | 103 | + |
104 | - @Override | 104 | + @Override |
105 | - public boolean equals(Object obj) { | 105 | + public boolean equals(Object obj) { |
106 | - if (this == obj) { | 106 | + if (this == obj) { |
107 | - return true; | 107 | + return true; |
108 | - } | 108 | + } |
109 | - if (obj instanceof NexthopIPv4addressTlv) { | 109 | + if (obj instanceof NexthopIPv4addressTlv) { |
110 | - NexthopIPv4addressTlv other = (NexthopIPv4addressTlv) obj; | 110 | + NexthopIPv4addressTlv other = (NexthopIPv4addressTlv) obj; |
111 | - return Objects.equals(this.rawValue, other.rawValue); | 111 | + return Objects.equals(this.rawValue, other.rawValue); |
112 | - } | 112 | + } |
113 | - return false; | 113 | + return false; |
114 | - } | 114 | + } |
115 | - | 115 | + |
116 | - @Override | 116 | + @Override |
117 | - public int write(ChannelBuffer c) { | 117 | + public int write(ChannelBuffer c) { |
118 | - int iStartIndex = c.writerIndex(); | 118 | + int iStartIndex = c.writerIndex(); |
119 | - c.writeShort(TYPE); | 119 | + c.writeShort(TYPE); |
120 | - c.writeShort(LENGTH); | 120 | + c.writeShort(LENGTH); |
121 | - c.writeInt(rawValue); | 121 | + c.writeInt(rawValue); |
122 | - return c.writerIndex() - iStartIndex; | 122 | + return c.writerIndex() - iStartIndex; |
123 | - } | 123 | + } |
124 | - | 124 | + |
125 | - /** | 125 | + /** |
126 | - * Reads the channel buffer and returns object of NexthopIPv4addressTlv. | 126 | + * Reads the channel buffer and returns object of NexthopIPv4addressTlv. |
127 | - * | 127 | + * |
128 | - * @param c type of channel buffer | 128 | + * @param c type of channel buffer |
129 | - * @return object of NexthopIPv4addressTlv | 129 | + * @return object of NexthopIPv4addressTlv |
130 | - */ | 130 | + */ |
131 | - public static NexthopIPv4addressTlv read(ChannelBuffer c) { | 131 | + public static NexthopIPv4addressTlv read(ChannelBuffer c) { |
132 | - return NexthopIPv4addressTlv.of(c.readInt()); | 132 | + return NexthopIPv4addressTlv.of(c.readInt()); |
133 | - } | 133 | + } |
134 | - | 134 | + |
135 | - @Override | 135 | + @Override |
136 | - public String toString() { | 136 | + public String toString() { |
137 | - return MoreObjects.toStringHelper(getClass()) | 137 | + return MoreObjects.toStringHelper(getClass()) |
138 | - .add("Type", TYPE) | 138 | + .add("Type", TYPE) |
139 | - .add("Length", LENGTH) | 139 | + .add("Length", LENGTH) |
140 | - .add("Ipv4Address ", rawValue) | 140 | + .add("Ipv4Address ", rawValue) |
141 | - .toString(); | 141 | + .toString(); |
142 | - } | 142 | + } |
143 | -} | 143 | +} | ... | ... |
This diff is collapsed. Click to expand it.
1 | -/* | 1 | +/* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
3 | - * | 3 | + * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | + * You may obtain a copy of the License at |
7 | - * | 7 | + * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | + * |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | + * Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | + * See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | + * limitations under the License. |
15 | - */ | 15 | + */ |
16 | - | 16 | + |
17 | -package org.onosproject.pcepio.types; | 17 | +package org.onosproject.pcepio.types; |
18 | - | 18 | + |
19 | -import java.util.Objects; | 19 | +import java.util.Objects; |
20 | - | 20 | + |
21 | -import org.jboss.netty.buffer.ChannelBuffer; | 21 | +import org.jboss.netty.buffer.ChannelBuffer; |
22 | -import org.onosproject.pcepio.protocol.PcepVersion; | 22 | +import org.onosproject.pcepio.protocol.PcepVersion; |
23 | -import org.slf4j.Logger; | 23 | +import org.slf4j.Logger; |
24 | -import org.slf4j.LoggerFactory; | 24 | +import org.slf4j.LoggerFactory; |
25 | - | 25 | + |
26 | -import com.google.common.base.MoreObjects; | 26 | +import com.google.common.base.MoreObjects; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * NexthopUnnumberedIPv4IDTlv provides the next node's ID and Interface ID. | 29 | + * NexthopUnnumberedIPv4IDTlv provides the next node's ID and Interface ID. |
30 | - */ | 30 | + */ |
31 | -public class NexthopUnnumberedIPv4IDTlv implements PcepValueType { | 31 | +public class NexthopUnnumberedIPv4IDTlv implements PcepValueType { |
32 | - | 32 | + |
33 | - /* | 33 | + /* |
34 | - Reference : draft-zhao-pce-pcep-extension-for-pce-controller-01. | 34 | + Reference : draft-zhao-pce-pcep-extension-for-pce-controller-01. |
35 | - | 35 | + |
36 | - 0 1 2 3 | 36 | + 0 1 2 3 |
37 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 37 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
38 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 38 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
39 | - | Type=TBD | Length = 12 | | 39 | + | Type=TBD | Length = 12 | |
40 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 40 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
41 | - | Node-ID | | 41 | + | Node-ID | |
42 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 42 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
43 | - | Interface ID | | 43 | + | Interface ID | |
44 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 44 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
45 | - | 45 | + |
46 | - NEXTHOP-UNNUMBERED-IPV4-ID TLV | 46 | + NEXTHOP-UNNUMBERED-IPV4-ID TLV |
47 | - | 47 | + |
48 | - */ | 48 | + */ |
49 | - protected static final Logger log = LoggerFactory.getLogger(NexthopUnnumberedIPv4IDTlv.class); | 49 | + protected static final Logger log = LoggerFactory.getLogger(NexthopUnnumberedIPv4IDTlv.class); |
50 | - | 50 | + |
51 | - public static final short TYPE = 1; //to be defined | 51 | + public static final short TYPE = 1; //to be defined |
52 | - //Length is header + value | 52 | + //Length is header + value |
53 | - public static final short LENGTH = 12; | 53 | + public static final short LENGTH = 12; |
54 | - | 54 | + |
55 | - private final int nodeID; | 55 | + private final int nodeID; |
56 | - private final int interfaceID; | 56 | + private final int interfaceID; |
57 | - | 57 | + |
58 | - /** | 58 | + /** |
59 | - * constructor to initialize nodeID and interfaceID. | 59 | + * constructor to initialize nodeID and interfaceID. |
60 | - * | 60 | + * |
61 | - * @param nodeID node ID | 61 | + * @param nodeID node ID |
62 | - * @param interfaceID interface ID | 62 | + * @param interfaceID interface ID |
63 | - */ | 63 | + */ |
64 | - public NexthopUnnumberedIPv4IDTlv(int nodeID, int interfaceID) { | 64 | + public NexthopUnnumberedIPv4IDTlv(int nodeID, int interfaceID) { |
65 | - this.nodeID = nodeID; | 65 | + this.nodeID = nodeID; |
66 | - this.interfaceID = interfaceID; | 66 | + this.interfaceID = interfaceID; |
67 | - } | 67 | + } |
68 | - | 68 | + |
69 | - /** | 69 | + /** |
70 | - * Returns new object of NexthopUnnumberedIPv4IDTlv. | 70 | + * Returns new object of NexthopUnnumberedIPv4IDTlv. |
71 | - * | 71 | + * |
72 | - * @param nodeID node ID | 72 | + * @param nodeID node ID |
73 | - * @param interfaceID interface ID | 73 | + * @param interfaceID interface ID |
74 | - * @return NexthopUnnumberedIPv4IDTlv | 74 | + * @return NexthopUnnumberedIPv4IDTlv |
75 | - */ | 75 | + */ |
76 | - public static NexthopUnnumberedIPv4IDTlv of(int nodeID, int interfaceID) { | 76 | + public static NexthopUnnumberedIPv4IDTlv of(int nodeID, int interfaceID) { |
77 | - return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID); | 77 | + return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID); |
78 | - } | 78 | + } |
79 | - | 79 | + |
80 | - /** | 80 | + /** |
81 | - * Returns Node Id. | 81 | + * Returns Node Id. |
82 | - * | 82 | + * |
83 | - * @return node ID | 83 | + * @return node ID |
84 | - */ | 84 | + */ |
85 | - public int getNodeID() { | 85 | + public int getNodeID() { |
86 | - return nodeID; | 86 | + return nodeID; |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - /** | 89 | + /** |
90 | - * Returns Interface Id. | 90 | + * Returns Interface Id. |
91 | - * | 91 | + * |
92 | - * @return interface ID | 92 | + * @return interface ID |
93 | - */ | 93 | + */ |
94 | - public int getInterfaceID() { | 94 | + public int getInterfaceID() { |
95 | - return interfaceID; | 95 | + return interfaceID; |
96 | - } | 96 | + } |
97 | - | 97 | + |
98 | - @Override | 98 | + @Override |
99 | - public PcepVersion getVersion() { | 99 | + public PcepVersion getVersion() { |
100 | - return PcepVersion.PCEP_1; | 100 | + return PcepVersion.PCEP_1; |
101 | - } | 101 | + } |
102 | - | 102 | + |
103 | - @Override | 103 | + @Override |
104 | - public short getType() { | 104 | + public short getType() { |
105 | - return TYPE; | 105 | + return TYPE; |
106 | - } | 106 | + } |
107 | - | 107 | + |
108 | - @Override | 108 | + @Override |
109 | - public short getLength() { | 109 | + public short getLength() { |
110 | - return LENGTH; | 110 | + return LENGTH; |
111 | - } | 111 | + } |
112 | - | 112 | + |
113 | - @Override | 113 | + @Override |
114 | - public int hashCode() { | 114 | + public int hashCode() { |
115 | - return Objects.hash(nodeID, interfaceID); | 115 | + return Objects.hash(nodeID, interfaceID); |
116 | - } | 116 | + } |
117 | - | 117 | + |
118 | - @Override | 118 | + @Override |
119 | - public boolean equals(Object obj) { | 119 | + public boolean equals(Object obj) { |
120 | - if (this == obj) { | 120 | + if (this == obj) { |
121 | - return true; | 121 | + return true; |
122 | - } | 122 | + } |
123 | - if (obj instanceof NexthopUnnumberedIPv4IDTlv) { | 123 | + if (obj instanceof NexthopUnnumberedIPv4IDTlv) { |
124 | - NexthopUnnumberedIPv4IDTlv other = (NexthopUnnumberedIPv4IDTlv) obj; | 124 | + NexthopUnnumberedIPv4IDTlv other = (NexthopUnnumberedIPv4IDTlv) obj; |
125 | - return Objects.equals(this.nodeID, other.nodeID) && Objects.equals(this.interfaceID, other.interfaceID); | 125 | + return Objects.equals(this.nodeID, other.nodeID) && Objects.equals(this.interfaceID, other.interfaceID); |
126 | - } | 126 | + } |
127 | - return false; | 127 | + return false; |
128 | - } | 128 | + } |
129 | - | 129 | + |
130 | - @Override | 130 | + @Override |
131 | - public int write(ChannelBuffer c) { | 131 | + public int write(ChannelBuffer c) { |
132 | - int iLenStartIndex = c.writerIndex(); | 132 | + int iLenStartIndex = c.writerIndex(); |
133 | - c.writeShort(TYPE); | 133 | + c.writeShort(TYPE); |
134 | - c.writeShort(LENGTH); | 134 | + c.writeShort(LENGTH); |
135 | - | 135 | + |
136 | - c.writeInt(nodeID); | 136 | + c.writeInt(nodeID); |
137 | - c.writeInt(interfaceID); | 137 | + c.writeInt(interfaceID); |
138 | - | 138 | + |
139 | - return c.writerIndex() - iLenStartIndex; | 139 | + return c.writerIndex() - iLenStartIndex; |
140 | - } | 140 | + } |
141 | - | 141 | + |
142 | - /** | 142 | + /** |
143 | - * Reads the channel buffer and returns object of NexthopUnnumberedIPv4IDTlv. | 143 | + * Reads the channel buffer and returns object of NexthopUnnumberedIPv4IDTlv. |
144 | - * | 144 | + * |
145 | - * @param cb type of channel buffer | 145 | + * @param cb type of channel buffer |
146 | - * @return object of NexthopUnnumberedIPv4IDTlv | 146 | + * @return object of NexthopUnnumberedIPv4IDTlv |
147 | - */ | 147 | + */ |
148 | - public static NexthopUnnumberedIPv4IDTlv read(ChannelBuffer cb) { | 148 | + public static NexthopUnnumberedIPv4IDTlv read(ChannelBuffer cb) { |
149 | - int nodeID = cb.readInt(); | 149 | + int nodeID = cb.readInt(); |
150 | - int interfaceID = cb.readInt(); | 150 | + int interfaceID = cb.readInt(); |
151 | - return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID); | 151 | + return new NexthopUnnumberedIPv4IDTlv(nodeID, interfaceID); |
152 | - } | 152 | + } |
153 | - | 153 | + |
154 | - @Override | 154 | + @Override |
155 | - public String toString() { | 155 | + public String toString() { |
156 | - return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("NodeId", nodeID) | 156 | + return MoreObjects.toStringHelper(getClass()).add("Type", TYPE).add("Length", LENGTH).add("NodeId", nodeID) |
157 | - .add("InterfaceId", interfaceID).toString(); | 157 | + .add("InterfaceId", interfaceID).toString(); |
158 | - } | 158 | + } |
159 | -} | 159 | +} | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment