use of org.onosproject.lisp.msg.protocols.LispEncapsulatedControl.EcmBuilder 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();
}
use of org.onosproject.lisp.msg.protocols.LispEncapsulatedControl.EcmBuilder 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();
}
Aggregations