Search in sources :

Example 11 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class DefaultLispInfoReplyTest method testConstruction.

@Test
public void testConstruction() {
    DefaultLispInfoReply reply = (DefaultLispInfoReply) reply1;
    LispIpv4Address address = new LispIpv4Address(IpAddress.valueOf("192.168.1.4"));
    short msUdpPortNumber1 = 80;
    short etrUdpPortNumber1 = 100;
    LispIpv4Address globalEtrRlocAddress1 = new LispIpv4Address(IpAddress.valueOf("192.168.1.1"));
    LispIpv4Address msRlocAddress1 = new LispIpv4Address(IpAddress.valueOf("192.168.1.2"));
    LispIpv4Address privateEtrRlocAddress1 = new LispIpv4Address(IpAddress.valueOf("192.168.1.3"));
    LispNatLcafAddress natLcafAddress = new NatAddressBuilder().withLength((short) 0).withMsUdpPortNumber(msUdpPortNumber1).withEtrUdpPortNumber(etrUdpPortNumber1).withGlobalEtrRlocAddress(globalEtrRlocAddress1).withMsRlocAddress(msRlocAddress1).withPrivateEtrRlocAddress(privateEtrRlocAddress1).build();
    assertThat(reply.isInfoReply(), is(true));
    assertThat(reply.getNonce(), is(1L));
    assertThat(reply.getKeyId(), is((short) 1));
    assertThat(reply.getMaskLength(), is((byte) 1));
    assertThat(reply.getPrefix(), is(address));
    assertThat(reply.getNatLcafAddress(), is(natLcafAddress));
}
Also used : NatAddressBuilder(org.onosproject.lisp.msg.types.lcaf.LispNatLcafAddress.NatAddressBuilder) LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) LispNatLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispNatLcafAddress) Test(org.junit.Test)

Example 12 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class DefaultLispInfoRequestTest method testConstruction.

@Test
public void testConstruction() {
    DefaultLispInfoRequest request = (DefaultLispInfoRequest) request1;
    LispIpv4Address address = new LispIpv4Address(IpAddress.valueOf("192.168.1.1"));
    assertThat(request.isInfoReply(), is(false));
    assertThat(request.getNonce(), is(1L));
    assertThat(request.getKeyId(), is((short) 1));
    assertThat(request.getMaskLength(), is((byte) 1));
    assertThat(request.getPrefix(), is(address));
}
Also used : LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) Test(org.junit.Test)

Example 13 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class LispSourceDestLcafAddressTest method setup.

@Before
public void setup() {
    SourceDestAddressBuilder builder1 = new SourceDestAddressBuilder();
    LispIpv4Address srcAddress1 = new LispIpv4Address(IpAddress.valueOf("192.168.1.1"));
    LispIpv4Address dstAddress1 = new LispIpv4Address(IpAddress.valueOf("192.168.1.2"));
    address1 = builder1.withReserved((short) 1).withSrcMaskLength((byte) 0x01).withDstMaskLength((byte) 0x01).withSrcPrefix(srcAddress1).withDstPrefix(dstAddress1).build();
    SourceDestAddressBuilder builder2 = new SourceDestAddressBuilder();
    sameAsAddress1 = builder2.withReserved((short) 1).withSrcMaskLength((byte) 0x01).withDstMaskLength((byte) 0x01).withSrcPrefix(srcAddress1).withDstPrefix(dstAddress1).build();
    SourceDestAddressBuilder builder3 = new SourceDestAddressBuilder();
    LispIpv4Address srcAddress2 = new LispIpv4Address(IpAddress.valueOf("192.168.2.1"));
    LispIpv4Address dstAddress2 = new LispIpv4Address(IpAddress.valueOf("192.168.2.2"));
    address2 = builder3.withReserved((short) 2).withSrcMaskLength((byte) 0x02).withDstMaskLength((byte) 0x02).withSrcPrefix(srcAddress2).withDstPrefix(dstAddress2).build();
}
Also used : LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) SourceDestAddressBuilder(org.onosproject.lisp.msg.types.lcaf.LispSourceDestLcafAddress.SourceDestAddressBuilder) Before(org.junit.Before)

Example 14 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class LispSourceDestLcafAddressTest method testConstruction.

