Shashikanth VH
Committed by Gerrit Code Review

Modified bgp file name according to naming convention.

Change-Id: I403139b53fbc1a2dba894dfd39720707a52ba7cd
Showing 118 changed files with 809 additions and 809 deletions
......@@ -20,7 +20,7 @@ import java.util.TreeMap;
/**
* Abstraction of an BGP configuration. Manages the BGP configuration from CLI to the BGP controller.
*/
public interface BGPCfg {
public interface BgpCfg {
enum State {
/**
......@@ -233,7 +233,7 @@ public interface BGPCfg {
*
* @return return the tree map with IP as key and BGPPeerCfg as object
*/
TreeMap<String, BGPPeerCfg> displayPeers();
TreeMap<String, BgpPeerCfg> displayPeers();
/**
* Return the BGP Peer information with this matching IP.
......@@ -242,7 +242,7 @@ public interface BGPCfg {
*
* @return BGPPeerCfg object
*/
BGPPeerCfg displayPeers(String routerid);
BgpPeerCfg displayPeers(String routerid);
/**
* Check if this BGP peer is configured.
......@@ -267,7 +267,7 @@ public interface BGPCfg {
*
* @return return the tree map with IP as key and BGPPeerCfg as object
*/
TreeMap<String, BGPPeerCfg> getPeerTree();
TreeMap<String, BgpPeerCfg> getPeerTree();
/**
* Set the current connection state information.
......@@ -275,7 +275,7 @@ public interface BGPCfg {
* @param routerid router IP address in string format
* @param state state information
*/
void setPeerConnState(String routerid, BGPPeerCfg.State state);
void setPeerConnState(String routerid, BgpPeerCfg.State state);
/**
* Check if the peer can be connected or not.
......@@ -293,5 +293,5 @@ public interface BGPCfg {
*
* @return state information
*/
BGPPeerCfg.State getPeerConnState(String routerid);
BgpPeerCfg.State getPeerConnState(String routerid);
}
......
......@@ -19,21 +19,21 @@ package org.onosproject.bgp.controller;
import java.util.Map;
import java.util.Set;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPMessage;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpMessage;
/**
* Abstraction of an BGP controller. Serves as a one stop shop for obtaining BGP devices and (un)register listeners on
* bgp events
*/
public interface BGPController {
public interface BgpController {
/**
* Returns list of bgp peers connected to this BGP controller.
*
* @return Iterable of BGPPeer elements
*/
Iterable<BGPPeer> getPeers();
Iterable<BgpPeer> getPeers();
/**
* Returns the actual bgp peer for the given ip address.
......@@ -41,7 +41,7 @@ public interface BGPController {
* @param bgpId the id of the bgp peer to fetch
* @return the interface to this bgp peer
*/
BGPPeer getPeer(BGPId bgpId);
BgpPeer getPeer(BgpId bgpId);
/**
* Register a listener for BGP message events.
......@@ -77,16 +77,16 @@ public interface BGPController {
* @param bgpId the id of the peer to send message.
* @param msg the message to send
*/
void writeMsg(BGPId bgpId, BGPMessage msg);
void writeMsg(BgpId bgpId, BgpMessage msg);
/**
* Process a message and notify the appropriate listeners.
*
* @param bgpId id of the peer the message arrived on
* @param msg the message to process.
* @throws BGPParseException on data processing error
* @throws BgpParseException on data processing error
*/
void processBGPPacket(BGPId bgpId, BGPMessage msg) throws BGPParseException;
void processBGPPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException;
/**
* Close all connected BGP peers.
......@@ -99,7 +99,7 @@ public interface BGPController {
*
* @return configuration object
*/
BGPCfg getConfig();
BgpCfg getConfig();
/**
* Get the BGP connected peers to this controller.
......@@ -120,7 +120,7 @@ public interface BGPController {
*
* @return connectedPeers connected peers
*/
Map<BGPId, BGPPeer> connectedPeers();
Map<BgpId, BgpPeer> connectedPeers();
/**
* Return BGP node listener.
......
......@@ -18,9 +18,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import java.net.URI;
import java.net.URISyntaxException;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -61,7 +61,7 @@ public final class BgpDpid {
} else if (nodeDescriptorType == NODE_DESCRIPTOR_REMOTE) {
add(linkNlri.remoteNodeDescriptors().toString());
}
} catch (BGPParseException e) {
} catch (BgpParseException e) {
log.info("Exception BgpId string: " + e.toString());
}
......@@ -72,7 +72,7 @@ public final class BgpDpid {
*
* @param nodeNlri node Nlri.
*/
public BgpDpid(final BGPNodeLSNlriVer4 nodeNlri) {
public BgpDpid(final BgpNodeLSNlriVer4 nodeNlri) {
this.stringBuilder = new StringBuilder("bgpls://");
if (nodeNlri.getRouteDistinguisher() != null) {
......@@ -89,7 +89,7 @@ public final class BgpDpid {
add(nodeNlri.getLocalNodeDescriptors().toString());
} catch (BGPParseException e) {
} catch (BgpParseException e) {
log.info("Exception node string: " + e.toString());
}
}
......
......@@ -27,7 +27,7 @@ import static com.google.common.base.Preconditions.checkArgument;
* The class representing a network peer bgp ip.
* This class is immutable.
*/
public final class BGPId {
public final class BgpId {
private static final String SCHEME = "bgp";
private static final long UNKNOWN = 0;
......@@ -36,7 +36,7 @@ public final class BGPId {
/**
* Private constructor.
*/
private BGPId(IpAddress ipAddress) {
private BgpId(IpAddress ipAddress) {
this.ipAddress = ipAddress;
}
......@@ -46,8 +46,8 @@ public final class BGPId {
* @param ipAddress IP address
* @return object of BGPId
*/
public static BGPId bgpId(IpAddress ipAddress) {
return new BGPId(ipAddress);
public static BgpId bgpId(IpAddress ipAddress) {
return new BgpId(ipAddress);
}
/**
......@@ -71,11 +71,11 @@ public final class BGPId {
@Override
public boolean equals(Object other) {
if (!(other instanceof BGPId)) {
if (!(other instanceof BgpId)) {
return false;
}
BGPId otherBGPid = (BGPId) other;
BgpId otherBGPid = (BgpId) other;
return Objects.equals(ipAddress, otherBGPid.ipAddress);
}
......@@ -90,9 +90,9 @@ public final class BGPId {
* @param uri device URI
* @return object of BGPId
*/
public static BGPId bgpId(URI uri) {
public static BgpId bgpId(URI uri) {
checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme");
return new BGPId(IpAddress.valueOf(uri.getSchemeSpecificPart()));
return new BgpId(IpAddress.valueOf(uri.getSchemeSpecificPart()));
}
/**
......@@ -101,7 +101,7 @@ public final class BGPId {
* @param bgpId device bgpId
* @return device URI
*/
public static URI uri(BGPId bgpId) {
public static URI uri(BgpId bgpId) {
return uri(bgpId.ipAddress());
}
......
......@@ -13,7 +13,7 @@
package org.onosproject.bgp.controller;
import org.onosproject.bgpio.protocol.BGPLSNlri;
import org.onosproject.bgpio.protocol.BgpLSNlri;
import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails;
import org.onosproject.bgpio.types.RouteDistinguisher;
......@@ -29,14 +29,14 @@ public interface BgpLocalRib {
* @param nlri network layer reach info
* @param details nlri details
*/
void add(BgpSessionInfo sessionInfo, BGPLSNlri nlri, PathAttrNlriDetails details);
void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details);
/**
* Removes NLRI identifier if it exists.
*
* @param nlri info
*/
void delete(BGPLSNlri nlri);
void delete(BgpLSNlri nlri);
/**
* Update NLRI identifier mapped with route distinguisher if it exists in tree otherwise add NLRI infomation mapped
......@@ -47,7 +47,7 @@ public interface BgpLocalRib {
* @param details has pathattribute, protocol id and identifier
* @param routeDistinguisher unique for each VPN
*/
void add(BgpSessionInfo sessionInfo, BGPLSNlri nlri, PathAttrNlriDetails details,
void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details,
RouteDistinguisher routeDistinguisher);
/**
......@@ -56,5 +56,5 @@ public interface BgpLocalRib {
* @param nlri info
* @param routeDistinguisher unique for each VPN
*/
void delete(BGPLSNlri nlri, RouteDistinguisher routeDistinguisher);
void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher);
}
......
......@@ -12,7 +12,7 @@
*/
package org.onosproject.bgp.controller;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4;
/**
* Allows for providers interested in node events to be notified.
......@@ -24,12 +24,12 @@ public interface BgpNodeListener {
*
* @param nodeNlri node rechability info
*/
void addNode(BGPNodeLSNlriVer4 nodeNlri);
void addNode(BgpNodeLSNlriVer4 nodeNlri);
/**
* Notifies that the node was removed.
*
* @param nodeNlri node rechability info
*/
void deleteNode(BGPNodeLSNlriVer4 nodeNlri);
void deleteNode(BgpNodeLSNlriVer4 nodeNlri);
}
......
......@@ -21,7 +21,7 @@ package org.onosproject.bgp.controller;
* to the event if blocked has been called. This packet context can be used to react to the packet in event with a
* packet out.
*/
public interface BGPPacketStats {
public interface BgpPacketStats {
/**
* Returns the count for no of packets sent out.
*
......
......@@ -16,14 +16,14 @@
package org.onosproject.bgp.controller;
import java.util.List;
import org.jboss.netty.channel.Channel;
import org.onosproject.bgpio.protocol.BGPFactory;
import org.onosproject.bgpio.protocol.BGPMessage;
import org.onosproject.bgpio.protocol.BgpFactory;
import org.onosproject.bgpio.protocol.BgpMessage;
/**
* Represents the peer side of an BGP peer.
*
*/
public interface BGPPeer {
public interface BgpPeer {
/**
* Sets the associated Netty channel for this bgp peer.
......@@ -58,21 +58,21 @@ public interface BGPPeer {
*
* @param msg the message to write
*/
void sendMessage(BGPMessage msg);
void sendMessage(BgpMessage msg);
/**
* Writes the BGPMessage list to the peer.
*
* @param msgs the messages to be written
*/
void sendMessage(List<BGPMessage> msgs);
void sendMessage(List<BgpMessage> msgs);
/**
* Provides the factory for BGP version.
*
* @return BGP version specific factory.
*/
BGPFactory factory();
BgpFactory factory();
/**
* Checks if the bgp peer is still connected.
......
......@@ -18,7 +18,7 @@ package org.onosproject.bgp.controller;
/**
* BGP Peer configuration information.
*/
public interface BGPPeerCfg {
public interface BgpPeerCfg {
enum State {
......
......@@ -26,7 +26,7 @@ public interface BgpPeerManager {
*
* @return false if peer already exist, otherwise true
*/
public boolean addConnectedPeer(BGPId bgpId, BGPPeer bgpPeer);
public boolean addConnectedPeer(BgpId bgpId, BgpPeer bgpPeer);
/**
* Validate wheather peer is connected.
......@@ -35,14 +35,14 @@ public interface BgpPeerManager {
*
* @return true if peer exist, otherwise false
*/
public boolean isPeerConnected(BGPId bgpId);
public boolean isPeerConnected(BgpId bgpId);
/**
* Remove connected peer.
*
* @param bgpId BGP ID
*/
public void removeConnectedPeer(BGPId bgpId);
public void removeConnectedPeer(BgpId bgpId);
/**
* Gets connected peer.
......@@ -50,5 +50,5 @@ public interface BgpPeerManager {
* @param bgpId BGP ID
* @return BGPPeer the connected peer, otherwise null
*/
public BGPPeer getPeer(BGPId bgpId);
public BgpPeer getPeer(BgpId bgpId);
}
......
......@@ -13,7 +13,7 @@
package org.onosproject.bgp.controller;
import org.onosproject.bgpio.protocol.BGPVersion;
import org.onosproject.bgpio.protocol.BgpVersion;
/**
* Abstraction of an BGP session info. Maintian session parameters obtained during session creation.
......@@ -38,14 +38,14 @@ public interface BgpSessionInfo {
*
* @return bgp ID.
*/
BGPId remoteBgpId();
BgpId remoteBgpId();
/**
* Gets the BGP version of peer.
*
* @return bgp version.
*/
BGPVersion remoteBgpVersion();
BgpVersion remoteBgpVersion();
/**
* Gets the BGP remote bgp AS number.
......
......@@ -21,7 +21,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
/**
* Custom Exception for BGP IO.
*/
public class BGPParseException extends Exception {
public class BgpParseException extends Exception {
private static final long serialVersionUID = 1L;
private byte errorCode;
......@@ -31,7 +31,7 @@ public class BGPParseException extends Exception {
/**
* Default constructor to create a new exception.
*/
public BGPParseException() {
public BgpParseException() {
super();
}
......@@ -41,7 +41,7 @@ public class BGPParseException extends Exception {
* @param message the detail of exception in string
* @param cause underlying cause of the error
*/
public BGPParseException(final String message, final Throwable cause) {
public BgpParseException(final String message, final Throwable cause) {
super(message, cause);
}
......@@ -50,7 +50,7 @@ public class BGPParseException extends Exception {
*
* @param message the detail of exception in string
*/
public BGPParseException(final String message) {
public BgpParseException(final String message) {
super(message);
}
......@@ -59,7 +59,7 @@ public class BGPParseException extends Exception {
*
* @param cause underlying cause of the error
*/
public BGPParseException(final Throwable cause) {
public BgpParseException(final Throwable cause) {
super(cause);
}
......@@ -70,7 +70,7 @@ public class BGPParseException extends Exception {
* @param errorSubCode error subcode of BGP message
* @param data error data of BGP message
*/
public BGPParseException(final byte errorCode, final byte errorSubCode, final ChannelBuffer data) {
public BgpParseException(final byte errorCode, final byte errorSubCode, final ChannelBuffer data) {
super();
this.errorCode = errorCode;
this.errorSubCode = errorSubCode;
......
......@@ -17,22 +17,22 @@
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.ver4.BGPFactoryVer4;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4;
import org.onosproject.bgpio.types.BgpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Abstraction to provide the version for BGP.
*/
public final class BGPFactories {
public final class BgpFactories {
protected static final Logger log = LoggerFactory.getLogger(BGPFactories.class);
protected static final Logger log = LoggerFactory.getLogger(BgpFactories.class);
private static final GenericReader GENERIC_READER = new GenericReader();
private BGPFactories() {
private BgpFactories() {
}
/**
......@@ -41,12 +41,12 @@ public final class BGPFactories {
* @param version BGP version
* @return BGP version
*/
public static BGPFactory getFactory(BGPVersion version) {
public static BgpFactory getFactory(BgpVersion version) {
switch (version) {
case BGP_4:
return BGPFactoryVer4.INSTANCE;
return BgpFactoryVer4.INSTANCE;
default:
throw new IllegalArgumentException("[BGPFactory:]Unknown version: " + version);
throw new IllegalArgumentException("[BgpFactory:]Unknown version: " + version);
}
}
......@@ -54,19 +54,19 @@ public final class BGPFactories {
* Reader class for reading BGP messages from channel buffer.
*
*/
private static class GenericReader implements BGPMessageReader<BGPMessage> {
private static class GenericReader implements BgpMessageReader<BgpMessage> {
@Override
public BGPMessage readFrom(ChannelBuffer bb, BGPHeader bgpHeader)
throws BGPParseException {
BGPFactory factory;
public BgpMessage readFrom(ChannelBuffer bb, BgpHeader bgpHeader)
throws BgpParseException {
BgpFactory factory;
if (!bb.readable()) {
log.error("Empty message received");
throw new BGPParseException("Empty message received");
throw new BgpParseException("Empty message received");
}
// TODO: Currently only BGP version 4 is supported
factory = org.onosproject.bgpio.protocol.ver4.BGPFactoryVer4.INSTANCE;
factory = org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4.INSTANCE;
return factory.getReader().readFrom(bb, bgpHeader);
}
}
......@@ -76,7 +76,7 @@ public final class BGPFactories {
*
* @return bgp message generic reader
*/
public static BGPMessageReader<BGPMessage> getGenericReader() {
public static BgpMessageReader<BgpMessage> getGenericReader() {
return GENERIC_READER;
}
}
......
......@@ -21,40 +21,40 @@ package org.onosproject.bgpio.protocol;
* and objects.
*
*/
public interface BGPFactory {
public interface BgpFactory {
/**
* Gets the builder object for a open message.
*
* @return builder object for open message
*/
BGPOpenMsg.Builder openMessageBuilder();
BgpOpenMsg.Builder openMessageBuilder();
/**
* Gets the builder object for a keepalive message.
*
* @return builder object for keepalive message
*/
BGPKeepaliveMsg.Builder keepaliveMessageBuilder();
BgpKeepaliveMsg.Builder keepaliveMessageBuilder();
/**
* Gets the builder object for a notification message.
*
* @return builder object for notification message.
*/
BGPNotificationMsg.Builder notificationMessageBuilder();
BgpNotificationMsg.Builder notificationMessageBuilder();
/**
* Gets the BGP message reader.
*
* @return BGP message reader
*/
BGPMessageReader<BGPMessage> getReader();
BgpMessageReader<BgpMessage> getReader();
/**
* Returns BGP version.
*
* @return BGP version
*/
BGPVersion getVersion();
BgpVersion getVersion();
}
......
......@@ -16,33 +16,33 @@
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.types.BgpHeader;
/**
* Abstraction of an entity providing BGP Keepalive Message.
*/
public interface BGPKeepaliveMsg extends BGPMessage {
public interface BgpKeepaliveMsg extends BgpMessage {
@Override
BGPVersion getVersion();
BgpVersion getVersion();
@Override
BGPType getType();
BgpType getType();
@Override
void writeTo(ChannelBuffer channelBuffer);
@Override
BGPHeader getHeader();
BgpHeader getHeader();
/**
* Builder interface with get and set functions to build Keepalive message.
*/
interface Builder extends BGPMessage.Builder {
interface Builder extends BgpMessage.Builder {
@Override
BGPKeepaliveMsg build();
BgpKeepaliveMsg build();
@Override
Builder setHeader(BGPHeader bgpMsgHeader);
Builder setHeader(BgpHeader bgpMsgHeader);
}
}
......
......@@ -15,14 +15,14 @@
*/
package org.onosproject.bgpio.protocol;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.types.RouteDistinguisher;
/**
* Abstraction of an entity providing BGP-LS NLRI.
*/
public interface BGPLSNlri {
public interface BgpLSNlri {
/**
* Returns NlriType of BGP-LS NLRI.
*
......@@ -41,9 +41,9 @@ public interface BGPLSNlri {
* Returns Protocol Id in Nlri.
*
* @return Protocol Id in Nlri
* @throws BGPParseException while getting protocol ID
* @throws BgpParseException while getting protocol ID
*/
ProtocolType getProtocolId() throws BGPParseException;
ProtocolType getProtocolId() throws BgpParseException;
/**
* Returns Route distinguisher in Nlri.
......
......@@ -17,13 +17,13 @@ package org.onosproject.bgpio.protocol;
import java.util.List;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors;
/**
* Abstraction of an entity providing BGP-LS Link NLRI.
*/
public interface BgpLinkLsNlri extends BGPLSNlri {
public interface BgpLinkLsNlri extends BgpLSNlri {
/**
* Returns local node descriptors.
*
......@@ -43,5 +43,5 @@ public interface BgpLinkLsNlri extends BGPLSNlri {
*
* @return link descriptors
*/
List<BGPValueType> linkDescriptors();
List<BgpValueType> linkDescriptors();
}
\ No newline at end of file
......
......@@ -17,36 +17,36 @@
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpHeader;
/**
* Abstraction of an entity providing BGP Messages.
*/
public interface BGPMessage extends Writeable {
public interface BgpMessage extends Writeable {
/**
* Returns BGP Header of BGP Message.
*
* @return BGP Header of BGP Message
*/
BGPHeader getHeader();
BgpHeader getHeader();
/**
* Returns version of BGP Message.
*
* @return version of BGP Message
*/
BGPVersion getVersion();
BgpVersion getVersion();
/**
* Returns BGP Type of BGP Message.
*
* @return BGP Type of BGP Message
*/
BGPType getType();
BgpType getType();
@Override
void writeTo(ChannelBuffer cb) throws BGPParseException;
void writeTo(ChannelBuffer cb) throws BgpParseException;
/**
* Builder interface with get and set functions to build BGP Message.
......@@ -56,9 +56,9 @@ public interface BGPMessage extends Writeable {
* Builds BGP Message.
*
* @return BGP Message
* @throws BGPParseException while building bgp message
* @throws BgpParseException while building bgp message
*/
BGPMessage build() throws BGPParseException;
BgpMessage build() throws BgpParseException;
/**
* Sets BgpHeader and return its builder.
......@@ -66,6 +66,6 @@ public interface BGPMessage extends Writeable {
* @param bgpMsgHeader BGP Message Header
* @return builder by setting BGP message header
*/
Builder setHeader(BGPHeader bgpMsgHeader);
Builder setHeader(BgpHeader bgpMsgHeader);
}
}
\ No newline at end of file
......
......@@ -16,13 +16,13 @@
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpHeader;
/**
* Abstraction of an entity providing BGP Message Reader.
*/
public interface BGPMessageReader<T> {
public interface BgpMessageReader<T> {
/**
* Reads the Objects in the BGP Message and Returns BGP Message.
......@@ -30,7 +30,7 @@ public interface BGPMessageReader<T> {
* @param cb Channel Buffer
* @param bgpHeader BGP message header
* @return BGP Message
* @throws BGPParseException while parsing BGP message.
* @throws BgpParseException while parsing BGP message.
*/
T readFrom(ChannelBuffer cb, BGPHeader bgpHeader) throws BGPParseException;
T readFrom(ChannelBuffer cb, BgpHeader bgpHeader) throws BgpParseException;
}
\ No newline at end of file
......
......@@ -17,20 +17,20 @@
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
/**
* Abstraction of an entity providing BGP Message Writer.
*/
public interface BGPMessageWriter<T> {
public interface BgpMessageWriter<T> {
/**
* Writes the Objects of the BGP Message into Channel Buffer.
*
* @param cb Channel Buffer
* @param message BGP Message
* @throws BGPParseException
* @throws BgpParseException
* While writing message
*/
void write(ChannelBuffer cb, T message) throws BGPParseException;
void write(ChannelBuffer cb, T message) throws BgpParseException;
}
\ No newline at end of file
......
......@@ -15,16 +15,16 @@
*/
package org.onosproject.bgpio.protocol;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSIdentifier;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier;
/**
* Abstraction of an entity providing BGP-LS Node NLRI.
*/
public interface BGPNodeLSNlri extends BGPLSNlri {
public interface BgpNodeLSNlri extends BgpLSNlri {
/**
* Returns local node descriptors.
*
* @return local node descriptors
*/
BGPNodeLSIdentifier getLocalNodeDescriptors();
BgpNodeLSIdentifier getLocalNodeDescriptors();
}
......
......@@ -15,12 +15,12 @@
*/
package org.onosproject.bgpio.protocol;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
/**
* Abstraction of an entity providing BGP notification message.
*/
public interface BGPNotificationMsg extends BGPMessage {
public interface BgpNotificationMsg extends BgpMessage {
/**
* Returns errorCode in notification message.
*
......@@ -45,10 +45,10 @@ public interface BGPNotificationMsg extends BGPMessage {
/**
* Builder interface with get and set functions to build notification message.
*/
public interface Builder extends BGPMessage.Builder {
public interface Builder extends BgpMessage.Builder {
@Override
BGPNotificationMsg build() throws BGPParseException;
BgpNotificationMsg build() throws BgpParseException;
/**
* Sets errorCode in notification message and return its builder.
......
......@@ -17,23 +17,23 @@ package org.onosproject.bgpio.protocol;
import java.util.LinkedList;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpHeader;
import org.onosproject.bgpio.types.BgpValueType;
/**
* Abstraction of an entity providing BGP Open Message.
*/
public interface BGPOpenMsg extends BGPMessage {
public interface BgpOpenMsg extends BgpMessage {
@Override
BGPHeader getHeader();
BgpHeader getHeader();
@Override
BGPVersion getVersion();
BgpVersion getVersion();
@Override
BGPType getType();
BgpType getType();
/**
* Returns hold time of Open Message.
......@@ -61,15 +61,15 @@ public interface BGPOpenMsg extends BGPMessage {
*
* @return capabilities of Open Message
*/
LinkedList<BGPValueType> getCapabilityTlv();
LinkedList<BgpValueType> getCapabilityTlv();
/**
* Builder interface with get and set functions to build Open message.
*/
interface Builder extends BGPMessage.Builder {
interface Builder extends BgpMessage.Builder {
@Override
BGPOpenMsg build() throws BGPParseException;
BgpOpenMsg build() throws BgpParseException;
/**
* Sets hold time in Open Message and return its builder.
......@@ -101,7 +101,7 @@ public interface BGPOpenMsg extends BGPMessage {
* @param capabilityTlv capabilities in open message
* @return builder by setting capabilities
*/
Builder setCapabilityTlv(LinkedList<BGPValueType> capabilityTlv);
Builder setCapabilityTlv(LinkedList<BgpValueType> capabilityTlv);
/**
* Sets isLargeAsCapabilityTlvSet and return its builder.
......@@ -122,6 +122,6 @@ public interface BGPOpenMsg extends BGPMessage {
Builder setLsCapabilityTlv(boolean isLsCapabilitySet);
@Override
Builder setHeader(BGPHeader bgpMsgHeader);
Builder setHeader(BgpHeader bgpMsgHeader);
}
}
......
......@@ -17,13 +17,13 @@ package org.onosproject.bgpio.protocol;
import java.util.LinkedList;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors;
/**
* Abstraction of an entity providing BGP-LS Prefix NLRI.
*/
public interface BGPPrefixLSNlri extends BGPLSNlri {
public interface BgpPrefixLSNlri extends BgpLSNlri {
/**
* Returns local node descriptors.
*
......@@ -36,5 +36,5 @@ public interface BGPPrefixLSNlri extends BGPLSNlri {
*
* @return list of Prefix descriptor
*/
LinkedList<BGPValueType> getPrefixdescriptor();
LinkedList<BgpValueType> getPrefixdescriptor();
}
......
......@@ -19,7 +19,7 @@ package org.onosproject.bgpio.protocol;
/**
* Enum to Provide the Different types of BGP messages.
*/
public enum BGPType {
public enum BgpType {
NONE(0), OPEN(1), UPDATE(2), NOTIFICATION(3), KEEP_ALIVE(4);
......@@ -30,7 +30,7 @@ public enum BGPType {
*
* @param val type of BGP message
*/
BGPType(int val) {
BgpType(int val) {
value = val;
}
......
......@@ -24,7 +24,7 @@ import org.onosproject.bgpio.protocol.ver4.BgpPathAttributes;
/**
* Abstraction of an entity providing BGP Update Message.
*/
public interface BgpUpdateMsg extends BGPMessage {
public interface BgpUpdateMsg extends BgpMessage {
/**
* Returns path attributes in BGP Update Message.
*
......
......@@ -19,7 +19,7 @@ package org.onosproject.bgpio.protocol;
/**
* Enum to provide BGP Message Version.
*/
public enum BGPVersion {
public enum BgpVersion {
BGP_4(4);
......@@ -30,7 +30,7 @@ public enum BGPVersion {
*
* @param packetVersion version of BGP
*/
BGPVersion(final int packetVersion) {
BgpVersion(final int packetVersion) {
this.packetVersion = packetVersion;
}
......
......@@ -17,7 +17,7 @@
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
/**
* Abstraction of an entity providing functionality to write byte streams of
......@@ -29,7 +29,7 @@ public interface Writeable {
* Writes byte streams of messages to channel buffer.
*
* @param cb channelBuffer
* @throws BGPParseException when error occurs while writing BGP message to channel buffer
* @throws BgpParseException when error occurs while writing BGP message to channel buffer
*/
void writeTo(ChannelBuffer cb) throws BGPParseException;
void writeTo(ChannelBuffer cb) throws BgpParseException;
}
\ No newline at end of file
......
......@@ -21,9 +21,9 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.IPv4AddressTlv;
import org.onosproject.bgpio.types.IPv6AddressTlv;
import org.onosproject.bgpio.types.LinkLocalRemoteIdentifiersTlv;
......@@ -38,8 +38,8 @@ import com.google.common.base.Preconditions;
/**
* Implementation of local node descriptors, remote node descriptors and link descriptors.
*/
public class BGPLinkLSIdentifier {
private static final Logger log = LoggerFactory.getLogger(BGPLinkLSIdentifier.class);
public class BgpLinkLSIdentifier {
private static final Logger log = LoggerFactory.getLogger(BgpLinkLSIdentifier.class);
public static final short IPV4_INTERFACE_ADDRESS_TYPE = 259;
public static final short IPV4_NEIGHBOR_ADDRESS_TYPE = 260;
public static final short IPV6_INTERFACE_ADDRESS_TYPE = 261;
......@@ -48,12 +48,12 @@ public class BGPLinkLSIdentifier {
private NodeDescriptors localNodeDescriptors;
private NodeDescriptors remoteNodeDescriptors;
private List<BGPValueType> linkDescriptor;
private List<BgpValueType> linkDescriptor;
/**
* Initialize fields.
*/
public BGPLinkLSIdentifier() {
public BgpLinkLSIdentifier() {
this.localNodeDescriptors = null;
this.remoteNodeDescriptors = null;
this.linkDescriptor = null;
......@@ -66,8 +66,8 @@ public class BGPLinkLSIdentifier {
* @param remoteNodeDescriptors remote node descriptors
* @param linkDescriptor link descriptors
*/
public BGPLinkLSIdentifier(NodeDescriptors localNodeDescriptors, NodeDescriptors remoteNodeDescriptors,
LinkedList<BGPValueType> linkDescriptor) {
public BgpLinkLSIdentifier(NodeDescriptors localNodeDescriptors, NodeDescriptors remoteNodeDescriptors,
LinkedList<BgpValueType> linkDescriptor) {
this.localNodeDescriptors = Preconditions.checkNotNull(localNodeDescriptors);
this.remoteNodeDescriptors = Preconditions.checkNotNull(remoteNodeDescriptors);
this.linkDescriptor = Preconditions.checkNotNull(linkDescriptor);
......@@ -79,9 +79,9 @@ public class BGPLinkLSIdentifier {
* @param cb ChannelBuffer
* @param protocolId in linkstate nlri
* @return object of BGPLinkLSIdentifier
* @throws BGPParseException while parsing link identifier
* @throws BgpParseException while parsing link identifier
*/
public static BGPLinkLSIdentifier parseLinkIdendifier(ChannelBuffer cb, byte protocolId) throws BGPParseException {
public static BgpLinkLSIdentifier parseLinkIdendifier(ChannelBuffer cb, byte protocolId) throws BgpParseException {
//Parse local node descriptor
NodeDescriptors localNodeDescriptors = new NodeDescriptors();
localNodeDescriptors = parseNodeDescriptors(cb, NodeDescriptors.LOCAL_NODE_DES_TYPE, protocolId);
......@@ -91,9 +91,9 @@ public class BGPLinkLSIdentifier {
remoteNodeDescriptors = parseNodeDescriptors(cb, NodeDescriptors.REMOTE_NODE_DES_TYPE, protocolId);
//Parse link descriptor
LinkedList<BGPValueType> linkDescriptor = new LinkedList<>();
LinkedList<BgpValueType> linkDescriptor = new LinkedList<>();
linkDescriptor = parseLinkDescriptors(cb);
return new BGPLinkLSIdentifier(localNodeDescriptors, remoteNodeDescriptors, linkDescriptor);
return new BgpLinkLSIdentifier(localNodeDescriptors, remoteNodeDescriptors, linkDescriptor);
}
/**
......@@ -103,15 +103,15 @@ public class BGPLinkLSIdentifier {
* @param desType descriptor type
* @param protocolId protocol identifier
* @return object of NodeDescriptors
* @throws BGPParseException while parsing Local/Remote node descriptors
* @throws BgpParseException while parsing Local/Remote node descriptors
*/
public static NodeDescriptors parseNodeDescriptors(ChannelBuffer cb, short desType, byte protocolId)
throws BGPParseException {
throws BgpParseException {
ChannelBuffer tempBuf = cb;
short type = cb.readShort();
short length = cb.readShort();
if (cb.readableBytes() < length) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
}
NodeDescriptors nodeIdentifier = new NodeDescriptors();
......@@ -120,7 +120,7 @@ public class BGPLinkLSIdentifier {
if (type == desType) {
nodeIdentifier = NodeDescriptors.read(tempCb, length, desType, protocolId);
} else {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.MALFORMED_ATTRIBUTE_LIST, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.MALFORMED_ATTRIBUTE_LIST, null);
}
return nodeIdentifier;
}
......@@ -130,11 +130,11 @@ public class BGPLinkLSIdentifier {
*
* @param cb ChannelBuffer
* @return list of link descriptors
* @throws BGPParseException while parsing link descriptors
* @throws BgpParseException while parsing link descriptors
*/
public static LinkedList<BGPValueType> parseLinkDescriptors(ChannelBuffer cb) throws BGPParseException {
LinkedList<BGPValueType> linkDescriptor = new LinkedList<>();
BGPValueType tlv = null;
public static LinkedList<BgpValueType> parseLinkDescriptors(ChannelBuffer cb) throws BgpParseException {
LinkedList<BgpValueType> linkDescriptor = new LinkedList<>();
BgpValueType tlv = null;
int count = 0;
while (cb.readableBytes() > 0) {
......@@ -142,7 +142,7 @@ public class BGPLinkLSIdentifier {
short type = cb.readShort();
short length = cb.readShort();
if (cb.readableBytes() < length) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
}
ChannelBuffer tempCb = cb.readBytes(length);
......@@ -168,8 +168,8 @@ public class BGPLinkLSIdentifier {
//MultiTopologyId TLV cannot repeat more than once
if (count > 1) {
//length + 4 implies data contains type, length and value
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length
+ TYPE_AND_LEN));
}
break;
......@@ -204,7 +204,7 @@ public class BGPLinkLSIdentifier {
*
* @return link descriptors
*/
public List<BGPValueType> linkDescriptors() {
public List<BgpValueType> linkDescriptors() {
return this.linkDescriptor;
}
......@@ -218,19 +218,19 @@ public class BGPLinkLSIdentifier {
if (this == obj) {
return true;
}
if (obj instanceof BGPLinkLSIdentifier) {
if (obj instanceof BgpLinkLSIdentifier) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
BGPLinkLSIdentifier other = (BGPLinkLSIdentifier) obj;
Iterator<BGPValueType> objListIterator = other.linkDescriptor.iterator();
BgpLinkLSIdentifier other = (BgpLinkLSIdentifier) obj;
Iterator<BgpValueType> objListIterator = other.linkDescriptor.iterator();
countOtherSubTlv = other.linkDescriptor.size();
countObjSubTlv = linkDescriptor.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
} else {
while (objListIterator.hasNext() && isCommonSubTlv) {
BGPValueType subTlv = objListIterator.next();
BgpValueType subTlv = objListIterator.next();
isCommonSubTlv = Objects.equals(linkDescriptor.contains(subTlv),
other.linkDescriptor.contains(subTlv));
}
......
......@@ -18,12 +18,12 @@ package org.onosproject.bgpio.protocol.linkstate;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpLinkLsNlri;
import org.onosproject.bgpio.protocol.NlriType;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.RouteDistinguisher;
import org.onosproject.bgpio.util.Constants;
import org.slf4j.Logger;
......@@ -58,7 +58,7 @@ public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri {
private static final Logger log = LoggerFactory.getLogger(BgpLinkLsNlriVer4.class);
public static final int LINK_NLRITYPE = 2;
private BGPLinkLSIdentifier linkLSIdentifier;
private BgpLinkLSIdentifier linkLSIdentifier;
private byte protocolId;
private long identifier;
private RouteDistinguisher routeDistinguisher;
......@@ -84,7 +84,7 @@ public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri {
* @param routeDistinguisher route distinguisher from message
* @param isVpn vpn info availability in message
*/
public BgpLinkLsNlriVer4(byte protocolId, long identifier, BGPLinkLSIdentifier linkLSIdentifier,
public BgpLinkLsNlriVer4(byte protocolId, long identifier, BgpLinkLSIdentifier linkLSIdentifier,
RouteDistinguisher routeDistinguisher, boolean isVpn) {
this.protocolId = protocolId;
this.identifier = identifier;
......@@ -100,9 +100,9 @@ public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri {
* @param afi Address Family Identifier
* @param safi Subsequent Address Family Identifier
* @return object of this class
* @throws BGPParseException while parsing Link LS NLRI
* @throws BgpParseException while parsing Link LS NLRI
*/
public static BgpLinkLsNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BGPParseException {
public static BgpLinkLsNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BgpParseException {
boolean isVpn = false;
RouteDistinguisher routeDistinguisher = null;
if ((afi == Constants.AFI_VALUE) && (safi == Constants.VPN_SAFI_VALUE)) {
......@@ -115,8 +115,8 @@ public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri {
byte protocolId = cb.readByte();
long identifier = cb.readLong();
BGPLinkLSIdentifier linkLSIdentifier = new BGPLinkLSIdentifier();
linkLSIdentifier = BGPLinkLSIdentifier.parseLinkIdendifier(cb, protocolId);
BgpLinkLSIdentifier linkLSIdentifier = new BgpLinkLSIdentifier();
linkLSIdentifier = BgpLinkLSIdentifier.parseLinkIdendifier(cb, protocolId);
return new BgpLinkLsNlriVer4(protocolId, identifier, linkLSIdentifier, routeDistinguisher, isVpn);
}
......@@ -135,12 +135,12 @@ public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri {
*
* @param linkLSIdentifier link LS identifier to set
*/
public void setLinkLSIdentifier(BGPLinkLSIdentifier linkLSIdentifier) {
public void setLinkLSIdentifier(BgpLinkLSIdentifier linkLSIdentifier) {
this.linkLSIdentifier = linkLSIdentifier;
}
@Override
public ProtocolType getProtocolId() throws BGPParseException {
public ProtocolType getProtocolId() throws BgpParseException {
switch (protocolId) {
case Constants.ISIS_LEVELONE:
return ProtocolType.ISIS_LEVEL_ONE;
......@@ -155,7 +155,7 @@ public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri {
case Constants.OSPFV3:
return ProtocolType.OSPF_V3;
default:
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
}
}
......@@ -188,12 +188,12 @@ public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri {
*
* @return link identifier
*/
public BGPLinkLSIdentifier getLinkIdentifier() {
public BgpLinkLSIdentifier getLinkIdentifier() {
return this.linkLSIdentifier;
}
@Override
public List<BGPValueType> linkDescriptors() {
public List<BgpValueType> linkDescriptors() {
return this.linkLSIdentifier.linkDescriptors();
}
......
......@@ -18,8 +18,8 @@ package org.onosproject.bgpio.protocol.linkstate;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.util.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -29,15 +29,15 @@ import com.google.common.base.MoreObjects;
/**
* Implementation of Node Identifier which includes local node descriptor/remote node descriptors.
*/
public class BGPNodeLSIdentifier {
public class BgpNodeLSIdentifier {
protected static final Logger log = LoggerFactory.getLogger(BGPNodeLSIdentifier.class);
protected static final Logger log = LoggerFactory.getLogger(BgpNodeLSIdentifier.class);
private NodeDescriptors nodeDescriptors;
/**
* Resets fields.
*/
public BGPNodeLSIdentifier() {
public BgpNodeLSIdentifier() {
this.nodeDescriptors = null;
}
......@@ -46,7 +46,7 @@ public class BGPNodeLSIdentifier {
*
* @param nodeDescriptors local/remote node descriptor
*/
public BGPNodeLSIdentifier(NodeDescriptors nodeDescriptors) {
public BgpNodeLSIdentifier(NodeDescriptors nodeDescriptors) {
this.nodeDescriptors = nodeDescriptors;
}
......@@ -56,15 +56,15 @@ public class BGPNodeLSIdentifier {
* @param cb ChannelBuffer
* @param protocolId protocol identifier
* @return object of this BGPNodeLSIdentifier
* @throws BGPParseException while parsing local node descriptors
* @throws BgpParseException while parsing local node descriptors
*/
public static BGPNodeLSIdentifier parseLocalNodeDescriptors(ChannelBuffer cb, byte protocolId)
throws BGPParseException {
public static BgpNodeLSIdentifier parseLocalNodeDescriptors(ChannelBuffer cb, byte protocolId)
throws BgpParseException {
ChannelBuffer tempBuf = cb;
short type = cb.readShort();
short length = cb.readShort();
if (cb.readableBytes() < length) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + Constants.TYPE_AND_LEN));
}
NodeDescriptors nodeDescriptors = new NodeDescriptors();
......@@ -73,9 +73,9 @@ public class BGPNodeLSIdentifier {
if (type == NodeDescriptors.LOCAL_NODE_DES_TYPE) {
nodeDescriptors = NodeDescriptors.read(tempCb, length, type, protocolId);
} else {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.MALFORMED_ATTRIBUTE_LIST, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.MALFORMED_ATTRIBUTE_LIST, null);
}
return new BGPNodeLSIdentifier(nodeDescriptors);
return new BgpNodeLSIdentifier(nodeDescriptors);
}
/**
......@@ -92,8 +92,8 @@ public class BGPNodeLSIdentifier {
if (this == obj) {
return true;
}
if (obj instanceof BGPNodeLSIdentifier) {
BGPNodeLSIdentifier other = (BGPNodeLSIdentifier) obj;
if (obj instanceof BgpNodeLSIdentifier) {
BgpNodeLSIdentifier other = (BgpNodeLSIdentifier) obj;
return Objects.equals(nodeDescriptors, other.nodeDescriptors);
}
return false;
......
......@@ -16,10 +16,10 @@
package org.onosproject.bgpio.protocol.linkstate;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPNodeLSNlri;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpNodeLSNlri;
import org.onosproject.bgpio.protocol.NlriType;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.RouteDistinguisher;
import org.onosproject.bgpio.util.Constants;
import org.slf4j.Logger;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implementation of Node LS NLRI.
*/
public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
public class BgpNodeLSNlriVer4 implements BgpNodeLSNlri {
/*
*REFERENCE : draft-ietf-idr-ls-distribution-11
......@@ -48,13 +48,13 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
Figure : The Node NLRI format
*/
protected static final Logger log = LoggerFactory.getLogger(BGPNodeLSNlriVer4.class);
protected static final Logger log = LoggerFactory.getLogger(BgpNodeLSNlriVer4.class);
public static final int NODE_NLRITYPE = 1;
public static final int IDENTIFIER_LENGTH = 16;
private long identifier;
private byte protocolId;
private BGPNodeLSIdentifier localNodeDescriptors;
private BgpNodeLSIdentifier localNodeDescriptors;
private RouteDistinguisher routeDistinguisher;
private boolean isVpn;
......@@ -87,7 +87,7 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
/**
* Reset fields.
*/
public BGPNodeLSNlriVer4() {
public BgpNodeLSNlriVer4() {
this.identifier = 0;
this.protocolId = 0;
this.localNodeDescriptors = null;
......@@ -104,7 +104,7 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
* @param isVpn true if VPN info is present
* @param routeDistinguisher unique for each VPN
*/
public BGPNodeLSNlriVer4(long identifier, byte protocolId, BGPNodeLSIdentifier localNodeDescriptors, boolean isVpn,
public BgpNodeLSNlriVer4(long identifier, byte protocolId, BgpNodeLSIdentifier localNodeDescriptors, boolean isVpn,
RouteDistinguisher routeDistinguisher) {
this.identifier = identifier;
this.protocolId = protocolId;
......@@ -120,9 +120,9 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
* @param afi Address Family Identifier
* @param safi Subsequent Address Family Identifier
* @return object of this class
* @throws BGPParseException while parsing node descriptors
* @throws BgpParseException while parsing node descriptors
*/
public static BGPNodeLSNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BGPParseException {
public static BgpNodeLSNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BgpParseException {
boolean isVpn = false;
RouteDistinguisher routeDistinguisher = null;
if ((afi == Constants.AFI_VALUE) && (safi == Constants.VPN_SAFI_VALUE)) {
......@@ -136,9 +136,9 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
long identifier = cb.readLong();
// Parse Local Node Descriptors
BGPNodeLSIdentifier localNodeDescriptors = new BGPNodeLSIdentifier();
localNodeDescriptors = BGPNodeLSIdentifier.parseLocalNodeDescriptors(cb, protocolId);
return new BGPNodeLSNlriVer4(identifier, protocolId, localNodeDescriptors, isVpn, routeDistinguisher);
BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier();
localNodeDescriptors = BgpNodeLSIdentifier.parseLocalNodeDescriptors(cb, protocolId);
return new BgpNodeLSNlriVer4(identifier, protocolId, localNodeDescriptors, isVpn, routeDistinguisher);
}
@Override
......@@ -147,7 +147,7 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
}
@Override
public BGPNodeLSIdentifier getLocalNodeDescriptors() {
public BgpNodeLSIdentifier getLocalNodeDescriptors() {
return this.localNodeDescriptors;
}
......@@ -175,12 +175,12 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
*
* @param localNodeDescriptors node LS identifier to set
*/
public void setNodeLSIdentifier(BGPNodeLSIdentifier localNodeDescriptors) {
public void setNodeLSIdentifier(BgpNodeLSIdentifier localNodeDescriptors) {
this.localNodeDescriptors = localNodeDescriptors;
}
@Override
public ProtocolType getProtocolId() throws BGPParseException {
public ProtocolType getProtocolId() throws BgpParseException {
switch (protocolId) {
case Constants.ISIS_LEVELONE:
return ProtocolType.ISIS_LEVEL_ONE;
......@@ -195,7 +195,7 @@ public class BGPNodeLSNlriVer4 implements BGPNodeLSNlri {
case Constants.OSPFV3:
return ProtocolType.OSPF_V3;
default:
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
}
}
......
......@@ -18,11 +18,11 @@ package org.onosproject.bgpio.protocol.linkstate;
import java.util.LinkedList;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPPrefixLSNlri;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpPrefixLSNlri;
import org.onosproject.bgpio.protocol.NlriType;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.RouteDistinguisher;
import org.onosproject.bgpio.util.Constants;
import org.slf4j.Logger;
......@@ -33,7 +33,7 @@ import com.google.common.base.MoreObjects;
/**
* Implementation of Prefix IPV4 LS NLRI.
*/
public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
public class BgpPrefixIPv4LSNlriVer4 implements BgpPrefixLSNlri {
/*
* REFERENCE : draft-ietf-idr-ls-distribution-11
......@@ -53,7 +53,7 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
Figure : The IPv4/IPv6 Topology Prefix NLRI format
*/
protected static final Logger log = LoggerFactory.getLogger(BGPPrefixIPv4LSNlriVer4.class);
protected static final Logger log = LoggerFactory.getLogger(BgpPrefixIPv4LSNlriVer4.class);
public static final int PREFIX_IPV4_NLRITYPE = 3;
public static final int IDENTIFIER_LENGTH = 16;
......@@ -61,12 +61,12 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
private byte protocolId;
private RouteDistinguisher routeDistinguisher;
private boolean isVpn;
private BGPPrefixLSIdentifier bgpPrefixLSIdentifier;
private BgpPrefixLSIdentifier bgpPrefixLSIdentifier;
/**
* Resets parameters.
*/
public BGPPrefixIPv4LSNlriVer4() {
public BgpPrefixIPv4LSNlriVer4() {
this.identifier = 0;
this.protocolId = 0;
this.bgpPrefixLSIdentifier = null;
......@@ -83,7 +83,7 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
* @param routeDistinguisher RouteDistinguisher
* @param isVpn vpn availability in message
*/
public BGPPrefixIPv4LSNlriVer4(long identifier, byte protocolId, BGPPrefixLSIdentifier bgpPrefixLSIdentifier,
public BgpPrefixIPv4LSNlriVer4(long identifier, byte protocolId, BgpPrefixLSIdentifier bgpPrefixLSIdentifier,
RouteDistinguisher routeDistinguisher, boolean isVpn) {
this.identifier = identifier;
this.protocolId = protocolId;
......@@ -99,9 +99,9 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
* @param afi Address family identifier
* @param safi Subsequent address family identifier
* @return object of BGPPrefixIPv4LSNlriVer4
* @throws BGPParseException while parsing Prefix LS Nlri
* @throws BgpParseException while parsing Prefix LS Nlri
*/
public static BGPPrefixIPv4LSNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BGPParseException {
public static BgpPrefixIPv4LSNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BgpParseException {
boolean isVpn = false;
RouteDistinguisher routeDistinguisher = null;
......@@ -115,9 +115,9 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
byte protocolId = cb.readByte();
long identifier = cb.readLong();
BGPPrefixLSIdentifier bgpPrefixLSIdentifier = new BGPPrefixLSIdentifier();
bgpPrefixLSIdentifier = BGPPrefixLSIdentifier.parsePrefixIdendifier(cb, protocolId);
return new BGPPrefixIPv4LSNlriVer4(identifier, protocolId, bgpPrefixLSIdentifier, routeDistinguisher, isVpn);
BgpPrefixLSIdentifier bgpPrefixLSIdentifier = new BgpPrefixLSIdentifier();
bgpPrefixLSIdentifier = BgpPrefixLSIdentifier.parsePrefixIdendifier(cb, protocolId);
return new BgpPrefixIPv4LSNlriVer4(identifier, protocolId, bgpPrefixLSIdentifier, routeDistinguisher, isVpn);
}
@Override
......@@ -140,12 +140,12 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
*
* @param bgpPrefixLSIdentifier prefix identifier to set
*/
public void setPrefixLSIdentifier(BGPPrefixLSIdentifier bgpPrefixLSIdentifier) {
public void setPrefixLSIdentifier(BgpPrefixLSIdentifier bgpPrefixLSIdentifier) {
this.bgpPrefixLSIdentifier = bgpPrefixLSIdentifier;
}
@Override
public ProtocolType getProtocolId() throws BGPParseException {
public ProtocolType getProtocolId() throws BgpParseException {
switch (protocolId) {
case Constants.ISIS_LEVELONE:
return ProtocolType.ISIS_LEVEL_ONE;
......@@ -160,7 +160,7 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
case Constants.OSPFV3:
return ProtocolType.OSPF_V3;
default:
throw new BGPParseException("protocol id not valid");
throw new BgpParseException("protocol id not valid");
}
}
......@@ -178,7 +178,7 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
*
* @return Prefix Identifier
*/
public BGPPrefixLSIdentifier getPrefixIdentifier() {
public BgpPrefixLSIdentifier getPrefixIdentifier() {
return this.bgpPrefixLSIdentifier;
}
......@@ -188,7 +188,7 @@ public class BGPPrefixIPv4LSNlriVer4 implements BGPPrefixLSNlri {
}
@Override
public LinkedList<BGPValueType> getPrefixdescriptor() {
public LinkedList<BgpValueType> getPrefixdescriptor() {
return this.bgpPrefixLSIdentifier.getPrefixdescriptor();
}
......
......@@ -21,9 +21,9 @@ import java.util.LinkedList;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.IPReachabilityInformationTlv;
import org.onosproject.bgpio.types.OSPFRouteTypeTlv;
import org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId;
......@@ -36,17 +36,17 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of Local node descriptors and prefix descriptors.
*/
public class BGPPrefixLSIdentifier {
public class BgpPrefixLSIdentifier {
protected static final Logger log = LoggerFactory.getLogger(BGPPrefixLSIdentifier.class);
protected static final Logger log = LoggerFactory.getLogger(BgpPrefixLSIdentifier.class);
public static final int TYPE_AND_LEN = 4;
private NodeDescriptors localNodeDescriptors;
private LinkedList<BGPValueType> prefixDescriptor;
private LinkedList<BgpValueType> prefixDescriptor;
/**
* Resets parameters.
*/
public BGPPrefixLSIdentifier() {
public BgpPrefixLSIdentifier() {
this.localNodeDescriptors = null;
this.prefixDescriptor = null;
}
......@@ -57,7 +57,7 @@ public class BGPPrefixLSIdentifier {
* @param localNodeDescriptors Local node descriptors
* @param prefixDescriptor Prefix Descriptors
*/
public BGPPrefixLSIdentifier(NodeDescriptors localNodeDescriptors, LinkedList<BGPValueType> prefixDescriptor) {
public BgpPrefixLSIdentifier(NodeDescriptors localNodeDescriptors, LinkedList<BgpValueType> prefixDescriptor) {
this.localNodeDescriptors = localNodeDescriptors;
this.prefixDescriptor = prefixDescriptor;
}
......@@ -68,18 +68,18 @@ public class BGPPrefixLSIdentifier {
* @param cb ChannelBuffer
* @param protocolId protocol ID
* @return object of this class
* @throws BGPParseException while parsing Prefix Identifier
* @throws BgpParseException while parsing Prefix Identifier
*/
public static BGPPrefixLSIdentifier parsePrefixIdendifier(ChannelBuffer cb, byte protocolId)
throws BGPParseException {
public static BgpPrefixLSIdentifier parsePrefixIdendifier(ChannelBuffer cb, byte protocolId)
throws BgpParseException {
//Parse Local Node descriptor
NodeDescriptors localNodeDescriptors = new NodeDescriptors();
localNodeDescriptors = parseLocalNodeDescriptors(cb, protocolId);
//Parse Prefix descriptor
LinkedList<BGPValueType> prefixDescriptor = new LinkedList<>();
LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>();
prefixDescriptor = parsePrefixDescriptors(cb);
return new BGPPrefixLSIdentifier(localNodeDescriptors, prefixDescriptor);
return new BgpPrefixLSIdentifier(localNodeDescriptors, prefixDescriptor);
}
/**
......@@ -88,16 +88,16 @@ public class BGPPrefixLSIdentifier {
* @param cb ChannelBuffer
* @param protocolId protocol identifier
* @return LocalNodeDescriptors
* @throws BGPParseException while parsing local node descriptors
* @throws BgpParseException while parsing local node descriptors
*/
public static NodeDescriptors parseLocalNodeDescriptors(ChannelBuffer cb, byte protocolId)
throws BGPParseException {
throws BgpParseException {
ChannelBuffer tempBuf = cb;
short type = cb.readShort();
short length = cb.readShort();
if (cb.readableBytes() < length) {
//length + 4 implies data contains type, length and value
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
}
NodeDescriptors localNodeDescriptors = new NodeDescriptors();
......@@ -106,8 +106,8 @@ public class BGPPrefixLSIdentifier {
if (type == NodeDescriptors.LOCAL_NODE_DES_TYPE) {
localNodeDescriptors = NodeDescriptors.read(tempCb, length, type, protocolId);
} else {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MALFORMED_ATTRIBUTE_LIST, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MALFORMED_ATTRIBUTE_LIST, null);
}
return localNodeDescriptors;
}
......@@ -117,11 +117,11 @@ public class BGPPrefixLSIdentifier {
*
* @param cb ChannelBuffer
* @return list of prefix descriptors
* @throws BGPParseException while parsing list of prefix descriptors
* @throws BgpParseException while parsing list of prefix descriptors
*/
public static LinkedList<BGPValueType> parsePrefixDescriptors(ChannelBuffer cb) throws BGPParseException {
LinkedList<BGPValueType> prefixDescriptor = new LinkedList<>();
BGPValueType tlv = null;
public static LinkedList<BgpValueType> parsePrefixDescriptors(ChannelBuffer cb) throws BgpParseException {
LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>();
BgpValueType tlv = null;
boolean isIpReachInfo = false;
ChannelBuffer tempCb;
int count = 0;
......@@ -132,7 +132,7 @@ public class BGPPrefixLSIdentifier {
short length = cb.readShort();
if (cb.readableBytes() < length) {
//length + 4 implies data contains type, length and value
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
}
tempCb = cb.readBytes(length);
......@@ -149,8 +149,8 @@ public class BGPPrefixLSIdentifier {
count = count + 1;
if (count > 1) {
//length + 4 implies data contains type, length and value
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length + TYPE_AND_LEN));
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length + TYPE_AND_LEN));
}
break;
default:
......@@ -160,7 +160,7 @@ public class BGPPrefixLSIdentifier {
}
if (!isIpReachInfo) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
null);
}
return prefixDescriptor;
......@@ -180,7 +180,7 @@ public class BGPPrefixLSIdentifier {
*
* @return Prefix descriptors
*/
public LinkedList<BGPValueType> getPrefixdescriptor() {
public LinkedList<BgpValueType> getPrefixdescriptor() {
return this.prefixDescriptor;
}
......@@ -195,20 +195,20 @@ public class BGPPrefixLSIdentifier {
return true;
}
if (obj instanceof BGPPrefixLSIdentifier) {
if (obj instanceof BgpPrefixLSIdentifier) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
BGPPrefixLSIdentifier other = (BGPPrefixLSIdentifier) obj;
BgpPrefixLSIdentifier other = (BgpPrefixLSIdentifier) obj;
Iterator<BGPValueType> objListIterator = other.prefixDescriptor.iterator();
Iterator<BgpValueType> objListIterator = other.prefixDescriptor.iterator();
countOtherSubTlv = other.prefixDescriptor.size();
countObjSubTlv = prefixDescriptor.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
} else {
while (objListIterator.hasNext() && isCommonSubTlv) {
BGPValueType subTlv = objListIterator.next();
BgpValueType subTlv = objListIterator.next();
isCommonSubTlv = Objects.equals(prefixDescriptor.contains(subTlv),
other.prefixDescriptor.contains(subTlv));
}
......
......@@ -21,12 +21,12 @@ import java.util.LinkedList;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.AreaIDTlv;
import org.onosproject.bgpio.types.AutonomousSystemTlv;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPLSIdentifierTlv;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpLSIdentifierTlv;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.IsIsNonPseudonode;
import org.onosproject.bgpio.types.IsIsPseudonode;
import org.onosproject.bgpio.types.OSPFNonPseudonode;
......@@ -71,7 +71,7 @@ public class NodeDescriptors {
public static final int ISISPSEUDONODE_LEN = 7;
public static final int OSPFNONPSEUDONODE_LEN = 4;
public static final int OSPFPSEUDONODE_LEN = 8;
private LinkedList<BGPValueType> subTlvs;
private LinkedList<BgpValueType> subTlvs;
private short deslength;
private short desType;
......@@ -91,7 +91,7 @@ public class NodeDescriptors {
* @param deslength Descriptors length
* @param desType local node descriptor or remote node descriptor type
*/
public NodeDescriptors(LinkedList<BGPValueType> subTlvs, short deslength, short desType) {
public NodeDescriptors(LinkedList<BgpValueType> subTlvs, short deslength, short desType) {
this.subTlvs = subTlvs;
this.deslength = deslength;
this.desType = desType;
......@@ -102,7 +102,7 @@ public class NodeDescriptors {
*
* @return subTlvs list of subTlvs
*/
public LinkedList<BGPValueType> getSubTlvs() {
public LinkedList<BgpValueType> getSubTlvs() {
return subTlvs;
}
......@@ -122,14 +122,14 @@ public class NodeDescriptors {
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
NodeDescriptors other = (NodeDescriptors) obj;
Iterator<BGPValueType> objListIterator = other.subTlvs.iterator();
Iterator<BgpValueType> objListIterator = other.subTlvs.iterator();
countOtherSubTlv = other.subTlvs.size();
countObjSubTlv = subTlvs.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
} else {
while (objListIterator.hasNext() && isCommonSubTlv) {
BGPValueType subTlv = objListIterator.next();
BgpValueType subTlv = objListIterator.next();
isCommonSubTlv = Objects.equals(subTlvs.contains(subTlv), other.subTlvs.contains(subTlv));
}
return isCommonSubTlv;
......@@ -146,20 +146,20 @@ public class NodeDescriptors {
* @param desType local node descriptor or remote node descriptor type
* @param protocolId protocol ID
* @return object of NodeDescriptors
* @throws BGPParseException while parsing node descriptors
* @throws BgpParseException while parsing node descriptors
*/
public static NodeDescriptors read(ChannelBuffer cb, short desLength, short desType, byte protocolId)
throws BGPParseException {
LinkedList<BGPValueType> subTlvs;
throws BgpParseException {
LinkedList<BgpValueType> subTlvs;
subTlvs = new LinkedList<>();
BGPValueType tlv = null;
BgpValueType tlv = null;
while (cb.readableBytes() > 0) {
ChannelBuffer tempBuf = cb;
short type = cb.readShort();
short length = cb.readShort();
if (cb.readableBytes() < length) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
}
ChannelBuffer tempCb = cb.readBytes(length);
......@@ -167,8 +167,8 @@ public class NodeDescriptors {
case AutonomousSystemTlv.TYPE:
tlv = AutonomousSystemTlv.read(tempCb);
break;
case BGPLSIdentifierTlv.TYPE:
tlv = BGPLSIdentifierTlv.read(tempCb);
case BgpLSIdentifierTlv.TYPE:
tlv = BgpLSIdentifierTlv.read(tempCb);
break;
case AreaIDTlv.TYPE:
tlv = AreaIDTlv.read(tempCb);
......
......@@ -19,8 +19,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.types.BgpValueType;
import com.google.common.base.MoreObjects;
......@@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects;
* This Class stores path Attributes, protocol ID and Identifier of LinkState NLRI.
*/
public class PathAttrNlriDetails {
private List<BGPValueType> pathAttributes;
private List<BgpValueType> pathAttributes;
private ProtocolType protocolID;
private long identifier;
......@@ -37,7 +37,7 @@ public class PathAttrNlriDetails {
*
* @param pathAttributes in update message
*/
public void setPathAttribute(List<BGPValueType> pathAttributes) {
public void setPathAttribute(List<BgpValueType> pathAttributes) {
this.pathAttributes = pathAttributes;
}
......@@ -46,7 +46,7 @@ public class PathAttrNlriDetails {
*
* @return path attributes
*/
public List<BGPValueType> pathAttributes() {
public List<BgpValueType> pathAttributes() {
return this.pathAttributes;
}
......@@ -102,14 +102,14 @@ public class PathAttrNlriDetails {
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
PathAttrNlriDetails other = (PathAttrNlriDetails) obj;
Iterator<BGPValueType> objListIterator = other.pathAttributes.iterator();
Iterator<BgpValueType> objListIterator = other.pathAttributes.iterator();
countOtherSubTlv = other.pathAttributes.size();
countObjSubTlv = pathAttributes.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
} else {
while (objListIterator.hasNext() && isCommonSubTlv) {
BGPValueType subTlv = objListIterator.next();
BgpValueType subTlv = objListIterator.next();
if (pathAttributes.contains(subTlv) && other.pathAttributes.contains(subTlv)) {
isCommonSubTlv = Objects.equals(pathAttributes.get(pathAttributes.indexOf(subTlv)),
other.pathAttributes.get(other.pathAttributes.indexOf(subTlv)));
......
......@@ -16,43 +16,43 @@
package org.onosproject.bgpio.protocol.ver4;
import org.onosproject.bgpio.protocol.BGPFactory;
import org.onosproject.bgpio.protocol.BGPKeepaliveMsg;
import org.onosproject.bgpio.protocol.BGPMessage;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.protocol.BGPNotificationMsg;
import org.onosproject.bgpio.protocol.BGPOpenMsg;
import org.onosproject.bgpio.protocol.BGPVersion;
import org.onosproject.bgpio.protocol.BgpFactory;
import org.onosproject.bgpio.protocol.BgpKeepaliveMsg;
import org.onosproject.bgpio.protocol.BgpMessage;
import org.onosproject.bgpio.protocol.BgpMessageReader;
import org.onosproject.bgpio.protocol.BgpNotificationMsg;
import org.onosproject.bgpio.protocol.BgpOpenMsg;
import org.onosproject.bgpio.protocol.BgpVersion;
/**
* Provides BGP Factory and returns builder classes for all objects and messages.
*/
public class BGPFactoryVer4 implements BGPFactory {
public class BgpFactoryVer4 implements BgpFactory {
public static final BGPFactoryVer4 INSTANCE = new BGPFactoryVer4();
public static final BgpFactoryVer4 INSTANCE = new BgpFactoryVer4();
@Override
public BGPOpenMsg.Builder openMessageBuilder() {
return new BGPOpenMsgVer4.Builder();
public BgpOpenMsg.Builder openMessageBuilder() {
return new BgpOpenMsgVer4.Builder();
}
@Override
public BGPKeepaliveMsg.Builder keepaliveMessageBuilder() {
return new BGPKeepaliveMsgVer4.Builder();
public BgpKeepaliveMsg.Builder keepaliveMessageBuilder() {
return new BgpKeepaliveMsgVer4.Builder();
}
@Override
public BGPNotificationMsg.Builder notificationMessageBuilder() {
return new BGPNotificationMsgVer4.Builder();
public BgpNotificationMsg.Builder notificationMessageBuilder() {
return new BgpNotificationMsgVer4.Builder();
}
@Override
public BGPMessageReader<BGPMessage> getReader() {
return BGPMessageVer4.READER;
public BgpMessageReader<BgpMessage> getReader() {
return BgpMessageVer4.READER;
}
@Override
public BGPVersion getVersion() {
return BGPVersion.BGP_4;
public BgpVersion getVersion() {
return BgpVersion.BGP_4;
}
}
\ No newline at end of file
......
......@@ -16,13 +16,13 @@
package org.onosproject.bgpio.protocol.ver4;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPKeepaliveMsg;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.protocol.BGPMessageWriter;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.protocol.BGPType;
import org.onosproject.bgpio.protocol.BGPVersion;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpKeepaliveMsg;
import org.onosproject.bgpio.protocol.BgpMessageReader;
import org.onosproject.bgpio.protocol.BgpMessageWriter;
import org.onosproject.bgpio.types.BgpHeader;
import org.onosproject.bgpio.protocol.BgpType;
import org.onosproject.bgpio.protocol.BgpVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,7 +31,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides BGP keep alive message.
*/
public class BGPKeepaliveMsgVer4 implements BGPKeepaliveMsg {
public class BgpKeepaliveMsgVer4 implements BgpKeepaliveMsg {
/*
<Keepalive Message>::= <Common Header>
......@@ -56,56 +56,56 @@ public class BGPKeepaliveMsgVer4 implements BGPKeepaliveMsg {
*/
protected static final Logger log = LoggerFactory
.getLogger(BGPKeepaliveMsgVer4.class);
.getLogger(BgpKeepaliveMsgVer4.class);
private BGPHeader bgpMsgHeader;
private BgpHeader bgpMsgHeader;
public static final byte PACKET_VERSION = 4;
public static final int PACKET_MINIMUM_LENGTH = 19;
public static final int MARKER_LENGTH = 16;
public static final BGPType MSG_TYPE = BGPType.KEEP_ALIVE;
public static final BgpType MSG_TYPE = BgpType.KEEP_ALIVE;
public static byte[] marker = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff};
public static final BGPKeepaliveMsgVer4.Reader READER = new Reader();
public static final BgpKeepaliveMsgVer4.Reader READER = new Reader();
/**
* Reader class for reading BGP keepalive message from channel buffer.
*/
static class Reader implements BGPMessageReader<BGPKeepaliveMsg> {
static class Reader implements BgpMessageReader<BgpKeepaliveMsg> {
@Override
public BGPKeepaliveMsg readFrom(ChannelBuffer cb, BGPHeader bgpHeader)
throws BGPParseException {
public BgpKeepaliveMsg readFrom(ChannelBuffer cb, BgpHeader bgpHeader)
throws BgpParseException {
/* bgpHeader is not required in case of keepalive message and
Header is already read and no other fields except header in keepalive message.*/
return new BGPKeepaliveMsgVer4();
return new BgpKeepaliveMsgVer4();
}
}
/**
* Default constructor.
*/
public BGPKeepaliveMsgVer4() {
public BgpKeepaliveMsgVer4() {
}
/**
* Builder class for BGP keepalive message.
*/
static class Builder implements BGPKeepaliveMsg.Builder {
BGPHeader bgpMsgHeader;
static class Builder implements BgpKeepaliveMsg.Builder {
BgpHeader bgpMsgHeader;
@Override
public Builder setHeader(BGPHeader bgpMsgHeader) {
public Builder setHeader(BgpHeader bgpMsgHeader) {
this.bgpMsgHeader = bgpMsgHeader;
return this;
}
@Override
public BGPKeepaliveMsg build() {
return new BGPKeepaliveMsgVer4();
public BgpKeepaliveMsg build() {
return new BgpKeepaliveMsgVer4();
}
}
......@@ -119,10 +119,10 @@ public class BGPKeepaliveMsgVer4 implements BGPKeepaliveMsg {
/**
* Writer class for writing the BGP keepalive message to channel buffer.
*/
static class Writer implements BGPMessageWriter<BGPKeepaliveMsgVer4> {
static class Writer implements BgpMessageWriter<BgpKeepaliveMsgVer4> {
@Override
public void write(ChannelBuffer cb, BGPKeepaliveMsgVer4 message) {
public void write(ChannelBuffer cb, BgpKeepaliveMsgVer4 message) {
// write marker
cb.writeBytes(marker, 0, MARKER_LENGTH);
......@@ -136,17 +136,17 @@ public class BGPKeepaliveMsgVer4 implements BGPKeepaliveMsg {
}
@Override
public BGPVersion getVersion() {
return BGPVersion.BGP_4;
public BgpVersion getVersion() {
return BgpVersion.BGP_4;
}
@Override
public BGPType getType() {
public BgpType getType() {
return MSG_TYPE;
}
@Override
public BGPHeader getHeader() {
public BgpHeader getHeader() {
return this.bgpMsgHeader;
}
......
......@@ -17,12 +17,12 @@
package org.onosproject.bgpio.protocol.ver4;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPFactories;
import org.onosproject.bgpio.protocol.BGPMessage;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpFactories;
import org.onosproject.bgpio.protocol.BgpMessage;
import org.onosproject.bgpio.protocol.BgpMessageReader;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpHeader;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,9 +30,9 @@ import org.slf4j.LoggerFactory;
/**
* Provides BGP messages.
*/
public abstract class BGPMessageVer4 {
public abstract class BgpMessageVer4 {
protected static final Logger log = LoggerFactory.getLogger(BGPFactories.class);
protected static final Logger log = LoggerFactory.getLogger(BgpFactories.class);
static final byte OPEN_MSG_TYPE = 0x1;
static final byte KEEPALIVE_MSG_TYPE = 0x4;
......@@ -42,42 +42,42 @@ public abstract class BGPMessageVer4 {
static final int HEADER_AND_MSG_LEN = 18;
static final int MAXIMUM_PACKET_LENGTH = 4096;
public static final BGPMessageVer4.Reader READER = new Reader();
public static final BgpMessageVer4.Reader READER = new Reader();
/**
* Reader class for reading BGP messages from channel buffer.
*
*/
static class Reader implements BGPMessageReader<BGPMessage> {
static class Reader implements BgpMessageReader<BgpMessage> {
@Override
public BGPMessage readFrom(ChannelBuffer cb, BGPHeader bgpHeader)
throws BGPParseException {
public BgpMessage readFrom(ChannelBuffer cb, BgpHeader bgpHeader)
throws BgpParseException {
if (cb.readableBytes() < MINIMUM_COMMON_HEADER_LENGTH) {
log.error("Packet should have minimum length.");
Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH,
Validation.validateLen(BgpErrorType.MESSAGE_HEADER_ERROR, BgpErrorType.BAD_MESSAGE_LENGTH,
cb.readableBytes());
}
if (cb.readableBytes() > MAXIMUM_PACKET_LENGTH) {
log.error("Packet length should not exceed {}.", MAXIMUM_PACKET_LENGTH);
Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH,
Validation.validateLen(BgpErrorType.MESSAGE_HEADER_ERROR, BgpErrorType.BAD_MESSAGE_LENGTH,
cb.readableBytes());
}
try {
// fixed value property version == 4
byte[] marker = new byte[BGPHeader.MARKER_LENGTH];
cb.readBytes(marker, 0, BGPHeader.MARKER_LENGTH);
byte[] marker = new byte[BgpHeader.MARKER_LENGTH];
cb.readBytes(marker, 0, BgpHeader.MARKER_LENGTH);
bgpHeader.setMarker(marker);
for (int i = 0; i < BGPHeader.MARKER_LENGTH; i++) {
for (int i = 0; i < BgpHeader.MARKER_LENGTH; i++) {
if (marker[i] != (byte) 0xff) {
throw new BGPParseException(BGPErrorType.MESSAGE_HEADER_ERROR,
BGPErrorType.CONNECTION_NOT_SYNCHRONIZED, null);
throw new BgpParseException(BgpErrorType.MESSAGE_HEADER_ERROR,
BgpErrorType.CONNECTION_NOT_SYNCHRONIZED, null);
}
}
short length = cb.readShort();
if (length > cb.readableBytes() + HEADER_AND_MSG_LEN) {
Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR,
BGPErrorType.BAD_MESSAGE_LENGTH, length);
Validation.validateLen(BgpErrorType.MESSAGE_HEADER_ERROR,
BgpErrorType.BAD_MESSAGE_LENGTH, length);
}
bgpHeader.setLength(length);
byte type = cb.readByte();
......@@ -88,23 +88,23 @@ public abstract class BGPMessageVer4 {
switch (type) {
case OPEN_MSG_TYPE:
log.debug("OPEN MESSAGE is received");
return BGPOpenMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
return BgpOpenMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
case KEEPALIVE_MSG_TYPE:
log.debug("KEEPALIVE MESSAGE is received");
return BGPKeepaliveMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
return BgpKeepaliveMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
case UPDATE_MSG_TYPE:
log.debug("UPDATE MESSAGE is received");
return BgpUpdateMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
case NOTIFICATION_MSG_TYPE:
log.debug("NOTIFICATION MESSAGE is received");
return BGPNotificationMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
return BgpNotificationMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
default:
Validation.validateType(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_TYPE, type);
Validation.validateType(BgpErrorType.MESSAGE_HEADER_ERROR, BgpErrorType.BAD_MESSAGE_TYPE, type);
return null;
}
} catch (IndexOutOfBoundsException e) {
throw new BGPParseException(BGPErrorType.MESSAGE_HEADER_ERROR,
BGPErrorType.BAD_MESSAGE_LENGTH, null);
throw new BgpParseException(BgpErrorType.MESSAGE_HEADER_ERROR,
BgpErrorType.BAD_MESSAGE_LENGTH, null);
}
}
}
......
......@@ -16,14 +16,14 @@
package org.onosproject.bgpio.protocol.ver4;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.protocol.BGPMessageWriter;
import org.onosproject.bgpio.protocol.BGPNotificationMsg;
import org.onosproject.bgpio.protocol.BGPType;
import org.onosproject.bgpio.protocol.BGPVersion;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpMessageReader;
import org.onosproject.bgpio.protocol.BgpMessageWriter;
import org.onosproject.bgpio.protocol.BgpNotificationMsg;
import org.onosproject.bgpio.protocol.BgpType;
import org.onosproject.bgpio.protocol.BgpVersion;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -33,7 +33,7 @@ import com.google.common.base.MoreObjects;
* A NOTIFICATION message is sent when an error condition is detected. The BGP connection is closed immediately after it
* is sent.
*/
class BGPNotificationMsgVer4 implements BGPNotificationMsg {
class BgpNotificationMsgVer4 implements BgpNotificationMsg {
/*
0 1 2 3
......@@ -44,32 +44,32 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg {
REFERENCE : RFC 4271
*/
private static final Logger log = LoggerFactory.getLogger(BGPNotificationMsgVer4.class);
private static final Logger log = LoggerFactory.getLogger(BgpNotificationMsgVer4.class);
static final byte PACKET_VERSION = 4;
//BGPHeader(19) + Error code(1) + Error subcode(1)
static final int TOTAL_MESSAGE_MIN_LENGTH = 21;
static final int PACKET_MINIMUM_LENGTH = 2;
static final BGPType MSG_TYPE = BGPType.NOTIFICATION;
static final BgpType MSG_TYPE = BgpType.NOTIFICATION;
static final byte DEFAULT_ERRORSUBCODE = 0;
static final byte[] MARKER = {(byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff };
static final byte MESSAGE_TYPE = 3;
static final BGPHeader DEFAULT_MESSAGE_HEADER = new BGPHeader(MARKER, BGPHeader.DEFAULT_HEADER_LENGTH,
static final BgpHeader DEFAULT_MESSAGE_HEADER = new BgpHeader(MARKER, BgpHeader.DEFAULT_HEADER_LENGTH,
MESSAGE_TYPE);
private byte errorCode;
private byte errorSubCode;
private byte[] data;
private BGPHeader bgpHeader;
public static final BGPNotificationMsgVer4.Reader READER = new Reader();
private BgpHeader bgpHeader;
public static final BgpNotificationMsgVer4.Reader READER = new Reader();
/**
* Initialize fields.
*/
public BGPNotificationMsgVer4() {
public BgpNotificationMsgVer4() {
this.bgpHeader = null;
this.data = null;
this.errorCode = 0;
......@@ -84,7 +84,7 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg {
* @param errorSubCode error subcode
* @param data field
*/
public BGPNotificationMsgVer4(BGPHeader bgpHeader, byte errorCode, byte errorSubCode, byte[] data) {
public BgpNotificationMsgVer4(BgpHeader bgpHeader, byte errorCode, byte errorSubCode, byte[] data) {
this.bgpHeader = bgpHeader;
this.data = data;
this.errorCode = errorCode;
......@@ -94,13 +94,13 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg {
/**
* Reader reads BGP Notification Message from the channel buffer.
*/
static class Reader implements BGPMessageReader<BGPNotificationMsg> {
static class Reader implements BgpMessageReader<BgpNotificationMsg> {
@Override
public BGPNotificationMsg readFrom(ChannelBuffer cb, BGPHeader bgpHeader) throws BGPParseException {
public BgpNotificationMsg readFrom(ChannelBuffer cb, BgpHeader bgpHeader) throws BgpParseException {
byte errorCode;
byte errorSubCode;
if (cb.readableBytes() < PACKET_MINIMUM_LENGTH) {
throw new BGPParseException("Not enough readable bytes");
throw new BgpParseException("Not enough readable bytes");
}
errorCode = cb.readByte();
errorSubCode = cb.readByte();
......@@ -108,31 +108,31 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg {
int dataLength = bgpHeader.getLength() - TOTAL_MESSAGE_MIN_LENGTH;
byte[] data = new byte[dataLength];
cb.readBytes(data, 0, dataLength);
return new BGPNotificationMsgVer4(bgpHeader, errorCode, errorSubCode, data);
return new BgpNotificationMsgVer4(bgpHeader, errorCode, errorSubCode, data);
}
}
/**
* Builder class for BGP notification message.
*/
static class Builder implements BGPNotificationMsg.Builder {
static class Builder implements BgpNotificationMsg.Builder {
private byte errorCode;
private byte errorSubCode;
private byte[] data;
private BGPHeader bgpHeader;
private BgpHeader bgpHeader;
private boolean isErrorCodeSet = false;
private boolean isErrorSubCodeSet = false;
private boolean isBGPHeaderSet = false;
@Override
public BGPNotificationMsg build() throws BGPParseException {
BGPHeader bgpHeader = this.isBGPHeaderSet ? this.bgpHeader : DEFAULT_MESSAGE_HEADER;
public BgpNotificationMsg build() throws BgpParseException {
BgpHeader bgpHeader = this.isBGPHeaderSet ? this.bgpHeader : DEFAULT_MESSAGE_HEADER;
if (!this.isErrorCodeSet) {
throw new BGPParseException("Error code must be present");
throw new BgpParseException("Error code must be present");
}
byte errorSubCode = this.isErrorSubCodeSet ? this.errorSubCode : DEFAULT_ERRORSUBCODE;
return new BGPNotificationMsgVer4(bgpHeader, this.errorCode, errorSubCode, this.data);
return new BgpNotificationMsgVer4(bgpHeader, this.errorCode, errorSubCode, this.data);
}
@Override
......@@ -158,24 +158,24 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg {
}
@Override
public Builder setHeader(BGPHeader bgpMsgHeader) {
public Builder setHeader(BgpHeader bgpMsgHeader) {
this.bgpHeader = bgpMsgHeader;
return this;
}
}
@Override
public BGPVersion getVersion() {
return BGPVersion.BGP_4;
public BgpVersion getVersion() {
return BgpVersion.BGP_4;
}
@Override
public BGPType getType() {
return BGPType.NOTIFICATION;
public BgpType getType() {
return BgpType.NOTIFICATION;
}
@Override
public void writeTo(ChannelBuffer cb) throws BGPParseException {
public void writeTo(ChannelBuffer cb) throws BgpParseException {
WRITER.write(cb, this);
}
......@@ -184,13 +184,13 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg {
/**
* Writer writes BGP notification message to channel buffer.
*/
static class Writer implements BGPMessageWriter<BGPNotificationMsgVer4> {
static class Writer implements BgpMessageWriter<BgpNotificationMsgVer4> {
@Override
public void write(ChannelBuffer cb, BGPNotificationMsgVer4 message) throws BGPParseException {
public void write(ChannelBuffer cb, BgpNotificationMsgVer4 message) throws BgpParseException {
int msgStartIndex = cb.writerIndex();
int headerLenIndex = message.bgpHeader.write(cb);
if (headerLenIndex <= 0) {
throw new BGPParseException(BGPErrorType.MESSAGE_HEADER_ERROR, (byte) 0, null);
throw new BgpParseException(BgpErrorType.MESSAGE_HEADER_ERROR, (byte) 0, null);
}
cb.writeByte(message.errorCode);
cb.writeByte(message.errorSubCode);
......@@ -246,7 +246,7 @@ class BGPNotificationMsgVer4 implements BGPNotificationMsg {
}
@Override
public BGPHeader getHeader() {
public BgpHeader getHeader() {
return this.bgpHeader;
}
......
......@@ -19,11 +19,11 @@ import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.As4Path;
import org.onosproject.bgpio.types.AsPath;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.LocalPref;
import org.onosproject.bgpio.types.Med;
import org.onosproject.bgpio.types.NextHop;
......@@ -58,7 +58,7 @@ public class BgpPathAttributes {
public static final int MPREACHNLRI_TYPE = 14;
public static final int MPUNREACHNLRI_TYPE = 15;
private final List<BGPValueType> pathAttribute;
private final List<BgpValueType> pathAttribute;
/**
* Initialize parameter.
......@@ -72,7 +72,7 @@ public class BgpPathAttributes {
*
* @param pathAttribute list of path attributes
*/
public BgpPathAttributes(List<BGPValueType> pathAttribute) {
public BgpPathAttributes(List<BgpValueType> pathAttribute) {
this.pathAttribute = pathAttribute;
}
......@@ -81,7 +81,7 @@ public class BgpPathAttributes {
*
* @return list of path attributes
*/
public List<BGPValueType> pathAttributes() {
public List<BgpValueType> pathAttributes() {
return this.pathAttribute;
}
......@@ -90,13 +90,13 @@ public class BgpPathAttributes {
*
* @param cb channelBuffer
* @return object of BgpPathAttributes
* @throws BGPParseException while parsing BGP path attributes
* @throws BgpParseException while parsing BGP path attributes
*/
public static BgpPathAttributes read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
BGPValueType pathAttribute = null;
List<BGPValueType> pathAttributeList = new LinkedList<>();
BgpValueType pathAttribute = null;
List<BgpValueType> pathAttributeList = new LinkedList<>();
boolean isOrigin = false;
boolean isAsPath = false;
boolean isNextHop = false;
......@@ -161,27 +161,27 @@ public class BgpPathAttributes {
* @param isNextHop say whether nexthop attribute is present
* @param isMpReach say whether mpreach attribute is present
* @param isMpUnReach say whether mpunreach attribute is present
* @throws BGPParseException if mandatory path attribute is not present
* @throws BgpParseException if mandatory path attribute is not present
*/
public static void checkMandatoryAttr(boolean isOrigin, boolean isAsPath,
boolean isNextHop, boolean isMpReach, boolean isMpUnReach)
throws BGPParseException {
throws BgpParseException {
if (!isOrigin) {
log.debug("Mandatory Attributes not Present");
Validation.validateType(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MISSING_WELLKNOWN_ATTRIBUTE,
Validation.validateType(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MISSING_WELLKNOWN_ATTRIBUTE,
Origin.ORIGIN_TYPE);
}
if (!isAsPath) {
log.debug("Mandatory Attributes not Present");
Validation.validateType(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MISSING_WELLKNOWN_ATTRIBUTE,
Validation.validateType(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MISSING_WELLKNOWN_ATTRIBUTE,
AsPath.ASPATH_TYPE);
}
if (!isMpUnReach && !isMpReach && !isNextHop) {
log.debug("Mandatory Attributes not Present");
Validation.validateType(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MISSING_WELLKNOWN_ATTRIBUTE,
Validation.validateType(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MISSING_WELLKNOWN_ATTRIBUTE,
NextHop.NEXTHOP_TYPE);
}
}
......
......@@ -20,14 +20,14 @@ import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.IpPrefix;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.protocol.BGPType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpMessageReader;
import org.onosproject.bgpio.protocol.BgpType;
import org.onosproject.bgpio.protocol.BgpUpdateMsg;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpHeader;
import org.onosproject.bgpio.util.Validation;
import org.onosproject.bgpio.protocol.BGPVersion;
import org.onosproject.bgpio.protocol.BgpVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -75,12 +75,12 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
public static final int BYTE_IN_BITS = 8;
public static final int MIN_LEN_AFTER_WITHDRW_ROUTES = 2;
public static final int MINIMUM_COMMON_HEADER_LENGTH = 19;
public static final BGPType MSG_TYPE = BGPType.UPDATE;
public static final BgpType MSG_TYPE = BgpType.UPDATE;
public static final BgpUpdateMsgVer4.Reader READER = new Reader();
private List<IpPrefix> withdrawnRoutes;
private BgpPathAttributes bgpPathAttributes;
private BGPHeader bgpHeader;
private BgpHeader bgpHeader;
private List<IpPrefix> nlri;
/**
......@@ -91,7 +91,7 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
* @param bgpPathAttributes BGP Path attributes
* @param nlri Network Layer Reachability Information
*/
public BgpUpdateMsgVer4(BGPHeader bgpHeader, List<IpPrefix> withdrawnRoutes,
public BgpUpdateMsgVer4(BgpHeader bgpHeader, List<IpPrefix> withdrawnRoutes,
BgpPathAttributes bgpPathAttributes, List<IpPrefix> nlri) {
this.bgpHeader = bgpHeader;
this.withdrawnRoutes = withdrawnRoutes;
......@@ -102,15 +102,15 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
/**
* Reader reads BGP Update Message from the channel buffer.
*/
static class Reader implements BGPMessageReader<BgpUpdateMsg> {
static class Reader implements BgpMessageReader<BgpUpdateMsg> {
@Override
public BgpUpdateMsg readFrom(ChannelBuffer cb, BGPHeader bgpHeader)
throws BGPParseException {
public BgpUpdateMsg readFrom(ChannelBuffer cb, BgpHeader bgpHeader)
throws BgpParseException {
if (cb.readableBytes() != (bgpHeader.getLength() - MINIMUM_COMMON_HEADER_LENGTH)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.BAD_MESSAGE_LENGTH, bgpHeader.getLength());
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.BAD_MESSAGE_LENGTH, bgpHeader.getLength());
}
LinkedList<IpPrefix> withDrwRoutes = new LinkedList<>();
......@@ -120,8 +120,8 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
Short withDrwLen = cb.readShort();
if (cb.readableBytes() < withDrwLen) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MALFORMED_ATTRIBUTE_LIST,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MALFORMED_ATTRIBUTE_LIST,
cb.readableBytes());
}
ChannelBuffer tempCb = cb.readBytes(withDrwLen);
......@@ -131,23 +131,23 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
}
if (cb.readableBytes() < MIN_LEN_AFTER_WITHDRW_ROUTES) {
log.debug("Bgp Path Attribute len field not present");
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MALFORMED_ATTRIBUTE_LIST, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MALFORMED_ATTRIBUTE_LIST, null);
}
// Reading Total Path Attribute Length
short totPathAttrLen = cb.readShort();
int len = withDrwLen + totPathAttrLen + PACKET_MINIMUM_LENGTH;
if (len > bgpHeader.getLength()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MALFORMED_ATTRIBUTE_LIST, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MALFORMED_ATTRIBUTE_LIST, null);
}
if (totPathAttrLen != 0) {
// Parsing BGPPathAttributes
if (cb.readableBytes() < totPathAttrLen) {
Validation
.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MALFORMED_ATTRIBUTE_LIST,
.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MALFORMED_ATTRIBUTE_LIST,
cb.readableBytes());
}
tempCb = cb.readBytes(totPathAttrLen);
......@@ -167,10 +167,10 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
*
* @param cb channelBuffer
* @return list of IP Prefix
* @throws BGPParseException while parsing NLRI
* @throws BgpParseException while parsing NLRI
*/
public static LinkedList<IpPrefix> parseNlri(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
LinkedList<IpPrefix> nlri = new LinkedList<>();
while (cb.readableBytes() > 0) {
int length = cb.readByte();
......@@ -186,8 +186,8 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
len = len + 1;
}
if (cb.readableBytes() < len) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MALFORMED_ATTRIBUTE_LIST,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MALFORMED_ATTRIBUTE_LIST,
cb.readableBytes());
}
byte[] prefix = new byte[len];
......@@ -204,10 +204,10 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
*
* @param cb channelBuffer
* @return list of IP prefix
* @throws BGPParseException while parsing withdrawn routes
* @throws BgpParseException while parsing withdrawn routes
*/
public static LinkedList<IpPrefix> parseWithdrawnRoutes(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
LinkedList<IpPrefix> withDrwRoutes = new LinkedList<>();
while (cb.readableBytes() > 0) {
int length = cb.readByte();
......@@ -224,8 +224,8 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
}
if (cb.readableBytes() < len) {
Validation
.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.MALFORMED_ATTRIBUTE_LIST,
.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.MALFORMED_ATTRIBUTE_LIST,
cb.readableBytes());
}
byte[] prefix = new byte[len];
......@@ -238,17 +238,17 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
}
@Override
public BGPVersion getVersion() {
return BGPVersion.BGP_4;
public BgpVersion getVersion() {
return BgpVersion.BGP_4;
}
@Override
public BGPType getType() {
return BGPType.UPDATE;
public BgpType getType() {
return BgpType.UPDATE;
}
@Override
public void writeTo(ChannelBuffer channelBuffer) throws BGPParseException {
public void writeTo(ChannelBuffer channelBuffer) throws BgpParseException {
//Not to be implemented as of now
}
......@@ -268,7 +268,7 @@ public class BgpUpdateMsgVer4 implements BgpUpdateMsg {
}
@Override
public BGPHeader getHeader() {
public BgpHeader getHeader() {
return this.bgpHeader;
}
......
......@@ -26,7 +26,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides AreaID Tlv which contains opaque value (32 Bit Area-ID).
*/
public class AreaIDTlv implements BGPValueType {
public class AreaIDTlv implements BgpValueType {
/* Reference :draft-ietf-idr-ls-distribution-11
* 0 1 2 3
......
......@@ -20,7 +20,7 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
......@@ -31,7 +31,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of As4Path BGP Path Attribute.
*/
public class As4Path implements BGPValueType {
public class As4Path implements BgpValueType {
private static final Logger log = LoggerFactory.getLogger(AsPath.class);
public static final byte AS4PATH_TYPE = 17;
public static final byte ASNUM_SIZE = 4;
......@@ -63,16 +63,16 @@ public class As4Path implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of As4Path
* @throws BGPParseException while parsing As4Path
* @throws BgpParseException while parsing As4Path
*/
public static As4Path read(ChannelBuffer cb) throws BGPParseException {
public static As4Path read(ChannelBuffer cb) throws BgpParseException {
List<Integer> as4pathSet = new ArrayList<>();
List<Integer> as4pathSeq = new ArrayList<>();
ChannelBuffer tempCb = cb.copy();
Validation validation = Validation.parseAttributeHeader(cb);
if (cb.readableBytes() < validation.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
validation.getLength());
}
//if fourth bit is set length is read as short otherwise as byte , len includes type, length and value
......@@ -80,7 +80,7 @@ public class As4Path implements BGPValueType {
.getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
ChannelBuffer data = tempCb.readBytes(len);
if (validation.getFirstBit() && !validation.getSecondBit() && validation.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
ChannelBuffer tempBuf = cb.readBytes(validation.getLength());
......@@ -91,8 +91,8 @@ public class As4Path implements BGPValueType {
//length = no of Ases * ASnum size (4 bytes)
int length = pathSegLen * ASNUM_SIZE;
if (tempBuf.readableBytes() < length) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR, length);
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR, length);
}
ChannelBuffer aspathBuf = tempBuf.readBytes(length);
while (aspathBuf.readableBytes() > 0) {
......
......@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
......@@ -32,7 +32,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of AsPath mandatory BGP Path Attribute.
*/
public class AsPath implements BGPValueType {
public class AsPath implements BgpValueType {
/**
* Enum to provide AS types.
*/
......@@ -94,16 +94,16 @@ public class AsPath implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of AsPath
* @throws BGPParseException while parsing AsPath
* @throws BgpParseException while parsing AsPath
*/
public static AsPath read(ChannelBuffer cb) throws BGPParseException {
public static AsPath read(ChannelBuffer cb) throws BgpParseException {
List<Short> aspathSet = new ArrayList<>();
List<Short> aspathSeq = new ArrayList<>();
ChannelBuffer tempCb = cb.copy();
Validation validation = Validation.parseAttributeHeader(cb);
if (cb.readableBytes() < validation.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
validation.getLength());
}
//if fourth bit is set, length is read as short otherwise as byte , len includes type, length and value
......@@ -111,7 +111,7 @@ public class AsPath implements BGPValueType {
.getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
ChannelBuffer data = tempCb.readBytes(len);
if (validation.getFirstBit() && !validation.getSecondBit() && validation.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
ChannelBuffer tempBuf = cb.readBytes(validation.getLength());
......@@ -121,8 +121,8 @@ public class AsPath implements BGPValueType {
byte pathSegLen = tempBuf.readByte();
int length = pathSegLen * ASNUM_SIZE;
if (tempBuf.readableBytes() < length) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR, length);
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR, length);
}
ChannelBuffer aspathBuf = tempBuf.readBytes(length);
while (aspathBuf.readableBytes() > 0) {
......
......@@ -26,7 +26,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Autonomous System Tlv which contains opaque value (32 Bit AS Number).
*/
public class AutonomousSystemTlv implements BGPValueType {
public class AutonomousSystemTlv implements BgpValueType {
/* Reference :draft-ietf-idr-ls-distribution-11
* 0 1 2 3
......
......@@ -19,8 +19,8 @@ package org.onosproject.bgpio.types;
/**
* BgpErrorType class defines all errorCodes and error Subcodes required for Notification message.
*/
public final class BGPErrorType {
private BGPErrorType() {
public final class BgpErrorType {
private BgpErrorType() {
}
//Error Codes
......
......@@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
* Provides BGP Message Header which is common for all the Messages.
*/
public class BGPHeader {
public class BgpHeader {
/* 0 1 2 3
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
......@@ -40,7 +40,7 @@ public class BGPHeader {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(BGPHeader.class);
protected static final Logger log = LoggerFactory.getLogger(BgpHeader.class);
public static final int MARKER_LENGTH = 16;
public static final short DEFAULT_HEADER_LENGTH = 19;
......@@ -52,7 +52,7 @@ public class BGPHeader {
/**
* Reset fields.
*/
public BGPHeader() {
public BgpHeader() {
this.marker = null;
this.length = 0;
this.type = 0;
......@@ -65,7 +65,7 @@ public class BGPHeader {
* @param length message length
* @param type message type
*/
public BGPHeader(byte[] marker, short length, byte type) {
public BgpHeader(byte[] marker, short length, byte type) {
this.marker = marker;
this.length = length;
this.type = type;
......@@ -148,7 +148,7 @@ public class BGPHeader {
* @param cb ChannelBuffer
* @return object of BGPHeader
*/
public static BGPHeader read(ChannelBuffer cb) {
public static BgpHeader read(ChannelBuffer cb) {
byte[] marker = new byte[MARKER_LENGTH];
byte type;
......@@ -156,6 +156,6 @@ public class BGPHeader {
cb.readBytes(marker, 0, MARKER_LENGTH);
length = cb.readShort();
type = cb.readByte();
return new BGPHeader(marker, length, type);
return new BgpHeader(marker, length, type);
}
}
\ No newline at end of file
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides BGPLSIdentifier Tlv which contains opaque value (32 Bit BGPLS-Identifier).
*/
public class BGPLSIdentifierTlv implements BGPValueType {
public class BgpLSIdentifierTlv implements BgpValueType {
/* Reference :draft-ietf-idr-ls-distribution-11
* 0 1 2 3
......@@ -39,7 +39,7 @@ public class BGPLSIdentifierTlv implements BGPValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(BGPLSIdentifierTlv.class);
protected static final Logger log = LoggerFactory.getLogger(BgpLSIdentifierTlv.class);
public static final short TYPE = 513;
public static final short LENGTH = 4;
......@@ -49,26 +49,26 @@ public class BGPLSIdentifierTlv implements BGPValueType {
/**
* Constructor to initialize bgpLSIdentifier.
*
* @param bgpLSIdentifier BgpLS-Identifier
* @param bgpLSIdentifier BGPLS-Identifier
*/
public BGPLSIdentifierTlv(int bgpLSIdentifier) {
public BgpLSIdentifierTlv(int bgpLSIdentifier) {
this.bgpLSIdentifier = bgpLSIdentifier;
}
/**
* Returns object of this class with specified rbgpLSIdentifier.
*
* @param bgpLSIdentifier BgpLS-Identifier
* @return BgpLS-Identifier
* @param bgpLSIdentifier BGPLS-Identifier
* @return BGPLS-Identifier
*/
public static BGPLSIdentifierTlv of(final int bgpLSIdentifier) {
return new BGPLSIdentifierTlv(bgpLSIdentifier);
public static BgpLSIdentifierTlv of(final int bgpLSIdentifier) {
return new BgpLSIdentifierTlv(bgpLSIdentifier);
}
/**
* Returns opaque value of BgpLS-Identifier.
* Returns opaque value of BGPLS-Identifier.
*
* @return opaque value of BgpLS-Identifier
* @return opaque value of BGPLS-Identifier
*/
public int getBgpLSIdentifier() {
return bgpLSIdentifier;
......@@ -85,8 +85,8 @@ public class BGPLSIdentifierTlv implements BGPValueType {
return true;
}
if (obj instanceof BGPLSIdentifierTlv) {
BGPLSIdentifierTlv other = (BGPLSIdentifierTlv) obj;
if (obj instanceof BgpLSIdentifierTlv) {
BgpLSIdentifierTlv other = (BgpLSIdentifierTlv) obj;
return Objects.equals(bgpLSIdentifier, other.bgpLSIdentifier);
}
return false;
......@@ -107,8 +107,8 @@ public class BGPLSIdentifierTlv implements BGPValueType {
* @param cb ChannelBuffer
* @return object of BGPLSIdentifierTlv
*/
public static BGPLSIdentifierTlv read(ChannelBuffer cb) {
return BGPLSIdentifierTlv.of(cb.readInt());
public static BgpLSIdentifierTlv read(ChannelBuffer cb) {
return BgpLSIdentifierTlv.of(cb.readInt());
}
@Override
......
......@@ -21,7 +21,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
/**
* Abstraction which Provides the BGP of TLV format.
*/
public interface BGPValueType {
public interface BgpValueType {
/**
* Returns the Type of BGP Message.
*
......
......@@ -26,7 +26,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides FourOctetAsNumCapabilityTlv Capability Tlv.
*/
public class FourOctetAsNumCapabilityTlv implements BGPValueType {
public class FourOctetAsNumCapabilityTlv implements BgpValueType {
/**
* support to indicate its support for four-octet AS numbers -CAPABILITY TLV format.
......
......@@ -29,7 +29,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides IP Reachability InformationTlv Tlv which contains IP Prefix.
*/
public class IPReachabilityInformationTlv implements BGPValueType {
public class IPReachabilityInformationTlv implements BgpValueType {
/*
* Reference :draft-ietf-idr-ls-distribution-11
......
......@@ -20,7 +20,7 @@ import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,7 +31,7 @@ import com.google.common.base.Preconditions;
/**
* Provides Implementation of IPv4AddressTlv.
*/
public class IPv4AddressTlv implements BGPValueType {
public class IPv4AddressTlv implements BgpValueType {
private static final Logger log = LoggerFactory.getLogger(IPv4AddressTlv.class);
private static final int LENGTH = 4;
......@@ -95,12 +95,12 @@ public class IPv4AddressTlv implements BGPValueType {
* @param cb channelBuffer
* @param type address type
* @return object of IPv4AddressTlv
* @throws BGPParseException while parsing IPv4AddressTlv
* @throws BgpParseException while parsing IPv4AddressTlv
*/
public static IPv4AddressTlv read(ChannelBuffer cb, short type) throws BGPParseException {
public static IPv4AddressTlv read(ChannelBuffer cb, short type) throws BgpParseException {
InetAddress ipAddress = Validation.toInetAddress(LENGTH, cb);
if (ipAddress.isMulticastAddress()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
}
Ip4Address address = Ip4Address.valueOf(ipAddress);
return IPv4AddressTlv.of(address, type);
......
......@@ -20,7 +20,7 @@ import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip6Address;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,7 +31,7 @@ import com.google.common.base.Preconditions;
/**
* Provides Implementation of IPv6AddressTlv.
*/
public class IPv6AddressTlv implements BGPValueType {
public class IPv6AddressTlv implements BgpValueType {
private static final Logger log = LoggerFactory.getLogger(IPv6AddressTlv.class);
private static final int LENGTH = 16;
......@@ -95,12 +95,12 @@ public class IPv6AddressTlv implements BGPValueType {
* @param cb channelBuffer
* @param type address type
* @return object of IPv6AddressTlv
* @throws BGPParseException while parsing IPv6AddressTlv
* @throws BgpParseException while parsing IPv6AddressTlv
*/
public static IPv6AddressTlv read(ChannelBuffer cb, short type) throws BGPParseException {
public static IPv6AddressTlv read(ChannelBuffer cb, short type) throws BgpParseException {
InetAddress ipAddress = Validation.toInetAddress(LENGTH, cb);
if (ipAddress.isMulticastAddress()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
}
Ip6Address address = Ip6Address.valueOf(ipAddress);
return IPv6AddressTlv.of(address, type);
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of IsIsNonPseudonode Tlv.
*/
public class IsIsNonPseudonode implements IGPRouterID, BGPValueType {
public class IsIsNonPseudonode implements IGPRouterID, BgpValueType {
private static final Logger log = LoggerFactory.getLogger(IsIsNonPseudonode.class);
public static final short TYPE = 515;
......
......@@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides implementation of IsIsPseudonode Tlv.
*/
public class IsIsPseudonode implements IGPRouterID, BGPValueType {
public class IsIsPseudonode implements IGPRouterID, BgpValueType {
private static final Logger log = LoggerFactory.getLogger(IsIsPseudonode.class);
public static final short TYPE = 515;
......
......@@ -26,7 +26,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of Link Local/Remote IdentifiersTlv.
*/
public class LinkLocalRemoteIdentifiersTlv implements BGPValueType {
public class LinkLocalRemoteIdentifiersTlv implements BgpValueType {
private static final Logger log = LoggerFactory.getLogger(LinkLocalRemoteIdentifiersTlv.class);
public static final short TYPE = 258;
private static final int LENGTH = 8;
......
......@@ -19,7 +19,7 @@ import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.attr.BgpAttrNodeFlagBitTlv;
import org.onosproject.bgpio.types.attr.BgpAttrNodeIsIsAreaId;
import org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId;
......@@ -52,7 +52,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP Link state attribute.
*/
public class LinkStateAttributes implements BGPValueType {
public class LinkStateAttributes implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(LinkStateAttributes.class);
......@@ -92,7 +92,7 @@ public class LinkStateAttributes implements BGPValueType {
public static final byte LINKSTATE_ATTRIB_TYPE = 50;
public static final byte TYPE_AND_LEN = 4;
private boolean isLinkStateAttribute = false;
private List<BGPValueType> linkStateAttribList;
private List<BgpValueType> linkStateAttribList;
/**
* Constructor to reset parameters.
......@@ -106,7 +106,7 @@ public class LinkStateAttributes implements BGPValueType {
*
* @param linkStateAttribList Linked list of Link, Node and Prefix TLVs
*/
LinkStateAttributes(List<BGPValueType> linkStateAttribList) {
LinkStateAttributes(List<BgpValueType> linkStateAttribList) {
this.linkStateAttribList = linkStateAttribList;
this.isLinkStateAttribute = true;
}
......@@ -116,7 +116,7 @@ public class LinkStateAttributes implements BGPValueType {
*
* @return linked list of Link, Node and Prefix TLVs
*/
public List<BGPValueType> linkStateAttributes() {
public List<BgpValueType> linkStateAttributes() {
return this.linkStateAttribList;
}
......@@ -134,10 +134,10 @@ public class LinkStateAttributes implements BGPValueType {
*
* @param cb ChannelBuffer
* @return constructor of LinkStateAttributes
* @throws BGPParseException while parsing link state attributes
* @throws BgpParseException while parsing link state attributes
*/
public static LinkStateAttributes read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
ChannelBuffer tempBuf = cb;
Validation parseFlags = Validation.parseAttributeHeader(cb);
......@@ -147,20 +147,20 @@ public class LinkStateAttributes implements BGPValueType {
ChannelBuffer data = tempBuf.readBytes(len);
if (!parseFlags.getFirstBit() || parseFlags.getSecondBit()
|| parseFlags.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_FLAGS_ERROR,
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_FLAGS_ERROR,
data);
}
if (cb.readableBytes() < parseFlags.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.BAD_MESSAGE_LENGTH,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.BAD_MESSAGE_LENGTH,
parseFlags.getLength());
}
BGPValueType bgpLSAttrib = null;
LinkedList<BGPValueType> linkStateAttribList;
linkStateAttribList = new LinkedList<BGPValueType>();
BgpValueType bgpLSAttrib = null;
LinkedList<BgpValueType> linkStateAttribList;
linkStateAttribList = new LinkedList<BgpValueType>();
ChannelBuffer tempCb = cb.readBytes(parseFlags.getLength());
while (tempCb.readableBytes() > 0) {
short tlvCodePoint = tempCb.readShort();
......@@ -279,8 +279,8 @@ public class LinkStateAttributes implements BGPValueType {
break;
default:
throw new BGPParseException(
"The BGP-LS Attribute is not supported : "
throw new BgpParseException(
"The Bgp-LS Attribute is not supported : "
+ tlvCodePoint);
}
......
......@@ -18,7 +18,7 @@ package org.onosproject.bgpio.types;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides implementation of LocalPref BGP Path Attribute.
*/
public class LocalPref implements BGPValueType {
public class LocalPref implements BgpValueType {
public static final byte LOCAL_PREF_TYPE = 5;
public static final byte LOCAL_PREF_MAX_LEN = 4;
......@@ -56,14 +56,14 @@ public class LocalPref implements BGPValueType {
*
* @param cb channelBuffer
* @return object of LocalPref
* @throws BGPParseException while parsing localPref attribute
* @throws BgpParseException while parsing localPref attribute
*/
public static LocalPref read(ChannelBuffer cb) throws BGPParseException {
public static LocalPref read(ChannelBuffer cb) throws BgpParseException {
int localPref;
ChannelBuffer tempCb = cb.copy();
Validation parseFlags = Validation.parseAttributeHeader(cb);
if ((parseFlags.getLength() > LOCAL_PREF_MAX_LEN) || cb.readableBytes() < parseFlags.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
parseFlags.getLength());
}
......@@ -71,7 +71,7 @@ public class LocalPref implements BGPValueType {
Constants.TYPE_AND_LEN_AS_SHORT : parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
ChannelBuffer data = tempCb.readBytes(len);
if (parseFlags.getFirstBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
localPref = cb.readInt();
......
......@@ -18,7 +18,7 @@ package org.onosproject.bgpio.types;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of Med BGP Path Attribute.
*/
public class Med implements BGPValueType {
public class Med implements BgpValueType {
public static final byte MED_TYPE = 4;
public static final byte MED_MAX_LEN = 4;
......@@ -56,22 +56,22 @@ public class Med implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of Med
* @throws BGPParseException while parsing Med path attribute
* @throws BgpParseException while parsing Med path attribute
*/
public static Med read(ChannelBuffer cb) throws BGPParseException {
public static Med read(ChannelBuffer cb) throws BgpParseException {
int med;
ChannelBuffer tempCb = cb.copy();
Validation parseFlags = Validation.parseAttributeHeader(cb);
if ((parseFlags.getLength() > MED_MAX_LEN) || cb.readableBytes() < parseFlags.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
parseFlags.getLength());
}
int len = parseFlags.isShort() ? parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_SHORT : parseFlags
.getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
ChannelBuffer data = tempCb.readBytes(len);
if (!parseFlags.getFirstBit() && parseFlags.getSecondBit() && parseFlags.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
med = cb.readInt();
......
......@@ -22,10 +22,10 @@ import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPLSNlri;
import org.onosproject.bgpio.protocol.linkstate.BGPPrefixIPv4LSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpLSNlri;
import org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
......@@ -37,14 +37,14 @@ import com.google.common.base.MoreObjects;
/*
* Provides Implementation of MpReach Nlri BGP Path Attribute.
*/
public class MpReachNlri implements BGPValueType {
public class MpReachNlri implements BgpValueType {
private static final Logger log = LoggerFactory.getLogger(MpReachNlri.class);
public static final byte MPREACHNLRI_TYPE = 14;
public static final byte LINK_NLRITYPE = 2;
private boolean isMpReachNlri = false;
private final List<BGPLSNlri> mpReachNlri;
private final List<BgpLSNlri> mpReachNlri;
private final int length;
private final short afi;
private final byte safi;
......@@ -59,7 +59,7 @@ public class MpReachNlri implements BGPValueType {
* @param ipNextHop nexthop IpAddress
* @param length of MpReachNlri
*/
public MpReachNlri(List<BGPLSNlri> mpReachNlri, short afi, byte safi, Ip4Address ipNextHop, int length) {
public MpReachNlri(List<BgpLSNlri> mpReachNlri, short afi, byte safi, Ip4Address ipNextHop, int length) {
this.mpReachNlri = mpReachNlri;
this.isMpReachNlri = true;
this.ipNextHop = ipNextHop;
......@@ -82,7 +82,7 @@ public class MpReachNlri implements BGPValueType {
*
* @return list of MpReach Nlri
*/
public List<BGPLSNlri> mpReachNlri() {
public List<BgpLSNlri> mpReachNlri() {
return this.mpReachNlri;
}
......@@ -100,9 +100,9 @@ public class MpReachNlri implements BGPValueType {
*
* @param cb channelBuffer
* @return object of MpReachNlri
* @throws BGPParseException while parsing MpReachNlri
* @throws BgpParseException while parsing MpReachNlri
*/
public static MpReachNlri read(ChannelBuffer cb) throws BGPParseException {
public static MpReachNlri read(ChannelBuffer cb) throws BgpParseException {
ChannelBuffer tempBuf = cb.copy();
Validation parseFlags = Validation.parseAttributeHeader(cb);
int len = parseFlags.isShort() ? parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_SHORT :
......@@ -110,15 +110,15 @@ public class MpReachNlri implements BGPValueType {
ChannelBuffer data = tempBuf.readBytes(len);
if (cb.readableBytes() < parseFlags.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
parseFlags.getLength());
}
if (!parseFlags.getFirstBit() && parseFlags.getSecondBit() && parseFlags.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
BGPLSNlri bgpLSNlri = null;
List<BGPLSNlri> mpReachNlri = new LinkedList<>();
BgpLSNlri bgpLSNlri = null;
List<BgpLSNlri> mpReachNlri = new LinkedList<>();
ChannelBuffer tempCb = cb.readBytes(parseFlags.getLength());
short afi = 0;
byte safi = 0;
......@@ -133,7 +133,7 @@ public class MpReachNlri implements BGPValueType {
byte nextHopLen = tempCb.readByte();
InetAddress ipAddress = Validation.toInetAddress(nextHopLen, cb);
if (ipAddress.isMulticastAddress()) {
throw new BGPParseException("Multicast not supported");
throw new BgpParseException("Multicast not supported");
}
ipNextHop = Ip4Address.valueOf(ipAddress);
byte reserved = tempCb.readByte();
......@@ -142,19 +142,19 @@ public class MpReachNlri implements BGPValueType {
short nlriType = tempCb.readShort();
short totNlriLen = tempCb.readShort();
if (tempCb.readableBytes() < totNlriLen) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen);
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen);
}
tempBuf = tempCb.readBytes(totNlriLen);
switch (nlriType) {
case BGPNodeLSNlriVer4.NODE_NLRITYPE:
bgpLSNlri = BGPNodeLSNlriVer4.read(tempBuf, afi, safi);
case BgpNodeLSNlriVer4.NODE_NLRITYPE:
bgpLSNlri = BgpNodeLSNlriVer4.read(tempBuf, afi, safi);
break;
case BgpLinkLsNlriVer4.LINK_NLRITYPE:
bgpLSNlri = BgpLinkLsNlriVer4.read(tempBuf, afi, safi);
break;
case BGPPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE:
bgpLSNlri = BGPPrefixIPv4LSNlriVer4.read(tempBuf, afi, safi);
case BgpPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE:
bgpLSNlri = BgpPrefixIPv4LSNlriVer4.read(tempBuf, afi, safi);
break;
default:
log.debug("nlriType not supported" + nlriType);
......@@ -162,7 +162,7 @@ public class MpReachNlri implements BGPValueType {
mpReachNlri.add(bgpLSNlri);
}
} else {
throw new BGPParseException("Not Supporting afi " + afi + "safi " + safi);
throw new BgpParseException("Not Supporting afi " + afi + "safi " + safi);
}
}
return new MpReachNlri(mpReachNlri, afi, safi, ipNextHop, parseFlags.getLength());
......
......@@ -20,10 +20,10 @@ import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPLSNlri;
import org.onosproject.bgpio.protocol.linkstate.BGPNodeLSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BGPPrefixIPv4LSNlriVer4;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpLSNlri;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
......@@ -35,7 +35,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of MpUnReach Nlri BGP Path Attribute.
*/
public class MpUnReachNlri implements BGPValueType {
public class MpUnReachNlri implements BgpValueType {
private static final Logger log = LoggerFactory.getLogger(MpUnReachNlri.class);
public static final byte MPUNREACHNLRI_TYPE = 15;
......@@ -44,7 +44,7 @@ public class MpUnReachNlri implements BGPValueType {
private boolean isMpUnReachNlri = false;
private final short afi;
private final byte safi;
private final List<BGPLSNlri> mpUnReachNlri;
private final List<BgpLSNlri> mpUnReachNlri;
private final int length;
/**
......@@ -55,7 +55,7 @@ public class MpUnReachNlri implements BGPValueType {
* @param safi subsequent address family identifier
* @param length of MpUnReachNlri
*/
public MpUnReachNlri(List<BGPLSNlri> mpUnReachNlri, short afi, byte safi,
public MpUnReachNlri(List<BgpLSNlri> mpUnReachNlri, short afi, byte safi,
int length) {
this.mpUnReachNlri = mpUnReachNlri;
this.isMpUnReachNlri = true;
......@@ -69,9 +69,9 @@ public class MpUnReachNlri implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of MpUnReachNlri
* @throws BGPParseException while parsing MpUnReachNlri
* @throws BgpParseException while parsing MpUnReachNlri
*/
public static MpUnReachNlri read(ChannelBuffer cb) throws BGPParseException {
public static MpUnReachNlri read(ChannelBuffer cb) throws BgpParseException {
ChannelBuffer tempBuf = cb.copy();
Validation parseFlags = Validation.parseAttributeHeader(cb);
int len = parseFlags.isShort() ? parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_SHORT
......@@ -80,17 +80,17 @@ public class MpUnReachNlri implements BGPValueType {
if (!parseFlags.getFirstBit() && parseFlags.getSecondBit()
&& parseFlags.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
if (cb.readableBytes() < parseFlags.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR, parseFlags.getLength());
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR, parseFlags.getLength());
}
LinkedList<BGPLSNlri> mpUnReachNlri = new LinkedList<>();
BGPLSNlri bgpLSNlri = null;
LinkedList<BgpLSNlri> mpUnReachNlri = new LinkedList<>();
BgpLSNlri bgpLSNlri = null;
short afi = 0;
byte safi = 0;
ChannelBuffer tempCb = cb.readBytes(parseFlags.getLength());
......@@ -106,19 +106,19 @@ public class MpUnReachNlri implements BGPValueType {
short totNlriLen = tempCb.readShort();
if (tempCb.readableBytes() < totNlriLen) {
Validation.validateLen(
BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen);
BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR, totNlriLen);
}
tempBuf = tempCb.readBytes(totNlriLen);
switch (nlriType) {
case BGPNodeLSNlriVer4.NODE_NLRITYPE:
bgpLSNlri = BGPNodeLSNlriVer4.read(tempBuf, afi, safi);
case BgpNodeLSNlriVer4.NODE_NLRITYPE:
bgpLSNlri = BgpNodeLSNlriVer4.read(tempBuf, afi, safi);
break;
case BgpLinkLsNlriVer4.LINK_NLRITYPE:
bgpLSNlri = BgpLinkLsNlriVer4.read(tempBuf, afi, safi);
break;
case BGPPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE:
bgpLSNlri = BGPPrefixIPv4LSNlriVer4.read(tempBuf, afi,
case BgpPrefixIPv4LSNlriVer4.PREFIX_IPV4_NLRITYPE:
bgpLSNlri = BgpPrefixIPv4LSNlriVer4.read(tempBuf, afi,
safi);
break;
default:
......@@ -128,7 +128,7 @@ public class MpUnReachNlri implements BGPValueType {
}
} else {
//TODO: check with the values got from capability
throw new BGPParseException("Not Supporting afi " + afi
throw new BgpParseException("Not Supporting afi " + afi
+ "safi " + safi);
}
}
......@@ -164,7 +164,7 @@ public class MpUnReachNlri implements BGPValueType {
*
* @return list of MpUnReach Nlri
*/
public List<BGPLSNlri> mpUnReachNlri() {
public List<BgpLSNlri> mpUnReachNlri() {
return this.mpUnReachNlri;
}
......
......@@ -25,7 +25,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides MultiProtocolExtnCapabilityTlv.
*/
public class MultiProtocolExtnCapabilityTlv implements BGPValueType {
public class MultiProtocolExtnCapabilityTlv implements BgpValueType {
/*
0 7 15 23 31
......@@ -141,7 +141,7 @@ public class MultiProtocolExtnCapabilityTlv implements BGPValueType {
* @param cb of type channel buffer
* @return object of MultiProtocolExtnCapabilityTlv
*/
public static BGPValueType read(ChannelBuffer cb) {
public static BgpValueType read(ChannelBuffer cb) {
short afi = cb.readShort();
byte res = cb.readByte();
byte safi = cb.readByte();
......
......@@ -20,7 +20,7 @@ import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
......@@ -30,7 +30,7 @@ import com.google.common.base.Preconditions;
/**
* Implementation of NextHop BGP Path Attribute.
*/
public class NextHop implements BGPValueType {
public class NextHop implements BgpValueType {
public static final byte NEXTHOP_TYPE = 3;
private boolean isNextHop = false;
......@@ -60,27 +60,27 @@ public class NextHop implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of NextHop
* @throws BGPParseException while parsing nexthop attribute
* @throws BgpParseException while parsing nexthop attribute
*/
public static NextHop read(ChannelBuffer cb) throws BGPParseException {
public static NextHop read(ChannelBuffer cb) throws BgpParseException {
Ip4Address nextHop;
ChannelBuffer tempCb = cb.copy();
Validation parseFlags = Validation.parseAttributeHeader(cb);
if (cb.readableBytes() < parseFlags.getLength()) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
parseFlags.getLength());
}
int len = parseFlags.isShort() ? parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_SHORT : parseFlags
.getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
ChannelBuffer data = tempCb.readBytes(len);
if (parseFlags.getFirstBit() && !parseFlags.getSecondBit() && parseFlags.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
InetAddress ipAddress = Validation.toInetAddress(parseFlags.getLength(), cb);
if (ipAddress.isMulticastAddress()) {
throw new BGPParseException("Multicast address is not supported");
throw new BgpParseException("Multicast address is not supported");
}
nextHop = Ip4Address.valueOf(ipAddress);
......
......@@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides implementation of OSPFNonPseudonode Tlv.
*/
public class OSPFNonPseudonode implements IGPRouterID, BGPValueType {
public class OSPFNonPseudonode implements IGPRouterID, BgpValueType {
protected static final Logger log = LoggerFactory.getLogger(OSPFNonPseudonode.class);
......
......@@ -28,7 +28,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides implementation of OSPFPseudonode Tlv.
*/
public class OSPFPseudonode implements IGPRouterID, BGPValueType {
public class OSPFPseudonode implements IGPRouterID, BgpValueType {
protected static final Logger log = LoggerFactory.getLogger(OSPFPseudonode.class);
......
......@@ -18,7 +18,7 @@ package org.onosproject.bgpio.types;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides OSPF Route Type Tlv which contains route type.
*/
public class OSPFRouteTypeTlv implements BGPValueType {
public class OSPFRouteTypeTlv implements BgpValueType {
/* Reference :draft-ietf-idr-ls-distribution-11
0 1 2 3
......@@ -90,9 +90,9 @@ public class OSPFRouteTypeTlv implements BGPValueType {
* Returns RouteType.
*
* @return RouteType
* @throws BGPParseException if routeType is not matched
* @throws BgpParseException if routeType is not matched
*/
public ROUTETYPE getValue() throws BGPParseException {
public ROUTETYPE getValue() throws BgpParseException {
switch (routeType) {
case INTRA_AREA_TYPE:
return ROUTETYPE.Intra_Area;
......@@ -107,7 +107,7 @@ public class OSPFRouteTypeTlv implements BGPValueType {
case NSSA_TYPE_2:
return ROUTETYPE.NSSA_2;
default:
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
}
}
......
......@@ -18,7 +18,7 @@ package org.onosproject.bgpio.types;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides Implementation of mandatory BGP Origin path attribute.
*/
public class Origin implements BGPValueType {
public class Origin implements BgpValueType {
/**
* Enum to provide ORIGIN types.
......@@ -99,9 +99,9 @@ public class Origin implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of Origin
* @throws BGPParseException while parsing Origin path attribute
* @throws BgpParseException while parsing Origin path attribute
*/
public static Origin read(ChannelBuffer cb) throws BGPParseException {
public static Origin read(ChannelBuffer cb) throws BgpParseException {
ChannelBuffer tempCb = cb.copy();
Validation parseFlags = Validation.parseAttributeHeader(cb);
......@@ -109,18 +109,18 @@ public class Origin implements BGPValueType {
.getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
ChannelBuffer data = tempCb.readBytes(len);
if ((parseFlags.getLength() > ORIGIN_VALUE_LEN) || (cb.readableBytes() < parseFlags.getLength())) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
parseFlags.getLength());
}
if (parseFlags.getFirstBit() && !parseFlags.getSecondBit() && parseFlags.getThirdBit()) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.ATTRIBUTE_FLAGS_ERROR, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
}
byte originValue;
originValue = cb.readByte();
if ((originValue != ORIGINTYPE.INCOMPLETE.value) && (originValue != ORIGINTYPE.IGP.value) &&
(originValue != ORIGINTYPE.EGP.value)) {
throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.INVALID_ORIGIN_ATTRIBUTE, data);
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.INVALID_ORIGIN_ATTRIBUTE, data);
}
return new Origin(originValue);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute node flag.
*/
public final class BgpAttrNodeFlagBitTlv implements BGPValueType {
public final class BgpAttrNodeFlagBitTlv implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpAttrNodeFlagBitTlv.class);
......@@ -86,10 +86,10 @@ public final class BgpAttrNodeFlagBitTlv implements BGPValueType {
*
* @param cb ChannelBuffer
* @return attribute node flag bit tlv
* @throws BGPParseException while parsing BgpAttrNodeFlagBitTlv
* @throws BgpParseException while parsing BgpAttrNodeFlagBitTlv
*/
public static BgpAttrNodeFlagBitTlv read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
boolean bOverloadBit = false;
boolean bAttachedBit = false;
boolean bExternalBit = false;
......@@ -98,8 +98,8 @@ public final class BgpAttrNodeFlagBitTlv implements BGPValueType {
short lsAttrLength = cb.readShort();
if ((lsAttrLength != 1) || (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute ISIS Area Identifier.
*/
public class BgpAttrNodeIsIsAreaId implements BGPValueType {
public class BgpAttrNodeIsIsAreaId implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpAttrNodeIsIsAreaId.class);
......@@ -64,17 +64,17 @@ public class BgpAttrNodeIsIsAreaId implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpAttrNodeIsIsAreaId
* @throws BGPParseException while parsing BgpAttrNodeIsIsAreaId
* @throws BgpParseException while parsing BgpAttrNodeIsIsAreaId
*/
public static BgpAttrNodeIsIsAreaId read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
byte[] isisAreaId;
short lsAttrLength = cb.readShort();
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -20,9 +20,9 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -32,7 +32,7 @@ import com.google.common.base.MoreObjects;
/**
* BGP Multi-Topology ID of the LS attribute.
*/
public class BgpAttrNodeMultiTopologyId implements BGPValueType {
public class BgpAttrNodeMultiTopologyId implements BgpValueType {
private static final Logger log = LoggerFactory
.getLogger(BgpAttrNodeMultiTopologyId.class);
......@@ -66,18 +66,18 @@ public class BgpAttrNodeMultiTopologyId implements BGPValueType {
*
* @param cb ChannelBuffer
* @return Constructor of BgpAttrNodeMultiTopologyId
* @throws BGPParseException while parsing BgpAttrNodeMultiTopologyId
* @throws BgpParseException while parsing BgpAttrNodeMultiTopologyId
*/
public static BgpAttrNodeMultiTopologyId read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
ArrayList<Short> multiTopologyId = new ArrayList<Short>();
short tempMultiTopologyId;
short lsAttrLength = cb.readShort();
int len = lsAttrLength / 2; // Length is 2*n and n is the number of MT-IDs
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute node name.
*/
public class BgpAttrNodeName implements BGPValueType {
public class BgpAttrNodeName implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpAttrNodeName.class);
......@@ -64,17 +64,17 @@ public class BgpAttrNodeName implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpAttrNodeName
* @throws BGPParseException while parsing BgpAttrNodeName
* @throws BgpParseException while parsing BgpAttrNodeName
*/
public static BgpAttrNodeName read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
byte[] nodeName;
short lsAttrLength = cb.readShort();
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute opaque node.
*/
public class BgpAttrOpaqueNode implements BGPValueType {
public class BgpAttrOpaqueNode implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpAttrOpaqueNode.class);
......@@ -64,18 +64,18 @@ public class BgpAttrOpaqueNode implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpAttrOpaqueNode
* @throws BGPParseException while parsing BgpAttrOpaqueNode
* @throws BgpParseException while parsing BgpAttrOpaqueNode
*/
public static BgpAttrOpaqueNode read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
byte[] opaqueNodeAttribute;
short lsAttrLength = cb.readShort();
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -19,9 +19,9 @@ import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,7 +31,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute node router ID.
*/
public final class BgpAttrRouterIdV4 implements BGPValueType {
public final class BgpAttrRouterIdV4 implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpAttrRouterIdV4.class);
......@@ -70,15 +70,15 @@ public final class BgpAttrRouterIdV4 implements BGPValueType {
* @param cb ChannelBuffer
* @param sType tag type
* @return object of BgpAttrRouterIdV4
* @throws BGPParseException while parsing BgpAttrRouterIdV4
* @throws BgpParseException while parsing BgpAttrRouterIdV4
*/
public static BgpAttrRouterIdV4 read(ChannelBuffer cb, short sType)
throws BGPParseException {
throws BgpParseException {
short lsAttrLength = cb.readShort();
if ((lsAttrLength != 4) || (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -19,9 +19,9 @@ import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip6Address;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,7 +31,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute IPv6 router ID.
*/
public final class BgpAttrRouterIdV6 implements BGPValueType {
public final class BgpAttrRouterIdV6 implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpAttrRouterIdV6.class);
......@@ -70,18 +70,18 @@ public final class BgpAttrRouterIdV6 implements BGPValueType {
* @param cb ChannelBuffer
* @param sType TLV type
* @return object of BgpAttrRouterIdV6
* @throws BGPParseException while parsing BgpAttrRouterIdV6
* @throws BgpParseException while parsing BgpAttrRouterIdV6
*/
public static BgpAttrRouterIdV6 read(ChannelBuffer cb, short sType)
throws BGPParseException {
throws BgpParseException {
byte[] ipBytes;
Ip6Address ip6RouterId;
short lsAttrLength = cb.readShort();
if ((lsAttrLength != 16) || (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP link IGP metric attribute.
*/
public class BgpLinkAttrIgpMetric implements BGPValueType {
public class BgpLinkAttrIgpMetric implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrIgpMetric.class);
......@@ -75,10 +75,10 @@ public class BgpLinkAttrIgpMetric implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrIgpMetric
* @throws BGPParseException while parsing BgpLinkAttrIgpMetric
* @throws BgpParseException while parsing BgpLinkAttrIgpMetric
*/
public static BgpLinkAttrIgpMetric read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
short linkigp;
int igpMetric = 0;
......@@ -88,8 +88,8 @@ public class BgpLinkAttrIgpMetric implements BGPValueType {
if (cb.readableBytes() < lsAttrLength
|| lsAttrLength > ATTRLINK_MAX_LEN) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute Is Is Administrative area.
*/
public final class BgpLinkAttrIsIsAdminstGrp implements BGPValueType {
public final class BgpLinkAttrIsIsAdminstGrp implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrIsIsAdminstGrp.class);
......@@ -65,17 +65,17 @@ public final class BgpLinkAttrIsIsAdminstGrp implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrIsIsAdminstGrp
* @throws BGPParseException while parsing BgpLinkAttrIsIsAdminstGrp
* @throws BgpParseException while parsing BgpLinkAttrIsIsAdminstGrp
*/
public static BgpLinkAttrIsIsAdminstGrp read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
long isisAdminGrp;
short lsAttrLength = cb.readShort();
if ((lsAttrLength != ISIS_ADMIN_DATA_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP attribute Max Link bandwidth.
*/
public final class BgpLinkAttrMaxLinkBandwidth implements BGPValueType {
public final class BgpLinkAttrMaxLinkBandwidth implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrMaxLinkBandwidth.class);
......@@ -72,17 +72,17 @@ public final class BgpLinkAttrMaxLinkBandwidth implements BGPValueType {
* @param cb Channel buffer
* @param type type of this tlv
* @return object of type BgpLinkAttrMaxLinkBandwidth
* @throws BGPParseException while parsing BgpLinkAttrMaxLinkBandwidth
* @throws BgpParseException while parsing BgpLinkAttrMaxLinkBandwidth
*/
public static BgpLinkAttrMaxLinkBandwidth read(ChannelBuffer cb, short type)
throws BGPParseException {
throws BgpParseException {
float maxBandwidth;
short lsAttrLength = cb.readShort();
if ((lsAttrLength != MAX_BANDWIDTH_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP MPLS protocol mask attribute.
*/
public class BgpLinkAttrMplsProtocolMask implements BGPValueType {
public class BgpLinkAttrMplsProtocolMask implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrMplsProtocolMask.class);
......@@ -72,10 +72,10 @@ public class BgpLinkAttrMplsProtocolMask implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrMPLSProtocolMask
* @throws BGPParseException while parsing BgpLinkAttrMplsProtocolMask
* @throws BgpParseException while parsing BgpLinkAttrMplsProtocolMask
*/
public static BgpLinkAttrMplsProtocolMask read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
boolean bLdp = false;
boolean bRsvpTe = false;
......@@ -83,8 +83,8 @@ public class BgpLinkAttrMplsProtocolMask implements BGPValueType {
if ((lsAttrLength != MASK_BYTE_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP link name attribute.
*/
public class BgpLinkAttrName implements BGPValueType {
public class BgpLinkAttrName implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrName.class);
......@@ -64,16 +64,16 @@ public class BgpLinkAttrName implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrName
* @throws BGPParseException while parsing BgpLinkAttrName
* @throws BgpParseException while parsing BgpLinkAttrName
*/
public static BgpLinkAttrName read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
byte[] linkName;
short lsAttrLength = cb.readShort();
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP link opaque attribute.
*/
public final class BgpLinkAttrOpaqLnkAttrib implements BGPValueType {
public final class BgpLinkAttrOpaqLnkAttrib implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrOpaqLnkAttrib.class);
......@@ -65,18 +65,18 @@ public final class BgpLinkAttrOpaqLnkAttrib implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrOpaqLnkAttrib
* @throws BGPParseException while parsing BgpLinkAttrOpaqLnkAttrib
* @throws BgpParseException while parsing BgpLinkAttrOpaqLnkAttrib
*/
public static BgpLinkAttrOpaqLnkAttrib read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
byte[] opaqueLinkAttribute;
short lsAttrLength = cb.readShort();
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP link protection type attribute.
*/
public final class BgpLinkAttrProtectionType implements BGPValueType {
public final class BgpLinkAttrProtectionType implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrProtectionType.class);
......@@ -102,10 +102,10 @@ public final class BgpLinkAttrProtectionType implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrProtectionType
* @throws BGPParseException while parsing BgpLinkAttrProtectionType
* @throws BgpParseException while parsing BgpLinkAttrProtectionType
*/
public static BgpLinkAttrProtectionType read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
short linkProtectionType;
byte higherByte;
short lsAttrLength = cb.readShort();
......@@ -119,8 +119,8 @@ public final class BgpLinkAttrProtectionType implements BGPValueType {
if ((lsAttrLength != LINK_PROTECTION_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -20,9 +20,9 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import com.google.common.base.MoreObjects;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP link Shared Risk Link Group attribute.
*/
public class BgpLinkAttrSrlg implements BGPValueType {
public class BgpLinkAttrSrlg implements BgpValueType {
public static final short ATTRNODE_SRLG = 1097;
......@@ -61,10 +61,10 @@ public class BgpLinkAttrSrlg implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrSrlg
* @throws BGPParseException while parsing BgpLinkAttrSrlg
* @throws BgpParseException while parsing BgpLinkAttrSrlg
*/
public static BgpLinkAttrSrlg read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
int tempSrlg;
ArrayList<Integer> sRlg = new ArrayList<Integer>();
......@@ -72,8 +72,8 @@ public class BgpLinkAttrSrlg implements BGPValueType {
int len = lsAttrLength / Integer.SIZE; // each element is of 4 octets
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP link state Default TE metric link attribute.
*/
public class BgpLinkAttrTeDefaultMetric implements BGPValueType {
public class BgpLinkAttrTeDefaultMetric implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrTeDefaultMetric.class);
......@@ -66,18 +66,18 @@ public class BgpLinkAttrTeDefaultMetric implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrTeDefaultMetric
* @throws BGPParseException while parsing BgpLinkAttrTeDefaultMetric
* @throws BgpParseException while parsing BgpLinkAttrTeDefaultMetric
*/
public static BgpLinkAttrTeDefaultMetric read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
int linkTeMetric;
short lsAttrLength = cb.readShort();
if ((lsAttrLength != TE_DATA_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -20,9 +20,9 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -32,7 +32,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP unreserved bandwidth attribute.
*/
public class BgpLinkAttrUnRsrvdLinkBandwidth implements BGPValueType {
public class BgpLinkAttrUnRsrvdLinkBandwidth implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpLinkAttrUnRsrvdLinkBandwidth.class);
......@@ -74,19 +74,19 @@ public class BgpLinkAttrUnRsrvdLinkBandwidth implements BGPValueType {
*
* @param cb Channel buffer
* @return object of type BgpLinkAttrMaxLinkBandwidth
* @throws BGPParseException while parsing BgpLinkAttrMaxLinkBandwidth
* @throws BgpParseException while parsing BgpLinkAttrMaxLinkBandwidth
*/
public static BgpLinkAttrUnRsrvdLinkBandwidth read(ChannelBuffer cb,
short sType)
throws BGPParseException {
throws BgpParseException {
ArrayList<Float> maxUnResBandwidth = new ArrayList<Float>();
float tmp;
short lsAttrLength = cb.readShort();
if ((lsAttrLength != MAX_BANDWIDTH_LEN * NO_OF_PRIORITY)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -22,9 +22,9 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -34,7 +34,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP prefix route Extended tag attribute.
*/
public class BgpPrefixAttrExtRouteTag implements BGPValueType {
public class BgpPrefixAttrExtRouteTag implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpPrefixAttrExtRouteTag.class);
......@@ -69,10 +69,10 @@ public class BgpPrefixAttrExtRouteTag implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpPrefixAttrExtRouteTag
* @throws BGPParseException while parsing BgpPrefixAttrExtRouteTag
* @throws BgpParseException while parsing BgpPrefixAttrExtRouteTag
*/
public static BgpPrefixAttrExtRouteTag read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
ArrayList<Long> pfxExtRouteTag = new ArrayList<Long>();
long temp;
......@@ -80,8 +80,8 @@ public class BgpPrefixAttrExtRouteTag implements BGPValueType {
int len = lsAttrLength / ATTR_PREFIX_EXT_LEN;
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP prefix IGP Flag attribute.
*/
public final class BgpPrefixAttrIgpFlags implements BGPValueType {
public final class BgpPrefixAttrIgpFlags implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpPrefixAttrIgpFlags.class);
......@@ -88,10 +88,10 @@ public final class BgpPrefixAttrIgpFlags implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpPrefixAttrIGPFlags
* @throws BGPParseException while parsing BgpPrefixAttrIGPFlags
* @throws BgpParseException while parsing BgpPrefixAttrIGPFlags
*/
public static BgpPrefixAttrIgpFlags read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
boolean bisisUpDownBit = false;
boolean bOspfNoUnicastBit = false;
boolean bOspfLclAddrBit = false;
......@@ -101,8 +101,8 @@ public final class BgpPrefixAttrIgpFlags implements BGPValueType {
if ((lsAttrLength != ATTR_PREFIX_FLAG_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP prefix metric attribute.
*/
public class BgpPrefixAttrMetric implements BGPValueType {
public class BgpPrefixAttrMetric implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpPrefixAttrMetric.class);
......@@ -65,18 +65,18 @@ public class BgpPrefixAttrMetric implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpPrefixAttrMetric
* @throws BGPParseException while parsing BgpPrefixAttrMetric
* @throws BgpParseException while parsing BgpPrefixAttrMetric
*/
public static BgpPrefixAttrMetric read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
int linkPfxMetric;
short lsAttrLength = cb.readShort(); // 4 Bytes
if ((lsAttrLength != ATTR_PREFIX_LEN)
|| (cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -18,9 +18,9 @@ package org.onosproject.bgpio.types.attr;
import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +30,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP prefix opaque data attribute.
*/
public final class BgpPrefixAttrOpaqueData implements BGPValueType {
public final class BgpPrefixAttrOpaqueData implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpPrefixAttrOpaqueData.class);
......@@ -65,18 +65,18 @@ public final class BgpPrefixAttrOpaqueData implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpPrefixAttrOpaqueData
* @throws BGPParseException while parsing BgpPrefixAttrOpaqueData
* @throws BgpParseException while parsing BgpPrefixAttrOpaqueData
*/
public static BgpPrefixAttrOpaqueData read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
byte[] opaquePrefixAttribute;
short lsAttrLength = cb.readShort();
opaquePrefixAttribute = new byte[lsAttrLength];
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -20,9 +20,9 @@ import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -32,7 +32,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP prefix OSPF Forwarding address attribute.
*/
public class BgpPrefixAttrOspfFwdAddr implements BGPValueType {
public class BgpPrefixAttrOspfFwdAddr implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpPrefixAttrOspfFwdAddr.class);
......@@ -80,10 +80,10 @@ public class BgpPrefixAttrOspfFwdAddr implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpPrefixAttrOSPFFwdAddr
* @throws BGPParseException while parsing BgpPrefixAttrOspfFwdAddr
* @throws BgpParseException while parsing BgpPrefixAttrOspfFwdAddr
*/
public static BgpPrefixAttrOspfFwdAddr read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
short lsAttrLength;
byte[] ipBytes;
Ip4Address ip4RouterId = null;
......@@ -93,8 +93,8 @@ public class BgpPrefixAttrOspfFwdAddr implements BGPValueType {
ipBytes = new byte[lsAttrLength];
if ((cb.readableBytes() < lsAttrLength)) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -20,9 +20,9 @@ import java.util.List;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPErrorType;
import org.onosproject.bgpio.types.BGPValueType;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -32,7 +32,7 @@ import com.google.common.base.MoreObjects;
/**
* Implements BGP prefix route tag attribute.
*/
public class BgpPrefixAttrRouteTag implements BGPValueType {
public class BgpPrefixAttrRouteTag implements BgpValueType {
protected static final Logger log = LoggerFactory
.getLogger(BgpPrefixAttrRouteTag.class);
......@@ -66,10 +66,10 @@ public class BgpPrefixAttrRouteTag implements BGPValueType {
*
* @param cb ChannelBuffer
* @return object of BgpPrefixAttrRouteTag
* @throws BGPParseException while parsing BgpPrefixAttrRouteTag
* @throws BgpParseException while parsing BgpPrefixAttrRouteTag
*/
public static BgpPrefixAttrRouteTag read(ChannelBuffer cb)
throws BGPParseException {
throws BgpParseException {
int tmp;
ArrayList<Integer> pfxRouteTag = new ArrayList<Integer>();
......@@ -77,8 +77,8 @@ public class BgpPrefixAttrRouteTag implements BGPValueType {
int len = lsAttrLength / Integer.SIZE;
if (cb.readableBytes() < lsAttrLength) {
Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
lsAttrLength);
}
......
......@@ -24,7 +24,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -109,13 +109,13 @@ public class Validation {
* @param errorCode Error code
* @param subErrCode Sub Error Code
* @param length erroneous length
* @throws BGPParseException for erroneous length
* @throws BgpParseException for erroneous length
*/
public static void validateLen(byte errorCode, byte subErrCode, int length) throws BGPParseException {
public static void validateLen(byte errorCode, byte subErrCode, int length) throws BgpParseException {
byte[] errLen = Ints.toByteArray(length);
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(errLen);
throw new BGPParseException(errorCode, subErrCode, buffer);
throw new BgpParseException(errorCode, subErrCode, buffer);
}
/**
......@@ -124,13 +124,13 @@ public class Validation {
* @param errorCode Error code
* @param subErrCode Sub Error Code
* @param type erroneous type
* @throws BGPParseException for erroneous type
* @throws BgpParseException for erroneous type
*/
public static void validateType(byte errorCode, byte subErrCode, int type) throws BGPParseException {
public static void validateType(byte errorCode, byte subErrCode, int type) throws BgpParseException {
byte[] errType = Ints.toByteArray(type);
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(errType);
throw new BGPParseException(errorCode, subErrCode, buffer);
throw new BgpParseException(errorCode, subErrCode, buffer);
}
/**
......
......@@ -18,8 +18,8 @@ package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.types.BGPHeader;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpHeader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
......@@ -28,13 +28,13 @@ import static org.hamcrest.core.Is.is;
/**
* Test case for BGP KEEPALIVE Message.
*/
public class BGPKeepaliveMsgTest {
public class BgpKeepaliveMsgTest {
/**
* This test case checks BGP Keepalive message.
*/
@Test
public void keepaliveMessageTest1() throws BGPParseException {
public void keepaliveMessageTest1() throws BgpParseException {
// BGP KEEPALIVE Message
byte[] keepaliveMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
......@@ -47,13 +47,13 @@ public class BGPKeepaliveMsgTest {
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(keepaliveMsg);
BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
BGPMessage message;
BGPHeader bgpHeader = new BGPHeader();
BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
BgpMessage message;
BgpHeader bgpHeader = new BgpHeader();
message = reader.readFrom(buffer, bgpHeader);
assertThat(message, instanceOf(BGPKeepaliveMsg.class));
assertThat(message, instanceOf(BgpKeepaliveMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
......