summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio')
-rwxr-xr-xframework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpKeepaliveMsgTest.java66
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java224
-rwxr-xr-xframework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpOpenMsgTest.java314
-rwxr-xr-xframework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpUpdateMsgTest.java1496
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java39
-rwxr-xr-xframework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java55
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java55
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BgpLSIdentifierTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java40
-rwxr-xr-xframework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java40
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java40
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsNonPseudonodeTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java36
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java36
-rwxr-xr-xframework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java40
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java42
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java50
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java49
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java43
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java43
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java42
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java38
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java41
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java56
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java40
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java56
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java53
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java41
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java51
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java54
36 files changed, 0 insertions, 3492 deletions
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpKeepaliveMsgTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpKeepaliveMsgTest.java
deleted file mode 100755
index 682c1bc0..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpKeepaliveMsgTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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 static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test case for BGP KEEPALIVE Message.
- */
-public class BgpKeepaliveMsgTest {
-
- /**
- * This test case checks BGP Keepalive message.
- */
- @Test
- public void keepaliveMessageTest1() throws BgpParseException {
-
- // BGP KEEPALIVE Message
- byte[] keepaliveMsg = 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,
- 0x00, 0x13, 0x04};
-
- byte[] testKeepaliveMsg;
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(keepaliveMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpKeepaliveMsg.class));
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
-
- int readLen = buf.writerIndex();
- testKeepaliveMsg = new byte[readLen];
- buf.readBytes(testKeepaliveMsg, 0, readLen);
-
- assertThat(testKeepaliveMsg, is(keepaliveMsg));
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java
deleted file mode 100644
index 6dfa57ee..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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 static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test for Notification message.
- */
-public class BgpNotificationMsgTest {
-
- /**
- * Notification message with error code, error subcode and data.
- *
- * @throws BgpParseException while decoding and encoding notification message
- */
- @Test
- public void bgpNotificationMessageTest1() throws BgpParseException {
- byte[] notificationMsg = 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, 0x00,
- 0x17, 0x03, 0x02, 0x02,
- (byte) 0xfe, (byte) 0xb0};
-
- byte[] testNotificationMsg = {0};
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(notificationMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message = null;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpNotificationMsg.class));
-
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
- testNotificationMsg = buf.array();
-
- int iReadLen = buf.writerIndex() - 0;
- testNotificationMsg = new byte[iReadLen];
- buf.readBytes(testNotificationMsg, 0, iReadLen);
- assertThat(testNotificationMsg, is(notificationMsg));
- }
-
- /**
- * Notification message without data.
- *
- * @throws BgpParseException while decoding and encoding notification message
- */
- @Test
- public void bgpNotificationMessageTest2() throws BgpParseException {
- byte[] notificationMsg = 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, 0x00,
- 0x15, 0x03, 0x02, 0x00};
-
- byte[] testNotificationMsg = {0};
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(notificationMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message = null;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpNotificationMsg.class));
-
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
- testNotificationMsg = buf.array();
-
- int iReadLen = buf.writerIndex() - 0;
- testNotificationMsg = new byte[iReadLen];
- buf.readBytes(testNotificationMsg, 0, iReadLen);
- assertThat(testNotificationMsg, is(notificationMsg));
- }
-
- //Negative scenarios
- /**
- * Notification message with wrong maker value.
- *
- * @throws BgpParseException while decoding and encoding notification message
- */
- @Test(expected = BgpParseException.class)
- public void bgpNotificationMessageTest3() throws BgpParseException {
- byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff,
- 0x01, (byte) 0xff,
- (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff, 0x00,
- 0x15, 0x03, 0x02, 0x00};
-
- byte[] testNotificationMsg = {0};
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(notificationMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message = null;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpNotificationMsg.class));
-
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
- testNotificationMsg = buf.array();
-
- int iReadLen = buf.writerIndex() - 0;
- testNotificationMsg = new byte[iReadLen];
- buf.readBytes(testNotificationMsg, 0, iReadLen);
- assertThat(testNotificationMsg, is(notificationMsg));
- }
-
- /**
- * Notification message without error subcode.
- *
- * @throws BgpParseException while decoding and encoding notification message
- */
- @Test(expected = BgpParseException.class)
- public void bgpNotificationMessageTest4() throws BgpParseException {
- byte[] notificationMsg = 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, 0x00,
- 0x14, 0x03, 0x02};
-
- byte[] testNotificationMsg = {0};
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(notificationMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message = null;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpNotificationMsg.class));
-
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
- testNotificationMsg = buf.array();
-
- int iReadLen = buf.writerIndex() - 0;
- testNotificationMsg = new byte[iReadLen];
- buf.readBytes(testNotificationMsg, 0, iReadLen);
- assertThat(testNotificationMsg, is(notificationMsg));
- }
-
- /**
- * Notification message with wrong message length.
- *
- * @throws BgpParseException while decoding and encoding notification message
- */
- @Test(expected = BgpParseException.class)
- public void bgpNotificationMessageTest5() throws BgpParseException {
- byte[] notificationMsg = 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, 0x00,
- 0x14, 0x03, 0x02, 0x02};
-
- byte[] testNotificationMsg = {0};
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(notificationMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message = null;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpNotificationMsg.class));
-
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
- testNotificationMsg = buf.array();
-
- int iReadLen = buf.writerIndex() - 0;
- testNotificationMsg = new byte[iReadLen];
- buf.readBytes(testNotificationMsg, 0, iReadLen);
- assertThat(testNotificationMsg, is(notificationMsg));
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpOpenMsgTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpOpenMsgTest.java
deleted file mode 100755
index 1fe4036f..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpOpenMsgTest.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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 static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.core.Is.is;
-
-/**
- * Test cases for BGP Open Message.
- */
-public class BgpOpenMsgTest {
-
- /**
- * This test case checks open message without optional parameter.
- */
- @Test
- public void openMessageTest1() throws BgpParseException {
- //Open message without optional parameter
- byte[] openMsg = 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,
- 0x00, 0x1d, 0x01, 0X04, (byte) 0xfe, 0x09, 0x00,
- (byte) 0xb4, (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
- 0x00};
-
- byte[] testOpenMsg;
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
-
- int readLen = buf.writerIndex();
- testOpenMsg = new byte[readLen];
- buf.readBytes(testOpenMsg, 0, readLen);
-
- assertThat(testOpenMsg, is(openMsg));
- }
-
- /**
- * This test case checks open message with Multiprotocol extension
- * capability.
- */
- @Test
- public void openMessageTest2() throws BgpParseException {
-
- // OPEN Message (MultiProtocolExtension-CAPABILITY).
- byte[] openMsg = 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, 0x00, 0x25,
- 0x01, //BGP Header
- 0X04, //Version
- (byte) 0x00, (byte) 0xc8, // AS Number
- 0x00, (byte) 0xb4, // Hold time
- (byte) 0xb6, (byte) 0x02, 0x5d,
- (byte) 0xc8, // BGP Identifier
- 0x08, 0x02, 0x06, // Opt Parameter length
- 0x01, 0x04, 0x00, 0x00, 0x00, (byte) 0xc8}; // Multiprotocol CAPABILITY
-
- byte[] testOpenMsg;
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
-
- int readLen = buf.writerIndex();
- testOpenMsg = new byte[readLen];
- buf.readBytes(testOpenMsg, 0, readLen);
-
- assertThat(testOpenMsg, is(openMsg));
- }
-
- /**
- * This test case checks open message with Four-octet AS number
- * capability.
- */
- @Test
- public void openMessageTest3() throws BgpParseException {
-
- // OPEN Message (Four-Octet AS number capability).
- byte[] openMsg = 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, 0x00, 0x25,
- 0x01, //BGPHeader
- 0X04, //Version
- (byte) 0x00, (byte) 0xc8, //AS Number
- 0x00, (byte) 0xb4, //Hold Time
- (byte) 0xb6, (byte) 0x02, 0x5d,
- (byte) 0xc8, //BGP Identifier
- 0x08, 0x02, 0x06, //Opt Parameter Length
- 0x41, 0x04, 0x00, 0x01, 0x00, 0x01}; //Four Octet AS Number-CAPABILITY-TLV
-
- byte[] testOpenMsg;
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
-
- int readLen = buf.writerIndex();
- testOpenMsg = new byte[readLen];
- buf.readBytes(testOpenMsg, 0, readLen);
-
- assertThat(testOpenMsg, is(openMsg));
- }
-
- /**
- * This test case checks open message with capabilities.
- */
- @Test
- public void openMessageTest4() throws BgpParseException {
-
- // OPEN Message with capabilities.
- byte[] openMsg = 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, 0x00, 0x2b,
- 0x01, //BGPHeader
- 0X04, //Version
- (byte) 0x00, (byte) 0xc8, //AS Number
- 0x00, (byte) 0xb4, //Hold Time
- (byte) 0xb6, (byte) 0x02, 0x5d, (byte) 0xc8, //BGP Identifier
- 0x0e, 0x02, 0x0c, //Opt Parameter Length
- 0x01, 0x04, 0x00, 0x00, 0x00, (byte) 0xc8, // Multiprotocol extension capability
- 0x41, 0x04, 0x00, 0x01, 0x00, 0x01}; //Four Octet AS Number-CAPABILITY-TLV
-
- byte[] testOpenMsg;
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
-
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
- message.writeTo(buf);
-
- int readLen = buf.writerIndex();
- testOpenMsg = new byte[readLen];
- buf.readBytes(testOpenMsg, 0, readLen);
-
- assertThat(testOpenMsg, is(openMsg));
- }
-
- /**
- * In this test case, Invalid version is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void openMessageTest5() throws BgpParseException {
-
- // OPEN Message with invalid version number.
- byte[] openMsg = 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, 0x00, 0x1d, 0x01, 0X05,
- (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
- (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
- 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
- }
-
- /**
- * In this test case, Marker is set as 0 in input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void openMessageTest6() throws BgpParseException {
-
- // OPEN Message with marker set to 0.
- byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff, (byte) 0xff,
- (byte) 0x00, (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff, (byte) 0xff,
- 0x00, 0x00, 0x1d, 0x01, 0X04,
- (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
- (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
- 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
- }
-
- /**
- * In this test case, Invalid message length is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void openMessageTest7() throws BgpParseException {
-
- // OPEN Message with invalid header length.
- byte[] openMsg = 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, 0x00, 0x1e, 0x01, 0X04,
- (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
- (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
- 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
- }
-
- /**
- * In this test case, Invalid message type is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void openMessageTest8() throws BgpParseException {
-
- // OPEN Message with invalid message type.
- byte[] openMsg = 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, 0x00, 0x1d, 0x05, 0X04,
- (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
- (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
- 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(openMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpOpenMsg.class));
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpUpdateMsgTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpUpdateMsgTest.java
deleted file mode 100755
index 8e1cd202..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpUpdateMsgTest.java
+++ /dev/null
@@ -1,1496 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.protocol;
-
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.core.Is.is;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onosproject.bgpio.exceptions.BgpParseException;
-import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4;
-import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier;
-import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4;
-import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType;
-import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors;
-import org.onosproject.bgpio.protocol.ver4.BgpPathAttributes;
-import org.onosproject.bgpio.types.As4Path;
-import org.onosproject.bgpio.types.AsPath;
-import org.onosproject.bgpio.types.AutonomousSystemTlv;
-import org.onosproject.bgpio.types.BgpHeader;
-import org.onosproject.bgpio.types.BgpLSIdentifierTlv;
-import org.onosproject.bgpio.types.BgpValueType;
-import org.onosproject.bgpio.types.IPReachabilityInformationTlv;
-import org.onosproject.bgpio.types.IsIsNonPseudonode;
-import org.onosproject.bgpio.types.IsIsPseudonode;
-import org.onosproject.bgpio.types.Med;
-import org.onosproject.bgpio.types.MpReachNlri;
-import org.onosproject.bgpio.types.MpUnReachNlri;
-import org.onosproject.bgpio.types.Origin;
-import org.onosproject.bgpio.types.NextHop;
-import org.onosproject.bgpio.types.LocalPref;
-import org.onosproject.bgpio.types.Origin.ORIGINTYPE;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-
-/**
- * Test cases for BGP update Message.
- */
-public class BgpUpdateMsgTest {
- protected static final Logger log = LoggerFactory.getLogger(BgpUpdateMsgTest.class);
- public static final 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 byte UPDATE_MSG_TYPE = 0x2;
-
- /**
- * This test case checks update message with no withdrawn routes
- * and path attributes.
- */
- @Test
- public void bgpUpdateMessageTest01() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x17, 0x02, 0x00, 0x00, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 23));
- }
-
- /**
- * In this test case, Marker is set as 0 in input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest02() throws BgpParseException {
- byte[] updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
- 0x00, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff, 0x00, 0x17, 0x02, 0x00, 0x00, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid message length is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest03() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x18, 0x02, 0x00, 0x00, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid message type is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest04() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x17, 0x06, 0x00, 0x00, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * This test case checks update message with withdrawn routes.
- */
- @Test
- public void bgpUpdateMessageTest05() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x1b, 0x02, 0x00, 0x04, 0x18, 0x0a, 0x01, 0x01, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 27));
-
- ListIterator<IpPrefix> listIterator1 = other.withdrawnRoutes().listIterator();
- byte[] prefix = new byte[] {0x0a, 0x01, 0x01, 0x00};
-
- IpPrefix testPrefixValue = listIterator1.next();
- assertThat(testPrefixValue.prefixLength(), is((int) 24));
- assertThat(testPrefixValue.address().toOctets(), is(prefix));
- }
-
- /**
- * In this test case, Invalid withdrawn route length is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest06() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x1b, 0x02, 0x00, 0x04, 0x19, 0x0a, 0x01, 0x01, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * This test case checks update message with path attributes.
- */
- @Test
- public void bgpUpdateMessageTest07() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x3f, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x40, 0x01, 0x01,
- 0x00, 0x40, 0x02, 0x00, 0x40, 0x03, 0x04, 0x03, 0x03, 0x03, 0x03, (byte) 0x80, 0x04, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x40, 0x05, 0x04, 0x00, 0x00, 0x00, 0x64, 0x18, 0x0a, 0x1e, 0x03, 0x18, 0x0a, 0x1e,
- 0x02, 0x18, 0x0a, 0x1e, 0x01};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 63));
-
- BgpValueType testPathAttribute;
- Origin origin;
- AsPath asPath;
- NextHop nexthop;
- Med med;
- LocalPref localPref;
-
- List<BgpValueType> pathAttributes = new LinkedList<>();
- BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
- pathAttributes = actualpathAttribute.pathAttributes();
- ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
- ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
-
- testPathAttribute = listIterator.next();
- origin = (Origin) testPathAttribute;
- assertThat(origin.origin(), is(originValue));
-
- testPathAttribute = listIterator.next(); // AS PATH value is empty in hex dump
- asPath = (AsPath) testPathAttribute;
- List<Short> asPathValues = asPath.asPathSeq();
- assertThat(asPathValues.isEmpty(), is(true));
-
- testPathAttribute = listIterator.next();
- nexthop = (NextHop) testPathAttribute;
- byte[] nextHopAddr = new byte[] {0x03, 0x03, 0x03, 0x03};
- assertThat(nexthop.nextHop().toOctets(), is(nextHopAddr));
-
- testPathAttribute = listIterator.next();
- med = (Med) testPathAttribute;
- assertThat(med.med(), is(0));
-
- testPathAttribute = listIterator.next();
- localPref = (LocalPref) testPathAttribute;
- assertThat(localPref.localPref(), is(100));
-
- ListIterator<IpPrefix> listIterator1 = other.nlri().listIterator();
- byte[] prefix = new byte[] {0x0a, 0x1e, 0x03, 0x00};
-
- IpPrefix testPrefixValue = listIterator1.next();
- assertThat(testPrefixValue.prefixLength(), is((int) 24));
- assertThat(testPrefixValue.address().toOctets(), is(prefix));
- }
-
- /**
- * In this test case, Invalid ORIGIN flags is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest08() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid ORIGIN value is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest09() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x04, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, update message without path attribute is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest10() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x1a, 0x02, 0x00, 0x04, 0x18, 0x0a, 0x01, 0x01, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, update message with incorrect path attribute length is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest11() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x1b, 0x02, 0x00, 0x04, 0x18, 0x0a, 0x01, 0x01, 0x00, 0x01};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid MED flags is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest12() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0xff, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid AS Path flags is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest13() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x01, 0x00, //origin
- (byte) 0xff, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid MP reach flags is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest14() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0xff, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid SAFI is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest15() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x49, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid AFI is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest16() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x06, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid res is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest17() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- (byte) 0xff, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x01, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * This test case checks update message with node NLRI.
- */
- @Test
- public void bgpUpdateMessageTest18() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 96));
-
- BgpValueType testPathAttribute;
- Origin origin;
- AsPath asPath;
- Med med;
- MpReachNlri mpReach;
- List<BgpValueType> pathAttributes = new LinkedList<>();
- BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
- pathAttributes = actualpathAttribute.pathAttributes();
- ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
- ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
-
- testPathAttribute = listIterator.next();
- origin = (Origin) testPathAttribute;
- assertThat(origin.origin(), is(originValue));
-
- testPathAttribute = listIterator.next();
- asPath = (AsPath) testPathAttribute;
- ListIterator<Short> listIterator2 = asPath.asPathSeq().listIterator();
- assertThat(listIterator2.next(), is((short) 65001));
-
- testPathAttribute = listIterator.next();
- med = (Med) testPathAttribute;
- assertThat(med.med(), is(0));
-
- testPathAttribute = listIterator.next();
- mpReach = (MpReachNlri) testPathAttribute;
- assertThat(mpReach.mpReachNlriLen(), is((int) 52));
- assertThat(mpReach.getType(), is((short) 14));
-
- List<BgpLSNlri> testMpReachNlri = new LinkedList<>();
- testMpReachNlri = mpReach.mpReachNlri();
-
- ListIterator<BgpLSNlri> list1 = testMpReachNlri.listIterator();
- BgpLSNlri testnlri = list1.next();
- NlriType nlriType = org.onosproject.bgpio.protocol.NlriType.NODE;
- ProtocolType protocolId = org.onosproject.bgpio.protocol.linkstate.
- BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO;
- assertThat(testnlri.getIdentifier(), is((long) 0));
- assertThat(testnlri.getNlriType(), is(nlriType));
- assertThat(testnlri.getProtocolId(), is(protocolId));
-
- BgpNodeLSNlriVer4 testNodenlri = (BgpNodeLSNlriVer4) testnlri;
-
- BgpNodeLSIdentifier testLocalNodeDescriptors = testNodenlri.getLocalNodeDescriptors();
-
- List<BgpValueType> testSubTlvs = new LinkedList<>();
- NodeDescriptors localNodeDescriptors = testLocalNodeDescriptors.getNodedescriptors();
- testSubTlvs = localNodeDescriptors.getSubTlvs();
- ListIterator<BgpValueType> subtlvlist1 = testSubTlvs.listIterator();
-
- AutonomousSystemTlv testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist1.next();
- assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
- assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
-
- BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
- assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
- assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
-
- IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
- byte[] expISONodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
- assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
- assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
-
- }
-
- /**
- * This test case checks update message with prefix NLRI.
- */
- @Test
- public void bgpUpdateMessageTest19() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, (byte) 0xd6, 0x02, 0x00, 0x04,
- 0x18, 0x0a, 0x01, 0x01, //withdrawn routes
- 0x00, (byte) 0xbb, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x90, 0x0e, 0x00, (byte) 0xa5, 0x40, 0x04, 0x47, //mpreach
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08,
- (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, 0x21, 0x68,
- 0x07, 0x70, 0x01, 0x01, 0x09, 0x00, 0x05, 0x20,
- (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01, 0x00, 0x03, 0x00, 0x30,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00,
- 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00,
- 0x06, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21, 0x01,
- 0x09, 0x00, 0x05, 0x20, 0x15, 0x15, 0x15, 0x15,
- 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08,
- (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x03, 0x00, 0x06, 0x02, 0x20, 0x22,
- 0x02, 0x20, 0x22, 0x01, 0x09, 0x00, 0x05, 0x20,
- 0x16, 0x16, 0x16, 0x16}; // prefix nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 214));
-
- ListIterator<IpPrefix> listIterator1 = other.withdrawnRoutes().listIterator();
- byte[] prefix = new byte[] {0x0a, 0x01, 0x01, 0x00};
-
- IpPrefix testPrefixValue = listIterator1.next();
- assertThat(testPrefixValue.prefixLength(), is((int) 24));
- assertThat(testPrefixValue.address().toOctets(), is(prefix));
-
- BgpValueType testPathAttribute;
- Origin origin;
- AsPath asPath;
- Med med;
- MpReachNlri mpReach;
- List<BgpValueType> pathAttributes = new LinkedList<>();
- BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
- pathAttributes = actualpathAttribute.pathAttributes();
- ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
- ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
-
- testPathAttribute = listIterator.next();
- origin = (Origin) testPathAttribute;
- assertThat(origin.origin(), is(originValue));
-
- testPathAttribute = listIterator.next();
- asPath = (AsPath) testPathAttribute;
- ListIterator<Short> listIterator2 = asPath.asPathSeq().listIterator();
- assertThat(listIterator2.next(), is((short) 65001));
-
- testPathAttribute = listIterator.next();
- med = (Med) testPathAttribute;
- assertThat(med.med(), is(0));
-
- testPathAttribute = listIterator.next();
- mpReach = (MpReachNlri) testPathAttribute;
- assertThat(mpReach.mpReachNlriLen(), is((int) 165));
- assertThat(mpReach.getType(), is((short) 14));
-
- List<BgpLSNlri> testMpReachNlri = new LinkedList<>();
- testMpReachNlri = mpReach.mpReachNlri();
-
- ListIterator<BgpLSNlri> list1 = testMpReachNlri.listIterator();
- BgpLSNlri testnlri = list1.next();
- NlriType nlriType = org.onosproject.bgpio.protocol.NlriType.PREFIX_IPV4;
- ProtocolType protocolId = org.onosproject.bgpio.protocol.linkstate.
- BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO;
- assertThat(testnlri.getIdentifier(), is((long) 0));
- assertThat(testnlri.getNlriType(), is(nlriType));
- assertThat(testnlri.getProtocolId(), is(protocolId));
-
- BgpPrefixLSNlri testprefixnlri = (BgpPrefixLSNlri) testnlri;
-
- NodeDescriptors testLocalNodeDescriptors = testprefixnlri.getLocalNodeDescriptors();
-
- List<BgpValueType> testSubTlvs = new LinkedList<>();
- testSubTlvs = testLocalNodeDescriptors.getSubTlvs();
- ListIterator<BgpValueType> subtlvlist1 = testSubTlvs.listIterator();
-
- AutonomousSystemTlv testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist1.next();
- assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
- assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
-
- BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
- assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
- assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
-
- IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
- byte[] expISONodeID = new byte[] {0x19, 0x21, 0x68, 0x07, 0x70, 0x01};
- assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
- assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
-
- List<BgpValueType> testPrefixDescriptors = new LinkedList<>();
- testPrefixDescriptors = testprefixnlri.getPrefixdescriptor();
- ListIterator<BgpValueType> subtlvlist2 = testPrefixDescriptors.listIterator();
- IPReachabilityInformationTlv testIPReachabilityInformationTlv = (IPReachabilityInformationTlv)
- subtlvlist2.next();
- byte[] address = new byte[] {(byte) 0xc0, (byte) 0xa8, 0x4d, 0x01};
- IpPrefix prefix1 = IpPrefix.valueOf(IpAddress.Version.INET, address, 32);
- assertThat(testIPReachabilityInformationTlv.getPrefixValue(), is(prefix1));
- assertThat(testIPReachabilityInformationTlv.getPrefixLen(), is((byte) 32));
- }
-
- /**
- * This test case checks update message with link NLRI.
- */
- @Test
- public void bgpUpdateMessageTest20() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, (byte) 0x83, 0x02, 0x00, 0x04,
- 0x18, 0x0a, 0x01, 0x01, //withdrawn routes
- 0x00, 0x68, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x53, 0x40, 0x04, 0x47, //mpreach
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x02, 0x00, 0x46, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x07, 0x19, 0x00,
- (byte) 0x95, 0x02, 0x50, 0x21, 0x03, 0x01, 0x01, 0x00, 0x1a, 0x02,
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00,
- 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x19,
- 0x00, (byte) 0x95, 0x02, 0x50, 0x21//link nlri
- };
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message = null;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 131));
-
- ListIterator<IpPrefix> listIterator1 = other.withdrawnRoutes().listIterator();
- byte[] prefix = new byte[] {0x0a, 0x01, 0x01, 0x00};
-
- IpPrefix testPrefixValue = listIterator1.next();
- assertThat(testPrefixValue.prefixLength(), is((int) 24));
- assertThat(testPrefixValue.address().toOctets(), is(prefix));
-
- BgpValueType testPathAttribute;
- Origin origin;
- AsPath asPath;
- Med med;
- MpReachNlri mpReach;
-
- List<BgpValueType> pathAttributes = new LinkedList<>();
- BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
- pathAttributes = actualpathAttribute.pathAttributes();
- ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
- ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
-
- testPathAttribute = listIterator.next();
- origin = (Origin) testPathAttribute;
- assertThat(origin.origin(), is(originValue));
-
- testPathAttribute = listIterator.next();
- asPath = (AsPath) testPathAttribute;
- ListIterator<Short> listIterator2 = asPath.asPathSeq().listIterator();
- assertThat(listIterator2.next(), is((short) 65001));
-
- testPathAttribute = listIterator.next();
- med = (Med) testPathAttribute;
- assertThat(med.med(), is(0));
-
- testPathAttribute = listIterator.next();
- mpReach = (MpReachNlri) testPathAttribute;
- assertThat(mpReach.mpReachNlriLen(), is((int) 83));
- assertThat(mpReach.getType(), is((short) 14));
-
- List<BgpLSNlri> testMpReachNlri = new LinkedList<>();
- testMpReachNlri = mpReach.mpReachNlri();
-
- ListIterator<BgpLSNlri> list1 = testMpReachNlri.listIterator();
- BgpLSNlri testnlri = list1.next();
- NlriType nlriType = org.onosproject.bgpio.protocol.NlriType.LINK;
- ProtocolType protocolId = org.onosproject.bgpio.protocol.linkstate.
- BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO;
- assertThat(testnlri.getIdentifier(), is((long) 0));
- assertThat(testnlri.getNlriType(), is(nlriType));
- assertThat(testnlri.getProtocolId(), is(protocolId));
-
- BgpLinkLsNlriVer4 testlinknlri = (BgpLinkLsNlriVer4) testnlri;
-
- NodeDescriptors testLocalNodeDescriptors = testlinknlri.localNodeDescriptors();
-
- List<BgpValueType> testSubTlvs = new LinkedList<>();
- testSubTlvs = testLocalNodeDescriptors.getSubTlvs();
- ListIterator<BgpValueType> subtlvlist1 = testSubTlvs.listIterator();
-
- AutonomousSystemTlv testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist1.next();
-
- assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
- assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
-
- BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
- assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
- assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
-
- IsIsPseudonode testIsIsPseudonode = (IsIsPseudonode) subtlvlist1.next();
- assertThat(testIsIsPseudonode.getPSNIdentifier(), is((byte) 3));
- assertThat(testIsIsPseudonode.getType(), is((short) 515));
-
- NodeDescriptors testRemoteNodeDescriptors = testlinknlri.remoteNodeDescriptors();
- testSubTlvs = testRemoteNodeDescriptors.getSubTlvs();
- ListIterator<BgpValueType> subtlvlist2 = testSubTlvs.listIterator();
-
- testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist2.next();
-
- assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
- assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
-
- testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist2.next();
- assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
- assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
-
- IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist2.next();
- byte[] expISONodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21};
- assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
- assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
- }
-
- /**
- * In this test case, Invalid withdrawn route length is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest21() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x1b, 0x02, 0x00, 0x07, 0x18, 0x0a, 0x01, 0x01, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid withdrawn route length is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest22() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x25, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x0e, //path attribute len
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00}; //med
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Mandatory attributes are not given in input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest23() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x29, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x12, //path attribute len
- 0x0e, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00}; //med
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid origin length is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest24() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x29, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x12, //path attribute len
- 0x04, 0x01, 0x02, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00}; //med
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid origin value is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest25() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x29, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x12, //path attribute len
- 0x04, 0x01, 0x01, 0x04, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00}; //med
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid descriptor type in node nlri is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest26() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, Invalid node nlri length field in is given as input and expecting
- * an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest27() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
- 0x00, 0x49, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1b, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, withdrawn routes with prefix length 0 is given as input and expecting
- * an exception.
- */
- @Test
- public void bgpUpdateMessageTest28() throws BgpParseException {
- byte[] updateMsg = 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, //marker
- 0x00, 0x18, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * In this test case, update message without total Path Attribute Length field is given as
- * input and expecting an exception.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest29() throws BgpParseException {
- byte[] updateMsg = 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, //marker
- 0x00, 0x16, 0x02, 0x00, 0x01, 0x00};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * This test case checks update message with as4 path attribute.
- */
- @Test
- public void bgpUpdateMessageTest30() throws BgpParseException {
- byte[] updateMsg = 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,
- 0x00, 0x3a, 0x02, 0x00, 0x00, 0x00, 0x21, 0x40, 0x01, 0x01, 0x00, (byte) 0xc0,
- 0x11, 0x0a, 0x02, 0x02, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x28, 0x00, 0x01, 0x40,
- 0x02, 0x06, 0x02, 0x02, 0x5b, (byte) 0xa0, 0x5b, (byte) 0xa0, 0x40, 0x03, 0x04,
- (byte) 0xac, 0x10, 0x03, 0x01, 0x08, 0x28};
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message = null;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 58));
-
- BgpValueType testPathAttribute;
- Origin origin;
- As4Path as4Path;
- AsPath asPath;
- NextHop nextHop;
-
- List<BgpValueType> pathAttributes = new LinkedList<>();
- BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
- pathAttributes = actualpathAttribute.pathAttributes();
- ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
- ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
-
- testPathAttribute = listIterator.next();
- origin = (Origin) testPathAttribute;
- assertThat(origin.origin(), is(originValue));
-
- testPathAttribute = listIterator.next();
- as4Path = (As4Path) testPathAttribute;
- ListIterator<Integer> listIterator2 = as4Path.as4PathSEQ().listIterator();
- assertThat(listIterator2.next(), is(655361));
-
- testPathAttribute = listIterator.next();
- asPath = (AsPath) testPathAttribute;
- ListIterator<Short> listIterator3 = asPath.asPathSeq().listIterator();
- assertThat(listIterator3.next(), is((short) 23456));
-
- testPathAttribute = listIterator.next();
- nextHop = (NextHop) testPathAttribute;
- byte[] nextHopAddr = new byte[] {(byte) 0xac, 0x10, 0x03, 0x01};
- assertThat(nextHop.nextHop().toOctets(), is(nextHopAddr));
-
- ListIterator<IpPrefix> listIterator1 = other.nlri().listIterator();
- byte[] prefix = new byte[] {0x28, 0x00, 0x00, 0x00};
-
- IpPrefix testPrefixValue = listIterator1.next();
- assertThat(testPrefixValue.prefixLength(), is((int) 8));
- assertThat(testPrefixValue.address().toOctets(), is(prefix));
- }
-
- /**
- * This test case checks update message with MPUnreach.
- */
- @Test
- public void bgpUpdateMessageTest31() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, 0x5e, 0x02, 0x00, 0x04, 0x18, 0x0a, 0x01, 0x01, //withdrawn routes
- 0x00, 0x43, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0f, 0x2e, 0x40, 0x04, 0x47, //mpunreach with safi = 71
- 0x00, 0x01, 0x00,
- 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
- 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- BgpUpdateMsg other = (BgpUpdateMsg) message;
-
- assertThat(other.getHeader().getMarker(), is(MARKER));
- assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
- assertThat(other.getHeader().getLength(), is((short) 94));
-
- ListIterator<IpPrefix> listIterator1 = other.withdrawnRoutes().listIterator();
- byte[] prefix = new byte[] {0x0a, 0x01, 0x01, 0x00};
-
- IpPrefix testPrefixValue = listIterator1.next();
- assertThat(testPrefixValue.prefixLength(), is((int) 24));
- assertThat(testPrefixValue.address().toOctets(), is(prefix));
-
- BgpValueType testPathAttribute;
- Origin origin;
- AsPath asPath;
- Med med;
- MpUnReachNlri mpUnReach;
- List<BgpValueType> pathAttributes = new LinkedList<>();
- BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
- pathAttributes = actualpathAttribute.pathAttributes();
- ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
- ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
-
- testPathAttribute = listIterator.next();
- origin = (Origin) testPathAttribute;
- assertThat(origin.origin(), is(originValue));
-
- testPathAttribute = listIterator.next();
- asPath = (AsPath) testPathAttribute;
- ListIterator<Short> listIterator2 = asPath.asPathSeq().listIterator();
- assertThat(listIterator2.next(), is((short) 65001));
-
- testPathAttribute = listIterator.next();
- med = (Med) testPathAttribute;
- assertThat(med.med(), is(0));
-
- testPathAttribute = listIterator.next();
- mpUnReach = (MpUnReachNlri) testPathAttribute;
- assertThat(mpUnReach.mpUnReachNlriLen(), is((int) 46));
- assertThat(mpUnReach.getType(), is((short) 15));
-
- List<BgpLSNlri> testMpUnReachNlri = new LinkedList<>();
- testMpUnReachNlri = mpUnReach.mpUnReachNlri();
-
- ListIterator<BgpLSNlri> list1 = testMpUnReachNlri.listIterator();
- BgpLSNlri testnlri = list1.next();
- NlriType nlriType = org.onosproject.bgpio.protocol.NlriType.NODE;
- ProtocolType protocolId = org.onosproject.bgpio.protocol.linkstate.
- BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO;
- assertThat(testnlri.getIdentifier(), is((long) 0));
- assertThat(testnlri.getNlriType(), is(nlriType));
- assertThat(testnlri.getProtocolId(), is(protocolId));
-
- BgpNodeLSNlriVer4 testNodenlri = (BgpNodeLSNlriVer4) testnlri;
-
- BgpNodeLSIdentifier testLocalNodeDescriptors = testNodenlri.getLocalNodeDescriptors();
-
- List<BgpValueType> testSubTlvs = new LinkedList<>();
- NodeDescriptors localNodeDescriptors = testLocalNodeDescriptors.getNodedescriptors();
- testSubTlvs = localNodeDescriptors.getSubTlvs();
- ListIterator<BgpValueType> subtlvlist1 = testSubTlvs.listIterator();
-
- AutonomousSystemTlv testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist1.next();
-
- assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
- assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
-
- BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
- assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
- assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
-
- IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
- byte[] expISONodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
- assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
- assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
- }
-
- /**
- * This test case checks update message with invalid mpreach packet.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest32() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, (byte) 0xd6, 0x02, 0x00, 0x04,
- 0x18, 0x0a, 0x01, 0x01, //withdrawn routes
- 0x00, (byte) 0xbb, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x90, 0x0e, 0x00, (byte) 0xa5, 0x40, 0x04, 0x47, //mpreach
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08,
- (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, 0x21, 0x68,
- 0x07, 0x70, 0x01, 0x01, 0x09, 0x00, 0x05, 0x20,
- (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01, 0x00, 0x03, 0x00, 0x30,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00,
- 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00,
- 0x06, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21, 0x01,
- 0x09, 0x00, 0x05, 0x20, 0x15, 0x15, 0x15, 0x15,
- 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08,
- (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x03, 0x00, 0x06, 0x02, 0x20, 0x22,
- 0x02, 0x20, 0x22, 0x01, 0x09, 0x00, 0x05, 0x20,
- 0x16, 0x16, 0x16, 0x16}; // prefix nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * This test case checks update message with invalid prefix nlri length in input.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest33() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, (byte) 0xd6, 0x02, 0x00, 0x04,
- 0x18, 0x0a, 0x01, 0x01, //withdrawn routes
- 0x00, (byte) 0xbb, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x90, 0x0e, 0x00, (byte) 0xa5, 0x40, 0x04, 0x47, //mpreach
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x03, 0x00, 0x35, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08,
- (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, 0x21, 0x68,
- 0x07, 0x70, 0x01, 0x01, 0x09, 0x00, 0x05, 0x20,
- (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01, 0x00, 0x03, 0x00, 0x30,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00,
- 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00,
- 0x06, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21, 0x01,
- 0x09, 0x00, 0x05, 0x20, 0x15, 0x15, 0x15, 0x15,
- 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08,
- (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x03, 0x00, 0x06, 0x02, 0x20, 0x22,
- 0x02, 0x20, 0x22, 0x01, 0x09, 0x00, 0x05, 0x20,
- 0x16, 0x16, 0x16, 0x16}; // prefix nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-
- /**
- * This test case checks update message with invalid link nlri length in input.
- */
- @Test(expected = BgpParseException.class)
- public void bgpUpdateMessageTest34() throws BgpParseException {
- byte[] updateMsg = 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, 0x00, (byte) 0x83, 0x02, 0x00, 0x04,
- 0x18, 0x0a, 0x01, 0x01, //withdrawn routes
- 0x00, 0x68, //path attribute len
- 0x04, 0x01, 0x01, 0x00, //origin
- 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
- (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
- (byte) 0x80, 0x0e, 0x53, 0x40, 0x04, 0x47, //mpreach
- 0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
- 0x00, //reserved
- 0x00, 0x02, 0x00, 0x48, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x07, 0x19, 0x00,
- (byte) 0x95, 0x02, 0x50, 0x21, 0x03, 0x01, 0x01, 0x00, 0x1a, 0x02,
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00,
- 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x19,
- 0x00, (byte) 0x95, 0x02, 0x50, 0x21}; //link nlri
-
- ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
- buffer.writeBytes(updateMsg);
-
- BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
- BgpMessage message;
- BgpHeader bgpHeader = new BgpHeader();
-
- message = reader.readFrom(buffer, bgpHeader);
-
- assertThat(message, instanceOf(BgpUpdateMsg.class));
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java
deleted file mode 100644
index e11564ab..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for AreaID Tlv.
- */
-public class AreaIdTest {
- private final int value1 = 10;
- private final int value2 = 20;
- private final AreaIDTlv tlv1 = AreaIDTlv.of(value1);
- private final AreaIDTlv sameAsTlv1 = AreaIDTlv.of(value1);
- private final AreaIDTlv tlv2 = AreaIDTlv.of(value2);
-
- @Test
- public void testEquality() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java
deleted file mode 100755
index 3ea56b64..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for As4Path BGP Path Attribute.
- */
-public class As4PathTest {
- //Two scenarios as4path set and sequence
- private final List<Integer> as4pathSet1 = new ArrayList<>();
- private final List<Integer> as4pathSeq1 = new ArrayList<>();
- private final List<Integer> as4pathSet2 = new ArrayList<>();
- private final List<Integer> as4pathSeq2 = new ArrayList<>();
- private final As4Path attr1 = new As4Path(as4pathSet1, null);
- private final As4Path sameAsAttr1 = new As4Path(as4pathSet1, null);
- private final As4Path attr2 = new As4Path(as4pathSet2, null);
- private final As4Path attr3 = new As4Path(null, as4pathSeq1);
- private final As4Path sameAsAttr3 = new As4Path(null, as4pathSeq1);
- private final As4Path attr4 = new As4Path(null, as4pathSeq2);
-
- @Test
- public void basics() {
- as4pathSet1.add(197358);
- as4pathSet1.add(12883);
- as4pathSet2.add(2008989);
- as4pathSeq1.add(3009009);
- as4pathSeq2.add(409900);
- new EqualsTester()
- .addEqualityGroup(attr1, sameAsAttr1)
- .addEqualityGroup(attr2)
- .addEqualityGroup(attr3, sameAsAttr3)
- .addEqualityGroup(attr4)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java
deleted file mode 100644
index e56ec5a5..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for AsPath BGP Path Attribute.
- */
-public class AsPathTest {
- //Two scenarios aspath set and sequence
- private final List<Short> aspathSet1 = new ArrayList<>();
- private final List<Short> aspathSet2 = new ArrayList<>();
- private final List<Short> aspathSeq1 = new ArrayList<>();
- private final List<Short> aspathSeq2 = new ArrayList<>();
- private final AsPath attr1 = new AsPath(aspathSet1, null);
- private final AsPath sameAsAttr1 = new AsPath(aspathSet1, null);
- private final AsPath attr2 = new AsPath(aspathSet2, null);
- private final AsPath attr3 = new AsPath(null, aspathSeq1);
- private final AsPath sameAsAttr3 = new AsPath(null, aspathSeq1);
- private final AsPath attr4 = new AsPath(null, aspathSeq2);
-
- @Test
- public void basics() {
- aspathSet1.add((short) 100);
- aspathSet1.add((short) 300);
- aspathSet2.add((short) 200);
- aspathSeq2.add((short) 400);
- aspathSeq1.add((short) 300);
- new EqualsTester()
- .addEqualityGroup(attr1, sameAsAttr1)
- .addEqualityGroup(attr2)
- .addEqualityGroup(attr3, sameAsAttr3)
- .addEqualityGroup(attr4)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java
deleted file mode 100644
index 1695583b..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for AutonomousSystem Tlv.
- */
-public class AutonomousSystemTest {
- private final int value1 = 101;
- private final int value2 = 201;
- private final AutonomousSystemTlv tlv1 = AutonomousSystemTlv.of(value1);
- private final AutonomousSystemTlv sameAsTlv1 = AutonomousSystemTlv.of(value1);
- private final AutonomousSystemTlv tlv2 = AutonomousSystemTlv.of(value2);
-
- @Test
- public void testEquality() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BgpLSIdentifierTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BgpLSIdentifierTest.java
deleted file mode 100644
index 59cf96fa..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BgpLSIdentifierTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGPLSIdentifier Tlv.
- */
-public class BgpLSIdentifierTest {
- private final int value1 = 8738;
- private final int value2 = 13107;
- private final BgpLSIdentifierTlv tlv1 = BgpLSIdentifierTlv.of(value1);
- private final BgpLSIdentifierTlv sameAsTlv1 = new BgpLSIdentifierTlv(value1);
- private final BgpLSIdentifierTlv tlv2 = new BgpLSIdentifierTlv(value2);
-
- @Test
- public void basics() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java
deleted file mode 100644
index 7bea518a..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for IPReachabilityInformation Tlv.
- */
-public class IPReachabilityInformationTest {
- private final byte[] value1 = new byte[] {(byte) 0xc0, (byte) 0xa8, 0x4d, 0x01};
- private final byte[] value2 = new byte[] {(byte) 0xc0};
- private final IPReachabilityInformationTlv tlv1 = IPReachabilityInformationTlv.of((byte) 0x17, value1, (short) 4);
- private final IPReachabilityInformationTlv sameAsTlv1 = IPReachabilityInformationTlv
- .of((byte) 0x17, value1, (short) 4);
- private final IPReachabilityInformationTlv tlv2 = IPReachabilityInformationTlv.of((byte) 0x05, value2, (short) 1);
-
- @Test
- public void basics() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java
deleted file mode 100755
index fdb71189..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-import org.onlab.packet.Ip4Address;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for IPv4Address Tlv.
- */
-public class IPv4AddressTest {
- private final Ip4Address value1 = Ip4Address.valueOf("127.0.0.1");
- private final Ip4Address value2 = Ip4Address.valueOf("127.0.0.1");
- private final IPv4AddressTlv tlv1 = IPv4AddressTlv.of(value1, (short) 259);
- private final IPv4AddressTlv sameAsTlv1 = IPv4AddressTlv.of(value1, (short) 259);
- private final IPv4AddressTlv tlv2 = IPv4AddressTlv.of(value2, (short) 260);
-
- @Test
- public void basics() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java
deleted file mode 100644
index 781935b4..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-import org.onlab.packet.Ip6Address;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for IPv6Address Tlv.
- */
-public class IPv6AddressTest {
- private final Ip6Address value1 = Ip6Address.valueOf("2001:db8:0:0:0:0:2:1");
- private final Ip6Address value2 = Ip6Address.valueOf("2001:db8:0:0:0:0:2:1");
- private final IPv6AddressTlv tlv1 = IPv6AddressTlv.of(value1, (short) 261);
- private final IPv6AddressTlv sameAsTlv1 = IPv6AddressTlv.of(value1, (short) 261);
- private final IPv6AddressTlv tlv2 = IPv6AddressTlv.of(value2, (short) 262);
-
- @Test
- public void basics() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsNonPseudonodeTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsNonPseudonodeTest.java
deleted file mode 100644
index 7ce4d5d3..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsNonPseudonodeTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for IsIsNonPseudonode Tlv.
- */
-public class IsIsNonPseudonodeTest {
- private final byte[] value1 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
- private final byte[] value2 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x59};
- private final IsIsNonPseudonode tlv1 = IsIsNonPseudonode.of(value1);
- private final IsIsNonPseudonode sameAsTlv1 = IsIsNonPseudonode.of(value1);
- private final IsIsNonPseudonode tlv2 = IsIsNonPseudonode.of(value2);
-
- @Test
- public void testEquality() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java
deleted file mode 100644
index a2a7c2b5..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for IsIsPseudonode Tlv.
- */
-public class IsIsPseudonodeTest {
- private final byte[] value1 = new byte[] {0x01, 0x02, 0x01, 0x02, 0x01, 0x02};
- private final byte[] value2 = new byte[] {0x01, 0x02, 0x01, 0x02, 0x01, 0x03};
- private final IsIsPseudonode tlv1 = IsIsPseudonode.of(value1, (byte) 1);
- private final IsIsPseudonode sameAsTlv1 = IsIsPseudonode.of(value1, (byte) 1);
- private final IsIsPseudonode tlv2 = IsIsPseudonode.of(value2, (byte) 1);
-
- @Test
- public void testEquality() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java
deleted file mode 100644
index f1510b17..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for LinkLocalRemoteIdentifiers Tlv.
- */
-public class LinkLocalRemoteIdentifiersTest {
- private final int value1 = 0x12101010;
- private final int value2 = 0x12101012;
- private final LinkLocalRemoteIdentifiersTlv tlv1 = LinkLocalRemoteIdentifiersTlv.of(value1, value2);
- private final LinkLocalRemoteIdentifiersTlv sameAsTlv1 = LinkLocalRemoteIdentifiersTlv.of(value1, value2);
- private final LinkLocalRemoteIdentifiersTlv tlv2 = LinkLocalRemoteIdentifiersTlv.of(value2, value1);
-
- @Test
- public void testEquality() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java
deleted file mode 100644
index 1bd34385..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for LocalPref BGP Path Attribute.
- */
-public class LocalPrefTest {
- private final int value1 = 800;
- private final int value2 = 300;
- private final LocalPref attr1 = new LocalPref(value1);
- private final LocalPref sameAsAttr1 = new LocalPref(value1);
- private final LocalPref attr2 = new LocalPref(value2);
-
- @Test
- public void testEquality() {
- new EqualsTester().addEqualityGroup(attr1, sameAsAttr1).addEqualityGroup(attr2).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java
deleted file mode 100644
index 2ee5b33f..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for MED BGP Path Attribute.
- */
-public class MedTest {
- private final int value1 = 800;
- private final int value2 = 200;
- private final Med attr1 = new Med(value1);
- private final Med sameAsAttr1 = new Med(value1);
- private final Med attr2 = new Med(value2);
-
- @Test
- public void testEquality() {
- new EqualsTester().addEqualityGroup(attr1, sameAsAttr1).addEqualityGroup(attr2).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java
deleted file mode 100755
index 799419a1..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-import org.onlab.packet.Ip4Address;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for NextHop BGP Path Attribute.
- */
-public class NextHopTest {
- private final Ip4Address value1 = Ip4Address.valueOf("12.12.12.12");
- private final Ip4Address value2 = Ip4Address.valueOf("12.12.12.13");
- private final NextHop attr1 = new NextHop(value1);
- private final NextHop sameAsAttr1 = new NextHop(value1);
- private final NextHop attr2 = new NextHop(value2);
-
- @Test
- public void basics() {
- new EqualsTester()
- .addEqualityGroup(attr1, sameAsAttr1)
- .addEqualityGroup(attr2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java
deleted file mode 100644
index da7b5570..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for Origin BGP Path Attribute.
- */
-public class OriginTest {
- private final byte value1 = 0x01;
- private final byte value2 = 0x02;
- private final Origin attr1 = new Origin(value1);
- private final Origin sameAsAttr1 = new Origin(value1);
- private final Origin attr2 = new Origin(value2);
-
- @Test
- public void basics() {
- new EqualsTester()
- .addEqualityGroup(attr1, sameAsAttr1)
- .addEqualityGroup(attr2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java
deleted file mode 100644
index a8002311..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-import org.onlab.packet.Ip4Address;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for OSPFPseudonode Tlv.
- */
-public class OspfPseudonodeTest {
- private final int value1 = 0xc3223409;
- private final int value2 = 0xc3223406;
- private final Ip4Address drInterface1 = Ip4Address.valueOf(0xaf91e01);
- private final Ip4Address drInterface2 = Ip4Address.valueOf(0xaf91e02);
- private final OSPFPseudonode tlv1 = OSPFPseudonode.of(value1, drInterface1);
- private final OSPFPseudonode sameAsTlv1 = OSPFPseudonode.of(value1, drInterface1);
- private final OSPFPseudonode tlv2 = OSPFPseudonode.of(value2, drInterface2);
-
- @Test
- public void testEquality() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java
deleted file mode 100644
index 859bdbe5..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for OSPFRouteType Tlv.
- */
-public class OspfRouteTypeTest {
- private final byte value1 = 5;
- private final byte value2 = 4;
- private final OSPFRouteTypeTlv tlv1 = OSPFRouteTypeTlv.of(value1);
- private final OSPFRouteTypeTlv sameAsTlv1 = OSPFRouteTypeTlv.of(value1);
- private final OSPFRouteTypeTlv tlv2 = OSPFRouteTypeTlv.of(value2);
-
- @Test
- public void testEquality() {
- new EqualsTester()
- .addEqualityGroup(tlv1, sameAsTlv1)
- .addEqualityGroup(tlv2)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
deleted file mode 100644
index 4efb7f5b..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP attribute node flag.
- */
-public class BgpAttrNodeFlagBitTlvTest {
-
- private final boolean bOverloadBit = true;
- private final boolean bAttachedBit = true;
- private final boolean bExternalBit = true;
- private final boolean bABRBit = true;
-
- private final boolean bOverloadBit1 = false;
- private final boolean bAttachedBit1 = false;
- private final boolean bExternalBit1 = false;
- private final boolean bABRBit1 = false;
-
- private final BgpAttrNodeFlagBitTlv data = BgpAttrNodeFlagBitTlv
- .of(bOverloadBit, bAttachedBit, bExternalBit, bABRBit);
- private final BgpAttrNodeFlagBitTlv sameAsData = BgpAttrNodeFlagBitTlv
- .of(bOverloadBit, bAttachedBit, bExternalBit, bABRBit);
- private final BgpAttrNodeFlagBitTlv diffData = BgpAttrNodeFlagBitTlv
- .of(bOverloadBit1, bAttachedBit1, bExternalBit1, bABRBit1);
-
- @Test
- public void basics() {
-
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
deleted file mode 100644
index 16ca58ee..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-import org.onlab.packet.Ip6Address;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP attribute node router ID.
- */
-public class BgpAttrRouterIdV6Test {
-
- private final short sType = 1;
- private final Ip6Address ip6RouterId = Ip6Address
- .valueOf("2001:0db8:0a0b:12f0:0000:0000:0000:0001");
-
- private final short sType1 = 2;
- private final Ip6Address ip6RouterId1 = Ip6Address
- .valueOf("2004:0db8:0a0b:12f0:0000:0000:0000:0004");
-
- private final BgpAttrRouterIdV6 data = BgpAttrRouterIdV6.of(ip6RouterId,
- sType);
- private final BgpAttrRouterIdV6 sameAsData = BgpAttrRouterIdV6
- .of(ip6RouterId, sType);
- private final BgpAttrRouterIdV6 diffData = BgpAttrRouterIdV6
- .of(ip6RouterId1, sType1);
-
- @Test
- public void basics() {
-
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
deleted file mode 100644
index ef1cfcea..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP link IGP metric attribute.
- */
-public class BgpLinkAttrIgpMetricTest {
- private final int val = 0x010203;
- private final int valLen = 3;
- private final int val1 = 0x01020304;
- private final int val1Len = 4;
-
- private final BgpLinkAttrIgpMetric data = BgpLinkAttrIgpMetric.of(val,
- valLen);
- private final BgpLinkAttrIgpMetric sameAsData = BgpLinkAttrIgpMetric
- .of(val, valLen);
- private final BgpLinkAttrIgpMetric diffData = BgpLinkAttrIgpMetric
- .of(val1, val1Len);
-
- @Test
- public void basics() {
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java
deleted file mode 100644
index 06fecc92..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP link max bandwidth attribute.
- */
-public class BgpLinkAttrMaxLinkBandwidthTest {
- private final float val = 0x010203;
- private final short valLen = 3;
- private final float val1 = 0x01020304;
- private final short val1Len = 4;
-
- private final BgpLinkAttrMaxLinkBandwidth data = BgpLinkAttrMaxLinkBandwidth
- .of(val, valLen);
- private final BgpLinkAttrMaxLinkBandwidth sameAsData = BgpLinkAttrMaxLinkBandwidth
- .of(val, valLen);
- private final BgpLinkAttrMaxLinkBandwidth diffData = BgpLinkAttrMaxLinkBandwidth
- .of(val1, val1Len);
-
- @Test
- public void basics() {
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java
deleted file mode 100644
index c0d7f986..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for MPLS protocol mask attribute.
- */
-public class BgpLinkAttrMplsProtocolMaskTest {
- private final boolean val = true;
- private final boolean val1 = false;
-
- private final BgpLinkAttrMplsProtocolMask data = BgpLinkAttrMplsProtocolMask
- .of(val, val);
- private final BgpLinkAttrMplsProtocolMask sameAsData = BgpLinkAttrMplsProtocolMask
- .of(val, val);
- private final BgpLinkAttrMplsProtocolMask diffData = BgpLinkAttrMplsProtocolMask
- .of(val, val1);
-
- @Test
- public void basics() {
-
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java
deleted file mode 100644
index 45048527..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for Link attribute name Tlv.
- */
-public class BgpLinkAttrNameTest {
- private final byte[] array = new byte[] {0x01, 0x02, 0x03, 0x04};
- private final byte[] array1 = new byte[] {0x01, 0x02, 0x03, 0x01};
-
- private final BgpLinkAttrName isisData = BgpLinkAttrName.of(array);
- private final BgpLinkAttrName sameAsIsisData = BgpLinkAttrName.of(array);
- private final BgpLinkAttrName isisDiff = BgpLinkAttrName.of(array1);
-
- @Test
- public void basics() {
- new EqualsTester().addEqualityGroup(isisData, sameAsIsisData)
- .addEqualityGroup(isisDiff).testEquals();
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java
deleted file mode 100644
index 71d05f85..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for Opaque Link attribute Tlv.
- */
-public class BgpLinkAttrOpaqLnkAttribTest {
- private final byte[] array = new byte[] {0x01, 0x02, 0x03, 0x04};
- private final byte[] array1 = new byte[] {0x01, 0x02, 0x03, 0x01};
-
- private final BgpLinkAttrOpaqLnkAttrib isisData = BgpLinkAttrOpaqLnkAttrib
- .of(array);
- private final BgpLinkAttrOpaqLnkAttrib sameAsIsisData = BgpLinkAttrOpaqLnkAttrib
- .of(array);
- private final BgpLinkAttrOpaqLnkAttrib isisDiff = BgpLinkAttrOpaqLnkAttrib
- .of(array1);
-
- @Test
- public void basics() {
- new EqualsTester().addEqualityGroup(isisData, sameAsIsisData)
- .addEqualityGroup(isisDiff).testEquals();
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
deleted file mode 100644
index 2fb76352..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for MPLS protocol mask attribute.
- */
-public class BgpLinkAttrProtectionTypeTest {
- boolean bExtraTraffic = true;
- boolean bUnprotected = true;
- boolean bShared = true;
- boolean bDedOneIstoOne = true;
- boolean bDedOnePlusOne = true;
- boolean bEnhanced = true;
-
- boolean bExtraTraffic1 = false;
- boolean bUnprotected1 = false;
- boolean bShared1 = false;
- boolean bDedOneIstoOne1 = false;
- boolean bDedOnePlusOne1 = false;
- boolean bEnhanced1 = false;
-
- private final BgpLinkAttrProtectionType data = BgpLinkAttrProtectionType
- .of(bExtraTraffic, bUnprotected, bShared, bDedOneIstoOne,
- bDedOnePlusOne, bEnhanced);
- private final BgpLinkAttrProtectionType sameAsData = BgpLinkAttrProtectionType
- .of(bExtraTraffic, bUnprotected, bShared, bDedOneIstoOne,
- bDedOnePlusOne, bEnhanced);
- private final BgpLinkAttrProtectionType diffData = BgpLinkAttrProtectionType
- .of(bExtraTraffic1, bUnprotected1, bShared1, bDedOneIstoOne1,
- bDedOnePlusOne1, bEnhanced1);
-
- @Test
- public void basics() {
-
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java
deleted file mode 100644
index 9f3a7fad..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP link TE default metric attribute.
- */
-public class BgpLinkAttrTeDefaultMetricTest {
- private final int val = 0x010203;
- private final int val1 = 0x01020304;
-
- private final BgpLinkAttrTeDefaultMetric data = BgpLinkAttrTeDefaultMetric
- .of(val);
- private final BgpLinkAttrTeDefaultMetric sameAsData = BgpLinkAttrTeDefaultMetric
- .of(val);
- private final BgpLinkAttrTeDefaultMetric diffData = BgpLinkAttrTeDefaultMetric
- .of(val1);
-
- @Test
- public void basics() {
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java
deleted file mode 100644
index f1d2a1fa..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import java.util.ArrayList;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP unreserved bandwidth attribute.
- */
-public class BgpLinkAttrUnRsrvdLinkBandwidthTest {
- ArrayList<Float> maxUnResBandwidth = new ArrayList<Float>();
- ArrayList<Float> maxUnResBandwidth1 = new ArrayList<Float>();
- short sType = 10;
-
- private final BgpLinkAttrUnRsrvdLinkBandwidth isisData = BgpLinkAttrUnRsrvdLinkBandwidth
- .of(maxUnResBandwidth, sType);
- private final BgpLinkAttrUnRsrvdLinkBandwidth sameAsIsisData = BgpLinkAttrUnRsrvdLinkBandwidth
- .of(maxUnResBandwidth, sType);
- private final BgpLinkAttrUnRsrvdLinkBandwidth isisDiff = BgpLinkAttrUnRsrvdLinkBandwidth
- .of(maxUnResBandwidth1, sType);
-
- @Test
- public void basics() {
-
- maxUnResBandwidth.add(new Float(1));
- maxUnResBandwidth.add(new Float(2));
- maxUnResBandwidth.add(new Float(3));
- maxUnResBandwidth.add(new Float(4));
-
- maxUnResBandwidth1.add(new Float(1));
- maxUnResBandwidth1.add(new Float(2));
- maxUnResBandwidth1.add(new Float(3));
- maxUnResBandwidth1.add(new Float(1));
-
- new EqualsTester().addEqualityGroup(isisData, sameAsIsisData)
- .addEqualityGroup(isisDiff).testEquals();
-
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java
deleted file mode 100644
index 535518f8..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP prefix IGP Flag attribute.
- */
-public class BgpPrefixAttrIgpFlagsTest {
-
- private final boolean bisisUpDownBit = true;
- private final boolean bOspfNoUnicastBit = true;
- private final boolean bOspfLclAddrBit = true;
- private final boolean bOspfNSSABit = true;
-
- private final boolean bisisUpDownBit1 = false;
- private final boolean bOspfNoUnicastBit1 = false;
- private final boolean bOspfLclAddrBit1 = false;
- private final boolean bOspfNSSABit1 = false;
-
- private final BgpPrefixAttrIgpFlags data = BgpPrefixAttrIgpFlags
- .of(bisisUpDownBit, bOspfNoUnicastBit, bOspfLclAddrBit,
- bOspfNSSABit);
- private final BgpPrefixAttrIgpFlags sameAsData = BgpPrefixAttrIgpFlags
- .of(bisisUpDownBit, bOspfNoUnicastBit, bOspfLclAddrBit,
- bOspfNSSABit);
- private final BgpPrefixAttrIgpFlags diffData = BgpPrefixAttrIgpFlags
- .of(bisisUpDownBit1, bOspfNoUnicastBit1, bOspfLclAddrBit1,
- bOspfNSSABit1);
-
- @Test
- public void basics() {
-
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java
deleted file mode 100644
index fe6079fd..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP prefix metric attribute.
- */
-public class BgpPrefixAttrMetricTest {
- private final int val = 1111;
- private final int val1 = 2222;
-
- private final BgpPrefixAttrMetric data = BgpPrefixAttrMetric.of(val);
- private final BgpPrefixAttrMetric sameAsData = BgpPrefixAttrMetric.of(val);
- private final BgpPrefixAttrMetric diffData = BgpPrefixAttrMetric.of(val1);
-
- @Test
- public void basics() {
-
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java
deleted file mode 100644
index 17dafbb7..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for prefix attribute opaque data Tlv.
- */
-public class BgpPrefixAttrOpaqueDataTest {
- private final byte[] array = new byte[] {0x01, 0x02, 0x03, 0x04};
- private final byte[] array1 = new byte[] {0x01, 0x02, 0x03, 0x01};
-
- private final BgpPrefixAttrOpaqueData isisData = BgpPrefixAttrOpaqueData
- .of(array);
- private final BgpPrefixAttrOpaqueData sameAsIsisData = BgpPrefixAttrOpaqueData
- .of(array);
- private final BgpPrefixAttrOpaqueData isisDiff = BgpPrefixAttrOpaqueData
- .of(array1);
-
- @Test
- public void basics() {
- new EqualsTester().addEqualityGroup(isisData, sameAsIsisData)
- .addEqualityGroup(isisDiff).testEquals();
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
deleted file mode 100644
index f6fe39f8..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import org.junit.Test;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.Ip6Address;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP prefix metric attribute.
- */
-public class BgpPrefixAttrOspfFwdAddrTest {
-
- private final short lsAttrLength = 4;
- private final Ip4Address ip4RouterId = Ip4Address.valueOf("192.168.1.1");
- private final Ip6Address ip6RouterId = Ip6Address
- .valueOf("2001:0db8:0a0b:12f0:0000:0000:0000:0001");
-
- private final short lsAttrLength1 = 16;
- private final Ip4Address ip4RouterId1 = Ip4Address.valueOf("192.168.1.2");
- private final Ip6Address ip6RouterId1 = Ip6Address
- .valueOf("1002:0db8:0a0b:12f0:0000:0000:0000:0002");
-
- private final BgpPrefixAttrOspfFwdAddr data = BgpPrefixAttrOspfFwdAddr
- .of(lsAttrLength, ip4RouterId, ip6RouterId);
- private final BgpPrefixAttrOspfFwdAddr sameAsData = BgpPrefixAttrOspfFwdAddr
- .of(lsAttrLength, ip4RouterId, ip6RouterId);
- private final BgpPrefixAttrOspfFwdAddr diffData = BgpPrefixAttrOspfFwdAddr
- .of(lsAttrLength1, ip4RouterId1, ip6RouterId1);
-
- @Test
- public void basics() {
- new EqualsTester().addEqualityGroup(data, sameAsData)
- .addEqualityGroup(diffData).testEquals();
- }
-}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java
deleted file mode 100644
index 25ced61f..00000000
--- a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.bgpio.types.attr;
-
-import java.util.ArrayList;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Test for BGP prefix route tag attribute.
- */
-public class BgpPrefixAttrRouteTagTest {
- ArrayList<Integer> maxUnResBandwidth = new ArrayList<Integer>();
- ArrayList<Integer> maxUnResBandwidth1 = new ArrayList<Integer>();
-
- private final BgpPrefixAttrRouteTag isisData = BgpPrefixAttrRouteTag
- .of(maxUnResBandwidth);
- private final BgpPrefixAttrRouteTag sameAsIsisData = BgpPrefixAttrRouteTag
- .of(maxUnResBandwidth);
- private final BgpPrefixAttrRouteTag isisDiff = BgpPrefixAttrRouteTag
- .of(maxUnResBandwidth1);
-
- @Test
- public void basics() {
-
- maxUnResBandwidth.add(new Integer(1));
- maxUnResBandwidth.add(new Integer(2));
- maxUnResBandwidth.add(new Integer(3));
- maxUnResBandwidth.add(new Integer(4));
-
- maxUnResBandwidth1.add(new Integer(1));
- maxUnResBandwidth1.add(new Integer(2));
- maxUnResBandwidth1.add(new Integer(3));
- maxUnResBandwidth1.add(new Integer(1));
-
- new EqualsTester().addEqualityGroup(isisData, sameAsIsisData)
- .addEqualityGroup(isisDiff).testEquals();
- }
-} \ No newline at end of file