Shashikanth VH
Committed by Gerrit Code Review

[ONOS-4240, ONOS-4241] Support wide community optional path attribute

Change-Id: I59f9c4b69e8c26702ab955d58655497a394b9ec9
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.bgpio.types;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +import org.onosproject.bgpio.exceptions.BgpParseException;
21 +import org.onosproject.bgpio.util.Validation;
22 +import org.jboss.netty.buffer.ChannelBuffer;
23 +
24 +import java.util.Objects;
25 +
26 +/**
27 + * Provides implementation of BGP wide community attribute header.
28 + */
29 +public class WideCommunityAttrHeader implements BgpValueType {
30 +
31 + /* 0 1 2 3
32 + 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
33 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 + | Type | Flags | Hop Count |
35 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 + | Length |
37 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
38 +
39 + /*FLAG
40 + +------+-------+----------------------------------------------------+
41 + | Bit | Value | Meaning |
42 + +------+-------+----------------------------------------------------+
43 + | 0 | 0 | Local community value. |
44 + | | 1 | Registered community value. |
45 + | 1 | 0 | Do not decrement Hop Count field across |
46 + | | | confederation boundaries. |
47 + | | 1 | Decrement Hop Count field across confederation |
48 + | | | boundaries. |
49 + | 2..7 | - | MUST be zero when sent and ignored upon receipt. |
50 + +------+-------+----------------------------------------------------+*/
51 +
52 + public static final short TYPE = 1;
53 + public static final short HEADER_LENGTH = 6;
54 + private byte flag;
55 + private byte hopCount;
56 + private short length;
57 +
58 + /**
59 + * Wide community attribute header.
60 + *
61 + * @param flag to apply to all wide community container types
62 + * @param hopCount represents the forwarding radius, in units of AS hops, for the given Wide BGP Community
63 + * @param length field represents the total length of a given container
64 + */
65 + public WideCommunityAttrHeader(byte flag, byte hopCount, short length) {
66 + this.flag = flag;
67 + this.hopCount = hopCount;
68 + this.length = length;
69 + }
70 +
71 + /**
72 + * Returns object of this class with specified values.
73 + *
74 + * @param flag flag to apply to all wide community container types
75 + * @param hopCount represents the forwarding radius, in units of AS hops, for the given Wide BGP Community
76 + * @param length field represents the total length of a given container
77 + * @return wide community attribute header
78 + */
79 + public static WideCommunityAttrHeader of(byte flag, byte hopCount, short length) {
80 + return new WideCommunityAttrHeader(flag, hopCount, length);
81 + }
82 +
83 + /**
84 + * Returns wide community flag.
85 + *
86 + * @return wide community flag
87 + */
88 + public byte flag() {
89 + return flag;
90 + }
91 +
92 + /**
93 + * Sets wide community flag.
94 + *
95 + * @param flag to apply to all wide community container types
96 + */
97 + public void setFlag(byte flag) {
98 + this.flag = flag;
99 + }
100 +
101 + /**
102 + * Returns hop count for wide community attribute.
103 + *
104 + * @return hop count from wide community
105 + */
106 + public byte hopCount() {
107 + return hopCount;
108 + }
109 +
110 + /**
111 + * Sets wide community hop count.
112 + *
113 + * @param hopCount represents the forwarding radius, in units of AS hops, for the given Wide BGP Community
114 + */
115 + public void setHopCount(byte hopCount) {
116 + this.hopCount = hopCount;
117 + }
118 +
119 + /**
120 + * Returns length of wide community attribute.
121 + *
122 + * @return length of wide community attribute
123 + */
124 + public short length() {
125 + return length;
126 + }
127 +
128 + /**
129 + * Sets wide community length.
130 + *
131 + * @param length total length of a given container
132 + */
133 + public void setLength(short length) {
134 + this.length = length;
135 + }
136 +
137 + @Override
138 + public int hashCode() {
139 + return Objects.hash(flag, hopCount, length);
140 + }
141 +
142 + @Override
143 + public boolean equals(Object obj) {
144 + if (this == obj) {
145 + return true;
146 + }
147 +
148 + if (obj == null) {
149 + return false;
150 + }
151 +
152 + if (obj instanceof WideCommunityAttrHeader) {
153 + WideCommunityAttrHeader other = (WideCommunityAttrHeader) obj;
154 + return Objects.equals(flag, other.flag) && Objects.equals(hopCount, other.hopCount)
155 + && Objects.equals(length, other.length);
156 + }
157 + return false;
158 + }
159 +
160 + @Override
161 + public int write(ChannelBuffer c) {
162 + int iLenStartIndex = c.writerIndex();
163 + c.writeShort(TYPE);
164 + c.writeByte(flag);
165 + c.writeByte(hopCount);
166 + c.writeShort(length);
167 + return c.writerIndex() - iLenStartIndex;
168 + }
169 +
170 + /**
171 + * Reads the channel buffer and returns object of WideCommunityAttrHeader.
172 + *
173 + * @param c ChannelBuffer
174 + * @return object of WideCommunityAttrHeader
175 + */
176 + public static WideCommunityAttrHeader read(ChannelBuffer c) throws BgpParseException {
177 +
178 + if (c.readableBytes() < HEADER_LENGTH) {
179 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
180 + BgpErrorType.ATTRIBUTE_LENGTH_ERROR, c.readableBytes());
181 + }
182 +
183 + short type = c.readShort();
184 + byte flag = c.readByte();
185 + byte hopCount = c.readByte();
186 + short length = c.readShort();
187 + return WideCommunityAttrHeader.of(flag, hopCount, length);
188 + }
189 +
190 + @Override
191 + public short getType() {
192 + return TYPE;
193 + }
194 +
195 + @Override
196 + public String toString() {
197 + return MoreObjects.toStringHelper(getClass())
198 + .add("Type", TYPE)
199 + .add("flag", flag)
200 + .add("hopCount", hopCount)
201 + .add("length", length)
202 + .toString();
203 + }
204 +
205 + @Override
206 + public int compareTo(Object o) {
207 + // TODO Auto-generated method stub
208 + return 0;
209 + }
210 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.bgpio.types;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +import org.jboss.netty.buffer.ChannelBuffer;
21 +import org.onosproject.bgpio.exceptions.BgpParseException;
22 +import org.onosproject.bgpio.types.attr.WideCommunity;
23 +
24 +import java.util.List;
25 +import java.util.Objects;
26 +
27 +/**
28 + * Provides implementation of BGP wide community exclude target.
29 + */
30 +public class WideCommunityExcludeTarget implements BgpValueType {
31 +
32 + public static final byte TYPE = 2;
33 + private List<BgpValueType> excludeTargetTlv;
34 +
35 + /**
36 + * Wide community targets.
37 + *
38 + * @param excludeTargetTlv wide community exclude target
39 + */
40 + public WideCommunityExcludeTarget(List<BgpValueType> excludeTargetTlv) {
41 + this.excludeTargetTlv = excludeTargetTlv;
42 + }
43 +
44 + /**
45 + * Returns object of this class with specified values.
46 + *
47 + * @param excludeTargetTlv exclude target
48 + * @return object of WideCommunityExcludeTarget
49 + */
50 + public static BgpValueType of(List<BgpValueType> excludeTargetTlv) {
51 + return new WideCommunityExcludeTarget(excludeTargetTlv);
52 + }
53 +
54 + /**
55 + * Returns wide community targets.
56 + *
57 + * @return wide community targets
58 + */
59 + public List<BgpValueType> excludeTargetTlv() {
60 + return excludeTargetTlv;
61 + }
62 +
63 + /**
64 + * Sets wide community target.
65 + *
66 + * @param excludeTargetTlv wide community exclude targets
67 + */
68 + public void setExcludeTargetTlv(List<BgpValueType> excludeTargetTlv) {
69 + this.excludeTargetTlv = excludeTargetTlv;
70 + }
71 +
72 +
73 + @Override
74 + public int hashCode() {
75 + return Objects.hash(excludeTargetTlv);
76 + }
77 +
78 + @Override
79 + public boolean equals(Object obj) {
80 + if (this == obj) {
81 + return true;
82 + }
83 +
84 + if (obj == null) {
85 + return false;
86 + }
87 +
88 + if (obj instanceof WideCommunityExcludeTarget) {
89 + WideCommunityExcludeTarget other = (WideCommunityExcludeTarget) obj;
90 + return Objects.equals(excludeTargetTlv, other.excludeTargetTlv);
91 + }
92 + return false;
93 + }
94 +
95 + @Override
96 + public int write(ChannelBuffer c) {
97 + int iLenStartIndex = c.writerIndex();
98 + WideCommunity.encodeWideCommunityTlv(c, excludeTargetTlv());
99 + return c.writerIndex() - iLenStartIndex;
100 + }
101 +
102 + /**
103 + * Reads the channel buffer and returns object of WideCommunityExcludeTarget.
104 + *
105 + * @param c ChannelBuffer
106 + * @return object of WideCommunityExcludeTarget
107 + * @throws BgpParseException on read error
108 + */
109 + public static WideCommunityExcludeTarget read(ChannelBuffer c) throws BgpParseException {
110 + return new WideCommunityExcludeTarget(WideCommunity.decodeWideCommunityTlv(c));
111 + }
112 +
113 + @Override
114 + public short getType() {
115 + return TYPE;
116 + }
117 +
118 + @Override
119 + public String toString() {
120 + return MoreObjects.toStringHelper(getClass())
121 + .omitNullValues()
122 + .add("Type", TYPE)
123 + .add("targetTlv", excludeTargetTlv)
124 + .toString();
125 + }
126 +
127 + @Override
128 + public int compareTo(Object o) {
129 + // TODO Auto-generated method stub
130 + return 0;
131 + }
132 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.bgpio.types;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +import org.jboss.netty.buffer.ChannelBuffer;
21 +import org.onosproject.bgpio.exceptions.BgpParseException;
22 +import org.onosproject.bgpio.util.Validation;
23 +
24 +import java.util.ArrayList;
25 +import java.util.Iterator;
26 +import java.util.List;
27 +import java.util.Objects;
28 +
29 +/**
30 + * Provides implementation of BGP wide community integer subtlv.
31 + */
32 +public class WideCommunityInteger implements BgpValueType {
33 + public static final short TYPE = 4;
34 + private List<Integer> integer;
35 +
36 + /**
37 + * Creates an instance of wide community integer subtlv.
38 + *
39 + * @param integer integer
40 + */
41 + public WideCommunityInteger(List<Integer> integer) {
42 + this.integer = integer;
43 + }
44 +
45 + /**
46 + * Returns object of this class with specified values.
47 + *
48 + * @param integer wide community subtlv integer
49 + * @return object of WideCommunityInteger
50 + */
51 + public static WideCommunityInteger of(List<Integer> integer) {
52 + return new WideCommunityInteger(integer);
53 + }
54 +
55 + /**
56 + * Returns wide community subtlv integer.
57 + *
58 + * @return wide community subtlv integer
59 + */
60 + public List<Integer> integer() {
61 + return integer;
62 + }
63 +
64 + /**
65 + * Sets wide community subtlv integer.
66 + *
67 + * @param integer wide community subtlv integer
68 + */
69 + public void setInteger(List<Integer> integer) {
70 + this.integer = integer;
71 + }
72 +
73 + @Override
74 + public int hashCode() {
75 + return Objects.hash(integer);
76 + }
77 +
78 + @Override
79 + public boolean equals(Object obj) {
80 + if (this == obj) {
81 + return true;
82 + }
83 +
84 + if (obj == null) {
85 + return false;
86 + }
87 +
88 + if (obj instanceof WideCommunityInteger) {
89 + WideCommunityInteger other = (WideCommunityInteger) obj;
90 + return Objects.equals(integer, other.integer);
91 + }
92 + return false;
93 + }
94 +
95 + @Override
96 + public int write(ChannelBuffer c) {
97 + int iLenStartIndex = c.writerIndex();
98 +
99 + Iterator<Integer> listIterator = integer.iterator();
100 + c.writeByte(TYPE);
101 +
102 + int iLengthIndex = c.writerIndex();
103 + c.writeShort(0);
104 +
105 + while (listIterator.hasNext()) {
106 + Integer integer = listIterator.next();
107 + if (integer instanceof Integer) {
108 + c.writeInt(integer);
109 + }
110 + }
111 +
112 + int length = c.writerIndex() - iLengthIndex;
113 + c.setShort(iLengthIndex, (short) (length - 2));
114 +
115 + return c.writerIndex() - iLenStartIndex;
116 + }
117 +
118 + /**
119 + * Reads the channel buffer and returns object of WideCommunityInteger.
120 + *
121 + * @param c ChannelBuffer
122 + * @return object of WideCommunityInteger
123 + * @throws BgpParseException on read error
124 + */
125 + public static WideCommunityInteger read(ChannelBuffer c) throws BgpParseException {
126 +
127 + List<Integer> integer = new ArrayList<>();
128 + short length;
129 +
130 + if (c.readableBytes() < 2) {
131 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
132 + c.readableBytes());
133 + }
134 +
135 + length = c.readShort();
136 + if (length == 0) {
137 + return new WideCommunityInteger(integer);
138 + }
139 +
140 + if (c.readableBytes() < length) {
141 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
142 + c.readableBytes());
143 + }
144 +
145 + while (c.readableBytes() > 0) {
146 + if (c.readableBytes() < 4) {
147 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
148 + c.readableBytes());
149 + }
150 + integer.add(c.readInt());
151 + }
152 +
153 + return new WideCommunityInteger(integer);
154 + }
155 +
156 + @Override
157 + public String toString() {
158 + return MoreObjects.toStringHelper(getClass())
159 + .omitNullValues()
160 + .add("integer", integer)
161 + .toString();
162 + }
163 +
164 + @Override
165 + public int compareTo(Object o) {
166 + // TODO Auto-generated method stub
167 + return 0;
168 + }
169 +
170 + @Override
171 + public short getType() {
172 + // TODO Auto-generated method stub
173 + return 0;
174 + }
175 +}
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.bgpio.types;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +import org.jboss.netty.buffer.ChannelBuffer;
21 +import org.onlab.packet.IpAddress;
22 +import org.onosproject.bgpio.exceptions.BgpParseException;
23 +import org.onosproject.bgpio.util.Validation;
24 +import java.util.ArrayList;
25 +import java.util.Iterator;
26 +import java.util.List;
27 +import java.util.Objects;
28 +
29 +/**
30 + * Provides implementation of BGP wide community IPV4 neighbour subtlv.
31 + */
32 +public class WideCommunityIpV4Neighbour implements BgpValueType {
33 + public static final byte TYPE = 8;
34 + private List<IpV4Neighbour> ipv4Neighbour;
35 + public static final byte IPV4_NEIGHBOUR_SIZE = 8;
36 +
37 + /**
38 + * Creates an instance of wide community ipv4 neighbour subtlv.
39 + *
40 + */
41 + public WideCommunityIpV4Neighbour() {
42 + this.ipv4Neighbour = new ArrayList<>();
43 + }
44 +
45 + /**
46 + * Adds local and remote speakers.
47 + *
48 + * @param localSpeaker local speaker
49 + * @param remoteSpeaker remote speaker
50 + */
51 + public void add(IpAddress localSpeaker, IpAddress remoteSpeaker) {
52 + ipv4Neighbour.add(new IpV4Neighbour(localSpeaker, remoteSpeaker));
53 + }
54 +
55 + /**
56 + * Deletes local and remote speakers.
57 + *
58 + * @param localSpeaker local speaker
59 + * @param remoteSpeaker remote speaker
60 + */
61 + public void remove(IpAddress localSpeaker, IpAddress remoteSpeaker) {
62 + ipv4Neighbour.remove(new IpV4Neighbour(localSpeaker, remoteSpeaker));
63 + }
64 +
65 + @Override
66 + public int hashCode() {
67 + return Objects.hash(ipv4Neighbour);
68 + }
69 +
70 + @Override
71 + public boolean equals(Object obj) {
72 + if (this == obj) {
73 + return true;
74 + }
75 +
76 + if (obj == null) {
77 + return false;
78 + }
79 +
80 + if (obj instanceof WideCommunityIpV4Neighbour) {
81 + WideCommunityIpV4Neighbour other = (WideCommunityIpV4Neighbour) obj;
82 + return Objects.equals(ipv4Neighbour, other.ipv4Neighbour);
83 + }
84 + return false;
85 + }
86 +
87 + @Override
88 + public int write(ChannelBuffer c) {
89 + int iLenStartIndex = c.writerIndex();
90 +
91 + Iterator<IpV4Neighbour> listIterator = ipv4Neighbour.iterator();
92 + c.writeByte(TYPE);
93 +
94 + int iLengthIndex = c.writerIndex();
95 + c.writeShort(0);
96 +
97 + while (listIterator.hasNext()) {
98 + IpV4Neighbour speaker = listIterator.next();
99 + if (speaker instanceof IpV4Neighbour) {
100 + c.writeInt(Integer.valueOf(speaker.localSpeaker.toString()));
101 + c.writeInt(Integer.valueOf(speaker.remoteSpeaker.toString()));
102 + }
103 + }
104 +
105 + int length = c.writerIndex() - iLengthIndex;
106 + c.setShort(iLengthIndex, (short) (length - 2));
107 +
108 + return c.writerIndex() - iLenStartIndex;
109 + }
110 +
111 + /**
112 + * Reads the channel buffer and returns object of WideCommunityIpV4Neighbour.
113 + *
114 + * @param c ChannelBuffer
115 + * @return object of WideCommunityIpV4Neighbour
116 + * @throws BgpParseException on read error
117 + */
118 + public static WideCommunityIpV4Neighbour read(ChannelBuffer c) throws BgpParseException {
119 + WideCommunityIpV4Neighbour wideCommNeighbour = new WideCommunityIpV4Neighbour();
120 + short length;
121 +
122 + if (c.readableBytes() == 0) {
123 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
124 + c.readableBytes());
125 + }
126 +
127 + length = c.readShort();
128 + if (c.readableBytes() == 0) {
129 + return wideCommNeighbour;
130 + }
131 +
132 + if (c.readableBytes() < length) {
133 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
134 + c.readableBytes());
135 + }
136 +
137 + while (c.readableBytes() > 0) {
138 + if (c.readableBytes() < IPV4_NEIGHBOUR_SIZE) {
139 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
140 + c.readableBytes());
141 + }
142 +
143 + IpAddress localSpeaker = IpAddress.valueOf(c.readInt());
144 + IpAddress remoteSpeaker = IpAddress.valueOf(c.readInt());
145 +
146 + wideCommNeighbour.add(localSpeaker, remoteSpeaker);
147 +
148 + }
149 +
150 + return wideCommNeighbour;
151 + }
152 +
153 + @Override
154 + public String toString() {
155 + return MoreObjects.toStringHelper(getClass())
156 + .add("ipv4Neighbour", ipv4Neighbour)
157 + .toString();
158 + }
159 +
160 + @Override
161 + public int compareTo(Object o) {
162 + // TODO Auto-generated method stub
163 + return 0;
164 + }
165 +
166 + @Override
167 + public short getType() {
168 + // TODO Auto-generated method stub
169 + return 0;
170 + }
171 +
172 + /*
173 + * IpV4Neighbour class contain remote and local speaker.
174 + */
175 + private class IpV4Neighbour {
176 + private IpAddress localSpeaker;
177 + private IpAddress remoteSpeaker;
178 +
179 + /**
180 + * Creates an instance of ipv4 neighbour.
181 + *
182 + * @param localSpeaker ip address of local speaker
183 + * @param remoteSpeaker ip address of remote speaker
184 + */
185 + public IpV4Neighbour(IpAddress localSpeaker, IpAddress remoteSpeaker) {
186 + this.localSpeaker = localSpeaker;
187 + this.remoteSpeaker = remoteSpeaker;
188 + }
189 +
190 + /**
191 + * Returns IPV4 neighbour local speaker.
192 + *
193 + * @return IPV4 neighbour local speaker
194 + */
195 + public IpAddress localSpeaker() {
196 + return localSpeaker;
197 + }
198 +
199 + /**
200 + * Returns IPV4 neighbour remote speaker.
201 + *
202 + * @return IPV4 neighbour remote speaker
203 + */
204 + public IpAddress remoteSpeaker() {
205 + return remoteSpeaker;
206 + }
207 + }
208 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.bgpio.types;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +import org.jboss.netty.buffer.ChannelBuffer;
21 +import org.onosproject.bgpio.exceptions.BgpParseException;
22 +import org.onosproject.bgpio.types.attr.WideCommunity;
23 +
24 +import java.util.List;
25 +import java.util.Objects;
26 +
27 +/**
28 + * Provides implementation of BGP wide community parameter.
29 + */
30 +public class WideCommunityParameter implements BgpValueType {
31 +
32 + public static final byte TYPE = 3;
33 + private List<BgpValueType> parameterTlv;
34 +
35 + /**
36 + * Creates an instance of wide community parameter.
37 + *
38 + * @param parameterTlv wide community parameter
39 + */
40 + public WideCommunityParameter(List<BgpValueType> parameterTlv) {
41 + this.parameterTlv = parameterTlv;
42 + }
43 +
44 + /**
45 + * Returns object of this class with specified values.
46 + *
47 + * @param parameterTlv wide community parameter
48 + * @return object of WideCommunityParameter
49 + */
50 + public static WideCommunityParameter of(List<BgpValueType> parameterTlv) {
51 + return new WideCommunityParameter(parameterTlv);
52 + }
53 +
54 + /**
55 + * Returns wide community parameter.
56 + *
57 + * @return wide community parameter
58 + */
59 + public List<BgpValueType> parameterTlv() {
60 + return parameterTlv;
61 + }
62 +
63 + /**
64 + * Sets wide community parameter.
65 + *
66 + * @param parameterTlv wide community parameter
67 + */
68 + public void setParameterTlv(List<BgpValueType> parameterTlv) {
69 + this.parameterTlv = parameterTlv;
70 + }
71 +
72 + @Override
73 + public int hashCode() {
74 + return Objects.hash(parameterTlv);
75 + }
76 +
77 + @Override
78 + public boolean equals(Object obj) {
79 + if (this == obj) {
80 + return true;
81 + }
82 +
83 + if (obj == null) {
84 + return false;
85 + }
86 +
87 + if (obj instanceof WideCommunityParameter) {
88 + WideCommunityParameter other = (WideCommunityParameter) obj;
89 + return Objects.equals(parameterTlv, other.parameterTlv);
90 + }
91 + return false;
92 + }
93 +
94 + @Override
95 + public int write(ChannelBuffer c) {
96 + int iLenStartIndex = c.writerIndex();
97 + WideCommunity.encodeWideCommunityTlv(c, parameterTlv());
98 + return c.writerIndex() - iLenStartIndex;
99 + }
100 +
101 + /**
102 + * Reads the channel buffer and returns object of WideCommunityParameter.
103 + *
104 + * @param c ChannelBuffer
105 + * @return object of WideCommunityParameter
106 + * @throws BgpParseException on read error
107 + */
108 + public static WideCommunityParameter read(ChannelBuffer c) throws BgpParseException {
109 + return new WideCommunityParameter(WideCommunity.decodeWideCommunityTlv(c));
110 + }
111 +
112 + @Override
113 + public short getType() {
114 + return TYPE;
115 + }
116 +
117 + @Override
118 + public String toString() {
119 + return MoreObjects.toStringHelper(getClass())
120 + .omitNullValues()
121 + .add("Type", TYPE)
122 + .add("parameterTlv", parameterTlv)
123 + .toString();
124 + }
125 +
126 + @Override
127 + public int compareTo(Object o) {
128 + // TODO Auto-generated method stub
129 + return 0;
130 + }
131 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.bgpio.types;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +import org.jboss.netty.buffer.ChannelBuffer;
21 +import org.onosproject.bgpio.exceptions.BgpParseException;
22 +import org.onosproject.bgpio.types.attr.WideCommunity;
23 +
24 +import java.util.List;
25 +import java.util.Objects;
26 +
27 +/**
28 + * Provides implementation of BGP wide community target.
29 + */
30 +public class WideCommunityTarget implements BgpValueType {
31 +
32 + public static final byte TYPE = 1;
33 + private List<BgpValueType> targetTlv;
34 +
35 + /**
36 + * Creates an instance of Wide community targets.
37 + *
38 + * @param targetTlv wide community targets to match
39 + */
40 + public WideCommunityTarget(List<BgpValueType> targetTlv) {
41 + this.targetTlv = targetTlv;
42 + }
43 +
44 + /**
45 + * Returns object of this class with specified values.
46 + *
47 + * @param targetTlv wide community target
48 + * @return object of WideCommunityTarget
49 + */
50 + public static WideCommunityTarget of(List<BgpValueType> targetTlv) {
51 + return new WideCommunityTarget(targetTlv);
52 + }
53 +
54 + /**
55 + * Returns wide community targets.
56 + *
57 + * @return wide community targets
58 + */
59 + public List<BgpValueType> targetTlv() {
60 + return targetTlv;
61 + }
62 +
63 + /**
64 + * Sets wide community target.
65 + *
66 + * @param targetTlv wide community targets to match
67 + */
68 + public void setTargetTlv(List<BgpValueType> targetTlv) {
69 + this.targetTlv = targetTlv;
70 + }
71 +
72 + @Override
73 + public int hashCode() {
74 + return Objects.hash(targetTlv);
75 + }
76 +
77 + @Override
78 + public boolean equals(Object obj) {
79 + if (this == obj) {
80 + return true;
81 + }
82 +
83 + if (obj == null) {
84 + return false;
85 + }
86 +
87 + if (obj instanceof WideCommunityTarget) {
88 + WideCommunityTarget other = (WideCommunityTarget) obj;
89 + return Objects.equals(targetTlv, other.targetTlv);
90 + }
91 + return false;
92 + }
93 +
94 + @Override
95 + public int write(ChannelBuffer c) {
96 + int iLenStartIndex = c.writerIndex();
97 + WideCommunity.encodeWideCommunityTlv(c, targetTlv());
98 + return c.writerIndex() - iLenStartIndex;
99 + }
100 +
101 + /**
102 + * Reads the channel buffer and returns object of WideCommunityTarget.
103 + *
104 + * @param c ChannelBuffer
105 + * @return object of WideCommunityTarget
106 + * @throws BgpParseException on read error
107 + */
108 + public static WideCommunityTarget read(ChannelBuffer c) throws BgpParseException {
109 + return new WideCommunityTarget(WideCommunity.decodeWideCommunityTlv(c));
110 + }
111 +
112 + @Override
113 + public short getType() {
114 + return TYPE;
115 + }
116 +
117 + @Override
118 + public String toString() {
119 + return MoreObjects.toStringHelper(getClass())
120 + .add("Type", TYPE)
121 + .add("targetTlv", targetTlv)
122 + .toString();
123 + }
124 +
125 + @Override
126 + public int compareTo(Object o) {
127 + // TODO Auto-generated method stub
128 + return 0;
129 + }
130 +}
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.bgpio.types.attr;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +import org.jboss.netty.buffer.ChannelBuffer;
21 +import org.onlab.packet.IpAddress;
22 +import org.onosproject.bgpio.exceptions.BgpParseException;
23 +import org.onosproject.bgpio.types.BgpErrorType;
24 +import org.onosproject.bgpio.types.BgpValueType;
25 +import org.onosproject.bgpio.types.WideCommunityAttrHeader;
26 +import org.onosproject.bgpio.types.WideCommunityExcludeTarget;
27 +import org.onosproject.bgpio.types.WideCommunityInteger;
28 +import org.onosproject.bgpio.types.WideCommunityIpV4Neighbour;
29 +import org.onosproject.bgpio.types.WideCommunityParameter;
30 +import org.onosproject.bgpio.types.WideCommunityTarget;
31 +import org.onosproject.bgpio.util.Validation;
32 +import org.slf4j.Logger;
33 +import org.slf4j.LoggerFactory;
34 +
35 +import java.util.ArrayList;
36 +import java.util.Iterator;
37 +import java.util.List;
38 +import java.util.Objects;
39 +
40 +/**
41 + * Provides implementation of wide community path attribute.
42 + */
43 +public class WideCommunity implements BgpValueType {
44 +
45 + private static final Logger log = LoggerFactory.getLogger(WideCommunity.class);
46 + public static final byte TYPE = (byte) 254; /* TODO: IANA Assigned */
47 + public static final short LENGTH = 4;
48 + public static final byte TYPE_LENGTH_SIZE = 3;
49 + public static final byte FLAGS = (byte) 0x40;
50 + private WideCommunityAttrHeader wideCommunityHeader;
51 + private int community;
52 + private int localAsn;
53 + private int contextAsn;
54 + private WideCommunityTarget target;
55 + private WideCommunityExcludeTarget excludeTarget;
56 + private WideCommunityParameter parameter;
57 +
58 + /**
59 + * Creates an instance of wide community.
60 + *
61 + * @param wideCommunityHeader wide community header
62 + * @param community wide community
63 + * @param localAsn local ASN number
64 + * @param contextAsn context ASN number
65 + * @param target wide community include target
66 + * @param excludeTarget wide community exclude target
67 + * @param parameter wide community parameter
68 + */
69 + public WideCommunity(WideCommunityAttrHeader wideCommunityHeader, int community, int localAsn, int contextAsn,
70 + WideCommunityTarget target, WideCommunityExcludeTarget excludeTarget,
71 + WideCommunityParameter parameter) {
72 + this.wideCommunityHeader = wideCommunityHeader;
73 + this.community = community;
74 + this.localAsn = localAsn;
75 + this.contextAsn = contextAsn;
76 + this.target = target;
77 + this.excludeTarget = excludeTarget;
78 + this.parameter = parameter;
79 + }
80 +
81 + /**
82 + * Returns object of this class with specified values.
83 + *
84 + * @param community wide community
85 + * @param localAsn local ASN number
86 + * @param contextAsn context ASN number
87 + * @param target wide community include target
88 + * @param excludeTarget wide community exclude target
89 + * @param parameter wide community parameter
90 + * @return object of WideCommunityAttr
91 + */
92 + public static WideCommunity of(WideCommunityAttrHeader wideCommunityHeader, int community, int localAsn,
93 + int contextAsn, WideCommunityTarget target,
94 + WideCommunityExcludeTarget excludeTarget, WideCommunityParameter parameter) {
95 + return new WideCommunity(wideCommunityHeader, community, localAsn, contextAsn, target, excludeTarget,
96 + parameter);
97 + }
98 +
99 + /**
100 + * Returns wide community value.
101 + *
102 + * @return wide community value
103 + */
104 + public int community() {
105 + return community;
106 + }
107 +
108 + /**
109 + * Sets wide community value.
110 + *
111 + * @param community wide community value
112 + */
113 + public void setCommunity(int community) {
114 + this.community = community;
115 + }
116 +
117 + /**
118 + * Returns wide community local autonomous number.
119 + *
120 + * @return local autonomous number
121 + */
122 + public int localAsn() {
123 + return localAsn;
124 + }
125 +
126 + /**
127 + * Sets wide community local autonomous number.
128 + *
129 + * @param localAsn local autonomous number
130 + */
131 + public void setLocalAsn(int localAsn) {
132 + this.localAsn = localAsn;
133 + }
134 +
135 + /**
136 + * Returns wide community context autonomous number.
137 + *
138 + * @return contest autonomous number
139 + */
140 + public int contextAsn() {
141 + return contextAsn;
142 + }
143 +
144 + /**
145 + * Sets wide community context autonomous number.
146 + *
147 + * @param contextAsn context autonomous number
148 + */
149 + public void setContextAsn(int contextAsn) {
150 + this.contextAsn = contextAsn;
151 + }
152 +
153 + /**
154 + * Returns wide community target.
155 + *
156 + * @return wide community target
157 + */
158 + public WideCommunityTarget target() {
159 + return target;
160 + }
161 +
162 + /**
163 + * Sets wide community target.
164 + *
165 + * @param target wide community target
166 + */
167 + public void setTarget(WideCommunityTarget target) {
168 + this.target = target;
169 + }
170 +
171 + /**
172 + * Returns wide community exclude target.
173 + *
174 + * @return wide community exclude target
175 + */
176 + public WideCommunityExcludeTarget excludeTarget() {
177 + return excludeTarget;
178 + }
179 +
180 + /**
181 + * Sets wide community exclude target.
182 + *
183 + * @param excludeTarget wide community texclude arget
184 + */
185 + public void setExcludeTarget(WideCommunityExcludeTarget excludeTarget) {
186 + this.excludeTarget = excludeTarget;
187 + }
188 +
189 + /**
190 + * Returns wide community parameter.
191 + *
192 + * @return wide community parameter
193 + */
194 + public WideCommunityParameter parameter() {
195 + return parameter;
196 + }
197 +
198 + /**
199 + * Sets wide community parameter.
200 + *
201 + * @param parameter wide community parameter
202 + */
203 + public void setParameter(WideCommunityParameter parameter) {
204 + this.parameter = parameter;
205 + }
206 +
207 + @Override
208 + public int hashCode() {
209 + return Objects.hash(wideCommunityHeader, community, localAsn, contextAsn, target, excludeTarget, parameter);
210 + }
211 +
212 + @Override
213 + public boolean equals(Object obj) {
214 + if (this == obj) {
215 + return true;
216 + }
217 +
218 + if (obj instanceof WideCommunity) {
219 + WideCommunity other = (WideCommunity) obj;
220 + return Objects.equals(wideCommunityHeader, other.wideCommunityHeader)
221 + && Objects.equals(community, other.community) && Objects.equals(localAsn, other.localAsn)
222 + && Objects.equals(contextAsn, other.contextAsn) && Objects.equals(target, other.target)
223 + && Objects.equals(excludeTarget, other.excludeTarget) && Objects.equals(parameter, other.parameter);
224 + }
225 + return false;
226 + }
227 +
228 + @Override
229 + public int write(ChannelBuffer c) {
230 + int iTargetLenIndex;
231 + int length;
232 + int iLenStartIndex = c.writerIndex();
233 + c.writeByte(FLAGS); // TODO: update flag value
234 + c.writeByte(TYPE);
235 +
236 + int iLengthIndex = c.writerIndex();
237 + c.writeShort(0);
238 +
239 + wideCommunityHeader.write(c);
240 +
241 + c.writeInt(community);
242 + c.writeInt(localAsn);
243 + c.writeInt(contextAsn);
244 +
245 + if (target() != null) {
246 + c.writeByte(WideCommunityTarget.TYPE);
247 + iTargetLenIndex = c.writerIndex();
248 + c.writeShort(0); // length
249 +
250 + target.write(c);
251 +
252 + length = c.writerIndex() - iTargetLenIndex;
253 + c.setShort(iTargetLenIndex, (short) (length - 2));
254 + }
255 +
256 + if (excludeTarget() != null) {
257 + c.writeByte(WideCommunityExcludeTarget.TYPE);
258 + iTargetLenIndex = c.writerIndex();
259 + c.writeShort(0); // length
260 +
261 + excludeTarget.write(c);
262 +
263 + length = c.writerIndex() - iTargetLenIndex;
264 + c.setShort(iTargetLenIndex, (short) (length - 2));
265 + }
266 +
267 + if (parameter() != null) {
268 + c.writeByte(WideCommunityParameter.TYPE);
269 + iTargetLenIndex = c.writerIndex();
270 + c.writeShort(0); // length
271 +
272 + parameter.write(c);
273 +
274 + length = c.writerIndex() - iTargetLenIndex;
275 + c.setShort(iTargetLenIndex, (short) (length - 2));
276 + }
277 +
278 + length = c.writerIndex() - iLengthIndex;
279 + c.setShort(iLengthIndex, (short) (length - 2));
280 +
281 + return c.writerIndex() - iLenStartIndex;
282 + }
283 +
284 + /**
285 + * Reads the wide community attribute.
286 + *
287 + * @param c ChannelBuffer
288 + * @return object of WideCommunityAttr
289 + * @throws BgpParseException while parsing BgpPrefixAttrRouteTag
290 + */
291 + public static WideCommunity read(ChannelBuffer c) throws BgpParseException {
292 +
293 + WideCommunityAttrHeader wideCommunityHeader;
294 + int community;
295 + int localAsn;
296 + int contextAsn;
297 + WideCommunityTarget target = null;
298 + WideCommunityExcludeTarget excludeTarget = null;
299 + WideCommunityParameter parameter = null;
300 +
301 + short length = c.readShort();
302 +
303 + if (c.readableBytes() < length) {
304 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR, length);
305 + }
306 +
307 + wideCommunityHeader = WideCommunityAttrHeader.read(c);
308 + if ((c.readableBytes() < 12) || (c.readableBytes() < wideCommunityHeader.length())) {
309 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR, length);
310 + }
311 +
312 + community = c.readInt();
313 + localAsn = c.readInt();
314 + contextAsn = c.readInt();
315 +
316 + while (c.readableBytes() > 0) {
317 +
318 + if (c.readableBytes() < TYPE_LENGTH_SIZE) {
319 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
320 + c.readableBytes());
321 + }
322 +
323 + byte type = c.readByte();
324 + length = c.readShort();
325 +
326 + if (c.readableBytes() < length) {
327 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
328 + c.readableBytes());
329 + }
330 +
331 + if (type == WideCommunityTarget.TYPE) {
332 + target = WideCommunityTarget.read(c);
333 + } else if (type == WideCommunityExcludeTarget.TYPE) {
334 + excludeTarget = WideCommunityExcludeTarget.read(c);
335 + } else if (type == WideCommunityParameter.TYPE) {
336 + parameter = WideCommunityParameter.read(c);
337 + }
338 + }
339 + return new WideCommunity(wideCommunityHeader, community, localAsn, contextAsn,
340 + target, excludeTarget, parameter);
341 + }
342 +
343 + /**
344 + * Encode wide community target(s).
345 + *
346 + * @param c channel buffer
347 + * @param targetTlv wide community include/exclude target
348 + */
349 + public static void encodeWideCommunityTlv(ChannelBuffer c,
350 + List<BgpValueType> targetTlv) {
351 +
352 + /*
353 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
354 + | IPV4Neig(8) | Length: 8 |
355 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
356 + | local 10101010 |
357 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
358 + | remote 10101010 |
359 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
360 + * */
361 + List<BgpValueType> target = targetTlv;
362 + if (target == null) {
363 + log.debug("target is null");
364 + return;
365 + }
366 + Iterator<BgpValueType> listIterator = targetTlv.iterator();
367 +
368 + while (listIterator.hasNext()) {
369 + BgpValueType attr = listIterator.next();
370 + if (attr instanceof WideCommunityIpV4Neighbour) {
371 + WideCommunityIpV4Neighbour ipv4Neig = (WideCommunityIpV4Neighbour) attr;
372 + ipv4Neig.write(c);
373 + } else if (attr instanceof WideCommunityInteger) {
374 + WideCommunityInteger integer = (WideCommunityInteger) attr;
375 + integer.write(c);
376 + }
377 + }
378 + return;
379 + }
380 +
381 + /**
382 + * Decode wide community target(s).
383 + *
384 + * @param c channel buffer
385 + * @return target list
386 + * @throws BgpParseException on decode error
387 + */
388 + public static List<BgpValueType> decodeWideCommunityTlv(ChannelBuffer c) throws BgpParseException {
389 + List<BgpValueType> targetTlv = new ArrayList<>();
390 +
391 + while (c.readableBytes() > 0) {
392 + if (c.readableBytes() < TYPE_LENGTH_SIZE) {
393 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
394 + c.readableBytes());
395 + }
396 +
397 + byte atomType = c.readByte();
398 + short atomLength = c.readShort();
399 +
400 + if (c.readableBytes() < atomLength) {
401 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
402 + atomLength);
403 + }
404 +
405 + if (atomType == WideCommunityIpV4Neighbour.TYPE) {
406 + ChannelBuffer tempBuf = c.readBytes(atomLength);
407 +
408 + WideCommunityIpV4Neighbour wideCommAtom = new WideCommunityIpV4Neighbour();
409 +
410 + while (tempBuf.readableBytes() > 0) {
411 + wideCommAtom.add(IpAddress.valueOf(tempBuf.readInt()),
412 + IpAddress.valueOf(tempBuf.readInt()));
413 + }
414 + targetTlv.add(wideCommAtom);
415 + } else if (atomType == WideCommunityInteger.TYPE) {
416 + ChannelBuffer tempBuf = c.readBytes(atomLength);
417 + List<Integer> integer = new ArrayList<>();
418 + while (tempBuf.readableBytes() > 0) {
419 + integer.add(tempBuf.readInt());
420 + }
421 + targetTlv.add(new WideCommunityInteger(integer));
422 + } else {
423 + Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.MALFORMED_ATTRIBUTE_LIST,
424 + atomLength);
425 + }
426 + }
427 + return targetTlv;
428 + }
429 +
430 + @Override
431 + public short getType() {
432 + return TYPE;
433 + }
434 +
435 + @Override
436 + public int compareTo(Object o) {
437 + // TODO:
438 + return 0;
439 + }
440 +
441 + @Override
442 + public String toString() {
443 + return MoreObjects.toStringHelper(getClass())
444 + .omitNullValues()
445 + .add("FLAGS", FLAGS)
446 + .add("wideCommunityHeader", wideCommunityHeader)
447 + .add("community", community)
448 + .add("localAsn", localAsn)
449 + .add("contextAsn", contextAsn)
450 + .add("target", target)
451 + .add("excludeTarget", excludeTarget)
452 + .add("parameter", parameter).toString();
453 + }
454 +}