Search in sources :

Example 1 with DefaultEcmBuilder

use of org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.DefaultEcmBuilder in project onos by opennetworkinglab.

the class LispMapResolver method cloneEcm.

/**
 * Clones ECM from original ECM.
 *
 * @param ecm original ECM
 * @return cloned ECM
 */
private LispEncapsulatedControl cloneEcm(LispEncapsulatedControl ecm) {
    EcmBuilder ecmBuilder = new DefaultEcmBuilder();
    ecmBuilder.innerLispMessage(ecm.getControlMessage());
    ecmBuilder.isSecurity(ecm.isSecurity());
    ecmBuilder.innerIpHeader(ecm.innerIpHeader());
    ecmBuilder.innerUdpHeader(ecm.innerUdp());
    return ecmBuilder.build();
}
Also used : DefaultEcmBuilder(org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.DefaultEcmBuilder) EcmBuilder(org.onosproject.lisp.msg.protocols.LispEncapsulatedControl.EcmBuilder) DefaultEcmBuilder(org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.DefaultEcmBuilder)

Example 2 with DefaultEcmBuilder

use of org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.DefaultEcmBuilder in project onos by opennetworkinglab.

the class DefaultLispEncapsulatedControlTest method setup.

@Before
public void setup() {
    // Creates ecm1
    EcmBuilder builder1 = new DefaultEcmBuilder();
    IP innerIp1 = new IPv4().setSourceAddress(ECM1_SRC_IP).setDestinationAddress(ECM1_DST_IP).setProtocol(IPv4.PROTOCOL_UDP).setVersion((byte) (4 & 0xf));
    UDP innerUdp1 = new UDP().setSourcePort(1).setDestinationPort(2);
    RegisterBuilder msgBuilder = new DefaultRegisterBuilder();
    List<LispMapRecord> records1 = ImmutableList.of(getMapRecord(), getMapRecord());
    LispMapRegister innerMsg1 = msgBuilder.withIsProxyMapReply(true).withIsWantMapNotify(false).withKeyId((short) 1).withAuthKey(AUTH_KEY).withNonce(1L).withMapRecords(records1).build();
    ecm1 = builder1.isSecurity(false).innerIpHeader(innerIp1).innerUdpHeader(innerUdp1).innerLispMessage(innerMsg1).build();
    // Creates sameAsEcm1
    EcmBuilder builder2 = new DefaultEcmBuilder();
    IP innerIp2 = new IPv4().setSourceAddress(ECM1_SRC_IP).setDestinationAddress(ECM1_DST_IP).setProtocol(IPv4.PROTOCOL_UDP);
    UDP innerUdp2 = new UDP().setSourcePort(1).setDestinationPort(2);
    RegisterBuilder msgBuilder2 = new DefaultRegisterBuilder();
    List<LispMapRecord> records2 = ImmutableList.of(getMapRecord(), getMapRecord());
    LispMapRegister innerMsg2 = msgBuilder2.withIsProxyMapReply(true).withIsWantMapNotify(false).withKeyId((short) 1).withAuthKey(AUTH_KEY).withNonce(1L).withMapRecords(records2).build();
    sameAsEcm1 = builder2.isSecurity(false).innerIpHeader(innerIp2).innerUdpHeader(innerUdp2).innerLispMessage(innerMsg2).build();
    // Creates ecm2
    EcmBuilder builder3 = new DefaultEcmBuilder();
    IP innerIp3 = new IPv4().setSourceAddress(ECM2_SRC_IP).setDestinationAddress(ECM2_DST_IP).setProtocol(IPv4.PROTOCOL_UDP);
    UDP innerUdp3 = new UDP().setSourcePort(10).setDestinationPort(20);
    RegisterBuilder msgBuilder3 = new DefaultRegisterBuilder();
    List<LispMapRecord> records3 = ImmutableList.of(getMapRecord(), getMapRecord());
    LispMapRegister innerMsg3 = msgBuilder3.withIsProxyMapReply(true).withIsWantMapNotify(false).withKeyId((short) 2).withAuthKey(AUTH_KEY).withNonce(1L).withMapRecords(records3).build();
    ecm2 = builder3.isSecurity(false).innerIpHeader(innerIp3).innerUdpHeader(innerUdp3).innerLispMessage(innerMsg3).build();
}
Also used : UDP(org.onlab.packet.UDP) DefaultEcmBuilder(org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.DefaultEcmBuilder) EcmBuilder(org.onosproject.lisp.msg.protocols.LispEncapsulatedControl.EcmBuilder) IP(org.onlab.packet.IP) IPv4(org.onlab.packet.IPv4) DefaultEcmBuilder(org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.DefaultEcmBuilder) RegisterBuilder(org.onosproject.lisp.msg.protocols.LispMapRegister.RegisterBuilder) DefaultRegisterBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRegister.DefaultRegisterBuilder) DefaultRegisterBuilder(org.onosproject.lisp.msg.protocols.DefaultLispMapRegister.DefaultRegisterBuilder) Before(org.junit.Before)

Aggregations

DefaultEcmBuilder (org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.DefaultEcmBuilder)2 EcmBuilder (org.onosproject.lisp.msg.protocols.LispEncapsulatedControl.EcmBuilder)2 Before (org.junit.Before)1 IP (org.onlab.packet.IP)1 IPv4 (org.onlab.packet.IPv4)1 UDP (org.onlab.packet.UDP)1 DefaultRegisterBuilder (org.onosproject.lisp.msg.protocols.DefaultLispMapRegister.DefaultRegisterBuilder)1 RegisterBuilder (org.onosproject.lisp.msg.protocols.LispMapRegister.RegisterBuilder)1