nicklesh adlakha
Committed by Gerrit Code Review

ONOS-4085, ONOS-4096, ONOS-4097: JUNIT for ISIS PDU data structures

Change-Id: If2ef21201d4d86a2f3f4b95365d41a01d8feda98
......@@ -79,11 +79,25 @@ public class Psnp extends IsisHeader {
populateHeader(isisHeader);
}
/**
* Adds the TLV to list.
*
* @param isisTlv ISIS TLV instance
*/
public void addTlv(IsisTlv isisTlv) {
variableLengths.add(isisTlv);
}
/**
* Returns the list of all tlvs.
*
* @return variableLengths list of tlvs
*/
public List<IsisTlv> getAllTlv() {
return variableLengths;
}
/**
* Returns the source ID of csnp.
*
* @return sourceId source ID
......@@ -136,7 +150,9 @@ public class Psnp extends IsisHeader {
TlvType tlvValue = TlvType.get(tlvHeader.tlvType());
if (tlvValue != null) {
IsisTlv tlv = TlvFinder.findTlv(tlvHeader, channelBuffer.readBytes(tlvHeader.tlvLength()));
this.variableLengths.add(tlv);
if (tlv != null) {
this.variableLengths.add(tlv);
}
} else {
channelBuffer.readBytes(tlvHeader.tlvLength());
}
......
......@@ -654,7 +654,7 @@ public final class IsisUtil {
* @return given number as bytes
*/
public static byte[] convertToThreeBytes(int numberToConvert) {
byte[] numInBytes = new byte[4];
byte[] numInBytes = new byte[3];
String s1 = Integer.toHexString(numberToConvert);
if (s1.length() % 2 != 0) {
s1 = "0" + s1;
......@@ -708,4 +708,4 @@ public final class IsisUtil {
}
return Bytes.toArray(byteList);
}
}
\ No newline at end of file
}
......
/*
* Copyright 2016-present 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.isis.io.isispacket;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.MacAddress;
import org.onosproject.isis.controller.IsisPduType;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
/**
* Unit test class for IsisHeader.
*/
public class IsisHeaderTest {
private IsisHeader isisHeader;
private MacAddress macAddress = MacAddress.valueOf("a4:23:05:00:00:00");
private int result;
private MacAddress result1;
private byte result2;
private IsisPduType result3;
private ChannelBuffer channelBuffer;
@Before
public void setUp() throws Exception {
isisHeader = new IsisHeader();
channelBuffer = EasyMock.createMock(ChannelBuffer.class);
}
@After
public void tearDown() throws Exception {
isisHeader = null;
}
/**
* Tests interfaceIndex() getter method.
*/
@Test
public void testInterfaceIndex() throws Exception {
isisHeader.setInterfaceIndex(1);
result = isisHeader.interfaceIndex();
assertThat(result, is(1));
}
/**
* Tests interfaceIndex() setter method.
*/
@Test
public void testSetInterfaceIndex() throws Exception {
isisHeader.setInterfaceIndex(1);
result = isisHeader.interfaceIndex();
assertThat(result, is(1));
}
/**
* Tests interfaceMac() getter method.
*/
@Test
public void testInterfaceMac() throws Exception {
isisHeader.setInterfaceMac(macAddress);
result1 = isisHeader.interfaceMac();
assertThat(result1, is(macAddress));
}
/**
* Tests sourceMac() getter method.
*/
@Test
public void testSourceMac() throws Exception {
isisHeader.setSourceMac(macAddress);
result1 = isisHeader.sourceMac();
assertThat(result1, is(macAddress));
}
/**
* Tests sourceMac() setter method.
*/
@Test
public void testSetSourceMac() throws Exception {
isisHeader.setSourceMac(macAddress);
result1 = isisHeader.sourceMac();
assertThat(result1, is(macAddress));
}
/**
* Tests interfaceMac() setter method.
*/
@Test
public void testSetInterfaceMac() throws Exception {
isisHeader.setSourceMac(macAddress);
result1 = isisHeader.sourceMac();
assertThat(result1, is(macAddress));
}
/**
* Tests version2() getter method.
*/
@Test
public void testVersion2() throws Exception {
isisHeader.setVersion2((byte) 1);
result2 = isisHeader.version2();
assertThat(result2, is((byte) 1));
}
/**
* Tests version2() setter method.
*/
@Test
public void testSetVersion2() throws Exception {
isisHeader.setVersion2((byte) 1);
result2 = isisHeader.version2();
assertThat(result2, is((byte) 1));
}
/**
* Tests maximumAreaAddresses() getter method.
*/
@Test
public void testMaximumAreaAddresses() throws Exception {
isisHeader.setMaximumAreaAddresses((byte) 1);
result2 = isisHeader.maximumAreaAddresses();
assertThat(result2, is((byte) 1));
}
/**
* Tests maximumAreaAddresses() setter method.
*/
@Test
public void testSetMaximumAreaAddresses() throws Exception {
isisHeader.setMaximumAreaAddresses((byte) 1);
result2 = isisHeader.maximumAreaAddresses();
assertThat(result2, is((byte) 1));
}
/**
* Tests reserved() getter method.
*/
@Test
public void testReserved() throws Exception {
isisHeader.setReserved((byte) 1);
result2 = isisHeader.reserved();
assertThat(result2, is((byte) 1));
}
/**
* Tests reserved() setter method.
*/
@Test
public void testSetReserved() throws Exception {
isisHeader.setReserved((byte) 1);
result2 = isisHeader.reserved();
assertThat(result2, is((byte) 1));
}
/**
* Tests version() getter method.
*/
@Test
public void testVersion() throws Exception {
isisHeader.setVersion((byte) 1);
result2 = isisHeader.version();
assertThat(result2, is((byte) 1));
}
/**
* Tests version() setter method.
*/
@Test
public void testSetVersion() throws Exception {
isisHeader.setVersion((byte) 1);
result2 = isisHeader.version();
assertThat(result2, is((byte) 1));
}
/**
* Tests idLength() getter method.
*/
@Test
public void testIdLength() throws Exception {
isisHeader.setIdLength((byte) 1);
result2 = isisHeader.idLength();
assertThat(result2, is((byte) 1));
}
/**
* Tests idLength() setter method.
*/
@Test
public void testSetIdLength() throws Exception {
isisHeader.setIdLength((byte) 1);
result2 = isisHeader.idLength();
assertThat(result2, is((byte) 1));
}
/**
* Tests pduType() getter method.
*/
@Test
public void testPduType() throws Exception {
isisHeader.setIsisPduType(1);
result = isisHeader.pduType();
assertThat(result, is(1));
}
/**
* Tests pduType() setter method.
*/
@Test
public void testSetIsisPduType() throws Exception {
isisHeader.setIsisPduType(1);
result = isisHeader.pduType();
assertThat(result, is(1));
}
/**
* Tests pduHeaderLength() getter method.
*/
@Test
public void testPduHeaderLength() throws Exception {
isisHeader.setPduHeaderLength((byte) 1);
result2 = isisHeader.pduHeaderLength();
assertThat(result2, is((byte) 1));
}
/**
* Tests pduHeaderLength() setter method.
*/
@Test
public void testSetPduHeaderLength() throws Exception {
isisHeader.setPduHeaderLength((byte) 1);
result2 = isisHeader.pduHeaderLength();
assertThat(result2, is((byte) 1));
}
/**
* Tests irpDiscriminator() getter method.
*/
@Test
public void testIrpDiscriminator() throws Exception {
isisHeader.setIrpDiscriminator((byte) 1);
result2 = isisHeader.irpDiscriminator();
assertThat(result2, is((byte) 1));
}
/**
* Tests irpDiscriminator() setter method.
*/
@Test
public void testSetIrpDiscriminator() throws Exception {
isisHeader.setIrpDiscriminator((byte) 1);
result2 = isisHeader.irpDiscriminator();
assertThat(result2, is((byte) 1));
}
/**
* Tests irpDiscriminator() setter method.
*/
@Test
public void testIsisPduType() throws Exception {
isisHeader.setIsisPduType(IsisPduType.L1HELLOPDU.value());
result3 = isisHeader.isisPduType();
assertThat(result3, is(IsisPduType.L1HELLOPDU));
}
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
isisHeader.readFrom(channelBuffer);
assertThat(isisHeader, is(notNullValue()));
}
/**
* Tests asBytes() method.
*/
@Test
public void testAsBytes() throws Exception {
isisHeader.asBytes();
assertThat(isisHeader, is(notNullValue()));
}
/**
* Tests populateHeader() method.
*/
@Test
public void testPopulateHeader() throws Exception {
isisHeader.populateHeader(new IsisHeader());
assertThat(isisHeader, is(notNullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016-present 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.isis.io.isispacket.pdu;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.isis.controller.IsisPduType;
import org.onosproject.isis.io.isispacket.IsisHeader;
import org.onosproject.isis.io.isispacket.tlv.AdjacencyStateTlv;
import org.onosproject.isis.io.isispacket.tlv.IsisTlv;
import org.onosproject.isis.io.isispacket.tlv.TlvHeader;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for Csnp.
*/
public class CsnpTest {
private final String srcId = "1111.1111.1111";
private final byte[] csnpBytes = {
0, 67, 18, 52, 18, 52, 0, 0, 67, 18, 52, 18, 52, 0,
18, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1,
-1, -1, 9, 32, 4, -81, 18, 52, 18, 52, 0, 18, 0, 0, 0,
0, 0, 41, -92, -30, 4, -81, 41, 41, 41, 41, 41, 41, 0,
0, 0, 0, 0, 1, 91, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0
};
private Csnp csnp;
private IsisHeader isisHeader;
private IsisTlv isisTlv;
private TlvHeader tlvHeader;
private List<IsisTlv> resultList;
private String resultStr;
private int resultInt;
private ChannelBuffer channelBuffer;
private byte[] result;
@Before
public void setUp() throws Exception {
isisHeader = new IsisHeader();
isisHeader.setIsisPduType(IsisPduType.L1CSNP.value());
csnp = new Csnp(isisHeader);
tlvHeader = new TlvHeader();
isisTlv = new AdjacencyStateTlv(tlvHeader);
channelBuffer = EasyMock.createMock(ChannelBuffer.class);
}
@After
public void tearDown() throws Exception {
isisHeader = null;
csnp = null;
tlvHeader = null;
isisTlv = null;
}
/**
* Tests getAllTlv() method.
*/
@Test
public void testGetAllTlv() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(csnpBytes);
csnp.readFrom(channelBuffer);
resultList = csnp.getAllTlv();
assertThat(resultList.size(), is(0));
}
/**
* Tests sourceId() getter method.
*/
@Test
public void testSourceId() throws Exception {
csnp.setSourceId(srcId);
resultStr = csnp.sourceId();
assertThat(resultStr, is(srcId));
}
/**
* Tests sourceId() setter method.
*/
@Test
public void testSetSourceId() throws Exception {
csnp.setSourceId(srcId);
resultStr = csnp.sourceId();
assertThat(resultStr, is(srcId));
}
/**
* Tests startLspId() getter method.
*/
@Test
public void testStartLspId() throws Exception {
csnp.setStartLspId(srcId);
resultStr = csnp.startLspId();
assertThat(resultStr, is(srcId));
}
/**
* Tests startLspId() setter method.
*/
@Test
public void testSetStartLspId() throws Exception {
csnp.setStartLspId(srcId);
resultStr = csnp.startLspId();
assertThat(resultStr, is(srcId));
}
/**
* Tests endLspId() getter method.
*/
@Test
public void testEndLspId() throws Exception {
csnp.setEndLspId(srcId);
resultStr = csnp.endLspId();
assertThat(resultStr, is(srcId));
}
/**
* Tests endLspId() setter method.
*/
@Test
public void testSetEndLspId() throws Exception {
csnp.setEndLspId(srcId);
resultStr = csnp.endLspId();
assertThat(resultStr, is(srcId));
}
/**
* Tests pduLength() getter method.
*/
@Test
public void testPduLength() throws Exception {
csnp.setPduLength(10);
resultInt = csnp.pduLength();
assertThat(resultInt, is(10));
}
/**
* Tests pduLength() setter method.
*/
@Test
public void testSetPduLength() throws Exception {
csnp.setPduLength(10);
resultInt = csnp.pduLength();
assertThat(resultInt, is(10));
}
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(csnpBytes);
csnp.readFrom(channelBuffer);
assertThat(csnp, is(notNullValue()));
}
/**
* Tests asBytes() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(csnpBytes);
csnp.readFrom(channelBuffer);
result = csnp.asBytes();
assertThat(csnp, is(notNullValue()));
}
/**
* Tests isisPduHeader() method.
*/
@Test
public void testIsisPduHeader() throws Exception {
result = csnp.isisPduHeader();
assertThat(result, is(notNullValue()));
}
/**
* Tests completeSequenceNumberPduBody() method.
*/
@Test
public void testCompleteSequenceNumberPduBody() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(csnpBytes);
csnp.readFrom(channelBuffer);
result = csnp.completeSequenceNumberPduBody();
assertThat(result, is(notNullValue()));
}
/**
* Tests toString() method.
*/
@Test
public void testToString() throws Exception {
assertThat((csnp.toString()), is(notNullValue()));
}
/**
* Tests equals() method.
*/
@Test
public void testEquals() throws Exception {
assertThat(csnp.equals(new Csnp(new IsisHeader())), is(true));
}
/**
* Tests hashCode() method.
*/
@Test
public void testHashCode() throws Exception {
int hashCode = csnp.hashCode();
assertThat(hashCode, is(notNullValue()));
}
}
/*
* Copyright 2016-present 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.isis.io.isispacket.pdu;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.isis.io.isispacket.IsisHeader;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for L1L2HelloPdu.
*/
public class L1L2HelloPduTest {
private final String lanId = "1111.1111.1111";
private final byte[] helloL1L2 = {
1, 34, 34, 34, 34, 34, 34, 0,
30, 5, -39, 64, 34, 34, 34, 34, 34, 34, 1, -127, 1, -52, 1,
4, 3, 73, 0, 10, -124, 4, 10, 0, 10, 2, -45, 3, 0, 0, 0,
8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, -93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
private L1L2HelloPdu l1L2HelloPdu;
private IsisHeader isisHeader;
private String resultStr;
private byte resultByte;
private int resultInt;
private ChannelBuffer channelBuffer;
private byte[] result;
@Before
public void setUp() throws Exception {
isisHeader = new IsisHeader();
isisHeader.setIsisPduType(15);
l1L2HelloPdu = new L1L2HelloPdu(isisHeader);
channelBuffer = EasyMock.createMock(ChannelBuffer.class);
}
@After
public void tearDown() throws Exception {
isisHeader = null;
l1L2HelloPdu = null;
}
/**
* Tests setLanId() getter method.
*/
@Test
public void testLanId() throws Exception {
l1L2HelloPdu.setLanId(lanId);
resultStr = l1L2HelloPdu.lanId();
assertThat(resultStr, is(lanId));
}
/**
* Tests setLanId() setter method.
*/
@Test
public void testSetLanId() throws Exception {
l1L2HelloPdu.setLanId(lanId);
resultStr = l1L2HelloPdu.lanId();
assertThat(resultStr, is(lanId));
}
/**
* Tests priority() getter method.
*/
@Test
public void testPriority() throws Exception {
l1L2HelloPdu.setPriority((byte) 1);
resultByte = l1L2HelloPdu.priority();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests priority() setter method.
*/
@Test
public void testSetPriority() throws Exception {
l1L2HelloPdu.setPriority((byte) 1);
resultByte = l1L2HelloPdu.priority();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(helloL1L2);
l1L2HelloPdu.readFrom(channelBuffer);
assertThat(l1L2HelloPdu, is(notNullValue()));
}
/**
* Tests asByte() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(helloL1L2);
l1L2HelloPdu.readFrom(channelBuffer);
result = l1L2HelloPdu.asBytes();
assertThat(l1L2HelloPdu, is(notNullValue()));
}
/**
* Tests l1l2IsisPduHeader() method.
*/
@Test
public void testL1l2IsisPduHeader() throws Exception {
result = l1L2HelloPdu.l1l2IsisPduHeader();
assertThat(l1L2HelloPdu, is(notNullValue()));
}
/**
* Tests l1l2HelloPduBody() method.
*/
@Test
public void testL1l2HelloPduBody() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(helloL1L2);
l1L2HelloPdu.readFrom(channelBuffer);
result = l1L2HelloPdu.l1l2HelloPduBody();
assertThat(result, is(notNullValue()));
}
/**
* Tests toString() method.
*/
@Test
public void testToString() throws Exception {
assertThat(l1L2HelloPdu.toString(), is(notNullValue()));
}
/**
* Tests equals() method.
*/
@Test
public void testEquals() throws Exception {
assertThat(l1L2HelloPdu.equals(new L1L2HelloPdu(new IsisHeader())), is(true));
}
/**
* Tests hashCode() method.
*/
@Test
public void testHashCode() throws Exception {
resultInt = l1L2HelloPdu.hashCode();
assertThat(resultInt, is(notNullValue()));
}
}
/*
* Copyright 2016-present 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.isis.io.isispacket.pdu;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.isis.controller.IsisPduType;
import org.onosproject.isis.io.isispacket.IsisHeader;
import org.onosproject.isis.io.isispacket.tlv.HostNameTlv;
import org.onosproject.isis.io.isispacket.tlv.TlvHeader;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for LsPdu.
*/
public class LsPduTest {
private final String lspId = "1111.1111.1111";
private final byte[] l1Lsp = {
0, 86, 4, -81, 34, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 9, 99, 11, 1, 1, 4, 3, 73,
0, 10, -127, 1, -52, -119, 2, 82, 50, -124, 4, -64, -88, 10, 1, -128, 24, 10,
-128, -128, -128, 10, 0, 10, 0, -1, -1, -1, -4, 10, -128, -128, -128, -64, -88,
10, 0, -1, -1, -1, 0, 2, 12, 0, 10, -128, -128, -128, 51, 51, 51, 51, 51, 51, 2
};
private LsPdu lsPdu;
private IsisHeader isisHeader;
private TlvHeader tlvHeader;
private int resultInt;
private boolean resultBool;
private byte resultByte;
private AttachedToOtherAreas resultObj;
private String resultStr;
private ChannelBuffer channelBuffer;
private byte[] result;
@Before
public void setUp() throws Exception {
isisHeader = new IsisHeader();
tlvHeader = new TlvHeader();
isisHeader.setIsisPduType(IsisPduType.L1LSPDU.value());
lsPdu = new LsPdu(isisHeader);
channelBuffer = EasyMock.createMock(ChannelBuffer.class);
}
@After
public void tearDown() throws Exception {
isisHeader = null;
lsPdu = null;
tlvHeader = null;
channelBuffer = null;
}
/**
* Tests addTlv() method.
*/
@Test
public void testAddTlv() throws Exception {
lsPdu.addTlv(new HostNameTlv(tlvHeader));
assertThat(lsPdu, is(notNullValue()));
}
/**
* Tests remainingLifeTime() getter method.
*/
@Test
public void testRemainingLifeTime() throws Exception {
lsPdu.setRemainingLifeTime(10);
resultInt = lsPdu.remainingLifeTime();
assertThat(resultInt, is(10));
}
/**
* Tests remainingLifeTime() setter method.
*/
@Test
public void testSetRemainingLifeTime() throws Exception {
lsPdu.setRemainingLifeTime(10);
resultInt = lsPdu.remainingLifeTime();
assertThat(resultInt, is(10));
}
/**
* Tests lspDbol() getter method.
*/
@Test
public void testLspDbol() throws Exception {
lsPdu.setLspDbol(true);
resultBool = lsPdu.lspDbol();
assertThat(resultBool, is(true));
}
/**
* Tests lspDbol() setter method.
*/
@Test
public void testSetLspDbol() throws Exception {
lsPdu.setLspDbol(true);
resultBool = lsPdu.lspDbol();
assertThat(resultBool, is(true));
}
/**
* Tests typeBlock() getter method.
*/
@Test
public void testTypeBlock() throws Exception {
lsPdu.setTypeBlock((byte) 1);
resultByte = lsPdu.typeBlock();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests typeBlock() setter method.
*/
@Test
public void testSetTypeBlock() throws Exception {
lsPdu.setTypeBlock((byte) 1);
resultByte = lsPdu.typeBlock();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests sequenceNumber() getter method.
*/
@Test
public void testSequenceNumber() throws Exception {
lsPdu.setSequenceNumber(1);
resultInt = lsPdu.sequenceNumber();
assertThat(resultInt, is(1));
}
/**
* Tests sequenceNumber() setter method.
*/
@Test
public void testSetSequenceNumber() throws Exception {
lsPdu.setSequenceNumber(1);
resultInt = lsPdu.sequenceNumber();
assertThat(resultInt, is(1));
}
/**
* Tests checkSum() getter method.
*/
@Test
public void testCheckSum() throws Exception {
lsPdu.setCheckSum(1);
resultInt = lsPdu.checkSum();
assertThat(resultInt, is(1));
}
/**
* Tests checkSum() setter method.
*/
@Test
public void testSetCheckSum() throws Exception {
lsPdu.setCheckSum(1);
resultInt = lsPdu.checkSum();
assertThat(resultInt, is(1));
}
/**
* Tests partitionRepair() getter method.
*/
@Test
public void testPartitionRepair() throws Exception {
lsPdu.setPartitionRepair(true);
resultBool = lsPdu.partitionRepair();
assertThat(resultBool, is(true));
}
/**
* Tests partitionRepair() setter method.
*/
@Test
public void testSetPartitionRepair() throws Exception {
lsPdu.setPartitionRepair(true);
resultBool = lsPdu.partitionRepair();
assertThat(resultBool, is(true));
}
/**
* Tests attachedToOtherAreas() getter method.
*/
@Test
public void testAttachedToOtherAreas() throws Exception {
lsPdu.setAttachedToOtherAreas(AttachedToOtherAreas.DEFAULTMETRIC);
resultObj = lsPdu.attachedToOtherAreas();
assertThat(resultObj, is(AttachedToOtherAreas.DEFAULTMETRIC));
}
/**
* Tests attachedToOtherAreas() setter method.
*/
@Test
public void testSetAttachedToOtherAreas() throws Exception {
lsPdu.setAttachedToOtherAreas(AttachedToOtherAreas.DEFAULTMETRIC);
resultObj = lsPdu.attachedToOtherAreas();
assertThat(resultObj, is(AttachedToOtherAreas.DEFAULTMETRIC));
}
/**
* Tests intermediateSystemType() getter method.
*/
@Test
public void testIntermediateSystemType() throws Exception {
lsPdu.setIntermediateSystemType((byte) 1);
resultByte = lsPdu.intermediateSystemType();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests intermediateSystemType() setter method.
*/
@Test
public void testSetIntermediateSystemType() throws Exception {
lsPdu.setIntermediateSystemType((byte) 1);
resultByte = lsPdu.intermediateSystemType();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests lspId() getter method.
*/
@Test
public void testLspId() throws Exception {
lsPdu.setLspId(lspId);
resultStr = lsPdu.lspId();
assertThat(resultStr, is(lspId));
}
/**
* Tests lspId() setter method.
*/
@Test
public void testSetLspId() throws Exception {
lsPdu.setLspId(lspId);
resultStr = lsPdu.lspId();
assertThat(resultStr, is(lspId));
}
/**
* Tests pduLength() getter method.
*/
@Test
public void testPduLength() throws Exception {
lsPdu.setPduLength(10);
resultInt = lsPdu.pduLength();
assertThat(resultInt, is(10));
}
/**
* Tests pduLength() setter method.
*/
@Test
public void testSetPduLength() throws Exception {
lsPdu.setPduLength(10);
resultInt = lsPdu.pduLength();
assertThat(resultInt, is(10));
}
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(l1Lsp);
lsPdu.readFrom(channelBuffer);
assertThat(lsPdu, is(notNullValue()));
}
/**
* Tests asBytes() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(l1Lsp);
lsPdu.readFrom(channelBuffer);
result = lsPdu.asBytes();
assertThat(result, is(notNullValue()));
}
/**
* Tests l1l2IsisPduHeader() method.
*/
@Test
public void testL1l2IsisPduHeader() throws Exception {
result = lsPdu.l1l2IsisPduHeader();
assertThat(result, is(notNullValue()));
}
/**
* Tests l1l2LsPduBody() method.
*/
@Test
public void testL1l2LsPduBody() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(l1Lsp);
lsPdu.readFrom(channelBuffer);
result = lsPdu.l1l2LsPduBody();
assertThat(result, is(notNullValue()));
}
/**
* Tests toString() method.
*/
@Test
public void testToString() throws Exception {
assertThat(lsPdu.toString(), is(notNullValue()));
}
/**
* Tests equals() method.
*/
@Test
public void testEquals() throws Exception {
assertThat(lsPdu.equals(new LsPdu(new IsisHeader())), is(true));
}
/**
* Tests hashCode() method.
*/
@Test
public void testHashCode() throws Exception {
resultInt = lsPdu.hashCode();
assertThat(resultInt, is(notNullValue()));
}
}
/*
* Copyright 2016-present 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.isis.io.isispacket.pdu;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.isis.controller.IsisPduType;
import org.onosproject.isis.io.isispacket.IsisHeader;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for P2PHelloPdu.
*/
public class P2PHelloPduTest {
private final byte[] p2p = {
2, 51, 51, 51, 51, 51, 51, 0, 100, 5, -39, -126, 1, 4, 3,
73, 0, 0, -127, 1, -52, -124, 4, -64, -88, 56, 102, 8, -1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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
private IsisHeader isisHeader;
private byte resultByte;
private ChannelBuffer channelBuffer;
private byte[] result;
private int resultInt;
@Before
public void setUp() throws Exception {
isisHeader = new IsisHeader();
isisHeader.setIsisPduType(IsisPduType.P2PHELLOPDU.value());
p2PHelloPdu = new P2PHelloPdu(isisHeader);
channelBuffer = EasyMock.createMock(ChannelBuffer.class);
}
@After
public void tearDown() throws Exception {
isisHeader = null;
p2PHelloPdu = null;
channelBuffer = null;
}
/**
* Tests localCircuitId() getter method.
*/
@Test
public void testLocalCircuitId() throws Exception {
p2PHelloPdu.setLocalCircuitId((byte) 1);
resultByte = p2PHelloPdu.localCircuitId();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests localCircuitId() setter method.
*/
@Test
public void testSetLocalCircuitId() throws Exception {
p2PHelloPdu.setLocalCircuitId((byte) 1);
resultByte = p2PHelloPdu.localCircuitId();
assertThat(resultByte, is((byte) 1));
}
/**
* Tests setVariableLengths() method.
*/
@Test
public void testSetVariableLengths() throws Exception {
}
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(p2p);
p2PHelloPdu.readFrom(channelBuffer);
assertThat(p2PHelloPdu, is(notNullValue()));
}
/**
* Tests asBytes() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(p2p);
p2PHelloPdu.readFrom(channelBuffer);
result = p2PHelloPdu.asBytes();
assertThat(result, is(notNullValue()));
}
/**
* Tests p2PHeader() method.
*/
@Test
public void testP2PHeader() throws Exception {
result = p2PHelloPdu.p2PHeader();
assertThat(result, is(notNullValue()));
}
/**
* Tests p2P2HelloPduBody() method.
*/
@Test
public void testP2P2HelloPduBody() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(p2p);
p2PHelloPdu.readFrom(channelBuffer);
result = p2PHelloPdu.p2P2HelloPduBody();
assertThat(result, is(notNullValue()));
}
/**
* Tests toString() method.
*/
@Test
public void testToString() throws Exception {
assertThat(p2PHelloPdu.toString(), is(notNullValue()));
}
/**
* Tests equals() method.
*/
@Test
public void testEquals() throws Exception {
assertThat(p2PHelloPdu.equals(new P2PHelloPdu(new IsisHeader())), is(true));
}
/**
* Tests hashCode() method.
*/
@Test
public void testHashCode() throws Exception {
resultInt = p2PHelloPdu.hashCode();
assertThat(resultInt, is(notNullValue()));
}
}
/*
* Copyright 2016-present 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.isis.io.isispacket.pdu;
import org.easymock.EasyMock;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.isis.controller.IsisPduType;
import org.onosproject.isis.io.isispacket.IsisHeader;
import org.onosproject.isis.io.isispacket.tlv.AdjacencyStateTlv;
import org.onosproject.isis.io.isispacket.tlv.IsisTlv;
import org.onosproject.isis.io.isispacket.tlv.TlvHeader;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for Psnp.
*/
public class PsnpTest {
private final String srcId = "1111.1111.1111";
private final byte[] psnpPkt = {
0, 35, 41, 41, 41, 41, 41, 41, 0, 9, 16, 4, -81, 18, 52, 18,
52, 0, 18, 0, 0, 0, 0, 0, 42, -94, -29
};
private Psnp psnp;
private IsisHeader isisHeader;
private ChannelBuffer channelBuffer;
private IsisTlv isisTlv;
private TlvHeader tlvHeader;
private List<IsisTlv> resultList;
private String resultStr;
private int resultInt;
private byte[] result;
@Before
public void setUp() throws Exception {
isisHeader = new IsisHeader();
isisHeader.setIsisPduType(IsisPduType.L1PSNP.value());
psnp = new Psnp(isisHeader);
tlvHeader = new TlvHeader();
channelBuffer = EasyMock.createMock(ChannelBuffer.class);
isisTlv = new AdjacencyStateTlv(tlvHeader);
}
@After
public void tearDown() throws Exception {
isisHeader = null;
psnp = null;
channelBuffer = null;
tlvHeader = null;
isisTlv = null;
tlvHeader = null;
}
/**
* Tests addTlv() method.
*/
@Test
public void testAddTlv() throws Exception {
psnp.addTlv(isisTlv);
resultList = psnp.getAllTlv();
assertThat(resultList.size(), is(1));
}
/**
* Tests getAllTlv() method.
*/
@Test
public void testGetAllTlv() throws Exception {
psnp.addTlv(isisTlv);
resultList = psnp.getAllTlv();
assertThat(resultList.size(), is(1));
}
/**
* Tests sourceId() getter method.
*/
@Test
public void testSourceId() throws Exception {
psnp.setSourceId(srcId);
resultStr = psnp.sourceId();
assertThat(resultStr, is(srcId));
}
/**
* Tests sourceId() setter method.
*/
@Test
public void testSetSourceId() throws Exception {
psnp.setSourceId(srcId);
resultStr = psnp.sourceId();
assertThat(resultStr, is(srcId));
}
/**
* Tests pduLength() getter method.
*/
@Test
public void testPduLength() throws Exception {
psnp.setPduLength(10);
resultInt = psnp.pduLength();
assertThat(resultInt, is(10));
}
/**
* Tests pduLength() setter method.
*/
@Test
public void testSetPduLength() throws Exception {
psnp.setPduLength(10);
resultInt = psnp.pduLength();
assertThat(resultInt, is(10));
}
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(psnpPkt);
psnp.readFrom(channelBuffer);
assertThat(psnp, is(notNullValue()));
}
/**
* Tests lasBytes() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(psnpPkt);
psnp.readFrom(channelBuffer);
result = psnp.asBytes();
assertThat(result, is(notNullValue()));
}
/**
* Tests isisPduHeader() method.
*/
@Test
public void testIsisPduHeader() throws Exception {
result = psnp.isisPduHeader();
assertThat(result, is(notNullValue()));
}
/**
* Tests partialSequenceNumberPduBody() method.
*/
@Test
public void testPartialSequenceNumberPduBody() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(psnpPkt);
psnp.readFrom(channelBuffer);
result = psnp.partialSequenceNumberPduBody();
assertThat(result, is(notNullValue()));
}
/**
* Tests toString() method.
*/
@Test
public void testToString() throws Exception {
assertThat((psnp.toString()), is(notNullValue()));
}
/**
* Tests equals() method.
*/
@Test
public void testEquals() throws Exception {
assertThat(psnp.equals(new Psnp(new IsisHeader())), is(true));
}
/**
* Tests hashCode() method.
*/
@Test
public void testHashCode() throws Exception {
int hashCode = psnp.hashCode();
assertThat(hashCode, is(notNullValue()));
}
}
/*
* Copyright 2016-present 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.isis.io.util;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* Unit test class for ChecksumCalculator.
*/
public class ChecksumCalculatorTest {
private final byte[] l1Lsp = {
-125, 27, 1, 0, 18, 1, 0, 0, 0, 86, 4, -81, 34, 34, 34,
34, 34, 34, 0, 0, 0, 0, 0, 9, 99, 11, 1, 1, 4, 3, 73,
0, 10, -127, 1, -52, -119, 2, 82, 50, -124, 4, -64, -88, 10, 1, -128,
24, 10, -128, -128, -128, 10, 0, 10, 0, -1, -1, -1, -4, 10, -128, -128,
-128, -64, -88, 10, 0, -1, -1, -1, 0, 2, 12, 0, 10, -128, -128, -128,
51, 51, 51, 51, 51, 51, 2
};
private ChecksumCalculator calculator;
private byte[] result;
private boolean result1;
@Before
public void setUp() throws Exception {
calculator = new ChecksumCalculator();
}
@After
public void tearDown() throws Exception {
calculator = null;
}
/**
* Tests validateLspCheckSum() method.
*/
@Test
public void testValidateLspCheckSum() throws Exception {
result1 = calculator.validateLspCheckSum(l1Lsp, IsisConstants.CHECKSUMPOSITION,
IsisConstants.CHECKSUMPOSITION + 1);
assertThat(result1, is(true));
}
/**
* Tests calculateLspChecksum() method.
*/
@Test
public void testCalculateLspChecksum() throws Exception {
result = calculator.calculateLspChecksum(l1Lsp, IsisConstants.CHECKSUMPOSITION,
IsisConstants.CHECKSUMPOSITION + 1);
assertThat(result[0],
is(l1Lsp[IsisConstants.CHECKSUMPOSITION]));
assertThat(result[1],
is(l1Lsp[IsisConstants.CHECKSUMPOSITION + 1]));
}
}
\ No newline at end of file
/*
* Copyright 2016-present 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.isis.io.util;
import com.google.common.primitives.Bytes;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.isis.controller.IsisPduType;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
/**
* Unit test class for IsisUtil.
*/
public class IsisUtilTest {
private final String systemId = "2929.2929.2929";
private final String lanId = "2929.2929.2929.01";
private final String areaAddres = "490001";
private final byte[] l1Lsp = {
-125, 27, 1, 0, 18, 1, 0, 0, 0, 86, 4, -81, 34, 34, 34,
34, 34, 34, 0, 0, 0, 0, 0, 9, 99, 11, 1, 1, 4, 3, 73,
0, 10, -127, 1, -52, -119, 2, 82, 50, -124, 4, -64, -88, 10, 1, -128,
24, 10, -128, -128, -128, 10, 0, 10, 0, -1, -1, -1, -4, 10, -128, -128,
-128, -64, -88, 10, 0, -1, -1, -1, 0, 2, 12, 0, 10, -128, -128, -128,
51, 51, 51, 51, 51, 51, 2
};
private final byte[] intger = {0, 0, 0, 1};
private Ip4Address ip4Address1 = Ip4Address.valueOf("10.10.10.10");
private Ip4Address ip4Address2 = Ip4Address.valueOf("10.10.10.11");
private Ip4Address mask = Ip4Address.valueOf("255.255.255.0");
private boolean result;
private String result1;
private byte[] result2;
private int result3;
private long result4;
private byte[] prefixBytes = {0, 0, 0, 1};
private String prefix = "192.16.17";
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
/**
* Tests sameNetwork() method.
*/
@Test
public void testSameNetwork() throws Exception {
result = IsisUtil.sameNetwork(ip4Address1, ip4Address2, mask.toOctets());
assertThat(result, is(true));
}
/**
* Tests systemId() method.
*/
@Test
public void testSystemId() throws Exception {
result1 = IsisUtil.systemId(Bytes.toArray(
IsisUtil.sourceAndLanIdToBytes(systemId)));
assertThat(result1, is(systemId));
}
/**
* Tests systemIdPlus() method.
*/
@Test
public void testSystemIdPlus() throws Exception {
result1 = IsisUtil.systemIdPlus(Bytes.toArray(
IsisUtil.sourceAndLanIdToBytes(lanId)));
assertThat(result1, is(lanId));
}
/**
* Tests areaAddres() method.
*/
@Test
public void testAreaAddres() throws Exception {
result1 = IsisUtil.areaAddres(Bytes.toArray(
IsisUtil.areaAddressToBytes(areaAddres)));
assertThat(result1, is(areaAddres));
}
/**
* Tests areaAddressToBytes() method.
*/
@Test
public void testAreaAddressToBytes() throws Exception {
result2 = Bytes.toArray(IsisUtil.areaAddressToBytes(areaAddres));
assertThat(result2, is(notNullValue()));
}
/**
* Tests getPduHeaderLength() method.
*/
@Test
public void testGetPduHeaderLength() throws Exception {
result3 = IsisUtil.getPduHeaderLength(IsisPduType.L1CSNP.value());
assertThat(result3, is(33));
result3 = IsisUtil.getPduHeaderLength(IsisPduType.L1PSNP.value());
assertThat(result3, is(17));
result3 = IsisUtil.getPduHeaderLength(IsisPduType.L1HELLOPDU.value());
assertThat(result3, is(27));
result3 = IsisUtil.getPduHeaderLength(IsisPduType.P2PHELLOPDU.value());
assertThat(result3, is(20));
}
/**
* Tests addLengthAndMarkItInReserved() method.
*/
@Test
public void testAddLengthAndMarkItInReserved() throws Exception {
result2 = IsisUtil.addLengthAndMarkItInReserved(l1Lsp,
IsisConstants.LENGTHPOSITION, IsisConstants.LENGTHPOSITION + 1,
IsisConstants.RESERVEDPOSITION);
assertThat(result2, is(notNullValue()));
}
/**
* Tests addChecksum() method.
*/
@Test
public void testAddChecksum() throws Exception {
result2 = IsisUtil.addChecksum(l1Lsp,
IsisConstants.CHECKSUMPOSITION, IsisConstants.CHECKSUMPOSITION + 1);
assertThat(result2, is(notNullValue()));
}
/**
* Tests framePacket() method.
*/
@Test
public void testFramePacket() throws Exception {
result2 = IsisUtil.framePacket(l1Lsp, 2);
assertThat(result2, is(notNullValue()));
}
/**
* Tests sourceAndLanIdToBytes() method.
*/
@Test
public void testSourceAndLanIdToBytes() throws Exception {
result2 = Bytes.toArray(IsisUtil.sourceAndLanIdToBytes(lanId));
assertThat(result2, is(notNullValue()));
}
/**
* Tests getPaddingTlvs() method.
*/
@Test
public void testGetPaddingTlvs() throws Exception {
result2 = IsisUtil.getPaddingTlvs(250);
assertThat(result2, is(notNullValue()));
}
/**
* Tests convertToTwoBytes() method.
*/
@Test
public void testConvertToTwoBytes() throws Exception {
result2 = IsisUtil.convertToTwoBytes(250);
assertThat(result2.length, is(2));
}
/**
* Tests convertToFourBytes() method.
*/
@Test
public void testConvertToFourBytes() throws Exception {
result2 = IsisUtil.convertToFourBytes(250);
assertThat(result2.length, is(4));
}
/**
* Tests byteToInteger() method.
*/
@Test
public void testByteToInteger() throws Exception {
result3 = IsisUtil.byteToInteger(intger);
assertThat(result3, is(1));
}
/**
* Tests byteToInteger() method.
*/
@Test
public void testByteToLong() throws Exception {
result4 = IsisUtil.byteToLong(intger);
assertThat(result4, is(1L));
}
/**
* Tests convertToFourBytes() method.
*/
@Test
public void testConvertToFourBytes1() throws Exception {
result2 = IsisUtil.convertToFourBytes(250L);
assertThat(result2.length, is(4));
}
/**
* Tests toFourBitBinary() method.
*/
@Test
public void testToEightBitBinary() throws Exception {
result1 = IsisUtil.toEightBitBinary("01");
assertThat(result1.length(), is(8));
}
/**
* Tests toFourBitBinary() method.
*/
@Test
public void testToFourBitBinary() throws Exception {
result1 = IsisUtil.toFourBitBinary("01");
assertThat(result1.length(), is(4));
}
/**
* Tests convertToThreeBytes() method.
*/
@Test
public void testConvertToThreeBytes() throws Exception {
result2 = IsisUtil.convertToThreeBytes(30);
assertThat(result2.length, is(3));
}
/**
* Tests prefixConversion() method.
*/
@Test
public void testPrefixConversion() throws Exception {
result1 = IsisUtil.prefixConversion(prefixBytes);
assertThat(result1, is(notNullValue()));
}
/**
* Tests prefixToBytes() method.
*/
@Test
public void testPrefixToBytes() throws Exception {
result2 = IsisUtil.prefixToBytes(prefix);
assertThat(result2, is(notNullValue()));
}
}
\ No newline at end of file
/*
* Copyright 2016-present 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.isis.io.util;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onosproject.isis.controller.IsisInterface;
import org.onosproject.isis.controller.IsisLsdb;
import org.onosproject.isis.controller.IsisPduType;
import org.onosproject.isis.io.isispacket.IsisHeader;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* Unit test class for LspGenerator.
*/
public class LspGeneratorTest {
private LspGenerator generator;
private IsisHeader isisHeader;
private IsisInterface isisInterface;
private IsisLsdb isisLsdb;
@Before
public void setUp() throws Exception {
generator = new LspGenerator();
isisLsdb = EasyMock.createMock(IsisLsdb.class);
isisInterface = EasyMock.createMock(IsisInterface.class);
}
@After
public void tearDown() throws Exception {
generator = null;
}
/**
* Tests getHeader() method.
*/
@Test
public void testGetHeader() throws Exception {
isisHeader = generator.getHeader(IsisPduType.L1CSNP);
assertThat(isisHeader, is(instanceOf(IsisHeader.class)));
}
}
\ No newline at end of file