SureshBR
Committed by Gerrit Code Review

UT added for Pcep TLVs

Change-Id: Ic231a2af9dafa2a5ee235808066aa531fea95242
......@@ -40,6 +40,17 @@ public class PcepNaiIpv4Adjacency implements PcepNai {
this.remoteIpv4Addr = remoteIpv4;
}
/**
* Returns Object of Pcep nai Ipv4 Adjacency.
*
* @param localIpv4Addr local ipv4 address
* @param remoteIpv4Addr remote ipv4 address
* @return Object of Pcep nai Ipv4 Adjacency
*/
public static PcepNaiIpv4Adjacency of(int localIpv4Addr, int remoteIpv4Addr) {
return new PcepNaiIpv4Adjacency(localIpv4Addr, remoteIpv4Addr);
}
@Override
public byte getType() {
return ST_TYPE;
......
......@@ -39,6 +39,16 @@ public class PcepNaiIpv6NodeId implements PcepNai {
this.ipv6NodeId = value;
}
/**
* Return object of Pcep Nai Ipv6 Node ID.
*
* @param ipv6NodeId Ipv6 node ID.
* @return object of Pcep Nai Ipv6 Node ID.
*/
public static PcepNaiIpv6NodeId of(byte[] ipv6NodeId) {
return new PcepNaiIpv6NodeId(ipv6NodeId);
}
@Override
public byte getType() {
return ST_TYPE;
......
/*
* 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.pcepio;
import org.junit.Test;
import org.onosproject.pcepio.types.NexthopIPv4addressTlv;
import com.google.common.testing.EqualsTester;
/**
* Equality test for NexthopIPv4addressTlv.
*/
public class NexthopIPv4addressTlvTest {
private final NexthopIPv4addressTlv tlv1 = new NexthopIPv4addressTlv(0x0A);
private final NexthopIPv4addressTlv sameAsTlv1 = new NexthopIPv4addressTlv(0x0A);
private final NexthopIPv4addressTlv tlv2 = NexthopIPv4addressTlv.of(0x0B);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
/*
* 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.pcepio;
import org.junit.Test;
import org.onosproject.pcepio.types.NexthopIPv6addressTlv;
import com.google.common.testing.EqualsTester;
/**
* Equality test for NexthopIPv6addressTlv.
*/
public class NexthopIPv6addressTlvTest {
private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00 };
private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 };
private final NexthopIPv6addressTlv tlv1 = NexthopIPv6addressTlv.of(b1);
private final NexthopIPv6addressTlv sameAsTlv1 = NexthopIPv6addressTlv.of(b1);
private final NexthopIPv6addressTlv tlv2 = NexthopIPv6addressTlv.of(b2);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
}
}
/*
* 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.pcepio;
import org.junit.Test;
import org.onosproject.pcepio.types.NexthopUnnumberedIPv4IDTlv;
import com.google.common.testing.EqualsTester;
/**
* Equality test for NexthopUnnumberedIPv4IDTlv.
*/
public class NexthopUnnumberedIPv4IDTlvTest {
private final NexthopUnnumberedIPv4IDTlv tlv1 = new NexthopUnnumberedIPv4IDTlv(0x0A, 0x0A);
private final NexthopUnnumberedIPv4IDTlv sameAsTlv1 = new NexthopUnnumberedIPv4IDTlv(0x0A, 0x0A);
private final NexthopUnnumberedIPv4IDTlv tlv2 = NexthopUnnumberedIPv4IDTlv.of(0x0B, 0x0B);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
/*
* 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.pcepio;
import org.junit.Test;
import org.onosproject.pcepio.types.PathKeySubObject;
import com.google.common.testing.EqualsTester;
/**
* Test of the PathKeySubObject.
*/
public class PathKeySubObjectTest {
private final PathKeySubObject tlv1 = new PathKeySubObject((short) 0x0A, 0x0A);
private final PathKeySubObject sameAsTlv1 = PathKeySubObject.of((short) 0x0A, 0x0A);
private final PathKeySubObject tlv2 = new PathKeySubObject((short) 0x0B, 0x0B);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
/*
* 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.pcepio;
import org.junit.Test;
import org.onosproject.pcepio.types.PcepNaiIpv4Adjacency;
import com.google.common.testing.EqualsTester;
/**
* Equality test for PcepNaiIpv4Adjacency.
*/
public class PcepNaiIpv4AdjacencyTest {
private final PcepNaiIpv4Adjacency obj1 = PcepNaiIpv4Adjacency.of(2, 16);
private final PcepNaiIpv4Adjacency sameAsObj1 = PcepNaiIpv4Adjacency.of(2, 16);
private final PcepNaiIpv4Adjacency obj2 = PcepNaiIpv4Adjacency.of(3, 16);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(obj1, sameAsObj1).addEqualityGroup(obj2).testEquals();
}
}
/*
* 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.pcepio;
import org.junit.Test;
import org.onosproject.pcepio.types.PcepNaiIpv6NodeId;
import com.google.common.testing.EqualsTester;
/**
* Equality test for PcepNaiIpv6NodeId.
*/
public class PcepNaiIpv6NodeIdTest {
private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02,
0x00, 0x00 };
private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02,
0x00, 0x00 };
private final PcepNaiIpv6NodeId tlv1 = PcepNaiIpv6NodeId.of(b1);
private final PcepNaiIpv6NodeId sameAsTlv1 = PcepNaiIpv6NodeId.of(b1);
private final PcepNaiIpv6NodeId tlv2 = PcepNaiIpv6NodeId.of(b2);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
}
}
/*
* 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.pcepio;
import org.junit.Test;
import org.onosproject.pcepio.types.RoutingUniverseTLV;
import com.google.common.testing.EqualsTester;
/**
* Equality test for RoutingUniverseTlv.
*/
public class RoutingUniverseTLVTest {
private final RoutingUniverseTLV tlv1 = RoutingUniverseTLV.of(2);
private final RoutingUniverseTLV tlv2 = RoutingUniverseTLV.of(2);
private final RoutingUniverseTLV tlv3 = RoutingUniverseTLV.of(3);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
}
}