Shashikanth VH
Committed by Gerrit Code Review

BGP AS number issue fixes.

Change-Id: I204fdbc4f54917448b79bba453015f64283da125
......@@ -47,7 +47,7 @@ public interface BgpOpenMsg extends BgpMessage {
*
* @return AS Number of Open Message
*/
short getAsNumber();
long getAsNumber();
/**
* Returns BGP Identifier of Open Message.
......
......@@ -84,7 +84,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg {
(short) OPEN_MSG_MINIMUM_LENGTH, (byte) 0X01);
private BgpHeader bgpMsgHeader;
private byte version;
private short asNumber;
private long asNumber;
private short holdTime;
private int bgpId;
private boolean isLargeAsCapabilitySet;
......@@ -114,7 +114,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg {
* @param bgpId BGP identifier in open message
* @param capabilityTlv capabilities in open message
*/
public BgpOpenMsgVer4(BgpHeader bgpMsgHeader, byte version, short asNumber, short holdTime,
public BgpOpenMsgVer4(BgpHeader bgpMsgHeader, byte version, long asNumber, short holdTime,
int bgpId, LinkedList<BgpValueType> capabilityTlv) {
this.bgpMsgHeader = bgpMsgHeader;
this.version = version;
......@@ -145,7 +145,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg {
}
@Override
public short getAsNumber() {
public long getAsNumber() {
return this.asNumber;
}
......@@ -169,7 +169,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg {
byte version;
short holdTime;
short asNumber;
long asNumber;
int bgpId;
byte optParaLen = 0;
byte optParaType;
......@@ -191,8 +191,8 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg {
}
// Read AS number
asNumber = cb.readShort();
asNumber = cb.getUnsignedShort(cb.readerIndex());
cb.readShort();
// Read Hold timer
holdTime = cb.readShort();
......@@ -497,7 +497,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg {
cb.writeShort(AS_TRANS);
} else {
// write AS number in next 2-octet
cb.writeShort(message.asNumber);
cb.writeShort((short) message.asNumber);
}
// write HoldTime in next 2-octet
......
......@@ -169,12 +169,12 @@ public class BgpAppConfig extends Config<ApplicationId> {
public boolean validateFlowSpec() {
if (flowSpecCapability() != null) {
String flowSpec = flowSpecCapability();
if ((flowSpec.equals("IPV4")) || (flowSpec.equals("VPNV4")) || (flowSpec.equals("IPV4_VPNV4"))) {
return true;
if ((!flowSpec.equals("IPV4")) && (!flowSpec.equals("VPNV4")) && (!flowSpec.equals("IPV4_VPNV4"))) {
return false;
}
}
return false;
return true;
}
/**
......