@Test
public void testConstruction() {
    LispSourceDestLcafAddress sourceDestLcafAddress = address1;
    LispIpv4Address srcAddress = new LispIpv4Address(IpAddress.valueOf("192.168.1.1"));
    LispIpv4Address dstAddress = new LispIpv4Address(IpAddress.valueOf("192.168.1.2"));
    assertThat(sourceDestLcafAddress.getReserved(), is((short) 1));
    assertThat(sourceDestLcafAddress.getSrcMaskLength(), is((byte) 0x01));
    assertThat(sourceDestLcafAddress.getDstMaskLength(), is((byte) 0x01));
    assertThat(sourceDestLcafAddress.getSrcPrefix(), is(srcAddress));
    assertThat(sourceDestLcafAddress.getDstPrefix(), is(dstAddress));
}
Also used : LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) Test(org.junit.Test)

Example 15 with LispIpv4Address

use of org.onosproject.lisp.msg.types.LispIpv4Address in project onos by opennetworkinglab.

the class LispTeLcafAddressTest method testConstruction.

@Test
public void testConstruction() {
    LispTeLcafAddress teLcafAddress = address1;
    LispIpv4Address rtrRloc1 = new LispIpv4Address(IpAddress.valueOf("192.168.1.1"));
    LispIpv4Address rtrRloc2 = new LispIpv4Address(IpAddress.valueOf("192.168.1.2"));
    assertThat("lookup flag value in TeRecord is not correct", teLcafAddress.getTeRecords().get(0).isLookup(), is(false));
    assertThat("RLOC probe flag value in TeRecord is not correct", teLcafAddress.getTeRecords().get(0).isRlocProbe(), is(false));
    assertThat("strict flag value in TeRecord is not correct", teLcafAddress.getTeRecords().get(0).isStrict(), is(false));
    assertThat("RTR RLOC address in TeRecord is not correct", teLcafAddress.getTeRecords().get(0).getRtrRlocAddress(), is(rtrRloc1));
    assertThat("lookup flag value in TeRecord in not correct", teLcafAddress.getTeRecords().get(1).isLookup(), is(false));
    assertThat("RLOC probe flag value in TeRecord is not correct", teLcafAddress.getTeRecords().get(1).isRlocProbe(), is(true));
    assertThat("strict flag value in TeRecord is not correct", teLcafAddress.getTeRecords().get(1).isStrict(), is(false));
    assertThat("RTR RLOC address in TeRecord is not correct", teLcafAddress.getTeRecords().get(1).getRtrRlocAddress(), is(rtrRloc2));
}
Also used : LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) Test(org.junit.Test)

Aggregations

LispIpv4Address (org.onosproject.lisp.msg.types.LispIpv4Address)49 Test (org.junit.Test)19 Before (org.junit.Before)18 LispAfiAddress (org.onosproject.lisp.msg.types.LispAfiAddress)10 DefaultMapRecordBuilder (org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder)8 MapRecordBuilder (org.onosproject.lisp.msg.protocols.LispMapRecord.MapRecordBuilder)8 LispIpv6Address (org.onosproject.lisp.msg.types.LispIpv6Address)6 LispEidRecord (org.onosproject.lisp.msg.protocols.LispEidRecord)4 LispMapRecord (org.onosproject.lisp.msg.protocols.LispMapRecord)4 NatAddressBuilder (org.onosproject.lisp.msg.types.lcaf.LispNatLcafAddress.NatAddressBuilder)4 IpAddress (org.onlab.packet.IpAddress)3 DefaultLocatorBuilder (org.onosproject.lisp.msg.protocols.DefaultLispLocator.DefaultLocatorBuilder)3 UnknownHostException (java.net.UnknownHostException)2 IpPrefix (org.onlab.packet.IpPrefix)2 DefaultInfoReplyBuilder (org.onosproject.lisp.msg.protocols.DefaultLispInfoReply.DefaultInfoReplyBuilder)2 DefaultInfoRequestBuilder (org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.DefaultInfoRequestBuilder)2 DefaultRequestBuilder (org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.DefaultRequestBuilder)2 DefaultReferralRecordBuilder (org.onosproject.lisp.msg.protocols.DefaultLispReferralRecord.DefaultReferralRecordBuilder)2 InfoReplyBuilder (org.onosproject.lisp.msg.protocols.LispInfoReply.InfoReplyBuilder)2 InfoRequestBuilder (org.onosproject.lisp.msg.protocols.LispInfoRequest.InfoRequestBuilder)2